4 #include <TStopwatch.h>
8 #include "AliRawReader.h"
9 #include "AliRawReaderRoot.h"
12 #include "AliAltroRawStreamFast.h"
13 #include "AliAltroRawStream.h"
16 compare old and new AltroRawStream algorithms for each pad and timebin
18 check if bins are filled twice (which should not be the case!!!)
21 void testRawReaderFastDDL(const Char_t *file="/data.local/data/06000002142000.1A.root")
23 // set minimal screen output
24 AliLog::SetGlobalDebugLevel(0) ;
25 AliLog::SetGlobalLogLevel(AliLog::kFatal);
27 // TString filename("/d/alice05/testtpc/raw/pulser/06000002142000.1A.root");
28 TString filename(file);
30 printf("File: %s\n", filename.Data());
32 AliRawReader *rawReader = new AliRawReaderRoot(filename);
33 if ( !rawReader ) return;
34 rawReader->RewindEvents();
36 AliAltroRawStreamFast *sf = new AliAltroRawStreamFast(rawReader);
37 AliAltroRawStream *s = new AliAltroRawStream(rawReader);
39 s->SetNoAltroMapping(kFALSE);
40 s->SelectRawData("TPC");
48 for ( Int_t i=0; i<216; i++ ){
57 while (rawReader->NextEvent()){
58 printf("\nevent: %d\n",ievent);
63 timer1.Start();timer2.Start(kFALSE);
65 if ( !h2ddlT1[s->GetDDLNumber()] ) h2ddlT1[s->GetDDLNumber()] = new TH2I(Form("hddl1_%d",s->GetDDLNumber()),"h2c1",3584,0,3584,1024,0,1024);
66 TH2I *hist = h2ddlT1[s->GetDDLNumber()];
68 //fast filling, TH1::Fill takes awfully long
69 Int_t bin=(s->GetTime()+1)*(3584+2)+s->GetHWAddress()+1;
70 // check if this bin was allready filled
71 if ( hist->GetArray()[bin] > 0 )
72 printf(" not 0: | %.3d : %.3d (%.3d)\n",
73 s->GetHWAddress(), s->GetSignal(), hist->GetArray()[bin]);
75 hist->GetArray()[bin]=s->GetSignal();
81 timer1.Stop();timer2.Stop();
82 printf("old -- Time: %.4f (%.4f)\n", timer1.RealTime(), timer1.CpuTime());
88 timer1.Start();timer3.Start(kFALSE);
89 while ( sf->NextDDL() ){
90 if ( !h2ddlT2[sf->GetDDLNumber()] ) h2ddlT2[sf->GetDDLNumber()] = new TH2I(Form("hddl2_%d",s->GetDDLNumber()),"h2c1",3584,0,3584,1024,0,1024);
91 TH2I *hist = h2ddlT2[sf->GetDDLNumber()];
92 while ( sf->NextChannel() ){
94 while ( sf->NextBunch() ){
95 for (UInt_t timebin=sf->GetStartTimeBin(); timebin<sf->GetEndTimeBin(); timebin++){
96 signal=sf->GetSignals()[timebin-sf->GetStartTimeBin()];
98 //fast filling, TH1::Fill takes awfully long
99 Int_t bin=(timebin+1+1)*(3584+2)+sf->GetHWAddress()+1; // timebins of old and new algorithm differ by 1!!!
100 // check if this bin was allready filled
101 if ( hist->GetArray()[bin] > 0 )
102 printf(" not 0: | %.3d : %.3d (%.3d)\n",
103 sf->GetHWAddress(), signal, hist->GetArray()[bin]);
105 hist->GetArray()[bin]=signal;
110 timer1.Stop();timer3.Stop();
111 printf("new -- Time: %.4f (%.4f)\n", timer1.RealTime(), timer1.CpuTime());
114 //check if all data are the same for both algorithms
115 for ( Int_t ddl=0; ddl<216; ddl++ ){
116 TH2I *hist = h2ddlT1[ddl];
117 if ( !hist ) continue;
118 TH2I *hist2 = h2ddlT2[ddl];
119 for ( Int_t hadd=0; hadd<3584; hadd++ )
120 for ( Int_t time=0; time<1024; time++ ){
121 Int_t bin=(time+1)*(3584+2)+hadd+1;
122 Int_t val1 = hist->GetArray()[bin];
123 Int_t val2 = hist2->GetArray()[bin];
125 printf("%.2d. %.3d %.4d %.4d: %d - %d = %d\n", ievent, ddl, hadd, time, val1, val2, val1-val2);
127 //reset for the next event
128 hist->GetArray()[bin]=0;
129 hist2->GetArray()[bin]=0;
136 printf("total old -- Time: %.4f (%.4f)\n", timer2.RealTime(), timer2.CpuTime());
137 printf("total new -- Time: %.4f (%.4f)\n", timer3.RealTime(), timer3.CpuTime());