]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PHOS/AliPHOSQADataMakerSim.cxx
Possibility to store CAF output files on alien (Renu)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSQADataMakerSim.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/*
20 Produces the data needed to calculate the quality assurance.
21 All data must be mergeable objects.
22 Y. Schutz CERN July 2007
23*/
24
25// --- ROOT system ---
26#include <TClonesArray.h>
27#include <TFile.h>
28#include <TH1F.h>
29#include <TH1I.h>
30#include <TH2F.h>
31#include <TTree.h>
32
33// --- Standard library ---
34
35// --- AliRoot header files ---
36#include "AliESDCaloCluster.h"
37#include "AliLog.h"
38#include "AliPHOSDigit.h"
39#include "AliPHOSHit.h"
40#include "AliPHOSQADataMakerSim.h"
41#include "AliQAChecker.h"
42
43ClassImp(AliPHOSQADataMakerSim)
44
45//____________________________________________________________________________
46AliPHOSQADataMakerSim::AliPHOSQADataMakerSim() :
47 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kPHOS), "PHOS Quality Assurance Data Maker")
48{
49 // ctor
50}
51
52//____________________________________________________________________________
53AliPHOSQADataMakerSim::AliPHOSQADataMakerSim(const AliPHOSQADataMakerSim& qadm) :
54 AliQADataMakerSim()
55{
56 //copy ctor
57 SetName((const char*)qadm.GetName()) ;
58 SetTitle((const char*)qadm.GetTitle());
59}
60
61//__________________________________________________________________
62AliPHOSQADataMakerSim& AliPHOSQADataMakerSim::operator = (const AliPHOSQADataMakerSim& qadm )
63{
64 // Assign operator.
65 this->~AliPHOSQADataMakerSim();
66 new(this) AliPHOSQADataMakerSim(qadm);
67 return *this;
68}
69
70//____________________________________________________________________________
71void AliPHOSQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
72{
73 //Detector specific actions at end of cycle
74 // do the QA checking
75 AliQAChecker::Instance()->Run(AliQAv1::kPHOS, task, list) ;
76}
77
78//____________________________________________________________________________
79void AliPHOSQADataMakerSim::InitHits()
80{
81 // create Hits histograms in Hits subdir
82 const Bool_t expert = kTRUE ;
83 const Bool_t image = kTRUE ;
84 TH1F * h0 = new TH1F("hPhosHits", "Hits energy distribution in PHOS;Energy [MeV];Counts", 100, 0., 100.) ;
85 h0->Sumw2() ;
86 Add2HitsList(h0, kHits, !expert, image) ;
87 TH1I * h1 = new TH1I("hPhosHitsMul", "Hits multiplicity distribution in PHOS;# of Hits;Entries", 500, 0., 10000) ;
88 h1->Sumw2() ;
89 Add2HitsList(h1, kHitsMul, !expert, image) ;
90
91}
92
93//____________________________________________________________________________
94void AliPHOSQADataMakerSim::InitDigits()
95{
96 // create Digits histograms in Digits subdir
97 const Bool_t expert = kTRUE ;
98 const Bool_t image = kTRUE ;
99 TH1I * h0 = new TH1I("hPhosDigits", "Digits amplitude distribution in PHOS;Amplitude [ADC counts];Counts", 500, 0, 1000) ;
100 h0->Sumw2() ;
101 Add2DigitsList(h0, kDigits, !expert, image) ;
102 TH1I * h1 = new TH1I("hPhosDigitsMul", "Digits multiplicity distribution in PHOS;# of Digits;Entries", 2000, 0, 10000) ;
103 h1->Sumw2() ;
104 Add2DigitsList(h1, kDigitsMul, !expert, image) ;
105}
106
107//____________________________________________________________________________
108void AliPHOSQADataMakerSim::InitSDigits()
109{
110 // create SDigits histograms in SDigits subdir
111 const Bool_t expert = kTRUE ;
112 const Bool_t image = kTRUE ;
113 TH1F * h0 = new TH1F("hPhosSDigits", "SDigits energy distribution in PHOS; Energy [MeV];Counts", 500, 0., 1000.) ;
114 h0->Sumw2() ;
115 Add2SDigitsList(h0, kSDigits, !expert, image) ;
116 TH1I * h1 = new TH1I("hPhosSDigitsMul", "SDigits multiplicity distribution in PHOS;# of SDigits;Entries", 500, 0, 1000) ;
117 h1->Sumw2() ;
118 Add2SDigitsList(h1, kSDigitsMul, !expert, image) ;
119}
120
121//____________________________________________________________________________
122void AliPHOSQADataMakerSim::MakeHits()
123{
124 //make QA data from Hits
125
126 TIter next(fHitsArray) ;
127 AliPHOSHit * hit ;
128 while ( (hit = dynamic_cast<AliPHOSHit *>(next())) ) {
129 GetHitsData(kHits)->Fill( hit->GetEnergy()) ;
130 }
131}
132
133//____________________________________________________________________________
134void AliPHOSQADataMakerSim::MakeHits(TTree * hitTree)
135{
136 // make QA data from Hit Tree
137
138 if (fHitsArray)
139 fHitsArray->Clear() ;
140 else
141 fHitsArray = new TClonesArray("AliPHOSHit", 1000);
142
143 TBranch * branch = hitTree->GetBranch("PHOS") ;
144 if ( ! branch ) {
145 AliWarning("PHOS branch in Hit Tree not found") ;
146 } else {
147 Int_t nHits = 0;
148 branch->SetAddress(&fHitsArray) ;
149 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
150 branch->GetEntry(ientry) ;
151 nHits += fHitsArray->GetEntriesFast();
152 MakeHits() ;
153 fHitsArray->Clear();
154 }
155 GetHitsData(1)->Fill(nHits) ;
156 }
157}
158
159//____________________________________________________________________________
160void AliPHOSQADataMakerSim::MakeDigits()
161{
162 // makes data from Digits
163
164 GetDigitsData(1)->Fill(fDigitsArray->GetEntriesFast()) ;
165 TIter next(fDigitsArray) ;
166 AliPHOSDigit * digit ;
167 while ( (digit = dynamic_cast<AliPHOSDigit *>(next())) ) {
168 GetDigitsData(kDigits)->Fill( digit->GetEnergy()) ;
169 }
170}
171
172//____________________________________________________________________________
173void AliPHOSQADataMakerSim::MakeDigits(TTree * digitTree)
174{
175 // makes data from Digit Tree
176 if (fDigitsArray)
177 fDigitsArray->Clear() ;
178 else
179 fDigitsArray = new TClonesArray("AliPHOSDigit", 1000) ;
180
181 TBranch * branch = digitTree->GetBranch("PHOS") ;
182 if ( ! branch ) {
183 AliWarning("PHOS branch in Digit Tree not found") ;
184 } else {
185 branch->SetAddress(&fDigitsArray) ;
186 branch->GetEntry(0) ;
187 MakeDigits() ;
188 }
189}
190
191//____________________________________________________________________________
192void AliPHOSQADataMakerSim::MakeSDigits()
193{
194 // makes data from SDigits
195
196 GetSDigitsData(1)->Fill(fSDigitsArray->GetEntriesFast()) ;
197 TIter next(fSDigitsArray) ;
198 AliPHOSDigit * sdigit ;
199 while ( (sdigit = dynamic_cast<AliPHOSDigit *>(next())) ) {
200 GetSDigitsData(kSDigits)->Fill( sdigit->GetEnergy()) ;
201 }
202}
203
204//____________________________________________________________________________
205void AliPHOSQADataMakerSim::MakeSDigits(TTree * sdigitTree)
206{
207 // makes data from SDigit Tree
208 if (fSDigitsArray)
209 fSDigitsArray->Clear() ;
210 else
211 fSDigitsArray = new TClonesArray("AliPHOSDigit", 1000) ;
212
213 TBranch * branch = sdigitTree->GetBranch("PHOS") ;
214 if ( ! branch ) {
215 AliWarning("PHOS branch in SDigit Tree not found") ;
216 } else {
217 branch->SetAddress(&fSDigitsArray) ;
218 branch->GetEntry(0) ;
219 MakeSDigits() ;
220 }
221}
222
223//____________________________________________________________________________
224void AliPHOSQADataMakerSim::StartOfDetectorCycle()
225{
226 //Detector specific actions at start of cycle
227
228}