1 void ITSSDDQA(char *iFile, Int_t MaxEvts=1000000, Int_t FirstEvt=0) {
3 cout << "SDD Quality Assurance Prototype Macro" << endl;
5 const Int_t nSDDmodules= 260;
6 const Int_t imodoffset = 240;
7 const Int_t modtotSDD = nSDDmodules*2;
10 Float_t xf = xi + nSDDmodules;
11 TH1F *modulePattern = new TH1F("patternModule","Modules pattern",nSDDmodules,xi,xf);
13 TH1F *moduleSidePattern = new TH1F("patternSide","Modules/Side pattern",modtotSDD,xi,xf);
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
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
23 sprintf(cindex,"%d",index+1); // imod,isid);
24 TString sindex((const char *) cindex);
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);
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);
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);
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);
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);
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);
60 TString strFile = iFile;
61 strFile += "?EventType=7";
62 AliRawReader *rd = new AliRawReaderDate(strFile.Data(),FirstEvt); // open run
65 //AliITS *itsRun = new AliITS();
66 // TGeoManager::Import("$ALICE_ROOT/EVE/alice-data/alice_fullgeo.root");
68 AliITSInitGeometry *initgeom = new AliITSInitGeometry("AliITSvPPRasymmFMD",2);
69 geom = initgeom->CreateAliITSgeom();
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;
77 rd->RequireHeader(kFALSE);
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.
85 while(s.Next()){ //read the next raw digit; returns kFALSE if there is no digit left
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() );
98 } while(rd->NextEvent()); // end loop on events
101 cout << "end after " << evCounter << " events" << endl;
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++){
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];
121 delete modulePattern;
122 delete moduleSidePattern;