1.The QA data created on demand according to the event species at filling time. 2...
[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
5379c4a3 55 AliDebug(AliQAv1::GetQADebugLevel(),"");
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
5379c4a3 66 AliDebug(AliQAv1::GetQADebugLevel(),"");
d874bd09 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
5379c4a3 85 AliDebug(AliQAv1::GetQADebugLevel(),"");
d874bd09 86
04236e67 87 this->~AliMUONQADataMakerSim();
88 new(this) AliMUONQADataMakerSim(qadm);
89 return *this;
90}
91
92//__________________________________________________________________
93AliMUONQADataMakerSim::~AliMUONQADataMakerSim()
94{
7d5d0cc5 95 /// Destructor
96
5379c4a3 97 AliDebug(AliQAv1::GetQADebugLevel(),"");
d874bd09 98
3770be44 99 delete fHitStore;
100 delete fDigitStore;
101}
102
103//__________________________________________________________________
104void AliMUONQADataMakerSim::InitHits()
105{
106 /// Initialized hit spectra
7d297381 107 const Bool_t expert = kTRUE ;
108 const Bool_t image = kTRUE ;
109
db72ff3b 110 TH1F* h0 = new TH1F("hHitDetElem", "DetElemId distribution in Hits;Detection element Id;Counts", 1400, 100., 1500.);
7d297381 111 Add2HitsList(h0, 0, !expert, image);
3770be44 112
db72ff3b 113 TH1F* h1 = new TH1F("hHitPtot", "P distribution in Hits;P [erg];Counts ", 300, 0., 300.);
7d297381 114 Add2HitsList(h1, 1, !expert, image);
3770be44 115 return;
116}
117
118//__________________________________________________________________
119void AliMUONQADataMakerSim::InitSDigits()
120{
121 /// Initialized SDigits spectra
7d297381 122 const Bool_t expert = kTRUE ;
123 const Bool_t image = kTRUE ;
124
db72ff3b 125 TH1I* h0 = new TH1I("hSDigitsDetElem", "Detection element distribution in SDigits;Detection element Id;Counts", 1400, 100, 1500);
7d297381 126 Add2SDigitsList(h0, 0, !expert, image);
3770be44 127
db72ff3b 128 TH1F* h1 = new TH1F("hSDigitsCharge", "Charge distribution in SDigits;Charge [??];Counts", 4096, 0, 4095);
7d297381 129 Add2SDigitsList(h1, 1, !expert, image);
3770be44 130
131}
132
133//__________________________________________________________________
134void AliMUONQADataMakerSim::InitDigits()
135{
136 /// Initialized Digits spectra
7d297381 137 const Bool_t expert = kTRUE ;
138 const Bool_t image = kTRUE ;
139
db72ff3b 140 TH1I* h0 = new TH1I("hDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 1400, 100, 1500);
7d297381 141 Add2DigitsList(h0, 0, !expert, image);
3770be44 142
db72ff3b 143 TH1I* h1 = new TH1I("hDigitsADC", "ADC distribution in Digits;ACD value;Counts", 4096, 0, 4095);
7d297381 144 Add2DigitsList(h1, 1, !expert, image);
3770be44 145
146}
147
148//__________________________________________________________________
149void AliMUONQADataMakerSim::MakeHits(TTree* hitsTree)
150{
151 /// makes data from Hits
eca4fa66 152
153 // Check id histograms already created for this Event Specie
154 if ( ! GetHitsData(0) )
155 InitHits() ;
156
3770be44 157 if (!fHitStore)
158 fHitStore = AliMUONVHitStore::Create(*hitsTree);
159 fHitStore->Connect(*hitsTree, false);
160 hitsTree->GetEvent(0);
161
162 TIter next(fHitStore->CreateIterator());
163
164 AliMUONHit* hit = 0x0;
165
166 while ( ( hit = static_cast<AliMUONHit*>(next()) ) )
167 {
168 GetHitsData(0)->Fill(hit->DetElemId());
169 GetHitsData(1)->Fill(hit->Momentum());
170 }
171
172
04236e67 173}
174
3770be44 175//__________________________________________________________________
176void AliMUONQADataMakerSim::MakeSDigits(TTree* sdigitsTree)
177{
178 /// makes data from SDigits
eca4fa66 179
180 // Check id histograms already created for this Event Specie
181 if ( ! GetSDigitsData(0) )
182 InitSDigits() ;
183
3770be44 184 if (!fDigitStore)
185 fDigitStore = AliMUONVDigitStore::Create(*sdigitsTree);
186 fDigitStore->Connect(*sdigitsTree, false);
187 sdigitsTree->GetEvent(0);
188
189 TIter next(fDigitStore->CreateIterator());
190
191 AliMUONVDigit* dig = 0x0;
192
193 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
194 {
195 GetSDigitsData(0)->Fill(dig->DetElemId());
196 GetSDigitsData(1)->Fill(dig->Charge());
197 }
198}
199
200//__________________________________________________________________
201void AliMUONQADataMakerSim::MakeDigits(TTree* digitsTree)
202{
203 /// makes data from Digits
eca4fa66 204
205 // Check id histograms already created for this Event Specie
206 if ( ! GetDigitsData(0) )
207 InitDigits() ;
208
3770be44 209 if (!fDigitStore)
210 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
211 fDigitStore->Connect(*digitsTree, false);
212 digitsTree->GetEvent(0);
213
214 TIter next(fDigitStore->CreateIterator());
215
216 AliMUONVDigit* dig = 0x0;
217
218 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
219 {
220 GetDigitsData(0)->Fill(dig->DetElemId());
221 GetDigitsData(1)->Fill(dig->ADC());
222 }
223}
224
04236e67 225//____________________________________________________________________________
4e25ac79 226void AliMUONQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list)
04236e67 227{
228 ///Detector specific actions at end of cycle
229 // do the QA checking
4e25ac79 230 AliQAChecker::Instance()->Run(AliQAv1::kMUON, task, list) ;
04236e67 231}
232
233
234//____________________________________________________________________________
235void AliMUONQADataMakerSim::StartOfDetectorCycle()
236{
237 /// Detector specific actions at start of cycle
238
239}