Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:38

0001 #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h"
0002 
0003 using namespace reco;
0004 
0005 IsolatedPixelTrackCandidate::IsolatedPixelTrackCandidate(const IsolatedPixelTrackCandidate& right)
0006     : RecoCandidate(right), track_(right.track_), l1tauJet_(right.l1tauJet_) {
0007   maxPtPxl_ = right.maxPtPxl_;
0008   sumPtPxl_ = right.sumPtPxl_;
0009   enIn_ = right.enIn_;
0010   enOut_ = right.enOut_;
0011   nhitIn_ = right.nhitIn_;
0012   nhitOut_ = right.nhitOut_;
0013   etaPhiEcal_ = right.etaPhiEcal_;
0014   etaEcal_ = right.etaEcal_;
0015   phiEcal_ = right.phiEcal_;
0016 }
0017 
0018 IsolatedPixelTrackCandidate::~IsolatedPixelTrackCandidate() {}
0019 
0020 IsolatedPixelTrackCandidate* IsolatedPixelTrackCandidate::clone() const {
0021   return new IsolatedPixelTrackCandidate(*this);
0022 }
0023 
0024 TrackRef IsolatedPixelTrackCandidate::track() const { return track_; }
0025 
0026 l1extra::L1JetParticleRef IsolatedPixelTrackCandidate::l1tau() const { return l1tauJet_; }
0027 
0028 l1t::TauRef IsolatedPixelTrackCandidate::l1ttau() const { return l1ttauJet_; }
0029 
0030 bool IsolatedPixelTrackCandidate::overlap(const Candidate& c) const {
0031   const RecoCandidate* o = dynamic_cast<const RecoCandidate*>(&c);
0032   return (o != nullptr && checkOverlap(track(), o->track()));
0033 }
0034 
0035 std::pair<int, int> IsolatedPixelTrackCandidate::towerIndex() const {
0036   int ieta(0), iphi(0), nphi(72), kphi(1);
0037   double etas[24] = {0.000, 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609, 0.696, 0.783, 0.870, 0.957,
0038                      1.044, 1.131, 1.218, 1.305, 1.392, 1.479, 1.566, 1.653, 1.740, 1.830, 1.930, 2.043};
0039   for (int i = 1; i < 24; i++) {
0040     if (fabs(track_->eta()) <= etas[i]) {
0041       ieta = (track_->eta() > 0) ? i : -i;
0042       if (i > 20) {
0043         kphi = 2;
0044         nphi = 36;
0045       }
0046       break;
0047     }
0048   }
0049 
0050   const double dphi = M_PI / 36.;  //0.087266462;
0051   double phi = track_->phi();
0052   if (phi < 0)
0053     phi += (2 * M_PI);
0054   double delta = phi + (kphi * dphi);
0055   for (int i = 0; i < nphi; i++) {
0056     if (delta <= (kphi * (i + 1) * dphi)) {
0057       iphi = kphi * i + 1;
0058       break;
0059     }
0060   }
0061 
0062   return std::pair<int, int>(ieta, iphi);
0063 }