Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:48

0001 
0002 #include "L1Trigger/CSCTrackFinder/test/src/TrackHistogramList.h"
0003 #include "L1Trigger/CSCTrackFinder/test/src/EffHistogramList.h"
0004 #include "L1Trigger/CSCTrackFinder/test/src/ResolutionHistogramList.h"
0005 
0006 namespace csctf_analysis
0007 {
0008   ResolutionHistogramList::ResolutionHistogramList(const std::string dirname, const edm::ParameterSet* parameters)
0009   {
0010 
0011     TFileDirectory dir = fs->mkdir(dirname);
0012     
0013     double maxpt=parameters->getUntrackedParameter<double>("MaxPtHist");
0014     double minpt=parameters->getUntrackedParameter<double>("MinPtHist");
0015     int ptbins=parameters->getUntrackedParameter<double>("BinsPtHist");
0016 
0017     
0018     PtQ1Res = dir.make<TH1F>("PtQ1Res","Pt Q>=1 Resolution",300,-1.5,1.5);
0019     PtQ2Res = dir.make<TH1F>("PtQ2Res","Pt Q>=2 Resolution",300,-1.5,1.5);
0020     PtQ3Res = dir.make<TH1F>("PtQ3Res","Pt Q>=3 Resolution",300,-1.5,1.5);
0021     EtaQ1Res = dir.make<TH1F>("EtaQ1Res","Eta Q>=1 Resolution",1000,-1, 1);
0022     EtaQ2Res = dir.make<TH1F>("EtaQ2Res","Eta Q>=2 Resolution",1000,-1, 1);
0023     EtaQ3Res = dir.make<TH1F>("EtaQ3Res","Eta Q>=3 Resolution",1000,-1, 1);
0024     PhiQ1Res = dir.make<TH1F>("PhiQ1Res","Phi Q>=1 Resolution",1000,-1, 1);
0025     PhiQ2Res = dir.make<TH1F>("PhiQ2Res","Phi Q>=2 Resolution",1000,-1, 1);
0026     PhiQ3Res = dir.make<TH1F>("PhiQ3Res","Phi Q>=3 Resolution",1000,-1, 1);
0027 
0028     PtQ2ResGolden = dir.make<TH1F>("PtQ2ResGolden","Pt Q>=2 Resolution; 1.2 <= eta <= 2.1",300,-1.5,1.5);
0029     PhiQ2ResGolden = dir.make<TH1F>("PhiQ2ResGolden","Phi Q>=2 Resolution; 1.2 <= eta <= 2.1",1000,-1, 1);
0030     PtQ2ResHighEta = dir.make<TH1F>("PtQ2ResHighEta","Pt Q>=2 Resolution; eta >= 2.1",300,-1.5,1.5);
0031     PhiQ2ResHighEta = dir.make<TH1F>("PhiQ2ResHighEta","Phi Q>=2 Resolution; eta >= 2.1",1000,-1, 1);
0032     PtQ2ResOverlap = dir.make<TH1F>("PtQ2ResOverlap","Pt Q>=2 Resolution; eta <= 1.2",300,-1.5,1.5);
0033     PhiQ2ResOverlap = dir.make<TH1F>("PhiQ2ResOverlap","Phi Q>=2 Resolution; eta <= 1.2",1000,-1, 1);
0034 
0035   PtQ2Res->GetXaxis()->SetTitle("Pt_{Sim}/Pt_{TF}-1");
0036   PtQ2Res->GetYaxis()->SetTitle("Counts");
0037   PhiQ2Res->GetXaxis()->SetTitle("#phi_{Sim}-#phi_{TF}");
0038   PhiQ2Res->GetYaxis()->SetTitle("Counts");
0039   EtaQ2Res->GetXaxis()->SetTitle("#eta_{Sim}-#eta_{TF}");
0040   EtaQ2Res->GetYaxis()->SetTitle("Counts");
0041 
0042   PtQ2ResGolden->GetXaxis()->SetTitle("Pt_{Sim}/Pt_{TF}-1");
0043   PtQ2ResGolden->GetYaxis()->SetTitle("Counts");
0044   PhiQ2ResGolden->GetXaxis()->SetTitle("#phi_{Sim}-#phi_{TF}");
0045   PhiQ2ResGolden->GetYaxis()->SetTitle("Counts");
0046   PtQ2ResHighEta->GetXaxis()->SetTitle("Pt_{Sim}/Pt_{TF}-1");
0047   PtQ2ResHighEta->GetYaxis()->SetTitle("Counts");
0048   PhiQ2ResHighEta->GetXaxis()->SetTitle("#phi_{Sim}-#phi_{TF}");
0049   PhiQ2ResHighEta->GetYaxis()->SetTitle("Counts");
0050   PtQ2ResOverlap->GetXaxis()->SetTitle("Pt_{Sim}/Pt_{TF}-1");
0051   PtQ2ResOverlap->GetYaxis()->SetTitle("Counts");
0052   PhiQ2ResOverlap->GetXaxis()->SetTitle("#phi_{Sim}-#phi_{TF}");
0053   PhiQ2ResOverlap->GetYaxis()->SetTitle("Counts");
0054   }
0055 
0056 
0057   void ResolutionHistogramList::FillResolutionHist( RefTrack refTrk, TFTrack tfTrk )
0058   {
0059     double ptResd = (refTrk.getPt() / tfTrk.getPt()) - 1;
0060     double EtaResd = (refTrk.getEta() - tfTrk.getEta() );
0061     double PhiResd = (refTrk.getPhi() - tfTrk.getPhi() );
0062 
0063     
0064     if ( refTrk.getQuality() >= 1 )
0065       {
0066     PhiQ1Res->Fill( PhiResd ); 
0067     EtaQ1Res->Fill( EtaResd );
0068     PtQ1Res->Fill( ptResd );
0069       }
0070     if ( refTrk.getQuality() >= 2 )
0071       {
0072     PhiQ2Res->Fill( PhiResd ); 
0073     EtaQ2Res->Fill( EtaResd );
0074     PtQ2Res->Fill( ptResd );
0075 
0076     double eta = refTrk.getEta();
0077     //Golden
0078     if(eta <= 2.1 && eta >= 1.2)
0079     {
0080         PhiQ2ResGolden->Fill( PhiResd ); 
0081         PtQ2ResGolden->Fill( ptResd );
0082     }
0083 
0084     //High Eta
0085     if(eta >= 2.1)
0086     {
0087         PhiQ2ResHighEta->Fill( PhiResd ); 
0088         PtQ2ResHighEta->Fill( ptResd );
0089     }
0090 
0091     //Overlap
0092     if(eta <= 1.2)
0093     {
0094         PhiQ2ResOverlap->Fill( PhiResd ); 
0095         PtQ2ResOverlap->Fill( ptResd );
0096     }
0097 
0098 
0099       }    
0100     if ( refTrk.getQuality() >= 3 )
0101       {
0102     PhiQ3Res->Fill( PhiResd ); 
0103     EtaQ3Res->Fill( EtaResd );
0104     PtQ3Res->Fill( ptResd );
0105       }
0106     
0107     
0108 
0109     
0110 
0111 
0112   }
0113 
0114   void ResolutionHistogramList::Print()
0115   {
0116   TCanvas* PtRes = new TCanvas("PtRes");
0117   PtQ2Res->Draw();
0118   PtRes->Print("ResPt.png","png");
0119 
0120   TCanvas* PhiRes = new TCanvas("PhiRes");
0121   PhiQ2Res->Draw();
0122   PhiRes->Print("ResPhi.png","png");
0123 
0124   TCanvas* EtaRes = new TCanvas("EtaRes");
0125   EtaQ2Res->Draw();
0126   EtaRes->Print("ResEta.png","png");
0127   }
0128 }
0129