34 fT0(0.), fT9(0.), fT0T9(false), fQuad_calibrated(false),
35 fValidHel(false), fRecovery_flag(true),
37 fFirstquad(0), fLastTimestamp(0.0), fTimeLastQ1(0.0),
38 fT9count(0), fPredicted_reading(0), fQ1_reading(0),
42 fNqrt(0), fHisto(nullptr), fNB(0), fIseed(0), fIseed_earlier(0),
43 fInquad(0), fTET9Index(0), fTELastEvtQrt(-1), fTELastEvtTime(-1.),
44 fTELastTime(-1.), fTEPresentReadingQ1(-1), fTEStartup(3), fTETime(-1.),
45 fTEType9(false), fManuallySet(0), fDelayedQrt(true)
53 fT0(0.), fT9(0.), fT0T9(false), fQuad_calibrated(false),
54 fValidHel(false), fRecovery_flag(true),
56 fFirstquad(0), fLastTimestamp(0.0), fTimeLastQ1(0.0),
57 fT9count(0), fPredicted_reading(0), fQ1_reading(0),
61 fNqrt(0), fHisto(nullptr), fNB(0), fIseed(0), fIseed_earlier(0),
62 fInquad(0), fTET9Index(0), fTELastEvtQrt(-1), fTELastEvtTime(-1.),
63 fTELastTime(-1.), fTEPresentReadingQ1(-1), fTEStartup(3), fTETime(-1.),
64 fTEType9(false), fManuallySet(0), fDelayedQrt(true)
87 const RVarDef var[] = {
88 {
"qrt",
"qrt from ROC",
"fQrt" },
89 {
"nqrt",
"number of qrts seen",
"fNqrt" },
90 {
"quad",
"quad (1, 2, or 4)",
"fQuad" },
91 {
"tdiff",
"time since quad start",
"fTdiff" },
92 {
"gate",
"Helicity Gate from ROC",
"fGate" },
93 {
"pread",
"Present helicity reading",
"fPresentReading" },
94 {
"timestamp",
"Timestamp from ROC",
"fTimestamp" },
95 {
"validtime",
"validtime flag",
"fValidTime" },
96 {
"validHel",
"validHel flag",
"fValidHel" },
129 {
"delay", &delay,
kInt, 0,
true, -2 },
130 {
"tdavg", &tdavg,
kDouble, 0,
true, -2 },
131 {
"ttol", &ttol,
kDouble, 0,
true, -2 },
132 {
"missqrt", &missqrt,
kInt, 0,
true, -2 },
160 fHisto =
new TH1F(
"hahel1",
"Time diff for QRT",1000,11000,22000);
189 Error(
Here(
"Decode"),
"Error decoding helicity data." );
195 cout << dec <<
"--> Data for spectrometer " <<
GetName() << endl;
198 cout <<
" qrt " <<
fQrt;
199 cout <<
" gate " <<
fGate;
298 static const char*
const here =
"TimingEvent";
334 auto nt9miss =
static_cast<Int_t>(tdiff / t9diff - 0.5);
341 TMath::Abs(tdiff - (nt9miss+1) * t9diff) > 10*(nt9miss + 1) )
348 Warning(
"THaG0Helicity",
"QRT wrong spacing: %d at %f.",
363 "%d in window 1, %d in window %d at timestamp %f.",
377 const char*
const here =
"QuadCalib";
406 for (
Int_t i = 0; i < nqmiss; i++) {
423 Info(
Here(
here),
" %5d M M %1d %2d %10.0f %10.0f %10.0f Missing",
429 Warning(
Here(
here),
"Cannot recover: Too many skipped QRT (Low rate ?) "
430 "or uninitialized" );
451 "This time = %f\nHELICITY SIGNALS MAY BE CORRUPT",
493 cout <<
"------------ quad calibrated --------------------------"<<endl;
496 Warning(
Here(
here),
"QuadCalib G0 prediction failed at timestamp %f.\n"
497 "HELICITY ASSIGNMENT IN PREVIOUS %d WINDOWS MAY BE INCORRECT",
529 static const char*
const here =
"LoadHelicity";
538 cout <<
"Loading helicity ##########" << endl;
546 "fPresentReading != fQ1_reading while QRT == 1 at timestamp "
547 "%f.\nHELICITY ASSIGNMENT MAY BE INCORRECT",
fTimestamp);
559 " qrt = %d present read = %d Q1 read = %d at timestamp %f.\n"
560 "HELICITY SET TO UNKNOWN",
586 "quad = %d tdiff = %f at timestamp %f. "
587 "HELICITY ASSIGNMENT MAY BE INCORRECT",
593 cout << dec <<
"Quad "<<
fInquad;
594 cout <<
" Time diff "<<
fTdiff;
595 cout <<
" Qrt "<<
fQrt;
608 static const char*
const here =
"QuadHelicity";
619 if (cond == 0 &&
fNB>0
634 for(
int i = 0; i <
kNbits+1; i++) {
647 for(
int i = 0; i <
fG0delay/4; i++)
656 cout <<
"quad helicities " << dec;
661 <<
" <<<<<<<<<<<<<================================="
663 if (
CompHel()) cout <<
"HELICITY OK "<<endl;
710 for (
int i = 0; i < 20; i++)
711 seedbits[23-i] =
fHbits[i];
712 seedbits[3] =
fHbits[20]^seedbits[23];
713 seedbits[2] =
fHbits[21]^seedbits[22]^seedbits[23];
714 seedbits[1] =
fHbits[22]^seedbits[21]^seedbits[22];
715 seedbits[0] =
fHbits[23]^seedbits[20]^seedbits[21]^seedbits[23];
716 for (
int i=
kNbits-1; i >= 0; i--)
717 ranseed = ranseed<<1|(seedbits[i]&1);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char mode
static const Int_t kDefaultDelay
static const Double_t kDefaultTdavg
static const Double_t kDefaultTtol
static const Int_t kDefaultMissQ
static const char *const here
virtual Int_t Fill(const char *name, Double_t w)
virtual void SetDebug(Int_t level)
static Int_t LoadDB(FILE *file, const TDatime &date, const DBRequest *request, const char *prefix, Int_t search=0, const char *here="THaAnalysisObject::LoadDB")
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 FILE * OpenFile(const TDatime &date)
virtual Int_t ReadData(const THaEvData &evdata)
Int_t ReadDatabase(const char *dbfilename, const char *prefix, const TDatime &date, int debug_flag=0)
virtual void Clear(Option_t *opt="")
Int_t fTEPresentReadingQ1
virtual Int_t ReadDatabase(const TDatime &date)
void SetMaxMsQrt(Int_t missq)
virtual Int_t DefineVariables(EMode mode=kDefine)
void SetTtol(Double_t ttol)
virtual Int_t End(THaRunBase *r=nullptr)
virtual void SetDebug(Int_t level)
EHelicity RanBit(Int_t i)
virtual Int_t Decode(const THaEvData &evdata)
virtual void Clear(Option_t *opt="")
void SetTdavg(Double_t tdavg)
EHelicity fPresent_helicity
EHelicity fQ1_present_helicity
EHelicity fSaved_helicity
void QuadHelicity(Int_t cond=0)
virtual Bool_t HelicityValid() const
virtual Int_t Begin(THaRunBase *r=nullptr)
void SetG0Delay(Int_t delay)
virtual void Clear(Option_t *opt="")
virtual Int_t ReadDatabase(const TDatime &date)
virtual const char * GetDBFileName() const
virtual Int_t DefineVariables(EMode mode=kDefine)
const char * GetName() const override
void Clear(Option_t *option="") override
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
RVec< PromoteTypes< T0, T1 > > fmod(const RVec< T0 > &v, const T1 &y)
Double_t Floor(Double_t x)