ROOT logo
/*
 author: Ionut-Cristian Arsene
 email: i.c.arsene@cern.ch
 
 Macro to plot trends from an input root file containing a tree.
 Usage:
 DrawTrendingTRDQA("trendingFile.root")
 
 How to add a new trending plot:
 1. If a new trending variables needs to be added, its name must be added
    in the gTrendNames array and also a corresponding entry in the Trends enumeration.
    The name must match the name of its corresponding branch in the trending tree.
    If no new trending variable is added, proceed to step 2
 2. Define the needed histogram in DefineHistograms()
   2.1 If just a plot of the trending variable as a function of run number is needed, then
       a) define the histogram, 
       b) set the uniqueID for the TH1D (with the corresponding Trends index needed to be filled) 
       c) set the uniqueID for the y axis which will represent the variable used as error bar (optional)
       d) add it to the output list
       The histogram will then be filled and drawn automatically.
   2.2 If the plot is more complicated then defined at 2.1 (e.g. use quantities derived from the existing trends, 
                                                           correlations between various trends, etc.):
       a) define the histogram
       b) add it to the output list
       c) fill the histogram in the FillHistograms() function in the section for exceptions.
       d) drawing will be done automatically
 */


// Trending variable indices
enum Trends {
  kTPCTRDmatchEffPosAll=0, kTPCTRDmatchEffPosAllErr,
  kTPCTRDmatchEffNegAll, kTPCTRDmatchEffNegAllErr,
  kTRDTOFmatchEffPosAll, kTRDTOFmatchEffPosAllErr,
  kTRDTOFmatchEffNegAll, kTRDTOFmatchEffNegAllErr,
  kAvTRDtrkltsPerTrackAll, kAvTRDtrkltsPerTrackAllErr,
  kAvNclsPerTrackAll, kAvNclsPerTrackAllErr,
  kPHplateauHeight, kPHplateauHeightErr,
  kPHplateauSlope, kPHplateauSlopeErr,
  kQtotLandauMPV1GeVAll, kQtotLandauWidth1GeVAll,
  kPHplateauHeightAbsolute, kPHplateauHeightErrAbsolute,
  kPHplateauSlopeAbsolute, kPHplateauSlopeErrAbsolute,
  kQtotLandauMPV1GeVAllAbsolute, kQtotLandauWidth1GeVAllAbsolute,
  kTRDcheckDET_NTracksEvent, kTRDcheckDET_NTracksEventRMS,
  kTRDcheckDET_NTracksSector, 
  kTRDcheckDET_NClustersTrack, kTRDcheckDET_NClustersTrackRMS, 
  kTRDcheckDET_NClustersTracklet, kTRDcheckDET_NClustersTrackletRMS, 
  kTRDcheckDET_NTrackletsTrack, kTRDcheckDET_NTrackletsTrackRMS, 
  kTRDcheckDET_ChargeCluster, kTRDcheckDET_ChargeClusterRMS, 
  kTRDcheckDET_ChargeTracklet, kTRDcheckDET_ChargeTrackletRMS, 
  kTRDcheckDET_PHplateau, kTRDcheckDET_PHslope, kTRDcheckDET_PHamplificationPeak,
  kMeanExB, kRmsExB,
  kMeanGainFactor, kRmsGainFactor,
  kMeanT0, kRmsT0,
  kMeanVdrift, kRmsVdrift,
  kBeamIntensityA, kBeamIntensityC,
  kNtrends,
  kRun
};

// Trending variable names
// These names must match the names of the branches in the trending tree
// since branches are detected automatically based on the strings in this array
TString gTrendNames[kNtrends] = {
  "TPCTRDmatchEffPosAll", "TPCTRDmatchEffPosAllErr",
  "TPCTRDmatchEffNegAll", "TPCTRDmatchEffNegAllErr",
  "TRDTOFmatchEffPosAll", "TRDTOFmatchEffPosAllErr",
  "TRDTOFmatchEffNegAll", "TRDTOFmatchEffNegAllErr",
  "AvTRDtrkltsPerTrackAll", "AvTRDtrkltsPerTrackAllErr",
  "AvNclsPerTrackAll", "AvNclsPerTrackAllErr",
  "PHplateauHeight", "PHplateauHeightErr",
  "PHplateauSlope", "PHplateauSlopeErr",
  "QtotLandauMPV1GeVAll", "QtotLandauWidth1GeVAll",
  "PHplateauHeightAbsolute", "PHplateauHeightErrAbsolute",
  "PHplateauSlopeAbsolute", "PHplateauSlopeErrAbsolute",
  "QtotLandauMPV1GeVAllAbsolute", "QtotLandauWidth1GeVAllAbsolute",
  "TRDcheckDET_NTracksEvent", "TRDcheckDET_NTracksEventRMS",
  "TRDcheckDET_NTracksSector", 
  "TRDcheckDET_NClustersTrack", "TRDcheckDET_NClustersTrackRMS", 
  "TRDcheckDET_NClustersTracklet", "TRDcheckDET_NClustersTrackletRMS", 
  "TRDcheckDET_NTrackletsTrack", "TRDcheckDET_NTrackletsTrackRMS", 
  "TRDcheckDET_ChargeCluster", "TRDcheckDET_ChargeClusterRMS", 
  "TRDcheckDET_ChargeTracklet", "TRDcheckDET_ChargeTrackletRMS", 
  "TRDcheckDET_PHplateau", "TRDcheckDET_PHslope", "TRDcheckDET_PHamplificationPeak",
  "meanExB", "rmsExB",
  "meanGainFactor", "rmsGainFactor",
  "meanT0", "rmsT0",
  "meanVdrift", "rmsVdrift",
  "beamIntensityA", "beamIntensityC"
};


