]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCQADataMakerRec.cxx
In AddTaskPHOSPi0Flow.C set Cent. Bin past event buffers/lists,
[u/mrichter/AliRoot.git] / TPC / AliTPCQADataMakerRec.cxx
index c201dcf4804e5a5b8a75092871b1ba50c16e6754..80b2741609483d8b4d756a42f9b7bc9edfb95fce 100644 (file)
   Produces the data needed to calculate the quality assurance. 
   All data must be mergeable objects.
   P. Christiansen, Lund, January 2008
-*/
 
-/*
-  Implementation:
+  Updated July 2011:
+  ==================
+
+  Major changes to accomodate updates of general DQM/QA changes to have per
+  trigger histograms (for a given event specie).
+
+  1) One instance of AliTPCdataQA only. (This also solves some old wishes by
+  offline team to use less memory because event the 2d arrays for this object
+  is not used). This now has a new flag for only keeping DQM info event by
+  event! For this reason there is no need for a special DQM reset any more
+  between runs!
+
+  2) Fill the histogram for each event. The histograms are no longer filled
+  from the AliTPCdataQA but per event.
+
+  3) Use profiles for the RAW info. By adding the profiles event by event we
+  get the correct event averages WITHOUT having to normalize in the end!
+  Results should therefore also be directly mergable when that feature will
+  come. (none of the other histograms are merged).
+
+  This means that from the DQM/QA point of view the TPC DQM is now fully
+  standard and should ease future developments.
+
+  Updated June 2010:
+  ==================
+
+  The "beautification" of the online DQM histograms have been moved to
+  an amore macro.  
+
+  The per event RAW histograms have been modified in AliTPCdataQA and
+  the copies have therefore also been modified here.
+
+  The AliTPCdataQA can now be configured a bit from here: time bin
+  range (extended default range to 1-1000, event range at start:
+  0-100000, 1000 events per bin). (At least the parameters are not
+  hardcoded:-)
 
-  We have chosen to have the histograms as non-persistent meber to
-  allow better debugging. In the copy constructor we then have to
-  assign the pointers to the existing histograms in the copied
-  list. This have been implemented but not tested.
+  Implementation:
+  ===============
 
   For the QA of the RAW data we use the class, AliTPCdataQA, from the
   existing TPC Calibration framework (which is more advanced than the
-  standard QA framework) and extract the histograms at the end. This
-  has been tested with zero-suppressed data. The Analyse method of the
-  AliTPCdataQA class is called in the method, EndOfDetectorCycle, and
-  there also: 1d histogram(s) are projected and added to the QA list.
-*/
-
-/*
-  TODO:
-  Sumw2 for RAW histogram(s)?
-  RecPoints and ESD could have many more histograms
+  standard QA framework) and extract the histograms at the end. The
+  Analyse method of the AliTPCdataQA class is called in the method,
+  EndOfDetectorCycle, and there also: 1d histogram(s) are projected
+  and added to the QA list.
 */
 
 #include "AliTPCQADataMakerRec.h"
 
 // --- ROOT system ---
 #include <TClonesArray.h>
+#include <TString.h>
+#include <TSystem.h>
+#include <TBox.h>
+#include <TLine.h>
+#include <TAxis.h>
+#include <TH1.h> 
+#include <TProfile.h> 
+#include <TProfile2D.h> 
 
 // --- Standard library ---
 
 #include "AliESDtrack.h"
 #include "AliLog.h"
 #include "AliTPCCalPad.h"
+#include "AliTPCCalROC.h"
 #include "AliTPCClustersRow.h"
 #include "AliTPCclusterMI.h"
+#include "AliSimDigits.h"
+#include <AliDetectorRecoParam.h>
+
 
 ClassImp(AliTPCQADataMakerRec)
 
 //____________________________________________________________________________ 
 AliTPCQADataMakerRec::AliTPCQADataMakerRec() : 
