Upgrading the raw data QA for tracker, and introducing the first
authorlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 Jul 2008 17:33:01 +0000 (17:33 +0000)
committerlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 Jul 2008 17:33:01 +0000 (17:33 +0000)
version of a real checker (again, only for raw data for the moment)
that cuts on the manu occupancy level.

MUON/AliMUONQAChecker.cxx
MUON/AliMUONQAChecker.h
MUON/AliMUONQADataMakerRec.cxx
MUON/AliMUONQADataMakerRec.h

index 55f76b0..4ee5e3b 100644 (file)
 
 // $Id$
 
-#include "AliQAChecker.h"
 #include "AliMUONQAChecker.h"
 
-//-----------------------------------------------------------------------------
 /// \class AliMUONQAChecker
 ///
-/// MUON base class for quality assurance checker
+/// Implementation of AliQACheckerBase for MCH and MTR
 ///
-/// \author C. Finck
-//-----------------------------------------------------------------------------
+/// For the moment we only implement the checking of raw data QA for the tracker
+/// by looking at the occupancy at the manu level.
+/// We count the number of manus above a given occupancy threshold, and
+/// depending on that number, the resulting QA flag is warning, error or fatal.
+/// (there's no "info" type in this case).
+///
+/// \author Laurent Aphecetche, Subatech
+
+#include "AliQA.h"
+#include "AliMUONVTrackerData.h"
+#include "AliMpManuIterator.h"
+#include <TDirectory.h>
 
 /// \cond CLASSIMP
 ClassImp(AliMUONQAChecker)
@@ -34,22 +42,20 @@ ClassImp(AliMUONQAChecker)
 AliMUONQAChecker::AliMUONQAChecker() : 
     AliQACheckerBase("MUON","MUON Quality Assurance Data Maker") 
 {
-/// ctor
-
+       /// ctor
 }          
 
 //__________________________________________________________________
 AliMUONQAChecker::~AliMUONQAChecker() 
 {
-/// dtor
+       /// dtor
 }
 
 //__________________________________________________________________
 AliMUONQAChecker::AliMUONQAChecker(const AliMUONQAChecker& qac) : 
     AliQACheckerBase(qac.GetName(), qac.GetTitle()) 
 {
-/// copy ctor 
-
+       /// copy ctor 
 }   
 
 //__________________________________________________________________
@@ -59,3 +65,119 @@ AliMUONQAChecker& AliMUONQAChecker::operator = (const AliMUONQAChecker& /*qac*/
     return *this;
 }
 
