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>
24 #include <Riostream.h>
25 // --- Standard library ---
27 // --- AliRoot header files ---
28 #include "AliESDCaloCluster.h"
29 #include "AliESDEvent.h"
30 #include "AliQAChecker.h"
32 #include "AliHMPIDDigit.h"
33 #include "AliHMPIDHit.h"
34 #include "AliHMPIDCluster.h"
35 #include "AliHMPIDQADataMakerSim.h"
36 #include "AliHMPIDParam.h"
37 #include "AliHMPIDRawStream.h"
41 // HMPID AliHMPIDQADataMakerSim base class
42 // for QA of simulation
43 // here also errors are calculated
46 ClassImp(AliHMPIDQADataMakerSim)
48 //____________________________________________________________________________
49 AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim() :
50 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kHMPID), "HMPID Quality Assurance Data Maker")
55 //____________________________________________________________________________
56 AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
60 SetName((const char*)qadm.GetName()) ;
61 SetTitle((const char*)qadm.GetTitle());
64 //__________________________________________________________________
65 AliHMPIDQADataMakerSim& AliHMPIDQADataMakerSim::operator = (const AliHMPIDQADataMakerSim& qadm )
68 this->~AliHMPIDQADataMakerSim();
69 new(this) AliHMPIDQADataMakerSim(qadm);
73 //____________________________________________________________________________
74 void AliHMPIDQADataMakerSim::InitHits()
76 // create Hits histograms in Hits subdir
77 const Bool_t expert = kTRUE ;
78 const Bool_t image = kTRUE ;
80 TH1F *hHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC;Entries",500,0,4000);
81 Add2HitsList(hHitQdc,0, !expert, image);
83 for(Int_t iCh=0;iCh<7;iCh++) {
84 hHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit};Entries",iCh),162,-1,161,146,-1,145);
85 Add2HitsList(hHitMap[iCh],iCh+1,expert,!image);
89 //____________________________________________________________________________
90 void AliHMPIDQADataMakerSim::InitDigits()
92 // create Digits histograms in Digits subdir
93 const Bool_t expert = kTRUE ;
94 const Bool_t image = kTRUE ;
96 TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event;Occupanc [%];Entries",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
97 TH1F *hDigPcEvt = new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
100 for(Int_t iCh =0; iCh < 7; iCh++){
101 hDigMap[iCh] = new TH2F(Form("MapCh%i",iCh),Form("Digit Map in Chamber %i;Digit #;Entries",iCh),159,0,159,143,0,143);
102 for(Int_t iPc =0; iPc < 6; iPc++ ){
103 hDigQ[iCh*6+iPc] = new TH1F(Form("QCh%iPc%i ",iCh,iPc),Form("Charge of digits (ADC) in Chamber %i and PC %i;Charge;Entries",iCh,iPc),4100,0,4100);
107 Add2DigitsList(hDigChEvt,0, !expert, image);
108 Add2DigitsList(hDigPcEvt,1,expert, !image);
109 for(Int_t iMap=0; iMap < 7; iMap++) Add2DigitsList(hDigMap[iMap],2+iMap,expert, !image);
110 for(Int_t iH =0; iH < 42 ; iH++) Add2DigitsList(hDigQ[iH] ,9+iH,expert,!image);
113 //____________________________________________________________________________
114 void AliHMPIDQADataMakerSim::InitSDigits()
116 // create SDigits histograms in SDigits subdir
117 const Bool_t expert = kTRUE ;
118 const Bool_t image = kTRUE ;
120 TH1F *hSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID;QDC;Entries", 500, 0., 5000.) ;
121 Add2SDigitsList(hSDigits,0, !expert, image);
124 //____________________________________________________________________________
126 void AliHMPIDQADataMakerSim::MakeHits(TClonesArray * data)
129 //filling QA histos for Hits
131 TClonesArray * hits = dynamic_cast<TClonesArray *>(data) ;
133 AliError("Wrong type of hits container") ;
136 // Check id histograms already created for this Event Specie
137 if ( ! GetHitsData(0) )
142 while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
143 if(hit->Pid()<500000) GetHitsData(0)->Fill(hit->Q()) ;
144 if(hit->Pid()<500000) GetHitsData(hit->Ch()+1)->Fill(hit->LorsX(),hit->LorsY());
149 //___________________________________________________________________________
150 void AliHMPIDQADataMakerSim::MakeHits(TTree * data)
153 //Opening of the Hit TTree
155 TClonesArray *pHits=new TClonesArray("AliHMPIDHit"); data->SetBranchAddress("HMPID",&pHits);
156 for(Int_t iEnt=0;iEnt<data->GetEntriesFast();iEnt++){//entries loop
157 data->GetEntry(iEnt);
161 //____________________________________________________________________________
162 void AliHMPIDQADataMakerSim::MakeDigits(TClonesArray * data)
165 //filling QA histos for Digits
168 TObjArray *chamber = dynamic_cast<TObjArray*>(data);
170 AliError("Wrong type of digits container") ;
173 // Check id histograms already created for this Event Specie
174 if ( ! GetDigitsData(0) )
177 for(Int_t i =0; i< chamber->GetEntries(); i++)
179 TClonesArray * digits = dynamic_cast<TClonesArray*>(chamber->At(i));
180 GetDigitsData(0)->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
182 AliHMPIDDigit * digit;
183 while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
184 GetDigitsData(1)->Fill(10.*i+digit->Pc(),1./(48.*80.));
185 GetDigitsData(2+i)->Fill(digit->PadChX(),digit->PadChY());
186 GetDigitsData(9+i*6+digit->Pc())->Fill(digit->Q());
191 //___________________________________________________________________________
192 void AliHMPIDQADataMakerSim::MakeDigits(TTree * data)
195 //Opening the Digit Tree
197 TObjArray *pObjDig=new TObjArray(AliHMPIDParam::kMaxCh+1);
198 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
199 TClonesArray *pCA=new TClonesArray("AliHMPIDDigit");
200 pObjDig->AddAt(pCA,iCh);
203 pObjDig->SetOwner(kTRUE);
205 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
206 data->SetBranchAddress(Form("HMPID%i",iCh),&(*pObjDig)[iCh]);
210 MakeDigits((TClonesArray *)pObjDig);
212 //____________________________________________________________________________
214 void AliHMPIDQADataMakerSim::MakeSDigits(TClonesArray * data)
217 //filling QA histos for SDigits
219 TClonesArray * sdigits = dynamic_cast<TClonesArray *>(data) ;
221 AliError("Wrong type of sdigits container") ;
224 // Check id histograms already created for this Event Specie
225 if ( ! GetSDigitsData(0) )
228 TIter next(sdigits) ;
229 AliHMPIDDigit * sdigit ;
230 while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
231 GetSDigitsData(0)->Fill(sdigit->Q());
235 //___________________________________________________________________________
236 void AliHMPIDQADataMakerSim::MakeSDigits(TTree * data)
239 // Opening the SDigit Tree
241 TClonesArray * sdigits = new TClonesArray("AliHMPIDDigit", 1000) ;
243 TBranch * branch = data->GetBranch("HMPID") ;
245 AliError("HMPID SDigit Tree not found") ;
248 branch->SetAddress(&sdigits) ;
249 branch->GetEntry(0) ;
250 MakeSDigits(sdigits) ;
252 //____________________________________________________________________________
253 void AliHMPIDQADataMakerSim::StartOfDetectorCycle()
255 //Detector specific actions at start of cycle
259 void AliHMPIDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray **obj)
261 //Detector specific actions at end of cycle
262 // do the QA checking
263 AliQAChecker::Instance()->Run(AliQAv1::kHMPID, task, obj) ;