new shifter histogram implemented HeaderBCID vs TRM BC ID
[u/mrichter/AliRoot.git] / T0 / AliT0QADataMakerRec.cxx
index caaa81f..e5f2a9d 100644 (file)
@@ -27,6 +27,7 @@
 #include <TH1F.h> 
 #include <TH2F.h> 
 #include <TDirectory.h>
+#include <TMath.h>
 // --- Standard library ---
 
 // --- AliRoot header files ---
@@ -50,7 +51,6 @@ AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kT0),
                  "T0 Quality Assurance Data Maker"),
   fnEventCal(0),
   fnEventPhys(0)
-
 {
   // ctor
   for (Int_t i=0; i<6; i++) {
@@ -65,16 +65,22 @@ AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kT0),
       feffC[i]=0;
       feffA[i]=0;
       feffqtc[i]=0;
+      feffPhysC[i]=0;
+      feffPhysA[i]=0;
+      feffqtcPhys[i]=0;
+      fMeans[i]=0;
    }
+
+  // for(Int_t ic=0; ic<24; ic++) 
+  // fMeans[ic] = new TH1F(Form("CFD1minCFD%d",ic+1),"CFD-CFD",100,-250,250);
 }
 
+
 //____________________________________________________________________________ 
 AliT0QADataMakerRec::AliT0QADataMakerRec(const AliT0QADataMakerRec& qadm) :
   AliQADataMakerRec(),
   fnEventCal(0),
   fnEventPhys(0)