+//______________________________________________________________________________
+const Double_t 
+AliMUONQAChecker::Check(AliQA::ALITASK_t /*index*/)
+{
+  /// Check data
+  
+  AliError(Form("This method is not implemented. Should it be ? fDataSubDir = %p (%s)",
+                fDataSubDir, ( fDataSubDir ? fDataSubDir->GetPath() : "")));
+  return 0.0;
+}
+
+//______________________________________________________________________________
+const Double_t 
+AliMUONQAChecker::Check(AliQA::ALITASK_t index, TObjArray * list)
+{
+  /// Check objects in list
+  
+  if ( index == AliQA::kRAW ) 
+  {
+    return CheckRaws(list);
+  }
+  
+  AliWarning(Form("Checker for task %d not implement for the moment",index));
+  return 0.0;
+}
+
+//______________________________________________________________________________
+const Double_t 
+AliMUONQAChecker::CheckRaws(TObjArray * list)
+{
+       TIter next(list);
+       TObject* object;
+       AliMUONVTrackerData* data(0x0);
+  
+       while ( (object=next()) && !data )
+       {
+               if (object->InheritsFrom("AliMUONVTrackerData"))
+               {
+                       data = static_cast<AliMUONVTrackerData*>(object);
+               }
+       }
+
+  if ( !data ) 
+  {
+    AliError("Did not find TrackerData in the list !");
+    return 0.0;
+  }
+  
+  AliMpManuIterator it;
+  Int_t detElemId;
+  Int_t manuId;
+  Int_t n50(0); // number of manus with occupancy above 0.5
+  Int_t n75(0); // number of manus with occupancy above 0.75
+  Int_t n(0); // number of manus with some occupancy
+  
+  while ( it.Next(detElemId,manuId) )
+  {
+    Float_t occ = data->Manu(detElemId,manuId,2);
+    if (occ > 0 ) ++n;
+    if (occ >= 0.5 ) ++n50;
+    if (occ >= 0.75 ) ++n75;    
+  }
+
+  AliInfo(Form("n %d n50 %d n75 %d",n,n50,n75));
+  
+  if ( n == 0 ) 
+  {
+    AliError("Oups. Got zero occupancy in all manus ?!");
+    return 0.0;
+  }
+
+  if ( n75 ) 
+  {
+    AliError(Form("Got %d manus with occupancy above 0.75",n75));
+    return 0.1;
+  }
+    
+  if ( n50 ) 
+  {
+    AliWarning(Form("Got %d manus with occupancy above 0.5",n50));
+    return 0.9;
+  }
+
+       return 1.0;
+}
+
+//______________________________________________________________________________
+void 
+AliMUONQAChecker::SetQA(AliQA::ALITASK_t index, const Double_t value) const
+{
+       // sets the QA according the return value of the Check
+
+  AliQA * qa = AliQA::Instance(index);
+  
+  qa->UnSet(AliQA::kFATAL);
+  qa->UnSet(AliQA::kWARNING);
+  qa->UnSet(AliQA::kERROR);
+  qa->UnSet(AliQA::kINFO);
+  
+  if ( value == 1.0 ) 
+  {
+    qa->Set(AliQA::kINFO);
+  }
+  else if ( value == 0.0 )
+  {
+    qa->Set(AliQA::kFATAL);
+  }
+  else if ( value > 0.5 ) 
+  {
+    qa->Set(AliQA::kWARNING);
+  }
+  else
+  {
+    qa->Set(AliQA::kERROR);
+  }
+}
\ No newline at end of file
index cdef58b..172dc41 100644 (file)
@@ -7,11 +7,9 @@
 
 /// \ingroup rec 
 /// \class AliMUONQAChecker
-/// \brief MUON quality assurance checker
+/// \brief Implementation of AliQACheckerBase for MCH and MTR
 ///
-//  Author: Christian Finck
-
-
+//  Author: Laurent Aphecetche
 
 // --- AliRoot header files ---
 #include "AliQACheckerBase.h"
@@ -24,6 +22,14 @@ public:
   AliMUONQAChecker& operator=(const AliMUONQAChecker& qac);
   virtual ~AliMUONQAChecker();
 
+protected:
+
+       virtual const Double_t Check(AliQA::ALITASK_t index) ;
+  virtual const Double_t Check(AliQA::ALITASK_t index, TObjArray * list) ;
+  virtual void SetQA(AliQA::ALITASK_t index, const Double_t value) const ;     
+       
+  const Double_t CheckRaws(TObjArray* list);
+  
 private:
   
   ClassDef(AliMUONQAChecker,1)  // MUON quality assurance checker
index 8a6eb8b..cf9181a 100644 (file)
 // --- MUON header files ---
 #include "AliMUONQADataMakerRec.h"
 
+#include "AliMUON2DMap.h"
 #include "AliMUONCluster.h"  
-#include "AliMUONRawStreamTracker.h"
-#include "AliMUONRawStreamTrigger.h"
 #include "AliMUONConstants.h"  
-#include "AliMUONVClusterStore.h"
-#include "AliMUONVCluster.h"
-
-#include "AliMUONDigitMaker.h"
-#include "AliMUONVDigitStore.h"
-#include "AliMUONVTriggerStore.h"
-#include "AliMUONVDigit.h"
-#include "AliMUONLocalTrigger.h"
-
 #include "AliMUONDDLTrigger.h"
-#include "AliMUONRegHeader.h"
 #include "AliMUONDarcHeader.h"
+#include "AliMUONDigitMaker.h"
 #include "AliMUONLocalStruct.h"
-
+#include "AliMUONLocalTrigger.h"
+#include "AliMUONRawStreamTracker.h"
+#include "AliMUONRawStreamTrigger.h"
+#include "AliMUONRegHeader.h"
+#include "AliMUONTrackerCalibratedDataMaker.h"
 #include "AliMUONTriggerDisplay.h"