-  AliQADataMakerRec(AliQA::GetDetName(AliQA::kTPC), 
-                   "TPC Rec Quality Assurance Data Maker"),
-  fTPCdataQA(0),
-  fHistESDclusters(0),fHistESDratio(0), fHistESDpt(0),
-  fHistRawsOccupancy(0),
-  fHistRecPointsQmaxShort(0), fHistRecPointsQmaxMedium(0), 
-  fHistRecPointsQmaxLong(0), fHistRecPointsQShort(0), 
-  fHistRecPointsQMedium(0), fHistRecPointsQLong(0),
-  fHistRecPointsRow(0)
+AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTPC), 
+                 "TPC Rec Quality Assurance Data Maker"),
+fTPCdataQA(NULL),
+fRawFirstTimeBin(1),
+fRawLastTimeBin(1000)
 {
   // ctor
+  
+  for(Int_t i = 0; i < 6; i++)
+    fMapping[i] = 0;
 }
 
 //____________________________________________________________________________ 
 AliTPCQADataMakerRec::AliTPCQADataMakerRec(const AliTPCQADataMakerRec& qadm) :
   AliQADataMakerRec(),
-  fTPCdataQA(0),
-  fHistESDclusters(0),  //! Clusters per ESD track
-  fHistESDratio(0),     //! Ratio of clusters to findables
-  fHistESDpt(0),        //! Pt spectrum
-  
-  fHistRawsOccupancy(0),//! Pad occupancy (1 entry per pad)
-  
-  fHistRecPointsQmaxShort(0), //! Qmax (short pads)
-  fHistRecPointsQmaxMedium(0),//! Qmax (medium pads)
-  fHistRecPointsQmaxLong(0),  //! Qmax (long pads)
-  fHistRecPointsQShort(0),    //! Q (short pads)
-  fHistRecPointsQMedium(0),   //! Q (medium pads)
-  fHistRecPointsQLong(0),     //! Q (long pads)
-  fHistRecPointsRow(0)       //! Row distribution
+  fTPCdataQA(NULL),
+  fRawFirstTimeBin(qadm.GetRawFirstTimeBin()),
+  fRawLastTimeBin(qadm.GetRawLastTimeBin())
 {
   //copy ctor 
   // Does not copy the calibration object, instead InitRaws have to be
@@ -102,30 +127,8 @@ AliTPCQADataMakerRec::AliTPCQADataMakerRec(const AliTPCQADataMakerRec& qadm) :
   SetName((const char*)qadm.GetName()) ; 
   SetTitle((const char*)qadm.GetTitle()); 
 
-  //
-  // Associate class histogram objects to the copies in the list
-  // Could also be done with the indexes
-  //
-  fHistESDclusters   = (TH1F*)fESDsQAList->FindObject("hESDclusters");
-  fHistESDratio             = (TH1F*)fESDsQAList->FindObject("hESDratio");
-  fHistESDpt         = (TH1F*)fESDsQAList->FindObject("hESDpt");
-
-  fHistRawsOccupancy = (TH1F*)fRawsQAList->FindObject("hRawsOccupancy");
-
-  fHistRecPointsQmaxShort  = 
-    (TH1F*)fRecPointsQAList->FindObject("hRecPointsQmaxShort");
-  fHistRecPointsQmaxMedium = 
-    (TH1F*)fRecPointsQAList->FindObject("hRecPointsQmaxMedium");
-  fHistRecPointsQmaxLong   = 
-    (TH1F*)fRecPointsQAList->FindObject("hRecPointsQmaxLong"); 
-  fHistRecPointsQShort     = 
-    (TH1F*)fRecPointsQAList->FindObject("hRecPointsQShort");
-  fHistRecPointsQMedium    = 
-    (TH1F*)fRecPointsQAList->FindObject("hRecPointsQMedium");
-  fHistRecPointsQLong      = 
-    (TH1F*)fRecPointsQAList->FindObject("hRecPointsQLong");
-  fHistRecPointsRow      = 
-    (TH1F*)fRecPointsQAList->FindObject("hRecPointsRow");
+  for(Int_t i = 0; i < 6; i++)
+    fMapping[i] = 0;
 }
 
 //__________________________________________________________________