-
-  
 {
   //copy ctor 
  SetName((const char*)qadm.GetName()) ; 
@@ -89,6 +95,11 @@ AliT0QADataMakerRec& AliT0QADataMakerRec::operator = (const AliT0QADataMakerRec&
   new(this) AliT0QADataMakerRec(qadm);
   return *this;
 }
+//__________________________________________________________________
+AliT0QADataMakerRec::~AliT0QADataMakerRec()
+{
+  //destructor
+}
 //____________________________________________________________________________
 void AliT0QADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
 {
@@ -109,23 +120,28 @@ void AliT0QADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArra
        if ( fnEventPhys>0) 
          fTrEffPhys[itr] = Float_t (fNumTriggers[itr])/Float_t (fnEventPhys);
 
-        GetRawsData(420)->Fill(triggers[itr], fTrEffCal[itr]);
-        GetRawsData(420)->SetBinContent(itr+1, fTrEffCal[itr]);
-        GetRawsData(97)->Fill(triggers[itr], fTrEffPhys[itr]);
-        GetRawsData(97)->SetBinContent(itr+1, fTrEffPhys[itr]);
+        GetRawsData(169+250)->Fill(triggers[itr], fTrEffCal[itr]);
+        GetRawsData(169+250)->SetBinContent(itr+1, fTrEffCal[itr]);
+        GetRawsData(169)->Fill(triggers[itr], fTrEffPhys[itr]);
+        GetRawsData(169)->SetBinContent(itr+1, fTrEffPhys[itr]);
       } 
       Float_t effic=0;
       for(Int_t ik=0; ik<24; ik++)
        {  
          effic=0;
          if ( fnEventCal>0) effic = Float_t(feffC[ik])/Float_t(fnEventCal);
-         GetRawsData(205)->SetBinContent(ik+1,effic) ;
+         GetRawsData(207+250)->SetBinContent(ik+1,effic) ;
          effic=0;
          if ( fnEventCal>0) effic = Float_t(feffA[ik])/Float_t(fnEventCal);
-         GetRawsData(206)->SetBinContent(ik+1,effic );
+         GetRawsData(208+250)->SetBinContent(ik+1,effic );
          effic=0;
          if ( fnEventCal>0) effic = Float_t(feffqtc[ik])/Float_t(fnEventCal);
+         GetRawsData(209+250)->SetBinContent(ik+1, effic);
+
+         effic=0;
+         if ( fnEventPhys>0) effic = Float_t(feffPhysC[ik])/Float_t(fnEventPhys);
          GetRawsData(207)->SetBinContent(ik+1, effic);
+
        }
       
       
@@ -139,7 +155,6 @@ void AliT0QADataMakerRec::StartOfDetectorCycle()
 {
   //Detector specific actions at start of cycle
 
-
 }
  
 //____________________________________________________________________________ 
@@ -154,10 +169,8 @@ void AliT0QADataMakerRec::InitRaws()
 
   
   for (Int_t i=0; i<500; i++){
-    //    low[i]  = GetRecoParam()->GetLow(i);
-    ///   high[i]  = GetRecoParam()->GetHigh(i);
     low[i] = 0;
-    high[i] = 10000;
+    high[i] = 30000;
 
   }
 
@@ -166,19 +179,17 @@ void AliT0QADataMakerRec::InitRaws()
   TString qt1name, qt0name, qt1Calname, qt0Calname;
   TString nhits;
 
-  TH1F* fhRefPoint = new TH1F("hRefPoint","Ref Point", 20000, 575000 ,595000);
+  TH1F* fhRefPoint = new TH1F("hRefPoint","Ref Point", 10000, 0 ,50000);
   Add2RawsList( fhRefPoint,0, expert, !image, !saveCorr);
 
-  TH1F* fhRefPointcal = new TH1F("hRefPointcal","Ref Point laser", 10000, 18000 ,28000);
-  Add2RawsList( fhRefPointcal,358, expert, !image, !saveCorr);
+  TH1F* fhRefPointcal = new TH1F("hRefPointcal","Ref Point laser", 5000, 0 ,20000);
+  Add2RawsList( fhRefPointcal,250, expert, !image, !saveCorr);
 
   TH1F *fhRawCFD[24]; 
   TH1F * fhRawLEDamp[24];
   TH1F *fhRawQTC[24]; TH1F * fhRawLED[24];
   TH1F *fhRawCFDcal[24]; TH1F * fhRawLEDampcal[24]; 
-  TH1F *fhRawCFDcalpmt[24];  
-  TH1F *fhRawCFDpmt[24];
-  TH1F *fhRawQTCcal[24];  TH1F * fhRawLEDcal[24];
+   TH1F *fhRawQTCcal[24];  TH1F * fhRawLEDcal[24];
   TH1F *fhRawQT0cal[24]; TH1F *fhRawQT1cal[24];
   TH1F *fhRawQT1[24]; TH1F *fhRawQT0[24];
   TH1F* fhRawNhits[24];
@@ -199,42 +210,23 @@ void AliT0QADataMakerRec::InitRaws()
       qt1name += i+1;
       ledname += i+1;
       nhits   += i+1;
-      // fhRawCFD[i] = new THnSparseF(timename.Data(), Form("%s;CFD [#channels];Counts", timename.Data()),1,spabins,spaxmin,spaxmax);
-      fhRawCFD[i] = new TH1F(timename.Data(), Form("%s;CFD [#channels];Counts", timename.Data()),Int_t(high[i+1]-low[i+1]),low[i+1],high[i+1]);
-        Add2RawsList( fhRawCFD[i],i+1, expert, !image, !saveCorr);
-       fhRawLED[i] = new TH1F(ledname.Data(),  Form("%s;LED[#channels];Counts", ledname.Data()),Int_t(high[i+24+1]-low[i+24+1]),low[i+24+1],high[i]);
-      Add2RawsList( fhRawLED[i],i+24+1, expert, !image, !saveCorr);
+      fhRawCFD[i] = new TH1F(timename.Data(), Form("%s;CFD [#channels];Counts", timename.Data()),Int_t((high[i+1]-low[i+1])/4),low[i+1],high[i+1]);
+      Add2RawsList( fhRawCFD[i],i+1, expert, !image, !saveCorr);
+      fhRawLED[i] = new TH1F(ledname.Data(),  Form("%s;LED[#channels];Counts", ledname.Data()),Int_t((high[i+25]-low[i+25])/4),low[i+25],high[i+25]);
+      Add2RawsList( fhRawLED[i],i+25, expert, !image, !saveCorr);
       fhRawLEDamp[i] = new TH1F(ampname.Data(),  Form("%s;LED-CFD [#channels];Counts", ampname.Data()),1000,0,1000);
-     Add2RawsList( fhRawLEDamp[i],i+48+1, expert, !image, !saveCorr);
+      Add2RawsList( fhRawLEDamp[i],i+49, expert, !image, !saveCorr);
       fhRawQTC[i] = new TH1F(qtcname.Data(),  Form("%s;QTC[#channels];Counts", qtcname.Data()),10000,0,10000);
-      Add2RawsList( fhRawQTC[i],i+72+1, expert, !image, !saveCorr);
-      fhRawQT1[i] = new TH1F(qt1name.Data(),  Form("%s;QT1[#channels];Counts", qtcname.Data()),Int_t(high[270+i]-low[270+i]),low[270+i],high[270+i]);
-       Add2RawsList( fhRawQT1[i],270+i, expert, !image, !saveCorr);
-       fhRawQT0[i] = new TH1F(qt0name.Data(),  Form("%s;QT0[#channels];Counts", qtcname.Data()),Int_t(high[270+24+i]-low[270+24+i]),low[270+24+i],high[270+24+i]);
-     Add2RawsList( fhRawQT0[i],270+24+i, expert, !image, !saveCorr);
-
-      fhRawNhits[i] = new TH1F(nhits.Data(),  Form("%s;#Hits;Events", nhits.Data()),10, 0, 10);
-     Add2RawsList( fhRawNhits[i],244+i, expert, !image, !saveCorr);
-
-    }
-  TH1F* fhRawTrigger = new TH1F("hRawTrigger"," phys triggers;Trigger #;Counts",5,0,5);
-  Add2RawsList(fhRawTrigger ,97, expert, !image, !saveCorr);
-
-  TH1F* fhRawMean = new TH1F("hRawMean","online mean signal, physics event;",Int_t(high[98]-low[98]),low[98],high[98]);
-  Add2RawsList( fhRawMean,98, expert, !image, !saveCorr);
-
-  TH1F* fhRawVertex = new TH1F("hRawVertex","online vertex signal; counts",Int_t(high[100]-low[99]),low[99],high[99]);
-  Add2RawsList( fhRawVertex,99, expert, !image, !saveCorr);
-
-  TH1F* fhRawORA = new TH1F("hRawORA","online OR A; counts",Int_t(high[100]-low[100]),low[100],high[100]);
-  Add2RawsList( fhRawORA,100, expert, !image, !saveCorr);
-  TH1F* fhRawORC = new TH1F("hRawORC","online OR C;counts",Int_t( high[101]-low[101]),low[101],high[101]);
-  Add2RawsList( fhRawORC,101, expert, !image, !saveCorr);
-
-
-  for (Int_t i=0; i<24; i++)
-    {
-      // for events with trigger CALIBRATION_EVENT
+      Add2RawsList( fhRawQTC[i],i+73, expert, !image, !saveCorr);
+      fhRawQT1[i] = new TH1F(qt1name.Data(),  Form("%s;QT1[#channels];Counts", qt1name.Data()),Int_t((high[97+i]-low[97+i])/4),low[97+i],high[97+i]);
+      Add2RawsList( fhRawQT1[i],97+i, expert, !image, !saveCorr);
+      fhRawQT0[i] = new TH1F(qt0name.Data(),  Form("%s;QT0[#channels];Counts", qt0name.Data()),Int_t((high[121+i]-low[121+i])/4),low[121+i],high[121+i]);
+      Add2RawsList( fhRawQT0[i],121+i, expert, !image, !saveCorr);
+      
+      fhRawNhits[i] = new TH1F(nhits.Data(),  Form("%s;#Hits;Events", nhits.Data()),20, 0, 20);
+      Add2RawsList( fhRawNhits[i],176+i, expert, !image, !saveCorr);
+      
+      
       timeCalname ="hRawCFDcal";
       ledCalname = "hRawLEDcal";
       ampCalname = "hRawLEDminCFDcal";
@@ -247,156 +239,220 @@ void AliT0QADataMakerRec::InitRaws()
       qtcCalname += i+1;
       qt0Calname += i+1;
       qt1Calname += i+1;
-      fhRawCFDcal[i] = new TH1F(timeCalname.Data(),  Form("%s;Time ;Counts", timeCalname.Data()),Int_t(high[101+i+1]-low[101+i+1]),low[101+i+1],high[101+i+1]);
-      Add2RawsList( fhRawCFDcal[i],101+i+1, expert, !image, !saveCorr);
-      fhRawLEDcal[i] = new TH1F(ledCalname.Data(),  Form("%s;Time ;Counts", ledCalname.Data()),Int_t(high[101+i+24+1]-low[101+i+24+1]),low[101+i+24+1],high[101+i+24+1]);
-      Add2RawsList( fhRawLEDcal[i],101+i+24+1, expert, !image, !saveCorr);
-
-      fhRawLEDampcal[i] = new TH1F(ampCalname.Data(), Form("%s;Amplitude [ADC counts];Counts", ampCalname.Data()),1000,0,1000);
-      Add2RawsList( fhRawLEDampcal[i],101+i+48+1, expert, !image, !saveCorr);
-
-      fhRawQTCcal[i] = new TH1F(qtcCalname.Data(), Form("%s;Charge ;Counts",qtcCalname.Data()),10000,0,10000);
-      Add2RawsList( fhRawQTCcal[i],101+i+72+1, expert, !image, !saveCorr);
-
-      fhRawQT0cal[i] = new TH1F(qt0Calname.Data(), Form("%s;Charge ;Counts",qt0Calname.Data()),Int_t(high[371+i]-low[371+i]),low[371+i],high[371+i]);
-      Add2RawsList( fhRawQT0cal[i],371+i, expert, !image, !saveCorr);
-
-      fhRawQT1cal[i] = new TH1F(qt1Calname.Data(), Form("%s;Charge ;Counts",qt1Calname.Data()),Int_t(high[i+371+24]-low[i+371+24]),low[i+371+24],high[i+371+24]);
-      Add2RawsList( fhRawQT1cal[i],i+371+24, expert, !image, !saveCorr);
+      fhRawCFDcal[i] = new TH1F(timeCalname.Data(),  Form("LASER: %s;Time ;Counts", timeCalname.Data()),Int_t((high[251+i]-low[251+i])/4),low[251+i],high[251+i]);
+      Add2RawsList( fhRawCFDcal[i],251+i, expert, !image, !saveCorr);
+      
+      fhRawLEDcal[i] = new TH1F(ledCalname.Data(),  Form("LASER: %s;Time ;Counts", ledCalname.Data()),Int_t((high[251+i+24]-low[251+i+24])/4),low[251+i+24],high[251+i+24]);
+      Add2RawsList( fhRawLEDcal[i],251+i+24, expert, !image, !saveCorr);
+      
+      fhRawLEDampcal[i] = new TH1F(ampCalname.Data(), Form("LASER: %s;Amplitude [ADC counts];Counts", ampCalname.Data()),1000,0,1000);
+      Add2RawsList( fhRawLEDampcal[i],251+i+48, expert, !image, !saveCorr);
+      
+      fhRawQTCcal[i] = new TH1F(qtcCalname.Data(), Form("LASER: %s;QTC[#channels]; ;Counts",qtcCalname.Data()),10000,0,10000);
+      Add2RawsList( fhRawQTCcal[i],251+i+72, expert, !image, !saveCorr);
+      
+      fhRawQT0cal[i] = new TH1F(qt0Calname.Data(), Form("LASER: %s;QT0[#channels] ;Counts",qt0Calname.Data()),Int_t((high[251+96+i]-low[251+96+i])/4),low[251+96+i],high[251+96+i]);
+      Add2RawsList( fhRawQT0cal[i],251+96+i, expert, !image, !saveCorr);
+      
+      fhRawQT1cal[i] = new TH1F(qt1Calname.Data(), Form("LASER: %s;QT1[#channels] ;Counts",qt1Calname.Data()),Int_t((high[i+251+120]-low[i+251+120])/4),low[i+251+120],high[i+251+120]);
+      Add2RawsList( fhRawQT1cal[i],i+251+120, expert, !image, !saveCorr);
+      
+    }
+  
+  
+  TH1F* fhRawTrigger = new TH1F("hRawTrigger"," phys triggers;Trigger ;Counts",6,0,6);
+  Add2RawsList(fhRawTrigger ,169, expert, image, !saveCorr);
+  
+  TH1F* fhRawMean = new TH1F("hRawMean","online mean signal, physics event;",Int_t((high[170]-low[170])/4),low[170],high[170]);
+  Add2RawsList( fhRawMean,170, expert, !image, !saveCorr);
 
