1 /**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 // *************************************************************
19 // Checks the quality assurance
20 // by comparing with reference data
22 // -------------------------------------------------------------
23 // W. Ferrarese Nov 2007
26 // --- ROOT system ---
32 // --- Standard library ---
34 // --- AliRoot header files ---
35 #include "AliITSQADataMaker.h"
38 #include "AliQAChecker.h"
39 #include "AliRawReader.h"
40 #include "AliITSRawStreamSDD.h"
41 #include "AliITSRecPoint.h"
42 #include "AliITSgeomTGeo.h"
43 #include "AliRawReader.h"
45 ClassImp(AliITSQADataMaker)
47 //____________________________________________________________________________
48 AliITSQADataMaker::AliITSQADataMaker() :
49 AliQADataMaker(AliQA::GetDetName(AliQA::kITS), "SDD Quality Assurance Data Maker")
54 //____________________________________________________________________________
55 AliITSQADataMaker::AliITSQADataMaker(Bool_t kMode, Int_t ldc) :
56 AliQADataMaker(AliQA::GetDetName(AliQA::kITS), "SDD Quality Assurance Data Maker")
58 //ctor used to discriminate OnLine-Offline analysis
63 //____________________________________________________________________________
64 AliITSQADataMaker::AliITSQADataMaker(const AliITSQADataMaker& qadm) :
68 SetName((const char*)qadm.GetName()) ;
69 SetTitle((const char*)qadm.GetTitle());
72 //__________________________________________________________________
73 AliITSQADataMaker& AliITSQADataMaker::operator = (const AliITSQADataMaker& qac )
76 this->~AliITSQADataMaker();
77 new(this) AliITSQADataMaker(qac);
81 //____________________________________________________________________________
82 void AliITSQADataMaker::StartOfDetectorCycle() const
84 //Detector specific actions at start of cycle
85 AliDebug(1,"AliITSQADM::Start of ITS Cycle\n");
88 //____________________________________________________________________________
89 void AliITSQADataMaker::EndOfDetectorCycle(AliQA::TASKINDEX task, TList *list)
91 // launch the QA checking
92 AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n");
94 AliQAChecker::Instance()->Run( AliQA::kITS , task, list);
97 //____________________________________________________________________________
98 void AliITSQADataMaker::EndOfDetectorCycle(const char * fgDataName)
100 //eventually used for different AliQAChecker::Instance()->Run
103 //____________________________________________________________________________
104 void AliITSQADataMaker::InitRaws()
106 // create SDD histo of raw
111 AliInfo("Book Online Histograms\n");
114 AliInfo("Book Offline Histograms\n ");
116 Char_t *hname[3][2 * fgknSDDmodules] ;
117 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
118 for(Int_t iside=0;iside<fgknSide;iside++){
119 Int_t index1 = moduleSDD * 2 + iside ;
120 for(Int_t i=0; i<3; i++) hname[i][index1]= new Char_t[50];
121 sprintf(hname[0][index1],"chargeMap%dSide%d",moduleSDD,iside);
122 sprintf(hname[1][index1],"Total Charge, module number %d , Side%d",moduleSDD,iside);
123 sprintf(hname[2][index1],"hmonoDMap%dSide%d",moduleSDD,iside);
124 fModuleChargeMap[index1] = new TH2D(hname[0][index1],hname[1][index1],256,-0.5,255.5,256,-0.5,255.5);
125 fmonoD[index1] = new TH1D(hname[2][index1],hname[2][index1],256,-0.5,255.5);
129 TH1F *h0 = new TH1F("ModPattern","Modules pattern",fgknSDDmodules,-0.5,259.5);
131 TH1F *h1 = new TH1F("ModPatternL3","Modules pattern L3",14,0.5,14.5);
133 TH1F *h2 = new TH1F("ModPatternL4","Modules pattern L4",22,0.5,22.5);
136 Char_t *hname0[fgkLADDonLAY3] ;
137 TH1D *h3[fgkLADDonLAY3] ;
138 for(Int_t i=1; i<=fgkLADDonLAY3; i++) {
139 hname0[i-1] = new Char_t[20];
140 sprintf(hname0[i-1],"ModPattern_L3_%d",i);
141 h3[i-1] = new TH1D(hname0[i-1],hname0[i-1],6,0.5,6.5);
142 Add2RawsList(h3[i-1],i-1+3);
145 Char_t *hname1[fgkLADDonLAY4] ;
146 TH1D *h4[fgkLADDonLAY4] ;
147 for(Int_t i=1; i<=fgkLADDonLAY4; i++) {
148 hname1[i-1] = new Char_t[20];
149 sprintf(hname1[i-1],"ModPattern_L4_%d",i);
150 h4[i-1] = new TH1D(hname1[i-1],hname1[i-1],8,0.5,8.5);
151 Add2RawsList(h4[i-1],i-1+17);
154 Char_t *hname2[fgknSDDmodules*2] ;
155 TH1D *h5[fgknSDDmodules*2] ;
156 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
157 for(Int_t iside=0; iside<fgknSide; iside++){
158 Int_t index1 = moduleSDD * 2 + iside;
159 hname2[index1] = new Char_t[50];
160 sprintf(hname2[index1],"ProjYMap%dSide%d",moduleSDD+1,iside);
161 h5[index1] = new TH1D(hname2[index1],hname2[index1],256,-0.5,255.5);
162 Add2RawsList(h5[index1],index1+39);
165 Char_t *hname3[fgknSDDmodules*8] ;
166 TH1D *h6[fgknSDDmodules*8] ;
167 for(Int_t htype=0; htype<4; htype++){
168 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
169 for(Int_t iside=0; iside<fgknSide; iside++){
170 Int_t index1 = moduleSDD*2 + iside;
171 hname3[index1 + htype*2*fgknSDDmodules] = new Char_t[50];
172 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
173 Int_t indextot = index1 + htype*2*fgknSDDmodules;
174 if(htype == 0) sprintf(hname3[indextot],"CountsVSAnode_L%d_%d_%d_%d",lay,lad,det,iside);
175 if(htype == 1) sprintf(hname3[indextot],"ChargeVSAnode_L%d_%d_%d_%d",lay,lad,det,iside);
176 if(htype == 2) sprintf(hname3[indextot],"CountsVSTbin_L%d_%d_%d_%d",lay,lad,det,iside);
177 if(htype == 3) sprintf(hname3[indextot],"ChargeVSTbin_L%d_%d_%d_%d",lay,lad,det,iside);
178 h6[indextot] = new TH1D(hname3[indextot],hname3[indextot],256,-0.5,255.5);
179 //cout << "add at index " << indextot+39+fgknSDDmodules*2 << " with name " << hname3[indextot] << endl;
180 Add2RawsList(h6[indextot],39 + fgknSDDmodules*2 + indextot);
185 Char_t *hname4[fgknSDDmodules*2];
186 TH2D *h7[fgknSDDmodules*2] ;
187 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
188 for(Int_t iside=0; iside<fgknSide; iside++){
189 Int_t index1 = moduleSDD * 2 + iside;
190 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
191 hname4[index1] = new Char_t[50];
192 sprintf(hname4[index1],"Anode_vs_Charge_L%d_%d_%d_%d",lay,lad,det,iside);
193 h7[index1] = new TH2D(hname4[index1],hname4[index1],fgknSDDmodules*2,-0.5,-0.5+fgknSDDmodules*2,256,0.5,256.5);
194 Add2RawsList(h7[index1],2639 + index1);
201 //____________________________________________________________________________
202 void AliITSQADataMaker::MakeRaws(AliRawReader* rawReader)
204 //Fills Raw QA list of histos
206 AliDebug(1,"entering MakeRaws\n");
207 rawReader->RequireHeader(kFALSE);
208 rawReader->SelectEvents(7);
209 rawReader->SelectEquipment(17,fgkeqOffset+1,fgkeqOffset + fgkDDLidRange);
211 AliITSRawStreamSDD s(rawReader);
216 Int_t iddl = rawReader->GetDDLID() - fgkDDLIDshift;
217 Int_t isddmod = s.GetModuleNumber(iddl,s.GetCarlosId());
218 Int_t coord1 = s.GetCoord1();
219 Int_t coord2 = s.GetCoord2();
220 Int_t signal = s.GetSignal();
221 Int_t moduleSDD = isddmod - fgkmodoffset;
222 if(moduleSDD < 0 || moduleSDD>fgknSDDmodules+fgkmodoffset) {
223 AliDebug(1,Form( "Module SDD = %d, resetting it to 1 \n",moduleSDD));
227 GetRawsData(0)->Fill(moduleSDD);
229 AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det);
230 //printf("modnumb %d, lay %d, lad %d, det %d \n",isddmod, lay, lad, det);
237 GetRawsData(iorder)->Fill(lad);
238 GetRawsData(ioffset+lad-1)->Fill(det); //-1 because ladder# starts from 1
240 Short_t iside = s.GetChannel();
241 Int_t index1 = moduleSDD * 2 + iside;
244 AliWarning("Wrong index number - patched \n");
246 // if(s.IsCompletedModule()) continue;
248 fModuleChargeMap[index1]->Fill(coord2, coord1, signal);
250 GetRawsData(39+ 2 * fgknSDDmodules + index1)->Fill(coord1);
251 GetRawsData(39+ 4 * fgknSDDmodules + index1)->Fill(coord1,signal);
252 GetRawsData(39+ 6 * fgknSDDmodules + index1)->Fill(coord2);
253 GetRawsData(39+ 8 * fgknSDDmodules + index1)->Fill(coord2,signal);
254 GetRawsData(2639+index1)->Fill(signal,coord1);
257 if(!(cnt%10000)) AliDebug(1,Form(" %d raw digits read",cnt));
259 AliDebug(1,Form("Event completed, %d raw digits read",cnt));
261 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
262 for(Int_t iside=0; iside<fgknSide; iside++){
263 Int_t index1 = moduleSDD * 2 + iside;
264 //if(s.IsCompletedModule()) continue;
265 fmonoD[index1] = fModuleChargeMap[index1]->ProjectionY();
267 for(Int_t bin=0; bin<nBins; bin++){
268 GetRawsData(index1+39)->Fill(bin,fmonoD[index1]->GetBinContent(bin+1) );
272 for(Int_t i=0; i<3159; i++){
273 Int_t entries = static_cast<Int_t>(GetRawsData(i)->GetEntries());
275 AliDebug(1,Form("histo %d, name %s , entries %d ",i,GetRawsData(i)->GetName(),entries));
279 rawReader->RequireHeader(kTRUE);
284 //____________________________________________________________________________
285 void AliITSQADataMaker::InitRecPoints()
287 // create SDD histo of RecPoints
289 TH1F * h0 = new TH1F("Lay3TotCh","Layer 3 total charge",1000,-0.5, 499.5);
290 Add2RecPointsList(h0, 0);
292 TH1F * h1 = new TH1F("Lay4TotCh","Layer 4 total charge",1000,-0.5, 499.5);
293 Add2RecPointsList(h1, 1);
298 for(Int_t i=1; i<=3; i++){
299 hisnam[i] = new Char_t[50];
300 sprintf(hisnam[i],"Charge_L3_Strip%d",i);
301 h2[i] = new TH1F(hisnam[i],hisnam[i],1000,-0.5, 499.5);
302 Add2RecPointsList(h2[i],i+1);
307 for(Int_t i=1; i<=4; i++){
308 hisnam2[i] = new Char_t[50];
309 sprintf(hisnam2[i],"Charge_L4_Strip%d",i);
310 h3[i] = new TH1F(hisnam2[i],hisnam2[i],1000,-0.5, 499.5);
311 Add2RecPointsList(h3[i],i+4);
317 //____________________________________________________________________________
318 void AliITSQADataMaker::MakeRecPoints(TTree * clustersTree)
320 // makes data from RecPoints
322 TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints");
324 AliError("can't get the branch with the ITS clusters !");
327 TObjArray * recpoints = new TObjArray(100) ;
328 branchRecP->SetAddress(&recpoints);
329 branchRecP->GetEntry(0);
331 TIter next(recpoints);
333 while ( rp = dynamic_cast<AliITSRecPoint *>(next()) ) {
334 if(rp->GetLayer() ==3) GetRecPointsData(0)->Fill( rp->GetQ()) ;
335 else if(rp->GetLayer() ==4) GetRecPointsData(1)->Fill( rp->GetQ()) ;