]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDQADataMakerSim.cxx
New mapping
[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() :
cc1abc7f 50 AliQADataMakerSim(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker")
04236e67 51{
52 // ctor
04236e67 53}
54
55//____________________________________________________________________________
56AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
cc1abc7f 57 AliQADataMakerSim()
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
cc1abc7f 77 TH1F *hHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC",500,0,4000);
78 Add2HitsList(hHitQdc,0);
79 TH2F *hHitMap[7];
80 for(Int_t iCh=0;iCh<7;iCh++) {
81 hHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit}",iCh),162,-1,161,146,-1,145);
82 Add2HitsList(hHitMap[iCh],iCh+1);
83 }
84
04236e67 85}
86
87//____________________________________________________________________________
88void AliHMPIDQADataMakerSim::InitDigits()
89{
90 // create Digits histograms in Digits subdir
cc1abc7f 91 TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
7656d8ac 92 TH1F *hDigPcEvt = new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
93 TH2F *hDigMap[7];
94 TH1F *hDigQ[42];
95 for(Int_t iCh =0; iCh < 7; iCh++){
96 hDigMap[iCh] = new TH2F(Form("MapCh%i",iCh),Form("Digit Map in Chamber %i",iCh),159,0,159,143,0,143);
97 for(Int_t iPc =0; iPc < 6; iPc++ ){
98 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);
99 }
100 }
cc1abc7f 101
7656d8ac 102 Add2DigitsList(hDigChEvt,0);
103 Add2DigitsList(hDigPcEvt,1);
104 for(Int_t iMap=0; iMap < 7; iMap++) Add2DigitsList(hDigMap[iMap],2+iMap);
105 for(Int_t iH =0; iH < 42 ; iH++) Add2DigitsList(hDigQ[iH] ,9+iH);
04236e67 106}
107
108//____________________________________________________________________________
109void AliHMPIDQADataMakerSim::InitSDigits()
110{
111 // create SDigits histograms in SDigits subdir
cc1abc7f 112 TH1F *hSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID", 500, 0., 5000.) ;
113
114Add2SDigitsList(hSDigits,0);
04236e67 115}
116
cc1abc7f 117//____________________________________________________________________________
118
119void AliHMPIDQADataMakerSim::MakeHits(TClonesArray * data)
04236e67 120{
cc1abc7f 121 //
122 //filling QA histos for Hits
123 //
04236e67 124 TClonesArray * hits = dynamic_cast<TClonesArray *>(data) ;
125 if (!hits){
126 AliError("Wrong type of hits container") ;
127 } else {
128 TIter next(hits);
129 AliHMPIDHit * hit ;
130 while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
cc1abc7f 131 if(hit->Pid()<500000) GetHitsData(0)->Fill(hit->Q()) ;
132 if(hit->Pid()<500000) GetHitsData(hit->Ch()+1)->Fill(hit->LorsX(),hit->LorsY());
04236e67 133 }
134 }
04236e67 135
cc1abc7f 136}
137//___________________________________________________________________________
138void AliHMPIDQADataMakerSim::MakeHits(TTree * data)
139{
140//
141//Opening of the Hit TTree
142//
143 TClonesArray *pHits=new TClonesArray("AliHMPIDHit"); data->SetBranchAddress("HMPID",&pHits);
144 for(Int_t iEnt=0;iEnt<data->GetEntriesFast();iEnt++){//entries loop
145 data->GetEntry(iEnt);
146 MakeHits(pHits);
147 }//entries loop
148}
04236e67 149//____________________________________________________________________________
cc1abc7f 150void AliHMPIDQADataMakerSim::MakeDigits(TClonesArray * data)
04236e67 151{
cc1abc7f 152 //
153 //filling QA histos for Digits
154 //
7656d8ac 155
cc1abc7f 156 TObjArray *chamber = dynamic_cast<TObjArray*>(data);
157 if ( !chamber) {
04236e67 158 AliError("Wrong type of digits container") ;
159 } else {
cc1abc7f 160 for(Int_t i =0; i< chamber->GetEntries(); i++)
04236e67 161 {
cc1abc7f 162 TClonesArray * digits = dynamic_cast<TClonesArray*>(chamber->At(i));
7656d8ac 163 GetDigitsData(0)->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
04236e67 164 TIter next(digits);
165 AliHMPIDDigit * digit;
166 while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
7656d8ac 167 GetDigitsData(1)->Fill(10.*i+digit->Pc(),1./(48.*80.));
168 GetDigitsData(2+i)->Fill(digit->PadChX(),digit->PadChY());
169 GetDigitsData(9+i*6+digit->Pc())->Fill(digit->Q());
04236e67 170 }
171 }
172 }
173}
cc1abc7f 174//___________________________________________________________________________
175void AliHMPIDQADataMakerSim::MakeDigits(TTree * data)
176{
177//
178//Opening the Digit Tree
179//
180 TObjArray *pObjDig=new TObjArray(AliHMPIDParam::kMaxCh+1);
181 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
182 TClonesArray *pCA=new TClonesArray("AliHMPIDDigit");
183 pObjDig->AddAt(pCA,iCh);
184 }
185
186 pObjDig->SetOwner(kTRUE);
04236e67 187
cc1abc7f 188 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
189 data->SetBranchAddress(Form("HMPID%i",iCh),&(*pObjDig)[iCh]);
190 }
191 data->GetEntry(0);
192
193 MakeDigits((TClonesArray *)pObjDig);
194}
04236e67 195//____________________________________________________________________________
cc1abc7f 196
197void AliHMPIDQADataMakerSim::MakeSDigits(TClonesArray * data)
04236e67 198{
cc1abc7f 199 //
200 //filling QA histos for SDigits
201 //
04236e67 202 TClonesArray * sdigits = dynamic_cast<TClonesArray *>(data) ;
203 if (!sdigits) {
204 AliError("Wrong type of sdigits container") ;
205 } else {
04236e67 206 TIter next(sdigits) ;
207 AliHMPIDDigit * sdigit ;
208 while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
cc1abc7f 209 GetSDigitsData(0)->Fill(sdigit->Q());
04236e67 210 }
211 }
212}
cc1abc7f 213//___________________________________________________________________________
214void AliHMPIDQADataMakerSim::MakeSDigits(TTree * data)
215{
216 //
217 // Opening the SDigit Tree
218 //
219 TClonesArray * sdigits = new TClonesArray("AliHMPIDDigit", 1000) ;
220
221 TBranch * branch = data->GetBranch("HMPID") ;
222 if ( ! branch ) {
223 AliError("HMPID SDigit Tree not found") ;
224 return;
225 }
226 branch->SetAddress(&sdigits) ;
227 branch->GetEntry(0) ;
228 MakeSDigits(sdigits) ;
229}
230//____________________________________________________________________________
231void AliHMPIDQADataMakerSim::StartOfDetectorCycle()
232{
233 //Detector specific actions at start of cycle
234
235}
236
7656d8ac 237void AliHMPIDQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray *obj)
cc1abc7f 238{
239 //Detector specific actions at end of cycle
240 // do the QA checking
7656d8ac 241 AliQAChecker::Instance()->Run(AliQA::kHMPID, task, obj) ;
cc1abc7f 242}
243