-      }
+  TH1F* fhRawVertex = new TH1F("hRawVertex","online vertex signal; counts",Int_t((high[171]-low[171])/4),low[171],high[171]);
+  Add2RawsList( fhRawVertex,171, expert, image, !saveCorr);
 
-  //from PMT1 (equalizing)
-  for (Int_t i=0; i<24; i++)
-    {
-      // for events with trigger CALIBRATION_EVENT
-      timeCalname ="hRawCFDcalpmt";
-      timename ="hRawCFDpmt";
-      timeCalname += i+1;
-      ledCalname += i+1;
-      timename += i+1;
-      ledname += i+1;
-      fhRawCFDcalpmt[i] = new TH1F(timeCalname.Data(),  Form("%s;Time;Counts", timeCalname.Data()),2000,-1000,1000);
-       Add2RawsList( fhRawCFDcalpmt[i],321+i , expert, !image, !saveCorr);
+  TH1F* fhRawORA = new TH1F("hRawORA","online OR A; counts",Int_t((high[172]-low[172])/4),low[172],high[172]);
+  Add2RawsList( fhRawORA,172, expert, !image, !saveCorr);
+  TH1F* fhRawORC = new TH1F("hRawORC","online OR C;counts",Int_t(( high[173]-low[173])/4),low[173],high[173]);
+  Add2RawsList( fhRawORC,173, expert, !image, !saveCorr);
+  TH1F* fhMultCentr = new TH1F("hMultCentr","online trigger Central;counts ",Int_t(( high[174]-low[174])/4),low[174],high[174]);
+  Add2RawsList( fhMultCentr,174, expert, !image, !saveCorr);
+  TH1F* fhMultSeCentr = new TH1F("hMultSemiCentr","online trigger SemiCentral;counts ",Int_t(( high[175]-low[175])/4),low[175],high[175]);
+  Add2RawsList( fhMultSeCentr,175, expert, !image, !saveCorr);
 
-      fhRawCFDpmt[i] = new TH1F(timename.Data(),  Form("%s;Time;Counts", timename.Data()),2000,-1000,1000);
-      Add2RawsList( fhRawCFDpmt[i],220+i, expert, !image, !saveCorr);
-     }
 
   TH1F* fhRawTriggerCal = new TH1F("hRawTriggerCal"," laser triggers",6,0,6);
-  Add2RawsList(fhRawTriggerCal ,420 , !expert, image, !saveCorr);
-  TH1F* fhRawMeanCal = new TH1F("hRawMeanCal","online mean signal, calibration event",Int_t(high[198]-low[198]),low[198],high[198]);
-  Add2RawsList( fhRawMeanCal,198, expert, !image, !saveCorr);
-  TH1F* fhRawVertexCal = new TH1F("hRawVertexCal","online vertex signal, calibration event ",Int_t( high[199]-low[199]),low[199],high[199] );
-   Add2RawsList( fhRawVertexCal,199, expert, !image, !saveCorr);
-   TH1F* fhRawORAcal = new TH1F("hRawORAcal","laser OR A; counts",Int_t( high[200]-low[200]),low[200],high[200]);
-   Add2RawsList( fhRawORAcal,200, expert, !image, !saveCorr );
-   TH1F* fhRawORCcal = new TH1F("hRawORCcal","laserOR C;counts ",Int_t( high[201]-low[201]),low[201],high[201]);
-   Add2RawsList( fhRawORCcal,201, expert, !image, !saveCorr);
-
+  Add2RawsList(fhRawTriggerCal ,169+250 , !expert, image, !saveCorr);
+  
+  TH1F* fhRawMeanCal = new TH1F("hRawMeanCal","online mean signal, calibration event",Int_t((high[170+250]-low[170+250])/4),low[170+250],high[170+250]);
+  Add2RawsList( fhRawMeanCal,170+250, expert, !image, !saveCorr);
+  
+  TH1F* fhRawVertexCal = new TH1F("hRawVertexCal","online vertex signal, calibration event ",Int_t((high[171+250]-low[171+250])/4),low[171+250],high[171+250] );
+  Add2RawsList( fhRawVertexCal,171+250, expert, !image, !saveCorr);
+  
+  
+  TH1F* fhRawORAcal = new TH1F("hRawORAcal","laser OR A; counts",Int_t((high[172+250]-low[172+250])/4),low[172+250],high[172+250]);
+  Add2RawsList( fhRawORAcal,172+250, expert, !image, !saveCorr );
+  
+  
+  TH1F* fhRawORCcal = new TH1F("hRawORCcal","laserOR C;counts ",Int_t(( high[173]-low[173])/4),low[173],high[173]);
+  Add2RawsList( fhRawORCcal,173+250, expert, !image, !saveCorr);
+  
+  TH1F* fhMultCentrcal = new TH1F("hMultCentrcal","laser trigger Central;counts ",Int_t(( high[174]-low[174])/4),low[174],high[174]);
+  Add2RawsList( fhMultCentrcal,174+250, expert, !image, !saveCorr);
+  TH1F* fhMultSeCentrcal = new TH1F("hMultSemiCentrcal","laser trigger SemiCentral;counts ",Int_t(( high[175]-low[175])/4),low[175],high[175]);
+  Add2RawsList( fhMultSeCentrcal,175+250, expert, !image, !saveCorr);
+  
   //multiplicity trigger
-   TH1F* fhMultcal = new TH1F("hMultcal","full mulltiplicity;Multiplicity;Entries",Int_t( high[202]-low[202]),low[202],high[202]);
-  Add2RawsList( fhMultcal,202, expert, !image, !saveCorr );
-   TH1F* fhMultScal = new TH1F("hMultSemical","full multiplicity with semi-central trigger;Multiplicity;Entries",
-                              Int_t( high[203]-low[203]),low[203],high[203] );
-  Add2RawsList( fhMultScal,203, expert, !image, !saveCorr);
-  TH1F* fhMultCcal = new TH1F("hMultCentrcal","full multiplicity with central trigger;Multiplicity;Entries", 
-                             Int_t( high[204]-low[204]),low[204],high[204]);
-  Add2RawsList( fhMultCcal,204, expert, !image, !saveCorr);
-  TH1F* fhMult = new TH1F("hMult","full mulltiplicity;Multiplicity;Entries", high[216]-low[216],low[216],high[216]);
-  Add2RawsList( fhMult,216, expert, !image, !saveCorr );
-   TH1F* fhMultS = new TH1F("hMultSemi","full multiplicity with semi-central trigger;Multiplicity;Entries",
-                           Int_t( high[217]-low[217]),low[217],high[217] );
-  Add2RawsList( fhMultS,217, expert, !image, !saveCorr);
-  TH1F* fhMultC = new TH1F("hMultCentr","full multiplicity with central trigger;Multiplicity;Entries", 
-                            high[218]-low[218],low[218],high[218]);
-  Add2RawsList( fhMultC,218, expert, !image, !saveCorr);
-
-  TH1F* fhEffCFD = new TH1F("hEffCFD","#PMT; #CFD counts/nEvents",24, 0 ,24); 
-  Add2RawsList( fhEffCFD,205, !expert, image, !saveCorr);
-  TH1F* fhEffLED = new TH1F("hEffLED","#PMT; #LED counts/nEvent",24, 0 ,24);
-  Add2RawsList( fhEffLED,206, !expert, image, !saveCorr);
-
-  TH1F* fhEffQTC = new TH1F("hEffQTC","#PMT; QTC efficiency%s;",24, 0 ,24);
-  Add2RawsList( fhEffQTC,207, !expert, image, !saveCorr);
-
+  //side A
+  TH1F* fhMultAcal = new TH1F("hMultAcal","laser: full mulltiplicity;Multiplicity A side;Entries",Int_t((high[201]-low[201])/4),low[201],high[201]);
+  Add2RawsList( fhMultAcal,201+250, expert, !image, !saveCorr );
+  TH1F* fhMultAScal = new TH1F("hMultASemical","laser:full multiplicity with semi-central trigger A side;Multiplicity;Entries",
+                              Int_t((high[202]-low[202])/4),low[202],high[202] );
+  Add2RawsList( fhMultAScal,202+250, expert, !image, !saveCorr);
+  TH1F* fhMultACcal = new TH1F("hMultACentrcal","laser:full multiplicity with central trigger A side;Multiplicity;Entries", 
+                              Int_t((high[203]-low[203])/4),low[203],high[203]);
+  Add2RawsList( fhMultACcal,203+250, expert, !image, !saveCorr);
   
