30 fnQrt(-1), fHelDelay(8), fMAXBIT(30)
41 : fnQrt(-1), fHelDelay(8), fMAXBIT(30)
106 std::transform(kwPrefix.begin(), kwPrefix.end(), kwPrefix.begin(), ::tolower);
114 cout <<
"In THcHelicity::ReadDatabase" << endl;
133 fFreq = 120.0007547169;
168 cout <<
"Helicity decoder initialized with frequency of " <<
fFreq
169 <<
" Hz and reporting delay of " <<
fHelDelay <<
" cycles." << endl;
185 cout <<
"Called THcHelicity::DefineVariables with mode == "
194 const RVarDef var[] = {
195 {
"nqrt",
"position of cycle in quartet",
"fnQrt" },
196 {
"hel",
"actual helicity for event",
"fActualHelicity" },
197 {
"helrep",
"reported helicity for event",
"fReportedHelicity" },
198 {
"helpred",
"predicted reported helicity for event",
"fPredictedHelicity" },
199 {
"mps",
"In MPS blanking period",
"fMPS"},
200 {
"pcheck",
"Period check",
"fPeriodCheck"},
201 {
"cycle",
"Helicity Cycle",
"fCycle"},
202 {
"qrt",
"Last cycle of quartet",
"fQrt"},
205 cout <<
"Calling THcHelicity DefineVarsFromList" << endl;
213 cout<<
" ++++++ THcHelicity::Print ++++++\n";
215 cout<<
" +++++++++++++++++++++++++++++++++++++\n";
287 Error(
Here(
"THcHelicity::Decode"),
"Error decoding helicity data." );
300 for(
Int_t i=0;i<nhelev;i++) {
308 for(nbehind=0;nbehind<4;nbehind++) {
311 cout <<
"Scaler seed behind " << nbehind
312 <<
" quartets" << endl;
314 cout <<
"Scaler Seed " << bitset<32>(
fScalerSeed) << endl;
321 cout <<
"Scaler seed does not match" << endl;
323 cout <<
"Scaler Seed " << bitset<32>(
fScalerSeed) << endl;
350 cout <<
" Disabling helicity decoding for rest of run." << endl;
351 cout <<
" Make sure \"RawDecode_master in cuts file accepts all physics events." <<endl;
410 for(
Int_t i=0;i<quartets_missed;i++) {
470 cout <<
"QRT Problem resetting" << endl;
490 cout <<
"Phase found from QRT signal" << endl;
513 cout <<
"Quartet potentially found, starting at cycle " <<
fFirstCycle
521 cout <<
"Lost quartet sync at cycle " <<
fNCycle << endl;
528 cout <<
"Searching for first of a quartet at cycle " <<
" " <<
fFirstCycle
559 cout <<
"Initializing" << endl;
576 cout <<
"Actual Helicity never got defined" << endl;
599 cout <<
"------------- HELICITY DECODING ----------------------" << endl;
600 cout <<
"Actual helicity reversal frequency differs from \"helicity_freq\" value" << endl;
601 cout <<
"If there are helicity decoding errors beyond the start of the run, " << endl;
602 streamsize ss = cout.precision();
605 cout <<
"If that still gives helicity errors, try " << 0.9999999*
fRecommendedFreq << endl;
607 cout <<
"------------------------------------------------------" << endl;
628 fnQrt = quartetphase;
633 cout <<
"fNBits = 0, missedcycles=" << missedcycles <<
651 cout <<
"Start calibrating at cycle " << cyclecount << endl;
673 cout <<
"Seed at cycle " <<
fFirstCycle <<
" should be " << hex << backseed << dec << endl;
685 cout <<
" -- Getting seed from scalers -- " << endl;
687 cout <<
"Scaler Seed " << bitset<32>(scalerseed) << endl;
701 if(quartetphase == 0) {
734 UInt_t bit7 = (ranseed & 0x00000040) != 0;
735 UInt_t bit28 = (ranseed & 0x08000000) != 0;
736 UInt_t bit29 = (ranseed & 0x10000000) != 0;
737 UInt_t bit30 = (ranseed & 0x20000000) != 0;
739 UInt_t newbit = (bit30 ^ bit29 ^ bit28 ^ bit7) & 0x1;
744 std::cerr<<
"ranseed must be greater than zero!"<<
"\n";
748 ranseed = ( (ranseed<<1) | newbit ) & 0x3FFFFFFF;
752 cout<<
"THcHelicity::RanBit30, newbit="<<newbit<<
"\n";
763 Int_t seed = currentseed;
764 for(
Int_t i=0;i<30;i++) {
765 UInt_t bit1 = (seed & 0x00000001) != 0;
766 UInt_t bit8 = (seed & 0x00000080) != 0;
767 UInt_t bit29 = (seed & 0x10000000) != 0;
768 UInt_t bit30 = (seed & 0x20000000) != 0;
770 UInt_t newbit30 = (bit30 ^ bit29 ^ bit8 ^ bit1) & 0x1;
771 seed = (seed >> 1) | (newbit30<<29);
774 Int_t bits = currentseed;
776 for(
Int_t i=0;i<30;i++) {
780 val = ((bits & (1<<(i)))!=0) ^ ((bits & (1<<(i+29)))!=0);
782 val = ((bits & (1<<(i)))!=0) ^ ((seed & (1<<(i-1)))!=0);
785 val = ((bits & (1<<(1-i)))!=0) ^ val;
787 val = ((seed & (1<<(i-2)))!=0) ^ val;
790 val = ((bits & (1<<(i-22)))!=0) ^ val;
792 val = ((seed & (1<<(i-23)))!=0) ^ val;
Option_t Option_t TPoint TPoint const char mode
ClassImp(VDC::AnalyticTTDConv) using namespace std
R__EXTERN class THcParmList * gHcParms
virtual void SetDebug(Int_t level)
static Int_t DefineVarsFromList(const void *list, EType type, EMode mode, const char *def_prefix, const TObject *obj, const char *prefix, const char *here, const char *comment_subst="")
virtual const char * Here(const char *) const
const char * GetPrefix() const
virtual void MakePrefix()
THaApparatus * GetApparatus() const
virtual void Clear(Option_t *opt="")
virtual const char * GetDBFileName() const
virtual Int_t DefineVariables(EMode mode=kDefine)
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)
virtual Int_t GetReportedSeed()
virtual Bool_t IsSeedGood()
virtual Int_t * GetHelicityHistoryP()
virtual Int_t GetNcycles()
virtual Int_t GetNevents()
THcHelicityScaler * fglHelicityScaler
virtual Int_t DefineVariables(EMode mode=kDefine)
void SetErrorCode(Int_t error)
virtual Int_t Decode(const THaEvData &evdata)
Int_t fRingSeed_reported_initial
Int_t fLastReportedHelicity
Int_t fLastActualHelicity
virtual void SetDebug(Int_t level)
virtual Int_t ReadDatabase(const TDatime &date)
Int_t fQuartetStartHelicity
virtual void MakePrefix()
void LoadHelicity(Int_t reportedhelicity, Int_t cyclecount, Int_t missedcycles)
Double_t fPeriodCheckOffset
Int_t RanBit30(Int_t ranseed)
virtual void SetHelicityScaler(THcHelicityScaler *f)
Int_t fHelperQuartetHistory
Double_t fRecommendedFreq
Int_t fQuartetStartPredictedHelicity
virtual void Clear(Option_t *opt="")
Int_t GetSeed30(Int_t currentseed)
void Setup(const char *name, const char *description)
void PrintEvent(Int_t evtnum)
Int_t LoadParmValues(const DBRequest *list, const char *prefix="")
Retrieve parameter values from the parameter cache.
const char * GetName() const override
const char * GetTitle() const override
virtual void Error(const char *method, const char *msgfmt,...) const
RVec< PromoteTypes< T0, T1 > > fmod(const RVec< T0 > &v, const T1 &y)
RVec< PromoteType< T > > abs(const RVec< T > &v)
RVec< PromoteType< T > > floor(const RVec< T > &v)