]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/ITSSDDQA.C
bugfix: external interface was calling AliHLTComponent::Init twice since r27483
[u/mrichter/AliRoot.git] / ITS / ITSSDDQA.C
CommitLineData
765a9f95 1void ITSSDDQA(char *iFile, Int_t MaxEvts=1000000, Int_t FirstEvt=0) {
2
3cout << "SDD Quality Assurance Prototype Macro" << endl;
4
5const Int_t nSDDmodules= 260;
6const Int_t imodoffset = 240;
7const Int_t modtotSDD = nSDDmodules*2;
8
9Float_t xi = 0.5;
10Float_t xf = xi + nSDDmodules;
11TH1F *modulePattern = new TH1F("patternModule","Modules pattern",nSDDmodules,xi,xf);
12xf = xi + modtotSDD;
13TH1F *moduleSidePattern = new TH1F("patternSide","Modules/Side pattern",modtotSDD,xi,xf);
14
15TH2F *hismap[modtotSDD]; //260 dx e 260 sx with A, T, Q
16TH2F *hispop[modtotSDD]; //260 dx e 260 sx with A, T, Ncounts
17
18Char_t *cindex = new Char_t[5];
19for(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}
58delete [] 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
73 Int_t eqOffset = 256;
74 Int_t DDLid_range = 24;
75 do{ // start loop on events
76 if(++evCounter > MaxEvts) { cout << MaxEvts << " events read, stop" << endl; evCounter--; break; }
77 cout << "Read Event: " << evCounter+FirstEvt-1 << endl;
78
79 rd->RequireHeader(kFALSE);
765a9f95 80
81 rd->SelectEquipment(17,eqOffset+1,eqOffset+DDLid_range);
82
83 rd->Reset(); // reset the current position to the beginning of the event
84 AliITSRawStreamSDD s(rd); //This class provides access to ITS SDD digits in raw data.
85 Int_t iddl;
86 Int_t isddmod;
87 Int_t moduleSDD;
88 while(s.Next()){ //read the next raw digit; returns kFALSE if there is no digit left
89
90 iddl=rd->GetDDLID();
91 isddmod=s.GetModuleNumber(iddl,s.GetCarlosId()); //this is the FEE Carlos
92 //cout<<"DDLID= "<<iddl <<"; Module number= " <<isddmod <<endl;
93 modulePattern->Fill(isddmod-imodoffset+1); // 1 to 260
94 moduleSDD=2*(isddmod-imodoffset)+s.GetChannel();
95 moduleSidePattern->Fill(moduleSDD+1); // 1 to 520
96 //cout << "anode " << s.GetCoord1() << ", time bin: " << s.GetCoord2() << ", charge: " << s.GetSignal() << endl;
97 hismap[moduleSDD]->Fill(s.GetCoord1(), s.GetCoord2(),s.GetSignal() );
98 hispop[moduleSDD]->Fill(s.GetCoord1(), s.GetCoord2() );
99 }
100
101 } while(rd->NextEvent()); // end loop on events
102 delete rd;
103
104 cout << "end after " << evCounter << " events" << endl;
105
106 TString oFileName(iFile);
107 oFileName.Append(".root");
108 TFile *oFile = TFile::Open(oFileName,"recreate");
109 modulePattern->Write();
110 moduleSidePattern->Write();
111 for(Int_t i=0; i<modtotSDD; i++){
112 hismap[i]->Write();
113 hispop[i]->Write();
114 }
115 oFile->Close();
116
117 for(Int_t imod=0; imod<nSDDmodules;imod++){
118 for(Int_t isid=0;isid<2;isid++){
119 Int_t index=2*imod+isid; //260*2 position
120 delete hismap[index];
121 delete hispop[index];
122 }
123 }
124 delete modulePattern;
125 delete moduleSidePattern;
126
127}