-  TH2F* fhCFDcal = new TH2F("hCFDcal","CFD laser; #PMT; CFD {#channnels}",25, 0 ,25,Int_t(high[208]-low[208]),low[208],high[208]);
-  fhCFDcal->SetOption("COLZ");
-  Add2RawsList( fhCFDcal,208, !expert, image, !saveCorr);
+  TH1F* fhMultA = new TH1F("hMultA","full mulltiplicity A side;Multiplicity;Entries", Int_t((high[201]-low[201])/4) ,low[201],high[201]);
+  Add2RawsList( fhMultA,201, expert, image, !saveCorr );
+  
+  TH1F* fhMultAS = new TH1F("hMultASemi","full multiplicity with semi-central trigger A side ;Multiplicity;Entries",
+                           Int_t((high[202]-low[202])/4),low[202],high[202] );
+  Add2RawsList( fhMultAS, 202, expert, !image, !saveCorr);
+  TH1F* fhMultAC = new TH1F("hMultACentr","full multiplicity with central trigger;Multiplicity;Entries", 
+                           Int_t((high[203]-low[203])/4),low[203],high[203]);
+  Add2RawsList( fhMultAC, 203, expert, !image, !saveCorr);
+  
+  
+  //side C
+  TH1F* fhMultCcal = new TH1F("hMultCcal","laser:full mulltiplicity C side;Multiplicity;Entries",Int_t((high[204]-low[204])/4),low[204],high[204]);
+  Add2RawsList( fhMultCcal,204+250, expert, !image, !saveCorr );
+  TH1F* fhMultCScal = new TH1F("hMultCSemical","laser:full multiplicity with semi-central trigger C side;Multiplicity;Entries",
+                              Int_t((high[205]-low[205])/4),low[205],high[205] );
+  Add2RawsList( fhMultCScal,205+250, expert, !image, !saveCorr);
+  TH1F* fhMultCCcal = new TH1F("hMultCCentrcal","laser:full multiplicity with central trigger C side;Multiplicity;Entries", 
+                              Int_t((high[206]-low[206])/4),low[206],high[206]);
+  Add2RawsList( fhMultCCcal,206+250, expert, !image, !saveCorr);
+  
+  TH1F* fhMultC = new TH1F("hMultC","full mulltiplicity C side;Multiplicity;Entries", Int_t(high[204]-low[204]/4) ,low[204],high[204]);
+  Add2RawsList( fhMultC,204, expert, image, !saveCorr );
+  TH1F* fhMultCS = new TH1F("hMultCSemi","full multiplicity with semi-central trigger C side;Multiplicity;Entries",
+                           Int_t((high[205]-low[205])/4),low[205],high[205] );
+  Add2RawsList( fhMultCS,205, expert, !image, !saveCorr);
+  TH1F* fhMultCC = new TH1F("hMultCentr","full multiplicity with central trigger C side;Multiplicity;Entries", 
+                           Int_t((high[206]-low[206])/4),low[206],high[206]);
+  Add2RawsList( fhMultCC,206, expert, !image, !saveCorr);
+  
+  
+  //efficiency
+  TH1F* fhEffCFD = new TH1F("hEffCFDcal","CFD efficiecy laser ;#PMT; #CFD counts/nEvents",24, 0 ,24); 
+  Add2RawsList( fhEffCFD,207+250, !expert, image, !saveCorr);
+  
+  TH1F* fhCFDeffpsys= new TH1F("fhCFDeffpsys"," CFD efficiency; #PMT; #CFD counts/nEvents",24, 0 ,24);  
+  // fhCFDeffpsys->SetMaximum(2);
+  Add2RawsList( fhCFDeffpsys, 207, expert, image, !saveCorr);
+  
+  TH1F* fhEffLED = new TH1F("hEffLEDcal","LEDefficiecy; #PMT; #LED counts/nEvent",24, 0 ,24);
+  Add2RawsList( fhEffLED,208+250, !expert, image, !saveCorr);
+  
+  TH1F* fhEffQTC = new TH1F("hEffQTCcal","QTC efficiecy; #PMT; QTC efficiency%s;",24, 0 ,24);
+  Add2RawsList( fhEffQTC,209+250, !expert, image, !saveCorr);
+  
+  
+ TH2F* fhCFD = new TH2F("hCFD","CFD phys; #PMT; CFD {#channnels}",25, 0 ,25,Int_t((high[210]-low[210])/4),low[210],high[210]);
+  fhCFD->SetOption("COLZ");
+  Add2RawsList( fhCFD,210, expert, image, !saveCorr);
+    
+  TH2F* fhLED = new TH2F("hLED","LED phys; #PMT; LED [#channnels]",25, 0 ,25,Int_t((high[211]-low[211])/4),low[211],high[211]);
+  fhLED->SetOption("COLZ");
+  Add2RawsList( fhLED,211, expert, image, !saveCorr);
 
+  TH2F* fhQTC = new TH2F("hQTC","QTC phys; #PMT; QTC [#channnels]",25, 0 ,25,Int_t( high[212]-low[212]),low[212],high[212]);
+  fhQTC->SetOption("COLZ");
+  Add2RawsList( fhQTC,212, expert, image, !saveCorr);
 
-  TH2F* fhLEDcal = new TH2F("hLEDcal","LED laser; #PMT; LED [#channnels]",25, 0 ,25,Int_t( high[209]-low[209]),low[209],high[209]);
+   TH2F* fhCFDcal = new TH2F("hCFDcal","CFD laser; #PMT; CFD {#channnels}",25, 0 ,25,Int_t((high[210]-low[210])/4),low[210],high[210]);
+  fhCFDcal->SetOption("COLZ");
+  Add2RawsList( fhCFDcal,210+250, expert, image, !saveCorr);
+  
+  
+  TH2F* fhLEDcal = new TH2F("hLEDcal","LED laser; #PMT; LED [#channnels]",25, 0 ,25,Int_t((high[211]-low[211])/4),low[211],high[211]);
   fhLEDcal->SetOption("COLZ");
-  Add2RawsList( fhLEDcal,209, !expert, image, !saveCorr);
-
-  TH2F* fhQTCcal = new TH2F("hQTCcal","QTC laser; #PMT; QTC [#channnels]",25, 0 ,25,Int_t( high[209]-low[209]),low[209],high[209]);
+  Add2RawsList( fhLEDcal,211+250, expert, image, !saveCorr);
+  
+  TH2F* fhQTCcal = new TH2F("hQTCcal","QTC laser; #PMT; QTC [#channnels]",25, 0 ,25,Int_t( high[212]-low[212]),low[212],high[212]);
   fhQTCcal->SetOption("COLZ");
-  Add2RawsList( fhQTCcal,210, !expert, image, !saveCorr);
-
-
+  Add2RawsList( fhQTCcal,212+250, expert, image, !saveCorr);
+  
+  
   TH1F* fhNumPMTA= new TH1F("hNumPMTA","number of PMT hitted per event",13, 0 ,13);
-  Add2RawsList(fhNumPMTA ,211, expert, !image, !saveCorr);
-
+  Add2RawsList(fhNumPMTA ,213, expert, image, !saveCorr);
+  
   TH1F* fhNumPMTC= new TH1F("hNumPMTC","number of PMT hitted per event",13, 0 ,13);
-  Add2RawsList(fhNumPMTC ,212, expert, !image, !saveCorr);
-
-  TH1F* fhHitsOrA= new TH1F("fhHitsOrA","T0_OR A hit multiplicitie",10, 0 ,10);
-  Add2RawsList( fhHitsOrA,213, expert, !image, !saveCorr);
-
-  TH1F* fhHitsOrC= new TH1F("fhHitsOrC","T0_OR C hit multiplicitie",10, 0 ,10);
-  Add2RawsList(fhHitsOrC ,214, expert, !image, !saveCorr);
-
+  Add2RawsList(fhNumPMTC ,214, expert, image, !saveCorr);
+  
+  TH1F* fhHitsOrA= new TH1F("fhHitsOrA","T0_OR A hit multiplicitie",20, 0 ,20);
+  Add2RawsList( fhHitsOrA,215, expert, !image, !saveCorr);
+  
+  TH1F* fhHitsOrC= new TH1F("fhHitsOrC","T0_OR C hit multiplicitie",20, 0 ,20);
+  Add2RawsList(fhHitsOrC ,216, expert, !image, !saveCorr);
+  
+  
   TH1F* fhOrCminOrA= new TH1F("fhOrCminOrA","T0_OR C - T0_OR A",10000,-5000,5000);
