]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONQADataMakerSim.cxx
Implemented methods MakeHits(), MakeSDigits(), MakeDigits()
[u/mrichter/AliRoot.git] / MUON / AliMUONQADataMakerSim.cxx
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
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"
27
28 // --- ROOT system ---
29 #include <TClonesArray.h>
30 #include <TFile.h> 
31 #include <TH1F.h> 
32 #include <TH1I.h> 
33 #include <TH2F.h> 
34 #include <TTree.h>
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
44 ClassImp(AliMUONQADataMakerSim)
45 /// \endcond
46            
47 //____________________________________________________________________________ 
48 AliMUONQADataMakerSim::AliMUONQADataMakerSim() : 
49     AliQADataMakerSim(AliQA::GetDetName(AliQA::kMUON), "MUON Quality Assurance Data Maker"),
50     fHitStore(0x0),
51     fDigitStore(0x0)   
52 {
53     /// ctor
54 }
55
56 //____________________________________________________________________________ 
57 AliMUONQADataMakerSim::AliMUONQADataMakerSim(const AliMUONQADataMakerSim& qadm) :
58     AliQADataMakerSim()
59 {
60     ///copy ctor 
61     SetName((const char*)qadm.GetName()) ; 
62     SetTitle((const char*)qadm.GetTitle()); 
63 }
64
65 //__________________________________________________________________
66 AliMUONQADataMakerSim& AliMUONQADataMakerSim::operator = (const AliMUONQADataMakerSim& qadm )
67 {
68     /// Equal operator.
69     this->~AliMUONQADataMakerSim();
70     new(this) AliMUONQADataMakerSim(qadm);
71     return *this;
72 }
73
74 //__________________________________________________________________
75 AliMUONQADataMakerSim::~AliMUONQADataMakerSim()
76 {
77     /// dtor
78   delete fHitStore;
79   delete fDigitStore;
80 }
81
82 //__________________________________________________________________
83 void AliMUONQADataMakerSim::InitHits() 
84 {
85   /// Initialized hit spectra
86   TH1F* h0 = new TH1F("hHitDetElem", "DetElemId distribution in Hits", 1400, 100., 1500.); 
87   Add2HitsList(h0, 0);
88
89   TH1F* h1 = new TH1F("hHitPtot", "P distribution in Hits ", 300, 0., 300.); 
90   Add2HitsList(h1, 1);
91   return;
92
93
94 //__________________________________________________________________
95 void AliMUONQADataMakerSim::InitSDigits() 
96 {
97   /// Initialized SDigits spectra
98   TH1I* h0 = new TH1I("hSDigitsDetElem", "Detection element distribution in SDigits",  1400, 100, 1500); 
99   Add2SDigitsList(h0, 0);
100
101   TH1F* h1 = new TH1F("hSDigitsCharge", "Charge distribution in SDigits", 4096, 0, 4095); 
102   Add2SDigitsList(h1, 1);
103
104 }  
105
106 //__________________________________________________________________
107 void AliMUONQADataMakerSim::InitDigits() 
108 {
109   /// Initialized Digits spectra 
110   TH1I* h0 = new TH1I("hDigitsDetElem", "Detection element distribution in Digits",  1400, 100, 1500); 
111   Add2DigitsList(h0, 0);
112
113   TH1I* h1 = new TH1I("hDigitsADC", "ADC distribution in Digits", 4096, 0, 4095); 
114   Add2DigitsList(h1, 1);  
115
116
117
118 //__________________________________________________________________
119 void AliMUONQADataMakerSim::MakeHits(TTree* hitsTree)        
120 {
121   /// makes data from Hits
122   if (!fHitStore)
123     fHitStore = AliMUONVHitStore::Create(*hitsTree);
124   fHitStore->Connect(*hitsTree, false);
125   hitsTree->GetEvent(0);
126     
127   TIter next(fHitStore->CreateIterator());
128
129   AliMUONHit* hit = 0x0;
130
131   while ( ( hit = static_cast<AliMUONHit*>(next()) ) )
132   {
133     GetHitsData(0)->Fill(hit->DetElemId());
134     GetHitsData(1)->Fill(hit->Momentum());
135   }
136
137   
138 }
139
140 //__________________________________________________________________
141 void AliMUONQADataMakerSim::MakeSDigits(TTree* sdigitsTree)        
142 {
143   /// makes data from SDigits
144   if (!fDigitStore)
145     fDigitStore = AliMUONVDigitStore::Create(*sdigitsTree);
146   fDigitStore->Connect(*sdigitsTree, false);
147   sdigitsTree->GetEvent(0);
148     
149   TIter next(fDigitStore->CreateIterator());
150
151   AliMUONVDigit* dig = 0x0;
152
153   while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
154   {
155     GetSDigitsData(0)->Fill(dig->DetElemId());
156     GetSDigitsData(1)->Fill(dig->Charge());
157   }
158
159
160 //__________________________________________________________________
161 void AliMUONQADataMakerSim::MakeDigits(TTree* digitsTree)         
162 {
163    /// makes data from Digits
164   if (!fDigitStore)
165     fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
166   fDigitStore->Connect(*digitsTree, false);
167   digitsTree->GetEvent(0);
168     
169   TIter next(fDigitStore->CreateIterator());
170
171   AliMUONVDigit* dig = 0x0;
172
173   while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
174   {
175     GetDigitsData(0)->Fill(dig->DetElemId());
176     GetDigitsData(1)->Fill(dig->ADC());
177   }
178 }
179       
180 //____________________________________________________________________________ 
181 void AliMUONQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray* list)
182 {
183     ///Detector specific actions at end of cycle
184     // do the QA checking
185     AliQAChecker::Instance()->Run(AliQA::kMUON, task, list) ;  
186 }
187
188
189 //____________________________________________________________________________ 
190 void AliMUONQADataMakerSim::StartOfDetectorCycle()
191 {
192     /// Detector specific actions at start of cycle
193   
194 }