* provided "as is" without express or implied warranty. *
**************************************************************************/
+// $Id$
-// --- ROOT system ---
-#include <TClonesArray.h>
-#include <TFile.h>
-#include <TH1F.h>
-#include <TH1I.h>
-#include <TH2F.h>
-#include <TH3F.h>
-#include <TLorentzVector.h>
-
-// --- AliRoot header files ---
-#include "AliESDEvent.h"
-#include "AliLog.h"
-#include "AliRawReader.h"
-#include "AliQAChecker.h"
-#include "AliMUONCluster.h"
-#include "AliMUONRawStreamTracker.h"
-#include "AliMUONRawStreamTrigger.h"
-
-#include "AliMUONVClusterStore.h"
-#include "AliMUONVCluster.h"
-#include "AliESDMuonTrack.h"
-
-#include "AliMUONDigitMaker.h"
-#include "AliMUONVDigitStore.h"
-#include "AliMUONVTriggerStore.h"
-#include "AliMUONVDigit.h"
-#include "AliMUONLocalTrigger.h"
-
+// --- MUON header files ---
#include "AliMUONQADataMakerRec.h"
//-----------------------------------------------------------------------------
///
/// MUON base class for quality assurance data (histo) maker
///
-/// \author C. Finck
+/// It is now only a steering class for the two subclasses AliMUONTrackerQADataMakerRec
+/// and AliMUONTriggerQADataMakerRec
+///
+/// \author C. Finck, D. Stocco, L. Aphecetche, A. Blanc
+
+#include "AliDAQ.h"
+#include "AliMUONTrackerQADataMakerRec.h"
+#include "AliMUONTriggerQADataMakerRec.h"
+#include "AliQAChecker.h"
+#include "AliRawReader.h"
+#include "AliRawEventHeaderBase.h"
/// \cond CLASSIMP
ClassImp(AliMUONQADataMakerRec)
/// \endcond
//____________________________________________________________________________
-AliMUONQADataMakerRec::AliMUONQADataMakerRec() :
- AliQADataMakerRec(AliQA::GetDetName(AliQA::kMUON), "MUON Quality Assurance Data Maker"),
- fDigitStore(0x0),
- fTriggerStore(0x0),
- fDigitMaker(0x0)
+AliMUONQADataMakerRec::AliMUONQADataMakerRec(Bool_t tracker, Bool_t trigger) :
+AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kMUON), "MUON Quality Assurance Data Maker"),
+fTracker(tracker ? new AliMUONTrackerQADataMakerRec(this) : 0x0),
+fTrigger(trigger ? new AliMUONTriggerQADataMakerRec(this) : 0x0)
{
- /// ctor
- fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
- fDigitMaker = new AliMUONDigitMaker(kTRUE,kFALSE);
+ /// ctor
+ AliInfo(Form("tracker=%d trigger=%d",tracker,trigger));
+}
+//__________________________________________________________________
+AliMUONQADataMakerRec::~AliMUONQADataMakerRec()
+{
+ /// dtor
+ delete fTracker;
+ delete fTrigger;
}
//____________________________________________________________________________
-AliMUONQADataMakerRec::AliMUONQADataMakerRec(const AliMUONQADataMakerRec& qadm) :
- AliQADataMakerRec(qadm),
- fDigitStore(0x0),
- fTriggerStore(0x0),
- fDigitMaker(0x0)
-{
- ///copy ctor
- SetName((const char*)qadm.GetName()) ;
- SetTitle((const char*)qadm.GetTitle());
-
- // Do not copy the digit store and digit maker, but create its own ones
- fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
- fDigitMaker = new AliMUONDigitMaker(kTRUE,kFALSE);
+Int_t AliMUONQADataMakerRec::Add2List(TH1 * hist, const Int_t index, AliQAv1::TASKINDEX_t task, const Bool_t expert, const Bool_t image, const Bool_t saveForCorr)
+{
+ TObjArray** list = GetList(task);
+ if (list)
+ {
+ return Add2List(hist,index,list,expert,image,saveForCorr);
+ }
+ return -1;
}
-//__________________________________________________________________
-AliMUONQADataMakerRec& AliMUONQADataMakerRec::operator = (const AliMUONQADataMakerRec& qadm )
+//____________________________________________________________________________
+void AliMUONQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list)
{
- /// Assignment operator
-
- // check assignment to self
- if (this == &qadm) return *this;
-
- this->~AliMUONQADataMakerRec();
- new(this) AliMUONQADataMakerRec(qadm);
- return *this;
+ /// Detector specific actions at end of cycle
+ //
+ ResetEventTrigClasses(); // RS
+ //
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
+ {
+ if (! IsValidEventSpecie(specie, list) ) continue;
+
+ SetEventSpecie(AliRecoParam::ConvertIndex(specie)); // needed by the GetXXXData methods
+
+ if ( task == AliQAv1::kRAWS )
+ {
+ if ( fTracker ) fTracker->EndOfDetectorCycleRaws(specie,list);
+ if ( fTrigger ) fTrigger->EndOfDetectorCycleRaws(specie,list);
+ }
+ else if ( task == AliQAv1::kRECPOINTS )
+ {
+ // normalize recpoints histograms
+ if ( fTracker ) fTracker->EndOfDetectorCycleRecPoints(specie,list);
+ if ( fTrigger ) fTrigger->EndOfDetectorCycleRecPoints(specie,list);
+ }
+ else if ( task == AliQAv1::kESDS )
+ {
+ // normalize esds histograms
+ if ( fTracker ) fTracker->EndOfDetectorCycleESDs(specie,list);
+ if ( fTrigger ) fTrigger->EndOfDetectorCycleESDs(specie,list);
+ }
+ else if ( task == AliQAv1::kDIGITSR )
+ {
+ if ( fTracker ) fTracker->EndOfDetectorCycleDigits(specie,list);
+ if ( fTrigger ) fTrigger->EndOfDetectorCycleDigits(specie,list);
+ }
+ else
+ {
+ AliFatal(Form("Not implemented for task %s",AliQAv1::GetTaskName(task).Data()));
+ }
+ } // loop on specie
+
+ // do the QA checking
+ AliQAChecker::Instance()->Run(AliQAv1::kMUON,task,list,const_cast<AliDetectorRecoParam*>(GetRecoParam()));
}
-//__________________________________________________________________
-AliMUONQADataMakerRec::~AliMUONQADataMakerRec()
+//____________________________________________________________________________
+TObject* AliMUONQADataMakerRec::GetData(AliQAv1::TASKINDEX_t task, const Int_t index)
{
- /// dtor
- delete fDigitStore;
- delete fTriggerStore;
- delete fDigitMaker;
+ TObjArray** list = GetList(task);
+ if (list) return GetData(list,index);
+ return 0x0;
}
//____________________________________________________________________________
-void AliMUONQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray* list)
+TObjArray** AliMUONQADataMakerRec::GetList(AliQAv1::TASKINDEX_t task)
{
- ///Detector specific actions at end of cycle
- // do the QA checking
- AliQAChecker::Instance()->Run(AliQA::kMUON, task, list) ;
+ // enum TASKINDEX_t {
+ // kNULLTASKINDEX=-1, kRAWS, kHITS, kSDIGITS, kDIGITS, kDIGITSR, kRECPOINTS, kTRACKSEGMENTS, kRECPARTICLES, kESDS, kNTASKINDEX };
+ if ( task == AliQAv1::kRAWS )
+ {
+ return fRawsQAList;
+ }
+ else if ( task == AliQAv1::kDIGITS || task == AliQAv1::kDIGITSR )
+ {
+ return fDigitsQAList;
+ }
+ else if ( task == AliQAv1::kRECPOINTS )
+ {
+ return fRecPointsQAList;
+ }
+ else
+ {
+ AliFatal(Form("task %s not supported here yet",AliQAv1::GetTaskName(task).Data()));
+ }
+ return 0x0;
}
//____________________________________________________________________________
void AliMUONQADataMakerRec::InitRaws()
{
- /// create Raws histograms in Raws subdir
- TH1I* h0 = new TH1I("hRawBusPatch", "buspatch distribution", 1932, 1, 1932);
- Add2RawsList(h0, 0);
-
- TH1I* h1 = new TH1I("hRawCharge", "Charge distribution in rawdata", 4096, 0, 4095);
- Add2RawsList(h1, 1);
-
+ /// create Raws histograms in Raws subdir
+
+ if ( fTracker ) fTracker->InitRaws();
+ if ( fTrigger ) fTrigger->InitRaws();
+ //
+ ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
}
+//__________________________________________________________________
+void AliMUONQADataMakerRec::InitDigits()
+{
+ /// Initialized Digits spectra
+ if ( fTracker ) fTracker->InitDigits();
+ if ( fTrigger ) fTrigger->InitDigits();
+ //
+ ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
+}
+
//____________________________________________________________________________
void AliMUONQADataMakerRec::InitRecPoints()
{
- /// create Reconstructed Points histograms in RecPoints subdir
- TH3F *h2 = new TH3F("hTriggerDigitsBendPlane", "Trigger digits in bending plane",
- 4, -0.5, 4. - 0.5,
- 18, -0.5, 18. - 0.5,
- 7*64, -0.5, 7.*64. - 0.5);
- Add2RecPointsList(h2, 0);
-
- TH3F *h3 = new TH3F("hTriggerDigitsNonBendPlane", "Trigger digits in non-bending plane",
- 4, -0.5, 4. - 0.5,
- 18, -0.5, 18. - 0.5,
- 112, -0.5, 112. - 0.5);
- Add2RecPointsList(h3, 1);
+ /// create Reconstructed Points histograms in RecPoints subdir
+ if ( fTracker ) fTracker->InitRecPoints();
+ if ( fTrigger ) fTrigger->InitRecPoints();
+ //
+ ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
}
//____________________________________________________________________________
void AliMUONQADataMakerRec::InitESDs()
{
- ///create ESDs histograms in ESDs subdir
- TH1F* h0 = new TH1F("hESDnTracks", "ESDs track number distribution", 30, 0., 30.);
- Add2ESDsList(h0, 0);
-
- TH1F* h1 = new TH1F("hESDMomentum", "ESDs P distribution", 300, 0., 300) ;
- Add2ESDsList(h1, 1);
-
- TH1F* h2 = new TH1F("hESDPt", "ESDs Pt distribution", 200, 0., 50) ;
- Add2ESDsList(h2, 2) ;
-
- TH1F* h3 = new TH1F("hESDRapidity", "ESDs rapidity distribution", 200, -4.5,-2.) ;
- Add2ESDsList(h3, 3) ;
+ ///create ESDs histograms in ESDs subdir
+ if ( fTracker ) fTracker->InitESDs();
+ if ( fTrigger ) fTrigger->InitESDs();
+ //
+ ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
}
//____________________________________________________________________________
void AliMUONQADataMakerRec::MakeRaws(AliRawReader* rawReader)
{
- /// make QA for rawdata
- Int_t busPatchId;
- UShort_t manuId;
- UChar_t channelId;
- UShort_t charge;
-
- rawReader->Reset();
- AliMUONRawStreamTracker rawStream(rawReader);
- rawStream.First();
- while( rawStream.Next(busPatchId, manuId, channelId, charge) ) {
+ /// make QA for rawdata
+ /// Note that we do not call the sub-datamaker MakeRaws method
+ /// for events where the MCH or MTR is not part of the readout...
+
+ if ( !rawReader || !rawReader->GetDetectorPattern() ) return;
+
+ UInt_t clmask = rawReader->GetDetectorPattern()[0];
+
+ if ( fTracker && rawReader->GetType() == AliRawEventHeaderBase::kPhysicsEvent )
+ {
+ UInt_t mchMask = AliDAQ::DetectorPattern(" MUONTRK ");
+ if ( clmask & mchMask )
+ {
+ rawReader->Reset();
+ fTracker->MakeRaws(rawReader);
+ }
+ }
- GetRawsData(0)->Fill(busPatchId);
- GetRawsData(1)->Fill(charge);
-
- } // Next digit
+ if ( fTrigger && (rawReader->GetType() == AliRawEventHeaderBase::kPhysicsEvent ||
+ rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent ) )
+ {
+ UInt_t mtrMask = AliDAQ::DetectorPattern(" MUONTRG ");
+ if ( clmask & mtrMask )
+ {
+ rawReader->Reset();
+ fTrigger->MakeRaws(rawReader);
+ }
+ }
+ //
+ IncEvCountCycleRaws();
+ IncEvCountTotalRaws();
+ //
}
-//____________________________________________________________________________
-void AliMUONQADataMakerRec::MakeRecPoints(TTree* clustersTree)
+//__________________________________________________________________
+void AliMUONQADataMakerRec::MakeDigits()
{
+ /// makes data from Digits
- /// makes data from trigger response
-
- // Fired pads info
- fDigitStore->Clear();
+ AliFatal("Not implemented");
+}
- if (!fTriggerStore) fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree);
- fTriggerStore->Clear();
- fTriggerStore->Connect(*clustersTree, false);
- clustersTree->GetEvent(0);
+//__________________________________________________________________
+void AliMUONQADataMakerRec::MakeDigits(TTree* digitsTree)
+{
+ /// makes data from Digits
- AliMUONLocalTrigger* locTrg;
- TIter nextLoc(fTriggerStore->CreateLocalIterator());
+ // Do nothing in case of calibration event
+ if ( GetEventSpecie() == AliRecoParam::kCalib ) return;
- while ( ( locTrg = static_cast<AliMUONLocalTrigger*>(nextLoc()) ) )
- {
- if (locTrg->IsNull()) continue;
-
- TArrayS xyPattern[2];
- locTrg->GetXPattern(xyPattern[0]);
- locTrg->GetYPattern(xyPattern[1]);
-
- Int_t nBoard = locTrg->LoCircuit();
- fDigitMaker->TriggerDigits(nBoard, xyPattern, *fDigitStore);
- }
+ if ( fTracker ) fTracker->MakeDigits(digitsTree);
+ if ( fTrigger ) fTrigger->MakeDigits(digitsTree);
+ //
+ IncEvCountCycleDigits();
+ IncEvCountTotalDigits();
+ //
+}
- TIter nextDigit(fDigitStore->CreateIterator());
- AliMUONVDigit* mDigit;
- while ( ( mDigit = static_cast<AliMUONVDigit*>(nextDigit()) ) )
- {
- Int_t detElemId = mDigit->DetElemId();
- Int_t ch = detElemId/100 - 11;
- Int_t slat = detElemId%100;
- Int_t cathode = mDigit->Cathode();
- Int_t ix = mDigit->PadX();
- Int_t iy = mDigit->PadY();
- Int_t maxY = (cathode==0) ? 64 : 1;
- Int_t currPair = ix*maxY + iy;
- ((TH3F*)GetRecPointsData(cathode))->Fill(ch, slat, currPair);
- }
+//____________________________________________________________________________
+void AliMUONQADataMakerRec::MakeRecPoints(TTree* clustersTree)
+{
+ /// Fill histograms from treeR
+
+ // Do nothing in case of calibration event
+ if ( GetEventSpecie() == AliRecoParam::kCalib ) return;
+
+ if ( fTracker ) fTracker->MakeRecPoints(clustersTree);
+ if ( fTrigger ) fTrigger->MakeRecPoints(clustersTree);
+ //
+ IncEvCountCycleRecPoints();
+ IncEvCountTotalRecPoints();
+ //
}
//____________________________________________________________________________
void AliMUONQADataMakerRec::MakeESDs(AliESDEvent* esd)
{
- /// make QA data from ESDs
-
- TLorentzVector v1;
-
- Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ;
- GetESDsData(0)->Fill(nTracks);
+ /// make QA data from ESDs
- for (Int_t iTrack = 0; iTrack < nTracks; ++iTrack) {
-
- AliESDMuonTrack* muonTrack = esd->GetMuonTrack(iTrack);
- muonTrack->LorentzP(v1);
+ // Do nothing in case of calibration event
+ if ( GetEventSpecie() == AliRecoParam::kCalib ) return;
+
+ if ( fTracker ) fTracker->MakeESDs(esd);
+ if ( fTrigger ) fTrigger->MakeESDs(esd);
+ //
+ IncEvCountCycleESDs();
+ IncEvCountTotalESDs();
+ //
+ }
- GetESDsData(1)->Fill(v1.P());
- GetESDsData(2)->Fill(v1.Pt());
- GetESDsData(3)->Fill(v1.Rapidity());
+//____________________________________________________________________________
+void AliMUONQADataMakerRec::ResetDetector(AliQAv1::TASKINDEX_t task)
+{
+ /// Reset internals
+
+ for (int spec = 0; spec < AliRecoParam::kNSpecies; ++spec)
+ {
+ if (!AliQAv1::Instance()->IsEventSpecieSet(AliRecoParam::ConvertIndex(spec)))
+ continue;
+
+ if ( task == AliQAv1::kRAWS )
+ {
+ if (fTracker) fTracker->ResetDetectorRaws(fRawsQAList[spec]);
+ if (fTrigger) fTrigger->ResetDetectorRaws(fRawsQAList[spec]);
+ }
+ else if ( task == AliQAv1::kRECPOINTS )
+ {
+ if (fTracker) fTracker->ResetDetectorRecPoints(fRecPointsQAList[spec]);
+ if (fTrigger) fTrigger->ResetDetectorRecPoints(fRecPointsQAList[spec]);
+ }
+ else if ( task == AliQAv1::kESDS )
+ {
+ if (fTracker) fTracker->ResetDetectorESDs(fESDsQAList[spec]);
+ if (fTrigger) fTrigger->ResetDetectorESDs(fESDsQAList[spec]);
+ }
+ else if ( task == AliQAv1::kDIGITS )
+ {
+ if (fTracker) fTracker->ResetDetectorDigits(fDigitsQAList[spec]);
+ if (fTrigger) fTrigger->ResetDetectorDigits(fDigitsQAList[spec]);
+ }
+ else
+ {
+ AliFatal(Form("Not implemented for task %s",AliQAv1::GetTaskName(task).Data()));
}
+ }
}
//____________________________________________________________________________
void AliMUONQADataMakerRec::StartOfDetectorCycle()
{
- /// Detector specific actions at start of cycle
+ /// Detector specific actions at start of cycle
}