26 #include "THaGlobals.h"
38 : THaEvtTypeHandler(name,description)
62 typedef std::map<Int_t, CrateInfo_t *> cmap_t;
63 typedef std::map<Int_t, Int_t *> imap_t;
83 if ( !IsMyEvent(evdata->
GetEvType()) )
return -1;
85 if (ldebug) cout <<
"------------------\n Event type 125"<<endl;
91 Int_t roc = thisword & 0xff;
92 cout <<
"THcConfigEvtHandler: " << roc << endl;
108 if (thisword == 0xdafadcff) {
111 cout <<
"ADC thresholds for slots ";
112 while((thisword & 0xfffff000)==0xfadcf000) {
113 Int_t slot = thisword&0x1f;
119 for(
Int_t i=0;i<16;i++) {
125 cout << endl <<
"Info event truncated" << endl;
132 }
else if((thisword&0xffffff00) == 0xdafadc00) {
133 cout <<
"ADC information: Block level " << (thisword&0xff) << endl;
148 }
else if (thisword == 0xdedc1190) {
149 cout <<
"TDC information" << endl;
155 }
else if (thisword == 0xd0000000) {
159 if((versionword & 0xffff0000) != 0xabcd0000) {
160 cout <<
"Unexpected TI info word " << hex << thisword << dec << endl;
161 cout <<
" Expected 0xabcdNNNN" << endl;
164 Int_t version = versionword & 0xffff;
178 if(lastword != 0xd000000f) {
179 cout <<
"Unexpected last word of TI information block "
180 << hex << lastword << dec << endl;
184 cout <<
"Expected header missing" << endl;
185 cout << ip <<
" " << hex << thisword << dec << endl;
190 cout <<
"Making Parms for ROC " << roc <<
" Event type " << evdata->
GetEvType() << endl;
201 std::map<Int_t, CrateInfo_t *>::iterator it =
CrateInfoMap.begin();
203 Int_t thisroc = it->first;
213 gHcParms->Define(
Form(
"g%s_tdc_resolution_%d",fName.Data(),roc),
"TDC resolution",resolution);
215 gHcParms->Define(
Form(
"g%s_tdc_offset_%d",fName.Data(),roc),
"TDC Time Window Offset",offset);
217 gHcParms->Define(
Form(
"g%s_tdc_width_%d",fName.Data(),roc),
"TDC Time Window Width",width);
224 Int_t slot = itt->first;
232 gHcParms->Define(
Form(
"g%s_adc_thresholds_%d_%d[16]",fName.Data(),roc,slot),
"ADC Thresholds",*itt->second);
235 gHcParms->Define(
Form(
"g%s_adc_mode_%d_%d",fName.Data(),roc,slot),
"ADC Mode",mode);
237 gHcParms->Define(
Form(
"g%s_adc_latency_%d_%d",fName.Data(),roc,slot),
"Window Latency",latency);
240 gHcParms->Define(
Form(
"g%s_adc_width_%d_%d",fName.Data(),roc,slot),
"Window Width",width);
243 gHcParms->Define(
Form(
"g%s_adc_daclevely_%d_%d",fName.Data(),roc,slot),
"DAC Level",daclevel);
245 gHcParms->Define(
Form(
"g%s_adc_nped_%d_%d",fName.Data(),roc,slot),
"NPED",nped);
247 gHcParms->Define(
Form(
"g%s_adc_nsa_%d_%d",fName.Data(),roc,slot),
"NSA",nsa);
249 gHcParms->Define(
Form(
"g%s_adc_maxped_%d_%d",fName.Data(),roc,slot),
"MAXPED",maxped);
251 gHcParms->Define(
Form(
"g%s_adc_np_%d_%d",fName.Data(),roc,slot),
"NP",np);
260 gHcParms->Define(
Form(
"g%s_ti_nped",fName.Data()),
"Number of Pedestal events",nped);
262 gHcParms->Define(
Form(
"g%s_ti_scaler_period",fName.Data()),
"Number of Pedestal events",scaler_period);
264 gHcParms->Define(
Form(
"g%s_ti_sync_count",fName.Data()),
"Number of Pedestal events",sync_count);
271 ps_factors[i] = (1<<(ps_exps[i]-1)) + 1;
272 }
else if (ps_exps[i] == 0) {
291 std::map<Int_t, CrateInfo_t *>::iterator it =
CrateInfoMap.begin();
293 Int_t roc = it->first;
294 cout <<
"================= Configuration Data ROC " << roc <<
"==================" << endl;
297 cout <<
" CAEN 1190 Configuration" << endl;
303 cout <<
" FADC250 Configuration" << endl;
311 cout <<
" Thresholds";
314 Int_t slot = itt->first;
315 cout <<
" " << setw(5) << slot;
319 for(
Int_t ichan=0;ichan<16;ichan++) {
320 cout <<
" " << setw(2) << ichan <<
" ";
323 Int_t *thresholds = itt->second;
324 cout <<
" " << setw(5) << thresholds[ichan];
331 cout <<
" TI Configuration" << endl;
332 cout <<
" N Pedestals: " << cinfo->
TI.
nped <<
" events" << endl;
333 cout <<
" Scaler Period: " << cinfo->
TI.
scaler_period <<
" seconds" << endl;
334 cout <<
" Sync interval: " << cinfo->
TI.
sync_count <<
" events" << endl;
335 cout <<
" Prescales: ";
375 eventtypes.push_back(evtype);
381 cout <<
"Howdy ! We are initializing THcConfigEvtHandler !! name = "<<fName<<endl;
383 if(eventtypes.size()==0) {
384 eventtypes.push_back(125);
virtual ~THcConfigEvtHandler()
virtual void PrintConfig()
virtual void AddEventType(Int_t evtype)
virtual Int_t GetNSA(Int_t crate)
virtual EStatus Init(const TDatime &run_time)
virtual Int_t IsPresent(Int_t crate)
struct THcConfigEvtHandler::CrateInfo_t::TI TI
virtual void MakeParms(Int_t roc)
void DeleteCrateInfoMap()
THcConfigEvtHandler(const char *name, const char *description)
UInt_t GetEvLength() const
struct THcConfigEvtHandler::CrateInfo_t::FADC250 FADC250
std::map< Int_t, CrateInfo_t * > CrateInfoMap
Analyze Hall C Configuration events. (Event type 125).
char * Form(const char *fmt,...)
virtual Int_t GetNSB(Int_t crate)
virtual Int_t GetNPED(Int_t crate)
ClassImp(THcDCLookupTTDConv) THcDCLookupTTDConv
virtual Int_t Analyze(THaEvData *evdata)
struct THcConfigEvtHandler::CrateInfo_t::CAEN1190 CAEN1190
std::map< Int_t, Int_t * > thresholds
UInt_t GetRawData(UInt_t crate, UInt_t slot, UInt_t hit) const
R__EXTERN class THcParmList * gHcParms