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