-  Add2RawsList( fhOrCminOrA,215, expert, !image, !saveCorr);
-
+  Add2RawsList( fhOrCminOrA,219, expert, !image, !saveCorr);
+  
   TH1F* fhOrCminOrAcal= new TH1F("fhOrCminOrAcal","T0_OR C - T0_OR A",10000,-5000,5000);
-  Add2RawsList( fhOrCminOrAcal,219, expert, !image, !saveCorr);
+  Add2RawsList( fhOrCminOrAcal,219+250, expert, !image, !saveCorr);
 
   TH1F* fhOrCminOrATvdcOn= new TH1F("fhOrCminOrATvdcOn","T0_OR C - T0_OR A TVDC on",10000,-5000,5000);
-  Add2RawsList( fhOrCminOrATvdcOn,350, expert, !image, !saveCorr);
-
+  Add2RawsList( fhOrCminOrATvdcOn,217, expert, !image, !saveCorr);
+  
   TH1F* fhOrCminOrATvdcOncal= new TH1F("fhOrCminOrATvdcOncal","T0_OR C - T0_OR A TVDC on laser",10000,-5000,5000);
-  Add2RawsList( fhOrCminOrATvdcOncal,351, expert, !image, !saveCorr);
+  Add2RawsList( fhOrCminOrATvdcOncal,217+250, expert, !image, !saveCorr);
 
   TH1F* fhOrCminOrATvdcOff= new TH1F("fhOrCminOrATvdcOff","T0_OR C - T0_OR A TVDC off",10000,-5000,5000);
-  Add2RawsList( fhOrCminOrATvdcOff,352, expert, !image, !saveCorr);
-
-  TH1F* fhOrCminOrATvdcOffcal= new TH1F("fhOrCminOrATvdcOffcal","T0_OR C - T0_OR ATVDC off laser",10000,-5000,5000);
-  Add2RawsList( fhOrCminOrATvdcOffcal,353, expert, !image, !saveCorr);
-
-  TH1F* fhCFD1abs= new TH1F("fhCFD1abs"," CFD 1 pure ( L1) ", 20000, 575000, 595000 );
-  Add2RawsList(fhCFD1abs ,354, expert, !image, !saveCorr);
-
-  TH1F* fhCFD2abs= new TH1F("fhCFD2abs"," CFD 2 pure ( L1)  ", 20000, 575000, 595000 );
-  Add2RawsList( fhCFD2abs,355, expert, !image, !saveCorr);
-
-  TH1F* fhCFD1abscal= new TH1F("fhCFD1abscal"," CFD 1 pure ( L1)laser ", 10000, 18000 ,28000 );
-  Add2RawsList(fhCFD1abscal,356, expert, !image, !saveCorr);
-
-  TH1F* fhCFD2abscal= new TH1F("fhCFD2abscal"," CFD 2 pure ( L1)laser ", 10000, 18000 ,28000 );
-  Add2RawsList( fhCFD2abscal,357, expert, !image, !saveCorr);
-
- const Char_t *triggers[6] = {"mean", "vertex","ORA","ORC","central","semi-central"};
-  for (Int_t itr=0; itr<6; itr++) {
-    GetRawsData(420)->Fill(triggers[itr], fNumTriggersCal[itr]);
-    GetRawsData(420)->SetBinContent(itr+1, fNumTriggersCal[itr]);
-    GetRawsData(97)->Fill(triggers[itr], fNumTriggers[itr]);
-    GetRawsData(97)->SetBinContent(itr+1, fNumTriggers[itr]);
-  }  
+  Add2RawsList( fhOrCminOrATvdcOff,218, expert, !image, !saveCorr);
+
+
+   TH1F* fhOrCminOrATvdcOffcal= new TH1F("fhOrCminOrATvdcOffcal","T0_OR C - T0_OR ATVDC off laser",10000,-5000,5000);
+   Add2RawsList( fhOrCminOrATvdcOffcal,218+250, expert, !image, !saveCorr);
+   
+   //satellite  & beam background
+  TH2F* fhBeam = new TH2F("fhBeam", " Mean vs Vertex ", 120, -30, 30, 120, -30, 30);
+  fhBeam->SetOption("COLZ");
+  fhBeam->GetXaxis()->SetTitle("(T0C-T0A/2, ns");
+  fhBeam->GetYaxis()->SetTitle("(T0C+T0A/2, ns");
+  Add2RawsList( fhBeam,220, !expert, image, !saveCorr);
+   TH2F* fhBeamTVDCon = new TH2F("fhBeamTVDCon", " Mean vs Vertex TVDC on ",50, -5, 5, 50, -5, 5) ;
+   fhBeamTVDCon->SetOption("COLZ");
+   fhBeamTVDCon->GetXaxis()->SetTitle("(T0C-T0A/2, ns");
+   fhBeamTVDCon->GetYaxis()->SetTitle("(T0C+T0A/2, ns");
+   Add2RawsList( fhBeamTVDCon,221, expert, image, !saveCorr);
+   TH2F* fhBeamTVDCoff = new TH2F("fhBeamTVDCoff", " Mean vs Vertex TVDC off", 120, -30, 30, 120, -30, 30);
+   fhBeamTVDCoff->GetXaxis()->SetTitle("(T0C-T0A/2, ns");
+   fhBeamTVDCoff->GetYaxis()->SetTitle("(T0C+T0A/2, ns");
+   fhBeamTVDCoff->SetOption("COLZ");
+   Add2RawsList( fhBeamTVDCoff,222, expert, image, !saveCorr);
+   TH1F* fhMean = new TH1F("fhMean", " (T0A+T0C)/2, ns ", 200, -2000, 2000);
+   Add2RawsList( fhMean,223, !expert, image, !saveCorr);
+
+   TH2F* fhBCID = new TH2F("fhBCID", "header BCID vs TRM BC ID ", 500, 0, 5000, 500, 0, 5000);
+   fhBCID->SetOption("COLZ");
+   fhBCID->GetXaxis()->SetTitle("TRM BC ID");
+   fhBCID->GetYaxis()->SetTitle("event header BC ID");
+   Add2RawsList(fhBCID ,224, !expert, image, !saveCorr);
+
+   //triggers
+   const Char_t *triggers[6] = {"mean", "vertex","ORA","ORC","central","semi-central"};
+   for (Int_t itr=0; itr<6; itr++) {
+     GetRawsData(169)->Fill(triggers[itr], fNumTriggersCal[itr]);
+     GetRawsData(169)->SetBinContent(itr+1, fNumTriggersCal[itr]);
+     GetRawsData(169+250)->Fill(triggers[itr], fNumTriggers[itr]);
+     GetRawsData(169+250)->SetBinContent(itr+1, fNumTriggers[itr]);
+   }
+  
+    
 }
-
+  
 //____________________________________________________________________________ 
 void AliT0QADataMakerRec::InitDigits()
 {
@@ -412,7 +468,10 @@ void AliT0QADataMakerRec::InitDigits()
   Add2DigitsList( fhDigLEDamp,1, !expert, !image);
   TH2F * fhDigQTC = new TH2F("fhDigQTC", " QTC digits; #PMT; QTC amplitude",25,-0.5,24.5,100,100,10000);
   fhDigQTC->SetOption("COLZ");
-  Add2DigitsList( fhDigQTC,2, !expert, !image);}
+  Add2DigitsList( fhDigQTC,2, !expert, !image);
+
+
+}
 
 //____________________________________________________________________________ 
 
@@ -444,18 +503,22 @@ void AliT0QADataMakerRec::InitESDs()
   const Bool_t expert   = kTRUE ; 
   const Bool_t image    = kTRUE ; 
   
