]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGPP/TPC/AliTPCPerformanceSummary.cxx
guess the run number from the input file path
[u/mrichter/AliRoot.git] / PWGPP / TPC / AliTPCPerformanceSummary.cxx
index 369f7e8f2dc131158d2fae4c77f0b741ad47ed7e..5b246b8d41a3af4863bda2574ebbdacdf2135083 100644 (file)
@@ -42,6 +42,8 @@
 
 #include "AliTPCPerformanceSummary.h"
 
+using std::ifstream;
+
 ClassImp(AliTPCPerformanceSummary)
 
 Bool_t AliTPCPerformanceSummary::fgForceTHnSparse = kFALSE;
@@ -106,7 +108,7 @@ void AliTPCPerformanceSummary::WriteToTTreeSRedirector(const AliPerformanceTPC*
       "time="<<time<<
       "startTimeGRP="<<startTimeGRP<<
       "stopTimeGRP="<<stopTimeGRP<<
-      "duration="<<
+      "duration="<<duration<<
       "runType.="<<&runType;
     if (pTPC) {
         pTPC->GetTPCTrackHisto()->GetAxis(9)->SetRangeUser(0.5,1.5);
@@ -123,7 +125,9 @@ void AliTPCPerformanceSummary::WriteToTTreeSRedirector(const AliPerformanceTPC*
 
        AnalyzePt(pTPC,pcstream);
        AnalyzeChargeOverPt(pTPC,pcstream); 
-       
+       AnalyzeQAPosNegDpT(pTPC,pcstream);
+       AnalyzeQADCAFitParameter(pTPC,pcstream);
+       AnalyzeOcc(pTPC,pcstream);
 
         pTPC->GetTPCTrackHisto()->GetAxis(9)->SetRangeUser(-10,10);
         pTPC->GetTPCTrackHisto()->GetAxis(7)->SetRangeUser(0,100);
@@ -407,8 +411,93 @@ Int_t AliTPCPerformanceSummary::ProduceTrends(const Char_t* infilelist, const Ch
     SaveGraph(tree,"tpcConstrainPhiA","run",condition);
     SaveGraph(tree,"tpcConstrainPhiC","run",condition);
      
+    SaveGraph(tree,"deltaPt","run",condition);
+    SaveGraph(tree,"deltaPtchi2","run",condition);
+    SaveGraph(tree,"deltaPtA","run",condition);
+    SaveGraph(tree,"deltaPtchi2A","run",condition);
+    SaveGraph(tree,"deltaPtC","run",condition);
+    SaveGraph(tree,"deltaPtchi2C","run",condition);
+    SaveGraph(tree,"deltaPtA_Err","run",condition);
+    SaveGraph(tree,"deltaPtA_Err","run",condition);
+    SaveGraph(tree,"deltaPtC_Err","run",condition);
+    
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //save dca fit parameters
+    SaveGraph(tree,"dcar_posA_0","run",condition);
+    SaveGraph(tree,"dcar_posA_1","run",condition);
+    SaveGraph(tree,"dcar_posA_2","run",condition);
+    SaveGraph(tree,"dcar_posA_chi2","run",condition);
+    SaveGraph(tree,"dcar_posA_0_Err","run",condition);
+    SaveGraph(tree,"dcar_posA_1_Err","run",condition);
+    SaveGraph(tree,"dcar_posA_2_Err","run",condition);
+
+    SaveGraph(tree,"dcaz_posA_0","run",condition);
+    SaveGraph(tree,"dcaz_posA_1","run",condition);
+    SaveGraph(tree,"dcaz_posA_2","run",condition);
+    SaveGraph(tree,"dcaz_posA_chi2","run",condition);
+    SaveGraph(tree,"dcaz_posA_0_Err","run",condition);
+    SaveGraph(tree,"dcaz_posA_1_Err","run",condition);
+    SaveGraph(tree,"dcaz_posA_2_Err","run",condition);
+
+    SaveGraph(tree,"dcaz_posC_0","run",condition);
+    SaveGraph(tree,"dcaz_posC_1","run",condition);
+    SaveGraph(tree,"dcaz_posC_2","run",condition);
+    SaveGraph(tree,"dcaz_posC_chi2","run",condition);
+    SaveGraph(tree,"dcaz_posC_0_Err","run",condition);
+    SaveGraph(tree,"dcaz_posC_1_Err","run",condition);
+    SaveGraph(tree,"dcaz_posC_2_Err","run",condition);
+
+    SaveGraph(tree,"dcar_posC_0","run",condition);
+    SaveGraph(tree,"dcar_posC_1","run",condition);
+    SaveGraph(tree,"dcar_posC_2","run",condition);
+    SaveGraph(tree,"dcar_posC_chi2","run",condition);
+    SaveGraph(tree,"dcar_posC_0_Err","run",condition);
+    SaveGraph(tree,"dcar_posC_1_Err","run",condition);
+    SaveGraph(tree,"dcar_posC_2_Err","run",condition);
+
+    SaveGraph(tree,"dcar_negA_0","run",condition);
+    SaveGraph(tree,"dcar_negA_1","run",condition);
+    SaveGraph(tree,"dcar_negA_2","run",condition);
+    SaveGraph(tree,"dcar_negA_chi2","run",condition);
+    SaveGraph(tree,"dcar_negA_0_Err","run",condition);
+    SaveGraph(tree,"dcar_negA_1_Err","run",condition);
+    SaveGraph(tree,"dcar_negA_2_Err","run",condition);
+
+    SaveGraph(tree,"dcaz_negA_0","run",condition);
+    SaveGraph(tree,"dcaz_negA_1","run",condition);
+    SaveGraph(tree,"dcaz_negA_2","run",condition);
+    SaveGraph(tree,"dcaz_negA_chi2","run",condition);
+    SaveGraph(tree,"dcaz_negA_0_Err","run",condition);
+    SaveGraph(tree,"dcaz_negA_1_Err","run",condition);
+    SaveGraph(tree,"dcaz_negA_2_Err","run",condition);
+    
+    SaveGraph(tree,"dcaz_negC_0","run",condition);
+    SaveGraph(tree,"dcaz_negC_1","run",condition);
+    SaveGraph(tree,"dcaz_negC_2","run",condition);
+    SaveGraph(tree,"dcaz_negC_chi2","run",condition);
+    SaveGraph(tree,"dcaz_negC_0_Err","run",condition);
+    SaveGraph(tree,"dcaz_negC_1_Err","run",condition);
+    SaveGraph(tree,"dcaz_negC_2_Err","run",condition);
+    
+    SaveGraph(tree,"dcar_negC_0","run",condition);
+    SaveGraph(tree,"dcar_negC_1","run",condition);
+    SaveGraph(tree,"dcar_negC_2","run",condition);
+    SaveGraph(tree,"dcar_negC_chi2","run",condition);
+    SaveGraph(tree,"dcar_negC_0_Err","run",condition);
+    SaveGraph(tree,"dcar_negC_1_Err","run",condition);
+    SaveGraph(tree,"dcar_negC_2_Err","run",condition);
+
+    SaveGraph(tree,"iroc_A_side","run",condition);    
+    SaveGraph(tree,"iroc_C_side","run",condition);    
+    SaveGraph(tree,"oroc_A_side","run",condition);    
+    SaveGraph(tree,"oroc_C_side","run",condition);    
+
+    //A/C side IROC                                                                                                                                                           
+    SaveGraph(tree,"TPC_Occ_IROC.","run",condition);
+    SaveGraph(tree,"TPC_Occ_OROC.","run",condition);
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////
+
     tree->Write();
-    
     out->Close();   
     if (tree) { delete tree; tree=0; }
     if (out) { delete out; out=0; }
@@ -1257,12 +1346,14 @@ Int_t AliTPCPerformanceSummary::AnalyzeGain(const AliPerformanceDEdx* pTPCgain,
     static Float_t resolutionMIP = 0;
     static Float_t attachSlopeC = 0;
     static Float_t attachSlopeA = 0;
-
+    static Float_t meanMIPele = 0;
+    static Float_t resolutionMIPele = 0;
+    static Float_t electroMIPSeparation = 0;
+    
     TH1 * his1D = 0;
     //TH1 * hisProj1D=0;
     TH2* his2D=0;
      
-
     meanMIPvsSector.Zero();
     //
     // select MIP particles
@@ -1288,6 +1379,7 @@ Int_t AliTPCPerformanceSummary::AnalyzeGain(const AliPerformanceDEdx* pTPCgain,
     resolutionMIP = 0;
     if (meanMIP!=0) resolutionMIP = gausFit.GetParameter(2)/meanMIP;
     //removedtotest// delete his1D;
+    
     //
     // MIP position vs. dip angle (attachment)
     //    
@@ -1305,8 +1397,8 @@ Int_t AliTPCPerformanceSummary::AnalyzeGain(const AliPerformanceDEdx* pTPCgain,
     his1D = (TH1*) arrayFit.At(1);
     his1D->Fit(fpol,"QNROB=0.8","QNR",-1,0);
     attachSlopeC = fpol->GetParameter(1);
-     //removedtotest// delete his2D;
-     //removedtotest// delete his1D;
+    //removedtotest// delete his2D;
+    //removedtotest// delete his1D;
     //
     pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(0,3); // A side
     if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_a_0_5") && !fgForceTHnSparse) {    
@@ -1318,7 +1410,8 @@ Int_t AliTPCPerformanceSummary::AnalyzeGain(const AliPerformanceDEdx* pTPCgain,
 
     TF1 * fpolA = new TF1("fpolA","pol1");
     TObjArray arrayFitA;
-    his2D->FitSlicesY(0,0,-1,10,"QN",&arrayFit);    
+    //FitSlicesY(TF1* f1 = 0, Int_t firstxbin = 0, Int_t lastxbin = -1, Int_t cut = 0, Option_t* option = "QNR", TObjArray* arr = 0)   
+    his2D->FitSlicesY(0,0,-1,10,"QN",&arrayFit); 
     his1D = (TH1*) arrayFit.At(1);
     his1D->Fit(fpolA,"QNROB=0.8","QN",0,1);
     attachSlopeA = fpolA->GetParameter(1);
@@ -1374,22 +1467,61 @@ Int_t AliTPCPerformanceSummary::AnalyzeGain(const AliPerformanceDEdx* pTPCgain,
         //removedtotest// delete his1D;
     }
      //removedtotest// delete his2D;
-    //
+
+     //                                                         
+    //  
+    // select electrons                                                                                                               
+    //                                                                                                                                                                           
+    pTPCgain->GetDeDxHisto()->GetAxis(7)->SetRangeUser(0.32,0.38); // momenta
+    pTPCgain->GetDeDxHisto()->GetAxis(0)->SetRangeUser(70,100); // dedx
+    pTPCgain->GetDeDxHisto()->GetAxis(6)->SetRangeUser(80,160); // nr clusters
+    pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-1,1); // eta
+
+    TF1 gausFitEle("gausFitEle","gaus");
+
+    if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mipsele_0") && !fgForceTHnSparse) {
+      his1D = dynamic_cast<TH1*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mipsele_0")->Clone());
+    } else {
+      his1D =  pTPCgain->GetDeDxHisto()->Projection(0);
+    }
+    if(!his1D) return 4;
+    his1D->Fit(&gausFitEle,"QN","QN");
+
+    meanMIPele = gausFitEle.GetParameter(1);
+    resolutionMIPele = 0;
+    if (meanMIPele!=0) resolutionMIPele = gausFitEle.GetParameter(2)/meanMIPele;
+    
+    //restore cuts as before
+    pTPCgain->GetDeDxHisto()->GetAxis(7)->SetRangeUser(0.4,0.55);
+    pTPCgain->GetDeDxHisto()->GetAxis(0)->SetRangeUser(35,60);
+    pTPCgain->GetDeDxHisto()->GetAxis(6)->SetRangeUser(80,160);
+    pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-1,1);
+
+    //                                                                                                                                                                        
+    // separation between electrons and MIPs                                                                                                                                  
+    // 
+    electroMIPSeparation = TMath::Abs((meanMIP-meanMIPele));
+
     printf("Gain QA report\n");
     printf("MIP mean\t%f\n",meanMIP);
     printf("MIP resolution\t%f\n",resolutionMIP);
     printf("MIPslopeA\t%f\n",attachSlopeA);
     printf("MIPslopeC\t%f\n",attachSlopeC);
+    printf("Electons energy loss MIP mean\t%f\n",meanMIPele);
+    printf("Electons MIP resolution\t%f\n",resolutionMIPele);
     // 
     
     (*pcstream)<<"tpcQA"<<
-        "MIPattachSlopeC="<<attachSlopeC<<
-        "MIPattachSlopeA="<<attachSlopeA<<
-        "resolutionMIP="<<resolutionMIP<<
-        "meanMIPvsSector.="<<&meanMIPvsSector<<
-        "sector.="<<&sector<<
-        "meanMIP="<<meanMIP;
-
+      "MIPattachSlopeC="<<attachSlopeC<<
+      "MIPattachSlopeA="<<attachSlopeA<<
+      "resolutionMIP="<<resolutionMIP<<
+      "meanMIPvsSector.="<<&meanMIPvsSector<<
+      "sector.="<<&sector<<
+      "meanMIP="<<meanMIP<<
+      "meanMIPele="<<meanMIPele<<
+      "resolutionMIPele="<<resolutionMIPele<<
+      "electroMIPSeparation="<<electroMIPSeparation;
+    
     return 0;
 }
 
@@ -1901,3 +2033,707 @@ Int_t AliTPCPerformanceSummary::AnalyzeConstrain(const AliPerformanceMatch* pCon
   
   return 0;
 }
+
+//_____________________________________________________________________________
+ Int_t AliTPCPerformanceSummary::AnalyzeQAPosNegDpT(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
+{
+  //function which plot 1/Pt for negative and 
+  //positive particles
+  
+  if (!pcstream) return 512;
+  if (!pTPC) return 512;
+  
+  TH3D* pos3=0;
+  TH3D* neg3=0;
+  TH1D* pos=0;
+  TH1D* neg=0;
+  TH1D* posC=0;
+  TH1D* negC=0;
+  TH1D* posA=0;
+  TH1D* negA=0;
+  static Double_t deltaPtC = 0;
+  static Double_t deltaPtchi2C = 0;
+  static Double_t slopeC = 0;
+  static Double_t deltaPtA = 0;
+  static Double_t deltaPtchi2A = 0;
+  static Double_t slopeA = 0;
+  static Double_t deltaPt = 0;
+  static Double_t deltaPtchi2 = 0;
+  static Double_t slope = 0;
+  static Double_t deltaPt_Err = 0; 
+  static Double_t deltaPtA_Err = 0;
+  static Double_t deltaPtC_Err = 0;
+
+
+//C side
+
+  if(pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_0_5_7"))
+    {
+    pos3 = dynamic_cast<TH3D*>(pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_0_5_7")); 
+    if(!pos3) return 512;
+  
+    pos = pos3->ProjectionZ("pos",71,-1,6,25);
+    posC = pos3->ProjectionZ("posC",71,-1,6,15);
+    posA = pos3->ProjectionZ("posA",71,-1,16,25);
+    }
+
+    if(pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_0_5_7")){
+    neg3 = dynamic_cast<TH3D*>(pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_0_5_7")); 
+    if(!neg3) return 512;
+    
+    neg = neg3->ProjectionZ("neg",71,-1,6,25);
+    negC = neg3->ProjectionZ("negC",71,-1,6,15);
+    negA = neg3->ProjectionZ("negA",71,-1,16,25);
+}
+
+if(!pos) return 512; 
+if(!neg) return 512; 
+if(!posA) return 512; 
+if(!negA) return 512; 
+if(!posC) return 512; 
+if(!negC) return 512; 
+
+pos->Sumw2();
+neg->Sumw2();
+posA->Sumw2();
+negA->Sumw2();
+posC->Sumw2();
+negC->Sumw2();
+
+pos->Scale(1.,"width");
+neg->Scale(1.,"width");
+posA->Scale(1.,"width");
+negA->Scale(1.,"width");
+posC->Scale(1.,"width");
+negC->Scale(1.,"width");
+
+//both sides
+
+TF1 fpt("fpt","[1]*exp(-1/((1/x))*[0])",0.1,10);
+TF1 fpt2("fpt2","[1]*exp(-1/((1/x))*[0])",0.1,10);
+fpt.SetParameters(1,0.5);
+fpt2.SetParameters(1,0.5);
+pos->Fit(&fpt,"","",1,4); pos->Fit(&fpt,"","",1,4); pos->Fit(&fpt,"","",1,4);
+neg->Fit(&fpt2,"","",1,4); neg->Fit(&fpt2,"","",1,4); neg->Fit(&fpt2,"","",1,4);
+
+slope = (fpt.GetParameter(0)+fpt2.GetParameter(0))/2.;
+
+TH1D* ratio = new TH1D(*pos); 
+ratio->Divide(neg);
+
+ratio->Draw();
+TF1 fptRatio("fptratio","[2]*exp(-1/((1/x)+[1])*[0])/exp(-1/((1/x)-[1])*[0])",0.1,10);
+fptRatio.SetParameters(0.5,0.006,1);
+fptRatio.FixParameter(0,slope);
+fptRatio.Draw();
+ratio->Fit(&fptRatio,"","",1,4); ratio->Fit(&fptRatio,"","",1,4); 
+ratio->Fit(&fptRatio,"","",1,4);
+
+deltaPt = fptRatio.GetParameter(1);
+deltaPtchi2 = fptRatio.GetChisquare();
+
+//get the errors
+deltaPt_Err = fptRatio.GetParError(1);
+
+
+//A side
+
+TF1 fptA("fptA","[1]*exp(-1/((1/x))*[0])",0.1,10);
+TF1 fpt2A("fpt2A","[1]*exp(-1/((1/x))*[0])",0.1,10);
+fptA.SetParameters(1,0.5);
+fpt2A.SetParameters(1,0.5);
+posA->Fit(&fptA,"","",1,4); posA->Fit(&fptA,"","",1,4); posA->Fit(&fptA,"","",1,4);
+negA->Fit(&fpt2A,"","",1,4); negA->Fit(&fpt2A,"","",1,4); negA->Fit(&fpt2A,"","",1,4);
+
+slopeA = (fptA.GetParameter(0)+fpt2A.GetParameter(0))/2.;
+
+TH1D* ratioA = new TH1D(*posA); 
+ratioA->Divide(negA);
+
+ratioA->Draw();
+TF1 fptRatioA("fptratioA","[2]*exp(-1/((1/x)+[1])*[0])/exp(-1/((1/x)-[1])*[0])",0.1,10);
+fptRatioA.SetParameters(0.5,0.006,1);
+fptRatioA.FixParameter(0,slopeA);
+fptRatioA.Draw();
+ratioA->Fit(&fptRatioA,"","",1,4); ratio->Fit(&fptRatioA,"","",1,4); 
+ratioA->Fit(&fptRatioA,"","",1,4);
+
+deltaPtA = fptRatioA.GetParameter(1);
+deltaPtchi2A = fptRatioA.GetChisquare();
+
+//get the errors
+deltaPtA_Err = fptRatioA.GetParError(1);
+
+ delete ratioA;
+ delete pos;
+ delete neg;
+
+
+//C side
+TF1 fptC("fptC","[1]*exp(-1/((1/x))*[0])",0.1,10);
+TF1 fpt2C("fpt2C","[1]*exp(-1/((1/x))*[0])",0.1,10);
+fptC.SetParameters(1,0.5);
+fpt2C.SetParameters(1,0.5);
+posC->Fit(&fptC,"","",1,4); posC->Fit(&fptC,"","",1,4); posC->Fit(&fptC,"","",1,4);
+negC->Fit(&fpt2C,"","",1,4); negC->Fit(&fpt2C,"","",1,4); negC->Fit(&fpt2C,"","",1,4);
+
+slopeC = (fptC.GetParameter(0)+fpt2C.GetParameter(0))/2.;
+
+TH1D* ratioC = new TH1D(*posC); 
+ratioC->Divide(negC);
+
+ratioC->Draw();
+TF1 fptRatioC("fptratioC","[2]*exp(-1/((1/x)+[1])*[0])/exp(-1/((1/x)-[1])*[0])",0.1,10);
+fptRatioC.SetParameters(0.5,0.006,1);
+fptRatioC.FixParameter(0,slopeC);
+fptRatioC.Draw();
+ratioC->Fit(&fptRatioC,"","",1,4); ratio->Fit(&fptRatioC,"","",1,4); 
+ratioC->Fit(&fptRatioC,"","",1,4);
+
+deltaPtC = fptRatioC.GetParameter(1);
+deltaPtchi2C = fptRatioC.GetChisquare();
+
+//get the errors
+deltaPtC_Err = fptRatioC.GetParError(1);
+
+
+ delete posC;
+ delete negC;
+ delete ratioC;
+    
+    (*pcstream)<<"tpcQA"<<      
+      "deltaPt="<< deltaPt<<
+      "deltaPtchi2="<< deltaPtchi2<<
+      "deltaPtA="<< deltaPtA<<
+      "deltaPtchi2A="<< deltaPtchi2A<<
+      "deltaPtC="<< deltaPtC<<
+      "deltaPtchi2C="<< deltaPtchi2C<<
+      "deltaPt_Err="<< deltaPt_Err<<
+      "deltaPtA_Err="<< deltaPtA_Err<<
+      "deltaPtC_Err="<< deltaPtC_Err;    
+      
+    return 0;
+}
+
+//_____________________________________________________________________________
+ Int_t AliTPCPerformanceSummary::AnalyzeQADCAFitParameter(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
+{
+  
+  //
+  //function which retrieve DCA fit parameters
+  //
+  
+  if (!pcstream) return 16;
+  if (!pTPC) return 16;
+  
+  TH3* dcar_pos3=0;
+  TH3* dcaz_pos3=0;
+  TH3* dcar_neg3=0;
+  TH3* dcaz_neg3=0;
+
+  static Double_t dcar_posA_0=0; 
+  static Double_t dcar_posA_1=0; 
+  static Double_t dcar_posA_2=0; 
+  static Double_t dcar_posA_chi2=0; 
+  static Double_t dcar_posA_0_Err=0; 
+  static Double_t dcar_posA_1_Err=0; 
+  static Double_t dcar_posA_2_Err=0; 
+  
+  static Double_t dcar_posC_0=0; 
+  static Double_t dcar_posC_1=0; 
+  static Double_t dcar_posC_2=0; 
+  static Double_t dcar_posC_chi2=0; 
+  static Double_t dcar_posC_0_Err=0; 
+  static Double_t dcar_posC_1_Err=0; 
+  static Double_t dcar_posC_2_Err=0; 
+
+  static Double_t dcaz_posA_0=0; 
+  static Double_t dcaz_posA_1=0; 
+  static Double_t dcaz_posA_2=0; 
+  static Double_t dcaz_posA_chi2=0; 
+  static Double_t dcaz_posA_0_Err=0; 
+  static Double_t dcaz_posA_1_Err=0; 
+  static Double_t dcaz_posA_2_Err=0; 
+  
+  static Double_t dcaz_posC_0=0; 
+  static Double_t dcaz_posC_1=0; 
+  static Double_t dcaz_posC_2=0; 
+  static Double_t dcaz_posC_chi2=0; 
+  static Double_t dcaz_posC_0_Err=0; 
+  static Double_t dcaz_posC_1_Err=0; 
+  static Double_t dcaz_posC_2_Err=0; 
+  
+  static Double_t dcar_negA_0=0; 
+  static Double_t dcar_negA_1=0; 
+  static Double_t dcar_negA_2=0; 
+  static Double_t dcar_negA_chi2=0; 
+  static Double_t dcar_negA_0_Err=0; 
+  static Double_t dcar_negA_1_Err=0; 
+  static Double_t dcar_negA_2_Err=0; 
+  
+  static Double_t dcar_negC_0=0; 
+  static Double_t dcar_negC_1=0; 
+  static Double_t dcar_negC_2=0; 
+  static Double_t dcar_negC_chi2=0; 
+  static Double_t dcar_negC_0_Err=0; 
+  static Double_t dcar_negC_1_Err=0; 
+  static Double_t dcar_negC_2_Err=0; 
+
+  static Double_t dcaz_negA_0=0; 
+  static Double_t dcaz_negA_1=0; 
+  static Double_t dcaz_negA_2=0; 
+  static Double_t dcaz_negA_chi2=0; 
+  static Double_t dcaz_negA_0_Err=0; 
+  static Double_t dcaz_negA_1_Err=0; 
+  static Double_t dcaz_negA_2_Err=0; 
+  static Double_t dcaz_negC_0=0; 
+  static Double_t dcaz_negC_1=0; 
+  static Double_t dcaz_negC_2=0; 
+  static Double_t dcaz_negC_chi2=0; 
+  static Double_t dcaz_negC_0_Err=0; 
+  static Double_t dcaz_negC_1_Err=0; 
+  static Double_t dcaz_negC_2_Err=0;
+  if (pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_6")) {  
+    dcar_pos3 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_6"));
+  }
+  
+  if (pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_6")) {  
+    dcaz_pos3 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_4_5_6"));
+  }
+  
+  if (pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_6")) {  
+    dcar_neg3 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_3_5_6")); 
+  }
+  
+  if (pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_6")) {  
+    dcaz_neg3 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_4_5_6"));
+  }
+
+  TF1 fit("fit","[0]+[1]*cos(x)+[2]*sin(x)",0,7); 
+
+  dcar_pos3->GetYaxis()->SetRangeUser(0,0.99);    
+  TH1* dcar_posA = (dynamic_cast<TH2*>(dcar_pos3->Project3D("xz_1")))->ProfileX(); 
+  dcar_posA->Fit(&fit,"NQ");
+  dcar_posA_0 = fit.GetParameter(0);
+  dcar_posA_1 = fit.GetParameter(1);
+  dcar_posA_2 = fit.GetParameter(2);
+  dcar_posA_chi2 = fit.GetChisquare();  
+  dcar_posA_0_Err = fit.GetParError(0);
+  dcar_posA_1_Err = fit.GetParError(1);
+  dcar_posA_2_Err = fit.GetParError(2);
+  
+  dcar_pos3->GetYaxis()->SetRangeUser(-1.0,-0.01);    
+  TH1* dcar_posC = (dynamic_cast<TH2*>(dcar_pos3->Project3D("xz_2")))->ProfileX(); 
+  dcar_posC->Fit(&fit,"NQ");
+  dcar_posC_0 = fit.GetParameter(0);
+  dcar_posC_1 = fit.GetParameter(1);
+  dcar_posC_2 = fit.GetParameter(2);
+  dcar_posC_chi2 = fit.GetChisquare();    
+  dcar_posC_0_Err = fit.GetParError(0);
+  dcar_posC_1_Err = fit.GetParError(1);
+  dcar_posC_2_Err = fit.GetParError(2);
+
+  dcaz_pos3->GetYaxis()->SetRangeUser(0,0.99);    
+  TH1* dcaz_posA = (dynamic_cast<TH2*>(dcaz_pos3->Project3D("xz_3")))->ProfileX(); 
+  dcaz_posA->Fit(&fit,"NQ");
+  dcaz_posA_0 = fit.GetParameter(0);
+  dcaz_posA_1 = fit.GetParameter(1);
+  dcaz_posA_2 = fit.GetParameter(2);
+  dcaz_posA_chi2 = fit.GetChisquare();      
+  dcaz_posA_0_Err = fit.GetParError(0);
+  dcaz_posA_1_Err = fit.GetParError(1);
+  dcaz_posA_2_Err = fit.GetParError(2);  
+  
+  dcaz_pos3->GetYaxis()->SetRangeUser(-1.0,-0.01);    
+  TH1* dcaz_posC = (dynamic_cast<TH2*>(dcaz_pos3->Project3D("xz_4")))->ProfileX(); 
+  dcaz_posC->Fit(&fit,"NQ");
+  dcaz_posC_0 = fit.GetParameter(0);
+  dcaz_posC_1 = fit.GetParameter(1);
+  dcaz_posC_2 = fit.GetParameter(2);
+  dcaz_posC_chi2 = fit.GetChisquare();    
+  dcaz_posC_0_Err = fit.GetParError(0);
+  dcaz_posC_1_Err = fit.GetParError(1);
+  dcaz_posC_2_Err = fit.GetParError(2);  
+    
+
+  
+   dcar_neg3->GetYaxis()->SetRangeUser(0,0.99);    
+  TH1* dcar_negA = (dynamic_cast<TH2*>(dcar_neg3->Project3D("xz_1")))->ProfileX(); 
+  dcar_negA->Fit(&fit,"NQ");
+  dcar_negA_0 = fit.GetParameter(0);
+  dcar_negA_1 = fit.GetParameter(1);
+  dcar_negA_2 = fit.GetParameter(2);
+  dcar_negA_chi2 = fit.GetChisquare();  
+  dcar_negA_0_Err = fit.GetParError(0);
+  dcar_negA_1_Err = fit.GetParError(1);
+  dcar_negA_2_Err = fit.GetParError(2);
+  
+  dcar_neg3->GetYaxis()->SetRangeUser(-1.0,-0.01);    
+  TH1* dcar_negC = (dynamic_cast<TH2*>(dcar_neg3->Project3D("xz_2")))->ProfileX(); 
+  dcar_negC->Fit(&fit,"NQ");
+  dcar_negC_0 = fit.GetParameter(0);
+  dcar_negC_1 = fit.GetParameter(1);
+  dcar_negC_2 = fit.GetParameter(2);
+  dcar_negC_chi2 = fit.GetChisquare();    
+  dcar_negC_0_Err = fit.GetParError(0);
+  dcar_negC_1_Err = fit.GetParError(1);
+  dcar_negC_2_Err = fit.GetParError(2);
+
+  dcaz_neg3->GetYaxis()->SetRangeUser(0,0.99);    
+  TH1* dcaz_negA = (dynamic_cast<TH2*>(dcaz_neg3->Project3D("xz_3")))->ProfileX(); 
+  dcaz_negA->Fit(&fit,"NQ");
+  dcaz_negA_0 = fit.GetParameter(0);
+  dcaz_negA_1 = fit.GetParameter(1);
+  dcaz_negA_2 = fit.GetParameter(2);
+  dcaz_negA_chi2 = fit.GetChisquare();      
+  dcaz_negA_0_Err = fit.GetParError(0);
+  dcaz_negA_1_Err = fit.GetParError(1);
+  dcaz_negA_2_Err = fit.GetParError(2);  
+  
+  dcaz_neg3->GetYaxis()->SetRangeUser(-1.0,-0.01);    
+  TH1* dcaz_negC = (dynamic_cast<TH2*>(dcaz_neg3->Project3D("xz_4")))->ProfileX(); 
+  dcaz_negC->Fit(&fit,"NQ");
+  dcaz_negC_0 = fit.GetParameter(0);
+  dcaz_negC_1 = fit.GetParameter(1);
+  dcaz_negC_2 = fit.GetParameter(2);
+  dcaz_negC_chi2 = fit.GetChisquare();    
+  dcaz_negC_0_Err = fit.GetParError(0);
+  dcaz_negC_1_Err = fit.GetParError(1);
+  dcaz_negC_2_Err = fit.GetParError(2);  
+    
+
+// store results (shift in dca) in ttree
+    
+    (*pcstream)<<"tpcQA"<<      
+      "dcar_posA_0="<< dcar_posA_0<<
+      "dcar_posA_1="<< dcar_posA_1<<
+      "dcar_posA_2="<< dcar_posA_2<<
+      "dcar_posA_chi2="<< dcar_posA_chi2<<
+      "dcar_posA_0_Err="<< dcar_posA_0_Err<<
+      "dcar_posA_1_Err="<< dcar_posA_1_Err<<
+      "dcar_posA_2_Err="<< dcar_posA_2_Err;    
+      
+      (*pcstream)<<"tpcQA"<<            
+      "dcaz_posA_0="<< dcaz_posA_0<<
+      "dcaz_posA_1="<< dcaz_posA_1<<
+      "dcaz_posA_2="<< dcaz_posA_2<<
+      "dcaz_posA_chi2="<< dcaz_posA_chi2<<
+      "dcaz_posA_0_Err="<< dcaz_posA_0_Err<<
+      "dcaz_posA_1_Err="<< dcaz_posA_1_Err<<
+      "dcaz_posA_2_Err="<< dcaz_posA_2_Err;          
+      
+      (*pcstream)<<"tpcQA"<<            
+      "dcaz_posC_0="<< dcaz_posC_0<<
+      "dcaz_posC_1="<< dcaz_posC_1<<
+      "dcaz_posC_2="<< dcaz_posC_2<<
+      "dcaz_posC_chi2="<< dcaz_posC_chi2<<
+      "dcaz_posC_0_Err="<< dcaz_posC_0_Err<<
+      "dcaz_posC_1_Err="<< dcaz_posC_1_Err<<
+      "dcaz_posC_2_Err="<< dcaz_posC_2_Err;           
+
+      (*pcstream)<<"tpcQA"<<            
+      "dcar_posC_0="<< dcar_posC_0<<
+      "dcar_posC_1="<< dcar_posC_1<<
+      "dcar_posC_2="<< dcar_posC_2<<
+      "dcar_posC_chi2="<< dcar_posC_chi2<<
+      "dcar_posC_0_Err="<< dcar_posC_0_Err<<
+      "dcar_posC_1_Err="<< dcar_posC_1_Err<<
+      "dcar_posC_2_Err="<< dcar_posC_2_Err;           
+            
+      
+     (*pcstream)<<"tpcQA"<<      
+      "dcar_negA_0="<< dcar_negA_0<<
+      "dcar_negA_1="<< dcar_negA_1<<
+      "dcar_negA_2="<< dcar_negA_2<<
+      "dcar_negA_chi2="<< dcar_negA_chi2<<
+      "dcar_negA_0_Err="<< dcar_negA_0_Err<<
+      "dcar_negA_1_Err="<< dcar_negA_1_Err<<
+      "dcar_negA_2_Err="<< dcar_negA_2_Err;    
+      
+      (*pcstream)<<"tpcQA"<<            
+      "dcaz_negA_0="<< dcaz_negA_0<<
+      "dcaz_negA_1="<< dcaz_negA_1<<
+      "dcaz_negA_2="<< dcaz_negA_2<<
+      "dcaz_negA_chi2="<< dcaz_negA_chi2<<
+      "dcaz_negA_0_Err="<< dcaz_negA_0_Err<<
+      "dcaz_negA_1_Err="<< dcaz_negA_1_Err<<
+      "dcaz_negA_2_Err="<< dcaz_negA_2_Err;          
+      
+      (*pcstream)<<"tpcQA"<<            
+      "dcaz_negC_0="<< dcaz_negC_0<<
+      "dcaz_negC_1="<< dcaz_negC_1<<
+      "dcaz_negC_2="<< dcaz_negC_2<<
+      "dcaz_negC_chi2="<< dcaz_negC_chi2<<
+      "dcaz_negC_0_Err="<< dcaz_negC_0_Err<<
+      "dcaz_negC_1_Err="<< dcaz_negC_1_Err<<
+      "dcaz_negC_2_Err="<< dcaz_negC_2_Err;           
+
+      (*pcstream)<<"tpcQA"<<            
+      "dcar_negC_0="<< dcar_negC_0<<
+      "dcar_negC_1="<< dcar_negC_1<<
+      "dcar_negC_2="<< dcar_negC_2<<
+      "dcar_negC_chi2="<< dcar_negC_chi2<<
+      "dcar_negC_0_Err="<< dcar_negC_0_Err<<
+      "dcar_negC_1_Err="<< dcar_negC_1_Err<<
+      "dcar_negC_2_Err="<< dcar_negC_2_Err;                 
+      
+      return 0;
+}
+
+//_____________________________________________________________________________                                                                                                  
+Int_t AliTPCPerformanceSummary::AnalyzeOcc(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
+{
+  //                                                                                                                                                                      
+  //function which make trending of occupany per side and IROC-OROC                                     
+  //                                                                                                                                                                            
+
+  if (!pcstream) return 16;
+  if (!pTPC) return 16;
+
+  TH3* h3D_1=0;
+  TH2* his2D=0;
+  TH1* his1D=0;
+
+  static Double_t norm=0; 
+  static Double_t mean_occ_chamber=0;                                                                                                                                         
+  static Double_t rms_mean_occ_chamber=0;   
+  static Float_t occ_chamber=0;
+  static Double_t rmsNr   = 3.0;
+  static Int_t n_chamber_lowOcc = 0;  
+  static Double_t minOcc= 0;  
+  
+  //nr of chamber within the thresholds
+  static Int_t iroc_A_side =0;
+  static Int_t oroc_A_side=0;
+  static Int_t iroc_C_side =0;
+  static Int_t oroc_C_side =0;
+  
+  //occupancy for each chamber, normalized to the total occupancy  
+  static TVectorF meanOccArray_iroc(36);
+  static TVectorF meanOccArray_oroc(36);
+
+ if (pTPC->GetHistos()->FindObject("h_tpc_clust_0_1_2")) {  
+    h3D_1 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_clust_0_1_2"));
+  }
+  
+  //////////////////////////////////////////
+  // normalization
+  h3D_1->GetZaxis()->SetRangeUser(0,0.99); //A side
+  h3D_1->GetXaxis()->SetRangeUser(0,160); //IROC + OROC
+  his2D  = dynamic_cast<TH2*>(h3D_1->Project3D("xy_A_norm"));
+  if(!his2D) return 4;
+  his1D = his2D->ProjectionX();
+  norm = his1D->Integral();
+  printf("normalization:  \t%f\n",norm);
+  if (norm < 0.001) norm=0.00001;
+  delete his2D;
+  
+  //////////////////////////////////////////
+  // A_side IROC
+  h3D_1->GetZaxis()->SetRangeUser(0,0.99); //A_side
+  h3D_1->GetXaxis()->SetRangeUser(0,63); //IROC    
+
+  his2D = dynamic_cast<TH2*>(h3D_1->Project3D("xy_A_side_IROC"));
+  if(!his2D) return 4;
+
+  printf("-------------- A_IROC occupancy \t\n");
+
+  for(Int_t i = 0; i < 18; i++) { //fill IROC A_side         
+    Float_t phiLow = i*(20./360.)*(2*TMath::Pi());
+    Float_t phiUp  = (i+1)*(20./360.)*(2*TMath::Pi());
+    his2D->GetXaxis()->SetRangeUser(phiLow,phiUp); 
+    his1D = his2D->ProjectionX();
+    occ_chamber = (his1D->Integral()) / norm;    
+    printf("%d occ_chamber \t%f \t phiLow phiUp  \t%f  %f \n",i, occ_chamber, phiLow, phiUp);
+    meanOccArray_iroc[i]= occ_chamber;//fill array with occupancy for each chamber
+    mean_occ_chamber += occ_chamber;//compute the average occupancy        
+    rms_mean_occ_chamber  += occ_chamber*occ_chamber;
+    delete his1D;
+  }
+  delete his2D;
+
+  mean_occ_chamber /= 18; //nr of sectors                                                                                                                              
+  rms_mean_occ_chamber  /= 18; //nr of sectors                                            
+  
+  rms_mean_occ_chamber   =  TMath::Sqrt( TMath::Abs(rms_mean_occ_chamber - (mean_occ_chamber*mean_occ_chamber)) );                                         
+  minOcc    = mean_occ_chamber - rmsNr*rms_mean_occ_chamber;  
+
+  printf("mean_occ_chamber +- rms_mean_occ_chamber \t%f\t%f \n", mean_occ_chamber, rms_mean_occ_chamber);
+  printf("min Occ allowed (threshold) \t%f \n", minOcc);
+
+  for (Int_t i = 0; i<18; i++) {
+    if (meanOccArray_iroc[i] < minOcc) {n_chamber_lowOcc++;}
+  }
+  iroc_A_side = (18 - n_chamber_lowOcc); //nr of iroc above the thr
+  printf("Nr of iroc_A_side \t%i \n \n ",iroc_A_side);
+
+  mean_occ_chamber=0;
+  rms_mean_occ_chamber=0;
+  occ_chamber=0.;
+  n_chamber_lowOcc=0;
+  minOcc=0.;
+  ////////////////////////////////////////////
+  // A_side OROC
+  h3D_1->GetZaxis()->SetRangeUser(0,0.99); //A_side
+  h3D_1->GetXaxis()->SetRangeUser(64,160); //OROC    
+
+  his2D = dynamic_cast<TH2*>(h3D_1->Project3D("xy_A_side_OROC"));
+  if(!his2D) return 4;
+
+  printf("-------------- A_OROC occupancy \t\n");
+
+  for(Int_t i = 0; i < 18; i++) {          
+    Float_t phiLow = i*(20./360.)*(2*TMath::Pi());
+    Float_t phiUp  = (i+1)*(20./360.)*(2*TMath::Pi());
+    his2D->GetXaxis()->SetRangeUser(phiLow,phiUp); 
+    his1D = his2D->ProjectionX();
+    occ_chamber = (his1D->Integral()) / norm;    
+    printf("%d occ_chamber \t%f \t phiLow phiUp  \t%f  %f \n",i, occ_chamber, phiLow, phiUp);
+    meanOccArray_oroc[i]= occ_chamber;//fill array with occupancy for each chamber
+    mean_occ_chamber += occ_chamber;//compute the average occupancy        
+    rms_mean_occ_chamber  += occ_chamber*occ_chamber;
+    delete his1D;
+  }
+  delete his2D;
+
+  mean_occ_chamber /= 18; //nr of sectors                                                                                                                              
+  rms_mean_occ_chamber  /= 18; //nr of sectors                                            
+  
+  rms_mean_occ_chamber   =  TMath::Sqrt( TMath::Abs(rms_mean_occ_chamber - (mean_occ_chamber*mean_occ_chamber)) );                                         
+  minOcc    = mean_occ_chamber - rmsNr*rms_mean_occ_chamber;  
+
+  printf("mean_occ_chamber +- rms_mean_occ_chamber \t%f\t%f \n", mean_occ_chamber, rms_mean_occ_chamber);
+  printf("min Occ allowed (threshold) \t%f \n", minOcc);
+
+  for (Int_t i = 0; i<18; i++) {
+    if (meanOccArray_oroc[i] < minOcc) {n_chamber_lowOcc++;}
+  }
+  oroc_A_side = (18 - n_chamber_lowOcc); //variable stored in the trending
+  printf("Nr of oroc_A_side \t%i \n \n ",oroc_A_side);
+
+  mean_occ_chamber=0;
+  rms_mean_occ_chamber=0;
+  occ_chamber=0.;
+  n_chamber_lowOcc=0;
+  minOcc=0.;
+
+  ////////////////////////////////////////////////////////////////////////////////
+  // C side
+  //////////////////////////////////////////
+  
+  // normalization
+  h3D_1->GetZaxis()->SetRangeUser(-1,-0.001); //C side
+  h3D_1->GetXaxis()->SetRangeUser(0,160); //IROC + OROC
+  his2D  = dynamic_cast<TH2*>(h3D_1->Project3D("xy_C_norm"));
+  if(!his2D) return 4;
+  his1D = his2D->ProjectionX();
+  norm = his1D->Integral();
+  printf("normalization:  \t%f\n",norm);
+  if (norm < 0.001) norm=0.00001;
+  delete his2D;
+  
+  //////////////////////////////////////////
+  // C_side IROC
+  h3D_1->GetZaxis()->SetRangeUser(-1,-0.001); //C_side
+  h3D_1->GetXaxis()->SetRangeUser(0,63); //IROC    
+
+  his2D = dynamic_cast<TH2*>(h3D_1->Project3D("xy_C_side_IROC"));
+  if(!his2D) return 4;
+
+  printf("-------------- C_IROC occupancy \t\n");
+
+  for(Int_t i = 0; i < 18; i++) {          
+    Float_t phiLow = i*(20./360.)*(2*TMath::Pi());
+    Float_t phiUp  = (i+1)*(20./360.)*(2*TMath::Pi());
+    his2D->GetXaxis()->SetRangeUser(phiLow,phiUp); 
+    his1D = his2D->ProjectionX();
+    occ_chamber = (his1D->Integral()) / norm;    
+    printf("%d occ_chamber \t%f \t phiLow phiUp  \t%f  %f \n",i, occ_chamber, phiLow, phiUp);
+    meanOccArray_iroc[18+i]= occ_chamber;//fill array with occupancy for each chamber, C side, therefore index 18+i
+    mean_occ_chamber += occ_chamber;//compute the average occupancy        
+    rms_mean_occ_chamber  += occ_chamber*occ_chamber;
+    delete his1D;
+  }
+  delete his2D;
+
+  mean_occ_chamber /= 18; //nr of sectors                                                                                                                              
+  rms_mean_occ_chamber  /= 18; //nr of sectors                                            
+  
+  rms_mean_occ_chamber   =  TMath::Sqrt( TMath::Abs(rms_mean_occ_chamber - (mean_occ_chamber*mean_occ_chamber)) );                                         
+  minOcc    = mean_occ_chamber - rmsNr*rms_mean_occ_chamber;  
+
+  printf("mean_occ_chamber +- rms_mean_occ_chamber \t%f\t%f \n", mean_occ_chamber, rms_mean_occ_chamber);
+  printf("min Occ allowed (threshold) \t%f \n", minOcc);
+
+  for (Int_t i = 18; i<36; i++) {
+    if (meanOccArray_iroc[i] < minOcc) {n_chamber_lowOcc++;}
+  }
+  iroc_C_side = (18 - n_chamber_lowOcc); //variable stored in the trending
+  printf("Nr of iroc_C_side \t%i \n \n ",iroc_C_side);
+
+  mean_occ_chamber=0;
+  rms_mean_occ_chamber=0;
+  occ_chamber=0.;
+  n_chamber_lowOcc=0;
+  minOcc=0.;
+
+  ////////////////////////////////////////////
+  // C_side OROC
+  h3D_1->GetZaxis()->SetRangeUser(-1,-0.001); //C_side
+  h3D_1->GetXaxis()->SetRangeUser(64,160); //OROC    
+
+  his2D = dynamic_cast<TH2*>(h3D_1->Project3D("xy_C_side_OROC"));
+  if(!his2D) return 4;
+
+  printf("-------------- C_OROC occupancy \t\n");
+
+  for(Int_t i = 0; i < 18; i++) {          
+    Float_t phiLow = i*(20./360.)*(2*TMath::Pi());
+    Float_t phiUp  = (i+1)*(20./360.)*(2*TMath::Pi());
+    his2D->GetXaxis()->SetRangeUser(phiLow,phiUp); 
+    his1D = his2D->ProjectionX();
+    occ_chamber = (his1D->Integral()) / norm;    
+    printf("%d occ_chamber \t%f \t phiLow phiUp  \t%f  %f \n",i, occ_chamber, phiLow, phiUp);
+    meanOccArray_oroc[18+i]= occ_chamber;//fill array with occupancy for each chamber
+    mean_occ_chamber += occ_chamber;//compute the average occupancy        
+    rms_mean_occ_chamber  += occ_chamber*occ_chamber;
+    delete his1D;
+  }
+  delete his2D;
+
+  mean_occ_chamber /= 18; //nr of sectors                                                                                                                              
+  rms_mean_occ_chamber  /= 18; //nr of sectors                                            
+  
+  rms_mean_occ_chamber   =  TMath::Sqrt( TMath::Abs(rms_mean_occ_chamber - (mean_occ_chamber*mean_occ_chamber)) );                                         
+  minOcc    = mean_occ_chamber - rmsNr*rms_mean_occ_chamber;  
+
+  printf("mean_occ_chamber +- rms_mean_occ_chamber \t%f\t%f \n", mean_occ_chamber, rms_mean_occ_chamber);
+  printf("min Occ allowed (threshold) \t%f \n", minOcc);
+
+  for (Int_t i = 18; i<36; i++) {
+    if (meanOccArray_oroc[i] < minOcc) {n_chamber_lowOcc++;}
+  }
+  oroc_C_side = (18 - n_chamber_lowOcc); //variable stored in the trending
+  printf("Nr of oroc_C_side \t%i \n \n ",oroc_C_side);
+
+  mean_occ_chamber=0;
+  rms_mean_occ_chamber=0;
+  occ_chamber=0.;
+  n_chamber_lowOcc=0;
+  minOcc=0.;
+
+  (*pcstream)<<"tpcQA"<<      
+   "iroc_A_side="<< iroc_A_side<<
+   "oroc_A_side="<< oroc_A_side<<
+   "iroc_C_side="<< iroc_C_side<<
+   "oroc_C_side="<< oroc_C_side<<
+   //A/C side IROC 
+   "TPC_Occ_IROC.="<< &meanOccArray_iroc<< 
+   //A/C side OROC
+   "TPC_Occ_OROC.="<< &meanOccArray_oroc;   
+
+ return 0;
+  }
+