-
-#include "AliMpDDLStore.h"
+#include "AliMUONVCluster.h"
+#include "AliMUONVClusterStore.h"
+#include "AliMUONVDigit.h"
+#include "AliMUONVDigitStore.h"
+#include "AliMUONVTrackerData.h"
+#include "AliMUONVTriggerStore.h"
+#include "AliMpCDB.h"
 #include "AliMpConstants.h"
-#include "AliMpBusPatch.h"
-#include "AliMpTriggerCrate.h"
+#include "AliMpDDLStore.h"
+#include "AliMpDEIterator.h"
+#include "AliMpDEManager.h"
 #include "AliMpLocalBoard.h"
-#include "AliMpCDB.h"
+#include "AliMpStationType.h"
+#include "AliMpTriggerCrate.h"
+#include "AliRawEventHeaderBase.h"
 
 // --- AliRoot header files ---
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
 #include "AliESDEvent.h"
 #include "AliESDMuonTrack.h"
 #include "AliESDMuonCluster.h"
 #include "AliLog.h"
 #include "AliRawReader.h"
 #include "AliQAChecker.h"
+#include "AliCodeTimer.h"
 
 // --- ROOT system ---
 #include <TClonesArray.h>
@@ -68,7 +73,7 @@
 ///
 /// MUON base class for quality assurance data (histo) maker
 ///
-/// \author C. Finck
+/// \author C. Finck, D. Stocco, L. Aphecetche
 
 /// \cond CLASSIMP
 ClassImp(AliMUONQADataMakerRec)
@@ -76,36 +81,52 @@ ClassImp(AliMUONQADataMakerRec)
            
 //____________________________________________________________________________ 
 AliMUONQADataMakerRec::AliMUONQADataMakerRec() : 
-    AliQADataMakerRec(AliQA::GetDetName(AliQA::kMUON), "MUON Quality Assurance Data Maker"),
-    fIsInitRaws(kFALSE),
-    fIsInitRecPoints(kFALSE),
-    fIsInitESDs(kFALSE),
-    fDigitStore(0x0),
-    fTriggerStore(0x0),
-    fDigitMaker(0x0)
+AliQADataMakerRec(AliQA::GetDetName(AliQA::kMUON), "MUON Quality Assurance Data Maker"),
+fIsInitRaws(kFALSE),
+fIsInitRecPointsTracker(kFALSE),
+fIsInitRecPointsTrigger(kFALSE),
+fIsInitESDs(kFALSE),
+fDigitStore(0x0),
+fTriggerStore(0x0),
+fDigitMaker(0x0),
+fClusterStore(0x0),
+fTrackerDataMaker(0x0)
 {
     /// ctor
-  fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
-  fDigitMaker = new AliMUONDigitMaker(kTRUE);
+       
+       Ctor();
+}
+
+//____________________________________________________________________________ 
+void
+AliMUONQADataMakerRec::Ctor()
+{
+       /// Init some members
+       fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
+       fDigitMaker = new AliMUONDigitMaker(kTRUE);
 }
 
 //____________________________________________________________________________ 
 AliMUONQADataMakerRec::AliMUONQADataMakerRec(const AliMUONQADataMakerRec& qadm) :
-    AliQADataMakerRec(qadm),
-    fIsInitRaws(kFALSE),
-    fIsInitRecPoints(kFALSE),
-    fIsInitESDs(kFALSE),
-    fDigitStore(0x0),
-    fTriggerStore(0x0),
-    fDigitMaker(0x0)
+AliQADataMakerRec(qadm),
+fIsInitRaws(kFALSE),
+fIsInitRecPointsTracker(kFALSE),
+fIsInitRecPointsTrigger(kFALSE),
+fIsInitESDs(kFALSE),
+fDigitStore(0x0),
+fTriggerStore(0x0),
+fDigitMaker(0x0),
+fClusterStore(0x0),
+fTrackerDataMaker(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);
+       // Do not copy the digit store and digit maker, but create its own ones
+       
+       Ctor();
+       
 }
 
 //__________________________________________________________________
