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