@@ -136,51 +139,53 @@ AliTPCQADataMakerRec& AliTPCQADataMakerRec::operator = (const AliTPCQADataMakerR
   new(this) AliTPCQADataMakerRec(qadm);
   return *this;
 }
+
+//__________________________________________________________________
+AliTPCQADataMakerRec::~AliTPCQADataMakerRec()
+{
+  // Destructor
+  delete fTPCdataQA; 
+
+  for(Int_t i = 0; i < 6; i++) 
+    delete fMapping[i];
+}
  
 //____________________________________________________________________________ 
-void AliTPCQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
+void AliTPCQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
 {
   //Detector specific actions at end of cycle
+  ResetEventTrigClasses();
 
-  if(fTPCdataQA) { // do the final step of the QA for Raw data
-
-    fTPCdataQA->Analyse(); // 31/1-08 Analyse is now protected against
-                           //         RAW data files with no TPC data
-    
-    //Add2RawsList(fTPCdataQA, 0);
-    // get the histograms and add them to the output
-    // 31/8-08 Histogram is only added if the Calibration class 
-    //         receives TPC data 
-    if(fTPCdataQA->GetNoThreshold()) { 
-      fHistRawsOccupancy = fTPCdataQA->GetNoThreshold()->MakeHisto1D(0, 1, -1);
-      //Add2RawsList(fHistRawsOccupancy, 1);
-    }
-  }
-
-  AliQAChecker::Instance()->Run(AliQA::kTPC, task, list) ;  
+  AliQAChecker::Instance()->Run(AliQAv1::kTPC, task, list) ;  
 }
 
