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 "AliHMPIDQADataMakerSim.h"
37 #include "AliHMPIDParam.h"
38 #include "AliHMPIDRawStream.h"
42 // HMPID AliHMPIDQADataMakerSim base class
43 // for QA of simulation
44 // here also errors are calculated
47 ClassImp(AliHMPIDQADataMakerSim)
49 //____________________________________________________________________________
50 AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim() :
51 AliQADataMakerSim(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker")
56 //____________________________________________________________________________
57 AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
61 SetName((const char*)qadm.GetName()) ;
62 SetTitle((const char*)qadm.GetTitle());
65 //__________________________________________________________________
66 AliHMPIDQADataMakerSim& AliHMPIDQADataMakerSim::operator = (const AliHMPIDQADataMakerSim& qadm )
69 this->~AliHMPIDQADataMakerSim();
70 new(this) AliHMPIDQADataMakerSim(qadm);
74 //____________________________________________________________________________
75 void AliHMPIDQADataMakerSim::InitHits()
77 // create Hits histograms in Hits subdir
78 TH1F *hHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC",500,0,4000);
79 Add2HitsList(hHitQdc,0);
81 for(Int_t iCh=0;iCh<7;iCh++) {
82 hHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit}",iCh),162,-1,161,146,-1,145);
83 Add2HitsList(hHitMap[iCh],iCh+1);
88 //____________________________________________________________________________
89 void AliHMPIDQADataMakerSim::InitDigits()
91 // create Digits histograms in Digits subdir
92 TH1F *hDigPcEvt = new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
93 TH1F *hDigQ = new TH1F("Q ","Charge of digits (ADC) ",3000,0,3000);
94 TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
96 TProfile *tDigHighQ = new TProfile("tDigHighQ","Highest charge in chamber ",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
97 TProfile *tDigChEvt = new TProfile("tDigChEvt","Chamber occupancy per event (profile)",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
99 Add2DigitsList(hDigPcEvt,0);
100 Add2DigitsList(hDigQ ,1);
101 Add2DigitsList(hDigChEvt,2);
102 Add2DigitsList(tDigHighQ,3);
103 Add2DigitsList(tDigChEvt,4);
106 //____________________________________________________________________________
107 void AliHMPIDQADataMakerSim::InitSDigits()
109 // create SDigits histograms in SDigits subdir
110 TH1F *hSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID", 500, 0., 5000.) ;
112 Add2SDigitsList(hSDigits,0);
115 //____________________________________________________________________________
117 void AliHMPIDQADataMakerSim::MakeHits(TClonesArray * data)
120 //filling QA histos for Hits
122 TClonesArray * hits = dynamic_cast<TClonesArray *>(data) ;
124 AliError("Wrong type of hits container") ;
128 while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
129 if(hit->Pid()<500000) GetHitsData(0)->Fill(hit->Q()) ;
130 if(hit->Pid()<500000) GetHitsData(hit->Ch()+1)->Fill(hit->LorsX(),hit->LorsY());
135 //___________________________________________________________________________
136 void AliHMPIDQADataMakerSim::MakeHits(TTree * data)
139 //Opening of the Hit TTree
141 TClonesArray *pHits=new TClonesArray("AliHMPIDHit"); data->SetBranchAddress("HMPID",&pHits);
142 for(Int_t iEnt=0;iEnt<data->GetEntriesFast();iEnt++){//entries loop
143 data->GetEntry(iEnt);
147 //____________________________________________________________________________
148 void AliHMPIDQADataMakerSim::MakeDigits(TClonesArray * data)
151 //filling QA histos for Digits
153 TObjArray *chamber = dynamic_cast<TObjArray*>(data);
155 AliError("Wrong type of digits container") ;
157 for(Int_t i =0; i< chamber->GetEntries(); i++)
159 TClonesArray * digits = dynamic_cast<TClonesArray*>(chamber->At(i));
160 GetDigitsData(2)->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
161 GetDigitsData(4)->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
164 AliHMPIDDigit * digit;
165 while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
166 GetDigitsData(0)->Fill(10.*i+digit->Pc(),1./(48.*80.));
167 GetDigitsData(1)->Fill(digit->Q());
168 if(digit->Q()>highQ) highQ = digit->Q();
170 GetDigitsData(3)->Fill(i,highQ);
175 //___________________________________________________________________________
176 void AliHMPIDQADataMakerSim::MakeDigits(TTree * data)
179 //Opening the Digit Tree
181 TObjArray *pObjDig=new TObjArray(AliHMPIDParam::kMaxCh+1);
182 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
183 TClonesArray *pCA=new TClonesArray("AliHMPIDDigit");
184 pObjDig->AddAt(pCA,iCh);
187 pObjDig->SetOwner(kTRUE);
189 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
190 data->SetBranchAddress(Form("HMPID%i",iCh),&(*pObjDig)[iCh]);
194 MakeDigits((TClonesArray *)pObjDig);
196 //____________________________________________________________________________
198 void AliHMPIDQADataMakerSim::MakeSDigits(TClonesArray * data)
201 //filling QA histos for SDigits
203 TClonesArray * sdigits = dynamic_cast<TClonesArray *>(data) ;
205 AliError("Wrong type of sdigits container") ;
207 TIter next(sdigits) ;
208 AliHMPIDDigit * sdigit ;
209 while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
210 GetSDigitsData(0)->Fill(sdigit->Q());
214 //___________________________________________________________________________
215 void AliHMPIDQADataMakerSim::MakeSDigits(TTree * data)
218 // Opening the SDigit Tree
220 TClonesArray * sdigits = new TClonesArray("AliHMPIDDigit", 1000) ;
222 TBranch * branch = data->GetBranch("HMPID") ;
224 AliError("HMPID SDigit Tree not found") ;
227 branch->SetAddress(&sdigits) ;
228 branch->GetEntry(0) ;
229 MakeSDigits(sdigits) ;
231 //____________________________________________________________________________
232 void AliHMPIDQADataMakerSim::StartOfDetectorCycle()
234 //Detector specific actions at start of cycle
238 void AliHMPIDQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t, TObjArray *)
240 //Detector specific actions at end of cycle
241 // do the QA checking
242 // AliQAChecker::Instance()->Run(AliQA::kHMPID, task, obj) ;