8 #ifndef _DTranslationTable_
9 #define _DTranslationTable_
17 #include <JANA/JObject.h>
18 #include <JANA/JFactory.h>
19 #include <JANA/JEventLoop.h>
20 #include <JANA/JCalibration.h>
21 #include <JANA/JException.h>
22 #include <JANA/JEventSource.h>
80 X(DFDCCathodeDigiHit) \
95 X(DTPOLSectorDigiHit) \
100 #define MyfADCTypes(X) \
106 X(DFDCCathodeDigiHit) \
113 X(DTPOLSectorDigiHit) \
165 case BCAL:
return "BCAL";
166 case CDC:
return "CDC";
167 case FCAL:
return "FCAL";
168 case CCAL:
return "CCAL";
169 case CCAL_REF:
return "CCAL_REF";
170 case FDC_CATHODES:
return "FDC_CATHODES";
171 case FDC_WIRES:
return "FDC_WIRES";
172 case PS:
return "PS";
173 case PSC:
return "PSC";
174 case RF:
return "RF";
175 case SC:
return "SC";
176 case TAGH:
return "TAGH";
177 case TAGM:
return "TAGM";
178 case TOF:
return "TOF";
179 case TPOLSECTOR:
return "TPOL";
180 case TAC:
return "TAC";
181 case DIRC:
return "DIRC";
182 case UNKNOWN_DETECTOR:
197 && (sector==rhs.
sector) && (end==rhs.
end);
207 return (ring==rhs.
ring) && (straw==rhs.
straw);
217 return (row==rhs.
row) && (col==rhs.
col);
227 return (row==rhs.
row) && (col==rhs.
col);
272 return (side==rhs.
side) && (
id==rhs.
id);
290 return (dSystem == rhs.
dSystem);
299 return (sector==rhs.
sector);
318 return (col==rhs.
col) && (row==rhs.
row);
329 return (plane==rhs.
plane) && (bar==rhs.
bar) && (end==rhs.
end);
338 return (sector==rhs.
sector);
354 return (pixel==rhs.
pixel);
397 #define makevector(A) mutable vector<A*> v##A;
401 #define makefactoryptr(A) JFactory<A> *fac_##A;
405 #define copyfactoryptr(A) fac_##A = (JFactory<A>*)loop->GetFactory(#A);
409 #define clearvector(A) v##A.clear();
413 #define copytofactory(A) fac_##A->CopyTo(v##A);
418 #define checkclassname(A) if(classname==#A) return true;
425 #define printvectorsize(A) ttout << " v" #A ".size() = " << v##A.size() << std::endl;
433 #define makefadcconfigparam1(A) uint32_t NSAMPLES_INTEGRAL_##A;
434 #define makefadcconfigparam2(A) uint32_t NSAMPLES_PEDESTAL_##A;
439 void InitNsamplesOverride(
void){
440 #define setdefaultfadc(A) {\
441 NSAMPLES_INTEGRAL_##A = NSAMPLES_PEDESTAL_##A = 0; \
442 gPARMS->SetDefaultParameter("TT:NSAMPLES_INTEGRAL_" #A, NSAMPLES_INTEGRAL_##A, "Overwrite the nsamples_integral field of all " #A " objects with this"); \
443 gPARMS->SetDefaultParameter("TT:NSAMPLES_PEDESTAL_" #A, NSAMPLES_PEDESTAL_##A, "Overwrite the nsamples_pedestal field of all " #A " objects with this"); \
450 #define overwritensamples(A) {\
451 if(NSAMPLES_INTEGRAL_##A > 0) for(auto h : v##A) h->nsamples_integral = NSAMPLES_INTEGRAL_##A; \
452 if(NSAMPLES_PEDESTAL_##A > 0) for(auto h : v##A) h->nsamples_pedestal = NSAMPLES_PEDESTAL_##A; \
461 void ApplyTranslationTable(jana::JEventLoop *loop)
const;
516 void Addf250ObjectsToCallStack(JEventLoop *loop,
string caller)
const;
517 void Addf125CDCObjectsToCallStack(JEventLoop *loop,
string caller,
bool addpulseobjs)
const;
518 void Addf125FDCObjectsToCallStack(JEventLoop *loop,
string caller,
bool addpulseobjs)
const;
519 void AddF1TDCObjectsToCallStack(JEventLoop *loop,
string caller)
const;
520 void AddCAEN1290TDCObjectsToCallStack(JEventLoop *loop,
string caller)
const;
521 void AddToCallStack(JEventLoop *loop,
string caller,
string callee)
const;
523 void ReadOptionalROCidTranslation(
void);
524 static void SetSystemsToParse(
string systems, JEventSource *eventsource);
526 void ReadTranslationTable(JCalibration *jcalib=NULL);
529 template<
class T>
void CopyDf250Info(T *
h,
const Df250PulseData *pd)
const;
531 template<
class T>
void CopyDF1TDCInfo(T *
h,
const DF1TDCHit *hit)
const;
532 template<
class T>
void CopyDCAEN1290TDCInfo(T *
h,
const DCAEN1290TDCHit *hit)
const;
533 template<
class T>
void CopyDIRCTDCInfo(T *
h,
const DDIRCTDCHit *hit)
const;
537 const DChannelInfo &GetDetectorIndex(
const csc_t &in_daq_index)
const;
538 const csc_t &GetDAQIndex(
const DChannelInfo &in_channel)
const;
541 static map<DTranslationTable::Detector_t, set<uint32_t> >& Get_ROCID_By_System(
void);
550 if (type ==
"vmecpu") {
552 }
else if (type ==
"tid") {
554 }
else if (type ==
"fadc250") {
556 }
else if (type ==
"fadc125") {
558 }
else if (type ==
"f1tdcv2") {
560 }
else if (type ==
"f1tdcv3") {
562 }
else if (type ==
"jldisc") {
564 }
else if (type ==
"vx1290a") {
582 string Channel2Str(
const DChannelInfo &in_channel)
const;
606 pthread_mutex_t& Get_TT_Mutex(
void)
const;
607 bool& Get_TT_Initialized(
void)
const;
608 map<DTranslationTable::csc_t, DTranslationTable::DChannelInfo>& Get_TT(
void)
const;
609 map<uint32_t, uint32_t>& Get_ROCID_Map(
void)
const;
610 map<uint32_t, uint32_t>& Get_ROCID_Inv_Map(
void)
const;
621 h->pulse_time = pt==NULL ? 0:pt->
time;
629 h->AddAssociatedObject(pi);
630 if(pt) h->AddAssociatedObject(pt);
631 if(pp) h->AddAssociatedObject(pp);
659 h->AddAssociatedObject(pd);
670 h->pulse_time = pt==NULL ? 0:pt->
time;
676 h->AddAssociatedObject(pi);
677 if(pt) h->AddAssociatedObject(pt);
678 if(pp) h->AddAssociatedObject(pp);
690 h->AddAssociatedObject(hit);
702 h->AddAssociatedObject(hit);
715 h->AddAssociatedObject(hit);
721 #undef makefactoryptr
722 #undef copyfactoryptr
725 #undef checkclassname
726 #undef printvectorsize
727 #undef makefadcconfigparam1
728 #undef makefadcconfigparam2
729 #undef setdefaultfadc
730 #undef overwritensamples
732 #endif // _DTranslationTable_
#define overwritensamples(A)
bool operator==(const CCALIndex_t &rhs) const
uint32_t nsamples_integral
number of samples used in integral
void CopyDf125Info(T *h, const Df125PulseIntegral *pi, const Df125PulseTime *pt, const Df125PulsePedestal *pp) const
uint32_t nsamples_pedestal
number of samples used in pedestal
uint32_t pedestal
from Pulse Integral Data word (future)
bool operator==(const TAGMIndex_t &rhs) const
bool operator==(const TPOLSECTORIndex_t &rhs) const
uint32_t time
16 bit relative to beginning of defined readout window
bool operator==(const FDC_CathodesIndex_t &rhs) const
void ClearVectors(void) const
bool IsSuppliedType(string &classname) const
FDC_CathodesIndex_t fdc_cathodes
TPOLSECTORIndex_t tpolsector
uint32_t quality_factor
from Pulse Integral Data word
void CopyDCAEN1290TDCInfo(T *h, const DCAEN1290TDCHit *hit) const
bool emulated
true if made from Window Raw Data
uint32_t quality_factor
from Pulse Integral Data word
#define makefactoryptr(A)
bool operator==(const TOFIndex_t &rhs) const
bool operator==(const CCALRefIndex_t &rhs) const
#define makefadcconfigparam1(A)
void OverwriteNsamples(void) const
static int ModuleStr2ModID(string &type)
uint32_t nsamples_integral
number of samples used in integral
bool operator==(const PSIndex_t &rhs) const
uint32_t pulse_peak
from Pulse Pedestal Data word
#define printvectorsize(A)
bool operator==(const BCALIndex_t &rhs) const
bool operator==(const PSCIndex_t &rhs) const
bool operator==(const TACIndex_t &rhs) const
bool operator==(const DIRCIndex_t &rhs) const
uint32_t edge
0=leading edge 1=trailing edge
bool emulated
true if made from Window Raw Data
DModuleType::type_id_t module_type
uint32_t nsamples_integral
number of samples used in integral
#define makefadcconfigparam2(A)
uint32_t time
from Pulse Time Data word
bool operator==(const FCALIndex_t &rhs) const
void PrintVectorSizes(void) const
void CopyDF1TDCInfo(T *h, const DF1TDCHit *hit) const
void CopyDIRCTDCInfo(T *h, const DDIRCTDCHit *hit) const
uint32_t time
from Pulse Time Data word
void CopyToFactories(void) const
void SetSystemsToParse(JEventSource *eventsource)
uint32_t integral
from Pulse Integral Data word
uint32_t pedestal
from Pulse Integral Data word (future)
bool operator==(const FDC_WiresIndex_t &rhs) const
uint32_t integral
from Pulse Integral Data word
bool operator==(const RFIndex_t &rhs) const
bool operator==(const SCIndex_t &rhs) const
void CopyDf250Info(T *h, const Df250PulseIntegral *pi, const Df250PulseTime *pt, const Df250PulsePedestal *pp) const
set< string > supplied_data_types
uint32_t nsamples_pedestal
number of samples used in pedestal
bool operator==(const CDCIndex_t &rhs) const
string ROCID_MAP_FILENAME
uint32_t nsamples_pedestal
number of samples used in pedestal
bool operator==(const TAGHIndex_t &rhs) const
FDC_WiresIndex_t fdc_wires
void InitFactoryPointers(JEventLoop *loop)
#define copyfactoryptr(A)
bool operator==(const struct csc_t &rhs) const
static string DetectorName(Detector_t type)
#define setdefaultfadc(A)
#define checkclassname(A)