@@ -125,77 +146,166 @@ AliMUONQADataMakerRec& AliMUONQADataMakerRec::operator = (const AliMUONQADataMak
 AliMUONQADataMakerRec::~AliMUONQADataMakerRec()
 {
     /// dtor
-    delete fDigitStore;
-    delete fTriggerStore;
-    delete fDigitMaker;
+  
+  AliCodeTimerAuto("");
+  
+  delete fDigitStore;
+  delete fTriggerStore;
+  delete fDigitMaker;
+       delete fClusterStore;
+       delete fTrackerDataMaker;
 }
 
 //____________________________________________________________________________ 
 void AliMUONQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray* list)
 {
-    ///Detector specific actions at end of cycle
-
-    // Display trigger histos in a more user friendly way
-    DisplayTriggerInfo(task);
-
-    // do the QA checking
-    AliQAChecker::Instance()->Run(AliQA::kMUON, task, list) ;
+       ///Detector specific actions at end of cycle
+       
+       // Display trigger histos in a more user friendly way
+       DisplayTriggerInfo(task);
+       
+       if ( task == AliQA::kRAWS ) 
+       {
+               TIter next(list);
+               TObject* o;
+               Bool_t alreadyThere(kFALSE);
+               while ( ( o = next() ) && !alreadyThere )
+               {
+                       TString classname(o->ClassName());
+                       if ( classname.Contains("TrackerData") ) alreadyThere = kTRUE;
+               }
+               if (!alreadyThere) list->AddAt(fTrackerDataMaker->Data(),(Int_t)kTrackerData);
+       }
+       
+       // do the QA checking
+       AliQAChecker::Instance()->Run(AliQA::kMUON, task, list) ;
 }
 
 //____________________________________________________________________________ 
 void AliMUONQADataMakerRec::InitRaws()
 {
     /// create Raws histograms in Raws subdir
-    TH1I* h0 = new TH1I("hRawBusPatch", "buspatch distribution",  1932, 1, 1932); 
-    Add2RawsList(h0, kRawBusPatch);
+       
+       if ( ! AliCDBManager::Instance()->GetDefaultStorage() )
+       {
+               AliError("CDB default storage not set. Cannot work.");
+               fIsInitRaws=kFALSE;
+       }
+       
+       TH3F* h3 = new TH3F("hTriggerScalersBendPlane", "Trigger scalers in bending plane",
+                                                                                       4, 10.5, 14.5,
+                                                                                       234, 0.5, 234.5,
+                                                                                       16, -0.5, 15.5);
+       h3->GetXaxis()->SetTitle("Chamber");
+       h3->GetYaxis()->SetTitle("Board");
+       h3->GetZaxis()->SetTitle("Strip");
+       Add2RawsList(h3, kTriggerScalersBP);
+       
+       TH3F* h4 = new TH3F("hTriggerScalersNonBendPlane", "Trigger scalers in non-bending plane",
+                                                                                       4, 10.5, 14.5,
+                                                                                       234, 0.5, 234.5,
+                                                                                       16, -0.5, 15.5);
+       h4->GetXaxis()->SetTitle("Chamber");
+       h4->GetYaxis()->SetTitle("Board");
+       h4->GetZaxis()->SetTitle("Strip");
+       Add2RawsList(h4, kTriggerScalersNBP);
+       
+       AliMUONTriggerDisplay triggerDisplay;
+       TString histoName, histoTitle;
+       for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
+               TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
+               for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
+                       histoName = Form("hScalers%sChamber%i", cathName.Data(), 11+iChamber);
+                       histoTitle = Form("Chamber %i: Scalers %s", 11+iChamber, cathName.Data());
+                       TH2F* h5 = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips, 
+                                                                                                                                                                                                                                               iCath, iChamber, histoTitle);
+                       Add2RawsList(h5, kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
+               }
+       }
+       
+       fIsInitRaws = kTRUE;
+}
 