// prototypes
void DefineHistograms(TList* outList, Int_t nRuns);
void FillHistograms(Int_t irun, TList* hList, Double_t* values, Bool_t* branchFound);
void DrawAllHistograms(TList* hList);
void SetDrawStyle(TObject* obj, TString drawOption="E1",
	          Int_t markerStyle=24, Int_t markerColor=4, Double_t markerSize=2.0,
	          Int_t lineStyle=1, Int_t lineColor=4, Double_t lineWidth=2.0);

//________________________________________________________________________
void DrawTrendingTRDQA(TString trendingFilename="trending.root") {
  //
  // Draw the TRD QA trending
  //
  TFile* trendingFile = TFile::Open(trendingFilename.Data(), "READ");
  TTree* tree = (TTree*)trendingFile->Get("trending");
  if(!tree){
    cout << "E-DrawTrendingTRDQA.C: Cannot get the trending tree!" << endl;
    return;
  }
    
  Int_t run=0;
  tree->SetBranchAddress("run",&run);
  
  // Array which will hold the information from the tree
  // Note that its size is kNtrends+1. The extra element is reserved for the run number and 
  // is always located at the back of the array (element at index kNtrends)
  Double_t trends[kNtrends+1]={0.0};
  
  // Detect branches in the tree and assign an address
  Bool_t branchFound[kNtrends]; for(Int_t i=0;i<kNtrends;++i) branchFound[i]=kFALSE;
  for(Int_t i=0;i<kNtrends;++i) {
    TBranch* branch = tree->FindBranch(gTrendNames[i].Data());
    if(!branch) continue;
    branch->SetAddress(&trends[i]);
    branchFound[i]=kTRUE;
  }
  
  // Define histograms and add them to a list
  Int_t nRuns = tree->GetEntries();
  TList histList;
  histList.SetOwner(kTRUE);
  DefineHistograms(&histList, nRuns);
  
  // loop over all entries in the tree (one entry per run)
  for(Int_t i=0; i<nRuns; ++i) {
    tree->GetEntry(i);
    trends[kNtrends] = run;
    FillHistograms(i, &histList, trends, branchFound);
  }  // end loop over runs
  
  // Draw trending histograms
  // Here the canvases with one drawn histogram each are saved as PNG files.
  // The names of the PNG files use the name of the histogram
  DrawAllHistograms(&histList);
  
  // save histograms into a root file
  TFile* save=new TFile("PeriodTRDQAtrends.hist.root", "RECREATE");
  histList.Write();
  save->Close();
}


//________________________________________________________________________
void DrawAllHistograms(TList* l) {
  //
  // Draw all histograms in the list
  //
  if(!l) return;
  TCanvas* c=0x0;
  for(Int_t i=0; i<l->GetEntries(); ++i) {
    TObject* o=l->At(i);
    c=new TCanvas(Form("canvas_%s",o->GetName()), Form("%s", o->GetName()), 800.,600.);
    c->SetLeftMargin(0.15); c->SetBottomMargin(0.15); c->SetTopMargin(0.08); c->SetRightMargin(0.03);
    ((TH1*)o)->SetStats(kFALSE);
    
    // some exceptions
    if(TString(o->GetName()).Contains("BeamIntensity")) c->SetLogy();
    
    o->Draw();
    c->Print(Form("%s.png", TString(o->GetName()).Remove(0,1).Data()));
    delete c;
  }
}


//________________________________________________________________________
void FillHistograms(Int_t irun, TList* l, Double_t* v, Bool_t* branchFound) {
  //
  // Fill all histograms in the list
  //
  if(!l) return;
  for(Int_t i=0; i<l->GetEntries(); ++i) {
    TObject* o=l->At(i);
    if(TString(o->IsA()->GetName()).Contains("TH1D")) {
      TH1D* h1=(TH1D*)o;
      h1->GetXaxis()->SetBinLabel(irun+1, Form("%.0f", v[kNtrends]));
      
      // Deal with the exceptions (no assigned space in the Trends enum)
      if(TString(h1->GetName()).Contains("hTPCTRDmatchChargeAsymm")) {
	if(branchFound[kTPCTRDmatchEffPosAll] && branchFound[kTPCTRDmatchEffNegAll]) {
	  Double_t p=v[kTPCTRDmatchEffPosAll], m=v[kTPCTRDmatchEffNegAll], 
	       dp=v[kTPCTRDmatchEffPosAllErr], dm=v[kTPCTRDmatchEffNegAllErr];
	  if(TMath::Abs(p+m)>1.0e-6) {
	    h1->SetBinContent(irun+1, 100.0*2.0*(p-m)/(p+m));
	    h1->SetBinError(irun+1, 100.0*4.0*TMath::Sqrt(m*m*dp*dp+p*p*dm*dm)/(p+m)/(p+m));
	  }
	}
	continue;
      }
      if(TString(h1->GetName()).Contains("hTRDTOFmatchChargeAsymm")) {
	if(branchFound[kTRDTOFmatchEffPosAll] && branchFound[kTRDTOFmatchEffNegAll]) {
	  Double_t p=v[kTRDTOFmatchEffPosAll], m=v[kTRDTOFmatchEffNegAll], 
	       dp=v[kTRDTOFmatchEffPosAllErr], dm=v[kTRDTOFmatchEffNegAllErr];
	  if(TMath::Abs(p+m)>1.0e-6) {
	    h1->SetBinContent(irun+1, 100.0*2.0*(p-m)/(p+m));
	    h1->SetBinError(irun+1, 100.0*4.0*TMath::Sqrt(m*m*dp*dp+p*p*dm*dm)/(p+m)/(p+m));
	  }
	}
	continue;
      }
      
      // Fill the rest of the histograms
      Int_t var = h1->GetUniqueID()-1;
      Int_t errY = h1->GetYaxis()->GetUniqueID()-1;
      if(var>=0 && branchFound[var]) 
	h1->SetBinContent(irun+1, v[var]);
      if(errY>=0 && branchFound[errY]) h1->SetBinError(irun+1, v[errY]);
      
    }  // end if(TH1D)
  }  // end loop over histograms
}


