Warning fixed
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDQADataMakerSim.cxx
CommitLineData
04236e67 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
04236e67 19// --- ROOT system ---
20#include <TClonesArray.h>
21#include <TFile.h>
22#include <TH1F.h>
23#include <TH2F.h>
04236e67 24#include <Riostream.h>
25// --- Standard library ---
26
27// --- AliRoot header files ---
cc1abc7f 28#include "AliESDCaloCluster.h"
29#include "AliESDEvent.h"
30#include "AliQAChecker.h"
04236e67 31#include "AliLog.h"
32#include "AliHMPIDDigit.h"
33#include "AliHMPIDHit.h"
cc1abc7f 34#include "AliHMPIDCluster.h"
04236e67 35#include "AliHMPIDQADataMakerSim.h"
cc1abc7f 36#include "AliHMPIDParam.h"
37#include "AliHMPIDRawStream.h"
38#include "AliLog.h"
b38ac33a 39
606697a8 40//.
b38ac33a 41// HMPID AliHMPIDQADataMakerSim base class
42// for QA of simulation
43// here also errors are calculated
44//.
45
04236e67 46ClassImp(AliHMPIDQADataMakerSim)
47
48//____________________________________________________________________________
49 AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim() :
6252ceeb 50 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kHMPID), "HMPID Quality Assurance Data Maker"), fChannel(0)
04236e67 51{
52 // ctor
04236e67 53}
54
55//____________________________________________________________________________
56AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
6252ceeb 57 AliQADataMakerSim(),fChannel(0)
04236e67 58{
59 //copy ctor
04236e67 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
7d297381 77 const Bool_t expert = kTRUE ;
78 const Bool_t image = kTRUE ;
79
db72ff3b 80 TH1F *hHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC;Entries",500,0,4000);
7d297381 81 Add2HitsList(hHitQdc,0, !expert, image);
82 TH2F *hHitMap[7];
83 for(Int_t iCh=0;iCh<7;iCh++) {
db72ff3b 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);
7d297381 85 Add2HitsList(hHitMap[iCh],iCh+1,expert,!image);
86 }
92664bc8 87 //
88 ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
04236e67 89}
90
91//____________________________________________________________________________
92void AliHMPIDQADataMakerSim::InitDigits()
93{
94 // create Digits histograms in Digits subdir
7d297381 95 const Bool_t expert = kTRUE ;
96 const Bool_t image = kTRUE ;
97
db72ff3b 98 TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event;Occupanc [%];Entries",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
7d297381 99 TH1F *hDigPcEvt = new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
100 TH2F *hDigMap[7];
101 TH1F *hDigQ[42];
102 for(Int_t iCh =0; iCh < 7; iCh++){
db72ff3b 103 hDigMap[iCh] = new TH2F(Form("MapCh%i",iCh),Form("Digit Map in Chamber %i;Digit #;Entries",iCh),159,0,159,143,0,143);
7d297381 104 for(Int_t iPc =0; iPc < 6; iPc++ ){
db72ff3b 105 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);
7d297381 106 }
107 }
108
109 Add2DigitsList(hDigChEvt,0, !expert, image);
110 Add2DigitsList(hDigPcEvt,1,expert, !image);
111 for(Int_t iMap=0; iMap < 7; iMap++) Add2DigitsList(hDigMap[iMap],2+iMap,expert, !image);
112 for(Int_t iH =0; iH < 42 ; iH++) Add2DigitsList(hDigQ[iH] ,9+iH,expert,!image);
92664bc8 113 //
114 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
04236e67 115}
116
117//____________________________________________________________________________
118void AliHMPIDQADataMakerSim::InitSDigits()
119{
120 // create SDigits histograms in SDigits subdir
7d297381 121 const Bool_t expert = kTRUE ;
122 const Bool_t image = kTRUE ;
cc1abc7f 123
db72ff3b 124 TH1F *hSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID;QDC;Entries", 500, 0., 5000.) ;
7d297381 125 Add2SDigitsList(hSDigits,0, !expert, image);
92664bc8 126 //
127 ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line}
04236e67 128}
129
cc1abc7f 130//____________________________________________________________________________
131
6252ceeb 132void AliHMPIDQADataMakerSim::MakeHits()
04236e67 133{
cc1abc7f 134 //
135 //filling QA histos for Hits
136 //
6252ceeb 137
138 TIter next(fHitsArray);
139 AliHMPIDHit * hit ;
140 while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
92664bc8 141 if(hit->Pid()<500000) FillHitsData(0,hit->Q()) ;
142 if(hit->Pid()<500000) FillHitsData(hit->Ch()+1,hit->LorsX(),hit->LorsY());
6252ceeb 143 }
144}
04236e67 145
cc1abc7f 146//___________________________________________________________________________
147void AliHMPIDQADataMakerSim::MakeHits(TTree * data)
148{
149//
150//Opening of the Hit TTree
151//
6252ceeb 152 if (fHitsArray)
153 fHitsArray->Clear() ;
154 else
155 fHitsArray=new TClonesArray("AliHMPIDHit");
156 data->SetBranchAddress("HMPID",&fHitsArray);
cc1abc7f 157 for(Int_t iEnt=0;iEnt<data->GetEntriesFast();iEnt++){//entries loop
158 data->GetEntry(iEnt);
6252ceeb 159 MakeHits();
cc1abc7f 160 }//entries loop
161}
6252ceeb 162//___________________________________________________________________________
163void AliHMPIDQADataMakerSim::MakeDigits()
04236e67 164{
6252ceeb 165 //
166 //filling QA histos for Digits
167 //
168
169 Int_t i = fChannel ;
92664bc8 170 FillDigitsData(0,i,fDigitsArray->GetEntriesFast()/(48.*80.*6.));
6252ceeb 171 TIter next(fDigitsArray);
172 AliHMPIDDigit * digit;
173 while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
92664bc8 174 FillDigitsData(1,10.*i+digit->Pc(),1./(48.*80.));
175 FillDigitsData(2+i,digit->PadChX(),digit->PadChY());
176 FillDigitsData(9+i*6+digit->Pc(),digit->Q());
6252ceeb 177 }
178}
cc1abc7f 179//___________________________________________________________________________
180void AliHMPIDQADataMakerSim::MakeDigits(TTree * data)
181{
6252ceeb 182 //
183 //Opening the Digit Tree
184 //
185
186 if(fDigitsArray)
187 fDigitsArray->Clear() ;
188 else
189 fDigitsArray=new TClonesArray("AliHMPIDDigit");
190
cc1abc7f 191 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
6252ceeb 192 fChannel = iCh ;
193 data->SetBranchAddress(Form("HMPID%i",iCh),&fDigitsArray);
194 data->GetEntry(0);
195 MakeDigits();
196 fDigitsArray->Clear() ;
cc1abc7f 197 }
cc1abc7f 198}
6252ceeb 199
04236e67 200//____________________________________________________________________________
cc1abc7f 201
6252ceeb 202void AliHMPIDQADataMakerSim::MakeSDigits()
04236e67 203{
cc1abc7f 204 //
205 //filling QA histos for SDigits
206 //
6252ceeb 207
208 TIter next(fSDigitsArray) ;
209 AliHMPIDDigit * sdigit ;
210 while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
92664bc8 211 FillSDigitsData(0,sdigit->Q());
6252ceeb 212 }
04236e67 213}
cc1abc7f 214//___________________________________________________________________________
215void AliHMPIDQADataMakerSim::MakeSDigits(TTree * data)
216{
217 //
218 // Opening the SDigit Tree
219 //
6252ceeb 220 if (fSDigitsArray)
221 fSDigitsArray->Clear() ;
222 else
223 fSDigitsArray = new TClonesArray("AliHMPIDDigit", 1000) ;
cc1abc7f 224
225 TBranch * branch = data->GetBranch("HMPID") ;
226 if ( ! branch ) {
227 AliError("HMPID SDigit Tree not found") ;
228 return;
229 }
6252ceeb 230 branch->SetAddress(&fSDigitsArray) ;
cc1abc7f 231 branch->GetEntry(0) ;
6252ceeb 232 MakeSDigits() ;
cc1abc7f 233}
234//____________________________________________________________________________
235void AliHMPIDQADataMakerSim::StartOfDetectorCycle()
236{
237 //Detector specific actions at start of cycle
238
239}
240
4e25ac79 241void AliHMPIDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray **obj)
cc1abc7f 242{
243 //Detector specific actions at end of cycle
244 // do the QA checking
92664bc8 245 ResetEventTrigClasses(); // reset triggers list to select all histos
4e25ac79 246 AliQAChecker::Instance()->Run(AliQAv1::kHMPID, task, obj) ;
cc1abc7f 247}
248