+
 //____________________________________________________________________________ 
 void AliTPCQADataMakerRec::InitESDs()
 {
   //create ESDs histograms in ESDs subdir  
-  fHistESDclusters = 
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  
+  TH1F * histESDclusters = 
     new TH1F("hESDclusters", "N TPC clusters per track; N clusters; Counts",
             160, 0, 160);
-  fHistESDclusters->Sumw2();
-  Add2ESDsList(fHistESDclusters, 0);
+  histESDclusters->Sumw2();
+  Add2ESDsList(histESDclusters, kClusters, !expert, image);
 
-  fHistESDratio = 
+  TH1F * histESDratio = 
     new TH1F("hESDratio", "Ratio: TPC clusters / findable; Ratio: cluster/findable; Counts",
             100, 0, 1);
-  fHistESDratio->Sumw2();
-  Add2ESDsList(fHistESDratio, 1);
+  histESDratio->Sumw2();
+  Add2ESDsList(histESDratio, kRatio, !expert, image);
   
-  fHistESDpt = 
+  TH1F * histESDpt = 
     new TH1F("hESDpt", "P_{T} distribution; p_{T} [GeV/c]; Counts",
             50, 0, 5);
-  fHistESDpt->Sumw2();
-  Add2ESDsList(fHistESDpt, 2);
+  histESDpt->Sumw2();
+  Add2ESDsList(histESDpt, kPt, !expert, image);
+  //
+  ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -188,63 +193,137 @@ void AliTPCQADataMakerRec::InitRaws()
 {
   //
   // Adding the raw 
+  //  
+
+  // Modified: 7/7 - 2008
+  // Laurent Aphecetche pointed out that the mapping was read from file
+  // for each event, so now we read in the map here and set if for 
+  // the raw data qa
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t saveCorr = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  
+  // It might happen that we will be in this method a few times
+  // (we create the dataQA at the first call to this method)
+  if(!fTPCdataQA) {
+    fTPCdataQA = new AliTPCdataQA();
+    LoadMaps(); // Load Altro maps
+    fTPCdataQA->SetAltroMapping(fMapping); // set Altro mapping
+    fTPCdataQA->SetRangeTime(fRawFirstTimeBin, fRawLastTimeBin); // set time bin interval 
+    fTPCdataQA->SetIsDQM(kTRUE);
+  }
+
+  TProfile * histRawsOccupancyVsSector = 
+    new TProfile("hRawsOccupancyVsSector", "Occupancy vs sector; Sector; Occupancy",
+            72, 0, 72);
+  histRawsOccupancyVsSector->SetMarkerStyle(20);
+  histRawsOccupancyVsSector->SetOption("P");
+  histRawsOccupancyVsSector->SetStats(kFALSE);
+  if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib )
+    Add2RawsList(histRawsOccupancyVsSector, kRawsOccupancyVsSector, expert, image, !saveCorr);
+  else
+    Add2RawsList(histRawsOccupancyVsSector, kRawsOccupancyVsSector, !expert, image, !saveCorr);
+    
+  TProfile * histRawsQVsSector = 
+    new TProfile("hRawsQVsSector", "<Q> vs sector; Sector; <Q>",
+            72, 0, 72);
+  Add2RawsList(histRawsQVsSector, kRawsQVsSector, expert, !image, !saveCorr);
+
+  TProfile * histRawsQmaxVsSector = 
+    new TProfile("hRawsQmaxVsSector", "<Qmax> vs sector; Sector; <Qmax>",
+            72, 0, 72);
+  histRawsQmaxVsSector->SetMarkerStyle(20);
+  histRawsQmaxVsSector->SetOption("P");
+  histRawsQmaxVsSector->SetStats(kFALSE);
+  if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib )
+    Add2RawsList(histRawsQmaxVsSector, kRawsQmaxVsSector, expert, image, !saveCorr);
+  else
+    Add2RawsList(histRawsQmaxVsSector, kRawsQmaxVsSector, !expert, image, !saveCorr);
+
+  TProfile2D * histRawsOccupancy2dVsSector = 
+    new TProfile2D("hRawsOccupancy2dVsSector", "Occupancy vs sector; Sector; Patch",
+                  72, 0, 36, 6, 0, 6);
+  histRawsOccupancy2dVsSector->SetOption("COLZ");
+  histRawsOccupancy2dVsSector->SetStats(kFALSE);
+  if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib )
+    Add2RawsList(histRawsOccupancy2dVsSector, kRawsOccupancy2dVsSector, expert, image, !saveCorr);
+  else
+    Add2RawsList(histRawsOccupancy2dVsSector, kRawsOccupancy2dVsSector, !expert, image, !saveCorr);
+    
   //
-  fTPCdataQA = new AliTPCdataQA();
-  fTPCdataQA->SetRangeTime(100, 920); // take all 1000 time bins 
-  Add2RawsList(fTPCdataQA, 0);
+  ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
+}
+
+//____________________________________________________________________________ 
+void AliTPCQADataMakerRec::InitDigits()
+{
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  TH1F * histDigitsADC = 
+    new TH1F("hDigitsADC", "Digit ADC distribution; ADC; Counts",
+             1000, 0, 1000);
+  histDigitsADC->Sumw2();
+  Add2DigitsList(histDigitsADC, kDigitsADC, !expert, image);
+  //
+  ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
 void AliTPCQADataMakerRec::InitRecPoints()
 {
-  fHistRecPointsQmaxShort = 
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  
+  TH1F * histRecPointsQmaxShort = 
     new TH1F("hRecPointsQmaxShort", "Qmax distrbution (short pads); Qmax; Counts",
-            200, 0, 1000);
-  fHistRecPointsQmaxShort->Sumw2();
-  Add2RecPointsList(fHistRecPointsQmaxShort, 0);
+            100, 0, 300);
+  histRecPointsQmaxShort->Sumw2();
+  Add2RecPointsList(histRecPointsQmaxShort, kQmaxShort, !expert, image);
 
-  fHistRecPointsQmaxMedium = 
+  TH1F * histRecPointsQmaxMedium = 
     new TH1F("hRecPointsQmaxMedium", "Qmax distrbution (medium pads); Qmax; Counts",
-            200, 0, 1000);
-  fHistRecPointsQmaxMedium->Sumw2();
-  Add2RecPointsList(fHistRecPointsQmaxMedium, 1);
+            100, 0, 300);
+  histRecPointsQmaxMedium->Sumw2();
+  Add2RecPointsList(histRecPointsQmaxMedium, kQmaxMedium, !expert, image);
 
