16 #include "hcategory.h"
20 #include "hldsource.h"
21 #include "hldsubevt.h"
30 #include "htrbnetunpacker.h"
48 #define TOF_TIME_MIN -300.0
49 #define TOF_TIME_MAX 1500.0
54 fLookup(0), fTimeRef(kTRUE), fTimeShift(0.) {
64 Error(
"init",
"No TOF Detector found.");
73 if (!pRawCat)
return kFALSE;
81 Error(
"init",
"No Pointer to parameter container TofTrb3Lookup.");
85 if (NULL == trbNetUnpacker) {
88 if (source->InheritsFrom(
"HldSource")) {
93 "DataSource not inherited from HldSource! trbNetUnpacker == 0 ");
97 "Could not retrieve DataSource! trbNetUnpacker == 0 ");
101 if (!trbNetUnpacker->init()) {
102 Error(
"init()",
"Failed to initialize HTrbNetUnpacker!");
118 if (fMinAddress == 0 && fMaxAddress == 0)
123 for (Int_t slot = 0; slot < numTDC; ++slot) {
125 Int_t trbnetaddress = offset+slot;
131 Int_t tindex = addTDC(trbnetaddress,nChan);
132 Info(
"reinit",
"Added TDC 0x%04x with %d channels from HTofTrb3Lookup to map index %d",
133 trbnetaddress, nChan,tindex);
142 fUseTDCFromLookup = kTRUE;
146 Info(
"reinit",
"TDCs will be added in auto register mode between min address 0x%04x and max address 0x%04x!",fMinAddress,fMaxAddress);
177 "subsubevent decoding failed!!! Evt Nr : %i SubEvtId: %x", nEvt,
188 correctRefTimeCh(REFCHAN);
191 const Double_t timeUnit=1e9;
194 for (UInt_t ntdc = 0; ntdc < numActiveTDC(); ntdc++) {
195 HTrb3TdcUnpacker::TDC* tdc = getActiveTDC(ntdc);
202 "Evt Nr : %i SubEvId: %x (%i) unpacked but TDC Board 0x%x not in lookup table",
203 nEvt, getSubEvtId(), getSubEvtId(), tdc->getTrbAddr());
208 for (UInt_t i = 0; i < tdc->numChannels(); i++) {
209 if(REFCHAN == i)
continue;
211 HTrb3TdcUnpacker::ChannelRec& theRecord = tdc->getCh(i);
214 #ifndef TOF_USE_TRAILING_WITHOUT_LEADING_EDGES
215 if (theRecord.rising_mult < 1)
220 Warning(
"execute",
"Missing channel %u in lookup table", i);
237 #ifdef TOF_USE_TIME_WINDOW
243 for (lix = 0; lix < theRecord.rising_mult; ++lix) {
244 Double_t tm0 = theRecord.rising_tm[lix] * timeUnit;
246 Warning(
"execute",
"JJJJ current hit leading: tm0:%e, apply time shift:%e", tm0,
fTimeShift);
249 #ifdef TOF_USE_TIME_WINDOW
250 if ((tm0 < tmin) || (tm0 > tmax)) {
253 "JJJJ Rejecting leading hit outside tmin:%e or tmax:%e",
260 if (lix < theRecord.falling_mult) {
261 Double_t tm1 = theRecord.falling_tm[lix] * timeUnit;
263 Warning(
"execute",
"JJJJ current hit falling: tm1:%e, apply time shift:%e",
268 #ifdef TOF_USE_TIME_WINDOW
269 if ((tm1 < tmin) || (tm1 > tmax)) {
272 "JJJJ Rejecting trailing hit outside tmin:%e or tmax:%e",
275 #ifdef TOF_USE_LEADING_WITHOUT_TRAILING_EDGES
297 #ifdef TOF_USE_LEADING_WITHOUT_TRAILING_EDGES
307 #ifdef TOF_USE_TRAILING_WITHOUT_LEADING_EDGES
309 for (UInt_t tix=lix; tix< theRecord.falling_mult; ++tix)
311 Double_t tm1=theRecord.falling_tm[tix] * timeUnit;
313 #ifdef TOF_USE_TIME_WINDOW
314 if ((tm1 < tmin) || (tm1 > tmax)) {
318 "JJJJ Rejecting trailing hit outside tmin:%e or tmax:%e",
357 Warning(
"addRawHit()",
"Can't get slot sec=%i, column=%i, cell=%i",
368 }
else if (side==
'l') {
377 "ADDING hit for sec:%d column:%d cell:%d tm0:%e tm1:%e",
virtual Bool_t addCategory(Cat_t aCat, HCategory *cat, Option_t opt[])=0
void setLeftCharge(Float_t aleftQ)
void setLeftTime(Float_t aleftT)
void getAddress(Int_t &s, Int_t &m, Int_t &c, Char_t &t)
HDataSource * getDataSource(void) const
HRuntimeDb * getRuntimeDb(void)
HEvent *& getCurrentEvent(void)
static Bool_t fHasPrintedTDC
virtual HEventHeader * getHeader(void) const
ClassImp(HDbColumn) HDbColumn
void setRightCharge(Float_t arightQ)
HTofTrb3LookupBoard * getBoard(Int_t trbnetAddress)
HTofTrb3LookupChan * getChannel(Int_t c)
HSpectrometer * getSetup(void)
HDetector * getDetector(const Char_t *name)
virtual HCategory * buildCategory(Cat_t)
HTofTrb3Unpacker(vector< UInt_t > &ids)
HParSet * getContainer(const Text_t *)
Int_t addRawHit(Double_t t_leading, Double_t t_trailing, HTofTrb3LookupChan *chan)
void setRightTime(Float_t arightT)