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"
46 ClassImp(AliITSQADataMaker)
48 //____________________________________________________________________________
49 AliITSQADataMaker::AliITSQADataMaker() :
50 AliQADataMaker(AliQA::GetDetName(AliQA::kITS), "SDD Quality Assurance Data Maker")
57 //____________________________________________________________________________
58 AliITSQADataMaker::AliITSQADataMaker(Int_t ldc, Bool_t kMode) :
59 AliQADataMaker(AliQA::GetDetName(AliQA::kITS), "SDD Quality Assurance Data Maker")
61 //ctor used to discriminate OnLine-Offline analysis
67 //____________________________________________________________________________
68 AliITSQADataMaker::AliITSQADataMaker(const AliITSQADataMaker& qadm) :
72 SetName((const char*)qadm.GetName()) ;
73 SetTitle((const char*)qadm.GetTitle());
76 //__________________________________________________________________
77 AliITSQADataMaker& AliITSQADataMaker::operator = (const AliITSQADataMaker& qac )
80 this->~AliITSQADataMaker();
81 new(this) AliITSQADataMaker(qac);
85 //____________________________________________________________________________
86 void AliITSQADataMaker::StartOfDetectorCycle() const
88 //Detector specific actions at start of cycle
89 AliDebug(1,"AliITSQADM::Start of ITS Cycle\n");
92 //____________________________________________________________________________
93 void AliITSQADataMaker::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray *list)
95 // launch the QA checking
96 AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n");
98 AliQAChecker::Instance()->Run( AliQA::kITS , task, list);
101 //____________________________________________________________________________
102 void AliITSQADataMaker::EndOfDetectorCycle(const char * fgDataName)
104 //eventually used for different AliQAChecker::Instance()->Run
107 //____________________________________________________________________________
108 void AliITSQADataMaker::InitRaws()
110 // create SDD histo of raw
115 AliInfo("Book Online Histograms\n");
118 AliInfo("Book Offline Histograms\n ");
121 TH1F *h0 = new TH1F("ModPattern","Modules pattern",fgknSDDmodules,-0.5,259.5);
124 TH1F *h1 = new TH1F("ModPatternL3","Modules pattern L3",14,0.5,14.5);
127 TH1F *h2 = new TH1F("ModPatternL4","Modules pattern L4",22,0.5,22.5);
131 Char_t *hname0[fgkLADDonLAY3] ;
132 TH1D *h3[fgkLADDonLAY3] ;
133 for(Int_t i=1; i<=fgkLADDonLAY3; i++) {
134 hname0[i-1] = new Char_t[20];
135 sprintf(hname0[i-1],"ModPattern_L3_%d",i);
136 h3[i-1] = new TH1D(hname0[i-1],hname0[i-1],6,0.5,6.5);
137 Add2RawsList(h3[i-1],i-1+3);
141 Char_t *hname1[fgkLADDonLAY4] ;
142 TH1D *h4[fgkLADDonLAY4] ;
143 for(Int_t i=1; i<=fgkLADDonLAY4; i++) {
144 hname1[i-1] = new Char_t[20];
145 sprintf(hname1[i-1],"ModPattern_L4_%d",i);
146 h4[i-1] = new TH1D(hname1[i-1],hname1[i-1],8,0.5,8.5);
147 Add2RawsList(h4[i-1],i-1+17);
153 Char_t *hname2[fgknSDDmodules*2] ;
154 TH1D *h5[fgknSDDmodules*2] ;
156 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
157 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
158 for(Int_t iside=0; iside<fgknSide; iside++){
159 //Int_t index1 = moduleSDD * 2 + iside;
160 hname2[index1] = new Char_t[50];
161 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
162 sprintf(hname2[index1],"ProjYMap_L%d_%d_%d_%d",lay,lad,det,iside);
164 h5[index1] = new TH1D(hname2[index1],hname2[index1],256,-0.5,255.5);
165 Add2RawsList(h5[index1],index1+39);
168 indexlast = index1+39;
173 Char_t *hname3[fgknSDDmodules*8] ;
174 TH1D *h6[fgknSDDmodules*8] ;
176 Int_t indexlast1 = 0;
177 for(Int_t htype=0; htype<4; htype++){
178 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
179 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
180 for(Int_t iside=0; iside<fgknSide; iside++){
181 //Int_t index1 = moduleSDD*2 + iside;
182 hname3[indextot] = new Char_t[50];
183 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
184 if(htype == 0) sprintf(hname3[indextot],"CountsVSAnode_L%d_%d_%d_%d",lay,lad,det,iside);
185 if(htype == 1) sprintf(hname3[indextot],"ChargeVSAnode_L%d_%d_%d_%d",lay,lad,det,iside);
186 if(htype == 2) sprintf(hname3[indextot],"CountsVSTbin_L%d_%d_%d_%d",lay,lad,det,iside);
187 if(htype == 3) sprintf(hname3[indextot],"ChargeVSTbin_L%d_%d_%d_%d",lay,lad,det,iside);
188 h6[indextot] = new TH1D(hname3[indextot],hname3[indextot],256,-0.5,255.5);
189 Add2RawsList(h6[indextot],indexlast + indextot);
192 indexlast1 = indexlast + indextot;
198 Int_t indexlast2 = 0;
199 Char_t *hname4[fgknSDDmodules*2];
200 TH2D *h7[fgknSDDmodules*2] ;
202 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
203 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
204 for(Int_t iside=0; iside<fgknSide; iside++){
205 //Int_t index1 = moduleSDD * 2 + iside;
206 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
207 hname4[index1] = new Char_t[50];
208 sprintf(hname4[index1],"Anode_vs_Charge_L%d_%d_%d_%d",lay,lad,det,iside);
209 h7[index1] = new TH2D(hname4[index1],hname4[index1],fgknSDDmodules*2,-0.5,-0.5+fgknSDDmodules*2,256,0.5,256.5);
210 Add2RawsList(h7[index1],indexlast1 + index1);
213 indexlast2 = indexlast1 + index1;
218 Char_t *hname[3][2 * fgknSDDmodules] ;
220 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
221 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
222 for(Int_t iside=0;iside<fgknSide;iside++){
223 //Int_t index1 = moduleSDD * 2 + iside ;
224 for(Int_t i=0; i<3; i++) hname[i][index1]= new Char_t[50];
225 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
226 sprintf(hname[0][index1],"chargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
227 sprintf(hname[1][index1],"TotalCharge_L%d_%d_%d_%d",lay,lad,det,iside);
228 sprintf(hname[2][index1],"hmonoDMap_L%d_%d_%d_%d",lay,lad,det,iside);
229 fModuleChargeMap[index1] = new TH2D(hname[0][index1],hname[1][index1],256,-0.5,255.5,256,-0.5,255.5);
230 Add2RawsList(fModuleChargeMap[index1],indexlast2 + index1);
232 fmonoD[index1] = new TH1D(hname[2][index1],hname[2][index1],256,-0.5,255.5);
239 AliDebug(1,Form("%d SDD histograms booked\n",fnSDDHistos));
242 //____________________________________________________________________________
243 void AliITSQADataMaker::MakeRaws(AliRawReader* rawReader)
245 //Fills Raw QA list of histos
246 if(rawReader->GetType() != 7) return; // skips non physical triggers
249 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
250 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
251 for(Int_t iside=0;iside<fgknSide;iside++) {
252 if(fnSDDHistos > 39+12 * 132 + index) GetRawsData(39+12 * 132 + index)->Reset();
258 AliDebug(1,"entering MakeRaws\n");
259 // rawReader->SelectEvents(7);
260 rawReader->SelectEquipment(17,fgkeqOffset+1,fgkeqOffset + fgkDDLidRange);
262 AliITSRawStreamSDD s(rawReader);
267 Int_t iddl = rawReader->GetDDLID() - fgkDDLIDshift;
268 Int_t isddmod = s.GetModuleNumber(iddl,s.GetCarlosId());
269 if(s.IsCompletedModule()) {
270 AliDebug(1,Form("IsCompletedModule == KTRUE\n"));
273 Int_t coord1 = s.GetCoord1();
274 Int_t coord2 = s.GetCoord2();
275 Int_t signal = s.GetSignal();
276 Int_t moduleSDD = isddmod - fgkmodoffset;
277 if(moduleSDD < 0 || moduleSDD>fgknSDDmodules+fgkmodoffset) {
278 AliDebug(1,Form( "Module SDD = %d, resetting it to 1 \n",moduleSDD));
281 GetRawsData(0)->Fill(moduleSDD);
283 AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det);
284 //printf("modnumb %d, lay %d, lad %d, det %d \n",isddmod, lay, lad, det);
291 GetRawsData(iorder)->Fill(lad);
292 GetRawsData(ioffset+lad-1)->Fill(det); //-1 because ladder# starts from 1
294 Short_t iside = s.GetChannel();
295 Int_t activeModule = moduleSDD;
296 if(moduleSDD > 35) activeModule -= 48;
297 Int_t index1 = activeModule * 2 + iside;
300 AliDebug(1,Form("Wrong index number %d - patched to 0\n",index1));
305 if(fnSDDHistos > 39+12 * 132 + index1) {
306 GetRawsData(39+ 2 * 132 + index1)->Fill(coord1);
307 GetRawsData(39+ 4 * 132 + index1)->Fill(coord1,signal);
308 GetRawsData(39+ 6 * 132 + index1)->Fill(coord2);
309 GetRawsData(39+ 8 * 132 + index1)->Fill(coord2,signal);
310 GetRawsData(39+10 * 132 + index1)->Fill(signal,coord1);
311 ((TH2D *)(GetRawsData(39+12 * 132 + index1)))->Fill(coord2, coord1, signal);
315 if(!(cnt%10000)) AliDebug(1,Form(" %d raw digits read",cnt));
317 AliDebug(1,Form("Event completed, %d raw digits read",cnt));
321 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
322 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
323 for(Int_t iside=0; iside<fgknSide; iside++){
324 Int_t activeModule = moduleSDD;
325 if(moduleSDD > 35) activeModule -= 48;
326 Int_t index1 = activeModule * 2 + iside;
327 if(fnSDDHistos > 39 + 2 * 132 + index1) {
328 fmonoD[index1] = ((TH2D *) (GetRawsData(39+12 * 132 + index1)))->ProjectionY();
329 for(Int_t bin=0; bin<nBins; bin++) GetRawsData(index1+39)->Fill(bin,fmonoD[index1]->GetBinContent(bin+1) );
334 for(Int_t i=0; i<fnSDDHistos; i++){
335 Int_t entries = static_cast<Int_t>(GetRawsData(i)->GetEntries());
337 AliDebug(1,Form("histo %d, name %s , entries %d ",i,GetRawsData(i)->GetName(),entries));
344 //____________________________________________________________________________
345 void AliITSQADataMaker::InitRecPoints()
347 // create SDD histo of RecPoints
349 TH1F * h0 = new TH1F("Lay3TotCh","Layer 3 total charge",1000,-0.5, 499.5);
350 Add2RecPointsList(h0, 0);
352 TH1F * h1 = new TH1F("Lay4TotCh","Layer 4 total charge",1000,-0.5, 499.5);
353 Add2RecPointsList(h1, 1);
358 for(Int_t i=1; i<=3; i++){
359 hisnam[i] = new Char_t[50];
360 sprintf(hisnam[i],"Charge_L3_Strip%d",i);
361 h2[i] = new TH1F(hisnam[i],hisnam[i],1000,-0.5, 499.5);
362 Add2RecPointsList(h2[i],i+1);
367 for(Int_t i=1; i<=4; i++){
368 hisnam2[i] = new Char_t[50];
369 sprintf(hisnam2[i],"Charge_L4_Strip%d",i);
370 h3[i] = new TH1F(hisnam2[i],hisnam2[i],1000,-0.5, 499.5);
371 Add2RecPointsList(h3[i],i+4);
377 //____________________________________________________________________________
378 void AliITSQADataMaker::MakeRecPoints(TTree * clustersTree)
380 // makes data from RecPoints
382 TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints");
384 AliError("can't get the branch with the ITS clusters !");
387 TObjArray * recpoints = new TObjArray(100) ;
388 branchRecP->SetAddress(&recpoints);
389 branchRecP->GetEntry(0);
391 TIter next(recpoints);
393 while ( rp = dynamic_cast<AliITSRecPoint *>(next()) ) {
394 if(rp->GetLayer() ==3) GetRecPointsData(0)->Fill( rp->GetQ()) ;
395 else if(rp->GetLayer() ==4) GetRecPointsData(1)->Fill( rp->GetQ()) ;