]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDQADataMakerSim.cxx
warning removal
[u/mrichter/AliRoot.git] / FMD / AliFMDQADataMakerSim.cxx
1 /**************************************************************************
2  * Copyright(c) 2004, 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 // --- ROOT system ---
16 #include <iostream>
17 #include <TClonesArray.h>
18 #include <TFile.h> 
19 #include <TH1F.h> 
20 #include <TH1I.h> 
21
22 // --- AliRoot header files ---
23 #include "AliESDEvent.h"
24 #include "AliLog.h"
25 #include "AliFMDQADataMakerSim.h"
26 #include "AliFMDDigit.h"
27 #include "AliFMDHit.h"
28 #include "AliQAChecker.h"
29 #include "AliFMDParameters.h"
30 #include "AliFMDSDigit.h"
31
32 //_____________________________________________________________________
33 // This is the class that collects the QA data for the FMD during simulation.
34 // The following data types are picked up:
35 // - hits
36 // - digits
37 // The following data types are not supported (yet):
38 // - raws
39 // - sdigits
40 // Author : Hans Hjersing Dalsgaard, Niels Bohr Institute, hans.dalsgaard@cern.ch
41 //_____________________________________________________________________
42
43 ClassImp(AliFMDQADataMakerSim)
44 #if 0
45 ; // This line is for Emacs - do not delete!
46 #endif
47 //_____________________________________________________________________
48 AliFMDQADataMakerSim::AliFMDQADataMakerSim() 
49   :  AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kFMD),
50                        "FMD Quality Assurance Data Maker")
51 {
52   // ctor
53
54 }
55
56 //_____________________________________________________________________
57 AliFMDQADataMakerSim::AliFMDQADataMakerSim(const AliFMDQADataMakerSim& /*qadm*/) 
58   : AliQADataMakerSim()
59 {
60   //copy ctor 
61   
62   // Parameters: 
63   //    qadm    Object to copy from
64   
65 }
66 //_____________________________________________________________________
67 AliFMDQADataMakerSim& AliFMDQADataMakerSim::operator = (const AliFMDQADataMakerSim& ) 
68 {
69   
70   return *this;
71 }
72 //_____________________________________________________________________
73 AliFMDQADataMakerSim::~AliFMDQADataMakerSim()
74 {
75
76 }
77
78 //_____________________________________________________________________
79 void AliFMDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, 
80                                               TObjArray ** list)
81 {
82   //Detector specific actions at end of cycle
83   // do the QA checking
84   AliLog::Message(5,"FMD: end of detector cycle",
85                   "AliFMDQADataMakerSim","AliFMDQADataMakerSim",
86                   "AliFMDQADataMakerSim::EndOfDetectorCycle",
87                   "AliFMDQADataMakerSim.cxx",83);
88   AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list) ;  
89   
90 }
91 //_____________________________________________________________________
92 void AliFMDQADataMakerSim::InitSDigits()
93 {
94   // create SDigits histograms in SDigits subdir
95   const Bool_t expert   = kTRUE ; 
96   const Bool_t image    = kTRUE ; 
97   
98   TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts;ADC counts;Entries",1024,0,1024);
99   hADCCounts->SetXTitle("ADC counts");
100   Add2SDigitsList(hADCCounts, 0, !expert, image);
101 }
102
103 //____________________________________________________________________ 
104 void AliFMDQADataMakerSim::InitHits()
105 {
106   // create Digits histograms in Digits subdir
107   const Bool_t expert   = kTRUE ; 
108   const Bool_t image    = kTRUE ; 
109   
110   TH1F* hEnergyOfHits = new TH1F("hEnergyOfHits","Energy distribution;Energy [MeV];Counts",100,0,3);
111   hEnergyOfHits->SetXTitle("Edep");
112   hEnergyOfHits->SetYTitle("Counts");
113   Add2HitsList(hEnergyOfHits, 0, !expert, image);
114 }
115
116 //_____________________________________________________________________
117 void AliFMDQADataMakerSim::InitDigits()
118 {
119   // create Digits histograms in Digits subdir
120   const Bool_t expert   = kTRUE ; 
121   const Bool_t image    = kTRUE ; 
122   
123   TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts; ADC counts;Entries",1024,0,1024);
124   hADCCounts->SetXTitle("ADC counts");
125   Add2DigitsList(hADCCounts, 0, !expert, image);
126 }
127
128 //_____________________________________________________________________
129 void AliFMDQADataMakerSim::MakeHits()
130 {
131   // Check id histograms already created for this Event Specie
132   if ( ! GetHitsData(0) )
133     InitHits() ;
134
135   TIter next(fHitsArray);
136   AliFMDHit * hit;
137   while ((hit = static_cast<AliFMDHit *>(next()))) 
138     GetHitsData(0)->Fill(hit->Edep()/hit->Length()*0.032);
139 }
140
141 //_____________________________________________________________________
142 void AliFMDQADataMakerSim::MakeHits(TTree * hitTree)
143 {
144   // make QA data from Hit Tree
145   
146   if (fHitsArray) 
147     fHitsArray->Clear() ; 
148   else
149     fHitsArray = new TClonesArray("AliFMDHit", 1000) ; 
150   
151   TBranch * branch = hitTree->GetBranch("FMD") ;
152   if (!branch) {
153     AliWarning("FMD branch in Hit Tree not found") ; 
154     return;
155   }
156     
157   branch->SetAddress(&fHitsArray) ;
158   
159   for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
160     branch->GetEntry(ientry);
161     MakeHits();   //tmp); 
162     fHitsArray->Clear() ; 
163   }     
164 }
165
166 //_____________________________________________________________________
167 void AliFMDQADataMakerSim::MakeDigits()
168 {
169   // makes data from Digits
170   if(!fDigitsArray) return;
171   
172   for(Int_t i = 0 ; i < fDigitsArray->GetEntriesFast() ; i++) {
173     //Raw ADC counts
174     AliFMDDigit* digit = static_cast<AliFMDDigit*>(fDigitsArray->At(i));
175     GetDigitsData(0)->Fill(digit->Counts());
176   }
177 }
178
179 //_____________________________________________________________________
180 void AliFMDQADataMakerSim::MakeDigits(TTree * digitTree)
181 {
182   
183   if (fDigitsArray) 
184     fDigitsArray->Clear();
185   else 
186     fDigitsArray = new TClonesArray("AliFMDDigit", 1000) ; 
187   
188   TBranch * branch = digitTree->GetBranch("FMD") ;
189   if (!branch)    {
190       AliWarning("FMD branch in Digit Tree not found") ; 
191       return;
192   } 
193   branch->SetAddress(&fDigitsArray) ;
194   branch->GetEntry(0) ; 
195   MakeDigits() ; 
196 }
197
198 //_____________________________________________________________________
199 void AliFMDQADataMakerSim::MakeSDigits()
200 {
201   // makes data from Digits
202   if(!fSDigitsArray) return;
203   
204    for(Int_t i = 0 ; i < fSDigitsArray->GetEntriesFast() ; i++) {
205     //Raw ADC counts
206     AliFMDSDigit* sdigit = static_cast<AliFMDSDigit*>(fSDigitsArray->At(i));
207     GetSDigitsData(0)->Fill(sdigit->Counts());
208   }
209 }
210
211 //_____________________________________________________________________
212 void AliFMDQADataMakerSim::MakeSDigits(TTree * sdigitTree)
213 {
214   
215   if (fSDigitsArray) 
216     fSDigitsArray->Clear() ;
217   else 
218     fSDigitsArray = new TClonesArray("AliFMDSDigit", 1000) ; 
219   TBranch * branch = sdigitTree->GetBranch("FMD") ;
220   if (!branch)    {
221     AliWarning("FMD branch in SDigit Tree not found") ; 
222     return;
223   } 
224   branch->SetAddress(&fSDigitsArray) ;
225   branch->GetEntry(0) ; 
226   MakeSDigits() ; 
227 }
228
229 //_____________________________________________________________________ 
230 void AliFMDQADataMakerSim::StartOfDetectorCycle()
231 {
232    
233 }
234 //_____________________________________________________________________ 
235 //
236 // EOF
237 //