Transfer of the initialisation of the QA Data objects in the framework; clean the...
[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 }
04236e67 87}
88
89//____________________________________________________________________________
90void AliHMPIDQADataMakerSim::InitDigits()
91{
92 // create Digits histograms in Digits subdir
7d297381 93 const Bool_t expert = kTRUE ;
94 const Bool_t image = kTRUE ;
95
db72ff3b 96 TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event;Occupanc [%];Entries",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
7d297381 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++){
db72ff3b 101 hDigMap[iCh] = new TH2F(Form("MapCh%i",iCh),Form("Digit Map in Chamber %i;Digit #;Entries",iCh),159,0,159,143,0,143);
7d297381 102 for(Int_t iPc =0; iPc < 6; iPc++ ){
db72ff3b 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);
7d297381 104 }
105 }
106
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);
04236e67 111}
112
113//____________________________________________________________________________
114void AliHMPIDQADataMakerSim::InitSDigits()
115{
116 // create SDigits histograms in SDigits subdir
7d297381 117 const Bool_t expert = kTRUE ;
118 const Bool_t image = kTRUE ;
cc1abc7f 119
db72ff3b 120 TH1F *hSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID;QDC;Entries", 500, 0., 5000.) ;
7d297381 121 Add2SDigitsList(hSDigits,0, !expert, image);
04236e67 122}
123
cc1abc7f 124//____________________________________________________________________________
125
6252ceeb 126void AliHMPIDQADataMakerSim::MakeHits()
04236e67 127{
cc1abc7f 128 //
129 //filling QA histos for Hits
130 //
6252ceeb 131
132 TIter next(fHitsArray);
133 AliHMPIDHit * hit ;
134 while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
135 if(hit->Pid()<500000) GetHitsData(0)->Fill(hit->Q()) ;
136 if(hit->Pid()<500000) GetHitsData(hit->Ch()+1)->Fill(hit->LorsX(),hit->LorsY());
137 }
138}
04236e67 139
cc1abc7f 140//___________________________________________________________________________
141void AliHMPIDQADataMakerSim::MakeHits(TTree * data)
142{
143//
144//Opening of the Hit TTree
145//
6252ceeb 146 if (fHitsArray)
147 fHitsArray->Clear() ;
148 else
149 fHitsArray=new TClonesArray("AliHMPIDHit");
150 data->SetBranchAddress("HMPID",&fHitsArray);
cc1abc7f 151 for(Int_t iEnt=0;iEnt<data->GetEntriesFast();iEnt++){//entries loop
152 data->GetEntry(iEnt);
6252ceeb 153 MakeHits();
cc1abc7f 154 }//entries loop
155}
6252ceeb 156//___________________________________________________________________________
157void AliHMPIDQADataMakerSim::MakeDigits()
04236e67 158{
6252ceeb 159 //
160 //filling QA histos for Digits
161 //
162
163 Int_t i = fChannel ;
164 GetDigitsData(0)->Fill(i,fDigitsArray->GetEntriesFast()/(48.*80.*6.));
165 TIter next(fDigitsArray);
166 AliHMPIDDigit * digit;
167 while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
168 GetDigitsData(1)->Fill(10.*i+digit->Pc(),1./(48.*80.));
169 GetDigitsData(2+i)->Fill(digit->PadChX(),digit->PadChY());
170 GetDigitsData(9+i*6+digit->Pc())->Fill(digit->Q());
171 }
172}
cc1abc7f 173//___________________________________________________________________________
174void AliHMPIDQADataMakerSim::MakeDigits(TTree * data)
175{
6252ceeb 176 //
177 //Opening the Digit Tree
178 //
179
180 if(fDigitsArray)
181 fDigitsArray->Clear() ;
182 else
183 fDigitsArray=new TClonesArray("AliHMPIDDigit");
184
cc1abc7f 185 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
6252ceeb 186 fChannel = iCh ;
187 data->SetBranchAddress(Form("HMPID%i",iCh),&fDigitsArray);
188 data->GetEntry(0);
189 MakeDigits();
190 fDigitsArray->Clear() ;
cc1abc7f 191 }
cc1abc7f 192}
6252ceeb 193
04236e67 194//____________________________________________________________________________
cc1abc7f 195
6252ceeb 196void AliHMPIDQADataMakerSim::MakeSDigits()
04236e67 197{
cc1abc7f 198 //
199 //filling QA histos for SDigits
200 //
6252ceeb 201
202 TIter next(fSDigitsArray) ;
203 AliHMPIDDigit * sdigit ;
204 while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
205 GetSDigitsData(0)->Fill(sdigit->Q());
206 }
04236e67 207}
cc1abc7f 208//___________________________________________________________________________
209void AliHMPIDQADataMakerSim::MakeSDigits(TTree * data)
210{
211 //
212 // Opening the SDigit Tree
213 //
6252ceeb 214 if (fSDigitsArray)
215 fSDigitsArray->Clear() ;
216 else
217 fSDigitsArray = new TClonesArray("AliHMPIDDigit", 1000) ;
cc1abc7f 218
219 TBranch * branch = data->GetBranch("HMPID") ;
220 if ( ! branch ) {
221 AliError("HMPID SDigit Tree not found") ;
222 return;
223 }
6252ceeb 224 branch->SetAddress(&fSDigitsArray) ;
cc1abc7f 225 branch->GetEntry(0) ;
6252ceeb 226 MakeSDigits() ;
cc1abc7f 227}
228//____________________________________________________________________________
229void AliHMPIDQADataMakerSim::StartOfDetectorCycle()
230{
231 //Detector specific actions at start of cycle
232
233}
234
4e25ac79 235void AliHMPIDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray **obj)
cc1abc7f 236{
237 //Detector specific actions at end of cycle
238 // do the QA checking
4e25ac79 239 AliQAChecker::Instance()->Run(AliQAv1::kHMPID, task, obj) ;
cc1abc7f 240}
241