]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDQADataMakerSim.cxx
silvermy@ornl.gov - missed in 1st round; filled MetaData and Id fields also now
[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"
30
31//_____________________________________________________________________
32// This is the class that collects the QA data for the FMD during simulation.
33// The following data types are picked up:
34// - hits
35// - digits
36// The following data types are not supported (yet):
37// - raws
38// - sdigits
39// Author : Hans Hjersing Dalsgaard, Niels Bohr Institute, hans.dalsgaard@cern.ch
40//_____________________________________________________________________
41
42ClassImp(AliFMDQADataMakerSim)
ffa78f64 43#if 0
44; // This line is for Emacs - do not delete!
45#endif
c9dd1c4d 46//_____________________________________________________________________
ffa78f64 47AliFMDQADataMakerSim::AliFMDQADataMakerSim()
48 : AliQADataMakerSim(AliQA::GetDetName(AliQA::kFMD),
9bd2ccc2 49 "FMD Quality Assurance Data Maker"),
56236ce9 50 fDigitsArray("AliFMDDigit", 1000),
51 fHitsArray("AliFMDHit", 10)
c9dd1c4d 52{
53 // ctor
56236ce9 54
c9dd1c4d 55}
56
57//_____________________________________________________________________
a7e41e8d 58AliFMDQADataMakerSim::AliFMDQADataMakerSim(const AliFMDQADataMakerSim& qadm)
59 : AliQADataMakerSim(),
60 fDigitsArray(qadm.fDigitsArray),
61 fHitsArray(qadm.fHitsArray)
c9dd1c4d 62{
63 //copy ctor
a7e41e8d 64
c9dd1c4d 65 // Parameters:
66 // qadm Object to copy from
67
68}
9bd2ccc2 69//_____________________________________________________________________
a7e41e8d 70AliFMDQADataMakerSim& AliFMDQADataMakerSim::operator = (const AliFMDQADataMakerSim& qadm )
71{
72 fDigitsArray = qadm.fDigitsArray;
73 fHitsArray = qadm.fHitsArray;
74
75 return *this;
76}
77//_____________________________________________________________________
9bd2ccc2 78AliFMDQADataMakerSim::~AliFMDQADataMakerSim()
79{
56236ce9 80
9bd2ccc2 81}
c9dd1c4d 82
83//_____________________________________________________________________
92a357bf 84void AliFMDQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task,
ffa78f64 85 TObjArray * list)
c9dd1c4d 86{
87 //Detector specific actions at end of cycle
88 // do the QA checking
ffa78f64 89 AliLog::Message(5,"FMD: end of detector cycle",
90 "AliFMDQADataMakerSim","AliFMDQADataMakerSim",
91 "AliFMDQADataMakerSim::EndOfDetectorCycle",
92 "AliFMDQADataMakerSim.cxx",83);
c9dd1c4d 93 AliQAChecker::Instance()->Run(AliQA::kFMD, task, list) ;
94
95}
96
97//____________________________________________________________________
98void AliFMDQADataMakerSim::InitHits()
99{
100 // create Digits histograms in Digits subdir
ffa78f64 101 TH1F* hEnergyOfHits = new TH1F("hEnergyOfHits","Energy distribution",100,0,3);
c9dd1c4d 102 hEnergyOfHits->SetXTitle("Edep");
103 hEnergyOfHits->SetYTitle("Counts");
104 Add2HitsList(hEnergyOfHits, 0);
105}
106
107//_____________________________________________________________________
108void AliFMDQADataMakerSim::InitDigits()
109{
110 // create Digits histograms in Digits subdir
111 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts",1024,0,1024);
c9dd1c4d 112 hADCCounts->SetXTitle("ADC counts");
c9dd1c4d 113 Add2DigitsList(hADCCounts, 0);
c9dd1c4d 114}
115
116//_____________________________________________________________________
117void AliFMDQADataMakerSim::MakeHits(TClonesArray * hits)
118{
a7e41e8d 119 TIter next(hits);
c9dd1c4d 120 AliFMDHit * hit;
121 while ((hit = static_cast<AliFMDHit *>(next())))
122 GetHitsData(0)->Fill(hit->Edep()/hit->Length()*0.032);
123}
124
125//_____________________________________________________________________
126void AliFMDQADataMakerSim::MakeHits(TTree * hitTree)
127{
128 // make QA data from Hit Tree
129
56236ce9 130 fHitsArray.Clear();
131
c9dd1c4d 132 TBranch * branch = hitTree->GetBranch("FMD") ;
133 if (!branch) {
134 AliWarning("FMD branch in Hit Tree not found") ;
135 return;
136 }
56236ce9 137
138 TClonesArray* hitsAddress = &fHitsArray;
139
140 branch->SetAddress(&hitsAddress) ;
c9dd1c4d 141
142 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
143 branch->GetEntry(ientry);
56236ce9 144 MakeHits(hitsAddress); //tmp);
c9dd1c4d 145 }
9bd2ccc2 146
c9dd1c4d 147}
148
149//_____________________________________________________________________
150void AliFMDQADataMakerSim::MakeDigits(TClonesArray * digits)
151{
152 // makes data from Digits
153 if(!digits) return;
154
56236ce9 155 for(Int_t i = 0 ; i < digits->GetEntriesFast() ; i++) {
c9dd1c4d 156 //Raw ADC counts
157 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i));
158 GetDigitsData(0)->Fill(digit->Counts());
159 }
160}
161
162//_____________________________________________________________________
163void AliFMDQADataMakerSim::MakeDigits(TTree * digitTree)
164{
165
56236ce9 166 fDigitsArray.Clear();
c9dd1c4d 167 TBranch * branch = digitTree->GetBranch("FMD") ;
168 if (!branch) {
169 AliWarning("FMD branch in Digit Tree not found") ;
170 return;
171 }
56236ce9 172 TClonesArray* digitAddress = &fDigitsArray;
173 branch->SetAddress(&digitAddress) ;
c9dd1c4d 174 branch->GetEntry(0) ;
56236ce9 175 MakeDigits(digitAddress) ;
c9dd1c4d 176}
177
178//_____________________________________________________________________
179void AliFMDQADataMakerSim::StartOfDetectorCycle()
180{
181
182}
183//_____________________________________________________________________
184//
185// EOF
186//