]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONQADataMakerRec.cxx
Updated serial number for station 345
[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
bf4d93eb 16// $Id$
17
b1341ab0 18// --- MUON header files ---
19#include "AliMUONQADataMakerRec.h"
04236e67 20
f587a77d 21#include "AliMUON2DMap.h"
04236e67 22#include "AliMUONCluster.h"
b1341ab0 23#include "AliMUONConstants.h"
2346e1ad 24#include "AliMUONDDLTrigger.h"
2346e1ad 25#include "AliMUONDarcHeader.h"
f587a77d 26#include "AliMUONDigitMaker.h"
2346e1ad 27#include "AliMUONLocalStruct.h"
f587a77d 28#include "AliMUONLocalTrigger.h"
29#include "AliMUONRawStreamTracker.h"
30#include "AliMUONRawStreamTrigger.h"
31#include "AliMUONRegHeader.h"
32#include "AliMUONTrackerCalibratedDataMaker.h"
aef183f7 33#include "AliMUONTriggerDisplay.h"
f587a77d 34#include "AliMUONVCluster.h"
35#include "AliMUONVClusterStore.h"
36#include "AliMUONVDigit.h"
37#include "AliMUONVDigitStore.h"
38#include "AliMUONVTrackerData.h"
39#include "AliMUONVTriggerStore.h"
40#include "AliMpCDB.h"
2346e1ad 41#include "AliMpConstants.h"
f587a77d 42#include "AliMpDDLStore.h"
43#include "AliMpDEIterator.h"
44#include "AliMpDEManager.h"
b1341ab0 45#include "AliMpLocalBoard.h"
f587a77d 46#include "AliMpStationType.h"
47#include "AliMpTriggerCrate.h"
48#include "AliRawEventHeaderBase.h"
2346e1ad 49
b1341ab0 50// --- AliRoot header files ---
f587a77d 51#include "AliCDBManager.h"
52#include "AliCDBStorage.h"
b1341ab0 53#include "AliESDEvent.h"
54#include "AliESDMuonTrack.h"
55#include "AliESDMuonCluster.h"
56#include "AliLog.h"
57#include "AliRawReader.h"
58#include "AliQAChecker.h"
f587a77d 59#include "AliCodeTimer.h"
b1341ab0 60
61// --- ROOT system ---
62#include <TClonesArray.h>
63#include <TFile.h>
64#include <TH1F.h>
65#include <TH1I.h>
66#include <TH2F.h>
67#include <TH3F.h>
68#include <TLorentzVector.h>
69#include <Riostream.h>
04236e67 70
71//-----------------------------------------------------------------------------
72/// \class AliMUONQADataMakerRec
73///
74/// MUON base class for quality assurance data (histo) maker
75///
f587a77d 76/// \author C. Finck, D. Stocco, L. Aphecetche
04236e67 77
78/// \cond CLASSIMP
79ClassImp(AliMUONQADataMakerRec)
80/// \endcond
81
82//____________________________________________________________________________
83AliMUONQADataMakerRec::AliMUONQADataMakerRec() :
f587a77d 84AliQADataMakerRec(AliQA::GetDetName(AliQA::kMUON), "MUON Quality Assurance Data Maker"),
85fIsInitRaws(kFALSE),
86fIsInitRecPointsTracker(kFALSE),
87fIsInitRecPointsTrigger(kFALSE),
88fIsInitESDs(kFALSE),
89fDigitStore(0x0),
90fTriggerStore(0x0),
91fDigitMaker(0x0),
92fClusterStore(0x0),
93fTrackerDataMaker(0x0)
04236e67 94{
95 /// ctor
f587a77d 96
97 Ctor();
98}
99
100//____________________________________________________________________________
101void
102AliMUONQADataMakerRec::Ctor()
103{
104 /// Init some members
105 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
106 fDigitMaker = new AliMUONDigitMaker(kTRUE);
04236e67 107}
108
109//____________________________________________________________________________
110AliMUONQADataMakerRec::AliMUONQADataMakerRec(const AliMUONQADataMakerRec& qadm) :
f587a77d 111AliQADataMakerRec(qadm),
112fIsInitRaws(kFALSE),
113fIsInitRecPointsTracker(kFALSE),
114fIsInitRecPointsTrigger(kFALSE),
115fIsInitESDs(kFALSE),
116fDigitStore(0x0),
117fTriggerStore(0x0),
118fDigitMaker(0x0),
119fClusterStore(0x0),
120fTrackerDataMaker(0x0)
04236e67 121{
122 ///copy ctor
123 SetName((const char*)qadm.GetName()) ;
124 SetTitle((const char*)qadm.GetTitle());
7035694f 125
f587a77d 126 // Do not copy the digit store and digit maker, but create its own ones
127
128 Ctor();
129
04236e67 130}
131
132//__________________________________________________________________
133AliMUONQADataMakerRec& AliMUONQADataMakerRec::operator = (const AliMUONQADataMakerRec& qadm )
134{
7035694f 135 /// Assignment operator
136
137 // check assignment to self
138 if (this == &qadm) return *this;
139
140 this->~AliMUONQADataMakerRec();
141 new(this) AliMUONQADataMakerRec(qadm);
142 return *this;
04236e67 143}
144
145//__________________________________________________________________
146AliMUONQADataMakerRec::~AliMUONQADataMakerRec()
147{
148 /// dtor
f587a77d 149
150 AliCodeTimerAuto("");
151
152 delete fDigitStore;
153 delete fTriggerStore;
154 delete fDigitMaker;
155 delete fClusterStore;
156 delete fTrackerDataMaker;
04236e67 157}
158
159//____________________________________________________________________________
92a357bf 160void AliMUONQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray* list)
04236e67 161{
f587a77d 162 ///Detector specific actions at end of cycle
163
164 // Display trigger histos in a more user friendly way
165 DisplayTriggerInfo(task);
166
167 if ( task == AliQA::kRAWS )
168 {
169 TIter next(list);
170 TObject* o;
171 Bool_t alreadyThere(kFALSE);
172 while ( ( o = next() ) && !alreadyThere )
173 {
174 TString classname(o->ClassName());
175 if ( classname.Contains("TrackerData") ) alreadyThere = kTRUE;
176 }
177 if (!alreadyThere) list->AddAt(fTrackerDataMaker->Data(),(Int_t)kTrackerData);
178 }
179
180 // do the QA checking
181 AliQAChecker::Instance()->Run(AliQA::kMUON, task, list) ;
04236e67 182}
183
184//____________________________________________________________________________
185void AliMUONQADataMakerRec::InitRaws()
186{
187 /// create Raws histograms in Raws subdir
f587a77d 188
189 if ( ! AliCDBManager::Instance()->GetDefaultStorage() )
190 {
191 AliError("CDB default storage not set. Cannot work.");
192 fIsInitRaws=kFALSE;
193 }
194
195 TH3F* h3 = new TH3F("hTriggerScalersBendPlane", "Trigger scalers in bending plane",
196 4, 10.5, 14.5,
197 234, 0.5, 234.5,
198 16, -0.5, 15.5);
199 h3->GetXaxis()->SetTitle("Chamber");
200 h3->GetYaxis()->SetTitle("Board");
201 h3->GetZaxis()->SetTitle("Strip");
202 Add2RawsList(h3, kTriggerScalersBP);
203
204 TH3F* h4 = new TH3F("hTriggerScalersNonBendPlane", "Trigger scalers in non-bending plane",
205 4, 10.5, 14.5,
206 234, 0.5, 234.5,
207 16, -0.5, 15.5);
208 h4->GetXaxis()->SetTitle("Chamber");
209 h4->GetYaxis()->SetTitle("Board");
210 h4->GetZaxis()->SetTitle("Strip");
211 Add2RawsList(h4, kTriggerScalersNBP);
212
213 AliMUONTriggerDisplay triggerDisplay;
214 TString histoName, histoTitle;
215 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
216 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
217 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
218 histoName = Form("hScalers%sChamber%i", cathName.Data(), 11+iChamber);
219 histoTitle = Form("Chamber %i: Scalers %s", 11+iChamber, cathName.Data());
220 TH2F* h5 = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips,
221 iCath, iChamber, histoTitle);
222 Add2RawsList(h5, kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
223 }
224 }
225
226 fIsInitRaws = kTRUE;
227}
04236e67 228
f587a77d 229//____________________________________________________________________________
230void AliMUONQADataMakerRec::InitRecPoints()
231{
232 /// create Reconstructed Points histograms in RecPoints subdir
233 InitRecPointsTrigger();
234 InitRecPointsTracker();
235}
236
237//____________________________________________________________________________
238void AliMUONQADataMakerRec::InitRecPointsTracker()
239{
240 /// create Reconstructed Points histograms in RecPoints subdir for the
241 /// MUON tracker subsystem.
242
243 AliMpDEIterator it;
244
245 it.First();
246
247 Int_t ndes(0);
248
249 while ( !it.IsDone())
250 {
251 Int_t detElemId = it.CurrentDEId();
1c66abf3 252
f587a77d 253 it.Next();
04236e67 254
f587a77d 255 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger )
256 {
257 ndes = TMath::Max(ndes,detElemId);
2346e1ad 258
f587a77d 259 TH1* h = new TH1I(Form("hTrackerClusterMultiplicityForDE%04d",detElemId),
260 Form("Multiplicity of the clusters in detection element %d",detElemId),
261 100,0,100);
262
263 h->GetXaxis()->SetTitle("Detection Element Id");
264
265 Add2RecPointsList(h,kTrackerClusterMultiplicityPerDE+detElemId);
266
267 h = new TH1I(Form("hTrackerClusterChargeForDE%04d",detElemId),
268 Form("Charge of the clusters in detection element %d",detElemId),
269 100,0,1000);
2346e1ad 270
f587a77d 271 h->GetXaxis()->SetTitle("Detection Element Id");
272
273 Add2RecPointsList(h,kTrackerClusterChargePerDE+detElemId);
274
275 }
276
277 }
278
279 TH1* h = new TH1I("hTrackerNumberOfClustersPerDE","Number of clusters per detection element",
280 ndes, -0.5, ndes - 0.5);
281
282 h->GetXaxis()->SetTitle("Detection Element Id");
283
284 Add2RecPointsList(h, kTrackerNumberOfClustersPerDE);
285
286 for ( Int_t i = 0; i < AliMpConstants::NofTrackingChambers(); ++i )
287 {
288 TH1* h1 = new TH1I("hTrackerNumberOfClustersPerChamber","Number of clusters per chamber",AliMpConstants::NofTrackingChambers(),-0.5,AliMpConstants::NofTrackingChambers()-0.5);
289 Add2RecPointsList(h1,kTrackerNumberOfClustersPerChamber);
290 h1 = new TH1I(Form("hTrackerClusterMultiplicityForChamber%d",i),
291 Form("Cluster multiplicity for chamber %d",i),
292 100,0,100);
293 Add2RecPointsList(h1,kTrackerClusterMultiplicityPerChamber+i);
294 h1 = new TH1I(Form("hTrackerClusterChargeForChamber%d",i),
295 Form("Cluster charge for chamber %d",i),
296 100,0,1000);
297 Add2RecPointsList(h1,kTrackerClusterChargePerChamber+i);
298 }
299
300 fIsInitRecPointsTracker=kTRUE;
04236e67 301}
302
303//____________________________________________________________________________
f587a77d 304void AliMUONQADataMakerRec::InitRecPointsTrigger()
04236e67 305{
f587a77d 306 /// create Reconstructed Points histograms in RecPoints subdir for the
307 /// MUON Trigger subsystem.
308
2346e1ad 309 TH3F* h0 = new TH3F("hTriggerDigitsBendPlane", "Trigger digits in bending plane",
310 4, 10.5, 14.5,
311 234, 0.5, 234.5,
312 16, -0.5, 15.5);
313 h0->GetXaxis()->SetTitle("Chamber");
314 h0->GetYaxis()->SetTitle("Board");
315 h0->GetZaxis()->SetTitle("Strip");
316 Add2RecPointsList(h0, kTriggerDigitsBendPlane);
317
318 TH3F* h1 = new TH3F("hTriggerDigitsNonBendPlane", "Trigger digits in non-bending plane",
319 4, 10.5, 14.5,
320 234, 0.5, 234.5,
321 16, -0.5, 15.5);
322 h1->GetXaxis()->SetTitle("Chamber");
323 h1->GetYaxis()->SetTitle("Board");
324 h1->GetZaxis()->SetTitle("Strip");
325 Add2RecPointsList(h1, kTriggerDigitsNonBendPlane);
326
327 TH1F* h2 = new TH1F("hTriggeredBoards", "Triggered boards", 234, 0.5, 234.5);
328 Add2RecPointsList(h2, kTriggeredBoards);
329
aef183f7 330 AliMUONTriggerDisplay triggerDisplay;
331 TString histoName, histoTitle;
332 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
333 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
334 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
335 histoName = Form("hTriggerDigits%sChamber%i", cathName.Data(), 11+iChamber);
336 histoTitle = Form("Chamber %i: Fired pads %s", 11+iChamber, cathName.Data());
337 TH2F* h3 = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips,
338 iCath, iChamber, histoTitle);
339 Add2RecPointsList(h3, kTriggerDigitsDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
340 }
341 }
342
343 TH2F* h4 = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards,
344 0, 0, "Fired boards");
345 Add2RecPointsList(h4, kTriggerBoardsDisplay);
f587a77d 346
347 fIsInitRecPointsTrigger = kTRUE;
04236e67 348}
349
350
351//____________________________________________________________________________
352void AliMUONQADataMakerRec::InitESDs()
353{
354 ///create ESDs histograms in ESDs subdir
355 TH1F* h0 = new TH1F("hESDnTracks", "ESDs track number distribution", 30, 0., 30.);
b62881f2 356 Add2ESDsList(h0, kESDnTracks);
04236e67 357
358 TH1F* h1 = new TH1F("hESDMomentum", "ESDs P distribution", 300, 0., 300) ;
b62881f2 359 Add2ESDsList(h1, kESDMomentum);
04236e67 360
361 TH1F* h2 = new TH1F("hESDPt", "ESDs Pt distribution", 200, 0., 50) ;
b62881f2 362 Add2ESDsList(h2, kESDPt);
04236e67 363
364 TH1F* h3 = new TH1F("hESDRapidity", "ESDs rapidity distribution", 200, -4.5,-2.) ;
b62881f2 365 Add2ESDsList(h3, kESDRapidity);
366
367 for (Int_t i = 0; i < AliMUONConstants::NTrackingCh(); ++i)
368 {
369 TH2F* h4 = new TH2F(Form("%s%d", "hESDClusterHitMap", i),
370 Form("%s %d", "ESD Clusters hit distribution for chamber", i),
371 100, -1*AliMUONConstants::Rmax(i/2), AliMUONConstants::Rmax(i/2),
372 100, -1*AliMUONConstants::Rmax(i/2), AliMUONConstants::Rmax(i/2));
373 Add2ESDsList(h4, kESDClusterHitMap+i);
374 }
b1341ab0 375
376 fIsInitESDs = kTRUE;
04236e67 377}
378
379//____________________________________________________________________________
380void AliMUONQADataMakerRec::MakeRaws(AliRawReader* rawReader)
381{
382 /// make QA for rawdata
b1341ab0 383
384 if ( ! fIsInitRaws ) {
385 AliWarningStream()
386 << "Skipping function due to a failure in Init" << endl;
387 return;
388 }
389
f587a77d 390 if ( rawReader->GetType() == AliRawEventHeaderBase::kPhysicsEvent )
391 {
04236e67 392 rawReader->Reset();
f587a77d 393 MakeRawsTracker(rawReader);
394 }
04236e67 395
f587a77d 396 rawReader->Reset();
397 MakeRawsTrigger(rawReader);
398}
2346e1ad 399
f587a77d 400//____________________________________________________________________________
401void AliMUONQADataMakerRec::MakeRawsTracker(AliRawReader* rawReader)
402{
403 /// make QA for rawdata tracker
404
405 if (!fTrackerDataMaker)
406 {
407 const Bool_t histogram(kFALSE);
408 const Bool_t fastDecoder(kTRUE);
409
410// fTrackerDataMaker = new AliMUONTrackerRawDataMaker(rawReader,histogram,fastDecoder,takeRawReaderOwnership);
411
412 fTrackerDataMaker = new AliMUONTrackerCalibratedDataMaker(AliCDBManager::Instance()->GetRun(),
413 rawReader,
414 AliCDBManager::Instance()->GetDefaultStorage()->GetURI(),
415 "NOGAIN",
416 histogram,
417 0.0,0.0,
418 fastDecoder);
419
420 fTrackerDataMaker->Data()->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level
421
422 fTrackerDataMaker->SetRunning(kTRUE);
423 }
424
425 ((AliMUONTrackerCalibratedDataMaker*)fTrackerDataMaker)->SetRawReader(rawReader);
426
427 fTrackerDataMaker->ProcessEvent();
428}
2346e1ad 429
f587a77d 430//____________________________________________________________________________
431void AliMUONQADataMakerRec::MakeRawsTrigger(AliRawReader* rawReader)
432{
433 /// make QA for rawdata trigger
434
2346e1ad 435 // Get trigger scalers
436
437 Int_t loCircuit=0;
438 AliMpCDB::LoadDDLStore();
439
440 AliMUONRawStreamTrigger rawStreamTrig(rawReader);
441 while (rawStreamTrig.NextDDL())
442 {
443 // If not a scaler event, do nothing
444 Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1;
d72d7b9e 445 if(!scalerEvent) break;
2346e1ad 446
447 AliMUONDDLTrigger* ddlTrigger = rawStreamTrig.GetDDLTrigger();
448 AliMUONDarcHeader* darcHeader = ddlTrigger->GetDarcHeader();
449
450 Int_t nReg = darcHeader->GetRegHeaderEntries();
451
452 for(Int_t iReg = 0; iReg < nReg ;iReg++)
453 { //reg loop
454
455 // crate info
456 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->
457 GetTriggerCrate(rawStreamTrig.GetDDL(), iReg);
458
459 AliMUONRegHeader* regHeader = darcHeader->GetRegHeaderEntry(iReg);
460
461 // loop over local structures
462 Int_t nLocal = regHeader->GetLocalEntries();
463 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++)
464 {
465 AliMUONLocalStruct* localStruct = regHeader->GetLocalEntry(iLocal);
466
467 // if card exist
468 if (!localStruct) continue;
469
470 loCircuit = crate->GetLocalBoardId(localStruct->GetId());
471
472 if ( !loCircuit ) continue; // empty slot
473
474 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false);
475
476 // skip copy cards
477 if( !localBoard->IsNotified())
478 continue;
479
480 Int_t cathode = localStruct->GetComptXY()%2;
481
482 ERaw hindex = (cathode==0) ? kTriggerScalersBP : kTriggerScalersNBP;
483
484 // loop over strips
485 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
486 if(localStruct->GetXY1(ibitxy) > 0)
487 ((TH3F*)GetRawsData(hindex))->Fill(11+0, loCircuit, ibitxy, 2*localStruct->GetXY1(ibitxy));
488 if(localStruct->GetXY2(ibitxy) > 0)
489 ((TH3F*)GetRawsData(hindex))->Fill(11+1, loCircuit, ibitxy, 2*localStruct->GetXY2(ibitxy));
490 if(localStruct->GetXY3(ibitxy) > 0)
491 ((TH3F*)GetRawsData(hindex))->Fill(11+2, loCircuit, ibitxy, 2*localStruct->GetXY3(ibitxy));
492 if(localStruct->GetXY4(ibitxy) > 0)
493 ((TH3F*)GetRawsData(hindex))->Fill(11+3, loCircuit, ibitxy, 2*localStruct->GetXY4(ibitxy));
494 } // loop on strips
495 } // iLocal
496 } // iReg
497 } // NextDDL
04236e67 498}
499
500//____________________________________________________________________________
501void AliMUONQADataMakerRec::MakeRecPoints(TTree* clustersTree)
502{
f587a77d 503 /// Fill histograms from treeR
504
505 if (fIsInitRecPointsTracker) MakeRecPointsTracker(clustersTree);
506 if (fIsInitRecPointsTrigger) MakeRecPointsTrigger(clustersTree);
507}
508
509//____________________________________________________________________________
510void AliMUONQADataMakerRec::MakeRecPointsTracker(TTree* clustersTree)
511{
512 /// Fill histograms related to tracker clusters
513
514 // First things first : do we have clusters in the TreeR ?
515 // In "normal" production mode, it should be perfectly normal
516 // *not* to have them.
517 // But if for some reason we de-activated the combined tracking,
518 // then we have clusters in TreeR, so let's take that opportunity
519 // to QA them...
520
521 if (!fClusterStore)
522 {
523 AliCodeTimerAuto("ClusterStore creation");
524 fClusterStore = AliMUONVClusterStore::Create(*clustersTree);
525 if (!fClusterStore)
526 {
527 fIsInitRecPointsTracker = kFALSE;
528 return;
529 }
530 }
531
532 AliCodeTimerAuto("");
533
534 fClusterStore->Connect(*clustersTree,kFALSE);
535 clustersTree->GetEvent(0);
536
537 TIter next(fClusterStore->CreateIterator());
538 AliMUONVCluster* cluster;
539
540 while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) )
541 {
542 Int_t detElemId = cluster->GetDetElemId();
543 Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
544
545 GetRecPointsData(kTrackerNumberOfClustersPerDE)->Fill(detElemId);
546 GetRecPointsData(kTrackerClusterChargePerDE+detElemId)->Fill(cluster->GetCharge());
547 GetRecPointsData(kTrackerClusterMultiplicityPerDE+detElemId)->Fill(cluster->GetNDigits());
b1341ab0 548
f587a77d 549 GetRecPointsData(kTrackerNumberOfClustersPerChamber)->Fill(chamberId);
550 GetRecPointsData(kTrackerClusterChargePerChamber+chamberId)->Fill(cluster->GetCharge());
551 GetRecPointsData(kTrackerClusterMultiplicityPerChamber+chamberId)->Fill(cluster->GetNDigits());
552
553 }
554
555 fClusterStore->Clear();
556}
557
558//____________________________________________________________________________
559void AliMUONQADataMakerRec::MakeRecPointsTrigger(TTree* clustersTree)
560{
561 /// makes data from trigger response
562
7035694f 563 // Fired pads info
564 fDigitStore->Clear();
565
566 if (!fTriggerStore) fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree);
567 fTriggerStore->Clear();
568 fTriggerStore->Connect(*clustersTree, false);
04236e67 569 clustersTree->GetEvent(0);
04236e67 570
7035694f 571 AliMUONLocalTrigger* locTrg;
572 TIter nextLoc(fTriggerStore->CreateLocalIterator());
573
574 while ( ( locTrg = static_cast<AliMUONLocalTrigger*>(nextLoc()) ) )
575 {
576 if (locTrg->IsNull()) continue;
577
578 TArrayS xyPattern[2];
579 locTrg->GetXPattern(xyPattern[0]);
580 locTrg->GetYPattern(xyPattern[1]);
581
582 Int_t nBoard = locTrg->LoCircuit();
2346e1ad 583
d72d7b9e 584 Bool_t xTrig=locTrg->IsTrigX();
585 Bool_t yTrig=locTrg->IsTrigY();
2346e1ad 586
587 if (xTrig && yTrig)
588 ((TH1F*)GetRecPointsData(kTriggeredBoards))->Fill(nBoard);
589
590 fDigitMaker->TriggerDigits(nBoard, xyPattern, *fDigitStore);
7035694f 591 }
04236e67 592
7035694f 593 TIter nextDigit(fDigitStore->CreateIterator());
594 AliMUONVDigit* mDigit;
595 while ( ( mDigit = static_cast<AliMUONVDigit*>(nextDigit()) ) )
04236e67 596 {
7035694f 597 Int_t detElemId = mDigit->DetElemId();
2346e1ad 598 Int_t ch = detElemId/100;
599 Int_t localBoard = mDigit->ManuId();
600 Int_t channel = mDigit->ManuChannel();
7035694f 601 Int_t cathode = mDigit->Cathode();
b62881f2 602 ERecPoints hindex
603 = ( cathode == 0 ) ? kTriggerDigitsBendPlane : kTriggerDigitsNonBendPlane;
604
2346e1ad 605 ((TH3F*)GetRecPointsData(hindex))->Fill(ch, localBoard, channel);
04236e67 606 }
607}
608
609//____________________________________________________________________________
610void AliMUONQADataMakerRec::MakeESDs(AliESDEvent* esd)
611{
612 /// make QA data from ESDs
613
b1341ab0 614 if ( ! fIsInitESDs ) {
615 AliWarningStream()
616 << "Skipping function due to a failure in Init" << endl;
617 return;
618 }
619
04236e67 620 TLorentzVector v1;
621
622 Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ;
623 GetESDsData(0)->Fill(nTracks);
624
625 for (Int_t iTrack = 0; iTrack < nTracks; ++iTrack) {
626
627 AliESDMuonTrack* muonTrack = esd->GetMuonTrack(iTrack);
b1fea02e 628
629 // skip "ghosts"
630 if (!muonTrack->ContainTrackerData()) continue;
631
04236e67 632 muonTrack->LorentzP(v1);
633
634 GetESDsData(1)->Fill(v1.P());
635 GetESDsData(2)->Fill(v1.Pt());
636 GetESDsData(3)->Fill(v1.Rapidity());
b62881f2 637
638 TClonesArray clusters = muonTrack->GetClusters();
639
640 for (Int_t iCluster = 0; iCluster <clusters.GetEntriesFast(); ++iCluster) {
641 AliESDMuonCluster* cluster = (AliESDMuonCluster*)clusters.At(iCluster);
642 GetESDsData(kESDClusterHitMap+cluster->GetChamberId())
643 ->Fill(cluster->GetX(), cluster->GetY());
644 }
04236e67 645 }
646}
647
648//____________________________________________________________________________
649void AliMUONQADataMakerRec::StartOfDetectorCycle()
650{
651 /// Detector specific actions at start of cycle
652
653}
2346e1ad 654
655//____________________________________________________________________________
656void AliMUONQADataMakerRec::DisplayTriggerInfo(AliQA::TASKINDEX_t task)
657{
658 //
659 /// Display trigger information in a user-friendly way:
660 /// from local board and strip numbers to their position on chambers
661 //
662 if(task!=AliQA::kRECPOINTS && task!=AliQA::kRAWS) return;
663
aef183f7 664 AliMUONTriggerDisplay triggerDisplay;
665
2346e1ad 666 TH3F* histoStrips=0x0;
667 TH2F* histoDisplayStrips=0x0;
2346e1ad 668
aef183f7 669 for (Int_t iCath = 0; iCath < AliMpConstants::NofCathodes(); iCath++)
2346e1ad 670 {
2346e1ad 671 if(task==AliQA::kRECPOINTS){
672 ERecPoints hindex
673 = ( iCath == 0 ) ? kTriggerDigitsBendPlane : kTriggerDigitsNonBendPlane;
674 histoStrips = (TH3F*)GetRecPointsData(hindex);
2346e1ad 675 }
676 else if(task==AliQA::kRAWS){
677 ERaw hindex
678 = ( iCath == 0 ) ? kTriggerScalersBP : kTriggerScalersNBP;
679 histoStrips = (TH3F*)GetRawsData(hindex);
680 if(histoStrips->GetEntries()==0) return; // No scalers found
681 }
682
aef183f7 683 for (Int_t iChamber = 0; iChamber < AliMpConstants::NofTriggerChambers(); iChamber++)
2346e1ad 684 {
2346e1ad 685 if(task==AliQA::kRECPOINTS){
aef183f7 686 histoDisplayStrips = (TH2F*)GetRecPointsData(kTriggerDigitsDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
2346e1ad 687 }
688 else if(task==AliQA::kRAWS){
aef183f7 689 histoDisplayStrips = (TH2F*)GetRawsData(kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
2346e1ad 690 }
aef183f7 691 Int_t bin = histoStrips->GetXaxis()->FindBin(11+iChamber);
692 histoStrips->GetXaxis()->SetRange(bin,bin);
693 TH2F* inputHisto = (TH2F*)histoStrips->Project3D("zy");
694 triggerDisplay.FillDisplayHistogram(inputHisto, histoDisplayStrips, AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber);
2346e1ad 695 } // iChamber
696 } // iCath
2346e1ad 697
aef183f7 698 if(task!=AliQA::kRECPOINTS) return;
699 TH1F* histoBoards = (TH1F*)GetRecPointsData(kTriggeredBoards);
700 TH2F* histoDisplayBoards = (TH2F*)GetRecPointsData(kTriggerBoardsDisplay);
701 triggerDisplay.FillDisplayHistogram(histoBoards, histoDisplayBoards, AliMUONTriggerDisplay::kDisplayBoards, 0, 0);
2346e1ad 702}