-    TH1I* h1 = new TH1I("hRawCharge", "Charge distribution in rawdata", 4096, 0, 4095); 
-    Add2RawsList(h1, kRawCharge);
+//____________________________________________________________________________ 
+void AliMUONQADataMakerRec::InitRecPoints()
+{
+       /// create Reconstructed Points histograms in RecPoints subdir
+       InitRecPointsTrigger();
+       InitRecPointsTracker();
+}
+
+//____________________________________________________________________________ 
+void AliMUONQADataMakerRec::InitRecPointsTracker()
+{
+       /// create Reconstructed Points histograms in RecPoints subdir for the
+       /// MUON tracker subsystem.
+
+       AliMpDEIterator it;
+       
+       it.First();
+       
+       Int_t ndes(0);
+       
+       while ( !it.IsDone())
+       {
+               Int_t detElemId = it.CurrentDEId();
                
-    for (Int_t iDDL = 0; iDDL < 20; ++iDDL) 
-    {
-      TH1F* h2 = new TH1F(Form("%s%d", "hRawBusPatchDDL", iDDL), Form("%s %d","RAW Buspatch distribution for DDL", iDDL), 50, 0, 49); 
-      Add2RawsList(h2, kRawBuspatchDDL+iDDL);
-    }
+               it.Next();
 
-    TH3F* h3 = new TH3F("hTriggerScalersBendPlane", "Trigger scalers in bending plane",
-                       4, 10.5, 14.5,
-                       234, 0.5, 234.5,
-                       16, -0.5, 15.5);
-    h3->GetXaxis()->SetTitle("Chamber");
-    h3->GetYaxis()->SetTitle("Board");
-    h3->GetZaxis()->SetTitle("Strip");
-    Add2RawsList(h3, kTriggerScalersBP);
+               if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger )
+               {
+                       ndes = TMath::Max(ndes,detElemId);
 
-    TH3F* h4 = new TH3F("hTriggerScalersNonBendPlane", "Trigger scalers in non-bending plane",
-                       4, 10.5, 14.5,
-                       234, 0.5, 234.5,
-                       16, -0.5, 15.5);
-    h4->GetXaxis()->SetTitle("Chamber");
-    h4->GetYaxis()->SetTitle("Board");
-    h4->GetZaxis()->SetTitle("Strip");
-    Add2RawsList(h4, kTriggerScalersNBP);
+                       TH1* h = new TH1I(Form("hTrackerClusterMultiplicityForDE%04d",detElemId),
+                                                                                               Form("Multiplicity of the clusters in detection element %d",detElemId),
+                                                                                               100,0,100);
+                       
+                       h->GetXaxis()->SetTitle("Detection Element Id");
+                       
+                       Add2RecPointsList(h,kTrackerClusterMultiplicityPerDE+detElemId);
+                       
+                       h =  new TH1I(Form("hTrackerClusterChargeForDE%04d",detElemId),
+                                                                               Form("Charge of the clusters in detection element %d",detElemId),
+                                                                               100,0,1000);
 
-    AliMUONTriggerDisplay triggerDisplay;
-    TString histoName, histoTitle;
-    for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
-      TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
-      for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
-       histoName = Form("hScalers%sChamber%i", cathName.Data(), 11+iChamber);
-       histoTitle = Form("Chamber %i: Scalers %s", 11+iChamber, cathName.Data());
-       TH2F* h5 = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips, 
-                                                             iCath, iChamber, histoTitle);
-       Add2RawsList(h5, kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
-      }
-    }
-    
-    fIsInitRaws = kTRUE;
+                       h->GetXaxis()->SetTitle("Detection Element Id");
+
+                       Add2RecPointsList(h,kTrackerClusterChargePerDE+detElemId);
+
+               }
+
+       }
+
+       TH1* h = new TH1I("hTrackerNumberOfClustersPerDE","Number of clusters per detection element",
+                                                                               ndes, -0.5, ndes - 0.5);
+
+       h->GetXaxis()->SetTitle("Detection Element Id");
+
+       Add2RecPointsList(h, kTrackerNumberOfClustersPerDE);
+
+       for ( Int_t i = 0; i < AliMpConstants::NofTrackingChambers(); ++i ) 
+       {
+               TH1* h1 = new TH1I("hTrackerNumberOfClustersPerChamber","Number of clusters per chamber",AliMpConstants::NofTrackingChambers(),-0.5,AliMpConstants::NofTrackingChambers()-0.5);
+               Add2RecPointsList(h1,kTrackerNumberOfClustersPerChamber);
+               h1 = new TH1I(Form("hTrackerClusterMultiplicityForChamber%d",i),
+                                                                Form("Cluster multiplicity for chamber %d",i),
+                                                                100,0,100);
+               Add2RecPointsList(h1,kTrackerClusterMultiplicityPerChamber+i);
+               h1 = new TH1I(Form("hTrackerClusterChargeForChamber%d",i),
+                                                                Form("Cluster charge for chamber %d",i),
+                                                                100,0,1000);
+               Add2RecPointsList(h1,kTrackerClusterChargePerChamber+i);
+       }
+       
+       fIsInitRecPointsTracker=kTRUE;
 }
 
 //____________________________________________________________________________ 
