63 , fScalerTree(nullptr)
87 *
fDebugFile << endl <<
"---------------------------------- " << endl << endl;
88 *
fDebugFile <<
"\nEnter THaScalerEvtHandler for fName = " <<
fName << endl;
100 *
fDebugFile << sname2 <<
" " << sname3 << endl;
110 for(
size_t i = 0; i <
scalerloc.size(); i++) {
123 cout <<
"THaScalerEvtHandler:: ERROR: Event length crazy " << endl;
128 *
fDebugFile << endl << endl <<
"THaScalerEvtHandler:: "
129 <<
"Debugging event type " << dec << evdata->
GetEvType() << endl << endl;
138 <<
" " << hex << *
p <<
" " << dec << endl;
141 for(
size_t j = 0; j <
scalers.size(); j++ ) {
145 <<
" nskip = " << nskip << endl;
157 *
fDebugFile <<
"Finished with decoding. " << endl;
158 *
fDebugFile <<
" Found flag = " << ifound << endl;
171 for(
size_t i = 0; i <
scalerloc.size(); i++ ) {
175 *
fDebugFile <<
"Debug dvars " << i <<
" " << idx <<
" " << ichan << endl;
183 <<
" " <<
dvars[i] << endl;
185 cout <<
"THaScalerEvtHandler:: ERROR:: incorrect index " << i
186 <<
" " << idx <<
" " << ichan << endl;
208 for(
size_t j = 5; j < dbline.size(); j++ ) {
212 Int_t islot = atoi(dbline[1].c_str());
213 Int_t ichan = atoi(dbline[2].c_str());
214 Int_t ikind = atoi(dbline[3].c_str());
216 *
fDebugFile <<
"add var " << dbline[1] <<
" desc = " << sdesc
217 <<
" islot= " << islot <<
" " << ichan
218 <<
" " << ikind << endl;
219 TString tsname(dbline[4].c_str());
221 AddVars(tsname, tsdesc, islot, ichan, ikind);
226 using ssiz_t =
decltype(
scalers)::size_type;
228 UInt_t icrate = 0, islot = 0, inorm = 0, header = 0,
mask = 0;
230 sscanf(cbuf,
"%20s %d %u %u %x %x %u \n",
231 cdum, &imodel, &icrate, &islot, &header, &
mask, &inorm);
233 cout <<
"THaScalerEvtHandler:: WARN: contradictory norm slot " << inorm << endl;
237 if( dbline.size() > 8 ) {
238 clkchan = atoi(dbline[7].c_str());
239 clkfreq =
static_cast<Double_t>( atoi(dbline[8].c_str()) );
242 *
fDebugFile <<
"map line " << dec << imodel <<
" " << icrate
243 <<
" " << islot << endl;
245 << dec <<
" " << inorm <<
" " << clkchan
246 <<
" " << clkfreq << endl;
265 ssiz_t idx =
scalers.size() - 1;
274 cout <<
"THaScalerEvtHandler:: WARN: contradictory norm slot ! "
277 *
fDebugFile <<
"Setting scaler clock ... channel = "
278 << clkchan <<
" ... freq = " << clkfreq
281 <<
" slot = " << islot << endl;
300 for(
size_t i1 = 0; i1 <
scalers.size() - 1; i1++ ) {
301 for(
size_t i2 = i1 + 1; i2 <
scalers.size(); i2++ ) {
303 cout <<
"THaScalerEvtHandler:: WARN: same slot defined twice" << endl;
310 for(
size_t i = 0; i <
scalers.size(); i++ ) {
312 if( loc->islot ==
scalers[i]->GetSlot() )
336 FILE *fi = Podd::OpenDBFile(sname.
Data(), date);
338 cout <<
"Cannot find db file for " <<
fName <<
" scaler event handler" << endl;
342 const char comment =
'#';
343 const string svariable =
"variable";
344 const string smap =
"map";
346 while( fgets(cbuf, LEN, fi) ) {
348 const vector<string> dbline = vsplit(cbuf);
351 assert(!dbline.front().empty() && !isspace(dbline.front()[0]));
352 if( dbline.front()[0] == comment )
355 if( dbline.size() > 4 && CmpNoCase(dbline.front(), svariable) == 0 ) {
358 else if( dbline.size() > 6 && CmpNoCase(dbline.front(), smap) == 0 ) {
367 if (
fName ==
"Left") {
385 if (
fName ==
"Left") {
390 scalers[0]->SetHeader(0xabc00000, 0xffff0000);
391 scalers[1]->SetHeader(0xabc10000, 0xffff0000);
392 scalers[2]->SetHeader(0xabc20000, 0xffff0000);
393 scalers[3]->SetHeader(0xabc30000, 0xffff0000);
395 scalers[1]->SetClock(4, 7, 1024);
403 scalers[0]->SetHeader(0xceb00000, 0xffff0000);
404 scalers[1]->SetHeader(0xceb10000, 0xffff0000);
405 scalers[2]->SetHeader(0xceb20000, 0xffff0000);
406 scalers[3]->SetHeader(0xceb30000, 0xffff0000);
407 scalers[0]->SetClock(4, 7, 1024);
421 *
fDebugFile <<
"THaScalerEvtHandler:: Name of scaler bank "<<
fName<<endl;
422 for (
size_t i=0; i<
scalers.size(); i++) {
455 cout <<
"No gHaVars ?! Well, that's a problem !!" << endl;
460 const Int_t* count =
nullptr;
461 for(
size_t i = 0; i <
scalerloc.size(); i++ ) {
winID h TVirtualViewer3D TVirtualGLPainter p
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 mask
R__EXTERN class THaVarList * gHaVars
static const UInt_t IRATE
static const UInt_t defaultDT
static const UInt_t ICOUNT
static const UInt_t MAXCHAN
static const UInt_t MAXTEVT
const UInt_t * GetRawDataBuffer() const
UInt_t GetEvLength() const
virtual void AddEvtType(UInt_t evtype)
virtual Bool_t IsMyEvent(UInt_t type) const
virtual void EvDump(THaEvData *evdata) const
std::ofstream * fDebugFile
std::vector< Decoder::GenScaler * > scalers
virtual ~THaScalerEvtHandler()
void AddVars(const TString &name, const TString &desc, UInt_t iscal, UInt_t ichan, UInt_t ikind)
virtual Int_t Analyze(THaEvData *evdata)
THaScalerEvtHandler(const char *name, const char *description)
void ParseMap(const char *cbuf, const std::vector< std::string > &dbline)
virtual Int_t End(THaRunBase *r=nullptr)
void ParseVariable(const std::vector< std::string > &dbline)
std::vector< ScalerLoc * > scalerloc
virtual THaVar * DefineByType(const char *name, const char *desc, const void *loc, VarType type, const Int_t *count, const char *errloc="DefineByType")
virtual void Clear(Option_t *="")
const char * Data() const
virtual void SetAutoSave(Long64_t autos=-300000000)
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const override
virtual Int_t Branch(const char *folder, Int_t bufsize=32000, Int_t splitlevel=99)
int CmpNoCase(const string &r, const string &s)