]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONQADataMakerRec.cxx
Moving the trigger digit info from AliMUONTrackHitPattern into QA.
[u/mrichter/AliRoot.git] / MUON / AliMUONQADataMakerRec.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
16
17// --- ROOT system ---
18#include <TClonesArray.h>
19#include <TFile.h>
20#include <TH1F.h>
21#include <TH1I.h>
7035694f 22#include <TH2F.h>
23#include <TH3F.h>
04236e67 24#include <TLorentzVector.h>
25
26// --- AliRoot header files ---
27#include "AliESDEvent.h"
28#include "AliLog.h"
29#include "AliRawReader.h"
30#include "AliQAChecker.h"
31#include "AliMUONCluster.h"
32#include "AliMUONRawStreamTracker.h"
33#include "AliMUONRawStreamTrigger.h"
34
35#include "AliMUONVClusterStore.h"
36#include "AliMUONVCluster.h"
37#include "AliESDMuonTrack.h"
38
7035694f 39#include "AliMUONDigitMaker.h"
40#include "AliMUONVDigitStore.h"
41#include "AliMUONVTriggerStore.h"
42#include "AliMUONVDigit.h"
43#include "AliMUONLocalTrigger.h"
44
04236e67 45#include "AliMUONQADataMakerRec.h"
46
47//-----------------------------------------------------------------------------
48/// \class AliMUONQADataMakerRec
49///
50/// MUON base class for quality assurance data (histo) maker
51///
52/// \author C. Finck
53
54/// \cond CLASSIMP
55ClassImp(AliMUONQADataMakerRec)
56/// \endcond
57
58//____________________________________________________________________________
59AliMUONQADataMakerRec::AliMUONQADataMakerRec() :
60 AliQADataMakerRec(AliQA::GetDetName(AliQA::kMUON), "MUON Quality Assurance Data Maker"),
7035694f 61 fDigitStore(0x0),
62 fTriggerStore(0x0),
63 fDigitMaker(0x0)
04236e67 64{
65 /// ctor
7035694f 66 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
67 fDigitMaker = new AliMUONDigitMaker(kTRUE,kFALSE);
68
04236e67 69}
70
71//____________________________________________________________________________
72AliMUONQADataMakerRec::AliMUONQADataMakerRec(const AliMUONQADataMakerRec& qadm) :
7035694f 73 AliQADataMakerRec(qadm),
74 fDigitStore(0x0),
75 fTriggerStore(0x0),
76 fDigitMaker(0x0)
04236e67 77{
78 ///copy ctor
79 SetName((const char*)qadm.GetName()) ;
80 SetTitle((const char*)qadm.GetTitle());
7035694f 81
82 // Do not copy the digit store and digit maker, but create its own ones
83 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
84 fDigitMaker = new AliMUONDigitMaker(kTRUE,kFALSE);
04236e67 85}
86
87//__________________________________________________________________
88AliMUONQADataMakerRec& AliMUONQADataMakerRec::operator = (const AliMUONQADataMakerRec& qadm )
89{
7035694f 90 /// Assignment operator
91
92 // check assignment to self
93 if (this == &qadm) return *this;
94
95 this->~AliMUONQADataMakerRec();
96 new(this) AliMUONQADataMakerRec(qadm);
97 return *this;
04236e67 98}
99
100//__________________________________________________________________
101AliMUONQADataMakerRec::~AliMUONQADataMakerRec()
102{
103 /// dtor
7035694f 104 delete fDigitStore;
105 delete fTriggerStore;
106 delete fDigitMaker;
04236e67 107}
108
109//____________________________________________________________________________
110void AliMUONQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray* list)
111{
112 ///Detector specific actions at end of cycle
113 // do the QA checking
114 AliQAChecker::Instance()->Run(AliQA::kMUON, task, list) ;
115}
116
117//____________________________________________________________________________
118void AliMUONQADataMakerRec::InitRaws()
119{
120 /// create Raws histograms in Raws subdir
121 TH1I* h0 = new TH1I("hRawBusPatch", "buspatch distribution", 1932, 1, 1932);
122 Add2RawsList(h0, 0);
123
124 TH1I* h1 = new TH1I("hRawCharge", "Charge distribution in rawdata", 4096, 0, 4095);
125 Add2RawsList(h1, 1);
126
127}
128
129//____________________________________________________________________________
130void AliMUONQADataMakerRec::InitRecPoints()
131{
132 /// create Reconstructed Points histograms in RecPoints subdir
7035694f 133 TH3F *h2 = new TH3F("hTriggerDigitsBendPlane", "Trigger digits in bending plane",
134 4, -0.5, 4. - 0.5,
135 18, -0.5, 18. - 0.5,
136 7*64, -0.5, 7.*64. - 0.5);
137 Add2RecPointsList(h2, 0);
138
139 TH3F *h3 = new TH3F("hTriggerDigitsNonBendPlane", "Trigger digits in non-bending plane",
140 4, -0.5, 4. - 0.5,
141 18, -0.5, 18. - 0.5,
142 112, -0.5, 112. - 0.5);
143 Add2RecPointsList(h3, 1);
04236e67 144}
145
146
147//____________________________________________________________________________
148void AliMUONQADataMakerRec::InitESDs()
149{
150 ///create ESDs histograms in ESDs subdir
151 TH1F* h0 = new TH1F("hESDnTracks", "ESDs track number distribution", 30, 0., 30.);
152 Add2ESDsList(h0, 0);
153
154 TH1F* h1 = new TH1F("hESDMomentum", "ESDs P distribution", 300, 0., 300) ;
155 Add2ESDsList(h1, 1);
156
157 TH1F* h2 = new TH1F("hESDPt", "ESDs Pt distribution", 200, 0., 50) ;
158 Add2ESDsList(h2, 2) ;
159
160 TH1F* h3 = new TH1F("hESDRapidity", "ESDs rapidity distribution", 200, -4.5,-2.) ;
161 Add2ESDsList(h3, 3) ;
162}
163
164//____________________________________________________________________________
165void AliMUONQADataMakerRec::MakeRaws(AliRawReader* rawReader)
166{
167 /// make QA for rawdata
168 Int_t busPatchId;
169 UShort_t manuId;
170 UChar_t channelId;
171 UShort_t charge;
172
173 rawReader->Reset();
174 AliMUONRawStreamTracker rawStream(rawReader);
175 rawStream.First();
176 while( rawStream.Next(busPatchId, manuId, channelId, charge) ) {
177
178 GetRawsData(0)->Fill(busPatchId);
179 GetRawsData(1)->Fill(charge);
180
181 } // Next digit
04236e67 182}
183
184//____________________________________________________________________________
185void AliMUONQADataMakerRec::MakeRecPoints(TTree* clustersTree)
186{
187
7035694f 188 /// makes data from trigger response
189
190 // Fired pads info
191 fDigitStore->Clear();
192
193 if (!fTriggerStore) fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree);
194 fTriggerStore->Clear();
195 fTriggerStore->Connect(*clustersTree, false);
04236e67 196 clustersTree->GetEvent(0);
04236e67 197
7035694f 198 AliMUONLocalTrigger* locTrg;
199 TIter nextLoc(fTriggerStore->CreateLocalIterator());
200
201 while ( ( locTrg = static_cast<AliMUONLocalTrigger*>(nextLoc()) ) )
202 {
203 if (locTrg->IsNull()) continue;
204
205 TArrayS xyPattern[2];
206 locTrg->GetXPattern(xyPattern[0]);
207 locTrg->GetYPattern(xyPattern[1]);
208
209 Int_t nBoard = locTrg->LoCircuit();
210 fDigitMaker->TriggerDigits(nBoard, xyPattern, *fDigitStore);
211 }
04236e67 212
7035694f 213 TIter nextDigit(fDigitStore->CreateIterator());
214 AliMUONVDigit* mDigit;
215 while ( ( mDigit = static_cast<AliMUONVDigit*>(nextDigit()) ) )
04236e67 216 {
7035694f 217 Int_t detElemId = mDigit->DetElemId();
218 Int_t ch = detElemId/100 - 11;
219 Int_t slat = detElemId%100;
220 Int_t cathode = mDigit->Cathode();
221 Int_t ix = mDigit->PadX();
222 Int_t iy = mDigit->PadY();
223 Int_t maxY = (cathode==0) ? 64 : 1;
224 Int_t currPair = ix*maxY + iy;
225 ((TH3F*)GetRecPointsData(cathode))->Fill(ch, slat, currPair);
04236e67 226 }
227}
228
229//____________________________________________________________________________
230void AliMUONQADataMakerRec::MakeESDs(AliESDEvent* esd)
231{
232 /// make QA data from ESDs
233
234 TLorentzVector v1;
235
236 Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ;
237 GetESDsData(0)->Fill(nTracks);
238
239 for (Int_t iTrack = 0; iTrack < nTracks; ++iTrack) {
240
241 AliESDMuonTrack* muonTrack = esd->GetMuonTrack(iTrack);
242 muonTrack->LorentzP(v1);
243
244 GetESDsData(1)->Fill(v1.P());
245 GetESDsData(2)->Fill(v1.Pt());
246 GetESDsData(3)->Fill(v1.Rapidity());
247 }
248}
249
250//____________________________________________________________________________
251void AliMUONQADataMakerRec::StartOfDetectorCycle()
252{
253 /// Detector specific actions at start of cycle
254
255}