-  TH1F *fhESDMean = new TH1F("hESDmean"," ESD mean; mean time[%channels]",1000,0,1000);
-  Add2ESDsList(fhESDMean, 0, !expert, image) ;
+  TH1F *fhESDMean = new TH1F("hESDmean"," ESD mean; mean time[%channels]",1000, -5, 5);
+  Add2ESDsList(fhESDMean, 0, expert, !image) ;
   TH1F * fhESDVertex = new TH1F("hESDvertex","ESDvertex; vertex[cm];",82,-30,30);
-  Add2ESDsList(fhESDVertex, 1, !expert, image) ;
+  Add2ESDsList(fhESDVertex, 1, expert, !image) ;
   
+  TH1F * fhESDResolution = new TH1F("hESDResolution","(T0A-T0C)/2 corrected by SPD vertex; ns",800,-2,2);
+  Add2ESDsList(fhESDResolution, 2, !expert, image) ;
 
 }
 
 //____________________________________________________________________________
 void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
 {
-
+  Int_t  time[24] ;
+  for(Int_t i=0; i<24; i++) time[i] = 0;         
+    
   rawReader->Reset() ; 
   //fills QA histos for RAW
   Int_t shift=0;
@@ -469,211 +532,224 @@ void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
     AliDebug(AliQAv1::GetQADebugLevel(),Form(" no raw data found!!"));
   else
     {  
-      
+
       UInt_t type =rawReader->GetType();
-      if (type == 8){ shift=101; fnEventCal++;} 
+      if (type == 8){ shift=250; fnEventCal++;} 
       if (type == 7){ shift=0;   fnEventPhys++;}
+       //BC ID
+      if (type == 7){
+       UInt_t bcid = rawReader->GetBCID();
+       UInt_t  trmbcid = start->GetTRMBunchID();
+       GetRawsData(224)->Fill(trmbcid, bcid);
+      }
+     //    if (type == 7){ shift=1;   fnEventPhys++;}
       Int_t allData[110][5];
-      for (Int_t i0=0; i0<105; i0++)
+      for (Int_t i0=0; i0<110; i0++)
        {
          for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;
        }
-      for (Int_t i=0; i<105; i++) 
+      for (Int_t i=0; i<107; i++) 
        for (Int_t iHit=0; iHit<5; iHit++)
          allData[i][iHit]= start->GetData(i,iHit);
       
-      if ( type == 7  && allData[0][0] > 0 ) GetRawsData(0) -> Fill( allData[0][0]);
-      if ( type == 8  && allData[0][0] > 0 ) GetRawsData(358) -> Fill( allData[0][0]);
+      if ( allData[0][0] > 0  && (type == 7))
+       GetRawsData(0) -> Fill( allData[0][0]);
+     if ( allData[0][0] > 0  && (type == 8))
+       GetRawsData(250) -> Fill( allData[0][0]);
+      
       refpoint = allData[refPointParam][0];
       if (refPointParam <  0 ) refpoint=0; 
       if (refPointParam == 0 ) refpoint = allData[0][0] - 5000;
-
+      
+      Int_t sideshift, sideshiftqtc;
       Int_t numPmtC=0;    
-      for (Int_t ik = 0; ik<12; ik++)
+      Int_t numPmtA=0;    
+      for (Int_t ik = 0; ik<24; ik++)
        {
-       //      for (Int_t iHt=0; iHt<1; iHt++){
-
-       Int_t nhitsPMT=0;
-       if(allData[ik+1][0]>0 && type == 7  ) numPmtC++;
-       for (Int_t iHt=0; iHt<5; iHt++){
-         //cfd
-         if(allData[ik+1][iHt]>0) {
-           GetRawsData(shift+ik+1) -> Fill(allData[ik+1][iHt]-refpoint);
-           if(allData[1][0]>0) 
-           GetRawsData(shift+ik+220) -> Fill(allData[ik+1][iHt]-allData[1][0]);
-           //      cout<<"C  cfd "<<ik<<" "<<iHt<<" "<<allData[ik+1][iHt]<<" -RF "<<refpoint<<"  "<<allData[ik+1][iHt]-refpoint<<endl;
-           if(type == 8 && iHt==0 ) {
-             feffC[ik]++;
-             GetRawsData(208)->Fill(ik+1, allData[ik+1][iHt]-refpoint);
-           } 
-           if(type == 7  )  nhitsPMT++;
-           
-         }
-         //led
-         if(allData[ik+13][iHt] > 0) { 
-           GetRawsData(shift+ik+24+1)->  Fill(allData[ik+13][iHt]-refpoint);
-           //      cout<<"C  led "<<ik<<" "<<iHt<<" "<<allData[ik+1][iHt]<<" -RF "<<refpoint<<"  "<<allData[ik+13][iHt]-refpoint<<endl;
-           if(type == 8   && iHt==0) {
-             feffA[ik]++;
-             GetRawsData(209)->Fill(ik+1, allData[ik+13][iHt]-refpoint);
-           }
+         if(ik<12) {
+           sideshift=1;
+           sideshiftqtc=1;
+           if(allData[ik+sideshift][0]>0 && type == 7  )  numPmtC++;
          }
-         //led -cfd
-
-         if(allData[ik+13][iHt] > 0 && allData[ik+1][iHt] >0 )
-           GetRawsData(shift+ik+48+1)->
-             Fill(allData[ik+13][iHt]-allData[ik+1][iHt]);
-
-         //qtc
-         if(allData[2*ik+25][iHt] > 0 || allData[2*ik+26][iHt] > 0) {
-           GetRawsData(shift+ik+72+1)->
-             Fill(allData[2*ik+25][iHt]-allData[2*ik+26][iHt]);
-           GetRawsData(shift+ik+270)->Fill(allData[2*ik+26][iHt] - refpoint);
-           GetRawsData(shift+ik+24+270)->Fill(allData[2*ik+25][iHt] - refpoint);
-
-           if(type == 8  && iHt==0 ) {
-             feffqtc[ik]++;
-             GetRawsData(210)->Fill(allData[2*ik+25][iHt]-allData[2*ik+26][iHt]);
-           }
+         else {
+           if(allData[ik+45][0]>0 && type == 7 ) numPmtA++;
+           sideshift=45;
+           sideshiftqtc=33;
+
          }
-       }
-       if(type == 7  ) GetRawsData(ik+244)->Fill(nhitsPMT);
-      }
-      if(type == 7  ) GetRawsData(212)->Fill(numPmtC);
-      Int_t numPmtA=0;    
-       for (Int_t ik = 12; ik<24; ik++) {
-       //      for (Int_t iHt=0; iHt<1; iHt++) {
-       if(allData[ik+45][0]>0 && type == 7 ) numPmtA++;
-       Int_t nhitsPMT=0;
-       for (Int_t iHt=0; iHt<5; iHt++) {
-         if(allData[ik+45][iHt]>0) {
+         Int_t nhitsPMT=0;
+         
+         for (Int_t iHt=0; iHt<5; iHt++){
            //cfd
-           GetRawsData(shift+ik+1)->
-             Fill(allData[ik+45][iHt]-refpoint);
-           if(allData[57][0]>0) 
-           GetRawsData(shift+ik+220) -> Fill(allData[ik+45][iHt]-allData[57][0]);
-
-           //      cout<<"A  cfd "<<ik<<" "<<iHt<<" "<<allData[ik+1][iHt]<<" -RF "<<refpoint<<"  "<<allData[ik+1][iHt]-refpoint<<endl;
-           if(type == 8  ) {
-             feffC[ik]++;
-             GetRawsData(208)->Fill(ik+1, allData[ik+45][iHt]-refpoint);
-           } 
-           if(type == 7  )   nhitsPMT++;
+           if(allData[ik+sideshift][iHt]>0) {
+             GetRawsData(shift+ik+1) -> Fill(allData[ik+sideshift][iHt]);
+             GetRawsData(210+shift)->Fill(ik+1, allData[ik+sideshift][iHt]);
+             if(type == 8 ) feffC[ik]++;
+             AliDebug(50,Form("%i CFD %i  data %s",ik, ik+sideshift,  GetRawsData(shift+ik+1)->GetName()));
+             if(type == 7  ) {
+               nhitsPMT++;
+               feffPhysC[ik]++;
+             }
+             
+           }
+           //led
+           if(allData[ik+12+sideshift][iHt] > 0) { 
+             GetRawsData(shift+ik+24+1)->  Fill(allData[ik+12+sideshift][iHt]);
+             GetRawsData(211+shift)->Fill(ik+1, allData[ik+12+sideshift][iHt]);
+             AliDebug(50,Form("%i LED %i  data %s",ik, ik+12+sideshift,  GetRawsData(shift+ik+1+24)->GetName()));
+             if(type == 8  ) {
+               feffA[ik]++;
+             }
+           }
+           //led -cfd
+           
+           if(allData[ik+12+sideshift][iHt] > 0 && allData[ik+sideshift][iHt] >0 )
+             GetRawsData(shift+ik+48+1)->
+               Fill(allData[ik+12+sideshift][iHt]-allData[ik+sideshift][iHt]);
            
+           //qtc
+           if(allData[2*ik+sideshiftqtc+24][iHt] > 0 &&
+              allData[2*ik+sideshiftqtc+25][iHt] > 0) {
+             GetRawsData(shift+ik+72+1)->
+               Fill(allData[2*ik+sideshiftqtc+24][iHt]-allData[2*ik+sideshiftqtc+25][iHt]);
+             GetRawsData(212+shift)->Fill(ik+1, allData[2*ik+sideshiftqtc+24][iHt]-allData[2*ik+sideshiftqtc+25][iHt]);
+             if(type == 8) feffqtc[ik]++;
+             AliDebug(50,Form("%i QTC %i  data %s",ik, 2*ik+sideshiftqtc+24,  GetRawsData(shift+ik+1+72)->GetName()));
 
-         }
-         //led
-         if(allData[ik+57][iHt] > 0 ) {
-           GetRawsData(shift+ik+24+1)->Fill(allData[ik+57][iHt]-refpoint);
-           //   cout<<"C  led "<<ik<<" "<<iHt<<" "<<allData[ik+1][iHt]<<" -RF "<<refpoint<<"  "<<allData[ik+13][iHt]-refpoint<<endl;
-           if(type == 8  ) {
-             feffA[ik]++;
-             GetRawsData(209)->Fill(ik+1, allData[ik+57][iHt]-refpoint);
+           }
+               if(allData[2*ik+sideshiftqtc+24][iHt] > 0) {
+                 AliDebug(50,Form("%i QT0 %i  data %s",ik, 2*ik+sideshiftqtc+24,  GetRawsData(shift+ik+1+96)->GetName()));
+             GetRawsData(shift+ik+96+1)->Fill(allData[2*ik+sideshiftqtc+24][iHt]);
+           }
+           if(allData[2*ik+sideshiftqtc+25][iHt] > 0) {
+             AliDebug(50,Form("%i QT0 %i  data %s",ik, 2*ik+sideshiftqtc+25,  GetRawsData(shift+ik+1+120)->GetName()));
+             GetRawsData(shift+ik+120+1)->Fill(allData[2*ik+sideshiftqtc+25][iHt]);
            }
          }
-           //qtc         
-         if(allData[2*ik+57][iHt]>0 || allData[2*ik+58][iHt]>0)
-           {
-             GetRawsData(shift+ik+72+1)-> Fill(allData[2*ik+57][iHt]-allData[2*ik+58][iHt]);
-             GetRawsData(shift+ik+270)->Fill(allData[2*ik+58][iHt]-refpoint);
-             GetRawsData(shift+ik+24+270)->Fill(allData[2*ik+57][iHt]-refpoint);
-             if(type == 8  ){
-               feffqtc[ik]++;
-               GetRawsData(210)->Fill(allData[2*ik+57][iHt]-allData[2*ik+58][iHt]);
-             }
-           } 
-         //led-cfd
-         if(allData[ik+57][iHt] > 0 &&allData[ik+45][iHt]>0)
-           GetRawsData(shift+ik+48+1)->
-             Fill(allData[ik+57][iHt]-allData[ik+45][iHt]);
-       }
-       if(type == 7  ) GetRawsData(ik+244)->Fill(nhitsPMT);
+       
+         if(type == 7  ) {
+           GetRawsData(ik+176)->Fill(nhitsPMT);
+           GetRawsData(213)->Fill(numPmtC);
+           GetRawsData(214)->Fill(numPmtA);
+         }  
+       }   
+       
+      Int_t trChannel[6] = {49,50,51,52,55,56};  
+      Float_t ch2cm = 24.4*0.029979;     
+      Int_t nhitsOrA=0;
+      Int_t nhitsOrC=0;
+      for (Int_t iHt=0; iHt<5; iHt++) {
+       
+       //orA-orC phys tvdc 1 
+       if((allData[51][iHt]>0 && allData[52][iHt]>0) && allData[50][iHt]>0)
+         {
+           AliDebug(10,Form("orA-orC phys tvdc 1  %i  data %s", 217+shift,  GetRawsData(shift+217)->GetName()));
 
-      }
-       if(type == 7  ) GetRawsData(211)->Fill(numPmtA);
+           GetRawsData(217+shift)->Fill((allData[52][iHt]-allData[51][iHt])*ch2cm);
+           //        GetRawsData(345) ->Fill((allData[51][iHt]+allData[52][iHt])/2.);
+         }
+       //orA-orC phys tvdc 0 
+       if((allData[51][iHt]>0 && allData[52][iHt]>0) && allData[50][iHt]<=0)
+         {
+           AliDebug(10,Form("orA-orC phys tvdc 0  %i  data %s", 218+shift,  GetRawsData(shift+218)->GetName()));
 
-      Int_t trChannel[6] = {49,50,51,52,55,56};  
-       
-      if(type == 7)
-       {
-         Int_t nhitsOrA=0;
-         Int_t nhitsOrC=0;
-         for (Int_t iHt=0; iHt<5; iHt++) {
-           // pure CFD1 & CFD2 for trigger needs
-           if(allData[1][iHt]>0) GetRawsData(354)->Fill(allData[1][iHt]);
-           if(allData[2][iHt]>0) GetRawsData(355)->Fill(allData[2][iHt]);
-
-           //orA-orC phys tvdc 1 
-           if((allData[51][iHt]>0 && allData[52][iHt]>0) && allData[50][iHt]>0)
-             GetRawsData(350)->Fill(allData[52][iHt]-allData[51][iHt]);
-           //orA-orC phys tvdc 0 
-           if((allData[51][iHt]>0 && allData[52][iHt]>0) && allData[50][iHt]<=0)
-             GetRawsData(352)->Fill(allData[52][iHt]-allData[51][iHt]);
-           for (Int_t itr=0; itr<6; itr++) {
-             if (allData[trChannel[itr]][iHt] >0) {
-               fNumTriggers[itr]++;
-               GetRawsData(98+itr)->Fill(allData[trChannel[itr]][iHt]-refpoint);
-             }
-           }
+           GetRawsData(218+shift)->Fill((allData[52][iHt]-allData[51][iHt])*ch2cm);
+         }
+       if(allData[51][iHt]>0 && allData[52][iHt]>0) {
+         AliDebug(50,Form("orA-orC phys tvdc all  %i  data %s", 219+shift,  GetRawsData(shift+219)->GetName()));
+           GetRawsData(219+shift)->Fill((allData[52][iHt]-allData[51][iHt])*ch2cm);
+       }
+       for (Int_t itr=0; itr<6; itr++) {
+         if (allData[trChannel[itr]][iHt] >0) {
+            if(type == 7  )fNumTriggers[itr]++;
+            if(type == 8  )fNumTriggersCal[itr]++;
+            AliDebug(50,Form(" triggers %i  data %s", 170+itr+shift,  GetRawsData(170+itr+shift)->GetName()));
 
-           if(allData[51][iHt] >0) nhitsOrA++;
-           if(allData[52][iHt] >0) nhitsOrC++;
-           
-           if(allData[53][iHt]>0 && allData[54][iHt]>0) {
-             GetRawsData(216)->Fill(allData[53][iHt]-allData[54][iHt]);
-             if(allData[55][iHt]>0) GetRawsData(216)->Fill(allData[53][iHt]-allData[54][iHt]);
-             if(allData[56][iHt]>0) GetRawsData(218)->Fill(allData[53][iHt]-allData[54][iHt]);
-           }
-           if(allData[51][iHt]>0 && allData[52][iHt]>0)
-             GetRawsData(215)->Fill(allData[52][iHt]-allData[51][iHt]);
+           GetRawsData(170+itr+shift)->Fill(allData[trChannel[itr]][iHt]);
          }
-         GetRawsData(213)->Fill(nhitsOrA);
-         GetRawsData(214)->Fill(nhitsOrC);
-         
        }
+           
+       if(type == 7) if(allData[51][iHt] >0) nhitsOrA++;
+       if(type == 7)if(allData[52][iHt] >0) nhitsOrC++;
+       
+       //mult trigger signals phys
+       //C side
+       if(allData[53][iHt]>0 && allData[54][iHt]>0) {
+         AliDebug(50,Form(" mpdA %i  data %s", 201+shift,  GetRawsData(201+shift)->GetName()));
+
+         GetRawsData(201+shift)->Fill(allData[53][iHt]-allData[54][iHt]);
+         if(allData[56][iHt]>0) GetRawsData(202+shift)->Fill(allData[53][iHt]-allData[54][iHt]);
+         if(allData[55][iHt]>0) GetRawsData(203+shift)->Fill(allData[53][iHt]-allData[54][iHt]);
+       }
+       
+       //A side 
+       if(allData[105][iHt]>0 && allData[106][iHt]>0) {
+         AliDebug(50,Form(" mpdC %i  data %s", 204+shift,  GetRawsData(204+shift)->GetName()));
+
+            GetRawsData(204+shift)->Fill(allData[105][iHt]-allData[106][iHt]);
+            if(allData[56][iHt]>0) GetRawsData(205+shift)->Fill(allData[105][iHt]-allData[106][iHt]);
+            if(allData[55][iHt]>0) GetRawsData(206+shift)->Fill(allData[105][iHt]-allData[106][iHt]);
+       }
+      }
       
-      if(type == 8)
-         {
-           for (Int_t iHt=0; iHt<5; iHt++) {
-             //pure CFD 1 & 2
-           if(allData[1][iHt]>0) GetRawsData(356)->Fill(allData[1][iHt]);
-           if(allData[2][iHt]>0) GetRawsData(357)->Fill(allData[2][iHt]);
-
-             //orA-orC laser
-           if(allData[51][iHt]>0 && allData[52][iHt]>0)
-             GetRawsData(219)->Fill(allData[52][iHt]-allData[51][iHt]);
-           //orA-orC laser tvdc 1 
-           if((allData[51][iHt]>0 && allData[52][iHt]>0) && allData[50][iHt]>0)
-             GetRawsData(351)->Fill(allData[52][iHt]-allData[51][iHt]);
-           //orA-orC laser tvdc 0 
-           if((allData[51][iHt]>0 && allData[52][iHt]>0) && allData[50][iHt]<=0)
-             GetRawsData(353)->Fill(allData[52][iHt]-allData[51][iHt]);
-           //trigger laser
-             for (Int_t itr=0; itr<6; itr++) {
-               if(allData[trChannel[itr]][iHt]>0)
-                 {
-                   
-                   GetRawsData(198+itr)->
-                     Fill(allData[trChannel[itr]][iHt]-refpoint);
-                   fNumTriggersCal[itr]++;
-                 }
+      GetRawsData(215)->Fill(nhitsOrA);
+      GetRawsData(216)->Fill(nhitsOrC);
+
+      //draw satellite
+       if(type == 7){  
+         if(fnEventPhys == 1000) {
+           for (Int_t ik=0; ik<24; ik++)
+             {
+               GetRawsData(ik+1)->GetXaxis()->SetRangeUser(2000, 3000);
+               int  maxBin  =  GetRawsData(ik+1) ->GetMaximumBin(); 
+               double   meanEstimate  =  GetRawsData(ik+1)->GetBinCenter( maxBin);
+               TF1* fit= new TF1("fit","gaus", meanEstimate - 40, meanEstimate + 40);
+               fit->SetParameters (GetRawsData(ik+1)->GetBinContent(maxBin), meanEstimate, 80);
+               GetRawsData(ik+1) -> Fit("fit","RQ","Q",  meanEstimate-40,  meanEstimate+40);
+               fMeans[ik]= (Int_t) fit->GetParameter(1);
+               GetRawsData(ik+1)->GetXaxis()->SetRangeUser(0, 30000);
+
              }
-             //mult trigger signals laser
-             if(allData[53][iHt]>0 && allData[54][iHt]>0) {
-               GetRawsData(202)->Fill(allData[53][iHt]-allData[54][iHt]);
-               if(allData[55][iHt]>0) GetRawsData(202)->Fill(allData[53][iHt]-allData[54][iHt]);
-               if(allData[56][iHt]>0) GetRawsData(204)->Fill(allData[53][iHt]-allData[54][iHt]);
+         }
+
+         if( fnEventPhys > 1000) {
+           Int_t besttimeA=9999999;
+           Int_t besttimeC=9999999;
+           for (Int_t ipmt=0; ipmt<12; ipmt++){
+               if(allData[ipmt+1][0] > 1 ) {
+                 //          time[ipmt] = allData[ipmt+1][0] - Int_t(GetRawsData(1)->GetMean());
+                 time[ipmt] = allData[ipmt+1][0] - fMeans[ipmt];
+                 if(TMath::Abs(time[ipmt]) < TMath::Abs(besttimeC))
+                   besttimeC=time[ipmt]; //timeC
+               }
+           }
+           for ( Int_t ipmt=12; ipmt<24; ipmt++){
+             if(allData[ipmt+45][0] > 0) {
+               time[ipmt] = allData[ipmt+45][0] - fMeans[ipmt] ;
+               if(TMath::Abs(time[ipmt]) < TMath::Abs(besttimeA) )
+                 besttimeA=time[ipmt]; //timeA
              }
            }
-         } 
-      
-           delete start;
-    }
+           if(besttimeA<99999 &&besttimeC< 99999) {
+             Float_t t0 =  24.4 * (Float_t( besttimeA+besttimeC)/2. );
+             Float_t ver = 24.4 * Float_t( besttimeC-besttimeA)/2.;
+             GetRawsData(220)->Fill(0.001*ver, 0.001*(t0));
+             if(allData[50][0] > 0)  GetRawsData(221)->Fill(0.001*ver, 0.001*(t0));
+             if(allData[50][0] <= 0) GetRawsData(222)->Fill(0.001*ver, 0.001*(t0));
+             GetRawsData(223) ->Fill(t0);
+           }     
+         } //event >100
+      } //type 7
+    } //next
+  
+  
+
+  delete start;
 }
 
 
 
+
 //____________________________________________________________________________
 void AliT0QADataMakerRec::MakeDigits( TTree *digitsTree)
 {
@@ -755,7 +831,37 @@ void AliT0QADataMakerRec::MakeESDs(AliESDEvent * esd)
 {
   //fills QA histos for ESD
   
-  GetESDsData(0) -> Fill(esd->GetT0());
-  GetESDsData(1)-> Fill(esd->GetT0zVertex());
+  const Double32_t  *mean;
+  mean = esd->GetT0TOF();
+  Double32_t t0time= 0.001*mean[0];
+  Double32_t orA= 0.001*mean[1];
+  Double32_t orC=0.001* mean[2];
+
+  if (t0time<99)   GetESDsData(0) -> Fill(t0time);
+  if( esd->GetT0zVertex() <99) GetESDsData(1)-> Fill(esd->GetT0zVertex());
+  if( orA<99 && orC<99) GetESDsData(2)-> Fill((orA-orC)/2.);
   
 }
+//____________________________________________________________________________
+
+/*
+void AliT0QADataMakerRec::GetMeanAndSigma(TH1F* hist, Float_t &mean, Float_t &sigma) 
+{
+
+  const double window = 3.;  //fit window 
+  double meanEstimate, sigmaEstimate; 
+  int maxBin;
+  maxBin        =  hist->GetMaximumBin(); //position of maximum
+  meanEstimate  =  hist->GetBinCenter( maxBin); // mean of gaussian sitting in maximum
+  sigmaEstimate = hist->GetRMS();
+  TF1* fit= new TF1("fit","gaus", meanEstimate - window*sigmaEstimate, meanEstimate + window*sigmaEstimate);
+  fit->SetParameters(hist->GetBinContent(maxBin), meanEstimate, sigmaEstimate);
+  hist->Fit("fit","RQ","Q");
+
+  mean  = (Float_t) fit->GetParameter(1);
+  sigma = (Float_t) fit->GetParameter(2);
+
+  delete fit;
+}
+*/