-void AliMUONQADataMakerRec::InitRecPoints()
+void AliMUONQADataMakerRec::InitRecPointsTrigger()
 {
-    /// create Reconstructed Points histograms in RecPoints subdir
+       /// create Reconstructed Points histograms in RecPoints subdir for the
+       /// MUON Trigger subsystem.
+       
     TH3F* h0 = new TH3F("hTriggerDigitsBendPlane", "Trigger digits in bending plane",
                        4, 10.5, 14.5,
                        234, 0.5, 234.5,
@@ -233,8 +343,8 @@ void AliMUONQADataMakerRec::InitRecPoints()
     TH2F* h4 = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards,
                                                          0, 0, "Fired boards");
     Add2RecPointsList(h4, kTriggerBoardsDisplay);
-
-    fIsInitRecPoints = kTRUE;
+       
+       fIsInitRecPointsTrigger = kTRUE;
 }
 
 
@@ -277,25 +387,51 @@ void AliMUONQADataMakerRec::MakeRaws(AliRawReader* rawReader)
       return;
     }    
 
-    Int_t busPatchId;
-    UShort_t manuId;  
-    UChar_t channelId;
-    UShort_t charge;
-
+  if ( rawReader->GetType() == AliRawEventHeaderBase::kPhysicsEvent ) 
+  {
     rawReader->Reset();
-    AliMUONRawStreamTracker rawStreamTrack(rawReader);
-    rawStreamTrack.First();
-    while( rawStreamTrack.Next(busPatchId, manuId, channelId, charge) ) {
+    MakeRawsTracker(rawReader);
+  }
   
-      GetRawsData(kRawBusPatch)->Fill(busPatchId);
-      GetRawsData(kRawCharge)->Fill(charge);
-      Int_t iDDL = rawStreamTrack.GetCurentDDL();
-      GetRawsData(kRawBuspatchDDL + iDDL)->Fill(AliMpBusPatch::GetLocalBusID(busPatchId, iDDL));
-               
-                 
-    } // Next digit
+  rawReader->Reset();    
+  MakeRawsTrigger(rawReader);
+}
 
+//____________________________________________________________________________
+void AliMUONQADataMakerRec::MakeRawsTracker(AliRawReader* rawReader)
+{
+       /// make QA for rawdata tracker
+  
+       if (!fTrackerDataMaker) 
+       {
+               const Bool_t histogram(kFALSE);
+               const Bool_t fastDecoder(kTRUE);
+    
+//    fTrackerDataMaker = new AliMUONTrackerRawDataMaker(rawReader,histogram,fastDecoder,takeRawReaderOwnership);
+
+               fTrackerDataMaker = new AliMUONTrackerCalibratedDataMaker(AliCDBManager::Instance()->GetRun(),
+                                                              rawReader,
+                                                                                                                                                                                                                                                       AliCDBManager::Instance()->GetDefaultStorage()->GetURI(),
+                                                                                                                                                                                                                                                       "NOGAIN",
+                                                                                                                                                                                                                                                       histogram,
+                                                                                                                                                                                                                                                       0.0,0.0,
+                                                              fastDecoder);
+               
+               fTrackerDataMaker->Data()->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level
+               
+               fTrackerDataMaker->SetRunning(kTRUE);
+       }
+       
+       ((AliMUONTrackerCalibratedDataMaker*)fTrackerDataMaker)->SetRawReader(rawReader);
+       
+       fTrackerDataMaker->ProcessEvent();
+}
 
