Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include <L1Trigger/CSCTrackFinder/test/src/RHistogram.h>
0002 #include <iostream>
0003 
0004 namespace csctf_analysis
0005 {
0006 
0007   RHistogram::RHistogram(std::string dirName)
0008   {
0009     TFileDirectory dir = m_fs->mkdir(dirName);
0010     m_histR = dir.make<TH1F>("histR","R",26,0,6.5);
0011     m_histRvEtaHigh = dir.make<TH2F>("histRvEtaHigh","R v. #eta",32,0.9,2.5,26,0,6.5);
0012     m_histRvEtaLow = dir.make<TH2F>("histRvEtaLow","R v. #eta",32,0.9,2.5,26,0,6.5);
0013     m_histRvPhiHigh = dir.make<TH2F>("histRvPhiHigh","R v. #phi",65,0,6.5,26,0,6.5);
0014     m_histRvPhiLow = dir.make<TH2F>("histRvPhiLow","R v. #phi",65,0,6.5,26,0,6.5);
0015     m_histRvPtHigh = dir.make<TH2F>("histRvPtHigh","R v. Pt",20,0,100,26,0,6.5);
0016     m_histRvPtLow = dir.make<TH2F>("histRvPtLow","R v. Pt",20,0,100,26,0,6.5);
0017 
0018     m_histR->GetXaxis()->SetTitle("R");
0019     m_histR->GetYaxis()->SetTitle("Counts");
0020 
0021     m_histRvEtaHigh->GetXaxis()->SetTitle("#eta of Higher #eta Track");
0022     m_histRvEtaHigh->GetYaxis()->SetTitle("R");
0023     m_histRvEtaLow->GetXaxis()->SetTitle("#eta of Lower #eta Track");
0024     m_histRvEtaLow->GetYaxis()->SetTitle("R");
0025 
0026     m_histRvPhiHigh->GetXaxis()->SetTitle("#phi of Higher #phi Track");
0027     m_histRvPhiHigh->GetYaxis()->SetTitle("R");
0028     m_histRvPhiLow->GetXaxis()->SetTitle("#phi of Lower #phi Track");
0029     m_histRvPhiLow->GetYaxis()->SetTitle("R");
0030 
0031     m_histRvPtHigh->GetXaxis()->SetTitle("Pt of Higher Pt Track");
0032     m_histRvPtHigh->GetYaxis()->SetTitle("R");
0033     m_histRvPtLow->GetXaxis()->SetTitle("Pt of Lower Pt Track");
0034     m_histRvPtLow->GetYaxis()->SetTitle("R");
0035   }
0036 
0037   void RHistogram::fillR(TFTrack track1, TFTrack track2)
0038   {
0039     double eta1 = track1.getEta();
0040     double eta2 = track2.getEta();
0041     
0042     double phi1 = track1.getPhi();
0043     double phi2 = track2.getPhi();
0044 
0045     double pt1 = track1.getPt();
0046     double pt2 = track2.getPt();
0047 
0048     double R = sqrt((eta1-eta2)*(eta1-eta2) + 
0049         (phi1-phi2)*(phi1-phi2));
0050 
0051     m_histR->Fill(R);
0052 
0053     if(eta1>=eta2)
0054     {
0055       m_histRvEtaHigh->Fill(eta1,R);
0056       m_histRvEtaLow->Fill(eta2,R);
0057     }
0058     else
0059     {
0060       m_histRvEtaHigh->Fill(eta2,R);
0061       m_histRvEtaLow->Fill(eta1,R);
0062 
0063     }
0064 
0065     if(phi1>=phi2)
0066     {
0067       m_histRvPhiHigh->Fill(phi1,R);
0068       m_histRvPhiLow->Fill(phi2,R);
0069     }
0070     else
0071     {
0072       m_histRvPhiHigh->Fill(phi2,R);
0073       m_histRvPhiLow->Fill(phi1,R);
0074     }
0075 
0076     if(pt1>=pt2)
0077     {
0078       m_histRvPtHigh->Fill(pt1,R);
0079       m_histRvPtLow->Fill(pt2,R);
0080     }
0081     else
0082     {
0083       m_histRvPtHigh->Fill(pt2,R);
0084       m_histRvPtLow->Fill(pt1,R);
0085     }
0086 
0087     /*
0088     if(R < 0.25)
0089     {
0090         std::cout << "Debug R" << std::endl;
0091         std::cout << "eta1: " << eta1 << std::endl;
0092         std::cout << "eta2: " << eta2 << std::endl;
0093     
0094         std::cout << "phi1: " << phi1 << std::endl;
0095         std::cout << "phi2: " << phi2 << std::endl;
0096     
0097         std::cout << "pt1: " << pt1 << std::endl;
0098         std::cout << "pt2: " << pt2 << std::endl;
0099     }
0100     */
0101   }
0102 
0103 }