Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
THaEvtTypeHandler.cxx
Go to the documentation of this file.
1
2//
3// THaEvtTypeHandler
4// handles events of a particular type
5//
7
8#include "THaEvtTypeHandler.h"
9#include "THaEvData.h"
10#include "THaCrateMap.h"
11#include "TMath.h"
12#include <iostream>
13#include <algorithm>
14
15using namespace std;
16
17THaEvtTypeHandler::THaEvtTypeHandler(const char* name, const char* description)
18 : THaAnalysisObject(name, description), fDebugFile(nullptr)
19{
20}
21
23{
24 if (fDebugFile) {
25 fDebugFile->close();
26 delete fDebugFile;
27 }
28}
29
31 eventtypes.push_back(evtype);
32}
33
35 eventtypes.clear();
36 AddEvtType(evtype);
37}
38
39
41{
42 cout << "Hello ! THaEvtTypeHandler name = "<<GetName()<<endl;
43 cout << " description "<<GetTitle()<<endl;
44 cout << " event types handled are "<<endl;
45 for( int eventtype : eventtypes ) {
46 cout << " event type "<<eventtype<<endl;
47 }
48 cout << "----------------- good bye ----------------- "<<endl;
49}
50
52{
53 // Dumps data to file, if fDebugFile was set.
54 if (!fDebugFile) return;
55 if (!evdata) return; // get what you deserve
56 int evnum = evdata->GetRawData(4);
57 int len = evdata->GetRawData(0) + 1;
58 int evtype = evdata->GetRawData(1)>>16;
59 *fDebugFile << "\n ------ Raw Data Dump ------ "<<endl;
60 *fDebugFile << "\n\n Event number " << dec << evnum << endl;
61 *fDebugFile << " length " << len << " type " << evtype << endl;
62 int ipt = 0;
63 for (int j=0; j<(len/5); j++) {
64 *fDebugFile << dec << "\n evbuffer[" << ipt << "] = ";
65 for (int k=j; k<j+5; k++) {
66 *fDebugFile << hex << evdata->GetRawData(ipt++) << " ";
67 }
68 *fDebugFile << endl;
69 }
70 if (ipt < len) {
71 *fDebugFile << dec << "\n evbuffer[" << ipt << "] = ";
72 for (int k=ipt; k<len; k++) {
73 *fDebugFile << hex << evdata->GetRawData(ipt++) << " ";
74 }
75 *fDebugFile << endl;
76 }
77}
78
80{
81// fStatus = kOK;
82// return kOK;
83 SetConfig("default"); // BCI: override ReadRunDatabase instead
84 return THaAnalysisObject::Init(date);
85}
86
87void THaEvtTypeHandler::SetDebugFile(const char *filename) {
88 delete fDebugFile;
89 fDebugFile = new ofstream;
90 fDebugFile->open(filename);
91}
92
94{
95 return any_of(eventtypes.begin(), eventtypes.end(),
96 [type](UInt_t evtype){ return type == evtype; });
97}
98
99//_____________________________________________________________________________
104
unsigned int UInt_t
bool Bool_t
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 filename
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 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 type
char name[80]
virtual void MakePrefix()
void SetConfig(const char *label)
UInt_t GetRawData(UInt_t crate, UInt_t slot, UInt_t hit) const
Definition THaEvData.h:288
std::vector< UInt_t > eventtypes
virtual void AddEvtType(UInt_t evtype)
THaEvtTypeHandler(const char *name, const char *description)
virtual void EvPrint() const
virtual Bool_t IsMyEvent(UInt_t type) const
virtual void EvDump(THaEvData *evdata) const
virtual void SetDebugFile(std::ofstream *file)
virtual void SetEvtType(UInt_t evtype)
std::ofstream * fDebugFile
virtual void MakePrefix()
const char * GetName() const override
const char * GetTitle() const override
STL namespace.
ClassImp(TPyArg)