46 auto* debugfile =
new ofstream;
47 debugfile->open (
"oodecoder1.txt");
48 *debugfile <<
"Debug of OO decoder"<<endl<<endl;
50 ofstream* debugfile =
nullptr;
55 cerr <<
"ERROR: Cannot open CODA data" << endl;
56 cerr <<
"Perhaps you mistyped it" << endl;
57 cerr <<
"... exiting." << endl;
63 evdata->SetDebugFile(debugfile);
66 TROOT fadcana(
"fadcroot",
"Hall A FADC analysis, 1st version");
67 TFile hfile(
"fadc.root",
"RECREATE",
"FADC data");
69 char cnum[50],ctitle[80];
71 sprintf(cnum,
"h%d",i+1);
72 sprintf(ctitle,
"snapshot %d",i+1);
73 hsnaps.push_back(
new TH1F(cnum,ctitle,1020,-5,505));
75 hinteg =
new TH1F(
"hinteg",
"Integral of ADC",1000,50000,120000);
76 hinteg2 =
new TH1F(
"hinteg2",
"Integral of ADC",1000,0,10000);
82 for (
UInt_t iev=0; iev<NUMEVT; iev++) {
85 if (evdata->IsMultiBlockMode()) {
86 *debugfile <<
"Are in Multiblock mode "<<endl;
87 if (evdata->BlockIsDone()) {
88 *debugfile <<
"Block is done "<<endl;
90 *debugfile <<
"Block is NOT done "<<endl;
93 *debugfile <<
"Not in Multiblock mode "<<endl;
98 Bool_t to_read_file = !evdata->DataCached();
102 cout <<
"CODA read --- "<<endl;
104 if (debugfile) *debugfile <<
"Read from file ? Yes "<<endl;
109 if ( status == EOF) {
110 cout <<
"Normal end of file. Bye bye." << endl;
113 cout <<
"ERROR: codaRread status = " << status << endl;
122 cout <<
"LoadEvent --- "<<endl;
124 status = evdata->LoadEvent(
data );
126 if( status != CodaDecoder::HED_OK && status != CodaDecoder::HED_WARN ) {
127 cerr <<
"ERROR: LoadEvent status = " << status
128 <<
" while decoding event " << iev <<
". Exiting." << endl;
135 if (debugfile) *debugfile <<
"Read from file ? No "<<endl;
137 int status = evdata->LoadFromMultiBlock();
139 if( status != CodaDecoder::HED_OK && status != CodaDecoder::HED_WARN ) {
140 cerr <<
"ERROR: LoadFromMultiBlock status = " << status
141 <<
" while decoding event " << iev <<
". Exiting." << endl;
147 if( evdata->GetEvType() ==
MYTYPE )
148 process(trigcnt++, evdata, debugfile);
160 if (!debugfile)
return;
165 *debugfile <<
"\n\n Event number " << dec << evnum << endl;
166 *debugfile <<
" length " <<
len <<
" type " << evtype << endl;
169 *debugfile << dec <<
"\n evbuffer[" << ipt <<
"] = ";
170 for (
UInt_t k=j; k<j+5; k++) {
171 *debugfile << hex <<
data[ipt++] <<
" ";
176 *debugfile << dec <<
"\n evbuffer[" << ipt <<
"] = ";
178 *debugfile << hex <<
data[ipt++] <<
" ";
187 *debugfile <<
"\n\nHello. Now we process evdata : "<<endl;
189 *debugfile <<
"\nEvent type " << dec << evdata->
GetEvType() << endl;
190 *debugfile <<
"Event number " << evdata->
GetEvNum() << endl;
191 *debugfile <<
"Event length " << evdata->
GetEvLength() << endl;
195 if (debugfile) *debugfile <<
"Physics trigger " << endl;
201 if (debugfile) *debugfile <<
"main: using module, fadc ptr = "<<fadc<<endl;
205 if (debugfile) *debugfile <<
"main: fadc mode "<<fadc->
GetMode()<<endl;
209 if (debugfile) *debugfile <<
"main: SAMPLE fadc data on ch. "<<dec<<
MYCHAN<<
" "<<i<<
" "<<rdata<<endl;
216 if (debugfile) *debugfile <<
"main: INTEG fadc data on ch. "<<dec<<
MYCHAN<<
" "<<i<<
" "<<rdata<<endl;
226 if (debugfile) *debugfile <<
"main: using THaEvData "<<endl;
229 for (
UInt_t jj=0; jj<10; jj++) {
230 for (
UInt_t kk=0; kk<15; kk++) {
239 if (debugfile) *debugfile <<
"main: SAMPLE fadc data on ch. "<<dec<<
MYCHAN<<
" "<<i<<
" "<<rdata<<endl;
244 if (debugfile) *debugfile <<
"main: INTEG fadc data on ch. "<<dec<<
MYCHAN<<
" "<<i<<
" "<<rdata<<endl;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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
virtual UInt_t GetNumEvents(Decoder::EModuleType, UInt_t) const
virtual Int_t GetMode() const
virtual UInt_t GetData(UInt_t) const
virtual Int_t codaOpen(const char *filename, Int_t mode=1)
virtual Int_t codaClose()
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsiz=0) const override
void Close(Option_t *option="") override
virtual Int_t Fill(const char *name, Double_t w)
Bool_t IsPhysicsTrigger() const
UInt_t GetNumEvents(Decoder::EModuleType type, UInt_t crate, UInt_t slot, UInt_t chan) const
virtual Decoder::Module * GetModule(UInt_t roc, UInt_t slot) const
UInt_t GetEvLength() const
UInt_t GetData(UInt_t crate, UInt_t slot, UInt_t chan, UInt_t hit) const
void process(UInt_t trignum, THaEvData *evdata, ofstream *file)
void dump(UInt_t *data, ofstream *file)