]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSQADataMakerSim.cxx
Updates in GRP Preprocessor (Ernesto)
[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(AliQA::GetDetName(AliQA::kPHOS), "PHOS Quality Assurance Data Maker")
48 {
49   // ctor
50 }
51
52 //____________________________________________________________________________ 
53 AliPHOSQADataMakerSim::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 //__________________________________________________________________
62 AliPHOSQADataMakerSim& AliPHOSQADataMakerSim::operator = (const AliPHOSQADataMakerSim& qadm )
63 {
64   // Assign operator.
65   this->~AliPHOSQADataMakerSim();
66   new(this) AliPHOSQADataMakerSim(qadm);
67   return *this;
68 }
69  
70 //____________________________________________________________________________ 
71 void AliPHOSQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
72 {
73   //Detector specific actions at end of cycle
74   // do the QA checking
75   AliQAChecker::Instance()->Run(AliQA::kPHOS, task, list) ;  
76 }
77
78 //____________________________________________________________________________ 
79 void AliPHOSQADataMakerSim::InitHits()
80 {
81   // create Hits histograms in Hits subdir
82   TH1F * h0 = new TH1F("hPhosHits",    "Hits energy distribution in PHOS",       100, 0., 100.) ; 
83   h0->Sumw2() ;
84   Add2HitsList(h0, 0) ;
85   TH1I * h1  = new TH1I("hPhosHitsMul", "Hits multiplicity distribution in PHOS", 500, 0., 10000) ; 
86   h1->Sumw2() ;
87   Add2HitsList(h1, 1) ;
88 }
89
90 //____________________________________________________________________________ 
91 void AliPHOSQADataMakerSim::InitDigits()
92 {
93   // create Digits histograms in Digits subdir
94   TH1I * h0 = new TH1I("hPhosDigits",    "Digits amplitude distribution in PHOS",    500, 0, 5000) ; 
95   h0->Sumw2() ;
96   Add2DigitsList(h0, 0) ;
97   TH1I * h1 = new TH1I("hPhosDigitsMul", "Digits multiplicity distribution in PHOS", 500, 0, 1000) ; 
98   h1->Sumw2() ;
99   Add2DigitsList(h1, 1) ;
100 }
101
102 //____________________________________________________________________________ 
103 void AliPHOSQADataMakerSim::InitSDigits()
104 {
105   // create SDigits histograms in SDigits subdir
106   TH1F * h0 = new TH1F("hPhosSDigits",    "SDigits energy distribution in PHOS",       100, 0., 100.) ; 
107   h0->Sumw2() ;
108   Add2SDigitsList(h0, 0) ;
109   TH1I * h1 = new TH1I("hPhosSDigitsMul", "SDigits multiplicity distribution in PHOS", 500, 0,  10000) ; 
110   h1->Sumw2() ;
111   Add2SDigitsList(h1, 1) ;
112 }
113
114 //____________________________________________________________________________
115 void AliPHOSQADataMakerSim::MakeHits(TClonesArray * hits)
116 {
117         //make QA data from Hits
118
119     GetHitsData(1)->Fill(hits->GetEntriesFast()) ; 
120     TIter next(hits) ; 
121     AliPHOSHit * hit ; 
122     while ( (hit = dynamic_cast<AliPHOSHit *>(next())) ) {
123       GetHitsData(0)->Fill( hit->GetEnergy()) ;
124     }
125 }
126
127 //____________________________________________________________________________
128 void AliPHOSQADataMakerSim::MakeHits(TTree * hitTree)
129 {
130         // make QA data from Hit Tree
131         
132         TClonesArray * hits = new TClonesArray("AliPHOSHit", 1000);
133
134         TBranch * branch = hitTree->GetBranch("PHOS") ;
135         if ( ! branch ) {
136                 AliWarning("PHOS branch in Hit Tree not found") ; 
137         } else {
138                 TClonesArray * tmp =  new TClonesArray("AliPHOSHit", 1000) ;
139                 branch->SetAddress(&tmp) ;
140                 Int_t index = 0 ;  
141                 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
142                         branch->GetEntry(ientry) ; 
143                         for (Int_t ihit = 0 ; ihit < tmp->GetEntries() ; ihit++) {
144                                 AliPHOSHit * hit = dynamic_cast<AliPHOSHit *> (tmp->At(ihit)) ; 
145                                 new((*hits)[index]) AliPHOSHit(*hit) ; 
146                                 index++ ;
147                         } 
148                 }       
149                 tmp->Delete() ; 
150                 delete tmp ; 
151                 MakeHits(hits) ; 
152         }
153 }
154
155 //____________________________________________________________________________
156 void AliPHOSQADataMakerSim::MakeDigits(TClonesArray * digits)
157 {
158   // makes data from Digits
159
160     GetDigitsData(1)->Fill(digits->GetEntriesFast()) ; 
161     TIter next(digits) ; 
162     AliPHOSDigit * digit ; 
163     while ( (digit = dynamic_cast<AliPHOSDigit *>(next())) ) {
164       GetDigitsData(0)->Fill( digit->GetEnergy()) ;
165     }  
166 }
167
168 //____________________________________________________________________________
169 void AliPHOSQADataMakerSim::MakeDigits(TTree * digitTree)
170 {
171         // makes data from Digit Tree
172         TClonesArray * digits = new TClonesArray("AliPHOSDigit", 1000) ; 
173
174         TBranch * branch = digitTree->GetBranch("PHOS") ;
175         if ( ! branch ) {
176                 AliWarning("PHOS branch in Digit Tree not found") ; 
177         } else {
178                 branch->SetAddress(&digits) ;
179                 branch->GetEntry(0) ; 
180                 MakeDigits(digits) ; 
181         }
182 }
183
184 //____________________________________________________________________________
185 void AliPHOSQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
186 {
187   // makes data from SDigits
188   
189         GetSDigitsData(1)->Fill(sdigits->GetEntriesFast()) ; 
190     TIter next(sdigits) ; 
191     AliPHOSDigit * sdigit ; 
192     while ( (sdigit = dynamic_cast<AliPHOSDigit *>(next())) ) {
193       GetSDigitsData(0)->Fill( sdigit->GetEnergy()) ;
194     } 
195 }
196
197 //____________________________________________________________________________
198 void AliPHOSQADataMakerSim::MakeSDigits(TTree * sdigitTree)
199 {
200         // makes data from SDigit Tree
201         TClonesArray * sdigits = new TClonesArray("AliPHOSDigit", 1000) ; 
202
203         TBranch * branch = sdigitTree->GetBranch("PHOS") ;
204         if ( ! branch ) {
205                 AliWarning("PHOS branch in SDigit Tree not found") ; 
206         } else {
207                 branch->SetAddress(&sdigits) ;
208                 branch->GetEntry(0) ;
209                 MakeSDigits(sdigits) ; 
210         }
211 }
212
213 //____________________________________________________________________________ 
214 void AliPHOSQADataMakerSim::StartOfDetectorCycle()
215 {
216   //Detector specific actions at start of cycle
217   
218 }