-  fHistRecPointsQmaxLong = 
+  TH1F * histRecPointsQmaxLong = 
     new TH1F("hRecPointsQmaxLong", "Qmax distrbution (long pads); Qmax; Counts",
-            200, 0, 1000);
-  fHistRecPointsQmaxLong->Sumw2();
-  Add2RecPointsList(fHistRecPointsQmaxLong, 2);
+            100, 0, 300);
+  histRecPointsQmaxLong->Sumw2();
+  Add2RecPointsList(histRecPointsQmaxLong, kQmaxLong, !expert, image);
 
-  fHistRecPointsQShort = 
+  TH1F * histRecPointsQShort = 
     new TH1F("hRecPointsQShort", "Q distrbution (short pads); Q; Counts",
-            200, 0, 5000);
-  fHistRecPointsQShort->Sumw2();
-  Add2RecPointsList(fHistRecPointsQShort, 3);
+            100, 0, 2000);
+  histRecPointsQShort->Sumw2();
+  Add2RecPointsList(histRecPointsQShort, kQShort, !expert, image);
 
-  fHistRecPointsQMedium = 
+  TH1F * histRecPointsQMedium = 
     new TH1F("hRecPointsQMedium", "Q distrbution (medium pads); Q; Counts",
-            200, 0, 5000);
-  fHistRecPointsQMedium->Sumw2();
-  Add2RecPointsList(fHistRecPointsQMedium, 4);
+            100, 0, 2000);
+  histRecPointsQMedium->Sumw2();
+  Add2RecPointsList(histRecPointsQMedium, kQMedium, !expert, image);
 
-  fHistRecPointsQLong = 
+  TH1F * histRecPointsQLong = 
     new TH1F("hRecPointsQLong", "Q distrbution (long pads); Q; Counts",
-            200, 0, 5000);
-  fHistRecPointsQLong->Sumw2();
-  Add2RecPointsList(fHistRecPointsQLong, 5);
+            100, 0, 2000);
+  histRecPointsQLong->Sumw2();
+  Add2RecPointsList(histRecPointsQLong, kQLong, !expert, image);
 
-  fHistRecPointsRow = 
+  TH1F * histRecPointsRow = 
     new TH1F("hRecPointsRow", "Clusters per row; Row; Counts",
             159, 0, 159);
-  fHistRecPointsRow->Sumw2();
-  Add2RecPointsList(fHistRecPointsRow, 6);
+  histRecPointsRow->Sumw2();
+  Add2RecPointsList(histRecPointsRow, kRow, !expert, image);
+  //
+  ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
 }
 
 //____________________________________________________________________________
 void AliTPCQADataMakerRec::MakeESDs(AliESDEvent * esd)
 {
   // make QA data from ESDs
-  
   const Int_t nESDTracks = esd->GetNumberOfTracks();
   Int_t nTPCtracks = 0; 
   for(Int_t i = 0; i < nESDTracks; i++) {
@@ -258,11 +337,15 @@ void AliTPCQADataMakerRec::MakeESDs(AliESDEvent * esd)
     
     Int_t nTPCclusters         = track->GetTPCNcls();
     Int_t nTPCclustersFindable = track->GetTPCNclsF();
-    
-    fHistESDclusters->Fill(nTPCclusters);
-    fHistESDratio->Fill(Float_t(nTPCclusters)/Float_t(nTPCclustersFindable));
-    fHistESDpt->Fill(track->Pt()); 
+    if ( nTPCclustersFindable<=0) continue;
+    FillESDsData(kClusters,nTPCclusters);
+    FillESDsData(kRatio,Float_t(nTPCclusters)/Float_t(nTPCclustersFindable));
+    FillESDsData(kPt,track->Pt()); 
   }
+  //
+  IncEvCountCycleESDs();
+  IncEvCountTotalESDs();
+  //
 }
 
 //____________________________________________________________________________
