1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
19 // --- ROOT system ---
20 #include <TClonesArray.h>
25 #include <Riostream.h>
26 // --- Standard library ---
28 // --- AliRoot header files ---
29 #include "AliESDCaloCluster.h"
30 #include "AliESDEvent.h"
31 #include "AliQAChecker.h"
33 #include "AliHMPIDDigit.h"
34 #include "AliHMPIDHit.h"
35 #include "AliHMPIDCluster.h"
36 #include "AliHMPIDQADataMaker.h"
37 #include "AliHMPIDParam.h"
38 #include "AliHMPIDRawStream.h"
40 ClassImp(AliHMPIDQADataMaker)
42 //____________________________________________________________________________
43 AliHMPIDQADataMaker::AliHMPIDQADataMaker() :
44 AliQADataMaker(AliQAv1::GetDetName(AliQAv1::kHMPID), "HMPID Quality Assurance Data Maker")
49 //____________________________________________________________________________
50 AliHMPIDQADataMaker::AliHMPIDQADataMaker(const AliHMPIDQADataMaker& qadm) :
54 SetName((const char*)qadm.GetName()) ;
55 SetTitle((const char*)qadm.GetTitle());
58 //__________________________________________________________________
59 AliHMPIDQADataMaker& AliHMPIDQADataMaker::operator = (const AliHMPIDQADataMaker& qadm )
62 this->~AliHMPIDQADataMaker();
63 new(this) AliHMPIDQADataMaker(qadm);
67 //____________________________________________________________________________
68 void AliHMPIDQADataMaker::InitHits()
70 // create Hits histograms in Hits subdir
71 TH1F *hHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC",500,0,4000);
72 Add2HitsList(hHitQdc,0);
74 for(Int_t iCh=0;iCh<7;iCh++) {
75 hHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit}",iCh),162,-1,161,146,-1,145);
76 Add2HitsList(hHitMap[iCh],iCh+1);
81 //____________________________________________________________________________
82 void AliHMPIDQADataMaker::InitDigits()
84 // create Digits histograms in Digits subdir
85 TH1F *hDigPcEvt = new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
86 TH1F *hDigQ = new TH1F("Q ","Charge of digits (ADC) ",3000,0,3000);
87 TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
89 TProfile *tDigHighQ = new TProfile("tDigHighQ","Highest charge in chamber ",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
90 TProfile *tDigChEvt = new TProfile("tDigChEvt","Chamber occupancy per event (profile)",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
92 Add2DigitsList(hDigPcEvt,0);
93 Add2DigitsList(hDigQ ,1);
94 Add2DigitsList(hDigChEvt,2);
95 Add2DigitsList(tDigHighQ,3);
96 Add2DigitsList(tDigChEvt,4);
99 //____________________________________________________________________________
100 void AliHMPIDQADataMaker::InitSDigits()
102 // create SDigits histograms in SDigits subdir
103 TH1F *hSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID", 500, 0., 5000.) ;
105 Add2SDigitsList(hSDigits,0);
108 //____________________________________________________________________________
110 void AliHMPIDQADataMaker::InitRecPoints()
112 // create cluster histograms in RecPoint subdir
114 TH1F *hCluEvt=new TH1F("CluPerEvt","Cluster multiplicity" ,100,0,100);
115 TH1F *hCluChi2 =new TH1F("CluChi2" ,"Chi2 " ,1000,0,100);
116 TH1F *hCluFlg =new TH1F("CluFlg" ,"Cluster flag" ,14,-1.5,12.5); hCluFlg->SetFillColor(5);
117 TH1F *hCluSize =new TH1F("CluSize" ,"Cluster size ",100,0,100);
118 TH1F *hCluQ =new TH1F("CluQ" ,"Cluster charge (ADC)",1000,0,5000);
120 Add2RecPointsList(hCluEvt , 0);
121 Add2RecPointsList(hCluChi2, 1);
122 Add2RecPointsList(hCluFlg , 2);
123 Add2RecPointsList(hCluSize, 3);
124 Add2RecPointsList(hCluQ , 4);
126 //____________________________________________________________________________
128 void AliHMPIDQADataMaker::InitRaws()
131 // Booking QA histo for Raw data
134 for(Int_t iddl =0; iddl<14; iddl++) {
135 hqPad[iddl] = new TH1F(Form("hqPadDDL%i",iddl), Form("Pad Q Entries at DDL %i",iddl), 500,0,5000);
136 Add2RawsList(hqPad[iddl],iddl);
139 const Int_t nerr = (Int_t)AliHMPIDRawStream::kSumErr+1;
140 const char *hnames[nerr]={"RawDataSize","RawMarkerSize","WrongRow","WrongDilogic","WrongPad","EoEFlag",
141 "EoESize","EoEDILOGIC","EoERow","BadSegWord","WrongSeg","RowMarkerSize","NoErrors","Invalid"};
143 TH1F *hSumErr = new TH1F("SumErr","Summary of the returned errors",2*nerr,0,nerr);
145 for(Int_t ilabel=0; ilabel< nerr; ilabel++) {
146 hSumErr->GetXaxis()->CenterLabels(kTRUE);
147 hSumErr->GetXaxis()->SetBinLabel((2*ilabel+1),Form("%i %s",ilabel+1,hnames[ilabel]));
150 Add2RawsList(hSumErr,14);
153 //____________________________________________________________________________
154 void AliHMPIDQADataMaker::InitESDs()
157 //Booking ESDs histograms
158 TH2F* hCkovP = new TH2F("CkovP" , "#theta_{c}, [rad];P, [GeV]" , 150, 0, 7 ,100, 0, 1) ;
159 TH2F* hSigP = new TH2F("SigP" ,"#sigma_{#theta_c} [mrad];[GeV]", 150, 0, 7 ,100, 0, 1) ;
160 TH2F* hMipXY = new TH2F("MipXY" ,"mip position" , 260, 0,130 ,252, 0,126) ;
161 TH2F* hDifXY = new TH2F("DifXY" ,"diff" , 200, -10, 10 ,200,-10,10) ;
163 hPid[0] = new TH1F("PidE" ,"electron response" , 101, -0.005,1.005) ;
164 hPid[1] = new TH1F("PidMu","#mu response" , 101, -0.005,1.005) ;
165 hPid[2] = new TH1F("PidPi","#pi response" , 101, -0.005,1.005) ;
166 hPid[3] = new TH1F("PidK" ,"K response" , 101, -0.005,1.005) ;
167 hPid[4] = new TH1F("PidP" ,"p response" ,101, -0.005,1.005) ;
169 Add2ESDsList(hCkovP,0);
170 Add2ESDsList(hSigP ,1);
171 Add2ESDsList(hMipXY,2);
172 Add2ESDsList(hDifXY,3);
173 for(Int_t i=0; i< 5; i++) Add2ESDsList(hPid[i],i+4);
175 //____________________________________________________________________________
177 void AliHMPIDQADataMaker::MakeHits(TClonesArray * data)
180 //filling QA histos for Hits
182 TClonesArray * hits = dynamic_cast<TClonesArray *>(data) ;
184 AliError("Wrong type of hits container") ;
188 while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
189 if(hit->Pid()<500000) GetHitsData(0)->Fill(hit->Q()) ;
190 if(hit->Pid()<500000) GetHitsData(hit->Ch()+1)->Fill(hit->LorsX(),hit->LorsY());
195 //___________________________________________________________________________
196 void AliHMPIDQADataMaker::MakeHits(TTree * data)
199 //Opening of the Hit TTree
201 TClonesArray *pHits=new TClonesArray("AliHMPIDHit"); data->SetBranchAddress("HMPID",&pHits);
202 for(Int_t iEnt=0;iEnt<data->GetEntriesFast();iEnt++){//entries loop
203 data->GetEntry(iEnt);
207 //____________________________________________________________________________
208 void AliHMPIDQADataMaker::MakeDigits(TClonesArray * data)
211 //filling QA histos for Digits
213 TObjArray *chamber = dynamic_cast<TObjArray*>(data);
215 AliError("Wrong type of digits container") ;
217 for(Int_t i =0; i< chamber->GetEntries(); i++)
219 TClonesArray * digits = dynamic_cast<TClonesArray*>(chamber->At(i));
220 GetDigitsData(2)->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
221 GetDigitsData(4)->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
224 AliHMPIDDigit * digit;
225 while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
226 GetDigitsData(0)->Fill(10.*i+digit->Pc(),1./(48.*80.));
227 GetDigitsData(1)->Fill(digit->Q());
228 if(digit->Q()>highQ) highQ = digit->Q();
230 GetDigitsData(3)->Fill(i,highQ);
235 //___________________________________________________________________________
236 void AliHMPIDQADataMaker::MakeDigits(TTree * data)
239 //Opening the Digit Tree
241 TObjArray *pObjDig=new TObjArray(AliHMPIDParam::kMaxCh+1);
242 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
243 TClonesArray *pCA=new TClonesArray("AliHMPIDDigit");
244 pObjDig->AddAt(pCA,iCh);
247 pObjDig->SetOwner(kTRUE);
249 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
250 data->SetBranchAddress(Form("HMPID%i",iCh),&(*pObjDig)[iCh]);
254 MakeDigits((TClonesArray *)pObjDig);
256 //____________________________________________________________________________
258 void AliHMPIDQADataMaker::MakeRaws(AliRawReader *rawReader)
261 // Filling Raws QA histos
263 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
264 AliHMPIDRawStream stream(rawReader);
268 UInt_t ddl=stream.GetDDLNumber(); //returns 0,1,2 ... 13
269 if((UInt_t)(2*iCh)==ddl || (UInt_t)(2*iCh+1)==ddl) {
270 for(Int_t row = 1; row <= AliHMPIDRawStream::kNRows; row++){
271 for(Int_t dil = 1; dil <= AliHMPIDRawStream::kNDILOGICAdd; dil++){
272 for(Int_t pad = 0; pad < AliHMPIDRawStream::kNPadAdd; pad++){
273 if(stream.GetCharge(ddl,row,dil,pad) < 1) continue;
274 GetRawsData(ddl)->Fill(stream.GetCharge(ddl,row,dil,pad));
275 // Printf("charge %i",stream.GetCharge(ddl,row,dil,pad));
281 for(Int_t iErr =1; iErr<(Int_t)AliHMPIDRawStream::kSumErr; iErr++){
282 Int_t errflag = stream.GetErrors(iErr);
284 if(errflag < 0) GetRawsData(14)->Fill((Int_t)AliHMPIDRawStream::kSumErr+0.5);
285 else if(errflag == 0) GetRawsData(14)->Fill((Int_t)AliHMPIDRawStream::kSumErr-0.5);
286 else GetRawsData(14)->Fill(iErr-0.5);
292 //___________________________________________________________________________
294 void AliHMPIDQADataMaker::MakeSDigits(TClonesArray * data)
297 //filling QA histos for SDigits
299 TClonesArray * sdigits = dynamic_cast<TClonesArray *>(data) ;
301 AliError("Wrong type of sdigits container") ;
303 TIter next(sdigits) ;
304 AliHMPIDDigit * sdigit ;
305 while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
306 GetSDigitsData(0)->Fill(sdigit->Q());
310 //___________________________________________________________________________
311 void AliHMPIDQADataMaker::MakeSDigits(TTree * data)
314 // Opening the SDigit Tree
316 TClonesArray * sdigits = new TClonesArray("AliHMPIDDigit", 1000) ;
318 TBranch * branch = data->GetBranch("HMPID") ;
320 AliError("HMPID SDigit Tree not found") ;
323 branch->SetAddress(&sdigits) ;
324 branch->GetEntry(0) ;
325 MakeSDigits(sdigits) ;
327 //____________________________________________________________________________
328 void AliHMPIDQADataMaker::MakeRecPoints(TTree * clustersTree)
331 //filling QA histos for clusters
333 TClonesArray *clusters = new TClonesArray("AliHMPIDCluster");
334 for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++){
335 TBranch *branch = clustersTree->GetBranch(Form("HMPID%d",i));
336 branch->SetAddress(&clusters);
339 GetRecPointsData(0)->Fill(i,clusters->GetEntries());
340 TIter next(clusters);
341 AliHMPIDCluster *clu;
342 while ( (clu = dynamic_cast<AliHMPIDCluster *>(next())) ) {
343 GetRecPointsData(1)->Fill(clu->Chi2());
344 GetRecPointsData(2)->Fill(clu->Status());
345 GetRecPointsData(3)->Fill(clu->Size());
346 GetRecPointsData(4)->Fill(clu->Q());
354 //____________________________________________________________________________
355 void AliHMPIDQADataMaker::MakeESDs(AliESDEvent * esd)
358 //fills QA histos for ESD
360 for(Int_t iTrk = 0 ; iTrk < esd->GetNumberOfTracks() ; iTrk++){
361 AliESDtrack *pTrk = esd->GetTrack(iTrk) ;
362 GetESDsData(0)->Fill(pTrk->GetP(),pTrk->GetHMPIDsignal());
363 GetESDsData(1)->Fill( pTrk->GetP(),TMath::Sqrt(pTrk->GetHMPIDchi2()));
364 Float_t xm,ym; Int_t q,np;
365 pTrk->GetHMPIDmip(xm,ym,q,np); //mip info
366 GetESDsData(2)->Fill(xm,ym);
367 Float_t xRad,yRad,th,ph;
368 pTrk->GetHMPIDtrk(xRad,yRad,th,ph); //track info at the middle of the radiator
369 Float_t xPc = xRad+9.25*TMath::Tan(th)*TMath::Cos(ph); // temporar: linear extrapol (B=0!)
370 Float_t yPc = yRad+9.25*TMath::Tan(th)*TMath::Sin(ph); // temporar: "
371 GetESDsData(3)->Fill(xm-xPc,ym-yPc); //track info
372 Double_t pid[5] ; pTrk->GetHMPIDpid(pid) ;
373 for(Int_t i = 0 ; i < 5 ; i++) GetESDsData(4+i)->Fill(pid[i]) ;
376 //____________________________________________________________________________
377 void AliHMPIDQADataMaker::StartOfDetectorCycle()
379 //Detector specific actions at start of cycle
383 void AliHMPIDQADataMaker::EndOfDetectorCycle(AliQAv1::TASKINDEX task, TObjArray * obj)
385 //Detector specific actions at end of cycle
386 // do the QA checking
387 // AliQAChecker::Instance()->Run(AliQAv1::kHMPID, task, obj) ;