]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDQADataMakerSim.cxx
Bugs soved by Peter Hristov.
[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>
cc1abc7f 24#include <TProfile.h>
04236e67 25#include <Riostream.h>
26// --- Standard library ---
27
28// --- AliRoot header files ---
cc1abc7f 29#include "AliESDCaloCluster.h"
30#include "AliESDEvent.h"
31#include "AliQAChecker.h"
04236e67 32#include "AliLog.h"
33#include "AliHMPIDDigit.h"
34#include "AliHMPIDHit.h"
cc1abc7f 35#include "AliHMPIDCluster.h"
04236e67 36#include "AliHMPIDQADataMakerSim.h"
cc1abc7f 37#include "AliHMPIDParam.h"
38#include "AliHMPIDRawStream.h"
39#include "AliLog.h"
b38ac33a 40
41//
42// HMPID AliHMPIDQADataMakerSim base class
43// for QA of simulation
44// here also errors are calculated
45//.
46
04236e67 47ClassImp(AliHMPIDQADataMakerSim)
48
49//____________________________________________________________________________
50 AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim() :
cc1abc7f 51 AliQADataMakerSim(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker")
04236e67 52{
53 // ctor
04236e67 54}
55
56//____________________________________________________________________________
57AliHMPIDQADataMakerSim::AliHMPIDQADataMakerSim(const AliHMPIDQADataMakerSim& qadm) :
cc1abc7f 58 AliQADataMakerSim()
04236e67 59{
60 //copy ctor
04236e67 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
cc1abc7f 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
04236e67 86}
87
88//____________________________________________________________________________
89void AliHMPIDQADataMakerSim::InitDigits()
90{
91 // create Digits histograms in Digits subdir
cc1abc7f 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);
04236e67 104}
105
106//____________________________________________________________________________
107void AliHMPIDQADataMakerSim::InitSDigits()
108{
109 // create SDigits histograms in SDigits subdir
cc1abc7f 110 TH1F *hSDigits = new TH1F("hHmpidSDigits", "SDigits Q distribution in HMPID", 500, 0., 5000.) ;
111
112Add2SDigitsList(hSDigits,0);
04236e67 113}
114
cc1abc7f 115//____________________________________________________________________________
116
117void AliHMPIDQADataMakerSim::MakeHits(TClonesArray * data)
04236e67 118{
cc1abc7f 119 //
120 //filling QA histos for Hits
121 //
04236e67 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())) ) {
cc1abc7f 129 if(hit->Pid()<500000) GetHitsData(0)->Fill(hit->Q()) ;
130 if(hit->Pid()<500000) GetHitsData(hit->Ch()+1)->Fill(hit->LorsX(),hit->LorsY());
04236e67 131 }
132 }
04236e67 133
cc1abc7f 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}
04236e67 147//____________________________________________________________________________
cc1abc7f 148void AliHMPIDQADataMakerSim::MakeDigits(TClonesArray * data)
04236e67 149{
cc1abc7f 150 //
151 //filling QA histos for Digits
152 //
153 TObjArray *chamber = dynamic_cast<TObjArray*>(data);
154 if ( !chamber) {
04236e67 155 AliError("Wrong type of digits container") ;
156 } else {
cc1abc7f 157 for(Int_t i =0; i< chamber->GetEntries(); i++)
04236e67 158 {
cc1abc7f 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;
04236e67 163 TIter next(digits);
164 AliHMPIDDigit * digit;
165 while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
cc1abc7f 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();
04236e67 169 }
cc1abc7f 170 GetDigitsData(3)->Fill(i,highQ);
171
04236e67 172 }
173 }
174}
cc1abc7f 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);
04236e67 188
cc1abc7f 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}
04236e67 196//____________________________________________________________________________
cc1abc7f 197
198void AliHMPIDQADataMakerSim::MakeSDigits(TClonesArray * data)
04236e67 199{
cc1abc7f 200 //
201 //filling QA histos for SDigits
202 //
04236e67 203 TClonesArray * sdigits = dynamic_cast<TClonesArray *>(data) ;
204 if (!sdigits) {
205 AliError("Wrong type of sdigits container") ;
206 } else {
04236e67 207 TIter next(sdigits) ;
208 AliHMPIDDigit * sdigit ;
209 while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
cc1abc7f 210 GetSDigitsData(0)->Fill(sdigit->Q());
04236e67 211 }
212 }
213}
cc1abc7f 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, 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