]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - HMPID/AliHMPIDQADataMakerSim.cxx
fixing comment
[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 <TProfile.h>
25#include <Riostream.h>
26// --- Standard library ---
27
28// --- AliRoot header files ---
29#include "AliESDCaloCluster.h"
30#include "AliESDEvent.h"
31#include "AliQAChecker.h"
32#include "AliLog.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"
39#include "AliLog.h"
40
41//.
42// HMPID AliHMPIDQADataMakerSim base class
43// for QA of simulation
44// here also errors are calculated
45//.
46
47ClassImp(AliHMPIDQADataMakerSim)
48
49//____________________________________________________________________________
50 AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim() :
51 AliQADataMakerSim(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker")
52{
53 // ctor
54}
55
56//____________________________________________________________________________
57AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
58 AliQADataMakerSim()
59{
60 //copy ctor
61 SetName((const char*)qadm.GetName()) ;
62 SetTitle((const char*)qadm.GetTitle());
63}
64
65//__________________________________________________________________
66AliHMPIDQADataMakerSim& AliHMPIDQADataMakerSim::operator = (const AliHMPIDQADataMakerSim& qadm )
67{
68 // Equal operator.
69 this->~AliHMPIDQADataMakerSim();
70 new(this) AliHMPIDQADataMakerSim(qadm);
71 return *this;
72}
73
74//____________________________________________________________________________
75void AliHMPIDQADataMakerSim::InitHits()
76{
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);
80 TH2F *hHitMap[7];
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);
84 }
85
86}
87
88//____________________________________________________________________________
89void AliHMPIDQADataMakerSim::InitDigits()
90{
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);
95
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);
98
99Add2DigitsList(hDigPcEvt,0);
100Add2DigitsList(hDigQ ,1);
101Add2DigitsList(hDigChEvt,2);
102Add2DigitsList(tDigHighQ,3);
103Add2DigitsList(tDigChEvt,4);
104}
105
106//____________________________________________________________________________
107void AliHMPIDQADataMakerSim::InitSDigits()
108{
109 // create SDigits histograms in SDigits subdir
110 TH1F *hSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID", 500, 0., 5000.) ;
111
112Add2SDigitsList(hSDigits,0);
113}
114
115//____________________________________________________________________________
116
117void AliHMPIDQADataMakerSim::MakeHits(TClonesArray * data)
118{
119 //
120 //filling QA histos for Hits
121 //
122 TClonesArray * hits = dynamic_cast<TClonesArray *>(data) ;
123 if (!hits){
124 AliError("Wrong type of hits container") ;
125 } else {
126 TIter next(hits);
127 AliHMPIDHit * hit ;
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());
131 }
132 }
133
134}
135//___________________________________________________________________________
136void AliHMPIDQADataMakerSim::MakeHits(TTree * data)
137{
138//
139//Opening of the Hit TTree
140//
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);
144 MakeHits(pHits);
145 }//entries loop
146}
147//____________________________________________________________________________
148void AliHMPIDQADataMakerSim::MakeDigits(TClonesArray * data)
149{
150 //
151 //filling QA histos for Digits
152 //
153 TObjArray *chamber = dynamic_cast<TObjArray*>(data);
154 if ( !chamber) {
155 AliError("Wrong type of digits container") ;
156 } else {
157 for(Int_t i =0; i< chamber->GetEntries(); i++)
158 {
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.));
162 Double_t highQ=0;
163 TIter next(digits);
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();
169 }
170 GetDigitsData(3)->Fill(i,highQ);
171
172 }
173 }
174}
175//___________________________________________________________________________
176void AliHMPIDQADataMakerSim::MakeDigits(TTree * data)
177{
178//
179//Opening the Digit Tree
180//
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);
185 }
186
187 pObjDig->SetOwner(kTRUE);
188
189 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
190 data->SetBranchAddress(Form("HMPID%i",iCh),&(*pObjDig)[iCh]);
191 }
192 data->GetEntry(0);
193
194 MakeDigits((TClonesArray *)pObjDig);
195}
196//____________________________________________________________________________
197
198void AliHMPIDQADataMakerSim::MakeSDigits(TClonesArray * data)
199{
200 //
201 //filling QA histos for SDigits
202 //
203 TClonesArray * sdigits = dynamic_cast<TClonesArray *>(data) ;
204 if (!sdigits) {
205 AliError("Wrong type of sdigits container") ;
206 } else {
207 TIter next(sdigits) ;
208 AliHMPIDDigit * sdigit ;
209 while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
210 GetSDigitsData(0)->Fill(sdigit->Q());
211 }
212 }
213}
214//___________________________________________________________________________
215void AliHMPIDQADataMakerSim::MakeSDigits(TTree * data)
216{
217 //
218 // Opening the SDigit Tree
219 //
220 TClonesArray * sdigits = new TClonesArray("AliHMPIDDigit", 1000) ;
221
222 TBranch * branch = data->GetBranch("HMPID") ;
223 if ( ! branch ) {
224 AliError("HMPID SDigit Tree not found") ;
225 return;
226 }
227 branch->SetAddress(&sdigits) ;
228 branch->GetEntry(0) ;
229 MakeSDigits(sdigits) ;
230}
231//____________________________________________________________________________
232void AliHMPIDQADataMakerSim::StartOfDetectorCycle()
233{
234 //Detector specific actions at start of cycle
235
236}
237
238void AliHMPIDQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t, TObjArray *)
239{
240 //Detector specific actions at end of cycle
241 // do the QA checking
242// AliQAChecker::Instance()->Run(AliQA::kHMPID, task, obj) ;
243}
244