COVERITY reports many FORWARD_NULL, corrected; AliEMCALv2: initialization of fHits...
[u/mrichter/AliRoot.git] / FMD / AliFMDQADataMakerSim.cxx
CommitLineData
c9dd1c4d 1/**************************************************************************
ffa78f64 2 * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
c9dd1c4d 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"
028cb80b 30#include "AliFMDSDigit.h"
c9dd1c4d 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
43ClassImp(AliFMDQADataMakerSim)
ffa78f64 44#if 0
45; // This line is for Emacs - do not delete!
46#endif
c9dd1c4d 47//_____________________________________________________________________
ffa78f64 48AliFMDQADataMakerSim::AliFMDQADataMakerSim()
4e25ac79 49 : AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kFMD),
6252ceeb 50 "FMD Quality Assurance Data Maker")
c9dd1c4d 51{
52 // ctor
56236ce9 53
c9dd1c4d 54}
55
56//_____________________________________________________________________
f2597905 57AliFMDQADataMakerSim::AliFMDQADataMakerSim(const AliFMDQADataMakerSim& /*qadm*/)
6252ceeb 58 : AliQADataMakerSim()
c9dd1c4d 59{
60 //copy ctor
a7e41e8d 61
c9dd1c4d 62 // Parameters:
63 // qadm Object to copy from
64
65}
9bd2ccc2 66//_____________________________________________________________________
6252ceeb 67AliFMDQADataMakerSim& AliFMDQADataMakerSim::operator = (const AliFMDQADataMakerSim& )
a7e41e8d 68{
a7e41e8d 69
70 return *this;
71}
72//_____________________________________________________________________
9bd2ccc2 73AliFMDQADataMakerSim::~AliFMDQADataMakerSim()
74{
56236ce9 75
9bd2ccc2 76}
c9dd1c4d 77
78//_____________________________________________________________________
4e25ac79 79void AliFMDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task,
57acd2d2 80 TObjArray ** list)
c9dd1c4d 81{
82 //Detector specific actions at end of cycle
83 // do the QA checking
ffa78f64 84 AliLog::Message(5,"FMD: end of detector cycle",
85 "AliFMDQADataMakerSim","AliFMDQADataMakerSim",
86 "AliFMDQADataMakerSim::EndOfDetectorCycle",
87 "AliFMDQADataMakerSim.cxx",83);
4e25ac79 88 AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list) ;
c9dd1c4d 89
90}
028cb80b 91//_____________________________________________________________________
92void AliFMDQADataMakerSim::InitSDigits()
93{
94 // create SDigits histograms in SDigits subdir
7d297381 95 const Bool_t expert = kTRUE ;
96 const Bool_t image = kTRUE ;
97
db72ff3b 98 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts;ADC counts;Entries",1024,0,1024);
028cb80b 99 hADCCounts->SetXTitle("ADC counts");
7d297381 100 Add2SDigitsList(hADCCounts, 0, !expert, image);
028cb80b 101}
c9dd1c4d 102
103//____________________________________________________________________
104void AliFMDQADataMakerSim::InitHits()
105{
106 // create Digits histograms in Digits subdir
7d297381 107 const Bool_t expert = kTRUE ;
108 const Bool_t image = kTRUE ;
109
db72ff3b 110 TH1F* hEnergyOfHits = new TH1F("hEnergyOfHits","Energy distribution;Energy [MeV];Counts",100,0,3);
c9dd1c4d 111 hEnergyOfHits->SetXTitle("Edep");
112 hEnergyOfHits->SetYTitle("Counts");
7d297381 113 Add2HitsList(hEnergyOfHits, 0, !expert, image);
c9dd1c4d 114}
115
116//_____________________________________________________________________
117void AliFMDQADataMakerSim::InitDigits()
118{
119 // create Digits histograms in Digits subdir
7d297381 120 const Bool_t expert = kTRUE ;
121 const Bool_t image = kTRUE ;
122
db72ff3b 123 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts; ADC counts;Entries",1024,0,1024);
c9dd1c4d 124 hADCCounts->SetXTitle("ADC counts");
7d297381 125 Add2DigitsList(hADCCounts, 0, !expert, image);
c9dd1c4d 126}
127
128//_____________________________________________________________________
6252ceeb 129void AliFMDQADataMakerSim::MakeHits()
c9dd1c4d 130{
eca4fa66 131 // Check id histograms already created for this Event Specie
132 if ( ! GetHitsData(0) )
133 InitHits() ;
134
6252ceeb 135 TIter next(fHitsArray);
c9dd1c4d 136 AliFMDHit * hit;
137 while ((hit = static_cast<AliFMDHit *>(next())))
138 GetHitsData(0)->Fill(hit->Edep()/hit->Length()*0.032);
139}
140
141//_____________________________________________________________________
142void AliFMDQADataMakerSim::MakeHits(TTree * hitTree)
143{
144 // make QA data from Hit Tree
145
6252ceeb 146 if (fHitsArray)
147 fHitsArray->Clear() ;
148 else
149 fHitsArray = new TClonesArray("AliFMDHit", 1000) ;
56236ce9 150
c9dd1c4d 151 TBranch * branch = hitTree->GetBranch("FMD") ;
152 if (!branch) {
153 AliWarning("FMD branch in Hit Tree not found") ;
154 return;
155 }
6252ceeb 156
157 branch->SetAddress(&fHitsArray) ;
c9dd1c4d 158
159 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
160 branch->GetEntry(ientry);
6252ceeb 161 MakeHits(); //tmp);
162 fHitsArray->Clear() ;
c9dd1c4d 163 }
c9dd1c4d 164}
165
166//_____________________________________________________________________
6252ceeb 167void AliFMDQADataMakerSim::MakeDigits()
c9dd1c4d 168{
169 // makes data from Digits
6252ceeb 170 if(!fDigitsArray) return;
171
172 for(Int_t i = 0 ; i < fDigitsArray->GetEntriesFast() ; i++) {
c9dd1c4d 173 //Raw ADC counts
6252ceeb 174 AliFMDDigit* digit = static_cast<AliFMDDigit*>(fDigitsArray->At(i));
c9dd1c4d 175 GetDigitsData(0)->Fill(digit->Counts());
176 }
177}
178
179//_____________________________________________________________________
180void AliFMDQADataMakerSim::MakeDigits(TTree * digitTree)
181{
182
6252ceeb 183 if (fDigitsArray)
184 fDigitsArray->Clear();
185 else
186 fDigitsArray = new TClonesArray("AliFMDDigit", 1000) ;
187
c9dd1c4d 188 TBranch * branch = digitTree->GetBranch("FMD") ;
189 if (!branch) {
190 AliWarning("FMD branch in Digit Tree not found") ;
191 return;
192 }
6252ceeb 193 branch->SetAddress(&fDigitsArray) ;
c9dd1c4d 194 branch->GetEntry(0) ;
6252ceeb 195 MakeDigits() ;
c9dd1c4d 196}
197
028cb80b 198//_____________________________________________________________________
6252ceeb 199void AliFMDQADataMakerSim::MakeSDigits()
028cb80b 200{
201 // makes data from Digits
6252ceeb 202 if(!fSDigitsArray) return;
028cb80b 203
6252ceeb 204 for(Int_t i = 0 ; i < fSDigitsArray->GetEntriesFast() ; i++) {
028cb80b 205 //Raw ADC counts
6252ceeb 206 AliFMDSDigit* sdigit = static_cast<AliFMDSDigit*>(fSDigitsArray->At(i));
028cb80b 207 GetSDigitsData(0)->Fill(sdigit->Counts());
208 }
209}
210
211//_____________________________________________________________________
212void AliFMDQADataMakerSim::MakeSDigits(TTree * sdigitTree)
213{
214
6252ceeb 215 if (fSDigitsArray)
216 fSDigitsArray->Clear() ;
217 else
218 fSDigitsArray = new TClonesArray("AliFMDSDigit", 1000) ;
028cb80b 219 TBranch * branch = sdigitTree->GetBranch("FMD") ;
220 if (!branch) {
221 AliWarning("FMD branch in SDigit Tree not found") ;
222 return;
223 }
6252ceeb 224 branch->SetAddress(&fSDigitsArray) ;
028cb80b 225 branch->GetEntry(0) ;
6252ceeb 226 MakeSDigits() ;
028cb80b 227}
228
c9dd1c4d 229//_____________________________________________________________________
230void AliFMDQADataMakerSim::StartOfDetectorCycle()
231{
232
233}
234//_____________________________________________________________________
235//
236// EOF
237//