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 AliRawReader *rd = new AliRawReaderDate(iFile,FirstEvt); // open run
63 //AliITS *itsRun = new AliITS();
64 // TGeoManager::Import("$ALICE_ROOT/EVE/alice-data/alice_fullgeo.root");
66 AliITSInitGeometry *initgeom = new AliITSInitGeometry("AliITSvPPRasymmFMD",2);
67 geom = initgeom->CreateAliITSgeom();
72 Int_t DDLid_range = 24;
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);
78 rd->SelectEvents(7); // read only events with the given type. no selection is applied if a value < 0 is used.
80 rd->SelectEquipment(17,eqOffset+1,eqOffset+DDLid_range);
82 rd->Reset(); // reset the current position to the beginning of the event
83 AliITSRawStreamSDD s(rd); //This class provides access to ITS SDD digits in raw data.
87 while(s.Next()){ //read the next raw digit; returns kFALSE if there is no digit left
90 isddmod=s.GetModuleNumber(iddl,s.GetCarlosId()); //this is the FEE Carlos
91 //cout<<"DDLID= "<<iddl <<"; Module number= " <<isddmod <<endl;
92 modulePattern->Fill(isddmod-imodoffset+1); // 1 to 260
93 moduleSDD=2*(isddmod-imodoffset)+s.GetChannel();
94 moduleSidePattern->Fill(moduleSDD+1); // 1 to 520
95 //cout << "anode " << s.GetCoord1() << ", time bin: " << s.GetCoord2() << ", charge: " << s.GetSignal() << endl;
96 hismap[moduleSDD]->Fill(s.GetCoord1(), s.GetCoord2(),s.GetSignal() );
97 hispop[moduleSDD]->Fill(s.GetCoord1(), s.GetCoord2() );
100 } while(rd->NextEvent()); // end loop on events
103 cout << "end after " << evCounter << " events" << endl;
105 TString oFileName(iFile);
106 oFileName.Append(".root");
107 TFile *oFile = TFile::Open(oFileName,"recreate");
108 modulePattern->Write();
109 moduleSidePattern->Write();
110 for(Int_t i=0; i<modtotSDD; i++){
116 for(Int_t imod=0; imod<nSDDmodules;imod++){
117 for(Int_t isid=0;isid<2;isid++){
118 Int_t index=2*imod+isid; //260*2 position
119 delete hismap[index];
120 delete hispop[index];
123 delete modulePattern;
124 delete moduleSidePattern;