48 for(
const auto& name :
fParms )
62 static const char*
const here =
"THcConfigEvtHandler::Analyze";
67 cout <<
"------------------\n Event type 125"<<endl;
68 const char* whereami =
Here(here);
82 ostr << whereami <<
": CODA3 bank decoding error \""
83 << bankinfo.Errtxt() <<
"\"";
89 ostr << whereami <<
": CODA3 bank does not contain 32-bit integer "
90 "data, found " << bankinfo.Typtxt();
93 if( ip + bankinfo.len_ > evlen ) {
95 ostr << whereami <<
": CODA3 bank size too large, pos+len = "
96 << ip+bankinfo.len_ <<
", evlen = " << evlen;
102 UInt_t roc = header & 0xff;
104 cout << whereami <<
": Found config for ROC " << roc << endl;
109 auto& cinfo = ins.first->second;
116 while( ip < evlen ) {
119 if( (thisword & 0xffffff00) == 0xdafadc00 ) {
123 }
else if( thisword == 0xdedc1190 ) {
127 }
else if( thisword == 0xd0000000 ) {
132 cerr << whereami <<
": Expected header missing"
133 <<
"pos " << ip <<
", data " << hex << thisword << dec << endl;
139 cout << whereami <<
": Making Parms for ROC " << roc <<
" Event type " << evdata->
GetEvType() << endl;
140 cinfo.MakeParms(*
this);
145 const auto& TI = cinfo.TI;
146 if(
gHaRun && TI.present ) {
148 for(
Int_t i = 0; i < Podd::SSIZE(TI.ps_factors); ++i ) {
149 prescales[i] = TI.ps_factors[i];
161 static const char* here =
"THcConfigEvtHandler::DecodeFADC250Config";
162 const char* whereami =
Here(here);
167 cout << whereami <<
": FADC250 config: Block level " << (thisword & 0xff) << endl;
169 cerr << whereami <<
": FADC250 config block unexpectedly too short. "
170 "Call expert." << endl;
174 if( (versionword & 0xffff0000) == 0xabcd0000 ) {
190 if( lastword != 0xdafadcff ) {
191 cerr << whereami <<
": Unexpected FADC250 configuration block trailer"
192 <<
", expected " << hex << 0xdafadcff <<
", got " << lastword << dec << endl;
195 cerr << whereami <<
": Unexpected FADC250 version word "
196 << hex << thisword << dec <<
", expected 0xabcdNNNN" << endl;
206 if( (thisword & 0xffffff00) != 0xfadcf000 )
210 cout << whereami <<
": FADC250 thresholds for slot";
211 while( (thisword & 0xffffff00) == 0xfadcf000 ) {
212 UInt_t slot = thisword & 0x1f;
216 cerr << whereami <<
": FADC250 threshold data block unexpectedly too "
217 "short. Call expert." << endl;
221 cfg.
thresholds.emplace(slot, std::array<UInt_t, NTHR>{});
225 for(
auto&
threshold: ithr.first->second ) {
231 if( lastword != (0xfadcff00 | slot) ) {
234 cerr << whereami <<
": Unexpected FADC250 threshold block trailer"
235 <<
", expected " << hex << (0xfadcff00 | slot)
236 <<
", got " << lastword << dec
237 <<
". Thresholds for this slot may be incorrect." << endl;
255 static const char* here =
"THcConfigEvtHandler::DecodeCAEN1190Config";
256 const char* whereami =
Here(here);
257 constexpr UInt_t trailer = 0xdedc119f;
260 cerr << whereami <<
": CAEN1190 config block unexpectedly too short. "
261 "Call expert." << endl;
265 cout << whereami <<
": CAEN1190 TDC information" << endl;
267 if( (versionword & 0xffff0000) == 0xabcd0000 ) {
274 if( lastword != trailer ) {
275 cerr << whereami <<
": Unexpected 1190 configuration block trailer"
276 <<
", expected " << hex << trailer <<
", got " << lastword << dec << endl;
281 cerr << whereami <<
": Unexpected 1190 version word "
282 << hex << versionword << dec <<
", expected 0xabcdNNNN" << endl;
291 static const char* here =
"THcConfigEvtHandler::DecodeTIConfig";
292 const char* whereami =
Here(here);
295 cerr << whereami <<
": CAEN1190 config block unexpectedly too short. "
296 "Call expert." << endl;
300 cout << whereami <<
": TI setup data" << endl;
303 if( (versionword & 0xffff0000) == 0xabcd0000 ) {
304 UInt_t version = versionword & 0xffff;
310 cerr << whereami <<
": CAEN1190 config block unexpectedly too short. "
311 "Call expert." << endl;
327 if( ps > 0 && ps <= 16 )
328 fact = (1 << (ps - 1)) + 1;
334 cerr << whereami <<
": Invalid CODA3 prescale = " << ps <<
". "
335 <<
"Must be between -1 and 16 (inclusive)" << endl;
343 if( lastword != 0xd000000f ) {
344 cerr << whereami <<
": Unexpected last word of TI information block "
345 << hex << lastword << dec << endl;
348 cerr << whereami <<
": Unexpected TI info word " << hex << versionword
349 << dec << endl <<
" Expected 0xabcdNNNN" << endl;
362 const auto& cinfo = it->second;
363 cinfo.MakeParms(*
this);
370 cout <<
"+================= Configuration Data ROC "
371 << crate_config.first <<
" ==================" << endl;
372 crate_config.second.Print();
380 const auto& cinfo = it->second;
381 return cinfo.FADC250.present;
389 const auto& cinfo = it->second;
390 if( cinfo.FADC250.present )
391 return cinfo.FADC250.nsa;
399 const auto& cinfo = it->second;
400 if( cinfo.FADC250.present )
401 return cinfo.FADC250.nsb;
409 const auto& cinfo = it->second;
410 if( cinfo.FADC250.present )
411 return cinfo.FADC250.nped;
430 auto& parm_names =
h.fParms;
431 const auto& modname =
h.
fName;
437 auto slot = islot.first;
438 const auto& thresholds = islot.second;
440 parm_names.emplace_back(
Form(
"g%s_adc_thresholds_%u_%u[%u]", modname.Data(),
roc, slot,
NTHR));
442 gHcParms->
Define(parm_names.back().c_str(),
"ADC Thresholds", *thresholds.data());
446 parm_names.emplace_back(
Form(
"g%s_adc_mode_%u_%u", modname.Data(),
roc, slot));
449 parm_names.emplace_back(
Form(
"g%s_adc_latency_%u_%u", modname.Data(),
roc, slot));
453 parm_names.emplace_back(
Form(
"g%s_adc_width_%u_%u", modname.Data(),
roc, slot));
457 parm_names.emplace_back(
Form(
"g%s_adc_daclevel_%u_%u", modname.Data(),
roc, slot));
460 parm_names.emplace_back(
Form(
"g%s_adc_nped_%u_%u", modname.Data(),
roc, slot));
463 parm_names.emplace_back(
Form(
"g%s_adc_nsa_%u_%u", modname.Data(),
roc, slot));
466 parm_names.emplace_back(
Form(
"g%s_adc_maxped_%u_%u", modname.Data(),
roc, slot));
469 parm_names.emplace_back(
Form(
"g%s_adc_np_%u_%u", modname.Data(),
roc, slot));
472 parm_names.emplace_back(
Form(
"g%s_adc_blocklevel_%u_%u", modname.Data(),
roc, slot));
481 parm_names.emplace_back(
Form(
"g%s_tdc_resolution_%d", modname.Data(),
roc));
484 parm_names.emplace_back(
Form(
"g%s_tdc_offset_%d", modname.Data(),
roc));
487 parm_names.emplace_back(
Form(
"g%s_tdc_width_%d", modname.Data(),
roc));
496 parm_names.emplace_back(
Form(
"g%s_ti_nped", modname.Data()));
499 "Number of Pedestal events",
TI.
nped);
500 parm_names.emplace_back(
Form(
"g%s_ti_scaler_period", modname.Data()));
504 parm_names.emplace_back(
Form(
"g%s_ti_sync_count", modname.Data()));
508 parm_names.emplace_back(
Form(
"g%s_ti_ps[%d]", modname.Data(),
NPS));
511 parm_names.emplace_back(
Form(
"g%s_ti_ps_factors[%d]", modname.Data(),
NPS));
524 cout <<
" CAEN 1190 Configuration" << endl;
530 cout <<
" FADC250 Configuration" << endl;
539 cout <<
" Thresholds";
541 auto slot = thr.first;
542 cout <<
" " << setw(5) << slot;
545 for(
UInt_t ichan = 0; ichan <
NTHR; ichan++ ) {
546 cout <<
" " << setw(2) << ichan <<
" ";
548 const auto& thresholds =
chan.second;
549 cout <<
" " << setw(5) << thresholds[ichan];
556 cout <<
" TI Configuration" << endl;
557 cout <<
" N Pedestals: " <<
TI.
nped <<
" events" << endl;
559 cout <<
" Sync interval: " <<
TI.
sync_count <<
" events" << endl;
560 cout <<
" Prescale exponents: ";
564 cout <<
" Prescale factors: ";
591 , timewindow_offset{0}
592 , timewindow_width{0}
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
R__EXTERN class THaRunBase * gHaRun
ClassImp(VDC::AnalyticTTDConv) using namespace std
R__EXTERN class THcParmList * gHcParms
char * Form(const char *fmt,...)
UInt_t threshold[NUMSLOTS][NADCCHAN]
virtual const char * Here(const char *) const
UInt_t GetRawData(UInt_t crate, UInt_t i) const
Int_t GetDataVersion() const
const UInt_t * GetRawDataBuffer() const
UInt_t GetEvLength() const
std::vector< UInt_t > eventtypes
virtual Bool_t IsMyEvent(UInt_t type) const
THaRunParameters * GetParameters() const
virtual Int_t RemoveName(const char *name)
THaVar * Define(const char *name, const Byte_t &var, const Int_t *count=nullptr)
Analyze Hall C Configuration events. (Event type 125).
UInt_t DecodeCAEN1190Config(THaEvData *evdata, UInt_t ip, UInt_t len, CrateConfig::CAEN1190_t &cfg)
static constexpr UInt_t NTHR
std::vector< std::string > fParms
virtual void PrintConfig()
Bool_t IsPresent(UInt_t crate)
UInt_t GetNSA(UInt_t crate)
virtual Int_t Analyze(THaEvData *evdata)
virtual void MakeParms(UInt_t roc)
THcConfigEvtHandler(const char *name, const char *description)
static constexpr UInt_t NPS
UInt_t GetNSB(UInt_t crate)
virtual ~THcConfigEvtHandler()
std::map< UInt_t, CrateConfig > fCrateInfoMap
UInt_t GetNPED(UInt_t crate)
UInt_t DecodeTIConfig(THaEvData *evdata, UInt_t ip, UInt_t len, CrateConfig::TI_t &cfg)
UInt_t DecodeFADC250Config(THaEvData *evdata, UInt_t ip, UInt_t len, CrateConfig::FADC250_t &cfg)
std::map< UInt_t, std::array< UInt_t, NTHR > > thresholds
std::array< Int_t, NPS > ps_factors
std::array< Int_t, NPS > prescales
Int_t MakeParms(THcConfigEvtHandler &h) const