//________________________________________________________________________
void DefineHistograms(TList* outList, Int_t nRuns) {
  //
  // Define trending histograms
  //
  TH1D* hTPCTRDmatchPos=new TH1D("hTPCTRDmatchPos","TPC-TRD matching efficiency at pt=1GeV/c, positive tracks;run;matching efficiency",
                                 nRuns, 0., nRuns);
  hTPCTRDmatchPos->SetUniqueID(kTPCTRDmatchEffPosAll+1); hTPCTRDmatchPos->GetYaxis()->SetUniqueID(kTPCTRDmatchEffPosAllErr+1);
  SetDrawStyle(hTPCTRDmatchPos); outList->Add(hTPCTRDmatchPos);
  
  TH1D* hTPCTRDmatchNeg=new TH1D("hTPCTRDmatchNeg","TPC-TRD matching efficiency at pt=1GeV/c, negative tracks;run;matching efficiency",
                                 nRuns, 0., nRuns);
  hTPCTRDmatchNeg->SetUniqueID(kTPCTRDmatchEffNegAll+1); hTPCTRDmatchNeg->GetYaxis()->SetUniqueID(kTPCTRDmatchEffNegAllErr+1);
  SetDrawStyle(hTPCTRDmatchNeg); outList->Add(hTPCTRDmatchNeg);
  
  TH1D* hTPCTRDmatchChargeAsymm=new TH1D("hTPCTRDmatchChargeAsymm","TPC-TRD matching efficiency at pt=1GeV/c, charge asymmetry;run;percents",
                                 nRuns, 0., nRuns);
  SetDrawStyle(hTPCTRDmatchChargeAsymm); outList->Add(hTPCTRDmatchChargeAsymm);
  
  TH1D* hTRDTOFmatchPos=new TH1D("hTRDTOFmatchPos","TRD-TOF matching efficiency at pt=1GeV/c, positive tracks;run;matching efficiency",
                                 nRuns, 0., nRuns);
  hTRDTOFmatchPos->SetUniqueID(kTRDTOFmatchEffPosAll+1); hTRDTOFmatchPos->GetYaxis()->SetUniqueID(kTRDTOFmatchEffPosAllErr+1);
  SetDrawStyle(hTRDTOFmatchPos); outList->Add(hTRDTOFmatchPos);
  
  TH1D* hTRDTOFmatchNeg=new TH1D("hTRDTOFmatchNeg","TRD-TOF matching efficiency at pt=1GeV/c, negative tracks;run;matching efficiency",
                                 nRuns, 0., nRuns);
  hTRDTOFmatchNeg->SetUniqueID(kTRDTOFmatchEffNegAll+1); hTRDTOFmatchNeg->GetYaxis()->SetUniqueID(kTRDTOFmatchEffNegAllErr+1);
  SetDrawStyle(hTRDTOFmatchNeg); outList->Add(hTRDTOFmatchNeg);
  
  TH1D* hTRDTOFmatchChargeAsymm=new TH1D("hTRDTOFmatchChargeAsymm","TRD-TOF matching efficiency at pt=1GeV/c, charge asymmetry;run;percents",
                                 nRuns, 0., nRuns);
  SetDrawStyle(hTRDTOFmatchChargeAsymm); outList->Add(hTRDTOFmatchChargeAsymm);

  TH1D* hTrkltsPerTrack=new TH1D("hTrkltsPerTrack","Average no. tracklets per TRD track at pt=1GeV/c;run;#tracklets",
                                 nRuns, 0., nRuns);
  hTrkltsPerTrack->SetUniqueID(kAvTRDtrkltsPerTrackAll+1); hTrkltsPerTrack->GetYaxis()->SetUniqueID(kAvTRDtrkltsPerTrackAllErr+1);
  SetDrawStyle(hTrkltsPerTrack); outList->Add(hTrkltsPerTrack);
  
  TH1D* hClsPerTrack=new TH1D("hClsPerTrack","Average no. clusters per TRD track at pt=1GeV/c;run;#tracklets",
                              nRuns, 0., nRuns);
  SetDrawStyle(hClsPerTrack); outList->Add(hClsPerTrack);
  hClsPerTrack->SetUniqueID(kAvNclsPerTrackAll+1); hClsPerTrack->GetYaxis()->SetUniqueID(kAvNclsPerTrackAllErr+1);
  
  TH1D* hPHplateauHeight=new TH1D("hPHplateauHeight","PH plateau height from slices;run;PH",
                                  nRuns, 0., nRuns);
  hPHplateauHeight->SetUniqueID(kPHplateauHeightAbsolute+1); hPHplateauHeight->GetYaxis()->SetUniqueID(kPHplateauHeightErrAbsolute+1);
  SetDrawStyle(hPHplateauHeight); outList->Add(hPHplateauHeight);
  
  TH1D* hPHplateauSlope=new TH1D("hPHplateauSlope","PH plateau slope from slices;run;slope",
                                  nRuns, 0., nRuns);
  hPHplateauSlope->SetUniqueID(kPHplateauSlopeAbsolute+1); hPHplateauSlope->GetYaxis()->SetUniqueID(kPHplateauSlopeErrAbsolute+1);
  SetDrawStyle(hPHplateauSlope); outList->Add(hPHplateauSlope);
  
  TH1D* hQtotLandauMPV=new TH1D("hQtotLandauMPV","Landau MPV for the tracklet charge distribution (Q_{tot}) ;run;Q_{tot}",
                                  nRuns, 0., nRuns);
  hQtotLandauMPV->SetUniqueID(kQtotLandauMPV1GeVAllAbsolute+1);
  SetDrawStyle(hQtotLandauMPV); outList->Add(hQtotLandauMPV);
  
  TH1D* hQtotLandauWidth=new TH1D("hQtotLandauWidth","Landau width for the tracklet charge distribution (Q_{tot});run;Q_{tot}",
                                  nRuns, 0., nRuns);
  hQtotLandauWidth->SetUniqueID(kQtotLandauWidth1GeVAllAbsolute+1);
  SetDrawStyle(hQtotLandauWidth); outList->Add(hQtotLandauWidth);
  
  TH1D* hNTracksPerEvent_DET=new TH1D("hNTracksPerEvent_DET", "Number of TRD tracks per event, (TRDcheckDET);run;#tracks",
                                  nRuns, 0., nRuns);
  hNTracksPerEvent_DET->SetUniqueID(kTRDcheckDET_NTracksEvent+1); hNTracksPerEvent_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_NTracksEventRMS+1);
  SetDrawStyle(hNTracksPerEvent_DET); outList->Add(hNTracksPerEvent_DET);
  
  TH1D* hNTracksPerSector_DET=new TH1D("hNTracksPerSector_DET", "Number of TRD tracks per sector (TRDcheckDET);run;#tracks",
                                  nRuns, 0., nRuns);
  hNTracksPerSector_DET->SetUniqueID(kTRDcheckDET_NTracksSector+1);
  SetDrawStyle(hNTracksPerSector_DET); outList->Add(hNTracksPerSector_DET);
  
  TH1D* hNClustersPerTrack_DET=new TH1D("hNClustersPerTrack_DET", "Number of clusters per track (TRDcheckDET);run;#clusters",
                                  nRuns, 0., nRuns);
  hNClustersPerTrack_DET->SetUniqueID(kTRDcheckDET_NClustersTrack+1); hNClustersPerTrack_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_NClustersTrackRMS+1);
  SetDrawStyle(hNClustersPerTrack_DET); outList->Add(hNClustersPerTrack_DET);
  
  TH1D* hNClustersPerTracklet_DET=new TH1D("hNClustersPerTracklet_DET", "Number of clusters per tracklet (TRDcheckDET);run;#clusters",
                                  nRuns, 0., nRuns);
  hNClustersPerTracklet_DET->SetUniqueID(kTRDcheckDET_NClustersTracklet+1); hNClustersPerTracklet_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_NClustersTrackletRMS+1);
  SetDrawStyle(hNClustersPerTracklet_DET); outList->Add(hNClustersPerTracklet_DET);

  TH1D* hNTrackletsPerTrack_DET=new TH1D("hNTrackletsPerTrack_DET", "Number of tracklets per track (TRDcheckDET);run;#tracklets",
                                  nRuns, 0., nRuns);
  hNTrackletsPerTrack_DET->SetUniqueID(kTRDcheckDET_NTrackletsTrack+1); hNTrackletsPerTrack_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_NTrackletsTrackRMS+1);
  SetDrawStyle(hNTrackletsPerTrack_DET); outList->Add(hNTrackletsPerTrack_DET);
  
  TH1D* hClusterCharge_DET=new TH1D("hClusterCharge_DET", "Cluster charge (TRDcheckDET);run;#charge",
                                  nRuns, 0., nRuns);
  hClusterCharge_DET->SetUniqueID(kTRDcheckDET_ChargeCluster+1); hClusterCharge_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_ChargeClusterRMS+1);
  SetDrawStyle(hClusterCharge_DET); outList->Add(hClusterCharge_DET);
  
  TH1D* hTrackletCharge_DET=new TH1D("hTrackletCharge_DET", "Tracklet charge (TRDcheckDET);run;#charge",
                                  nRuns, 0., nRuns);
  hTrackletCharge_DET->SetUniqueID(kTRDcheckDET_ChargeTracklet+1); hTrackletCharge_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_ChargeTrackletRMS+1);
  SetDrawStyle(hTrackletCharge_DET); outList->Add(hTrackletCharge_DET);
  
  TH1D* hPHplateau_DET=new TH1D("hPHplateau_DET", "PH plateau (TRDcheckDET);run;#charge",
                                  nRuns, 0., nRuns);
  hPHplateau_DET->SetUniqueID(kTRDcheckDET_PHplateau+1);
  SetDrawStyle(hPHplateau_DET); outList->Add(hPHplateau_DET);
  
  TH1D* hPHslope_DET=new TH1D("hPHslope_DET", "PH slope (TRDcheckDET);run;#charge/timebin",
                                  nRuns, 0., nRuns);
  hPHslope_DET->SetUniqueID(kTRDcheckDET_PHslope+1);
  SetDrawStyle(hPHslope_DET); outList->Add(hPHslope_DET);
  
  TH1D* hPHamplifPeak_DET=new TH1D("hPHamplifPeak_DET", "PH amplification peak position (TRDcheckDET);run;#timebin",
                                  nRuns, 0., nRuns);
  hPHamplifPeak_DET->SetUniqueID(kTRDcheckDET_PHamplificationPeak+1);
  SetDrawStyle(hPHamplifPeak_DET); outList->Add(hPHamplifPeak_DET);
  
  TH1D* hMeanExB=new TH1D("hMeanExB", "Mean ExB over all chambers from OCDB;run;ExB correction",
                                  nRuns, 0., nRuns);
  hMeanExB->SetUniqueID(kMeanExB+1); hMeanExB->GetYaxis()->SetUniqueID(kRmsExB+1);
  SetDrawStyle(hMeanExB); outList->Add(hMeanExB);
  
  TH1D* hMeanGainFactor=new TH1D("hMeanGainFactor", "Mean gain factor over all chambers from OCDB;run;gain factor",
                                  nRuns, 0., nRuns);
  hMeanGainFactor->SetUniqueID(kMeanGainFactor+1); hMeanGainFactor->GetYaxis()->SetUniqueID(kRmsGainFactor+1);
  SetDrawStyle(hMeanGainFactor); outList->Add(hMeanGainFactor);
  
  TH1D* hMeanT0=new TH1D("hMeanT0", "Mean T0 over all chambers from OCDB;run;T0",
                                  nRuns, 0., nRuns);
  hMeanT0->SetUniqueID(kMeanT0+1); hMeanT0->GetYaxis()->SetUniqueID(kRmsT0+1);
  SetDrawStyle(hMeanT0); outList->Add(hMeanT0);
  
  TH1D* hMeanVdrift=new TH1D("hMeanVdrift", "Mean drift velocity over all chambers from OCDB;run;drift velocity",
                                  nRuns, 0., nRuns);
  hMeanVdrift->SetUniqueID(kMeanVdrift+1); hMeanVdrift->GetYaxis()->SetUniqueID(kRmsVdrift+1);
  SetDrawStyle(hMeanVdrift); outList->Add(hMeanVdrift);
  
  TH1D* hBeamIntensityA=new TH1D("hBeamIntensityA", "Beam A intensity from OCDB;run;beam intensity",
                                  nRuns, 0., nRuns);
  hBeamIntensityA->SetUniqueID(kBeamIntensityA+1);
  SetDrawStyle(hBeamIntensityA); outList->Add(hBeamIntensityA);
  
  TH1D* hBeamIntensityC=new TH1D("hBeamIntensityC", "Beam C intensity from OCDB;run;beam intensity",
                                  nRuns, 0., nRuns);
  hBeamIntensityC->SetUniqueID(kBeamIntensityC+1);
  SetDrawStyle(hBeamIntensityC); outList->Add(hBeamIntensityC);
}


