26 fOffsetTIRvsRing(3), fQWEAKDelay(8), fMAXBIT(30),
27 fQWEAKNPattern(4), HWPIN(true), fQrt(1), fTSettle(0),fValidHel(false),
28 fHelicityLastTIR(0),fPatternLastTIR(0), fErrorCode(0), fRing_NSeed(0),
29 fRingU3plus(0),fRingU3minus(0),
30 fRingT3plus(0),fRingT3minus(0),
31 fRingT5plus(0),fRingT5minus(0),
32 fRingT10plus(0),fRingT10minus(0),
33 fRingTimeplus(0), fRingTimeminus(0),
34 fRingSeed_reported(0),fRingSeed_actual(0),
35 fRingPhase_reported(0),fRing_reported_polarity(0),
36 fRing_actual_polarity(0), fEvtype(-1), fHisto(NHIST, nullptr)
42 : fOffsetTIRvsRing(3), fQWEAKDelay(8), fMAXBIT(30),
43 fQWEAKNPattern(4), HWPIN(true), fQrt(1), fTSettle(0),fValidHel(false),
44 fHelicityLastTIR(0),fPatternLastTIR(0), fErrorCode(0), fRing_NSeed(0),
45 fRingU3plus(0),fRingU3minus(0),
46 fRingT3plus(0),fRingT3minus(0),
47 fRingT5plus(0),fRingT5minus(0),
48 fRingT10plus(0),fRingT10minus(0),
49 fRingTimeplus(0), fRingTimeminus(0),
50 fRingSeed_reported(0),fRingSeed_actual(0),
51 fRingPhase_reported(0),fRing_reported_polarity(0),
52 fRing_actual_polarity(0), fEvtype(-1), fHisto(NHIST, nullptr)
80 const RVarDef var[] = {
81 {
"qrt",
"actual qrt for TIR event",
"fQrt" },
82 {
"hel",
"actual helicity for TIR event",
"fHelicity" },
83 {
"tsettle",
"TSettle for TIR event",
"fTSettle"},
84 {
"U3plus",
"U3 plus",
"fRingU3plus"},
85 {
"U3minus",
"U3 minus",
"fRingU3minus"},
86 {
"T3plus",
"T3 plus",
"fRingT3plus"},
87 {
"T3minus",
"T3 minus",
"fRingT3minus"},
88 {
"T5plus",
"T5 plus",
"fRingT5plus"},
89 {
"T5minus",
"T5 minus",
"fRingT5minus"},
90 {
"T10plus",
"T10 plus",
"fRingT10plus"},
91 {
"T10minus",
"T10 minus",
"fRingT10minus"},
92 {
"Timeminus",
"Time minus",
"fRingTimeminus"},
93 {
"Timeplus",
"Time plus",
"fRingTimeplus"},
104 cout<<
" ++++++ THaQWEAKHelicity::Print ++++++\n";
105 cout << dec <<
"--> Data for spectrometer " <<
GetName() << endl;
106 cout <<
" evtype " <<
fEvtype<<endl;
107 cout <<
" event number ="<<evtnum<<endl;
108 cout <<
" == Input register data =="<<endl;
111 cout <<
" == Ring data =="<<endl;
132 cout<<
" == outputs ==\n";
139 cout<<
" +++++++++++++++++++++++++++++++++++++\n";
174 fHisto[0] =
new TH1F(
"hel.seed",
"hel.seed",32,-1.5,30.5);
175 fHisto[1] =
new TH1F(
"hel.error.code",
"hel.error.code",35,-1.5,33.5);
235 Error(
Here(
"THaQWEAKHelicity::Decode"),
"Error decoding helicity data." );
262 static const char*
const here =
"THaQWEAKHelicity::CheckTIRvsRing";
274 cout<<
here<<
" BAD !! the offset between the helicity ring and the input register ";
275 cout <<
"is not what is expected: reset the seed !! event#" << eventnumber <<
"\n";
281 cout<<
"=====================================\n";
283 cout <<
" Event number =" << eventnumber << endl;
287 cout<<
" fIRing="<<
fIRing<<endl;
322 static const char*
const here =
"THaQWEAKHelicity::LoadHelicity";
339 cout <<
here <<
" Reset seed: The pattern has too many elements !! "
342 <<
" at event #=" << eventnumber
367 cout<<
here<<
" Catastrophe !!"
368 <<
" predicted helicity doesn't match reported helicity !!!"
369 <<
" event #="<<eventnumber
372 cout<<
" iring="<<
Form(
"%02d", i)
409 if(localhelicity==
kPlus)
417 else if(localhelicity==
kMinus)
428 cout<<
here<<
" TROUBLE !! Local helicity doesn't make sense"
429 <<
" event #="<<eventnumber<<endl;
438 cout<<
" iring="<<
Form(
"%02d", i)
446 <<
", actual hel="<<localhelicity
475 localfPolarity=
RanBit30(localfSeed);
486 std::cout<<
"TROUBLE !!! when predicting the actual helicity for the CODA "
487 <<
" event #="<<eventnumber<<endl;
508 if( select == -1 || select == 2 ) {
513 }
else if( select == 1 || select == 0 ) {
534 bool bit7 = (ranseed & 0x00000040) != 0;
535 bool bit28 = (ranseed & 0x08000000) != 0;
536 bool bit29 = (ranseed & 0x10000000) != 0;
537 bool bit30 = (ranseed & 0x20000000) != 0;
539 UInt_t newbit = (bit30 ^ bit29 ^ bit28 ^ bit7) & 0x1;
543 std::cerr<<
"ranseed must be greater than zero!"<<
"\n";
547 ranseed = ( (ranseed<<1) | newbit ) & 0x3FFFFFFF;
550 cout <<
"THaQWEAKHelicity::RanBit30, newbit=" << newbit <<
"\n";
Option_t Option_t TPoint TPoint const char mode
static const char *const here
char * Form(const char *fmt,...)
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 Clear(Option_t *opt="")
virtual Int_t ReadDatabase(const TDatime &date)
virtual const char * GetDBFileName() const
virtual Int_t DefineVariables(EMode mode=kDefine)
UInt_t fTimeStampRing[kHelRingDepth]
UInt_t fPatternRing[kHelRingDepth]
UInt_t fT3Ring[kHelRingDepth]
UInt_t fHelicityRing[kHelRingDepth]
UInt_t fT10Ring[kHelRingDepth]
virtual void Clear(Option_t *opt="")
UInt_t fU3Ring[kHelRingDepth]
virtual Int_t ReadData(const THaEvData &evdata)
UInt_t fT5Ring[kHelRingDepth]
Int_t ReadDatabase(const char *dbfilename, const char *prefix, const TDatime &date, int debug_flag=0)
UInt_t fRing_actual_polarity
void PrintEvent(UInt_t evtnum)
THaHelicityDet::EHelicity SetHelicity(UInt_t polarity, UInt_t phase)
UInt_t fRing_reported_polarity
virtual void Clear(Option_t *opt="")
UInt_t fRingSeed_reported
virtual Int_t Decode(const THaEvData &evdata)
virtual Int_t DefineVariables(EMode mode=kDefine)
void LoadHelicity(UInt_t eventnumber)
virtual Int_t ReadDatabase(const TDatime &date)
std::vector< Int_t > fPatternSequence
UInt_t RanBit30(UInt_t &ranseed)
virtual void SetDebug(Int_t level)
void SetErrorCode(Int_t error)
UInt_t fRingPhase_reported
std::vector< TH1F * > fHisto
virtual ~THaQWEAKHelicity()
void CheckTIRvsRing(UInt_t eventnumber)
const char * GetName() const override
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