Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:03

0001 #include "TFile.h"
0002 #include "TTree.h"
0003 #include "TText.h"
0004 
0005 void SCEnergyPlots (TString inputfile = "SuperClusters.root" )
0006 {
0007   gROOT->Reset();
0008   char* rfilename = inputfile;
0009 
0010   TFile *rfile = new TFile(rfilename);
0011   rfile->ls();
0012   TTree * mytree = (TTree*)rfile->Get("energyScale");
0013 
0014   cout << "Validation plots for SC Energy Corrections; " << endl;
0015 
0016   int nBins = 200;
0017   float xMin = 0;
0018   float xMax = 1.2;
0019 
0020   TCut hybSC = "em_scType==1";
0021   TCut dynSC = "em_scType==2";
0022   TCut fmSC  = "em_scType==3";
0023   
0024   TCut barrel = "fabs(em_eta)<1.479";
0025   TCut endcap = "fabs(em_eta)>1.55&&fabs(em_eta)<2.5";
0026   
0027   //========== For my ROOT, need to be REMOVED before commiting
0028   //  TCut barrel = "abs(em_eta)<1.479";
0029   //  TCut endcap = "abs(em_eta)>1.55&&abs(em_eta)<2.5";
0030 
0031   TString plotEnergy = "emCorr_e/mc_e";
0032   TString plotEt     = "emCorr_et/mc_et";
0033 
0034   
0035   //Barrel SuperClusters
0036   cout << endl;
0037   cout << "Hybrid Super Clusters in Barrel." << endl;
0038   
0039   TCanvas *Hybrid = new TCanvas("Hybrid", "Hybrid", 800, 800);
0040   Hybrid->Divide(1,2);
0041 
0042   TH1F *h1 = new TH1F("h1","hybridSCEnergy", nBins, xMin, xMax);
0043   TH1F *h2 = new TH1F("h2","hybridSCEt", nBins, xMin, xMax);
0044 
0045   Hybrid->cd(1);
0046   mytree->Draw( plotEnergy+">>h1",hybSC&&barrel);
0047   Hybrid->cd(2);
0048   mytree->Draw( plotEt+">>h2",hybSC&&barrel);
0049   Hybrid->Print("Hybrid.eps");
0050   delete h1; 
0051   delete h2;
0052   delete Hybrid;
0053 
0054   //---------------------------
0055   cout << endl;
0056   cout << "Dynamic Hybrid Super Clusters in Barrel. " << endl;
0057   TCanvas *Dynamic = new TCanvas("Dynamic","Dynamic",800,800);
0058   Dynamic->Divide(1,2);
0059   
0060   TH1F *h1 = new TH1F("h1","dynamicHybridSCEnergy",nBins, xMin, xMax);
0061   TH1F *h2 = new TH1F("h2","dynamicHybridSCEt",nBins, xMin, xMax);
0062   Dynamic->cd(1);
0063   mytree->Draw( plotEnergy+">>h1",dynSC&&barrel);
0064   Dynamic->cd(2);
0065   mytree->Draw( plotEt+">>h2",dynSC&&barrel);
0066   Dynamic->Print("Dynamic.eps");
0067   delete h1;
0068   delete h2;
0069   delete Dynamic;
0070   //-----------------------------
0071   cout << endl;
0072   cout << "Fixed Matrix Super Clusters in Endcap. " << endl;
0073   
0074   TCanvas *FixedMatrix = new TCanvas("FixedMatrix","FixedMatrix",800,800);
0075   FixedMatrix->Divide(1,2);
0076   
0077   TH1F *h1 = new TH1F("h1","fixedMatrixSCEnergy",nBins, xMin, xMax);
0078   TH1F *h2 = new TH1F("h2","fixedMatrixSCEt",nBins, xMin, xMax);
0079   FixedMatrix->cd(1);
0080   mytree->Draw( plotEnergy+">>h1",fmSC&&endcap);
0081   FixedMatrix->cd(2);
0082   mytree->Draw( plotEt+">>h2",fmSC&&endcap);
0083   FixedMatrix->Print("FixedMatrix.eps");
0084   delete h1;
0085   delete h2;
0086   delete FixedMatrix;
0087   
0088   gROOT->ProcessLine(".q");
0089 }