Fixes for bug #49914: Compilation breaks in trunk, and bug #48629: Trunk cannot read...
[u/mrichter/AliRoot.git] / MUON / AliMUONQADataMakerSim.cxx
CommitLineData
04236e67 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
3770be44 16// $Id$
17
18#include "AliMUONQADataMakerSim.h"
19#include "AliMUONHit.h"
20#include "AliMUONDigit.h"
21#include "AliMUONVHitStore.h"
22#include "AliMUONVDigitStore.h"
23
24// --- AliRoot header files ---
25#include "AliLog.h"
26#include "AliQAChecker.h"
04236e67 27
28// --- ROOT system ---
29#include <TClonesArray.h>
30#include <TFile.h>
31#include <TH1F.h>
32#include <TH1I.h>
33#include <TH2F.h>
3770be44 34#include <TTree.h>
04236e67 35
36//-----------------------------------------------------------------------------
37/// \class AliMUONQADataMakerSim
38///
39/// MUON base class for quality assurance data (histo) maker
40///
41/// \author C. Finck
42
43/// \cond CLASSIMP
44ClassImp(AliMUONQADataMakerSim)
45/// \endcond
46
47//____________________________________________________________________________
48AliMUONQADataMakerSim::AliMUONQADataMakerSim() :
4e25ac79 49 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kMUON), "MUON Quality Assurance Data Maker"),
3770be44 50 fHitStore(0x0),
51 fDigitStore(0x0)
04236e67 52{
7d5d0cc5 53 /// Default constructor
54
d874bd09 55 AliDebug(1,"");
04236e67 56}
57
58//____________________________________________________________________________
59AliMUONQADataMakerSim::AliMUONQADataMakerSim(const AliMUONQADataMakerSim& qadm) :
4a3224ff 60 AliQADataMakerSim(),
61 fHitStore(0x0),
62 fDigitStore(0x0)
04236e67 63{
7d5d0cc5 64 /// Copy constructor
65
d874bd09 66 AliDebug(1,"");
67
4a3224ff 68 if ( qadm.fHitStore )
69 {
70 fHitStore = static_cast<AliMUONVHitStore*>(qadm.fHitStore->Clone());
71 }
72 if ( qadm.fDigitStore )
73 {
74 fDigitStore = static_cast<AliMUONVDigitStore*>(qadm.fDigitStore->Clone());
75 }
04236e67 76 SetName((const char*)qadm.GetName()) ;
77 SetTitle((const char*)qadm.GetTitle());
78}
79
80//__________________________________________________________________
81AliMUONQADataMakerSim& AliMUONQADataMakerSim::operator = (const AliMUONQADataMakerSim& qadm )
82{
7d5d0cc5 83 /// Assignment operator
84
d874bd09 85 AliDebug(1,"");
86
04236e67 87 this->~AliMUONQADataMakerSim();
88 new(this) AliMUONQADataMakerSim(qadm);
89 return *this;
90}
91
92//__________________________________________________________________
93AliMUONQADataMakerSim::~AliMUONQADataMakerSim()
94{
7d5d0cc5 95 /// Destructor
96
d874bd09 97 AliDebug(1,"");
98
3770be44 99 delete fHitStore;
100 delete fDigitStore;
101}
102
103//__________________________________________________________________
104void AliMUONQADataMakerSim::InitHits()
105{
106 /// Initialized hit spectra
107 TH1F* h0 = new TH1F("hHitDetElem", "DetElemId distribution in Hits", 1400, 100., 1500.);
108 Add2HitsList(h0, 0);
109
110 TH1F* h1 = new TH1F("hHitPtot", "P distribution in Hits ", 300, 0., 300.);
111 Add2HitsList(h1, 1);
112 return;
113}
114
115//__________________________________________________________________
116void AliMUONQADataMakerSim::InitSDigits()
117{
118 /// Initialized SDigits spectra
119 TH1I* h0 = new TH1I("hSDigitsDetElem", "Detection element distribution in SDigits", 1400, 100, 1500);
120 Add2SDigitsList(h0, 0);
121
122 TH1F* h1 = new TH1F("hSDigitsCharge", "Charge distribution in SDigits", 4096, 0, 4095);
123 Add2SDigitsList(h1, 1);
124
125}
126
127//__________________________________________________________________
128void AliMUONQADataMakerSim::InitDigits()
129{
130 /// Initialized Digits spectra
131 TH1I* h0 = new TH1I("hDigitsDetElem", "Detection element distribution in Digits", 1400, 100, 1500);
132 Add2DigitsList(h0, 0);
133
134 TH1I* h1 = new TH1I("hDigitsADC", "ADC distribution in Digits", 4096, 0, 4095);
135 Add2DigitsList(h1, 1);
136
137}
138
139//__________________________________________________________________
140void AliMUONQADataMakerSim::MakeHits(TTree* hitsTree)
141{
142 /// makes data from Hits
143 if (!fHitStore)
144 fHitStore = AliMUONVHitStore::Create(*hitsTree);
145 fHitStore->Connect(*hitsTree, false);
146 hitsTree->GetEvent(0);
147
148 TIter next(fHitStore->CreateIterator());
149
150 AliMUONHit* hit = 0x0;
151
152 while ( ( hit = static_cast<AliMUONHit*>(next()) ) )
153 {
154 GetHitsData(0)->Fill(hit->DetElemId());
155 GetHitsData(1)->Fill(hit->Momentum());
156 }
157
158
04236e67 159}
160
3770be44 161//__________________________________________________________________
162void AliMUONQADataMakerSim::MakeSDigits(TTree* sdigitsTree)
163{
164 /// makes data from SDigits
165 if (!fDigitStore)
166 fDigitStore = AliMUONVDigitStore::Create(*sdigitsTree);
167 fDigitStore->Connect(*sdigitsTree, false);
168 sdigitsTree->GetEvent(0);
169
170 TIter next(fDigitStore->CreateIterator());
171
172 AliMUONVDigit* dig = 0x0;
173
174 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
175 {
176 GetSDigitsData(0)->Fill(dig->DetElemId());
177 GetSDigitsData(1)->Fill(dig->Charge());
178 }
179}
180
181//__________________________________________________________________
182void AliMUONQADataMakerSim::MakeDigits(TTree* digitsTree)
183{
184 /// makes data from Digits
185 if (!fDigitStore)
186 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
187 fDigitStore->Connect(*digitsTree, false);
188 digitsTree->GetEvent(0);
189
190 TIter next(fDigitStore->CreateIterator());
191
192 AliMUONVDigit* dig = 0x0;
193
194 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
195 {
196 GetDigitsData(0)->Fill(dig->DetElemId());
197 GetDigitsData(1)->Fill(dig->ADC());
198 }
199}
200
04236e67 201//____________________________________________________________________________
4e25ac79 202void AliMUONQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list)
04236e67 203{
204 ///Detector specific actions at end of cycle
205 // do the QA checking
4e25ac79 206 AliQAChecker::Instance()->Run(AliQAv1::kMUON, task, list) ;
04236e67 207}
208
209
210//____________________________________________________________________________
211void AliMUONQADataMakerSim::StartOfDetectorCycle()
212{
213 /// Detector specific actions at start of cycle
214
215}