Adding a reminder for coders
[u/mrichter/AliRoot.git] / TOF / AliTOFQADataMakerRec.cxx
index 8f45f5f..f99ae5c 100644 (file)
 ///////////////////////////////////////////////////////////////////////
 
 /*
-  Modified by fbellini on 14/06/2010
+Modified by fbellini & rshanoian on 06/07/2011
+- changes for trigger classes implementation
+- fRunNumber added as private member
+- added time vs BCID plot
+
+Modified by fbellini on 18/01/2011
+- reduced histo binning to reduce size 
+- added decoding errors plot
+- added channel maps and options for DQM shifters
+- new list of recPoints and ESDs plots
+- removed hTrmChannels035 and hTrmChannels3671
+
+ Modified by bvonhall on 03/11/2010
+   - modified declaration of hTrmChannels035 and hTrmChannels3671 in EndOfDetectorCycle()
+     to prevent memory corruption
+   
+ Modified by adecaro on 18/10/2010
+   - fTOFRawStream object set as private member
+Modified by fbellini on 13/09/2010
+  - Set TLines as private members
+  - Set image flag for expert histos
+
+Modified by fbellini on 14/06/2010
   - Updated plots
   - use LoadRawDataBuffersV2()
 
@@ -55,6 +78,7 @@
 #include <TH1F.h> 
 #include <TH2F.h> 
 #include <TLine.h>
+#include <TPaveText.h>
 
 #include "AliCDBManager.h"
 #include "AliCDBEntry.h"
@@ -68,7 +92,8 @@
 #include "AliTOFrawData.h"
 #include "AliTOFGeometry.h"
 #include "AliTOFChannelOnlineStatusArray.h"
-
+#include "AliTOFDecoderSummaryData.h"
+#include "AliTOFDecoderV2.h"
 
 ClassImp(AliTOFQADataMakerRec)
            
@@ -77,13 +102,30 @@ ClassImp(AliTOFQADataMakerRec)
   AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
   fCalibData(0x0),
   fEnableNoiseFiltering(kFALSE),
-    fEnableDqmShifterOpt(kFALSE),
-    fProcessedRawEventN(0)
+  fEnableDqmShifterOpt(kFALSE),
+//  fProcessedRawEventN(0),
+  fIsSOC(kFALSE),
+  fLineExpTimeMin(new TLine(200., 0., 200., 0.)),
+  fLineExpTimeMax(new TLine(250., 0., 250., 0.)),
+  fLineExpTotMin(new TLine(5., 0., 5., 0.)),
+  fLineExpTotMax(new TLine(20., 0., 20., 0.)),
+  fTOFRawStream(AliTOFRawStream()),
+  fDecoderSummary(0),
+  fRunNumber(-1)
 {
   //
   // ctor
-  //
-   
+  //   
+  for (Int_t sm=0;sm<17;sm++){
+    fLineSMid[sm] = new TLine( sm+1, 0., sm+1, 91.);
+  }
+  //initialize all TRM counters to -1 i.e. invalid value
+  // for (Int_t trm=0;trm<720;trm++){
+  //   fTRMNoisyArray[trm]=-1;
+  //   fTRMHwOkArray[trm]=-1;
+  //   fTRMEnabledArray[trm]=-1;
+  // }
+  
 }
 
 //____________________________________________________________________________ 
@@ -92,15 +134,32 @@ AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
   fCalibData(qadm.fCalibData),
   fEnableNoiseFiltering(qadm.fEnableNoiseFiltering),
   fEnableDqmShifterOpt(qadm.fEnableDqmShifterOpt),
-  fProcessedRawEventN(qadm.fProcessedRawEventN)
+  //  fProcessedRawEventN(qadm.fProcessedRawEventN),
+  fIsSOC(qadm.fIsSOC),
+  fLineExpTimeMin(qadm.fLineExpTimeMin),
+  fLineExpTimeMax(qadm.fLineExpTimeMax),
+  fLineExpTotMin(qadm.fLineExpTotMin),
+  fLineExpTotMax(qadm.fLineExpTotMax),
+  fTOFRawStream(qadm.fTOFRawStream),
+  fDecoderSummary(qadm.fDecoderSummary),
+  fRunNumber(qadm.fRunNumber)
 {
   //
   //copy ctor 
   //
   SetName((const char*)qadm.GetName()) ; 
   SetTitle((const char*)qadm.GetTitle()); 
+   
+  for (Int_t sm=0;sm<17;sm++){
+    fLineSMid[sm]=qadm.fLineSMid[sm];
+  }
+  
+  // for (Int_t trm=0;trm<10;trm++){
+  //   fTRMNoisyArray[trm]=qadm.fTRMNoisyArray[trm];
+  //   fTRMHwOkArray[trm]=qadm.fTRMHwOkArray[trm];
+  //   fTRMEnabledArray[trm]=qadm.fTRMEnabledArray[trm];
+  // }
   
 }
 
 //__________________________________________________________________
@@ -115,34 +174,66 @@ AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerR
 }
  
 //----------------------------------------------------------------------------
-AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData() const
+AliTOFQADataMakerRec::~AliTOFQADataMakerRec()
+{
+  //destructor
+  fTOFRawStream.Clear();
+  if (fLineExpTimeMin)
+    delete fLineExpTimeMin;
+  if (fLineExpTimeMax)
+    delete fLineExpTimeMax;
+  if (fLineExpTotMin)
+    delete fLineExpTotMin;
+  if (fLineExpTotMax)
+    delete fLineExpTotMax;
+  for (Int_t sm=0;sm<10;sm++){
+    if (fLineSMid[sm])
+      delete fLineSMid[sm];
+  }
+}
+//----------------------------------------------------------------------------
+AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData() 
 {
   //
   // Retrive TOF calib objects from OCDB
   //
-    AliCDBManager *man = AliCDBManager::Instance();
-
-    AliCDBEntry *cdbe=0;
-
+  AliCDBManager *man = AliCDBManager::Instance();
+  AliCDBEntry *cdbe=0;
+  if (fRun<=0) fRunNumber=145288; //reference run from LHC11a
+  else fRunNumber=fRun;
+  
+  if (man->GetRun()!=fRunNumber){
+    fRunNumber=man->GetRun();
+    AliWarning(Form("Run number mismatch found: setting it to value from current AliCDBManager instance = %i", fRunNumber));
+  }
+  cdbe = man->Get("TOF/Calib/Status",fRunNumber);
+  
+  if(!cdbe){
+    // for DQM online
+    AliWarning("Load of calibration data from default (alien://) storage failed!");
+    printf("Calibration data will be loaded from local storage - ok if on DQM station!");
+    man->SetDefaultStorage("local:///local/cdb/");
     cdbe = man->Get("TOF/Calib/Status",fRun);
+    
     if(!cdbe){
-       AliWarning("Load of calibration data from default storage failed!");
-       AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
-       man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
-       cdbe = man->Get("TOF/Calib/Status",fRun);
+      AliWarning("Load of calibration data from local DQM machine storage failed!");
+      AliWarning("Calibration data will be loaded from local ($ALICE_ROOT) storage ");
+      man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+      cdbe = man->Get("TOF/Calib/Status",fRunNumber);
     }
-    // Retrieval of data in directory TOF/Calib/Data:
-    
-    AliTOFChannelOnlineStatusArray * array = 0;
-    if (cdbe) array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
-    if (!array)  AliFatal("No calibration data from calibration database !");
-    
-    return array;
-    
+  }
+  // Retrieval of data in directory TOF/Calib/Data:
+  AliTOFChannelOnlineStatusArray * array = 0;
+  if (cdbe) {
+    printf("======= OCDB object for TOF retrieved from run %i in %s\n",fRunNumber,cdbe->GetName());
+    array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
+  }
+  if (!array)  AliFatal("No calibration data from calibration database !");
+  
+  return array;
 }
 
-
-
 //____________________________________________________________________________ 
 void AliTOFQADataMakerRec::InitRaws()
 {
@@ -153,53 +244,62 @@ void AliTOFQADataMakerRec::InitRaws()
   const Bool_t saveCorr = kTRUE ; 
   const Bool_t image    = kTRUE ; 
 
-  TH1I * h0 =  new TH1I("hTOFRaws",      "TOF raw hit multiplicity; TOF raw hits number;Counts ",200, 0, 200) ;
-
-  TH1I * h1 =  new TH1I("hTOFRawsIA",    "TOF raw hit multiplicity - I/A side; TOF raw hits number ;Counts ",200, 0, 200) ;
-  TH1I * h2 =  new TH1I("hTOFRawsOA",    "TOF raw hit multiplicity - O/A side; TOF raw hits number ;Counts ",200, 0, 200) ;
-  TH1I * h3 =  new TH1I("hTOFRawsIC",    "TOF raw hit multiplicity - I/C side; TOF raw hits number ;Counts ",200, 0, 200) ;
-  TH1I * h4 =  new TH1I("hTOFRawsOC",    "TOF raw hit multiplicity - O/C side; TOF raw hits number ;Counts ",200, 0, 200) ;
-
-  TH1F * h5  = new TH1F("hTOFRawsTime", "TOF Raws - Hit time (ns);Measured Hit time [ns];Counts", 25000,0. ,610.) ; 
-
-  TH1F * h6  = new TH1F("hTOFRawsTimeIA", "TOF Raws - Hit time (ns) - I/A side;Measured Hit time [ns];Counts", 25000,0. ,610.) ; 
-  TH1F * h7  = new TH1F("hTOFRawsTimeOA", "TOF Raws - Hit time (ns) - O/A side;Measured Hit time [ns];Counts", 25000,0. ,610.) ; 
-  TH1F * h8  = new TH1F("hTOFRawsTimeIC", "TOF Raws - Hit time (ns) - I/C side;Measured Hit time [ns];Counts", 25000,0. ,610.) ; 
-  TH1F * h9  = new TH1F("hTOFRawsTimeOC", "TOF Raws - Hit time (ns) - O/C side;Measured Hit time [ns];Counts", 25000,0. ,610.) ; 
-
-  TH1F * h10  = new TH1F("hTOFRawsToT", "TOF Raws - Hit ToT (ns);Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ; 
+  TH1I * h0 =  new TH1I("hTOFRaws",      "TOF raw hit multiplicity; TOF raw hits number; Events ",200, 0, 200) ;
 
-  TH1F * h11  = new TH1F("hTOFRawsToTIA", "TOF Raws - Hit ToT (ns) - I/A side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ; 
-  TH1F * h12  = new TH1F("hTOFRawsToTOA", "TOF Raws - Hit ToT (ns) - O/A side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ; 
-  TH1F * h13  = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ; 
-  TH1F * h14  = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ; 
+  TH1I * h1 =  new TH1I("hTOFRawsIA",    "TOF raw hit multiplicity - I/A side; TOF raw hits number ;Events ",200, 0, 200) ;
+  TH1I * h2 =  new TH1I("hTOFRawsOA",    "TOF raw hit multiplicity - O/A side; TOF raw hits number ;Events ",200, 0, 200) ;
+  TH1I * h3 =  new TH1I("hTOFRawsIC",    "TOF raw hit multiplicity - I/C side; TOF raw hits number ;Events ",200, 0, 200) ;
+  TH1I * h4 =  new TH1I("hTOFRawsOC",    "TOF raw hit multiplicity - O/C side; TOF raw hits number ;Events ",200, 0, 200) ;
 
+  TH1F * h5  = new TH1F("hTOFRawsTime", "TOF Raws - Hit time (ns);Measured Hit time [ns];Hits", 250,0. ,610.) ; 
+  TH1F * h6  = new TH1F("hTOFRawsTimeIA", "TOF Raws - Hit time (ns) - I/A side;Measured Hit time [ns];Hits", 250,0. ,610.) ; 
+  TH1F * h7  = new TH1F("hTOFRawsTimeOA", "TOF Raws - Hit time (ns) - O/A side;Measured Hit time [ns];Hits", 250,0. ,610.) ; 
+  TH1F * h8  = new TH1F("hTOFRawsTimeIC", "TOF Raws - Hit time (ns) - I/C side;Measured Hit time [ns];Hits", 250,0. ,610.) ; 
+  TH1F * h9  = new TH1F("hTOFRawsTimeOC", "TOF Raws - Hit time (ns) - O/C side;Measured Hit time [ns];Hits", 250,0. ,610.) ; 
+  
+  TH1F * h10  = new TH1F("hTOFRawsToT", "TOF Raws - Hit ToT (ns);Measured Hit ToT (ns);Hits", 100, 0., 48.8) ; 
+  
+  TH1F * h11  = new TH1F("hTOFRawsToTIA", "TOF Raws - Hit ToT (ns) - I/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ; 
+  TH1F * h12  = new TH1F("hTOFRawsToTOA", "TOF Raws - Hit ToT (ns) - O/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ; 
+  TH1F * h13  = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ; 
+  TH1F * h14  = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ; 
+  
   TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts",  72, 0., 72.);
-  TH1F * h16  = new TH1F("hTOFRawsTRMHits035", "TRM hits  - crates 0 to 35 ;TRM index = SMid(crate*10)+TRM(0-9);Hits",  361, 0., 361.) ;
-  TH1F * h17  = new TH1F("hTOFRawsTRMHits3671","TRM hits  - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Hits", 361, 360., 721.) ;
+  TH2F * h16  = new TH2F("hTOFrefMap", "TOF enabled channel reference map;sector;strip",  72, 0., 18., 91, 0., 91.);
+  TH2F * h17  = new TH2F("hTOFRawHitMap","TOF raw hit map;sector;strip", 72, 0., 18., 91, 0., 91.);
+  TH2I * h18 = new TH2I("hTOFDecodingErrors","Decoding error monitoring; DDL; Error ", 72, 0, 72, 13,1,14);
   
-  TH1F * h18 = new TH1F("hTOFRawChannelHits","TOF channel hits count; Channel ID; Hits", 158000, 0., 158000);
+  h18->GetYaxis()->SetBinLabel(1,"DRM ");
+  h18->GetYaxis()->SetBinLabel(2,"LTM ");
+  h18->GetYaxis()->SetBinLabel(3,"TRM 3 ");
+  h18->GetYaxis()->SetBinLabel(4,"TRM 4");
+  h18->GetYaxis()->SetBinLabel(5,"TRM 5");
+  h18->GetYaxis()->SetBinLabel(6,"TRM 6");
+  h18->GetYaxis()->SetBinLabel(7,"TRM 7");
+  h18->GetYaxis()->SetBinLabel(8,"TRM 8");
+  h18->GetYaxis()->SetBinLabel(9,"TRM 9");
+  h18->GetYaxis()->SetBinLabel(10,"TRM 10");
+  h18->GetYaxis()->SetBinLabel(11,"TRM 11");
+  h18->GetYaxis()->SetBinLabel(12,"TRM 12");
+  h18->GetYaxis()->SetBinLabel(13,"recovered");
   
-  TH1F * h19  = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Counts", 25000, 0. ,610.) ; 
+  TH1F * h19  = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Hits", 250, 0. ,610.) ; 
   TH2F * h20 = new TH2F("hTOFRawTimeVsTRM035", "TOF raws - Hit time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF raw time [ns]", 361, 0., 361., 250, 0., 610.0) ;
   TH2F * h21 = new TH2F("hTOFRawTimeVsTRM3671", "TOF raws - Hit time vs TRM - crates 36 to 72; TRM index = DDL**10+TRM(0-9);TOF raw time [ns]", 361, 360., 721., 250, 0., 610.0) ;
-  TH2F * h22 = new TH2F("hTOFRawToTVsTRM035",  "TOF raws - Hit ToT vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF raw ToT [ns] ", 361, 0., 361., 100, 0., 48.8) ;
-  TH2F * h23 = new TH2F("hTOFRawToTVsTRM3671",  "TOF raws - Hit ToT vs TRM - crates 36 to 72; TRM index = DDL*10+TRM(0-9);TOF raw ToT [ns] ", 361, 360., 721., 100, 0., 48.8) ;
-  TH2F * h24 = new TH2F("hTOFTimeVsStrip","TOF Raws - Hit time vs. strip (theta); Strip index;Raws TOF time (ns) ", 91,0.,91, 250, 0., 610.) ; 
+  TH2F * h22 = new TH2F("hTOFTimeVsStrip","TOF Raws - Hit time vs. strip (theta); Strip index;Raws TOF time (ns) ", 91,0.,91, 250, 0., 610.) ; 
+  TH2F * h23 = new TH2F("hTOFtimeVsBCID","TOF time vs BCID; BCID; time (ns) ", 3564, 0., 3564., 250,0.,610);
   
-// TH2F * h25 = new TH2F("hTOFRawsClusMap","Raws vs TOF eta-phi;eta (2*strip+padz);phi (48*sector+padx)",183, -0.5, 182.5,865,-0.5,864.5) ; 
-
   h0->Sumw2() ;
   h1->Sumw2() ;
   h2->Sumw2() ;
   h3->Sumw2() ;
   h4->Sumw2() ;
-  h5->Sumw2() ;
+  //  h5->Sumw2() ;
   h6->Sumw2() ;
   h7->Sumw2() ;
   h8->Sumw2() ;
   h9->Sumw2() ;
-  h10->Sumw2() ;
+  // h10->Sumw2() ;
   h11->Sumw2() ;
   h12->Sumw2() ;
   h13->Sumw2() ;
@@ -213,18 +313,64 @@ void AliTOFQADataMakerRec::InitRaws()
   h21->Sumw2() ;
   h22->Sumw2() ;
   h23->Sumw2() ;
-  h24->Sumw2() ;
+  
+  //add lines for DQM shifter
+  //fLineExpTimeMin = new TLine(200., 0., 200., 0.);
+  fLineExpTimeMin->SetLineColor(kGreen);
+  fLineExpTimeMin->SetLineWidth(2);
+  
+  //fLineExpTimeMax = new TLine(250., 0., 250., 0.);
+  fLineExpTimeMax->SetLineColor(kGreen);
+  fLineExpTimeMax->SetLineWidth(2);
+  
+  //fLineExpTotMin = new TLine( 5., 0., 5., 0.);
+  fLineExpTotMin->SetLineColor(kGreen);
+  fLineExpTotMin->SetLineWidth(2);
+  
+  //fLineExpTotMax = new TLine(20., 0., 20., 0.);
+  fLineExpTotMax->SetLineColor(kGreen);
+  fLineExpTotMax->SetLineWidth(2);
+  
+  for (Int_t sm=0;sm<17;sm++){
+    //fLineSMid[sm] = new TLine( 1+sm, 0., 1+sm, 91.);
+    fLineSMid[sm]->SetLineColor(kMagenta);
+    fLineSMid[sm]->SetLineWidth(2);
+  }
+  
+  h5->GetListOfFunctions()->Add(fLineExpTimeMin);
+  h5->GetListOfFunctions()->Add(fLineExpTimeMax);
+  h10->GetListOfFunctions()->Add(fLineExpTotMin);
+  h10->GetListOfFunctions()->Add(fLineExpTotMax);
+  
+  for (Int_t sm=0;sm<17;sm++){
+    h16->GetListOfFunctions()->Add(fLineSMid[sm]);
+    h17->GetListOfFunctions()->Add(fLineSMid[sm]);
+  }
+  
+  
+  TPaveText *phosHoleBox=new TPaveText(13,38,16,53,"b");       
+  phosHoleBox->SetFillStyle(0);
+  phosHoleBox->SetFillColor(kWhite);
+  phosHoleBox->SetLineColor(kMagenta);
+  phosHoleBox->SetLineWidth(2);
+  phosHoleBox->AddText("PHOS");        
+  h16->GetListOfFunctions()->Add(phosHoleBox);
+  h17->GetListOfFunctions()->Add(phosHoleBox);
+
+  // h0->SetDrawOption("logy");
+  // h5->SetDrawOption("logy");
+  // h10->SetDrawOption("logy");
 
   Add2RawsList(h0,   0, !expert,  image, !saveCorr) ;
-  Add2RawsList(h1,   1,  expert, !image, !saveCorr) ;
-  Add2RawsList(h2,   2,  expert, !image, !saveCorr) ;
-  Add2RawsList(h3,   3,  expert, !image, !saveCorr) ;
-  Add2RawsList(h4,   4,  expert, !image, !saveCorr) ;
+  Add2RawsList(h1,   1,  expert,  !image, !saveCorr) ;
+  Add2RawsList(h2,   2,  expert,  !image, !saveCorr) ;
+  Add2RawsList(h3,   3,  expert,  !image, !saveCorr) ;
+  Add2RawsList(h4,   4,  expert,  !image, !saveCorr) ;
   Add2RawsList(h5,   5, !expert,  image, !saveCorr) ;
-  Add2RawsList(h6,   6,  expert, !image, !saveCorr) ;
-  Add2RawsList(h7,   7,  expert, !image, !saveCorr) ;
-  Add2RawsList(h8,   8,  expert, !image, !saveCorr) ;
-  Add2RawsList(h9,   9,  expert, !image, !saveCorr) ;
+  Add2RawsList(h6,   6,  expert,  !image, !saveCorr) ;
+  Add2RawsList(h7,   7,  expert,  !image, !saveCorr) ;
+  Add2RawsList(h8,   8,  expert,  !image, !saveCorr) ;
+  Add2RawsList(h9,   9,  expert,  !image, !saveCorr) ;
   Add2RawsList(h10, 10, !expert,  image, !saveCorr) ;
   Add2RawsList(h11, 11,  expert, !image, !saveCorr) ;
   Add2RawsList(h12, 12,  expert, !image, !saveCorr) ;
@@ -239,8 +385,8 @@ void AliTOFQADataMakerRec::InitRaws()
   Add2RawsList(h21, 21,  expert, !image, !saveCorr) ;
   Add2RawsList(h22, 22,  expert, !image, !saveCorr) ;
   Add2RawsList(h23, 23,  expert, !image, !saveCorr) ;
-  Add2RawsList(h24, 24,  expert, !image, !saveCorr) ;
-
+  //
+  ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -249,77 +395,69 @@ void AliTOFQADataMakerRec::InitRecPoints()
   //
   // create RecPoints histograms in RecPoints subdir
   //
-
+  
   const Bool_t expert   = kTRUE ; 
   const Bool_t image    = kTRUE ; 
 
-  TH1I * h0 = new TH1I("hTOFRecPoints",    "TOF RecPoints multiplicity ; TOF RecPoints number;Counts",200, 0, 200) ;
+  TH1I * h0 = new TH1I("hTOFRecPoints",    "TOF RecPoints multiplicity ; TOF RecPoints number;Events",200, 0, 200) ;
 
-  TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns)- I/A side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ; 
-  TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ;
-  TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ;
-  TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ;
+  TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns)- I/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ; 
+  TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
+  TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
+  TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
   
-  TH1F * h5  = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side; Measured TOF time [ns];Counts", 25000, 0., 610.) ; 
-  TH1F * h6  = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side; Measured TOF time [ns];Counts", 25000, 0., 610.) ; 
-  TH1F * h7  = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side; Measured TOF time [ns];Counts", 25000, 0., 610.) ; 
-  TH1F * h8  = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side; Measured TOF time [ns];Counts", 25000, 0., 610.) ; 
+  TH1F * h5  = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
+  TH1F * h6  = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
+  TH1F * h7  = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
+  TH1F * h8  = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
  
-  TH1F * h9   = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ; 
-  TH1F * h10  = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ; 
-  TH1F * h11  = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ; 
-  TH1F * h12  = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ; 
-  TH1F * h13 = new TH1F("hTOFRawChannelHits","TOF channel hits count; Channel ID; Hits", 158000, 0., 158000);
-
-  TH2F * h14 = new TH2F("hTOFRecPointsClusMap","RecPoints vs TOF phi-eta; eta (2*strip+padz);phi (48*sector+padx)",183, -0.5, 182.5,865,-0.5,864.5) ; 
-  TH2F * h15 = new TH2F("hTOFRecTimeVsStrip","RecPoints TOF time vs. strip (theta); Strip index; RecPoints TOF time (ns) ",92,-1.,91, 250, 0., 610.) ;
-
-  TH2F * h16 = new TH2F("hTOFRecPointsTimeVsTRM035","TOF RecPoints time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF time [ns]", 361, 0., 361., 250, 0., 610.0) ;
-  TH2F * h17 = new TH2F("hTOFRecPointsTimeVsTRM3671","TOF RecPoints time vs TRM - crates 36 to 72; TRM index = DDL**10+TRM(0-9);TOF time [ns]", 361, 360., 721., 250, 0., 610.0) ;
-  TH2F * h18 = new TH2F("hTOFRecPointsToTVsTRM035","TOF RecPoints ToT vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF ToT [ns] ", 361, 0., 361., 100, 0., 48.8) ;
-  TH2F * h19 = new TH2F("hTOFRecPointsToTVsTRM3671","TOF RecPoints ToT vs TRM - crates 36 to 72; TRM index = DDL*10+TRM(0-9);TOF ToT [ns] ", 361, 360., 721., 100, 0., 48.8) ;
-    h0->Sumw2() ;
-    h1->Sumw2() ;
-    h2->Sumw2() ;
-    h3->Sumw2() ;
-    h4->Sumw2() ;
-    h5->Sumw2() ;
-    h6->Sumw2() ;
-    h7->Sumw2() ;
-    h8->Sumw2() ;
-    h9->Sumw2() ;
-    h10->Sumw2() ;
-    h11->Sumw2() ;
-    h12->Sumw2() ;
-    h13->Sumw2() ;
-    h14->Sumw2() ;
-    h15->Sumw2() ;
-    h16->Sumw2() ;
-    h17->Sumw2() ;
-    h18->Sumw2() ;
-    h19->Sumw2() ;
+  TH1F * h9   = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
+  TH1F * h10  = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
+  TH1F * h11  = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
+  TH1F * h12  = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
+  
+  TH2F * h13 = new TH2F("hTOFRecPointsClusMap","RecPoints map; sector ;strip", 72, 0., 18., 91, 0., 91.) ; 
+  TH2F * h14 = new TH2F("hTOFRecPointsTimeVsStrip","RecPoints TOF time vs. strip (theta); Strip index; RecPoints TOF time (ns) ",91, 0., 91., 250, 0., 610.) ;
+  TH2F * h15 = new TH2F("hTOFRecPointsTimeVsTRM035","TOF RecPoints time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF time [ns]", 361, 0., 361., 250, 0., 610.0) ;
+  TH2F * h16 = new TH2F("hTOFRecPointsTimeVsTRM3671","TOF RecPoints time vs TRM - crates 36 to 72; TRM index = DDL**10+TRM(0-9);TOF time [ns]", 361, 360., 721., 250, 0., 610.0) ;
 
+  h0->Sumw2() ;
+  h1->Sumw2() ;
+  h2->Sumw2() ;
+  h3->Sumw2() ;
+  h4->Sumw2() ;
+  h5->Sumw2() ;
+  h6->Sumw2() ;
+  h7->Sumw2() ;
+  h8->Sumw2() ;
+  h9->Sumw2() ;
+  h10->Sumw2() ;
+  h11->Sumw2() ;
+  h12->Sumw2() ;
+  h13->Sumw2() ;
+  h14->Sumw2() ;
+  h15->Sumw2() ;
+  h16->Sumw2() ;
+   
   Add2RecPointsList(h0, 0,   !expert,  image) ;
   Add2RecPointsList(h1, 1,   !expert,  image) ;
   Add2RecPointsList(h2, 2,   !expert,  image) ;
   Add2RecPointsList(h3, 3,   !expert,  image) ;
   Add2RecPointsList(h4, 4,   !expert,  image) ;
-  Add2RecPointsList(h5, 5,    expert, !image) ;
+  Add2RecPointsList(h5, 5,    expert,  !image) ;
   Add2RecPointsList(h6, 6,    expert, !image) ;
   Add2RecPointsList(h7, 7,    expert, !image) ;
   Add2RecPointsList(h8, 8,    expert, !image) ;
-  Add2RecPointsList(h9, 9,   !expert,  image) ;
-  Add2RecPointsList(h10, 10, !expert,  image) ;
-  Add2RecPointsList(h11, 11, !expert,  image) ;
-  Add2RecPointsList(h12, 12, !expert,  image) ;
+  Add2RecPointsList(h9, 9,   !expert, !image) ;
+  Add2RecPointsList(h10, 10, !expert, !image) ;
+  Add2RecPointsList(h11, 11, !expert, !image) ;
+  Add2RecPointsList(h12, 12, !expert, !image) ;
   Add2RecPointsList(h13, 13,  expert, !image) ;
-  Add2RecPointsList(h14, 14,  expert, !image) ;
+  Add2RecPointsList(h14, 14,  expert, image) ;
   Add2RecPointsList(h15, 15,  expert, !image) ;
   Add2RecPointsList(h16, 16,  expert, !image) ;
-  Add2RecPointsList(h17, 17,  expert, !image) ;
-  Add2RecPointsList(h18, 18,  expert, !image) ;
-  Add2RecPointsList(h19, 19,  expert, !image) ;
+  //
+  ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -333,16 +471,16 @@ void AliTOFQADataMakerRec::InitESDs()
   const Bool_t image    = kTRUE ; 
 
   TH1I * h0  = new TH1I("hTOFESDs", "Number of matched TOF tracks per event;Number of TOF matched ESD tracks;Counts", 200, 0, 200) ;  
-  TH1F * h1  = new TH1F("hTOFESDsTime", "Matched  ESDs tracks: TOF Time spectrum; Calibrated TOF time [ns];Counts", 25000, 0., 610. ) ; 
-  TH1F * h2  = new TH1F("hTOFESDsRawTime", "Matched ESDs tracks: TOF raw Time spectrum;Measured TOF time [ns];Counts", 25000, 0., 610.) ; 
-  TH1F * h3  = new TH1F("hTOFESDsToT", "Matched ESDs tracks: TOF ToT spectrum; ESDs ToT [ns];Counts",1000, 0., 48.8) ; 
-  TH1F * h4  = new TH1F("hTOFESDsPIDoverMatched", "Fraction of TOF identified tracks over matched TOF tracks per event; identified by TOF / matched tracks [%];Counts", 101, -1., 100.) ;  
-  TH1F * h5  = new TH1F("hTOFESDsPID", "Fraction of TOF identified tracks over ESD identified tracks per event;  identified by TOF / ESD identified [%];Counts", 101, -1., 100.) ;  
-  TH1F * h6  = new TH1F("hTOFESDsTPCmatched", "TPC-TOF matched tracks momentum distribution (GeV/c); p (GeV/c);Counts", 50, 0.20, 5.00) ;  
-  TH1F * h7  = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability per event;TPC-TOF track-matching probability (%)  ;Counts",101, -1.0, 100) ;  
-  TH1F * h8  = new TH1F("hTOFESDsHitOverTracked", "Fraction of TOF matching tracks over propagated tracks per event; TOF matched / propagated to TOF [%];Counts",101, -1.0, 100.0) ;  
-  TH1F * h9  = new TH1F("hTOFESDsDiffTime", "ESDs t_{TOF}-t_{exp} spectrum in TOF (ps); t_{TOF}-t_{exp} [ps];Counts", 200, -2440., 2440.) ; 
-  TH1F * h10  = new TH1F("hTOFHitsLength", "Matched ESDs tracks: Length Spectrum; Track length [cm];Counts", 800, 0., 800) ; 
+  TH1F * h1  = new TH1F("hTOFESDsTime", "Matched  ESDs tracks: TOF Time spectrum; Calibrated TOF time [ns];Counts", 250, 0., 610. ) ; 
+  TH1F * h2  = new TH1F("hTOFESDsRawTime", "Matched ESDs tracks: TOF raw Time spectrum;Measured TOF time [ns];Counts", 250, 0., 610.) ; 
+  TH1F * h3  = new TH1F("hTOFESDsToT", "Matched ESDs tracks: TOF ToT spectrum; ESDs ToT [ns];Counts",100, 0., 48.8) ; 
+  TH1F * h4  = new TH1F("hTOFESDskTOFOUT", "p_{T}  distribution of tracks with kTOFout; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;  
+  TH1F * h5  = new TH1F("hTOFESDskTIME", "p_{T}  distribution of tracks with kTOFout && kTIME; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;  
+  TH1F * h6  = new TH1F("hTOFESDsMatched", "p_{T} distribution of tracks with kTOFout && TOFtime>0; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;  
+  TH1F * h7  = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability;TOF matching probability (%)  ;Counts",101, -1.0, 100) ;  
+  TH1F * h8  = new TH1F("hTOFESDsDiffTime", "ESDs t_{TOF}-t_{exp,pi} spectrum in TOF (ps); t_{TOF}-t_{exp,pi} [ps];Counts", 200, -2440., 2440.) ; 
+  TH1F * h9  = new TH1F("hTOFHitsLength", "Matched ESDs tracks: Length Spectrum; Track length [cm];Counts", 800, 0., 800) ; 
+
   h0->Sumw2() ;
   h1->Sumw2() ;
   h2->Sumw2() ;
@@ -353,19 +491,19 @@ void AliTOFQADataMakerRec::InitESDs()
   h7->Sumw2() ;
   h8->Sumw2() ;
   h9->Sumw2() ;
-  h10->Sumw2() ;
 
   Add2ESDsList(h0, 0, !expert,  image) ;
   Add2ESDsList(h1, 1, !expert,  image) ;
-  Add2ESDsList(h2, 2,  expert,  image) ;
-  Add2ESDsList(h3, 3, !expert,  image) ;
+  Add2ESDsList(h2, 2,  expert,  !image) ;
+  Add2ESDsList(h3, 3, !expert,  !image) ;
   Add2ESDsList(h4, 4,  expert,  image) ;
   Add2ESDsList(h5, 5,  expert,  image) ;
   Add2ESDsList(h6, 6,  expert,  image) ; 
   Add2ESDsList(h7, 7,  expert,  image) ; 
-  Add2ESDsList(h8, 8,  expert,  image) ; 
-  Add2ESDsList(h9, 9, !expert,  image) ;
-  Add2ESDsList(h10, 10, !expert,  image) ;
+  Add2ESDsList(h8, 8,  expert,  !image) ; 
+  Add2ESDsList(h9, 9, !expert,  !image) ;
+  //
+  ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line 
 }
 
 
@@ -375,139 +513,177 @@ void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
   //
   // makes data from Raws
   //
-    if (rawReader->GetType()==7) {
-       
-       Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;//in ns
-       Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
-       
-       Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
-       for (Int_t j=0;j<5;j++){ ntof[j]=0;}
-       
-       Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
-       Int_t volumeID[5];   //(sector,plate,strip,padX,padZ)
-       Int_t volumeID2[5];   //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
-       Int_t out[5]; //   out=(indexZ,indexPhi)   
-       Int_t chIndex=-1;
-       
-       TClonesArray * clonesRawData;
-       AliTOFRawStream tofInput(rawReader);
-       
-       //uncomment if needed to apply DeltaBC correction
-       //tofInput.ApplyBCCorrections(kTRUE);
+  if (rawReader->GetType()==7) {
+   
+    Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;//in ns
+    Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
+    Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
+    for (Int_t j=0;j<5;j++){ ntof[j]=0;}
+    Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
+    Int_t volumeID[5];   //(sector,plate,strip,padX,padZ)
+    Int_t volumeID2[5];   //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
+    Int_t chIndex=-1;
+    
+    TClonesArray * clonesRawData;
+    fTOFRawStream.SetRawReader(rawReader);
+    Int_t BCID=rawReader->GetBCID();
+    
+    //uncomment if needed to apply DeltaBC correction
+    //fTOFRawStream.ApplyBCCorrections(kTRUE);
+    if (fDecoderSummary){
+      fDecoderSummary->Reset();
+    }
+    for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
+      rawReader->Reset();
+      fTOFRawStream.LoadRawDataBuffersV2(iDDL);
+      
+      //* get decoding error counters
+      fDecoderSummary = ( (AliTOFDecoderV2*) fTOFRawStream.GetDecoderV2() )->GetDecoderSummaryData();
+      if ( (fDecoderSummary) && (fDecoderSummary ->GetErrorDetected()) ) {
+       Int_t errorSlotID=(Int_t) fDecoderSummary->GetErrorSlotID();
+       FillRawsData(18,iDDL,errorSlotID);
+       if (fDecoderSummary -> GetRecoverError() )              
+         FillRawsData(18,iDDL,13);
+      }     
+      
+      clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
+      for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
+       AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
        
-       for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
-           rawReader->Reset();
+       if (tofRawDatum->GetTOF()){
+         equipmentID[0]=iDDL;
+         equipmentID[1]=tofRawDatum->GetTRM(); 
+         equipmentID[2]=tofRawDatum->GetTRMchain();
+         equipmentID[3]=tofRawDatum->GetTDC();
+         equipmentID[4]=tofRawDatum->GetTDCchannel();
+         
+         if (CheckEquipID(equipmentID)){
+           fTOFRawStream.EquipmentId2VolumeId(iDDL, 
+                                              tofRawDatum->GetTRM(), 
+                                              tofRawDatum->GetTRMchain(),
+                                              tofRawDatum->GetTDC(), 
+                                              tofRawDatum->GetTDCchannel(), 
+                                              volumeID);
+           //LTM data
+           if (FilterLTMData(equipmentID)) { //counts LTM hits
+             if (equipmentID[2]==1)  //crate left, A-side or C-side
+               FillRawsData(15,equipmentID[0]);
+             else 
+               FillRawsData(15,equipmentID[0]-1);  
+             continue;
+           }
            
-           tofInput.LoadRawDataBuffersV2(iDDL);
-           clonesRawData = (TClonesArray*)tofInput.GetRawData();
-           for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
-               AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
-               
-               if (tofRawDatum->GetTOF()){
-                   
-                   equipmentID[0]=iDDL;
-                   equipmentID[1]=tofRawDatum->GetTRM(); 
-                   equipmentID[2]=tofRawDatum->GetTRMchain();
-                   equipmentID[3]=tofRawDatum->GetTDC();
-                   equipmentID[4]=tofRawDatum->GetTDCchannel();
-                   
-                   if (CheckEquipID(equipmentID)){
-                       tofInput.EquipmentId2VolumeId(iDDL, 
-                                                     tofRawDatum->GetTRM(), 
-                                                     tofRawDatum->GetTRMchain(),
-                                                     tofRawDatum->GetTDC(), 
-                                                     tofRawDatum->GetTDCchannel(), 
-                                                     volumeID);
-                       if (FilterSpare(equipmentID)) continue;
-                       if (FilterLTMData(equipmentID)){ //counts LTM hits
-                           if (tofRawDatum->GetTOT()) GetRawsData(15)->Fill(equipmentID[0]);
-                       } else {
-                           if (CheckVolumeID(volumeID)){  
-                               
-                               GetMapIndeces(volumeID,out);
-                               volumeID2[0]=volumeID[0];
-                               volumeID2[1]=volumeID[1];
-                               volumeID2[2]=volumeID[2];
-                               volumeID2[3]=volumeID[4];
-                               volumeID2[4]=volumeID[3];
-                               chIndex=AliTOFGeometry::GetIndex(volumeID2);
-                               
-                               if (tofRawDatum->GetTOT()){         
-                                   if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
-                                       && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter
-                                       ntof[0]++; //counter for tof hits
-                                       
-                                       //fill global spectra for DQM plots
-                                       GetRawsData(5)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
-                                       GetRawsData(10)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns
-                                       
-                                       //fill side-related spectra for experts plots
-                                       if (volumeID2[0]>4 && volumeID2[0]<14){       //I side
-                                           if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
-                                               ntof[1]++;
-                                               GetRawsData(6)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
-                                               GetRawsData(11)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
-                                           } else {
-                                               if ((iDDL%4==2)|| (iDDL%4==3)){//C side
-                                                   ntof[3]++;
-                                                   GetRawsData(8)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
-                                                   GetRawsData(13)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
-                                               }
-                                           }
-                                       } else {                                    
-                                           if (volumeID2[0]<5 || volumeID2[0]>13){   //O side
-                                               if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
-                                                   ntof[2]++;
-                                                   GetRawsData(7)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
-                                                   GetRawsData(12)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
-                                               } else {
-                                                   if ((iDDL%4==2)|| (iDDL%4==3)){//C side
-                                                       ntof[4]++;
-                                                       GetRawsData(9)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
-                                                       GetRawsData(14)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
-                                                   }
-                                               }
-                                           }   
-                                       }
-                                       GetRawsData(18)->Fill(chIndex);
-                                       //compute TRM offset
-                                       Int_t trm= iDDL*10+(equipmentID[1]-3);
-                                       if (iDDL>=0 && iDDL<36) {
-                                           GetRawsData(16)->Fill(trm) ;
-                                           GetRawsData(20)->Fill(trm,tofRawDatum->GetTOF()*tdc2ns);
-                                           GetRawsData(22)->Fill(trm,tofRawDatum->GetTOT()*tot2ns);
-                                       }
-                                       if (iDDL>=36 && iDDL<72) {
-                                           GetRawsData(17)->Fill(trm) ;//in ns 
-                                           GetRawsData(21)->Fill(trm,tofRawDatum->GetTOF()*tdc2ns);
-                                           GetRawsData(23)->Fill(trm,tofRawDatum->GetTOT()*tot2ns);
-                                       }                               
-                                       GetRawsData(24)->Fill(GetStripIndex(volumeID),tofRawDatum->GetTOF()*tdc2ns) ;
-                                       //GetRawsData(25)->Fill( out[0],out[1]) ;//raw map
-                                   }//noise filter
-                               }//end hit selection
-                               else { //orphans
-                                   if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
-                                       && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk))
-                                       GetRawsData(19)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
-                               }//end orphans
-                           }//end volumeID check
-                       }//end LTM filter
-                   }//end equipID check
-               }
-           } //while loop
-           clonesRawData->Clear();
-       } // DDL Loop
-       
-       for (Int_t j=0;j<5;j++){
-           GetRawsData(j)->Fill(ntof[j]);
-       }
-       fProcessedRawEventN++;
-       
-    } else {
-       AliDebug(1,Form("Event of type %d found. Skipping non-physics event for QA.\n", rawReader->GetType())); 
+           //TRM data
+           if (CheckVolumeID(volumeID)){  
+             volumeID2[0]=volumeID[0];
+             volumeID2[1]=volumeID[1];
+             volumeID2[2]=volumeID[2];
+             volumeID2[3]=volumeID[4];
+             volumeID2[4]=volumeID[3];
+             chIndex=AliTOFGeometry::GetIndex(volumeID2);
+             
+             if (tofRawDatum->GetTOT()){           
+               if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
+                   && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter
+                 ntof[0]++; //counter for tof hits
+                 
+                 //fill global spectra for DQM plots
+                 FillRawsData(5, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
+                 FillRawsData(10, tofRawDatum->GetTOT()*tot2ns) ;//in ns
+                 FillRawsData(23, BCID, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
+                 
+                 //fill side-related spectra for experts plots
+                 Int_t ddlACside=iDDL/36; // 0 or 1
+                 Int_t ddlPerSm=iDDL%4;
+                 
+                 if (volumeID2[0]>4 && volumeID2[0]<14){       //O side
+                   if (ddlPerSm<2){ //A side
+                     ntof[1]++;
+                     FillRawsData(6, tofRawDatum->GetTOF()*tdc2ns) ;
+                     FillRawsData(11, tofRawDatum->GetTOT()*tot2ns) ;
+                   } else {  //C side
+                     ntof[3]++;
+                     FillRawsData(8, tofRawDatum->GetTOF()*tdc2ns) ;
+                     FillRawsData(13, tofRawDatum->GetTOT()*tot2ns) ;
+                   }
+                 } else {                                    
+                   if (volumeID2[0]<5 || volumeID2[0]>13){   //I side
+                     if (ddlPerSm<2){ //A side
+                       ntof[2]++;
+                       FillRawsData(7, tofRawDatum->GetTOF()*tdc2ns) ;
+                       FillRawsData(12, tofRawDatum->GetTOT()*tot2ns) ;
+                     } else {//C side
+                       ntof[4]++;
+                       FillRawsData(9, tofRawDatum->GetTOF()*tdc2ns) ;
+                       FillRawsData(14, tofRawDatum->GetTOT()*tot2ns) ;
+                     }
+                   }   
+                 }
+                 
+                 //compute TRM offset
+                 Int_t trm= iDDL*10+(equipmentID[1]-3);
+                 FillRawsData(20+ddlACside,trm,tofRawDatum->GetTOF()*tdc2ns);
+                 FillRawsData(22,GetStripIndex(volumeID),tofRawDatum->GetTOF()*tdc2ns) ;
+                 Short_t fea = volumeID2[4]/12;
+                 Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
+                 FillRawsData(17,hitmapx,GetStripIndex(volumeID2));
+               }//noise filter
+             }//end hit selection
+             else { //orphans
+               if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
+                   && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk))
+                 FillRawsData(19, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
+             }//end orphans
+           }//end volumeID check
+         }//end equipID check
+       }//end tof check
+      }//loop on raw data
+      clonesRawData->Clear();
+    } // DDL Loop
+    
+    for (Int_t j=0;j<5;j++) FillRawsData(j,ntof[j]);
+    //    fProcessedRawEventN++; // RS Now the framework conters are use
+    fTOFRawStream.Clear();
+  } else {
+    AliDebug(1,Form("Event of type %d found. Skipping non-physics event for QA.\n", rawReader->GetType())); 
+  }
+  
+  //fill reference map for DQM shifter only once in a detector cycle 
+  if (fIsSOC) {
+    Int_t geoId[5]={-1,-1,-1,-1,-1};// pgeoId=(sm, mod, strip, padZ, padX)
+    Int_t detId[5]={-1,-1,-1,-1,-1};//detID=(ddl,trm,tdc, chain,channel)
+    Int_t trmIndex=-1;
+    for (Int_t ch = 0; ch <  fCalibData->GetSize(); ch++) {
+      AliTOFGeometry::GetVolumeIndices(ch,geoId);
+      AliTOFRawStream::Geant2EquipmentId(geoId,detId); 
+      if ((detId[1]<0)||(detId[0]<0)) continue;
+      trmIndex=(detId[1]-3)+detId[0]*10;
+      
+      //set TRM counters
+      // if (fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
+      //       fTRMNoisyArray[trmIndex]+=1;
+      // if (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk)
+      //       fTRMHwOkArray[trmIndex]+=1;
+      
+      if ( (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad))
+          && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk) ){
+       //fTRMEnabledArray[trmIndex]+=1;        
+       //fill reference map with info from OCDB
+       Short_t fea = geoId[4]/12;
+       Float_t hitmapx = geoId[0] + ((Double_t)(3 - fea) + 0.5)*0.25;
+       FillRawsData(16,hitmapx, GetStripIndex(geoId));
+      }
     }
-    EnableDqmShifterOpt(kTRUE);
+    //printf("Counters for noisy, enabled and good channels in TOF  TRMs read from OCDB.\n");
+    fIsSOC=kFALSE;
+  }
+    
+  //enable options for DQM shifter
+  EnableDqmShifterOpt(kTRUE);
+  //
+  IncEvCountCycleRaws();
+  IncEvCountTotalRaws();
+  //
 }
 
 //____________________________________________________________________________
@@ -519,11 +695,10 @@ void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
  
   Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
   Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
-
-  Int_t volumeID[5];
-  Int_t volumeID2[5];
-  Int_t out[5];
-
+  
+  Int_t volumeID2[5];//(sm, plate,strip, padZ,padX)
+  //Int_t volumeID[5];//(sm, plate,strip, padX,padZ) 
+    
   TBranch *branch=clustersTree->GetBranch("TOF");
   if (!branch) { 
     AliError("can't get the branch with the TOF clusters !");
@@ -534,76 +709,72 @@ void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
   dummy.Clear();
   TClonesArray *clusters=&dummy;
   branch->SetAddress(&clusters);
-
+  
   // Import the tree
   clustersTree->GetEvent(0);  
  
-  GetRecPointsData(0)->Fill((Int_t)clusters->GetEntriesFast()) ; 
+  FillRecPointsData(0,(Int_t)clusters->GetEntriesFast()) ; 
   
   TIter next(clusters) ; 
   AliTOFcluster * c ; 
   while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
    
-      volumeID[0] = c->GetDetInd(0);
-      volumeID[1] = c->GetDetInd(1);
-      volumeID[2] = c->GetDetInd(2);
-      volumeID[3] = c->GetDetInd(4); //X and Z indeces inverted in RecPoints
-      volumeID[4] = c->GetDetInd(3); //X and Z indeces inverted in RecPoints
+      // volumeID2[0] = c->GetDetInd(0);
+      // volumeID2[1] = c->GetDetInd(1);
+      // volumeID2[2] = c->GetDetInd(2);
+      // volumeID2[3] = c->GetDetInd(4); //padX
+      // volumeID2[4] = c->GetDetInd(3); //padZ 
       
       for (Int_t i=0;i<5;i++){
-         volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints
+       volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints
       }
-      
-      GetMapIndeces(volumeID,out);
-      Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2);
+      //Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2);
       Int_t iDDL=AliTOFRawStream::Geant2DDL(volumeID2);
       Int_t iTRM=AliTOFRawStream::Geant2TRM(volumeID2);
-
-      if (c->GetTDCRAW() && c->GetTDC() && c->GetToT()){
-         if (volumeID2[0]>4 && volumeID2[0]<14){       //I side
-             if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
-                 GetRecPointsData(1)->Fill( c->GetTDC()*tdc2ns) ;//in ns
-                 GetRecPointsData(5)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
-                 GetRecPointsData(9)->Fill( c->GetToT()*tot2ns) ;//in ns
-                 
-             } else {
-                 if ((iDDL%4==2)|| (iDDL%4==3)){//C side
-                     GetRecPointsData(3)->Fill( c->GetTDC()*tdc2ns) ;//in ns
-                     GetRecPointsData(7)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
-                     GetRecPointsData(11)->Fill( c->GetToT()*tot2ns) ;//in ns
-                 }
-             }
-         } else {
-             if (volumeID2[0]<5 || volumeID2[0]>13){       //O side
-                 if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
-                     GetRecPointsData(2)->Fill( c->GetTDC()*tdc2ns) ;//in ns
-                     GetRecPointsData(6)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
-                     GetRecPointsData(10)->Fill( c->GetToT()*tot2ns) ;//in ns
-                 } else {
-                     if ((iDDL%4==2)|| (iDDL%4==3)){//C side
-                         GetRecPointsData(4)->Fill( c->GetTDC()*tdc2ns) ;//in ns
-                         GetRecPointsData(8)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
-                         GetRecPointsData(12)->Fill( c->GetToT()*tot2ns) ;//in ns
-                     }
-                 }
-             }
-         }
-         GetRecPointsData(14)->Fill(out[0],out[1]);
-         GetRecPointsData(15)->Fill(GetStripIndex(volumeID), c->GetTDC()*tdc2ns) ;
-         Int_t trm= iDDL*10+(iTRM-3);
-         if (iDDL>=0 && iDDL<36) {
-             GetRecPointsData(16)->Fill(trm,c->GetTDC()*tdc2ns);
-             GetRecPointsData(18)->Fill(trm,c->GetToT()*tot2ns);
+      Short_t fea = volumeID2[4]/12;
+      Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
+      Int_t ddlACside=iDDL/36; // 0 or 1
+      Int_t ddlPerSm=iDDL%4;
+      
+      if ((c->GetTDCRAW()) && (c->GetTDC()) && (c->GetToT())){
+       if (volumeID2[0]>4 && volumeID2[0]<14){       //I side
+         if (ddlPerSm<2){ //A side
+           FillRecPointsData(1, c->GetTDC()*tdc2ns) ;//in ns
+           FillRecPointsData(5, c->GetTDCRAW()*tdc2ns) ;//in ns
+           FillRecPointsData(9, c->GetToT()*tot2ns) ;//in ns
+         } else {//C side
+           FillRecPointsData(3, c->GetTDC()*tdc2ns) ;//in ns
+           FillRecPointsData(7, c->GetTDCRAW()*tdc2ns) ;//in ns
+           FillRecPointsData(11, c->GetToT()*tot2ns) ;//in ns
          }
-         if (iDDL>=36 && iDDL<72) {
-             GetRecPointsData(17)->Fill(trm,c->GetTDC()*tdc2ns);
-             GetRecPointsData(19)->Fill(trm,c->GetToT()*tot2ns);
+       } else {
+         if (volumeID2[0]<5 || volumeID2[0]>13){       //O side
+           if (ddlPerSm<2){ //A side
+             FillRecPointsData(2, c->GetTDC()*tdc2ns) ;//in ns
+             FillRecPointsData(6, c->GetTDCRAW()*tdc2ns) ;//in ns
+             FillRecPointsData(10, c->GetToT()*tot2ns) ;//in ns
+           } else { //C side
+             FillRecPointsData(4, c->GetTDC()*tdc2ns) ;//in ns
+             FillRecPointsData(8, c->GetTDCRAW()*tdc2ns) ;//in ns
+             FillRecPointsData(12, c->GetToT()*tot2ns) ;//in ns
+           }
          }
-         GetRecPointsData(13)->Fill(chIndex) ;//in ns
+       }
+       FillRecPointsData(13,hitmapx,GetStripIndex(volumeID2));
+       FillRecPointsData(14,GetStripIndex(volumeID2), c->GetTDC()*tdc2ns) ;
+       Int_t trm= iDDL*10+(iTRM-3);
+       if (ddlACside==0) { //A side
+         FillRecPointsData(15,trm,c->GetTDC()*tdc2ns);
+       } else {//C side
+         FillRecPointsData(16,trm,c->GetTDC()*tdc2ns);
+       }
       }//hit selection
-  }//end while  
+  }//end while   
   EnableDqmShifterOpt(kFALSE);
+  //
+  IncEvCountCycleRecPoints();
+  IncEvCountTotalRecPoints();
+  //
 }
 
 //____________________________________________________________________________
@@ -612,76 +783,62 @@ void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
   //
   // make QA data from ESDs
   //  
-    const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
-    const Double_t pionMass = 0.13957018; //GeV/c^2
-
-    Int_t ntrk = esd->GetNumberOfTracks() ; 
-    Int_t ntof=0;
-    Int_t ntofpid=0;
-    Int_t nesdpid=0;
-    Int_t ntpc=0;
-    Int_t ntpctof=0;
-    Int_t ntofout=0;
-    
-    while (ntrk--) {
-       AliESDtrack *track=esd->GetTrack(ntrk);
-       Double_t tofTime=track->GetTOFsignal();//in ps
-       Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
-       Double_t tofToT=track->GetTOFsignalToT(); //in ps
-
-       UInt_t status=track->GetStatus();
-       if (track->IsOn(AliESDtrack::kTPCrefit)) {
-           ntpc++;
-           Double_t y=track->Eta();
-           if ((status&AliESDtrack::kTOFout)!=0) {
-               ntofout++;
-               if (tofTime>0){
-                   ntof++;
-                   
-                   if (TMath::Abs(y)<0.9) {
-                       GetESDsData(6)->Fill(track->Pt());
-                       ntpctof++;
-                   }
-                   GetESDsData(1)->Fill(tofTime*1E-3);
-                   GetESDsData(2)->Fill(tofTimeRaw*1E-3); 
-                   GetESDsData(3)->Fill(tofToT*1E-3);
-                   //check how many tracks where ESD PID is ok 
-                   if ((status&AliESDtrack::kESDpid)!=0) nesdpid++; 
-                   if (((status&AliESDtrack::kESDpid)&AliESDtrack::kTOFpid)!=0) ntofpid++;
-                   
-                   Double_t length =track->GetIntegratedLength();
-                   Double_t mom2=(track->Pt()*track->Pt())+(track->Pz()*track->Pz());
-                   Double_t eTexp = TMath::Sqrt(1+(pionMass*pionMass/mom2))*length/speedOfLight; //in ps
-                   GetESDsData(9)->Fill(tofTime-eTexp);
-                   GetESDsData(10)->Fill(length);
-               } //end check on matched tracks
-           }
-       }//end check on TPCrefit
-    }
-    
-    GetESDsData(0)->Fill(ntof) ;
+  const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
+  const Double_t pionMass = 0.13957018; //GeV/c^2
+
+  Int_t ntrk = esd->GetNumberOfTracks() ; 
+  Int_t ntpc=0;
+  Int_t ntofout=0;
   
-    
-    if(ntof>0) {
-       Float_t ratio = (Int_t)ntofpid/(Int_t)ntof*100; //identified by TOF over matched
-       GetESDsData(4)->Fill(ratio) ;
-    }
-    
-    if(nesdpid>0) {
-       Float_t ratio = (Float_t)ntofpid/(Float_t)nesdpid *100; //identified by TOF over identified
-       GetESDsData(5)->Fill(ratio) ;
+    while (ntrk--) {
+      AliESDtrack *track=esd->GetTrack(ntrk);
+      Double_t tofTime=track->GetTOFsignal();//in ps
+      Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
+      Double_t tofToT=track->GetTOFsignalToT(); //in ps
+      
+      UInt_t status=track->GetStatus();
+      if (track->IsOn(AliESDtrack::kTPCrefit)) {
+       ntpc++;
+       Double_t y=track->Eta();
+       if (TMath::Abs(y)<0.9) { //select TOF acceptance
+         if ((status&AliESDtrack::kTOFout)!=0)  { //define matching
+           ntofout++;
+           FillESDsData(1,tofTime*1E-3);
+           FillESDsData(2,tofTimeRaw*1E-3); 
+           FillESDsData(3,tofToT*1E-3);
+           FillESDsData(4,track->Pt());
+           
+           Double_t length =track->GetIntegratedLength();
+           Double_t mom2=(track->Pt()*track->Pt())+(track->Pz()*track->Pz());
+           Double_t piTexp = TMath::Sqrt(1+(pionMass*pionMass/mom2))*length/speedOfLight; //in ps
+           FillESDsData(8,tofTime-piTexp);
+           FillESDsData(9,length);
+           
+           if ((status&AliESDtrack::kTIME)!=0) 
+             FillESDsData(5,track->Pt());
+           
+           if (tofTime>0)
+             FillESDsData(6,track->Pt());
+         } //end check on matched tracks
+       } 
+      }//end check on TPCrefit
     }
     
+    FillESDsData(0,ntofout) ;
     if(ntpc>0){
-       Float_t ratio = (Float_t)ntof/(Float_t)ntpc*100.; //matching probability
-       GetESDsData(7)->Fill(ratio) ;
+      Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100.; //matching probability
+      FillESDsData(7,ratio) ;
     }
     
     if(ntofout>0) {
-       Float_t ratio = (Float_t)ntof/(Float_t)ntofout*100; //matched over propagated to TOF outer radius
-       GetESDsData(8)->Fill(ratio) ;
+       Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100; //matched over propagated to TOF outer radius
+       FillESDsData(8,ratio) ;
     }
     EnableDqmShifterOpt(kFALSE);
+    //
+    IncEvCountCycleESDs();
+    IncEvCountTotalESDs();
+    //
 }
 
 //____________________________________________________________________________ 
@@ -689,143 +846,92 @@ void AliTOFQADataMakerRec::StartOfDetectorCycle()
 {
   //
   //Detector specific actions at start of cycle
+  // ResetAllTRMcounters();
   fCalibData = GetCalibData();
-
-}
+  fIsSOC=kTRUE;
+  return;
+}  
 
 //____________________________________________________________________________ 
 void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
 {
   //Detector specific actions at end of cycle
   // do the QA checking
-     for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
-       if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
-           continue ; 
+  ResetEventTrigClasses();
+  //
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+    if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;     
+    SetEventSpecie(AliRecoParam::ConvertIndex(specie));  
+
+    for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
+
+      if (fEnableDqmShifterOpt) {
+       // RS: fetch the histograms for given trigger class
+       TObjArray& arrRW = *GetRawsDataOfTrigClass(itc);
        
+       // Help make the raw qa histogram easier to interpret for the DQM shifter
+       if (!arrRW[ 0] || !arrRW[ 5] || !arrRW[10] || !arrRW[15] || !arrRW[16] || !arrRW[17]) continue;
+       
+       printf("=========>Processed %i physics raw of specie %s with TrigGlass %d\n",
+              GetEvCountCycleRaws(itc),AliRecoParam::GetEventSpecieName(specie), itc);
+       
+       //Double_t monitorPeriodLength=fProcessedRawEventN*600*1E-9;//in s
+      
        if (fCalibData){
-           //normalize TRM hits plots to the number of enabled channels from OCDB object
-           TH1F * hTrmChannels035 = new TH1F("hTrmchannels035", "Active channels per TRM - crates 0 to 35;TRM index = SMid(crate*10)+TRM(0-9);Active channels",  361, 0., 361.) ;
-           TH1F * hTrmChannels3671 = new TH1F("hTrmChannels3671","Active channels per TRM - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Active channels", 361, 360., 721.) ;
-           
-           for (Int_t ch = 0; ch <  fCalibData->GetSize(); ch++) {
-               if (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
-                                       && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk)){
-                   Int_t geoId[5];
-                   Int_t detId[5];
-                   AliTOFGeometry::GetVolumeIndices(ch,geoId);
-                   AliTOFRawStream::Geant2EquipmentId(geoId,detId); //detID=(ddl,trm,tdc, chain,channel)
-                   if (detId[0]<36) hTrmChannels035->Fill((detId[1]-3)+detId[0]*10);
-                   else hTrmChannels3671->Fill((detId[1]-3)+detId[0]*10);
-               }
-           }
-           GetRawsData(16)->Divide(hTrmChannels035);
-           GetRawsData(16)->SetTitle("TRMs average hit number per active channel - crates 0-35");
-           GetRawsData(16)->GetYaxis()->SetTitle("hits/active channels");
-           GetRawsData(17)->Divide(hTrmChannels3671);
-           GetRawsData(17)->SetTitle("TRMs average hit number per active channel - crates 36-71");
-           GetRawsData(17)->GetYaxis()->SetTitle("hits/active channels");
-       }
-
-       if (fEnableDqmShifterOpt){
-           // Help make the raw qa histogram easier to interpret for the DQM shifter
-           // This is still to be optimized...
-           
-           if (!GetRawsData(0) || !GetRawsData(5) || !GetRawsData(10) 
-               || !GetRawsData(15) || !GetRawsData(16) || !GetRawsData(17)) {
-               printf("No histogram for DQM found - Possible memory corruption ???. Please check\n") ; 
-               continue;
-           }
-           AliInfo(Form("Processed %i physics raw events",fProcessedRawEventN));
-           
-           
-           if (fCalibData){
-               //normalize TRM hits plots to the number of enabled channels from OCDB object
-               TH1F * hTrmChannels035 = new TH1F("hTrmchannels035", "Active channels per TRM - crates 0 to 35;TRM index = SMid(crate*10)+TRM(0-9);Active channels",  361, 0., 361.) ;
-               TH1F * hTrmChannels3671 = new TH1F("hTrmChannels3671","Active channels per TRM - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Active channels", 361, 360., 721.) ;
-               
-               for (Int_t ch = 0; ch <  fCalibData->GetSize(); ch++) {
-                   if (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
-                       && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk)){
-                       Int_t geoId[5];
-                       Int_t detId[5];
-                       AliTOFGeometry::GetVolumeIndices(ch,geoId);
-                       AliTOFRawStream::Geant2EquipmentId(geoId,detId); //detID=(ddl,trm,tdc, chain,channel)
-                       if (detId[0]<36) hTrmChannels035->Fill((detId[1]-3)+detId[0]*10);
-                       else hTrmChannels3671->Fill((detId[1]-3)+detId[0]*10);
-                   }
-               }
-               GetRawsData(16)->Divide(hTrmChannels035);
-               GetRawsData(16)->SetTitle("TRMs average hit number per active channel - crates 0-35");
-               GetRawsData(16)->GetYaxis()->SetTitle("hits/active channels");
-               GetRawsData(17)->Divide(hTrmChannels3671);
-               GetRawsData(17)->SetTitle("TRMs average hit number per active channel - crates 36-71");
-               GetRawsData(17)->GetYaxis()->SetTitle("hits/active channels");
+         //set minima and maxima to allow log scale
+         Double_t yTimeMax = ((TH1*)arrRW[5])->GetMaximum()*1.05;
+         Double_t yTotMax = ((TH1*)arrRW[10])->GetMaximum()*1.05;
+         fLineExpTimeMin->SetY2(yTimeMax);
+         fLineExpTimeMax->SetY2(yTimeMax);
+         fLineExpTotMin->SetY2(yTotMax);
+         fLineExpTotMax->SetY2(yTotMax);
+         //
+         for (Int_t j=0;j<18;j++){
+           if ((j==0)||(j==5)||(j==10)||(j==15)||(j==16)||(j==17)) {
+             TH1* htmp = (TH1*)arrRW[j];
+             htmp->GetXaxis()->SetLabelOffset(0.005);
+             htmp->GetXaxis()->SetLabelSize(0.05);
+             htmp->GetXaxis()->SetTitleOffset(0.8);
+             htmp->GetXaxis()->SetTitleSize(0.05);
+             htmp->GetYaxis()->SetLabelOffset(0.005);
+             htmp->GetYaxis()->SetLabelSize(0.06);
+             htmp->GetYaxis()->SetTitleOffset(0.8);
+             htmp->GetYaxis()->SetTitleSize(0.06);       
            }
-           
-           
-           Double_t yTimeMin = GetRawsData(5)->GetMinimum();
-           Double_t yTimeMax = GetRawsData(5)->GetMaximum();
-           Double_t yTotMin = GetRawsData(10)->GetMinimum();
-           Double_t yTotMax = GetRawsData(10)->GetMaximum();
-           
-           TLine* lineExpTimeMin = new TLine(200., yTimeMin, 200., yTimeMax);
-           lineExpTimeMin->SetLineColor(kGreen);
-           lineExpTimeMin->SetLineWidth(2);
-           
-           TLine* lineExpTimeMax = new TLine(250., yTimeMin, 250., yTimeMax);
-           lineExpTimeMax->SetLineColor(kGreen);
-           lineExpTimeMax->SetLineWidth(2);
-           
-           TLine* lineExpTotMin = new TLine( 5., yTotMin, 5., yTotMax);
-           lineExpTotMin->SetLineColor(kGreen);
-           lineExpTotMin->SetLineWidth(2);
-           
-           TLine* lineExpTotMax = new TLine(20., yTotMin, 20., yTotMax);
-           lineExpTotMax->SetLineColor(kGreen);
-           lineExpTotMax->SetLineWidth(2);
-           
-           ((TH1F*)GetRawsData(5))->GetListOfFunctions()->Add(lineExpTimeMin);
-           ((TH1F*)GetRawsData(5))->GetListOfFunctions()->Add(lineExpTimeMax);
-           ((TH1F*)GetRawsData(10))->GetListOfFunctions()->Add(lineExpTotMin);
-           ((TH1F*)GetRawsData(10))->GetListOfFunctions()->Add(lineExpTotMax);
-                           
-           //make up for all bistos 
-           for(Int_t j=0;j<20;j++){
-             if (j<5) {
-               GetRawsData(j)->SetMarkerColor(kRed);
-               GetRawsData(j)->SetMarkerStyle(7);
-             } else {
-               GetRawsData(j)->SetLineColor(kBlue+1);
-               GetRawsData(j)->SetLineWidth(1);
-               GetRawsData(j)->SetMarkerColor(kBlue+1);
-             }
-           }
-           Float_t ySMmax035=GetRawsData(16)->GetMaximum();
-           TLine* lineSMid035[10];
-           Float_t ySMmax3671=GetRawsData(17)->GetMaximum();
-           TLine* lineSMid3671[10];
-           
-           for (Int_t sm=0;sm<10;sm++){
-             lineSMid035[sm] = new TLine( 40*sm, 0, 40*sm, ySMmax035);
-             lineSMid035[sm]->SetLineColor(kMagenta);
-             lineSMid035[sm]->SetLineWidth(2);
-             GetRawsData(16)->GetListOfFunctions()->Add(lineSMid035[sm]);
-             
-             lineSMid3671[sm] = new TLine( 40*sm+360, 0, 40*sm+360, ySMmax3671);
-             lineSMid3671[sm]->SetLineColor(kMagenta);
-             lineSMid3671[sm]->SetLineWidth(2);
-             GetRawsData(17)->GetListOfFunctions()->Add(lineSMid3671[sm]);
-           }
-           
-           for (Int_t j=15;j<19;j++){
-             GetRawsData(j)->SetFillColor(kGray+1);
-             GetRawsData(j)->SetOption("bar");
-           }
-           
+         }
+         //make up for all histos 
+         for(Int_t j=0;j<5;j++) {
+           TH1* htmp = (TH1*)arrRW[j];  
+           if (!htmp) continue;
+           htmp->SetMarkerColor(kBlue);
+           htmp->SetMarkerStyle(8);
+           htmp->SetMarkerSize(0.7);
+         }
+         for(Int_t j=5;j<15;j++) {
+           TH1* htmp = (TH1*)arrRW[j];
+           if (!htmp) continue;
+           htmp->SetLineColor(kBlue);
+           htmp->SetLineWidth(1);
+           htmp->SetMarkerColor(kBlue);
+         }
+         
+         TH1* htmp =  (TH1*)arrRW[15];  
+         htmp->SetLineColor(kBlue);
+         htmp->SetLineWidth(1);
+         htmp->SetMarkerStyle(8);
+         htmp->SetMarkerSize(0.7);
+         htmp->SetMarkerColor(kBlue);//Option("bar");
+         //
+         if ( (htmp=(TH1*)arrRW[16]) ) htmp->SetOption("colz");
+         if ( (htmp=(TH1*)arrRW[17]) ) htmp->SetOption("colz");
+         if ( (htmp=(TH1*)arrRW[18]) ) htmp->SetOption("colz"); 
        }
-    }
-    AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;  
+      }//END ENABLE DQM SHIFTER OPT
+    } // RS: loop over trigger classes
+  } //end for
+  //
+  AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;  
+  //
 }
 //____________________________________________________________________________
 void AliTOFQADataMakerRec::GetMapIndeces(const Int_t* const in , Int_t* out)
@@ -985,3 +1091,16 @@ Bool_t  AliTOFQADataMakerRec::FilterSpare(const Int_t * const equipmentID) const
     return kFALSE;
  
 }
+//----------------------------------------------------------------
+/*void  AliTOFQADataMakerRec::ResetAllTRMcounters()
+{
+  //resets all TRM counters to 0
+  for (Int_t trm=0;trm<720;trm++){
+    fTRMNoisyArray[trm]=-1;
+    fTRMHwOkArray[trm]=-1;
+    fTRMEnabledArray[trm]=-1;
+  } 
+  return;
+  
+}
+*/