@@ -272,30 +355,103 @@ void AliTPCQADataMakerRec::MakeRaws(AliRawReader* rawReader)
   // To make QA for the RAW data we use the TPC Calibration framework 
   // to handle the data and then in the end extract the data
   //
-  fTPCdataQA->ProcessEvent(rawReader);  
+  
+  GetRawsData(0); // dummy call to init raw data
+  rawReader->Reset() ; 
+  if (! fTPCdataQA ) {
+
+    AliError("No TPC data QA (no call to InitRaws?)!!!!") ; 
+  } else {  
+
+    if(fTPCdataQA->GetIsDQM() == kFALSE)
+      AliError("Data QA has to be initialized as DQM!!!!") ; 
+
+    // Fill profile data
+    fTPCdataQA->ResetProfiles();
+    
+    if(fTPCdataQA->ProcessEvent(rawReader)) { // means that TPC data was processed  
+
+      fTPCdataQA->FillOccupancyProfile();
+      
+      // Fill histograms    
+      TObjArray *arrRW = GetMatchingRawsData(kRawsOccupancyVsSector); // all kRawsOccupancyVsSector clones matching to triggers
+      for (int ih=arrRW->GetEntriesFast();ih--;) {
+       TProfile* hRawsOccupancyVsSector = dynamic_cast<TProfile*>(arrRW->At(ih));
+       if (hRawsOccupancyVsSector) hRawsOccupancyVsSector->Add(fTPCdataQA->GetHistOccVsSector());
+      }
+      arrRW = GetMatchingRawsData(kRawsOccupancy2dVsSector);
+      for (int ih=arrRW->GetEntriesFast();ih--;) {
+       TProfile2D* hRawsOccupancy2dVsSector = dynamic_cast<TProfile2D*>(arrRW->At(ih));
+       if (hRawsOccupancy2dVsSector) hRawsOccupancy2dVsSector->Add(fTPCdataQA->GetHistOcc2dVsSector());
+      }
+      arrRW = GetMatchingRawsData(kRawsQVsSector);
+      for (int ih=arrRW->GetEntriesFast();ih--;) {
+       TProfile* hRawsQVsSector = dynamic_cast<TProfile*>(arrRW->At(ih));
+       if (hRawsQVsSector) hRawsQVsSector->Add(fTPCdataQA->GetHistQVsSector());
+      }
+      arrRW = GetMatchingRawsData(kRawsQmaxVsSector);
+      for (int ih=arrRW->GetEntriesFast();ih--;) {
+       TProfile* hRawsQmaxVsSector = dynamic_cast<TProfile*>(arrRW->At(ih));
+       if (hRawsQmaxVsSector) hRawsQmaxVsSector->Add(fTPCdataQA->GetHistQmaxVsSector());
+      }
+      //
+      IncEvCountCycleRaws();
+      IncEvCountTotalRaws();
+      //
+    }
+  }
 }
 
 //____________________________________________________________________________