+//____________________________________________________________________________
+void AliMUONQADataMakerRec::MakeRawsTrigger(AliRawReader* rawReader)
+{
+       /// make QA for rawdata trigger
+       
     // Get trigger scalers
 
     Int_t loCircuit=0;
@@ -364,15 +500,66 @@ void AliMUONQADataMakerRec::MakeRaws(AliRawReader* rawReader)
 //____________________________________________________________________________
 void AliMUONQADataMakerRec::MakeRecPoints(TTree* clustersTree)
 {
-  
-    /// makes data from trigger response
-      
-    if ( ! fIsInitRecPoints ) {
-      AliWarningStream() 
-        << "Skipping function due to a failure in Init" << endl;
-      return;
-    }    
+       /// Fill histograms from treeR
+       
+       if (fIsInitRecPointsTracker) MakeRecPointsTracker(clustersTree);
+       if (fIsInitRecPointsTrigger) MakeRecPointsTrigger(clustersTree);
+}
+
+//____________________________________________________________________________
+void AliMUONQADataMakerRec::MakeRecPointsTracker(TTree* clustersTree)
+{
+       /// Fill histograms related to tracker clusters 
+       
+       // First things first : do we have clusters in the TreeR ?
+       // In "normal" production mode, it should be perfectly normal
+       // *not* to have them.
+       // But if for some reason we de-activated the combined tracking,
+       // then we have clusters in TreeR, so let's take that opportunity
+       // to QA them...
+       
+       if (!fClusterStore)
+       {
+               AliCodeTimerAuto("ClusterStore creation");
+               fClusterStore = AliMUONVClusterStore::Create(*clustersTree);
+               if (!fClusterStore) 
+               {
+                       fIsInitRecPointsTracker = kFALSE;
+                       return;
+               }
+       }
+       
+       AliCodeTimerAuto("");
+       
+       fClusterStore->Connect(*clustersTree,kFALSE);
+       clustersTree->GetEvent(0);
+
+       TIter next(fClusterStore->CreateIterator());
+       AliMUONVCluster* cluster;
+       
+       while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) )
+       {
+               Int_t detElemId = cluster->GetDetElemId();
+               Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
+               
+               GetRecPointsData(kTrackerNumberOfClustersPerDE)->Fill(detElemId);
+               GetRecPointsData(kTrackerClusterChargePerDE+detElemId)->Fill(cluster->GetCharge());
+               GetRecPointsData(kTrackerClusterMultiplicityPerDE+detElemId)->Fill(cluster->GetNDigits());
 
+               GetRecPointsData(kTrackerNumberOfClustersPerChamber)->Fill(chamberId);
+               GetRecPointsData(kTrackerClusterChargePerChamber+chamberId)->Fill(cluster->GetCharge());
+               GetRecPointsData(kTrackerClusterMultiplicityPerChamber+chamberId)->Fill(cluster->GetNDigits());
+               
+       }
+       
+       fClusterStore->Clear();
+}
+
+//____________________________________________________________________________
+void AliMUONQADataMakerRec::MakeRecPointsTrigger(TTree* clustersTree)
+{
+       /// makes data from trigger response
+      
     // Fired pads info
     fDigitStore->Clear();
 
index cbf9a60..d8ef37e 100644 (file)
@@ -9,20 +9,17 @@
 /// \class AliMUONQADataMakerRec
 /// \brief MUON Quality assurance data maker
 ///
-//  Author Christian Finck
 
 // --- AliRoot header files ---
-class AliMUONVTrackStore;
 class AliMUONDigitMaker;
 class AliMUONVDigitStore;
 class AliMUONVTriggerStore;
-
-// --- ROOT system ---
-class TObjArray;
-class TArrayF;
+class AliMUONVClusterStore;
 
 #include "AliQADataMakerRec.h"
 
+class AliMUONVTrackerDataMaker;
+
 class AliMUONQADataMakerRec: public AliQADataMakerRec {
 
 public:
@@ -34,9 +31,7 @@ public:
 private:
   /// Raw histograms indices
   enum ERaw { 
-    kRawBusPatch           = 0,   ///< Raw bus patch histogram index
-    kRawCharge             = 1,   ///< Raw charge histogram index
-    kRawBuspatchDDL        = 2,   ///< Raw buspatch hit map histogram per DDL index
+               kTrackerData           = 3,   ///< Accumulated data
     kTriggerScalersBP      = 22,  ///< Trigger scalers on BP histogram per chamber index
     kTriggerScalersNBP     = 23,  ///< Trigger scalers on NBP histogram per chamber index
     kTriggerScalersDisplay = 24   ///< Trigger scalers display histogram per chamber index
@@ -44,11 +39,21 @@ private:
          
   /// Rec points histograms indices
   enum ERecPoints { 
-    kTriggerDigitsBendPlane    = 0,  ///< Trigger digits on BP histogram index
+    
+               kTriggerDigitsBendPlane    = 0,  ///< Trigger digits on BP histogram index
     kTriggerDigitsNonBendPlane = 1,  ///< Trigger digits on NBP histogram index
     kTriggeredBoards           = 2,  ///< Triggered boards histogram index
     kTriggerDigitsDisplay      = 3,  ///< Trigger digits display histogram per plane index
-    kTriggerBoardsDisplay      = 11  ///< Triggered boards display histogram index
+    kTriggerBoardsDisplay      = 11,  ///< Triggered boards display histogram index
+
+               kTrackerNumberOfClustersPerChamber = 100, ///< Tracker: # of clusters per chamber
+               kTrackerClusterMultiplicityPerChamber = 200, ///< Tracker: cluster multiplicity per chamber
+               kTrackerClusterChargePerChamber = 300, ///< Tracker: cluster charge per chamber
+                               
+               kTrackerNumberOfClustersPerDE    = 1000, ///< Tracker : number of clusters per DE               
+               kTrackerClusterMultiplicityPerDE = 3000, ///< Tracker : cluster multiplicity per DE             
+               kTrackerClusterChargePerDE       = 5000 ///< Tracker : cluster charge per DE
+               
   };
           
   /// ESD histograms indices
@@ -60,28 +65,46 @@ private:
     kESDClusterHitMap = 4   ///< ESD Cluster hit map histogram index
   };
 
-  virtual void   StartOfDetectorCycle(); 
+protected:
+       
+  virtual void StartOfDetectorCycle(); 
 
-  virtual void   InitRaws(); 
-  virtual void   InitRecPoints(); 
-  virtual void   InitESDs(); 
+  virtual void InitRaws(); 
+  virtual void InitRecPoints(); 
+  virtual void InitESDs(); 
+  
+  virtual void MakeRaws(AliRawReader* rawReader); 
+  virtual void MakeRecPoints(TTree* recpo); 
+  virtual void MakeESDs(AliESDEvent* esd) ;
   
-  virtual void   MakeRaws(AliRawReader* rawReader); 
-  virtual void   MakeRecPoints(TTree* recpo); 
-  virtual void   MakeESDs(AliESDEvent* esd) ;
-  virtual void   EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray* list);
+  virtual void DefaultEndOfDetectorCycle(AliQA::TASKINDEX_t) {}
 
+       virtual void EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray* list);
+
+private:
+       
+       void Ctor();
   void DisplayTriggerInfo(AliQA::TASKINDEX_t task);
