Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hcana
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jlab
hallc
analyzer_software
hcana
Commits
29915353
Commit
29915353
authored
6 years ago
by
Stephen A. Wood
Committed by
Stephen Wood
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Improve THcHelicity so it doesn't loose sync.
parent
de986a69
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/THcHelicity.cxx
+35
-18
35 additions, 18 deletions
src/THcHelicity.cxx
src/THcHelicity.h
+4
-4
4 additions, 4 deletions
src/THcHelicity.h
with
39 additions
and
22 deletions
src/THcHelicity.cxx
+
35
−
18
View file @
29915353
...
@@ -32,7 +32,6 @@ THcHelicity::THcHelicity( const char* name, const char* description,
...
@@ -32,7 +32,6 @@ THcHelicity::THcHelicity( const char* name, const char* description,
// for( Int_t i = 0; i < NHIST; ++i )
// for( Int_t i = 0; i < NHIST; ++i )
// fHisto[i] = 0;
// fHisto[i] = 0;
// memset(fHbits, 0, sizeof(fHbits));
// memset(fHbits, 0, sizeof(fHbits));
}
}
//_____________________________________________________________________________
//_____________________________________________________________________________
...
@@ -63,6 +62,8 @@ THaAnalysisObject::EStatus THcHelicity::Init(const TDatime& date) {
...
@@ -63,6 +62,8 @@ THaAnalysisObject::EStatus THcHelicity::Init(const TDatime& date) {
fFirstEvProcessed
=
kFALSE
;
fFirstEvProcessed
=
kFALSE
;
fActualHelicity
=
kUnknown
;
fActualHelicity
=
kUnknown
;
fPredictedHelicity
=
kUnknown
;
fPredictedHelicity
=
kUnknown
;
fLastMPSTime
=
0
;
fFoundMPS
=
kFALSE
;
// Call initializer for base class.
// Call initializer for base class.
// This also calls `ReadDatabase` and `DefineVariables`.
// This also calls `ReadDatabase` and `DefineVariables`.
...
@@ -255,25 +256,32 @@ Int_t THcHelicity::Decode( const THaEvData& evdata )
...
@@ -255,25 +256,32 @@ Int_t THcHelicity::Decode( const THaEvData& evdata )
fActualHelicity
=
fIsMPS
?
kUnknown
:
fReportedHelicity
;
fActualHelicity
=
fIsMPS
?
kUnknown
:
fReportedHelicity
;
return
0
;
return
0
;
}
}
Long64_t
lastlastmpstime
=
fLastMPSTime
;
if
(
fFirstEvProcessed
)
{
// Normal processing
if
(
fFirstEvProcessed
)
{
// Normal processing
Int_t
missed
=
0
;
Int_t
missed
=
0
;
// Double_t elapsed_time = (fTITime - fFirstEvTime)/250000000.0;
// Double_t elapsed_time = (fTITime - fFirstEvTime)/250000000.0;
if
(
fIsMPS
)
{
if
(
fIsMPS
)
{
fFoundMPS
=
kTRUE
;
if
(
fFoundMPS
)
{
Int_t
missed
=
TMath
::
Nint
(
floor
((
fTITime
-
fLastMPSTime
)
/
fTIPeriod
));
missed
=
TMath
::
Nint
(
fTITime
/
fTIPeriod
-
fLastMPSTime
/
fTIPeriod
);
// cout << fTITime/250000000.0 << " " << fNCycle << " MPS " << fReportedHelicity <<endl;
if
(
missed
<
1
)
{
// was <=1
if
(
missed
<=
1
)
{
fLastMPSTime
=
(
fTITime
+
fLastMPSTime
+
missed
*
fTIPeriod
)
/
2
;
fIsNewCycle
=
kTRUE
;
fActualHelicity
=
kUnknown
;
fPredictedHelicity
=
kUnknown
;
}
else
{
fLastMPSTime
=
(
fLastMPSTime
+
fTITime
-
missed
*
fTIPeriod
)
/
2
;
}
// If there is a skip, pass it off to next non MPS event
// Need to also check here for missed MPS's
// cout << "Found MPS" << endl;
// check for Nint((time-last)/period) > 1
}
else
{
fFoundMPS
=
kTRUE
;
fLastMPSTime
=
fTITime
;
fLastMPSTime
=
fTITime
;
fIsNewCycle
=
kTRUE
;
}
fActualHelicity
=
kUnknown
;
fPredictedHelicity
=
kUnknown
;
}
// If there is a skip, pass it off to next non MPS event
// Need to also check here for missed MPS's
// cout << "Found MPS" << endl;
// check for Nint((time-last)/period) > 1
}
else
if
(
fFoundMPS
)
{
//
}
else
if
(
fFoundMPS
)
{
//
if
(
fTITime
-
fLastMPSTime
>
fTIPeriod
)
{
// We missed MPS periods
if
(
fTITime
-
fLastMPSTime
>
fTIPeriod
)
{
// We missed MPS periods
Int_t
missed
=
TMath
::
Nint
(
floor
((
fTITime
-
fLastMPSTime
)
/
fTIPeriod
));
missed
=
TMath
::
Nint
(
floor
((
fTITime
-
fLastMPSTime
)
/
fTIPeriod
));
if
(
missed
>
1
)
{
if
(
missed
>
1
)
{
// cout << "Missed " << missed << " MPSes" << endl;
// cout << "Missed " << missed << " MPSes" << endl;
Int_t
newNCycle
=
fNCycle
+
missed
-
1
;
// How many cycles really missed
Int_t
newNCycle
=
fNCycle
+
missed
-
1
;
// How many cycles really missed
...
@@ -282,6 +290,14 @@ Int_t THcHelicity::Decode( const THaEvData& evdata )
...
@@ -282,6 +290,14 @@ Int_t THcHelicity::Decode( const THaEvData& evdata )
fRingSeed_reported
=
RanBit30
(
fRingSeed_reported
);
fRingSeed_reported
=
RanBit30
(
fRingSeed_reported
);
fRingSeed_actual
=
RanBit30
(
fRingSeed_actual
);
fRingSeed_actual
=
RanBit30
(
fRingSeed_actual
);
}
}
int
quartetphase
=
(
newNCycle
-
fFirstCycle
)
%
4
;
// cout << " " << fNCycle << " " << newNCycle << " " << fFirstCycle << " " << quartets_missed << " " << quartetphase << endl;
fQuartetStartHelicity
=
(
fRingSeed_actual
&
1
)
?
kPlus
:
kMinus
;
fQuartetStartPredictedHelicity
=
(
fRingSeed_reported
&
1
)
?
kPlus
:
kMinus
;
fActualHelicity
=
(
quartetphase
==
0
||
quartetphase
==
3
)
?
fQuartetStartHelicity
:-
fQuartetStartHelicity
;
fPredictedHelicity
=
(
quartetphase
==
0
||
quartetphase
==
3
)
?
fQuartetStartPredictedHelicity
:-
fQuartetStartPredictedHelicity
;
// cout << "Cycles " << fNCycle << " " << newNCycle << " " << fFirstCycle
// cout << "Cycles " << fNCycle << " " << newNCycle << " " << fFirstCycle
// << " skipped " << quartets_missed << " quartets" << endl;
// << " skipped " << quartets_missed << " quartets" << endl;
fNCycle
=
newNCycle
;
fNCycle
=
newNCycle
;
...
@@ -290,13 +306,9 @@ Int_t THcHelicity::Decode( const THaEvData& evdata )
...
@@ -290,13 +306,9 @@ Int_t THcHelicity::Decode( const THaEvData& evdata )
// But only do this if we are calibrated.
// But only do this if we are calibrated.
if
(
fNBits
>=
fMAXBIT
)
{
if
(
fNBits
>=
fMAXBIT
)
{
if
(((
fNCycle
-
fFirstCycle
)
%
2
)
==
1
)
{
if
(((
fNCycle
-
fFirstCycle
)
%
2
)
==
1
)
{
// fQuartet[2] = fQuartet[3] = -fQuartet[0];
// fQuartet[1] = fQuartet[0];
fQuartet
[
0
]
=
fReportedHelicity
;
fQuartet
[
0
]
=
fReportedHelicity
;
fQuartet
[
1
]
=
fQuartet
[
2
]
=
-
fQuartet
[
0
];
fQuartet
[
1
]
=
fQuartet
[
2
]
=
-
fQuartet
[
0
];
}
else
{
}
else
{
// fQuartet[1] = fQuartet[2] = -fQuartet[0];
// fQuartet[3] = fQuartet[0];
fQuartet
[
0
]
=
fQuartet
[
1
]
=
-
fReportedHelicity
;
fQuartet
[
0
]
=
fQuartet
[
1
]
=
-
fReportedHelicity
;
fQuartet
[
2
]
=
-
fQuartet
[
1
];
fQuartet
[
2
]
=
-
fQuartet
[
1
];
}
}
...
@@ -365,7 +377,10 @@ Int_t THcHelicity::Decode( const THaEvData& evdata )
...
@@ -365,7 +377,10 @@ Int_t THcHelicity::Decode( const THaEvData& evdata )
fIsNewCycle
=
kFALSE
;
fIsNewCycle
=
kFALSE
;
fNBits
=
0
;
fNBits
=
0
;
}
}
// cout << setprecision(9) << "HEL " << fTITime/250000000.0 << " " << fNCycle << "(" << (fNCycle-fFirstCycle)%4 << "): "
// << fMPS << " " << fReportedHelicity << " "
// << fPredictedHelicity << " " << fActualHelicity << " " << lastlastmpstime/250000000.0 << endl;
// bitset<32>(v)
return
0
;
return
0
;
}
}
...
@@ -397,6 +412,7 @@ void THcHelicity::LoadHelicity(Int_t reportedhelicity, Int_t cyclecount, Int_t m
...
@@ -397,6 +412,7 @@ void THcHelicity::LoadHelicity(Int_t reportedhelicity, Int_t cyclecount, Int_t m
// static const char* const here = "THcHelicity::LoadHelicity";
// static const char* const here = "THcHelicity::LoadHelicity";
int
quartetphase
=
(
cyclecount
-
fFirstCycle
)
%
4
;
int
quartetphase
=
(
cyclecount
-
fFirstCycle
)
%
4
;
fnQrt
=
quartetphase
;
fnQrt
=
quartetphase
;
if
(
missedcycles
>
1
)
{
// If we missed windows
if
(
missedcycles
>
1
)
{
// If we missed windows
if
(
fNBits
<
fMAXBIT
)
{
// and we haven't gotten the seed, start over
if
(
fNBits
<
fMAXBIT
)
{
// and we haven't gotten the seed, start over
fNBits
=
0
;
fNBits
=
0
;
...
@@ -445,6 +461,7 @@ void THcHelicity::LoadHelicity(Int_t reportedhelicity, Int_t cyclecount, Int_t m
...
@@ -445,6 +461,7 @@ void THcHelicity::LoadHelicity(Int_t reportedhelicity, Int_t cyclecount, Int_t m
if
(
fReportedHelicity
!=
fPredictedHelicity
)
{
if
(
fReportedHelicity
!=
fPredictedHelicity
)
{
cout
<<
"Helicity prediction failed "
<<
fReportedHelicity
<<
" "
cout
<<
"Helicity prediction failed "
<<
fReportedHelicity
<<
" "
<<
fPredictedHelicity
<<
" "
<<
fActualHelicity
<<
endl
;
<<
fPredictedHelicity
<<
" "
<<
fActualHelicity
<<
endl
;
cout
<<
hex
<<
fRingSeed_reported
<<
" "
<<
fRingSeed_actual
<<
dec
<<
endl
;
fNBits
=
0
;
// Need to reaquire seed
fNBits
=
0
;
// Need to reaquire seed
fActualHelicity
=
kUnknown
;
fActualHelicity
=
kUnknown
;
fPredictedHelicity
=
kUnknown
;
fPredictedHelicity
=
kUnknown
;
...
...
This diff is collapsed.
Click to expand it.
src/THcHelicity.h
+
4
−
4
View file @
29915353
...
@@ -49,13 +49,13 @@ protected:
...
@@ -49,13 +49,13 @@ protected:
Int_t
fFirstCycle
;
Int_t
fFirstCycle
;
Double_t
fFreq
;
Double_t
fFreq
;
ULong64
_t
fTIPeriod
;
// Reversal period in TI time units
Double
_t
fTIPeriod
;
// Reversal period in TI time units
Bool_t
fFirstEvProcessed
;
Bool_t
fFirstEvProcessed
;
Int_t
fLastReportedHelicity
;
Int_t
fLastReportedHelicity
;
U
Long64_t
fFirstEvTime
;
Long64_t
fFirstEvTime
;
U
Long64_t
fLastEvTime
;
Long64_t
fLastEvTime
;
U
Long64_t
fLastMPSTime
;
Long64_t
fLastMPSTime
;
Int_t
fReportedHelicity
;
Int_t
fReportedHelicity
;
Int_t
fMPS
;
Int_t
fMPS
;
Int_t
fPredictedHelicity
;
Int_t
fPredictedHelicity
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment