Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hcana
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Whitney Armstrong
hcana
Commits
99b1b507
Commit
99b1b507
authored
5 years ago
by
Sylvester Joosten
Browse files
Options
Downloads
Patches
Plain Diff
fixed merge conflict issues
parent
af3bdee3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/.THcHelicity.h.swp
+0
-0
0 additions, 0 deletions
src/.THcHelicity.h.swp
src/THcHelicity.cxx
+3
-219
3 additions, 219 deletions
src/THcHelicity.cxx
src/THcHelicityReader.cxx
+3
-2
3 additions, 2 deletions
src/THcHelicityReader.cxx
src/THcHelicityReader.h
+25
-26
25 additions, 26 deletions
src/THcHelicityReader.h
with
31 additions
and
247 deletions
src/.THcHelicity.h.swp
0 → 100644
+
0
−
0
View file @
99b1b507
File added
This diff is collapsed.
Click to expand it.
src/THcHelicity.cxx
+
3
−
219
View file @
99b1b507
...
...
@@ -176,19 +176,6 @@ Int_t THcHelicity::DefineVariables(EMode mode) {
fIsSetup
=
(
mode
==
kDefine
);
// Define standard variables from base class
<<<<<<<
HEAD
THaHelicityDet
::
DefineVariables
(
mode
);
const
RVarDef
var
[]
=
{{
"nqrt"
,
"position of cycle in quartet"
,
"fnQrt"
},
{
"hel"
,
"actual helicity for event"
,
"fActualHelicity"
},
{
"helrep"
,
"reported helicity for event"
,
"fReportedHelicity"
},
{
"helpred"
,
"predicted reported helicity for event"
,
"fPredictedHelicity"
},
{
"mps"
,
"In MPS blanking period"
,
"fMPS"
},
{
0
}};
// cout << "Calling THcHelicity DefineVarsFromList" << endl;
_logger
->
info
(
"Calling THcHelicity DefineVarsFromList"
);
return
DefineVarsFromList
(
var
,
mode
);
=======
THaHelicityDet
::
DefineVariables
(
mode
);
const
RVarDef
var
[]
=
{{
"nqrt"
,
"position of cycle in quartet"
,
"fnQrt"
},
...
...
@@ -200,9 +187,8 @@ Int_t THcHelicity::DefineVariables(EMode mode) {
{
"cycle"
,
"Helicity Cycle"
,
"fCycle"
},
{
"qrt"
,
"Last cycle of quartet"
,
"fQrt"
},
{
0
}};
cout
<<
"Calling THcHelicity DefineVarsFromList"
<<
endl
;
_logger
->
info
(
"Calling THcHelicity DefineVarsFromList"
)
;
return
DefineVarsFromList
(
var
,
mode
);
>>>>>>>
77
b916167fbc44bfd82e8c4fe2b063c386e89d99
}
//_____________________________________________________________________________
...
...
@@ -281,12 +267,6 @@ Int_t THcHelicity::Decode(const THaEvData& evdata) {
return
err
;
}
<<<<<<<
HEAD
fReportedHelicity
=
(
fIsHelp
?
(
fIsHelm
?
kUnknown
:
kPlus
)
:
(
fIsHelm
?
kMinus
:
kUnknown
));
fMPS
=
fIsMPS
?
1
:
0
;
if
(
fHelDelay
==
0
)
{
// If no delay actual=reported (but zero if in MPS)
fActualHelicity
=
fIsMPS
?
kUnknown
:
fReportedHelicity
;
=======
fReportedHelicity
=
(
fIsHelp
?
(
fIsHelm
?
kUnknown
:
kPlus
)
:
(
fIsHelm
?
kMinus
:
kUnknown
));
fMPS
=
fIsMPS
?
1
:
0
;
fQrt
=
fIsQrt
?
1
:
0
;
// Last of quartet
...
...
@@ -307,7 +287,6 @@ Int_t THcHelicity::Decode(const THaEvData& evdata) {
if
(
fHelDelay
==
0
)
{
// If no delay actual=reported (but zero if in MPS)
fActualHelicity
=
fIsMPS
?
kUnknown
:
fReportedHelicity
;
>>>>>>>
77
b916167fbc44bfd82e8c4fe2b063c386e89d99
return
0
;
}
...
...
@@ -335,15 +314,10 @@ Int_t THcHelicity::Decode(const THaEvData& evdata) {
// << fLastMPSTime << " " << fNBits << endl;
Int_t
missed
=
0
;
// Double_t elapsed_time = (fTITime - fFirstEvTime)/250000000.0;
<<<<<<<
HEAD
if
(
fIsMPS
)
{
fPeriodCheck
=
fmod
(
fTITime
/
fTIPeriod
,
1.0
);
fCycle
=
(
fTITime
/
fTIPeriod
);
fActualHelicity
=
kUnknown
;
=======
if
(
fIsMPS
)
{
fPeriodCheck
=
fmod
(
fTITime
/
fTIPeriod
,
1.0
);
fCycle
=
(
fTITime
/
fTIPeriod
);
fActualHelicity
=
kUnknown
;
>>>>>>>
77
b916167fbc44bfd82e8c4fe2b063c386e89d99
fPredictedHelicity
=
kUnknown
;
if
(
fFoundMPS
)
{
missed
=
TMath
::
Nint
(
fTITime
/
fTIPeriod
-
fLastMPSTime
/
fTIPeriod
);
...
...
@@ -363,117 +337,6 @@ Int_t THcHelicity::Decode(const THaEvData& evdata) {
fFoundMPS
=
kTRUE
;
fLastMPSTime
=
fTITime
;
}
<<<<<<<
HEAD
}
else
if
(
fFoundMPS
)
{
//
if
(
fTITime
-
fLastMPSTime
>
fTIPeriod
)
{
// We missed MPS periods
missed
=
TMath
::
Nint
(
floor
((
fTITime
-
fLastMPSTime
)
/
fTIPeriod
));
if
(
missed
>
1
)
{
// cout << "Missed " << missed << " MPSes" << endl;
Int_t
newNCycle
=
fNCycle
+
missed
-
1
;
// How many cycles really missed
Int_t
quartets_missed
=
(
newNCycle
-
fFirstCycle
)
/
4
-
(
fNCycle
-
fFirstCycle
)
/
4
;
for
(
Int_t
i
=
0
;
i
<
quartets_missed
;
i
++
)
{
// Advance the seeds.
fRingSeed_reported
=
RanBit30
(
fRingSeed_reported
);
fRingSeed_actual
=
RanBit30
(
fRingSeed_actual
);
}
int
quartetphase
=
(
newNCycle
-
fFirstCycle
)
%
4
;
// cout << " " << fNCycle << " " << newNCycle << " " << fFirstCycle << " " <<
// quartets_missed << " " << quartetphase << endl; cout << "Cycles " << fNCycle << "
// " << newNCycle << " " << fFirstCycle
// << " skipped " << quartets_missed << " quartets" << endl;
fNCycle
=
newNCycle
;
// Need to reset fQuartet to reflect where we are based on the current
// reported helicity. So we don't fail quartet testing.
// But only do this if we are calibrated.
if
(
fNBits
>=
fMAXBIT
)
{
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
;
if
(((
fNCycle
-
fFirstCycle
)
%
2
)
==
1
)
{
fQuartet
[
0
]
=
fReportedHelicity
;
fQuartet
[
1
]
=
fQuartet
[
2
]
=
-
fQuartet
[
0
];
}
else
{
fQuartet
[
0
]
=
fQuartet
[
1
]
=
-
fReportedHelicity
;
fQuartet
[
2
]
=
-
fQuartet
[
1
];
}
}
else
{
fActualHelicity
=
kUnknown
;
fQuartet
[
0
]
=
fReportedHelicity
;
fQuartet
[
1
]
=
0
;
}
}
fLastMPSTime
+=
missed
*
fTIPeriod
;
fIsNewCycle
=
kTRUE
;
fLastReportedHelicity
=
fReportedHelicity
;
}
else
{
// No missed periods. Get helicities from rings
if
(
fNBits
>=
fMAXBIT
)
{
int
quartetphase
=
(
fNCycle
-
fFirstCycle
)
%
4
;
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
;
}
else
{
fActualHelicity
=
0
;
}
}
if
(
fIsNewCycle
)
{
fQuartet
[
3
]
=
fQuartet
[
2
];
fQuartet
[
2
]
=
fQuartet
[
1
];
fQuartet
[
1
]
=
fQuartet
[
0
];
fQuartet
[
0
]
=
fReportedHelicity
;
fNCycle
++
;
if
((
fNCycle
-
fFirstCycle
)
%
4
==
3
)
{
// Test if last in a quartet
if
((
abs
(
fQuartet
[
0
]
+
fQuartet
[
3
]
-
fQuartet
[
1
]
-
fQuartet
[
2
])
==
4
))
{
if
(
!
fFoundQuartet
)
{
// fFirstCycle = fNCycle - 3;
_logger
->
info
(
"Quartet potentially found, starting at cycle {} - event {}"
,
fFirstCycle
,
evdata
.
GetEvNum
());
// cout << "Quartet potentially found, starting at cycle " << fFirstCycle << " - event
// "
// << evdata.GetEvNum() << endl;
fFoundQuartet
=
kTRUE
;
}
}
else
{
if
(
fNCycle
-
fFirstCycle
>
4
)
{
// Not at start of run. Reset
_logger
->
warn
(
"Lost quartet sync at cycle {} - event {}"
,
fNCycle
,
evdata
.
GetEvNum
());
_logger
->
warn
(
"{} {} {} {}"
,
fQuartet
[
0
],
fQuartet
[
1
],
fQuartet
[
2
],
fQuartet
[
3
]);
// cout << "Lost quartet sync at cycle " << fNCycle << " - event " <<
// evdata.GetEvNum()
// << endl;
// cout << fQuartet[0] << " " << fQuartet[1] << " " << fQuartet[2] << " " <<
// fQuartet[3]
// << endl;
fFirstCycle
+=
4
*
((
fNCycle
-
fFirstCycle
)
/
4
);
// Update, but don't change phase
}
fFoundQuartet
=
kFALSE
;
fNBits
=
0
;
_logger
->
info
(
"Searching for first of a quartet at cycle {} - event {}"
,
fFirstCycle
,
evdata
.
GetEvNum
());
// cout << "Searching for first of a quartet at cycle "
// << " " << fFirstCycle << " - event " << evdata.GetEvNum() << endl;
// cout << fQuartet[0] << " " << fQuartet[1] << " " << fQuartet[2] << " " << fQuartet[3]
// << endl;
_logger
->
info
(
"{} {} {} {}"
,
fQuartet
[
0
],
fQuartet
[
1
],
fQuartet
[
2
],
fQuartet
[
3
]);
fFirstCycle
++
;
}
}
// Load the actual helicity. Calibrate if not calibrated.
fActualHelicity
=
kUnknown
;
LoadHelicity
(
fReportedHelicity
,
fNCycle
,
missed
);
fLastReportedHelicity
=
fReportedHelicity
;
fIsNewCycle
=
kFALSE
;
// cout << fTITime/250000000.0 << " " << fNCycle << " " << fReportedHelicity << endl;
// cout << fNCycle << ": " << fReportedHelicity << " "
// << fPredictedHelicity << " " << fActualHelicity << endl;
=======
}
else
if
(
fFoundMPS
)
{
//
if
(
fTITime
-
fLastMPSTime
>
fTIPeriod
)
{
// We missed MPS periods
missed
=
TMath
::
Nint
(
floor
((
fTITime
-
fLastMPSTime
)
/
fTIPeriod
));
...
...
@@ -700,71 +563,6 @@ void THcHelicity::LoadHelicity(Int_t reportedhelicity, Int_t cyclecount, Int_t m
int
quartetphase
=
(
cyclecount
-
fFirstCycle
)
%
4
;
fnQrt
=
quartetphase
;
<<<<<<<
HEAD
if
(
missedcycles
>
1
)
{
// If we missed windows
if
(
fNBits
<
fMAXBIT
)
{
// and we haven't gotten the seed, start over
fNBits
=
0
;
return
;
}
}
if
(
!
fFoundQuartet
)
{
// Wait until we have found quad phase before starting
return
;
// to calibrate
}
if
(
quartetphase
==
0
)
{
// Start of a quad
if
(
fNBits
<
fMAXBIT
)
{
if
(
fNBits
==
0
)
{
_logger
->
info
(
"Start calibrating at cycle {}"
,
cyclecount
);
// cout << "Start calibrating at cycle " << cyclecount << endl;
fRingSeed_reported
=
0
;
}
if
(
fReportedHelicity
==
kPlus
)
{
fRingSeed_reported
=
((
fRingSeed_reported
<<
1
)
|
1
)
&
0x3FFFFFFF
;
}
else
{
fRingSeed_reported
=
(
fRingSeed_reported
<<
1
)
&
0x3FFFFFFF
;
}
fNBits
++
;
if
(
fReportedHelicity
==
kUnknown
)
{
fNBits
=
0
;
fRingSeed_reported
=
0
;
}
else
if
(
fNBits
==
fMAXBIT
)
{
_logger
->
info
(
"Seed Found {} at cycle {} with first cycle {}"
,
fRingSeed_reported
,
cyclecount
,
fFirstCycle
);
// cout << "Seed Found " << hex << fRingSeed_reported << dec << " at cycle " << cyclecount
// << " with first cycle " << fFirstCycle << endl;
Int_t
backseed
=
GetSeed30
(
fRingSeed_reported
);
_logger
->
info
(
"Seed at cycle {} should be {}"
,
fFirstCycle
,
backseed
);
// cout << "Seed at cycle " << fFirstCycle << " should be " << hex << backseed << dec <<
// endl;
}
fActualHelicity
=
kUnknown
;
}
else
if
(
fNBits
>=
fMAXBIT
)
{
fRingSeed_reported
=
RanBit30
(
fRingSeed_reported
);
if
(
fNBits
==
fMAXBIT
)
{
fRingSeed_actual
=
fRingSeed_reported
;
for
(
Int_t
i
=
0
;
i
<
fHelDelay
/
4
;
i
++
)
{
fRingSeed_actual
=
RanBit30
(
fRingSeed_actual
);
}
fNBits
++
;
}
else
{
fRingSeed_actual
=
RanBit30
(
fRingSeed_actual
);
}
fActualHelicity
=
(
fRingSeed_actual
&
1
)
?
kPlus
:
kMinus
;
fPredictedHelicity
=
(
fRingSeed_reported
&
1
)
?
kPlus
:
kMinus
;
// if(fTITime/250000000.0 > 380.0) cout << fTITime/250000000.0 << " " << fNCycle << " "
// << hex <<
// fRingSeed_reported << " " << fRingSeed_actual << dec
//<< endl;
if
(
fReportedHelicity
!=
fPredictedHelicity
)
{
_logger
->
warn
(
"Helicity prediction failed {} {} {}"
,
fReportedHelicity
,
fPredictedHelicity
,
fActualHelicity
);
// cout << "Helicity prediction failed " << fReportedHelicity << " "
// << fPredictedHelicity << " " << fActualHelicity << endl;
// cout << hex << fRingSeed_reported << " " << fRingSeed_actual << dec << endl;
fNBits
=
0
;
// Need to reaquire seed
fActualHelicity
=
kUnknown
;
fPredictedHelicity
=
kUnknown
;
=======
// if(!fFixFirstCycle) {
if
(
fNQuartet
-
fNLastQuartet
>
1
)
{
// If we missed a quartet
if
(
fNBits
<
fMAXBIT
)
{
// and we haven't gotten the seed, start over
...
...
@@ -839,28 +637,14 @@ void THcHelicity::LoadHelicity(Int_t reportedhelicity, Int_t cyclecount, Int_t m
fNBits
=
0
;
// Need to reaquire seed
fActualHelicity
=
kUnknown
;
fPredictedHelicity
=
kUnknown
;
>>>>>>>
77
b916167fbc44bfd82e8c4fe2b063c386e89d99
}
fQuartetStartHelicity
=
fActualHelicity
;
fQuartetStartPredictedHelicity
=
fPredictedHelicity
;
}
<<<<<<<
HEAD
fQuartetStartHelicity
=
fActualHelicity
;
fQuartetStartPredictedHelicity
=
fPredictedHelicity
;
}
else
{
// Not the beginning of a quad
if
(
fNBits
>=
fMAXBIT
)
{
fActualHelicity
=
(
quartetphase
==
0
||
quartetphase
==
3
)
?
fQuartetStartHelicity
:
-
fQuartetStartHelicity
;
fPredictedHelicity
=
(
quartetphase
==
0
||
quartetphase
==
3
)
?
fQuartetStartPredictedHelicity
:
-
fQuartetStartPredictedHelicity
;
}
=======
fActualHelicity
=
(
quartetphase
==
0
||
quartetphase
==
3
)
?
fQuartetStartHelicity
:
-
fQuartetStartHelicity
;
fPredictedHelicity
=
(
quartetphase
==
0
||
quartetphase
==
3
)
?
fQuartetStartPredictedHelicity
:
-
fQuartetStartPredictedHelicity
;
>>>>>>>
77
b916167fbc44bfd82e8c4fe2b063c386e89d99
}
return
;
}
...
...
This diff is collapsed.
Click to expand it.
src/THcHelicityReader.cxx
+
3
−
2
View file @
99b1b507
...
...
@@ -15,6 +15,7 @@
#include
"THcParmList.h"
#include
"TMath.h"
#include
"VarDef.h"
#include
"hcana/Logger.h"
#include
<iostream>
#include
<vector>
...
...
@@ -166,8 +167,8 @@ Int_t THcHelicityReader::SetROCinfo(EROC which, Int_t roc, Int_t slot, Int_t ind
fROCinfo
[
which
].
slot
=
slot
;
fROCinfo
[
which
].
index
=
index
;
_det_
logger
->
info
(
"SetROCInfo: {} (roc: {}, slot: {}, index: {})"
,
which
,
fROCinfo
[
which
].
roc
,
fROCinfo
[
which
].
slot
,
fROCinfo
[
which
].
index
]
);
logger
_
->
info
(
"SetROCInfo: {} (roc: {}, slot: {}, index: {})"
,
which
,
fROCinfo
[
which
].
roc
,
fROCinfo
[
which
].
slot
,
fROCinfo
[
which
].
index
);
fHaveROCs
=
(
fROCinfo
[
kHel
].
roc
>
0
&&
fROCinfo
[
kTime
].
roc
>
0
&&
fROCinfo
[
kMPS
].
roc
);
return
0
;
...
...
This diff is collapsed.
Click to expand it.
src/THcHelicityReader.h
+
25
−
26
View file @
99b1b507
...
...
@@ -10,60 +10,59 @@
//////////////////////////////////////////////////////////////////////////
#include
"Rtypes.h"
#include
"THaHelicityDet.h"
#include
"hcana/Logger.h"
class
THaEvData
;
class
TDatime
;
class
TH1F
;
class
THcHelicityReader
{
class
THcHelicityReader
:
public
hcana
::
ConfigLogging
<
THaHelicityDet
>
{
public:
THcHelicityReader
();
virtual
~
THcHelicityReader
();
struct
ROCinfo
{
Int_t
roc
;
// ROC to read out
Int_t
slot
;
// Headers to search for (0 = ignore)
Int_t
index
;
// Index into buffer
Int_t
roc
;
// ROC to read out
Int_t
slot
;
// Headers to search for (0 = ignore)
Int_t
index
;
// Index into buffer
};
protected
:
protected
:
// Used by ReadDatabase
enum
EROC
{
kHel
=
0
,
kHelm
,
kMPS
,
kQrt
,
kTime
,
kCount
};
Int_t
SetROCinfo
(
EROC
which
,
Int_t
roc
,
Int_t
slot
,
Int_t
index
);
Int_t
SetROCinfo
(
EROC
which
,
Int_t
roc
,
Int_t
slot
,
Int_t
index
);
virtual
void
Clear
(
Option_t
*
opt
=
""
);
virtual
Int_t
ReadData
(
const
THaEvData
&
evdata
);
Int_t
ReadDatabase
(
const
char
*
dbfilename
,
const
char
*
prefix
,
const
TDatime
&
date
,
int
debug_flag
=
0
);
void
Begin
();
void
End
();
virtual
void
Clear
(
Option_t
*
opt
=
""
);
virtual
Int_t
ReadData
(
const
THaEvData
&
evdata
);
Int_t
ReadDatabase
(
const
char
*
dbfilename
,
const
char
*
prefix
,
const
TDatime
&
date
,
int
debug_flag
=
0
);
void
Begin
();
void
End
();
ULong64_t
fTITime
;
UInt_t
fTITime_last
;
UInt_t
fTITime_rollovers
;
UInt_t
fTITime_last
;
UInt_t
fTITime_rollovers
;
// Reported Helicity status for the event
Bool_t
fIsMPS
;
Bool_t
fIsQrt
;
Bool_t
fIsHelp
;
Bool_t
fIsHelm
;
Int_t
fADCThreshold
;
// Threshold for On/Off of helicity signals
Int_t
fADCThreshold
;
// Threshold for On/Off of helicity signals
ROCinfo
fROCinfo
[
kCount
];
ROCinfo
fROCinfo
[
kCount
];
Int_t
fQWEAKDebug
;
// Debug level
Bool_t
fHaveROCs
;
// Required ROCs are defined
Bool_t
fNegGate
;
// Invert polarity of gate, TO DO implement this functionality
Int_t
fQWEAKDebug
;
// Debug level
Bool_t
fHaveROCs
;
// Required ROCs are defined
Bool_t
fNegGate
;
// Invert polarity of gate, TO DO implement this functionality
static
const
Int_t
NHISTR
=
12
;
// TH1F* fHistoR[12]; // Histograms
private
:
ClassDef
(
THcHelicityReader
,
0
)
// Helper class for reading QWEAK helicity data
ClassDef
(
THcHelicityReader
,
0
)
// Helper class for reading QWEAK helicity data
};
#endif
...
...
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