Esempio n. 1
0
/*!
 * ### Example usage:
\code
    .L $AliRoot_SRC/STAT/Macros/aliExternalInfo.C+
    drawLogbook("LHC15o","pass1","QA.TPC.meanTPCncl>0","runDuration:totalEventsPhysics:totalNumberOfFilesMigrated:MonALISA.RCT.tpc_value");
    drawLogbook("LHC10h","pass2","totalEventsPhysics>1000&&totalNumberOfFilesMigrated>20","runDuration:totalEventsPhysics:totalNumberOfFilesMigrated:MonALISA.RCT.tpc_value");
    drawLogbook("LHC11h","pass2","totalEventsPhysics>1000&&totalNumberOfFilesMigrated>20","runDuration:totalEventsPhysics:totalNumberOfFilesMigrated:MonALISA.RCT.tpc_value");
\endcode
*/
void drawLogbook(TString period, TString pass,TString runSelection="", TString varSelection="runDuration:totalEventsPhysics:totalNumberOfFilesMigrated"){
  TTree * treeLogbook = info.GetTree("Logbook",period,pass,"QA.TPC;QA.TRD;QA.ITS;MonALISA.RCT");
  TObjArray *varList=0;
  if (varSelection[0]=='['){ //variable list using class selection
    // Use class selection to select variables
    varList=AliTreePlayer::selectMetadata(treeLogbook,varSelection,0);
    Int_t nvars=varList->GetEntries();
    for (Int_t i=0; i<nvars;i++){
      TString vname=varList->At(i)->GetName();
      vname.ReplaceAll(".class","");
    }
    // varList=AliTreePlayer::selectMetadata(treeLogbook, "[class==\"Logbook&&Time\"]",0);
  }else{
    varList=varSelection.Tokenize(":");
  }
  Int_t nvars=varList->GetEntries();
  TCanvas * canvas = new TCanvas("drawLogbook","drawLogbook",1200,1000);
  canvas->Divide(1,nvars);
  for (Int_t i=0; i<nvars; i++){
    canvas->cd(i+1);
    TString var=TString::Format("%s:run",varList->At(i)->GetName());
    TStatToolkit::MakeGraphSparse(treeLogbook,var,runSelection,25,1,1)->Draw("ap");
    Double_t mean = TMath::Mean(treeLogbook->GetSelectedRows(),treeLogbook->GetV1());
    Double_t sum  = treeLogbook->GetSelectedRows()*mean;
    latex.DrawLatexNDC(0.15,0.8,TString::Format("Mean=%0.0f",mean));
    latex.DrawLatexNDC(0.15,0.7,TString::Format("Sum=%0.0f",sum));
  }
  canvas->SaveAs(TString::Format("%s_%s.png",pass.Data(),period.Data()).Data());
}
Esempio n. 2
0
void treegraph(TString filename) {
   gROOT->SetStyle("Plain");
   gStyle->SetOptDate();


   Double_t x, y;
   Int_t nlines = 0;
   TFile *f = new TFile("graph.root","RECREATE");

   TCanvas *canvas_graph = new TCanvas("canvas_graph", "y vs x",467,89,400,700);

   TTree t;
   t.ReadFile(filename,"x:y");
   t.Draw("x:y","","goff");

   TGraph *g = new TGraph(t.GetSelectedRows(),t.GetV1(),t.GetV2());
   g->SetTitle(filename+": Y vs X");
   g->GetXaxis()->SetTitle("x[a.u.]");
   g->GetYaxis()->SetTitle("y[a.u.]");

   g->SetMarkerStyle(21);
   g->Draw("AP");

   f->Write();
}
Esempio n. 3
0
void fillGraphFromTreeVar(std::string& treedrawspec,int index,wGraph_t *&pwg)
{
  // Sample treedrawspec:
  // mytree:"TDCwinstart[%d]:runnum","evtnum==1","P"
  //
  vector<string> v_tokens;
  string tid;
  TString drawspec;
  Tokenize(treedrawspec,v_tokens,":",true);
  if( (v_tokens.size() < 2) ||
      (!v_tokens[0].size())  ||
      (!v_tokens[2].size())    ) {
    cerr << "malformed root tree draw spec treeid:\"varexp\",\"selection\",option: " << treedrawspec << endl;
    return;
  }

  tid = v_tokens[0];
  for (size_t i=2; i<v_tokens.size(); i++) {
    drawspec += v_tokens[i];
  }
  int fmtcnt = drawspec.CountChar('%');

  if (fmtcnt) { // use index for tree array var
    switch(fmtcnt) {
    case 1: drawspec = Form(drawspec,index); break;
    case 2: drawspec = Form(drawspec,index,index); break;
    case 3: drawspec = Form(drawspec,index,index,index); break;
    case 4: drawspec = Form(drawspec,index,index,index,index); break;
    case 5: drawspec = Form(drawspec,index,index,index,index,index); break;
    case 6: drawspec = Form(drawspec,index,index,index,index,index,index); break;
    default:
      cerr << "More than six fmt specifiers in drawspec found, fix me! " << drawspec <<endl;
      exit(-1);
    }
  }
  if( gl_verbose)
    cout<<"drawspec="<<drawspec<<endl;

  TTree *tree = findTree(tid);
  assert (tree);

  // can't use comma as delimiter since histo with binning spec may be supplied
  TObjArray *tokens = drawspec.Tokenize("\"");
  TString hname;

  TString varexp = ((TObjString *)(*tokens)[0])->GetString();

  if( gl_verbose)
    cout<<"varexp="<<varexp<<endl;
  switch(tokens->GetEntriesFast()) {
  case 1:
    tree->Draw(varexp,"","goff");
    break;
  case 3:
    {
      TString cut = ((TObjString *)(*tokens)[2])->GetString();
      tree->Draw(varexp,cut,"goff"); 
    }
    break;
  case 4: // assume the cut string is blank
    {
      TString gopt = ((TObjString *)(*tokens)[3])->GetString();
      gopt = gopt + " goff";
      tree->Draw(varexp,"",gopt);
    }
    break;
  case 5:
    {
      TString cut  = ((TObjString *)(*tokens)[2])->GetString();
      TString gopt = ((TObjString *)(*tokens)[4])->GetString();
      gopt = gopt + " goff";
      tree->Draw(varexp,cut,gopt);
    }
    break;
  default:
    cerr << "malformed root tree draw spec treeid:varexp,selection,option";
    for (int i=0; i<tokens->GetEntriesFast(); i++)
      cerr << i<<": "<< ((TObjString *)(*tokens)[i])->GetString() << " ";
    cerr << endl;
    break;
  }

  assert(tree->GetSelectedRows());

  if (!pwg)
    pwg = new wGraph_t();

  assert(pwg);
  pwg->gr = new TGraph(tree->GetSelectedRows(),
		       tree->GetV2(), tree->GetV1());

}                                                // fillGraphFromTreeVar
Esempio n. 4
0
void
CalcLimit(bool useCLs=true, string inName="nEvents.txt", string outName="nLimit.txt"){
  gErrorIgnoreLevel = kWarning;
  gSystem->SetIncludePath( "-I$ROOFITSYS/include" );
  gSystem->Load("libRooFit");
//  gSystem->SetIncludePath( "-I/afs/hep.wisc.edu/cern/.root/root_v5.30.00.Linux-slc5_amd64-gcc4.3/include/RooStats" );
  gROOT->ProcessLine(".L ../../../StatisticalTools/RooStatsRoutines/root/roostats_cl95.C+");
  
  string outfile(outName.c_str());
  ofstream out(outfile.c_str());
  if(!out) { 
    cout << "Cannot open file " << outfile << endl; 
    abort();
  } 
  
  out  << setiosflags(ios::fixed) << setprecision(4) << setiosflags(ios::left);
    
  out<<"SignalCode/F:"
     <<"Mass/F:"
     <<"Lumi/F:"
     <<"sLumi/F:"
     <<"Eff/F:"
     <<"sEff/F:"
     <<"DataEvts/F:"
     <<"BkgEvts/F:"
     <<"sBkgEvts/F:"
     <<"ObsLimit/F:"
     <<"ExpLimit/F:"
     <<"ExpLimitP1/F:"
     <<"ExpLimitM1/F:"
     <<"ExpLimitP2/F:"
     <<"ExpLimitM2/F"
     <<endl;

  TTree* tree = new TTree("tree", "Number of Events");
  tree->ReadFile(inName.c_str());
  tree->Draw("SignalCode:Mass:Lumi:DataEvts:BkgEvts:sBkgEvts:Eff:sEff", 
             "", "para goff");
  float n = tree->GetSelectedRows(); 
  for(int isample=0; isample<n; ++isample){
    const Double_t SignalCode = tree->GetVal(0)[isample];
    const Double_t  mass = tree->GetVal(1)[isample];
    const Double_t  lumi = tree->GetVal(2)[isample];
    const Double_t  DataEvts = tree->GetVal(3)[isample];
    const Double_t    BkgEvts = tree->GetVal(4)[isample];
    const Double_t   sBkgEvts = tree->GetVal(5)[isample];
    const Double_t       Eff = tree->GetVal(6)[isample];
    const Double_t      sEff = tree->GetVal(7)[isample];
    
    cout<<"Calculating limit for mass: "<<mass<<" and lumi: "<<lumi<<endl;
        
    float sLumi = sLumiFrac*lumi;
    
    Double_t obs_limit, exp_limit;
    Double_t exp_up, exp_down, exp_2up, exp_2down;
    
    if(useCLs){////CLs Limits
      //Does not work for bayesian, only works with cls    
      LimitResult limit = roostats_limit(lumi, sLumi, Eff, sEff, BkgEvts, sBkgEvts, DataEvts, false, 0, "cls", "", 12345);
      cout<<"\nCompleted Limit Calc\n";
      obs_limit = limit.GetObservedLimit();
      exp_limit = limit.GetExpectedLimit();
      exp_up    = limit.GetOneSigmaHighRange();
      exp_down  = limit.GetOneSigmaLowRange();
      exp_2up   = limit.GetTwoSigmaHighRange();
      exp_2down = limit.GetTwoSigmaLowRange();        
    }else{
      ////Bayesian Limits
      LimitResult limit  = roostats_clm (lumi, sLumi, Eff, sEff, BkgEvts, sBkgEvts);
      //obs_limit = limit.GetObservedLimit();
      obs_limit = roostats_cl95(lumi, sLumi, Eff, sEff, BkgEvts, sBkgEvts, DataEvts, false, 0, "bayesian", "");
      
      exp_limit = limit.GetExpectedLimit();
      exp_up    = limit.GetOneSigmaHighRange();
      exp_down  = limit.GetOneSigmaLowRange();
      exp_2up   = limit.GetTwoSigmaHighRange();
      exp_2down = limit.GetTwoSigmaLowRange();        
    }
  
    out<<setprecision(1)
       <<SignalCode<<"\t"
       <<setprecision(0)
       <<mass<<"\t"
       <<lumi<<"\t"
       <<sLumi<<"\t"
       <<setprecision(4)
       <<Eff<<"\t"
       <<sEff<<"\t"
       <<setprecision(0)
       <<DataEvts<<"\t"
       <<setprecision(4)
       <<BkgEvts<<"\t"
       <<sBkgEvts<<"\t";
//    out<<Value(obs_limit,-4)<<"\t"
//       <<Value(exp_limit,-4)<<"\t"
//       <<Value(exp_up,-4)<<"\t"
//       <<Value(exp_down,-4)<<"\t"
//       <<Value(exp_2up,-4)<<"\t"
//       <<Value(exp_2down,-4)
//       <<endl;
    out<<setprecision(8)
       <<obs_limit<<"\t"
       <<exp_limit<<"\t"
       <<exp_up<<"\t"
       <<exp_down<<"\t"
       <<exp_2up<<"\t"
       <<exp_2down
       <<endl;
  }
  
  out.close(); 
  cout<<"Done\n";
  return;
}
Esempio n. 5
0
void EffVsMass(string inName, int applyAnalysisCuts){

  gErrorIgnoreLevel = kWarning;
  CMSstyle();
  gStyle->SetOptStat(0);

  TFile *fin = TFile::Open(inName.c_str(), "read"); assert(fin);
  TGraphAsymmErrors* g[4];
  for(int ch=0; ch<4; ++ch){
    g[ch] = new TGraphAsymmErrors();
  }

  int ipoint = 0;
  for(int mass=200; mass <= 2000; mass += 100){
    string name = Form("WprimeToWZTo3LNu_M-%i",mass);
    
    float sample_tot(0), sample_pass(0);
    
    TH1F* hInfo = (TH1F*) fin->Get(Form("%s/hFileInfo", name.c_str()));
    if(!hInfo) continue;  
    float sample_weight = GetSampleInfo(hInfo, "Sample Weight");
    sample_tot = GetSampleInfo(hInfo, "Number of Events Produced");
    sample_tot *= (4./9.); //remove tau contribution from denom
    
    //get tree from file
    TTree* t = getTree(fin, name, "tEvts_MET"); assert(t);
    string analysisCuts = applyAnalysisCuts ? (applyAnalysisCuts == 1 ? Form("Lt > %.0f", LtCut(mass)) : AnalysisCuts(mass)) : "1";

    for(int ch=0; ch<4; ++ch){
      float tot = sample_tot / 4;
      float pass = 0;

      float pass_alt = t->Draw("WZMass", Form("weight*(EvtType == %i)*(%s)",ch, analysisCuts.c_str()), "goff");
      int n = t->GetSelectedRows();
      for(int ientry=0; ientry<n; ++ientry){
        float weight = t->GetW()[ientry];
        pass += weight;
      }
      pass /= sample_weight;
      sample_pass += pass;
      
      float mean    = tot>0 ? pass / tot : 0.;
      float errUp   = TEfficiency::ClopperPearson(tot, pass, 0.68, true) - mean;
      float errDown = mean - TEfficiency::ClopperPearson(tot, pass, 0.68, false);
      
      errDown = std::max(errDown, (float) 0.);
      float err = (errUp + errDown)/2;
      printf(" %s %ie%i\\mu &  %4.2f & %4.2f or %4.2f & %.2f \\pm %.2f\\%% \\\\\n", name.c_str(), 3-ch, ch, tot, pass, pass_alt, mean*100, err*100);

      g[ch]->SetPoint(ipoint, mass, mean);
      g[ch]->SetPointError(ipoint, 0., 0., errDown, errUp);
    }
    ipoint++;
  }

  TCanvas* c1 = new TCanvas();
  TMultiGraph* mg = new TMultiGraph("mg", ";M_{W'} (GeV); #varepsilon");
  TLegend *legend = new TLegend(0.4,0.2,0.51,0.4,"");
  prepLegend(legend);
  for(int ch=0; ch<4; ++ch){
    g[ch]->SetMarkerColor(ch+2);
    g[ch]->SetLineColor(ch+2);
    legend->AddEntry(g[ch], Form("%ie%i#mu", 3-ch, ch), "PE");
    mg->Add(g[ch]);
  }
  mg->SetMaximum(1.1);
  mg->SetMinimum(0. );
  mg->Draw("AP");
  legend->Draw();

  TLatex latexLabel;
  latexLabel.SetNDC();
  latexLabel.SetTextSize(0.05);
  latexLabel.SetTextFont(42);
  latexLabel.DrawLatex(0.33, 0.96, "CMS Simulation 2012");
  latexLabel.DrawLatex(0.21, 0.85, "#sqrt{s} = 8 TeV");

  string outName = applyAnalysisCuts ? (applyAnalysisCuts==1 ? "EffVsMass_LtCut.png" : "EffVsMass_AnalysisCuts.png") : "EffVsMass.png";
  c1->SaveAs(outName.c_str());
}
Esempio n. 6
0
void
ModXSec(string inFile, string outFile, bool removeTaus=true, bool applyKFactors=true){
  bool doTC = inFile.find("TC") != string::npos;
  cout<<"doTC is "<<doTC<<endl;

  TTree* tLimit = new TTree("tLimit", "Limits");
  tLimit->ReadFile(inFile.c_str());

  ofstream out(outFile.c_str());

  if(doTC)  out<<"Rho/F:";
  else      out<<"Mass/F:";
  if(doTC){
    out<<"Pi/F:";
    out<<"SinX/F:";
  }
  out<<"Xsec/F:"
     <<"percentError/F"
     <<endl;

  //kfactors
  TGraph* gK = new TGraph(20);
  gK->SetPoint( 0, 200,1.347);
  gK->SetPoint( 1, 300,1.347);
  gK->SetPoint( 2, 500,1.363);
  gK->SetPoint( 3, 700,1.351);
  gK->SetPoint( 4, 900,1.347);
  gK->SetPoint( 5,1100,1.331);
  gK->SetPoint( 6,1300,1.317);
  gK->SetPoint( 7,1500,1.293);
  gK->SetPoint( 8,1700,1.257);
  gK->SetPoint( 9,1900,1.230);
  gK->SetPoint( 10,2000,1.214);

  //Signal pdf uncertainties
  TGraph* gPerErr = new TGraph(20);
  gPerErr->SetPoint(  0, 200,2.192);
  gPerErr->SetPoint(  1, 300,2.192);
  gPerErr->SetPoint(  2, 500,2.632);
  gPerErr->SetPoint(  3, 700,3.070);
  gPerErr->SetPoint(  4, 900,3.448);
  gPerErr->SetPoint(  5,1100,3.771);
  gPerErr->SetPoint(  6,1300,4.101);
  gPerErr->SetPoint(  7,1500,4.339);
  gPerErr->SetPoint(  8,1700,4.581);
  gPerErr->SetPoint(  9,1900,4.846);
  gPerErr->SetPoint( 10,2000,4.981);
  
  if(doTC) tLimit->Draw("Rho:Xsec:Pi:SinX", "SinX > 0.32 && SinX<0.34", "para goff");
  //if(doTC) tLimit->Draw("Rho:Xsec:Pi:SinX", "(280<=Rho && Rho<=300) && (150<=Pi && Pi<=160)", "para goff");
  else     tLimit->Draw("Mass:Xsec",        "", "para goff");
  float n = tLimit->GetSelectedRows(); 
  for(int isample=0; isample<n; ++isample){
    int idx=0;
    Double_t mass = tLimit->GetVal(idx++)[isample];
    Double_t xsec  = tLimit->GetVal(idx++)[isample];

    Double_t pi(-1), sinx(-1);
    if(doTC){
      pi   = tLimit->GetVal(idx++)[isample];
      sinx = tLimit->GetVal(idx++)[isample];
    }

    //cout<<"For rho: "<<rho<<" the kfactor is "<<gK->Eval(rho)<<endl; 
    
    //xsec *= 1e9; //convert from mb to pb
    if(removeTaus) xsec *= 4./9.; //convert from emt to em
    if(applyKFactors) xsec *= gK->Eval(mass);//apply k factor

    Double_t perErr  = gPerErr->Eval(mass);

    out.precision(0) ;
    out.setf ( ios::fixed, ios::floatfield);
    out  <<mass<<"\t";

    if(doTC){
      out.precision(0) ;
      out.setf ( ios::fixed, ios::floatfield);
      out  <<pi<<"\t";

      out.precision(4) ;
      out.setf ( ios::fixed, ios::floatfield);
      out  <<sinx<<"\t";
    }

    out.precision(4) ;
    out.setf ( ios::scientific, ios::floatfield);
    out  <<xsec<<"\t";
    
    out.precision(3);
    out.setf ( ios::fixed, ios::floatfield);
    out<<perErr<<"\t";
    out<<endl;

  }

}
Esempio n. 7
0
void PlotMacro(char *inputFile, char *outputFile){
  TFile *out = new TFile(outputFile,"recreate"); 
  TFile *f = new TFile(inputFile); 
  TObjArray DetList(0);
  TTree *t = (TTree*) f->Get("DataTree");

  Double_t errx[t->GetSelectedRows()];
  for(int i=0;i<t->GetSelectedRows();i++){
    errx[i]=0;
  }

  //=== S/N Corr MPV 
  TCanvas *C1=new TCanvas("SN_MPV","SN_MPV",10,10,600,400); 
  DetList.Add(C1);
  C1->cd();
  TLegend *legend1 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(1,t,errx,"Run.number:TOB.StoNCorr.On.FitPar.mp:TOB.StoNCorr.On.FitPar.emp","",2,22,"MPV S/N Corrected for the track angle","Run Number","MPV",legend1,"TOB",5,35);
  DrawSame(1,t,errx,"Run.number:TIB.StoNCorr.On.FitPar.mp:TIB.StoNCorr.On.FitPar.emp","",3,23,legend1,"TIB");
  DrawSame(1,t,errx,"Run.number:TID.StoNCorr.On.FitPar.mp:TID.StoNCorr.On.FitPar.emp","",4,24,legend1,"TID");

  //=== Charge off Track mean
  TCanvas *C2=new TCanvas("chOffmean","chOffmean",10,10,600,400); 
  DetList.Add(C2);
  C2->cd();
  TLegend *legend2 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(0,t,errx,"Run.number:TOB.Charge.Off.HistoPar.mean","",2,22,"Charge of the clusters off track - Mean","Run Number","Mean Charge [ADC]",legend2,"TOB",50,250);
  DrawSame(0,t,errx,"Run.number:TIB.Charge.Off.HistoPar.mean","",3,23,legend2,"TIB");
  DrawSame(0,t,errx,"Run.number:TID.Charge.Off.HistoPar.mean","",4,24,legend2,"TID");

  //=== Charge off Track RMS
  TCanvas *C3=new TCanvas("chOffRms","chOffRms",10,10,600,400); 
  DetList.Add(C3);
  C3->cd();
  TLegend *legend3 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(0,t,errx,"Run.number:TOB.Charge.Off.HistoPar.rms","",2,22,"Charge of the clusters off track - RMS","Run Number","RMS [ADC]",legend3,"TOB",50,110);
  DrawSame(0,t,errx,"Run.number:TIB.Charge.Off.HistoPar.rms","",3,23,legend3,"TIB");
  DrawSame(0,t,errx,"Run.number:TID.Charge.Off.HistoPar.rms","",4,24,legend3,"TID");

  //=== Noise on Track Gauss Fit
  TCanvas *C4=new TCanvas("NoiseOn","NoiseOn",10,10,600,400); 
  DetList.Add(C4);
  C4->cd();
  TLegend *legend4 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(1,t,errx,"Run.number:TOB.Noise.On.FitNoisePar.fitmean:TOB.Noise.On.FitNoisePar.efitmean","",2,22,"Mean Noise of the clusters on track","Run Number","Mean Noise [ADC]",legend4,"TOB",2,6);
  DrawSame(1,t,errx,"Run.number:TIB.Noise.On.FitNoisePar.fitmean:TIB.Noise.On.FitNoisePar.efitmean","",3,23,legend4,"TIB");
  DrawSame(1,t,errx,"Run.number:TID.Noise.On.FitNoisePar.fitmean:TID.Noise.On.FitNoisePar.efitmean","",4,24,legend4,"TID");

  //=== Noise off Track mean
  TCanvas *C5=new TCanvas("NoiseOff","NoiseOff",10,10,600,400); 
  DetList.Add(C5);
  C5->cd();
  TLegend *legend5 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(0,t,errx,"Run.number:TOB.Noise.Off.HistoPar.mean","",2,22,"Mean noise of the clusters off track","Run Number","Mean noise [ADC]",legend5,"TOB",1,6);
  DrawSame(0,t,errx,"Run.number:TIB.Noise.Off.HistoPar.mean","",3,23,legend5,"TIB");
  DrawSame(0,t,errx,"Run.number:TID.Noise.Off.HistoPar.mean","",4,24,legend5,"TID");

  //=== Width on Track mean
  TCanvas *C6=new TCanvas("WidthOn","WidthOn",10,10,600,400); 
  DetList.Add(C6);
  C6->cd();
  TLegend *legend6 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(0,t,errx,"Run.number:TOB.Width.On.HistoPar.mean","",2,22,"Mean width of the clusters on track","Run Number","Mean width [#strips]",legend6,"TOB",0,7);
  DrawSame(0,t,errx,"Run.number:TIB.Width.On.HistoPar.mean","",3,23,legend6,"TIB");
  DrawSame(0,t,errx,"Run.number:TID.Width.On.HistoPar.mean","",4,24,legend6,"TID");

  //=== Width off Track mean
  TCanvas *C7=new TCanvas("WidthOff","WidthOff",10,10,600,400); 
  DetList.Add(C7);
  C7->cd();
  TLegend *legend7 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(0,t,errx,"Run.number:TOB.Width.Off.HistoPar.mean","",2,22,"Mean width of the clusters off track","Run Number","Mean width [#strips]",legend7,"TOB",0,7);
  DrawSame(0,t,errx,"Run.number:TIB.Width.Off.HistoPar.mean","",3,23,legend7,"TIB");
  DrawSame(0,t,errx,"Run.number:TID.Width.Off.HistoPar.mean","",4,24,legend7,"TID");

  //=== Number of Events 
  TCanvas *C8= new TCanvas("nEvents","nEvents",10,10,600,400);
  DetList.Add(C8);
  C8->cd();
  TLegend *legend8 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(0,t,errx,"Run.number:TrAndClus.nTracks.entries","",1,22,"Number of processed Events","Run Number", "# Events",legend8,"",40000,1000000);

  //=== Number of Events with at least one track
  TCanvas *C9= new TCanvas("nTracks","nTracks",10,10,600,400);
  DetList.Add(C9);
  C9->cd();
  TLegend *legend9 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(0,t,errx,"Run.number:(TrAndClus.nTracks.nonzero/TrAndClus.nTracks.entries)","",1,22,"Fraction of Events with at least one track","Run Number", "# Events",legend9,"",0,1);

  //=== Number of clusters on track
  TCanvas *C10= new TCanvas("nClusOn","nClusOn",10,10,600,400);
  DetList.Add(C10);
  C10->cd();
  TLegend *legend10 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(0,t,errx,"Run.number:(TIB.nClusters.On.HistoPar.nonzero/TrAndClus.nTracks.nonzero)","",2,22,"Fraction of clusters associated to a track","Run Number", "Fraction of Cluster On Track",legend10,"TIB",0,1);
  DrawSame(0,t,errx,"Run.number:(TOB.nClusters.On.HistoPar.nonzero/TrAndClus.nTracks.nonzero)","",3,23,legend10,"TOB");
  DrawSame(0,t,errx,"Run.number:(TID.nClusters.On.HistoPar.nonzero/TrAndClus.nTracks.nonzero)","",4,24,legend10,"TID");

  //=== Mean number of clusters off track
  TCanvas *C12= new TCanvas("nClusOff","nClusOff",10,10,600,400);
  DetList.Add(C12);
  C12->cd();
  TLegend *legend12 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(0,t,errx,"Run.number:TrAndClus.OffClus.mean","",1,21,"Mean number of clusters off track","Run Number", "# Cluster Off Track",legend12,"TOT",0,25);
  DrawSame(0,t,errx,"Run.number:TIB.nClusters.Off.HistoPar.mean","",2,22,legend12,"TIB");
  DrawSame(0,t,errx,"Run.number:TOB.nClusters.Off.HistoPar.mean","",3,23,legend12,"TOB");
  DrawSame(0,t,errx,"Run.number:TID.nClusters.Off.HistoPar.mean","",4,24,legend12,"TID");

  //=== Mean Number of Tracks
  TCanvas *C11= new TCanvas("MeanTracks","MeanTracks",10,10,600,400);
  DetList.Add(C11);
  C11->cd();
  TLegend *legend11 = new TLegend(0.851008,0.437882,0.995954,1.00035); 
  DrawClus(0,t,errx,"Run.number:TrAndClus.nTracks.mean","",1,22,"Mean number of tracks per event","Run Number", "# Tracks",legend11,"",0.4,0.7);

  out->cd();
  DetList.Write();
  f->cd();
   

}