]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZEROQADataMakerSim.cxx
- fixing use of centrality class
[u/mrichter/AliRoot.git] / VZERO / AliVZEROQADataMakerSim.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: AliVZEROQADataMakerSim.cxx 23123 2007-12-18 09:08:18Z hristov $ */
18
19 //---
20 //  Produces the data needed to calculate the quality assurance. 
21 //  All data must be mergeable objects.
22 //  Author : BC
23 //---
24
25 // --- ROOT system ---
26 #include <TClonesArray.h>
27 #include <TFile.h> 
28 #include <TH1F.h> 
29 #include <TDirectory.h>
30 // --- Standard library ---
31
32 // --- AliRoot header files ---
33 #include "AliESDEvent.h"
34 #include "AliLog.h"
35 #include "AliVZEROdigit.h" 
36 #include "AliVZEROhit.h"
37 #include "AliVZEROQADataMakerSim.h"
38 #include "AliQAChecker.h"
39
40 ClassImp(AliVZEROQADataMakerSim)
41            
42 //____________________________________________________________________________ 
43   AliVZEROQADataMakerSim::AliVZEROQADataMakerSim() : 
44   AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kVZERO), "VZERO Quality Assurance Data Maker")
45
46 {
47   // constructor
48
49   
50 }
51
52 //____________________________________________________________________________ 
53 AliVZEROQADataMakerSim::AliVZEROQADataMakerSim(const AliVZEROQADataMakerSim& qadm) :
54   AliQADataMakerSim() 
55 {
56   //copy constructor 
57
58   SetName((const char*)qadm.GetName()) ; 
59   SetTitle((const char*)qadm.GetTitle()); 
60 }
61
62 //__________________________________________________________________
63 AliVZEROQADataMakerSim& AliVZEROQADataMakerSim::operator = (const AliVZEROQADataMakerSim& qadm )
64 {
65   // Assign operator.
66   this->~AliVZEROQADataMakerSim();
67   new(this) AliVZEROQADataMakerSim(qadm);
68   return *this;
69 }
70 //____________________________________________________________________________
71 void AliVZEROQADataMakerSim::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::kVZERO, task, list) ;
76 }
77
78  
79 //____________________________________________________________________________ 
80 void AliVZEROQADataMakerSim::InitHits()
81 {
82  
83   // create Hits histograms in Hits subdir
84   const Bool_t expert   = kTRUE ; 
85   const Bool_t image    = kTRUE ; 
86   
87   TH1I * h0 = new TH1I("hHitMultiplicity", "Hit multiplicity distribution in VZERO;# of Hits;Entries", 300, 0, 299) ; 
88   h0->Sumw2() ;
89   Add2HitsList(h0, 0, !expert, image) ;  
90   
91   TH1I * h1 = new TH1I("hHitCellNumber", "Hit cell distribution in VZERO;# of Hits;Entries", 80, 0, 79) ; 
92   h1->Sumw2() ;
93   Add2HitsList(h1, 1, !expert, image) ;  
94     
95 }
96
97 //____________________________________________________________________________ 
98 void AliVZEROQADataMakerSim::InitDigits()
99 {
100   // create Digits histograms in Digits subdir
101   const Bool_t expert   = kTRUE ; 
102   const Bool_t image    = kTRUE ; 
103   
104   TH1I *fhDigTDC[64]; 
105   TH1I *fhDigADC[64]; 
106
107   // create Digits histograms in Digits subdir
108   TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in VZERO;# of Digits;Entries", 100, 0, 99) ; 
109   h0->Sumw2() ;
110   Add2DigitsList(h0, 0, !expert, image) ;
111   
112   for (Int_t i=0; i<64; i++)
113     {
114        fhDigTDC[i] = new TH1I(Form("hDigitTDC%d", i),Form("Digit TDC in cell %d; TDC value;Entries",i),300,0.,149.);
115        fhDigADC[i]= new TH1I(Form("hDigitADC%d", i),Form("Digit ADC in cell %d;ADC value;Entries",i),1024,0.,1023.);
116        
117        Add2DigitsList(fhDigTDC[i],i+1, !expert, image);
118        Add2DigitsList(fhDigADC[i],i+1+64, !expert, image);  
119      }  
120 }
121
122
123 //____________________________________________________________________________
124 void AliVZEROQADataMakerSim::MakeHits()
125 {
126         //make QA data from Hits
127
128   Int_t nhits = fHitsArray->GetEntriesFast();
129   GetHitsData(0)->Fill(nhits) ;    // fills Hit multiplicity
130     for (Int_t ihit=0;ihit<nhits;ihit++) 
131         {
132            AliVZEROhit  * VZEROHit   = (AliVZEROhit*) fHitsArray->UncheckedAt(ihit);
133            if (!VZEROHit) {
134               AliError("The unchecked hit doesn't exist");
135               break;
136            }
137            GetHitsData(1)->Fill(VZEROHit->Cell());
138         }
139 }
140
141
142 //____________________________________________________________________________
143
144 void AliVZEROQADataMakerSim::MakeHits(TTree *hitTree)
145 {
146   //fills QA histos for Hits
147  if (fHitsArray)
148    fHitsArray->Clear() ; 
149   else 
150     fHitsArray = new TClonesArray("AliVZEROhit", 1000);
151   
152   TBranch * branch = hitTree->GetBranch("VZERO") ;
153   if ( ! branch ) {
154     AliWarning("VZERO branch in Hit Tree not found") ;
155   } else {
156
157    if (branch) {
158       branch->SetAddress(&fHitsArray);
159     }else{
160       AliError("Branch VZERO hit not found");
161       exit(111);
162     } 
163     // Check id histograms already created for this Event Specie
164     if ( ! GetHitsData(0) )
165       InitHits() ;
166     
167     Int_t ntracks    = (Int_t) hitTree->GetEntries();
168     
169     if (ntracks<=0) return;
170     // Start loop on tracks in the hits containers
171     for (Int_t track=0; track<ntracks;track++) {
172       branch->GetEntry(track);
173       Int_t nhits = fHitsArray->GetEntriesFast();
174       GetHitsData(0)->Fill(nhits) ;    // fills Hit multiplicity
175       for (Int_t ihit=0;ihit<nhits;ihit++) 
176         {
177           AliVZEROhit  * VZEROHit   = (AliVZEROhit*) fHitsArray->UncheckedAt(ihit);
178           if (!VZEROHit) {
179             AliError("The unchecked hit doesn't exist");
180             break;
181           }
182           GetHitsData(1)->Fill(VZEROHit->Cell());        
183         }
184     }
185   }
186 }
187
188
189 //____________________________________________________________________________
190 void AliVZEROQADataMakerSim::MakeDigits()
191 {
192   // makes data from Digits
193
194   GetDigitsData(0)->Fill(fDigitsArray->GetEntriesFast()) ; 
195     TIter next(fDigitsArray) ; 
196     AliVZEROdigit *VZERODigit ; 
197     while ( (VZERODigit = dynamic_cast<AliVZEROdigit *>(next())) ) {
198          Int_t   PMNumber  = VZERODigit->PMNumber();         
199          GetDigitsData(PMNumber +1)->Fill( VZERODigit->Time()) ;    // in 100 of picoseconds
200          GetDigitsData(PMNumber +1+64)->Fill( VZERODigit->ADC()) ;
201     }  
202 }
203
204
205 //____________________________________________________________________________
206 void AliVZEROQADataMakerSim::MakeDigits(TTree *digitTree)
207 {
208     // makes data from Digit Tree
209         
210   if (fDigitsArray)
211     fDigitsArray->Clear() ; 
212   else 
213     fDigitsArray = new TClonesArray("AliVZEROdigit", 1000) ; 
214
215     TBranch * branch = digitTree->GetBranch("VZERODigit") ;
216     if ( ! branch ) {
217          AliWarning("VZERO branch in Digit Tree not found") ; 
218     } else {
219          branch->SetAddress(&fDigitsArray) ;
220          branch->GetEntry(0) ; 
221          MakeDigits() ; 
222     }  
223 }
224
225
226 //____________________________________________________________________________
227 void AliVZEROQADataMakerSim::StartOfDetectorCycle()
228 {
229   //Detector specific actions at start of cycle
230
231 }