//________________________________________________________________________
void SetDrawStyle(TObject* obj, 
		  TString drawOption /*="E1"*/,
	          Int_t markerStyle /*=24*/, Int_t markerColor /*=4*/, Double_t markerSize /*=2.0*/,
	          Int_t lineStyle /*=1*/, Int_t lineColor /*=4*/, Double_t lineWidth /*=2.0*/) {
  //
  // Set draw options
  //
  if(TString(obj->IsA()->GetName()).Contains("TH1D")) {
    TH1D* o=(TH1D*)obj;
    o->SetDrawOption(drawOption.Data());
    o->SetMarkerStyle(markerStyle);
    o->SetMarkerColor(markerColor);
    o->SetMarkerSize(markerSize);
    o->SetLineStyle(lineStyle);
    o->SetLineColor(lineColor);
    o->SetLineWidth(lineWidth);
    o->GetXaxis()->SetTitleOffset(1.6);
    o->GetYaxis()->SetNdivisions(507);
    o->GetXaxis()->SetLabelFont(42);
    o->GetXaxis()->SetTitleFont(42);
    o->GetYaxis()->SetLabelFont(42);
    o->GetYaxis()->SetTitleFont(42);
    o->SetTitleFont(42);
  }
}
 DrawTrendingTRDQA.C:1
 DrawTrendingTRDQA.C:2
 DrawTrendingTRDQA.C:3
 DrawTrendingTRDQA.C:4
 DrawTrendingTRDQA.C:5
 DrawTrendingTRDQA.C:6
 DrawTrendingTRDQA.C:7
 DrawTrendingTRDQA.C:8
 DrawTrendingTRDQA.C:9
 DrawTrendingTRDQA.C:10
 DrawTrendingTRDQA.C:11
 DrawTrendingTRDQA.C:12
 DrawTrendingTRDQA.C:13
 DrawTrendingTRDQA.C:14
 DrawTrendingTRDQA.C:15
 DrawTrendingTRDQA.C:16
 DrawTrendingTRDQA.C:17
 DrawTrendingTRDQA.C:18
 DrawTrendingTRDQA.C:19
 DrawTrendingTRDQA.C:20
 DrawTrendingTRDQA.C:21
 DrawTrendingTRDQA.C:22
 DrawTrendingTRDQA.C:23
 DrawTrendingTRDQA.C:24
 DrawTrendingTRDQA.C:25
 DrawTrendingTRDQA.C:26
 DrawTrendingTRDQA.C:27
 DrawTrendingTRDQA.C:28
 DrawTrendingTRDQA.C:29
 DrawTrendingTRDQA.C:30
 DrawTrendingTRDQA.C:31
 DrawTrendingTRDQA.C:32
 DrawTrendingTRDQA.C:33
 DrawTrendingTRDQA.C:34
 DrawTrendingTRDQA.C:35
 DrawTrendingTRDQA.C:36
 DrawTrendingTRDQA.C:37
 DrawTrendingTRDQA.C:38
 DrawTrendingTRDQA.C:39
 DrawTrendingTRDQA.C:40
 DrawTrendingTRDQA.C:41
 DrawTrendingTRDQA.C:42
 DrawTrendingTRDQA.C:43
 DrawTrendingTRDQA.C:44
 DrawTrendingTRDQA.C:45
 DrawTrendingTRDQA.C:46
 DrawTrendingTRDQA.C:47
 DrawTrendingTRDQA.C:48
 DrawTrendingTRDQA.C:49
 DrawTrendingTRDQA.C:50
 DrawTrendingTRDQA.C:51
 DrawTrendingTRDQA.C:52
 DrawTrendingTRDQA.C:53
 DrawTrendingTRDQA.C:54
 DrawTrendingTRDQA.C:55
 DrawTrendingTRDQA.C:56
 DrawTrendingTRDQA.C:57
 DrawTrendingTRDQA.C:58
 DrawTrendingTRDQA.C:59
 DrawTrendingTRDQA.C:60
 DrawTrendingTRDQA.C:61
 DrawTrendingTRDQA.C:62
 DrawTrendingTRDQA.C:63
 DrawTrendingTRDQA.C:64
 DrawTrendingTRDQA.C:65
 DrawTrendingTRDQA.C:66
 DrawTrendingTRDQA.C:67
 DrawTrendingTRDQA.C:68
 DrawTrendingTRDQA.C:69
 DrawTrendingTRDQA.C:70
 DrawTrendingTRDQA.C:71
 DrawTrendingTRDQA.C:72
 DrawTrendingTRDQA.C:73
 DrawTrendingTRDQA.C:74
 DrawTrendingTRDQA.C:75
 DrawTrendingTRDQA.C:76
 DrawTrendingTRDQA.C:77
 DrawTrendingTRDQA.C:78
 DrawTrendingTRDQA.C:79
 DrawTrendingTRDQA.C:80
 DrawTrendingTRDQA.C:81
 DrawTrendingTRDQA.C:82
 DrawTrendingTRDQA.C:83
 DrawTrendingTRDQA.C:84
 DrawTrendingTRDQA.C:85
 DrawTrendingTRDQA.C:86
 DrawTrendingTRDQA.C:87
 DrawTrendingTRDQA.C:88
 DrawTrendingTRDQA.C:89
 DrawTrendingTRDQA.C:90
 DrawTrendingTRDQA.C:91
 DrawTrendingTRDQA.C:92
 DrawTrendingTRDQA.C:93
 DrawTrendingTRDQA.C:94
 DrawTrendingTRDQA.C:95
 DrawTrendingTRDQA.C:96
 DrawTrendingTRDQA.C:97
 DrawTrendingTRDQA.C:98
 DrawTrendingTRDQA.C:99
 DrawTrendingTRDQA.C:100
 DrawTrendingTRDQA.C:101
 DrawTrendingTRDQA.C:102
 DrawTrendingTRDQA.C:103
 DrawTrendingTRDQA.C:104
 DrawTrendingTRDQA.C:105
 DrawTrendingTRDQA.C:106
 DrawTrendingTRDQA.C:107
 DrawTrendingTRDQA.C:108
 DrawTrendingTRDQA.C:109
 DrawTrendingTRDQA.C:110
 DrawTrendingTRDQA.C:111
 DrawTrendingTRDQA.C:112
 DrawTrendingTRDQA.C:113
 DrawTrendingTRDQA.C:114
 DrawTrendingTRDQA.C:115
 DrawTrendingTRDQA.C:116
 DrawTrendingTRDQA.C:117
 DrawTrendingTRDQA.C:118
 DrawTrendingTRDQA.C:119
 DrawTrendingTRDQA.C:120
 DrawTrendingTRDQA.C:121
 DrawTrendingTRDQA.C:122
 DrawTrendingTRDQA.C:123
 DrawTrendingTRDQA.C:124
 DrawTrendingTRDQA.C:125
 DrawTrendingTRDQA.C:126
 DrawTrendingTRDQA.C:127
 DrawTrendingTRDQA.C:128
 DrawTrendingTRDQA.C:129
 DrawTrendingTRDQA.C:130
 DrawTrendingTRDQA.C:131
 DrawTrendingTRDQA.C:132
 DrawTrendingTRDQA.C:133
 DrawTrendingTRDQA.C:134
 DrawTrendingTRDQA.C:135
 DrawTrendingTRDQA.C:136
 DrawTrendingTRDQA.C:137
 DrawTrendingTRDQA.C:138
 DrawTrendingTRDQA.C:139
 DrawTrendingTRDQA.C:140
 DrawTrendingTRDQA.C:141
 DrawTrendingTRDQA.C:142
 DrawTrendingTRDQA.C:143
 DrawTrendingTRDQA.C:144
 DrawTrendingTRDQA.C:145
 DrawTrendingTRDQA.C:146
 DrawTrendingTRDQA.C:147
 DrawTrendingTRDQA.C:148
 DrawTrendingTRDQA.C:149
 DrawTrendingTRDQA.C:150
 DrawTrendingTRDQA.C:151
 DrawTrendingTRDQA.C:152
 DrawTrendingTRDQA.C:153
 DrawTrendingTRDQA.C:154
 DrawTrendingTRDQA.C:155
 DrawTrendingTRDQA.C:156
 DrawTrendingTRDQA.C:157
 DrawTrendingTRDQA.C:158
 DrawTrendingTRDQA.C:159
 DrawTrendingTRDQA.C:160
 DrawTrendingTRDQA.C:161
 DrawTrendingTRDQA.C:162
 DrawTrendingTRDQA.C:163
 DrawTrendingTRDQA.C:164
 DrawTrendingTRDQA.C:165
 DrawTrendingTRDQA.C:166
 DrawTrendingTRDQA.C:167
 DrawTrendingTRDQA.C:168
 DrawTrendingTRDQA.C:169
 DrawTrendingTRDQA.C:170
 DrawTrendingTRDQA.C:171
 DrawTrendingTRDQA.C:172
 DrawTrendingTRDQA.C:173
 DrawTrendingTRDQA.C:174
 DrawTrendingTRDQA.C:175
 DrawTrendingTRDQA.C:176
 DrawTrendingTRDQA.C:177
 DrawTrendingTRDQA.C:178
 DrawTrendingTRDQA.C:179
 DrawTrendingTRDQA.C:180
 DrawTrendingTRDQA.C:181
 DrawTrendingTRDQA.C:182
 DrawTrendingTRDQA.C:183
 DrawTrendingTRDQA.C:184
 DrawTrendingTRDQA.C:185
 DrawTrendingTRDQA.C:186
 DrawTrendingTRDQA.C:187
 DrawTrendingTRDQA.C:188
 DrawTrendingTRDQA.C:189
 DrawTrendingTRDQA.C:190
 DrawTrendingTRDQA.C:191
 DrawTrendingTRDQA.C:192
 DrawTrendingTRDQA.C:193
 DrawTrendingTRDQA.C:194
 DrawTrendingTRDQA.C:195
 DrawTrendingTRDQA.C:196
 DrawTrendingTRDQA.C:197
 DrawTrendingTRDQA.C:198
 DrawTrendingTRDQA.C:199
 DrawTrendingTRDQA.C:200
 DrawTrendingTRDQA.C:201
 DrawTrendingTRDQA.C:202
 DrawTrendingTRDQA.C:203
 DrawTrendingTRDQA.C:204
 DrawTrendingTRDQA.C:205
 DrawTrendingTRDQA.C:206
 DrawTrendingTRDQA.C:207
 DrawTrendingTRDQA.C:208
 DrawTrendingTRDQA.C:209
 DrawTrendingTRDQA.C:210
 DrawTrendingTRDQA.C:211
 DrawTrendingTRDQA.C:212
 DrawTrendingTRDQA.C:213
 DrawTrendingTRDQA.C:214
 DrawTrendingTRDQA.C:215
 DrawTrendingTRDQA.C:216
 DrawTrendingTRDQA.C:217
 DrawTrendingTRDQA.C:218
 DrawTrendingTRDQA.C:219
 DrawTrendingTRDQA.C:220
 DrawTrendingTRDQA.C:221
 DrawTrendingTRDQA.C:222
 DrawTrendingTRDQA.C:223
 DrawTrendingTRDQA.C:224
 DrawTrendingTRDQA.C:225
 DrawTrendingTRDQA.C:226
 DrawTrendingTRDQA.C:227
 DrawTrendingTRDQA.C:228
 DrawTrendingTRDQA.C:229
 DrawTrendingTRDQA.C:230
 DrawTrendingTRDQA.C:231
 DrawTrendingTRDQA.C:232
 DrawTrendingTRDQA.C:233
 DrawTrendingTRDQA.C:234
 DrawTrendingTRDQA.C:235
 DrawTrendingTRDQA.C:236
 DrawTrendingTRDQA.C:237
 DrawTrendingTRDQA.C:238
 DrawTrendingTRDQA.C:239
 DrawTrendingTRDQA.C:240
 DrawTrendingTRDQA.C:241
 DrawTrendingTRDQA.C:242
 DrawTrendingTRDQA.C:243
 DrawTrendingTRDQA.C:244
 DrawTrendingTRDQA.C:245
 DrawTrendingTRDQA.C:246
 DrawTrendingTRDQA.C:247
 DrawTrendingTRDQA.C:248
 DrawTrendingTRDQA.C:249
 DrawTrendingTRDQA.C:250
 DrawTrendingTRDQA.C:251
 DrawTrendingTRDQA.C:252
 DrawTrendingTRDQA.C:253
 DrawTrendingTRDQA.C:254
 DrawTrendingTRDQA.C:255
 DrawTrendingTRDQA.C:256
 DrawTrendingTRDQA.C:257
 DrawTrendingTRDQA.C:258
 DrawTrendingTRDQA.C:259
 DrawTrendingTRDQA.C:260
 DrawTrendingTRDQA.C:261
 DrawTrendingTRDQA.C:262
 DrawTrendingTRDQA.C:263
 DrawTrendingTRDQA.C:264
 DrawTrendingTRDQA.C:265
 DrawTrendingTRDQA.C:266
 DrawTrendingTRDQA.C:267
 DrawTrendingTRDQA.C:268
 DrawTrendingTRDQA.C:269
 DrawTrendingTRDQA.C:270
 DrawTrendingTRDQA.C:271
 DrawTrendingTRDQA.C:272
 DrawTrendingTRDQA.C:273
 DrawTrendingTRDQA.C:274
 DrawTrendingTRDQA.C:275
 DrawTrendingTRDQA.C:276
 DrawTrendingTRDQA.C:277
 DrawTrendingTRDQA.C:278
 DrawTrendingTRDQA.C:279
 DrawTrendingTRDQA.C:280
 DrawTrendingTRDQA.C:281
 DrawTrendingTRDQA.C:282
 DrawTrendingTRDQA.C:283
 DrawTrendingTRDQA.C:284
 DrawTrendingTRDQA.C:285
 DrawTrendingTRDQA.C:286
 DrawTrendingTRDQA.C:287
 DrawTrendingTRDQA.C:288
 DrawTrendingTRDQA.C:289
 DrawTrendingTRDQA.C:290
 DrawTrendingTRDQA.C:291
 DrawTrendingTRDQA.C:292
 DrawTrendingTRDQA.C:293
 DrawTrendingTRDQA.C:294
 DrawTrendingTRDQA.C:295
 DrawTrendingTRDQA.C:296
 DrawTrendingTRDQA.C:297
 DrawTrendingTRDQA.C:298
 DrawTrendingTRDQA.C:299
 DrawTrendingTRDQA.C:300
 DrawTrendingTRDQA.C:301
 DrawTrendingTRDQA.C:302
 DrawTrendingTRDQA.C:303
 DrawTrendingTRDQA.C:304
 DrawTrendingTRDQA.C:305
 DrawTrendingTRDQA.C:306
 DrawTrendingTRDQA.C:307
 DrawTrendingTRDQA.C:308
 DrawTrendingTRDQA.C:309
 DrawTrendingTRDQA.C:310
 DrawTrendingTRDQA.C:311
 DrawTrendingTRDQA.C:312
 DrawTrendingTRDQA.C:313
 DrawTrendingTRDQA.C:314
 DrawTrendingTRDQA.C:315
 DrawTrendingTRDQA.C:316
 DrawTrendingTRDQA.C:317
 DrawTrendingTRDQA.C:318
 DrawTrendingTRDQA.C:319
 DrawTrendingTRDQA.C:320
 DrawTrendingTRDQA.C:321
 DrawTrendingTRDQA.C:322
 DrawTrendingTRDQA.C:323
 DrawTrendingTRDQA.C:324
 DrawTrendingTRDQA.C:325
 DrawTrendingTRDQA.C:326
 DrawTrendingTRDQA.C:327
 DrawTrendingTRDQA.C:328
 DrawTrendingTRDQA.C:329
 DrawTrendingTRDQA.C:330
 DrawTrendingTRDQA.C:331
 DrawTrendingTRDQA.C:332
 DrawTrendingTRDQA.C:333
 DrawTrendingTRDQA.C:334
 DrawTrendingTRDQA.C:335
 DrawTrendingTRDQA.C:336
 DrawTrendingTRDQA.C:337
 DrawTrendingTRDQA.C:338
 DrawTrendingTRDQA.C:339
 DrawTrendingTRDQA.C:340
 DrawTrendingTRDQA.C:341
 DrawTrendingTRDQA.C:342
 DrawTrendingTRDQA.C:343
 DrawTrendingTRDQA.C:344
 DrawTrendingTRDQA.C:345
 DrawTrendingTRDQA.C:346
 DrawTrendingTRDQA.C:347
 DrawTrendingTRDQA.C:348
 DrawTrendingTRDQA.C:349
 DrawTrendingTRDQA.C:350
 DrawTrendingTRDQA.C:351
 DrawTrendingTRDQA.C:352
 DrawTrendingTRDQA.C:353
 DrawTrendingTRDQA.C:354
 DrawTrendingTRDQA.C:355
 DrawTrendingTRDQA.C:356
 DrawTrendingTRDQA.C:357
 DrawTrendingTRDQA.C:358
 DrawTrendingTRDQA.C:359
 DrawTrendingTRDQA.C:360
 DrawTrendingTRDQA.C:361
 DrawTrendingTRDQA.C:362
 DrawTrendingTRDQA.C:363
 DrawTrendingTRDQA.C:364
 DrawTrendingTRDQA.C:365
 DrawTrendingTRDQA.C:366
 DrawTrendingTRDQA.C:367
 DrawTrendingTRDQA.C:368
 DrawTrendingTRDQA.C:369
 DrawTrendingTRDQA.C:370
 DrawTrendingTRDQA.C:371
 DrawTrendingTRDQA.C:372
 DrawTrendingTRDQA.C:373
 DrawTrendingTRDQA.C:374
 DrawTrendingTRDQA.C:375
 DrawTrendingTRDQA.C:376
 DrawTrendingTRDQA.C:377
 DrawTrendingTRDQA.C:378
 DrawTrendingTRDQA.C:379
 DrawTrendingTRDQA.C:380
 DrawTrendingTRDQA.C:381
 DrawTrendingTRDQA.C:382
 DrawTrendingTRDQA.C:383
 DrawTrendingTRDQA.C:384
 DrawTrendingTRDQA.C:385
 DrawTrendingTRDQA.C:386
 DrawTrendingTRDQA.C:387
 DrawTrendingTRDQA.C:388
 DrawTrendingTRDQA.C:389
 DrawTrendingTRDQA.C:390
 DrawTrendingTRDQA.C:391
 DrawTrendingTRDQA.C:392
 DrawTrendingTRDQA.C:393
 DrawTrendingTRDQA.C:394
 DrawTrendingTRDQA.C:395
 DrawTrendingTRDQA.C:396
 DrawTrendingTRDQA.C:397