]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDQADataMakerSim.cxx
Added fit macro from M. Putis
[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& 
68 AliFMDQADataMakerSim::operator = (const AliFMDQADataMakerSim& ) 
69 {
70   
71   return *this;
72 }
73 //_____________________________________________________________________
74 AliFMDQADataMakerSim::~AliFMDQADataMakerSim()
75 {
76
77 }
78
79 //_____________________________________________________________________
80 void AliFMDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, 
81                                               TObjArray ** list)
82 {
83   //Detector specific actions at end of cycle
84   // do the QA checking
85   AliLog::Message(5,"FMD: end of detector cycle",
86                   "AliFMDQADataMakerSim","AliFMDQADataMakerSim",
87                   "AliFMDQADataMakerSim::EndOfDetectorCycle",
88                   "AliFMDQADataMakerSim.cxx",83);
89   AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list) ;  
90   
91 }
92 //_____________________________________________________________________
93 void AliFMDQADataMakerSim::InitSDigits()
94 {
95   // create SDigits histograms in SDigits subdir
96   const Bool_t expert   = kTRUE ; 
97   const Bool_t image    = kTRUE ; 
98   
99   TH1I* hADCCounts = new TH1I("hADCCounts",
100                               "Dist of ADC counts;ADC counts;Entries",
101                               1024,0,1024);
102   hADCCounts->SetXTitle("ADC counts");
103   Add2SDigitsList(hADCCounts, 0, !expert, image);
104 }
105
106 //____________________________________________________________________ 
107 void AliFMDQADataMakerSim::InitHits()
108 {
109   // create Digits histograms in Digits subdir
110   const Bool_t expert   = kTRUE ; 
111   const Bool_t image    = kTRUE ; 
112   
113   TH1F* hEnergyOfHits = new TH1F("hEnergyOfHits",
114                                  "Energy distribution;Energy [MeV];Counts",
115                                  100,0,3);
116   hEnergyOfHits->SetXTitle("Edep");
117   hEnergyOfHits->SetYTitle("Counts");
118   Add2HitsList(hEnergyOfHits, 0, !expert, image);
119 }
120
121 //_____________________________________________________________________
122 void AliFMDQADataMakerSim::InitDigits()
123 {
124   // create Digits histograms in Digits subdir
125   const Bool_t expert   = kTRUE ; 
126   const Bool_t image    = kTRUE ; 
127   
128   TH1I* hADCCounts = new TH1I("hADCCounts",
129                               "Dist of ADC counts; ADC counts;Entries",
130                               1024,0,1024);
131   hADCCounts->SetXTitle("ADC counts");
132   Add2DigitsList(hADCCounts, 0, !expert, image);
133 }
134
135 //_____________________________________________________________________
136 void AliFMDQADataMakerSim::MakeHits()
137 {
138   // Check id histograms already created for this Event Specie
139   if ( ! GetHitsData(0) )
140     InitHits() ;
141
142   TIter next(fHitsArray);
143   AliFMDHit * hit;
144   while ((hit = static_cast<AliFMDHit *>(next()))) 
145     GetHitsData(0)->Fill(hit->Edep()/hit->Length()*0.032);
146 }
147
148 //_____________________________________________________________________
149 void AliFMDQADataMakerSim::MakeHits(TTree * hitTree)
150 {
151   // make QA data from Hit Tree
152   // 
153   // Parameters: 
154   //   hitTree    Hits container 
155   //
156   if (!fHitsArray) 
157     fHitsArray = new TClonesArray("AliFMDHit", 1000) ; 
158   fHitsArray->Clear() ; 
159   
160   TBranch * branch = hitTree->GetBranch("FMD") ;
161   if (!branch) {
162     AliWarning("FMD branch in Hit Tree not found") ; 
163     return;
164   }
165     
166   branch->SetAddress(&fHitsArray) ;
167   
168   for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
169     branch->GetEntry(ientry);
170     MakeHits();   //tmp); 
171     fHitsArray->Clear() ; 
172   }     
173 }
174
175 //_____________________________________________________________________
176 void AliFMDQADataMakerSim::MakeDigits()
177 {
178   // makes data from Digits
179   // 
180   // Parameters: 
181   //    none
182   if(!fDigitsArray) return;
183   
184   for(Int_t i = 0 ; i < fDigitsArray->GetEntriesFast() ; i++) {
185     //Raw ADC counts
186     AliFMDDigit* digit = static_cast<AliFMDDigit*>(fDigitsArray->At(i));
187     GetDigitsData(0)->Fill(digit->Counts());
188   }
189 }
190
191 //_____________________________________________________________________
192 void AliFMDQADataMakerSim::MakeDigits(TTree * digitTree)
193 {
194   // Make data from digits. 
195   // 
196   // Parameters: 
197   //    digitTree    Tree holding digits. 
198   
199   if (!fDigitsArray) 
200     fDigitsArray = new TClonesArray("AliFMDDigit", 1000) ; 
201   fDigitsArray->Clear();
202   
203   TBranch * branch = digitTree->GetBranch("FMD") ;
204   if (!branch)    {
205       AliWarning("FMD branch in Digit Tree not found") ; 
206       return;
207   } 
208   branch->SetAddress(&fDigitsArray) ;
209
210   if (fDigitsArray) fDigitsArray->Clear();
211
212   branch->GetEntry(0) ; 
213   MakeDigits() ; 
214 }
215
216 //_____________________________________________________________________
217 void AliFMDQADataMakerSim::MakeSDigits()
218 {
219   // makes data from Digits
220   // 
221   // Parameters: 
222   //   none 
223   if(!fSDigitsArray) return;
224   
225    for(Int_t i = 0 ; i < fSDigitsArray->GetEntriesFast() ; i++) {
226     //Raw ADC counts
227     AliFMDSDigit* sdigit = static_cast<AliFMDSDigit*>(fSDigitsArray->At(i));
228     GetSDigitsData(0)->Fill(sdigit->Counts());
229   }
230 }
231
232 //_____________________________________________________________________
233 void AliFMDQADataMakerSim::MakeSDigits(TTree * sdigitTree)
234 {
235   // Make data from digits. 
236   // 
237   // Parameters: 
238   //    digitTree    Tree holding digits. 
239   
240   if (!fSDigitsArray) 
241     fSDigitsArray = new TClonesArray("AliFMDSDigit", 1000) ; 
242   fSDigitsArray->Clear() ;
243
244   TBranch * branch = sdigitTree->GetBranch("FMD") ;
245   if (!branch)    {
246     AliWarning("FMD branch in SDigit Tree not found") ; 
247     return;
248   } 
249   branch->SetAddress(&fSDigitsArray) ;
250   branch->GetEntry(0) ; 
251   MakeSDigits() ; 
252 }
253
254 //_____________________________________________________________________ 
255 void AliFMDQADataMakerSim::StartOfDetectorCycle()
256 {
257   // Does 
258   // not 
259   // do 
260   // anything 
261 }
262 //_____________________________________________________________________ 
263 //
264 // EOF
265 //