-void AliTPCQADataMakerRec::MakeRecPoints(TTree* recTree)
+void AliTPCQADataMakerRec::MakeDigits(TTree* digitTree)
 {
-  AliTPCClustersRow *clrow = new AliTPCClustersRow();
-  clrow->SetClass("AliTPCclusterMI");
-  clrow->SetArray(0);
-  clrow->GetArray()->ExpandCreateFast(10000);
+  TBranch* branch = digitTree->GetBranch("Segment");
+  AliSimDigits* digArray = 0;
+  branch->SetAddress(&digArray);
+  
+  Int_t nEntries = Int_t(digitTree->GetEntries());
+  
+  for (Int_t n = 0; n < nEntries; n++) {
+    
+    digitTree->GetEvent(n);
+    
+    if (digArray->First())
+      do {
+        Float_t dig = digArray->CurrentDigit();
+        
+        FillDigitsData(kDigitsADC,dig);
+      } while (digArray->Next());    
+  }
+  //
+  IncEvCountCycleDigits();
+  IncEvCountTotalDigits();
+  //
+}
 
-  TBranch* branch = recTree->GetBranch("Segment");
+//____________________________________________________________________________
+void AliTPCQADataMakerRec::MakeRecPoints(TTree* recTree)
+{
+  
+  AliTPCClustersRow* clrow = 0x0;
+  TBranch* branch = recTree->GetBranch("Segment");  
   branch->SetAddress(&clrow);
+  TClonesArray * clarray = 0x0;
 
   const Int_t nEntries = Int_t(recTree->GetEntries());
   for (Int_t i = 0; i < nEntries; i++) {
     
     branch->GetEntry(i);
-    
-    const Int_t nClusters = clrow->GetArray()->GetEntriesFast();
+
+    clarray = clrow->GetArray();
+
+    if (!clarray) continue;
+
+    const Int_t nClusters = clarray->GetEntriesFast();
     for (Int_t icl=0; icl < nClusters; icl++){
       
       AliTPCclusterMI* cluster = 
-       (AliTPCclusterMI*)clrow->GetArray()->At(icl);
+       (AliTPCclusterMI*)clarray->At(icl);
       
       Float_t Qmax = cluster->GetMax();
       Float_t Q    = cluster->GetQ();
@@ -303,24 +459,44 @@ void AliTPCQADataMakerRec::MakeRecPoints(TTree* recTree)
 
       if(cluster->GetDetector()<36) { // IROC (short pads)
 
-       fHistRecPointsQmaxShort->Fill(Qmax);
-       fHistRecPointsQShort->Fill(Q);
+       FillRecPointsData(kQmaxShort,Qmax);
+       FillRecPointsData(kQShort,Q);
       } else { // OROC (medium and long pads)
        row += 63;
        if(cluster->GetRow()<64) { // medium pads
 
-         fHistRecPointsQmaxMedium->Fill(Qmax);
-         fHistRecPointsQMedium->Fill(Q);
+         FillRecPointsData(kQmaxMedium,Qmax);
+         FillRecPointsData(kQMedium,Q);
        } else { // long pads
 
-         fHistRecPointsQmaxLong->Fill(Qmax);
-         fHistRecPointsQLong->Fill(Q);
+         FillRecPointsData(kQmaxLong,Qmax);
+         FillRecPointsData(kQLong,Q);
        }
       }
       
-      fHistRecPointsRow->Fill(row);
+      FillRecPointsData(kRow,row);
     } // end loop over clusters
   } // end loop over tree
+  //
+  IncEvCountCycleRecPoints();
+  IncEvCountTotalRecPoints();
+  //
+}
 
-  delete clrow;
+//____________________________________________________________________________
+void AliTPCQADataMakerRec::LoadMaps()
+{
+  TString path = gSystem->Getenv("ALICE_ROOT");
+  path += "/TPC/mapping/Patch";
+
+  for(Int_t i = 0; i < 6; i++) {
+
+    if(fMapping[i]!=0) // mapping already loaded
+      continue;
+    TString path2 = path;
+    path2 += i;
+    path2 += ".data";
+    fMapping[i] = new AliTPCAltroMapping(path2.Data());
+  }
 }
+