-  
+       void InitRecPointsTracker();
+       void InitRecPointsTrigger();
+       void MakeRawsTracker(AliRawReader* rawReader);
+       void MakeRawsTrigger(AliRawReader* rawReader);
+  void MakeRecPointsTracker(TTree* treeR);
+  void MakeRecPointsTrigger(TTree* treeR);
+       
   Bool_t  fIsInitRaws;       //!<  info if InitRaws() went ok
-  Bool_t  fIsInitRecPoints;  //!<  info if InitRecPoints() went ok
+  Bool_t  fIsInitRecPointsTracker;  //!<  info if InitRecPoints() went ok
+  Bool_t  fIsInitRecPointsTrigger;  //!<  info if InitRecPoints() went ok
   Bool_t  fIsInitESDs;       //!<  info if InitESDs() went ok
   
   AliMUONVDigitStore*   fDigitStore; //!< pointer to digits store
   AliMUONVTriggerStore* fTriggerStore; //!< pointer to trigger store
   AliMUONDigitMaker*    fDigitMaker;  //!< pointer to digit maker
-
-  ClassDef(AliMUONQADataMakerRec,2)  // MUON Quality assurance data maker
+  AliMUONVClusterStore* fClusterStore; //!< pointer to cluster store
+       
+       AliMUONVTrackerDataMaker* fTrackerDataMaker; //!< tracker data accumulation
+       
+  ClassDef(AliMUONQADataMakerRec,3)  // MUON Quality assurance data maker
 
 };
 #endif