]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - HMPID/AliHMPIDQADataMakerSim.cxx
Added option for possible gaussian (Sumw2) error propagation in CalculateEfficiency()
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDQADataMakerSim.cxx
... / ...
CommitLineData
1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16
17/* $Id$ */
18
19// --- ROOT system ---
20#include <TClonesArray.h>
21#include <TFile.h>
22#include <TH1F.h>
23#include <TH2F.h>
24#include <Riostream.h>
25// --- Standard library ---
26
27// --- AliRoot header files ---
28#include "AliESDCaloCluster.h"
29#include "AliESDEvent.h"
30#include "AliQAChecker.h"
31#include "AliLog.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"
38#include "AliLog.h"
39
40//.
41// HMPID AliHMPIDQADataMakerSim base class
42// for QA of simulation
43// here also errors are calculated
44//.
45
46ClassImp(AliHMPIDQADataMakerSim)
47
48//____________________________________________________________________________
49 AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim() :
50 AliQADataMakerSim(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker")
51{
52 // ctor
53}
54
55//____________________________________________________________________________
56AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
57 AliQADataMakerSim()
58{
59 //copy ctor
60 SetName((const char*)qadm.GetName()) ;
61 SetTitle((const char*)qadm.GetTitle());
62}
63
64//__________________________________________________________________
65AliHMPIDQADataMakerSim& AliHMPIDQADataMakerSim::operator = (const AliHMPIDQADataMakerSim& qadm )
66{
67 // Equal operator.
68 this->~AliHMPIDQADataMakerSim();
69 new(this) AliHMPIDQADataMakerSim(qadm);
70 return *this;
71}
72
73//____________________________________________________________________________
74void AliHMPIDQADataMakerSim::InitHits()
75{
76 // create Hits histograms in Hits subdir
77 Bool_t expert = kTRUE;
78
79 TH1F *hHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC",500,0,4000);
80 Add2HitsList(hHitQdc,0);
81 TH2F *hHitMap[7];
82 for(Int_t iCh=0;iCh<7;iCh++) {
83 hHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit}",iCh),162,-1,161,146,-1,145);
84 Add2HitsList(hHitMap[iCh],iCh+1,expert);
85 }
86
87}
88
89//____________________________________________________________________________
90void AliHMPIDQADataMakerSim::InitDigits()
91{
92 // create Digits histograms in Digits subdir
93
94 Bool_t expert = kTRUE;
95
96 TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
97 TH1F *hDigPcEvt = new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
98 TH2F *hDigMap[7];
99 TH1F *hDigQ[42];
100 for(Int_t iCh =0; iCh < 7; iCh++){
101 hDigMap[iCh] = new TH2F(Form("MapCh%i",iCh),Form("Digit Map in Chamber %i",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 ",iCh,iPc),4100,0,4100);
104 }
105 }
106
107 Add2DigitsList(hDigChEvt,0);
108 Add2DigitsList(hDigPcEvt,1,expert);
109 for(Int_t iMap=0; iMap < 7; iMap++) Add2DigitsList(hDigMap[iMap],2+iMap,expert);
110 for(Int_t iH =0; iH < 42 ; iH++) Add2DigitsList(hDigQ[iH] ,9+iH,expert);
111}
112
113//____________________________________________________________________________
114void AliHMPIDQADataMakerSim::InitSDigits()
115{
116 // create SDigits histograms in SDigits subdir
117 TH1F *hSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID", 500, 0., 5000.) ;
118
119Add2SDigitsList(hSDigits,0);
120}
121
122//____________________________________________________________________________
123
124void AliHMPIDQADataMakerSim::MakeHits(TClonesArray * data)
125{
126 //
127 //filling QA histos for Hits
128 //
129 TClonesArray * hits = dynamic_cast<TClonesArray *>(data) ;
130 if (!hits){
131 AliError("Wrong type of hits container") ;
132 } else {
133 TIter next(hits);
134 AliHMPIDHit * hit ;
135 while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
136 if(hit->Pid()<500000) GetHitsData(0)->Fill(hit->Q()) ;
137 if(hit->Pid()<500000) GetHitsData(hit->Ch()+1)->Fill(hit->LorsX(),hit->LorsY());
138 }
139 }
140
141}
142//___________________________________________________________________________
143void AliHMPIDQADataMakerSim::MakeHits(TTree * data)
144{
145//
146//Opening of the Hit TTree
147//
148 TClonesArray *pHits=new TClonesArray("AliHMPIDHit"); data->SetBranchAddress("HMPID",&pHits);
149 for(Int_t iEnt=0;iEnt<data->GetEntriesFast();iEnt++){//entries loop
150 data->GetEntry(iEnt);
151 MakeHits(pHits);
152 }//entries loop
153}
154//____________________________________________________________________________
155void AliHMPIDQADataMakerSim::MakeDigits(TClonesArray * data)
156{
157 //
158 //filling QA histos for Digits
159 //
160
161 TObjArray *chamber = dynamic_cast<TObjArray*>(data);
162 if ( !chamber) {
163 AliError("Wrong type of digits container") ;
164 } else {
165 for(Int_t i =0; i< chamber->GetEntries(); i++)
166 {
167 TClonesArray * digits = dynamic_cast<TClonesArray*>(chamber->At(i));
168 GetDigitsData(0)->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
169 TIter next(digits);
170 AliHMPIDDigit * digit;
171 while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
172 GetDigitsData(1)->Fill(10.*i+digit->Pc(),1./(48.*80.));
173 GetDigitsData(2+i)->Fill(digit->PadChX(),digit->PadChY());
174 GetDigitsData(9+i*6+digit->Pc())->Fill(digit->Q());
175 }
176 }
177 }
178}
179//___________________________________________________________________________
180void AliHMPIDQADataMakerSim::MakeDigits(TTree * data)
181{
182//
183//Opening the Digit Tree
184//
185 TObjArray *pObjDig=new TObjArray(AliHMPIDParam::kMaxCh+1);
186 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
187 TClonesArray *pCA=new TClonesArray("AliHMPIDDigit");
188 pObjDig->AddAt(pCA,iCh);
189 }
190
191 pObjDig->SetOwner(kTRUE);
192
193 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
194 data->SetBranchAddress(Form("HMPID%i",iCh),&(*pObjDig)[iCh]);
195 }
196 data->GetEntry(0);
197
198 MakeDigits((TClonesArray *)pObjDig);
199}
200//____________________________________________________________________________
201
202void AliHMPIDQADataMakerSim::MakeSDigits(TClonesArray * data)
203{
204 //
205 //filling QA histos for SDigits
206 //
207 TClonesArray * sdigits = dynamic_cast<TClonesArray *>(data) ;
208 if (!sdigits) {
209 AliError("Wrong type of sdigits container") ;
210 } else {
211 TIter next(sdigits) ;
212 AliHMPIDDigit * sdigit ;
213 while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
214 GetSDigitsData(0)->Fill(sdigit->Q());
215 }
216 }
217}
218//___________________________________________________________________________
219void AliHMPIDQADataMakerSim::MakeSDigits(TTree * data)
220{
221 //
222 // Opening the SDigit Tree
223 //
224 TClonesArray * sdigits = new TClonesArray("AliHMPIDDigit", 1000) ;
225
226 TBranch * branch = data->GetBranch("HMPID") ;
227 if ( ! branch ) {
228 AliError("HMPID SDigit Tree not found") ;
229 return;
230 }
231 branch->SetAddress(&sdigits) ;
232 branch->GetEntry(0) ;
233 MakeSDigits(sdigits) ;
234}
235//____________________________________________________________________________
236void AliHMPIDQADataMakerSim::StartOfDetectorCycle()
237{
238 //Detector specific actions at start of cycle
239
240}
241
242void AliHMPIDQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray **obj)
243{
244 //Detector specific actions at end of cycle
245 // do the QA checking
246 AliQAChecker::Instance()->Run(AliQA::kHMPID, task, obj) ;
247}
248