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 "AliITSQADataMakerRec.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(AliITSQADataMakerRec)
48 //____________________________________________________________________________
49 AliITSQADataMakerRec::AliITSQADataMakerRec() :
50 AliQADataMakerRec(AliQA::GetDetName(AliQA::kITS), "SDD Quality Assurance Data Maker"),
55 // Default constructor
58 //____________________________________________________________________________
59 AliITSQADataMakerRec::AliITSQADataMakerRec(Int_t ldc, Bool_t kMode) :
60 AliQADataMakerRec(AliQA::GetDetName(AliQA::kITS), "SDD Quality Assurance Data Maker"),
65 //ctor used to discriminate OnLine-Offline analysis
68 //____________________________________________________________________________
69 AliITSQADataMakerRec::AliITSQADataMakerRec(const AliITSQADataMakerRec& qadm) :
70 AliQADataMakerRec(qadm),
71 fkOnline(qadm.fkOnline),
73 fnSDDHistos(qadm.fnSDDHistos)
76 SetName((const char*)qadm.GetName()) ;
77 SetTitle((const char*)qadm.GetTitle());
80 //__________________________________________________________________
81 AliITSQADataMakerRec& AliITSQADataMakerRec::operator = (const AliITSQADataMakerRec& qac )
84 this->~AliITSQADataMakerRec();
85 new(this) AliITSQADataMakerRec(qac);
89 //____________________________________________________________________________
90 void AliITSQADataMakerRec::StartOfDetectorCycle() const
92 //Detector specific actions at start of cycle
93 AliDebug(1,"AliITSQADM::Start of ITS Cycle\n");
96 //____________________________________________________________________________
97 void AliITSQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray *list)
99 // launch the QA checking
100 AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n");
102 AliQAChecker::Instance()->Run( AliQA::kITS , task, list);
105 //____________________________________________________________________________
106 void AliITSQADataMakerRec::EndOfDetectorCycle(const char * /* fgDataName */)
108 //possibly used for different AliQAChecker::Instance()->Run
111 //____________________________________________________________________________
112 void AliITSQADataMakerRec::InitRaws()
114 // create SDD histo of raw
119 AliInfo("Book Online Histograms\n");
122 AliInfo("Book Offline Histograms\n ");
125 TH1F *h0 = new TH1F("ModPattern","Modules pattern",fgknSDDmodules,-0.5,259.5);
128 TH1F *h1 = new TH1F("ModPatternL3","Modules pattern L3",14,0.5,14.5);
131 TH1F *h2 = new TH1F("ModPatternL4","Modules pattern L4",22,0.5,22.5);
135 Char_t *hname0[fgkLADDonLAY3] ;
136 TH1D *h3[fgkLADDonLAY3] ;
137 for(Int_t i=1; i<=fgkLADDonLAY3; i++) {
138 hname0[i-1] = new Char_t[20];
139 sprintf(hname0[i-1],"ModPattern_L3_%d",i);
140 h3[i-1] = new TH1D(hname0[i-1],hname0[i-1],6,0.5,6.5);
141 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);
157 Char_t *hname2[fgknSDDmodules*2] ;
158 TH1D *h5[fgknSDDmodules*2] ;
160 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
161 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
162 for(Int_t iside=0; iside<fgknSide; iside++){
163 //Int_t index1 = moduleSDD * 2 + iside;
164 hname2[index1] = new Char_t[50];
165 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
166 sprintf(hname2[index1],"ProjYMap_L%d_%d_%d_%d",lay,lad,det,iside);
168 h5[index1] = new TH1D(hname2[index1],hname2[index1],256,-0.5,255.5);
169 Add2RawsList(h5[index1],index1+39);
172 indexlast = index1+39;
177 Char_t *hname3[fgknSDDmodules*8] ;
178 TH1D *h6[fgknSDDmodules*8] ;
180 Int_t indexlast1 = 0;
181 for(Int_t htype=0; htype<4; htype++){
182 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
183 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
184 for(Int_t iside=0; iside<fgknSide; iside++){
185 //Int_t index1 = moduleSDD*2 + iside;
186 hname3[indextot] = new Char_t[50];
187 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
188 if(htype == 0) sprintf(hname3[indextot],"CountsVSAnode_L%d_%d_%d_%d",lay,lad,det,iside);
189 if(htype == 1) sprintf(hname3[indextot],"ChargeVSAnode_L%d_%d_%d_%d",lay,lad,det,iside);
190 if(htype == 2) sprintf(hname3[indextot],"CountsVSTbin_L%d_%d_%d_%d",lay,lad,det,iside);
191 if(htype == 3) sprintf(hname3[indextot],"ChargeVSTbin_L%d_%d_%d_%d",lay,lad,det,iside);
192 h6[indextot] = new TH1D(hname3[indextot],hname3[indextot],256,-0.5,255.5);
193 Add2RawsList(h6[indextot],indexlast + indextot);
196 indexlast1 = indexlast + indextot;
202 Int_t indexlast2 = 0;
203 Char_t *hname4[fgknSDDmodules*2];
204 TH2D *h7[fgknSDDmodules*2] ;
206 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
207 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
208 for(Int_t iside=0; iside<fgknSide; iside++){
209 //Int_t index1 = moduleSDD * 2 + iside;
210 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
211 hname4[index1] = new Char_t[50];
212 sprintf(hname4[index1],"Anode_vs_Charge_L%d_%d_%d_%d",lay,lad,det,iside);
213 h7[index1] = new TH2D(hname4[index1],hname4[index1],fgknSDDmodules*2,-0.5,-0.5+fgknSDDmodules*2,256,0.5,256.5);
214 Add2RawsList(h7[index1],indexlast1 + index1);
217 indexlast2 = indexlast1 + index1;
222 Char_t *hname[3][2 * fgknSDDmodules] ;
224 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
225 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
226 for(Int_t iside=0;iside<fgknSide;iside++){
227 //Int_t index1 = moduleSDD * 2 + iside ;
228 for(Int_t i=0; i<3; i++) hname[i][index1]= new Char_t[50];
229 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
230 sprintf(hname[0][index1],"chargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
231 sprintf(hname[1][index1],"TotalCharge_L%d_%d_%d_%d",lay,lad,det,iside);
232 sprintf(hname[2][index1],"hmonoDMap_L%d_%d_%d_%d",lay,lad,det,iside);
233 fModuleChargeMap[index1] = new TH2D(hname[0][index1],hname[1][index1],256,-0.5,255.5,256,-0.5,255.5);
234 Add2RawsList(fModuleChargeMap[index1],indexlast2 + index1);
236 fmonoD[index1] = new TH1D(hname[2][index1],hname[2][index1],256,-0.5,255.5);
243 AliDebug(1,Form("%d SDD histograms booked\n",fnSDDHistos));
246 //____________________________________________________________________________
247 void AliITSQADataMakerRec::MakeRaws(AliRawReader* rawReader)
249 //Fills Raw QA list of histos
250 if(rawReader->GetType() != 7) return; // skips non physical triggers
253 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
254 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
255 for(Int_t iside=0;iside<fgknSide;iside++) {
256 if(fnSDDHistos > 39+12 * 132 + index) GetRawsData(39+12 * 132 + index)->Reset();
262 AliDebug(1,"entering MakeRaws\n");
263 // rawReader->SelectEvents(7);
264 rawReader->SelectEquipment(17,fgkeqOffset+1,fgkeqOffset + fgkDDLidRange);
266 AliITSRawStreamSDD s(rawReader);
271 Int_t iddl = rawReader->GetDDLID() - fgkDDLIDshift;
272 Int_t isddmod = s.GetModuleNumber(iddl,s.GetCarlosId());
273 if(s.IsCompletedModule()) {
274 AliDebug(1,Form("IsCompletedModule == KTRUE\n"));
277 Int_t coord1 = s.GetCoord1();
278 Int_t coord2 = s.GetCoord2();
279 Int_t signal = s.GetSignal();
280 Int_t moduleSDD = isddmod - fgkmodoffset;
281 if(moduleSDD < 0 || moduleSDD>fgknSDDmodules+fgkmodoffset) {
282 AliDebug(1,Form( "Module SDD = %d, resetting it to 1 \n",moduleSDD));
285 GetRawsData(0)->Fill(moduleSDD);
287 AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det);
288 //printf("modnumb %d, lay %d, lad %d, det %d \n",isddmod, lay, lad, det);
295 GetRawsData(iorder)->Fill(lad);
296 GetRawsData(ioffset+lad-1)->Fill(det); //-1 because ladder# starts from 1
298 Short_t iside = s.GetChannel();
299 Int_t activeModule = moduleSDD;
300 if(moduleSDD > 35) activeModule -= 48;
301 Int_t index1 = activeModule * 2 + iside;
304 AliDebug(1,Form("Wrong index number %d - patched to 0\n",index1));
309 if(fnSDDHistos > 39+12 * 132 + index1) {
310 GetRawsData(39+ 2 * 132 + index1)->Fill(coord1);
311 GetRawsData(39+ 4 * 132 + index1)->Fill(coord1,signal);
312 GetRawsData(39+ 6 * 132 + index1)->Fill(coord2);
313 GetRawsData(39+ 8 * 132 + index1)->Fill(coord2,signal);
314 GetRawsData(39+10 * 132 + index1)->Fill(signal,coord1);
315 ((TH2D *)(GetRawsData(39+12 * 132 + index1)))->Fill(coord2, coord1, signal);
319 if(!(cnt%10000)) AliDebug(1,Form(" %d raw digits read",cnt));
321 AliDebug(1,Form("Event completed, %d raw digits read",cnt));
325 for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
326 if((moduleSDD >= 0 && moduleSDD < 36) || (moduleSDD >= 84 && moduleSDD < 180)) {
327 for(Int_t iside=0; iside<fgknSide; iside++){
328 Int_t activeModule = moduleSDD;
329 if(moduleSDD > 35) activeModule -= 48;
330 Int_t index1 = activeModule * 2 + iside;
331 if(fnSDDHistos > 39 + 2 * 132 + index1) {
332 fmonoD[index1] = ((TH2D *) (GetRawsData(39+12 * 132 + index1)))->ProjectionY();
333 for(Int_t bin=0; bin<nBins; bin++) GetRawsData(index1+39)->Fill(bin,fmonoD[index1]->GetBinContent(bin+1) );
338 for(Int_t i=0; i<fnSDDHistos; i++){
339 Int_t entries = static_cast<Int_t>(GetRawsData(i)->GetEntries());
341 AliDebug(1,Form("histo %d, name %s , entries %d ",i,GetRawsData(i)->GetName(),entries));
348 //____________________________________________________________________________
349 void AliITSQADataMakerRec::InitRecPoints()
351 // create SDD histo of RecPoints
353 TH1F * h0 = new TH1F("Lay3TotCh","Layer 3 total charge",1000,-0.5, 499.5);
354 Add2RecPointsList(h0, 0);
356 TH1F * h1 = new TH1F("Lay4TotCh","Layer 4 total charge",1000,-0.5, 499.5);
357 Add2RecPointsList(h1, 1);
362 for(Int_t i=1; i<=3; i++){
363 hisnam[i] = new Char_t[50];
364 sprintf(hisnam[i],"Charge_L3_Strip%d",i);
365 h2[i] = new TH1F(hisnam[i],hisnam[i],1000,-0.5, 499.5);
366 Add2RecPointsList(h2[i],i+1);
371 for(Int_t i=1; i<=4; i++){
372 hisnam2[i] = new Char_t[50];
373 sprintf(hisnam2[i],"Charge_L4_Strip%d",i);
374 h3[i] = new TH1F(hisnam2[i],hisnam2[i],1000,-0.5, 499.5);
375 Add2RecPointsList(h3[i],i+4);
381 //____________________________________________________________________________
382 void AliITSQADataMakerRec::MakeRecPoints(TTree * clustersTree)
384 // makes data from RecPoints
386 TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints");
388 AliError("can't get the branch with the ITS clusters !");
391 TObjArray * recpoints = new TObjArray(100) ;
392 branchRecP->SetAddress(&recpoints);
393 branchRecP->GetEntry(0);
395 TIter next(recpoints);
397 while ( rp = dynamic_cast<AliITSRecPoint *>(next()) ) {
398 if(rp->GetLayer() ==3) GetRecPointsData(0)->Fill( rp->GetQ()) ;
399 else if(rp->GetLayer() ==4) GetRecPointsData(1)->Fill( rp->GetQ()) ;