]>
Commit | Line | Data |
---|---|---|
27639c72 | 1 | void ITSSDDQAMaker(char *iFile, Int_t MaxEvts=1000000, Int_t FirstEvt=0) { |
2 | ||
3 | //To have Baseline Histos uncomment parts with " // BL!!! " comment | |
4 | ||
5 | cout << "SDD Quality Assurance Prototype Macro" << endl; | |
6 | ||
7 | const Int_t nSDDmodules= 260; | |
8 | const Int_t imodoffset = 240; | |
9 | const Int_t modtotSDD = nSDDmodules*2; | |
10 | const Int_t anode = 256; | |
11 | ||
12 | Float_t xi = -0.5; | |
13 | Float_t xf = xi + nSDDmodules; | |
14 | TH1F *hModulePattern = new TH1F("hModulePattern","Modules pattern",nSDDmodules,xi,xf); | |
15 | xf = xi + modtotSDD; | |
16 | TH1F *hModuleSidePattern = new TH1F("hModuleSidePattern","Modules/Side pattern",modtotSDD,xi,xf); | |
17 | ||
18 | TH2F *hModuleChargeMap[modtotSDD]; //260 dx e 260 sx with A, T, Q | |
19 | TH2F *hModuleCountsMap[modtotSDD]; //260 dx e 260 sx with A, T, Ncounts | |
20 | TH2I *hModuleCarlos = new TH2I("hModuleCarlos","hModuleCarlos",modtotSDD,xi,xf,101,-0.5,100.5); | |
21 | /* | |
22 | TH1F *hModuleSideBL[modtotSDD][anode]; // BL!!! | |
23 | */ | |
24 | ||
25 | ||
26 | //-------histograms definition | |
27 | Char_t *hisnam = new Char_t[50]; | |
28 | Char_t *histit = new Char_t[50]; | |
29 | Char_t *hisnam2 = new Char_t[50]; | |
30 | Char_t *histit2 = new Char_t[50]; | |
31 | Char_t *hisnam3 = new Char_t[50]; | |
32 | for(Int_t imod=0; imod<nSDDmodules;imod++){ | |
33 | for(Int_t isid=0;isid<2;isid++){ | |
34 | Int_t index=2*imod+isid; //260*2 position | |
35 | ||
36 | sprintf(hisnam,"chargeMap%d",index); | |
37 | sprintf(histit,"Total Charge, module number %d",index); | |
38 | hModuleChargeMap[index]=new TH2F(hisnam,histit,256,-0.5,255.5,256,-0.5,255.5); | |
39 | ||
40 | sprintf(hisnam2,"countsMap%d",index); | |
41 | sprintf(histit2,"Number of Counts, module number %d",index); | |
42 | hModuleCountsMap[index] = new TH2F(hisnam2,histit2,256,-0.5,255.5,256,-0.5,255.5); | |
43 | /* | |
44 | for(Int_t ianode=0; ianode<anode; ianode++){ // BL!!! | |
45 | sprintf(hisnam3,"BL_module_%d_%d",index,ianode); | |
46 | //cout<<hisnam3 <<endl; | |
47 | hModuleSideBL[index][ianode] = new TH1F(hisnam3,hisnam3,256,0.,1024.); | |
48 | } | |
49 | */ | |
50 | } | |
51 | } | |
52 | ||
3f7450e0 | 53 | TString strFile = iFile; |
54 | strFile += "?EventType=7"; | |
55 | AliRawReader *rd = new AliRawReaderDate(strFile.Data(),FirstEvt); // open run | |
27639c72 | 56 | Int_t evCounter = 0; |
57 | Int_t eqOffset = 256; | |
58 | Int_t DDLid_range = 24; | |
59 | do{ // start loop on events | |
60 | if(++evCounter > MaxEvts) { cout << MaxEvts << " events read, stop" << endl; evCounter--; break; } | |
61 | cout << "Read Event: " << evCounter+FirstEvt-1 << endl; | |
62 | ||
63 | rd->RequireHeader(kFALSE); | |
27639c72 | 64 | rd->SelectEquipment(17,eqOffset+1,eqOffset+DDLid_range); //17 states for "DRorc acquisition" |
65 | rd->Reset(); // reset the current position to the beginning of the event | |
66 | ||
67 | Int_t nSkip = 0; // number of skipped signals | |
68 | AliITSRawStreamSDD s(rd); //This class provides access to ITS SDD digits in raw data. | |
69 | Int_t iddl; | |
70 | Int_t isddmod; | |
71 | Int_t moduleSDD; | |
72 | gStyle->SetPalette(1); | |
73 | while(s.Next()){ //read the next raw digit; returns kFALSE if there is no digit left | |
5dfa68c5 | 74 | if(s.IsCompletedModule()) continue; |
75 | iddl=rd->GetDDLID()-2; // -2 is temporary for test raw data | |
27639c72 | 76 | |
5dfa68c5 | 77 | isddmod=s.GetModuleNumber(iddl,s.GetCarlosId()); //this is the FEE Carlos |
27639c72 | 78 | //cout<<"DDLID= "<<iddl <<"; Module number= " <<isddmod <<endl; |
79 | if(isddmod >= imodoffset) { | |
80 | hModulePattern->Fill(isddmod-imodoffset); // 0 to 259 so 240 to 499 | |
81 | moduleSDD=2*(isddmod-imodoffset)+s.GetChannel(); | |
82 | hModuleSidePattern->Fill(moduleSDD); // 0 to 519 | |
83 | hModuleCarlos->Fill(isddmod-imodoffset,s.GetCarlosId()); | |
84 | //cout << "anode " << s.GetCoord1() << ", time bin: " << s.GetCoord2() << ", charge: " << s.GetSignal() << endl; | |
85 | Int_t coord1 = s.GetCoord1(); | |
86 | Int_t coord2 = s.GetCoord2(); | |
87 | Int_t signal = s.GetSignal(); | |
88 | hModuleChargeMap[moduleSDD]->Fill(coord2, coord1,signal); | |
89 | hModuleCountsMap[moduleSDD]->Fill(coord2, coord1 ); | |
90 | //hModuleSideBL[moduleSDD][coord1]->Fill(signal); // BL !!! | |
91 | } else { | |
92 | nSkip++; | |
93 | } | |
94 | } | |
95 | cout << "End of Event " << evCounter+FirstEvt-1 << ", " << nSkip << " wrong module numbers" << endl; | |
96 | } while(rd->NextEvent()); // end loop on events | |
97 | delete rd; | |
98 | ||
99 | cout << "end after " << evCounter << " events" << endl; | |
100 | /* | |
101 | TNtuple *Baseline = new TNtuple("Baseline","Baseline","HalfModule:Anode:Mean:RMS"); // BL!!! | |
102 | Float_t meanBL; | |
103 | Float_t rmsBL; | |
104 | */ | |
105 | for(Int_t i=0; i<modtotSDD; i++){ | |
106 | if(hModuleSidePattern->GetBinContent(i+1)){ //check if they're not empty | |
107 | hModuleChargeMap[i]->GetXaxis()->SetTitle("Time Bin"); | |
108 | hModuleChargeMap[i]->GetYaxis()->SetTitle("Anode"); | |
109 | hModuleCountsMap[i]->GetXaxis()->SetTitle("Time Bin"); | |
110 | hModuleCountsMap[i]->GetYaxis()->SetTitle("Anode"); | |
111 | /* | |
112 | for(Int_t ianode=0; ianode<anode; ianode++ ){ // BL!!! | |
113 | hModuleSideBL[i][ianode]->GetXaxis()->SetTitle("ADC counts"); | |
114 | hModuleSideBL[i][ianode]->GetYaxis()->SetTitle("#"); | |
115 | meanBL = hModuleSideBL[i][ianode]->GetMean(); | |
116 | rmsBL = hModuleSideBL[i][ianode]->GetRMS(); | |
117 | gaussfitBL = hModuleSideBL[i][ianode]->Fit("gaus"); | |
118 | Baseline->Fill(i,ianode,meanBL,rmsBL); | |
119 | } | |
120 | */ | |
121 | } | |
122 | } | |
123 | ||
124 | hModuleSidePattern->GetXaxis()->SetTitle("2*(Module Number-1)+Side"); | |
125 | hModuleSidePattern->GetYaxis()->SetTitle("Counts"); | |
126 | hModulePattern->GetXaxis()->SetTitle("Module Number"); | |
127 | hModulePattern->GetYaxis()->SetTitle("Counts"); | |
128 | ||
129 | ||
130 | //-------store Histograms | |
131 | cout << "Store Histograms" << endl; | |
132 | TString oFileName(iFile); | |
133 | oFileName.Append(".root"); | |
134 | TFile *oFile = TFile::Open(oFileName,"recreate"); | |
135 | hModulePattern->Write(); | |
136 | hModuleSidePattern->Write(); | |
137 | hModuleCarlos->Write(); | |
138 | for(Int_t i=0; i<modtotSDD; i++){ | |
139 | if(hModuleSidePattern->GetBinContent(i+1)){ //check if they're not empty | |
140 | hModuleChargeMap[i]->Write(); | |
141 | hModuleCountsMap[i]->Write(); | |
142 | /* | |
143 | for(Int_t ianode=0; ianode<anode; ianode++ ){ // BL!!! | |
144 | hModuleSideBL[i][ianode]->Write(); | |
145 | Baseline->Write(); | |
146 | } | |
147 | */ | |
148 | } | |
149 | } | |
150 | ||
151 | oFile->Close(); | |
152 | cout << "Clear memory" << endl; | |
153 | for(Int_t imod=0; imod<nSDDmodules;imod++){ | |
154 | for(Int_t isid=0;isid<2;isid++){ | |
155 | Int_t index=2*imod+isid; //260*2 position | |
156 | delete hModuleChargeMap[index]; | |
157 | delete hModuleCountsMap[index]; | |
158 | /* | |
159 | for(Int_t ianode=0; ianode<anode; ianode++ ){ // BL!!! | |
160 | delete hModuleSideBL[index][ianode]; | |
161 | delete Baseline; | |
162 | } | |
163 | */ | |
164 | } | |
165 | } | |
166 | delete hModulePattern; | |
167 | delete hModuleSidePattern; | |
168 | delete hModuleCarlos; | |
169 | ||
170 | } |