765a9f95 |
1 | void ITSSDDQA(char *iFile, Int_t MaxEvts=1000000, Int_t FirstEvt=0) { |
2 | |
3 | cout << "SDD Quality Assurance Prototype Macro" << endl; |
4 | |
5 | const Int_t nSDDmodules= 260; |
6 | const Int_t imodoffset = 240; |
7 | const Int_t modtotSDD = nSDDmodules*2; |
8 | |
9 | Float_t xi = 0.5; |
10 | Float_t xf = xi + nSDDmodules; |
11 | TH1F *modulePattern = new TH1F("patternModule","Modules pattern",nSDDmodules,xi,xf); |
12 | xf = xi + modtotSDD; |
13 | TH1F *moduleSidePattern = new TH1F("patternSide","Modules/Side pattern",modtotSDD,xi,xf); |
14 | |
15 | TH2F *hismap[modtotSDD]; //260 dx e 260 sx with A, T, Q |
16 | TH2F *hispop[modtotSDD]; //260 dx e 260 sx with A, T, Ncounts |
17 | |
18 | Char_t *cindex = new Char_t[5]; |
19 | for(Int_t imod=0; imod<nSDDmodules;imod++){ |
20 | for(Int_t isid=0;isid<2;isid++){ |
21 | Int_t index=2*imod+isid; //260*2 position |
22 | |
23 | sprintf(cindex,"%d",index+1); // imod,isid); |
24 | TString sindex((const char *) cindex); |
25 | |
26 | TString histnam("chargeMap"); |
27 | TString histit("Total Charge, module number "); |
28 | histnam.Append(sindex); |
29 | histit.Append(sindex); |
30 | hismap[index]=new TH2F(histnam.Data(),histit.Data(),256,-0.5,255.5,256,-0.5,255.5); |
31 | |
32 | TString hisnam2("countsMap"); |
33 | TString histit2("Number of Counts, module number "); |
34 | hisnam2.Append(sindex); |
35 | histit2.Append(sindex); |
36 | hispop[index]=new TH2F(hisnam2.Data(),histit2.Data(),256,-0.5,255.5,256,-0.5,255.5); |
37 | |
38 | /* |
39 | sprintf(hisnam,"hisprojX%03ds%d",imod,isid); |
40 | sprintf(histitle,"layer , ladder, module position, channel, %d, %d", imod, isid); |
41 | hisprojX[index]=new TH2F(hisnam,histitle,256,-0.5,255.5,256,-0.5,255.5); |
42 | |
43 | sprintf(hisnam,"hisprojY%03ds%d",imod,isid); |
44 | sprintf(histitle,"layer , ladder, module position, channel, %d, %d", imod, isid); |
45 | hisprojY[index]=new TH2F(hisnam,histitle,256,-0.5,255.5,256,-0.5,255.5); |
46 | |
47 | sprintf(hisnam,"hisprofX%03ds%d",imod,isid); |
48 | sprintf(histitle,"layer , ladder, module position, channel, %d, %d", imod, isid); |
49 | hisprofX[index]=new TH2F(hisnam,histitle,256,-0.5,255.5,256,-0.5,255.5); |
50 | |
51 | sprintf(hisnam,"hisprofY%03ds%d",imod,isid); |
52 | sprintf(histitle,"layer , ladder, module position, channel, %d, %d", imod, isid); |
53 | hisprofY[index]=new TH2F(hisnam,histitle,256,-0.5,255.5,256,-0.5,255.5); |
54 | */ |
55 | |
56 | } |
57 | } |
58 | delete [] cindex; |
59 | |
3f7450e0 |
60 | TString strFile = iFile; |
61 | strFile += "?EventType=7"; |
62 | AliRawReader *rd = new AliRawReaderDate(strFile.Data(),FirstEvt); // open run |
765a9f95 |
63 | Int_t evCounter = 0; |
64 | |
65 | //AliITS *itsRun = new AliITS(); |
66 | // TGeoManager::Import("$ALICE_ROOT/EVE/alice-data/alice_fullgeo.root"); |
67 | /* |
68 | AliITSInitGeometry *initgeom = new AliITSInitGeometry("AliITSvPPRasymmFMD",2); |
69 | geom = initgeom->CreateAliITSgeom(); |
70 | delete initgeom; |
71 | */ |
72 | |
765a9f95 |
73 | do{ // start loop on events |
74 | if(++evCounter > MaxEvts) { cout << MaxEvts << " events read, stop" << endl; evCounter--; break; } |
75 | cout << "Read Event: " << evCounter+FirstEvt-1 << endl; |
76 | |
77 | rd->RequireHeader(kFALSE); |
765a9f95 |
78 | |
765a9f95 |
79 | |
80 | rd->Reset(); // reset the current position to the beginning of the event |
81 | AliITSRawStreamSDD s(rd); //This class provides access to ITS SDD digits in raw data. |
82 | Int_t iddl; |
83 | Int_t isddmod; |
84 | Int_t moduleSDD; |
85 | while(s.Next()){ //read the next raw digit; returns kFALSE if there is no digit left |
86 | |
87 | iddl=rd->GetDDLID(); |
88 | isddmod=s.GetModuleNumber(iddl,s.GetCarlosId()); //this is the FEE Carlos |
89 | //cout<<"DDLID= "<<iddl <<"; Module number= " <<isddmod <<endl; |
90 | modulePattern->Fill(isddmod-imodoffset+1); // 1 to 260 |
91 | moduleSDD=2*(isddmod-imodoffset)+s.GetChannel(); |
92 | moduleSidePattern->Fill(moduleSDD+1); // 1 to 520 |
93 | //cout << "anode " << s.GetCoord1() << ", time bin: " << s.GetCoord2() << ", charge: " << s.GetSignal() << endl; |
94 | hismap[moduleSDD]->Fill(s.GetCoord1(), s.GetCoord2(),s.GetSignal() ); |
95 | hispop[moduleSDD]->Fill(s.GetCoord1(), s.GetCoord2() ); |
96 | } |
97 | |
98 | } while(rd->NextEvent()); // end loop on events |
99 | delete rd; |
100 | |
101 | cout << "end after " << evCounter << " events" << endl; |
102 | |
103 | TString oFileName(iFile); |
104 | oFileName.Append(".root"); |
105 | TFile *oFile = TFile::Open(oFileName,"recreate"); |
106 | modulePattern->Write(); |
107 | moduleSidePattern->Write(); |
108 | for(Int_t i=0; i<modtotSDD; i++){ |
109 | hismap[i]->Write(); |
110 | hispop[i]->Write(); |
111 | } |
112 | oFile->Close(); |
113 | |
114 | for(Int_t imod=0; imod<nSDDmodules;imod++){ |
115 | for(Int_t isid=0;isid<2;isid++){ |
116 | Int_t index=2*imod+isid; //260*2 position |
117 | delete hismap[index]; |
118 | delete hispop[index]; |
119 | } |
120 | } |
121 | delete modulePattern; |
122 | delete moduleSidePattern; |
123 | |
124 | } |