CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
AlCaIsoTracksProducer.cc File Reference
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "Calibration/HcalAlCaRecoProducers/interface/AlCaIsoTracksProducer.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
#include "DataFormats/GeometrySurface/interface/Cylinder.h"
#include "DataFormats/GeometrySurface/interface/Plane.h"
#include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
#include "MagneticField/Engine/interface/MagneticField.h"
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "Geometry/CaloTopology/interface/EcalPreshowerTopology.h"
#include "DataFormats/TrackReco/interface/TrackExtra.h"
#include "DataFormats/TrackReco/interface/TrackExtraFwd.h"
#include "RecoTracker/TrackProducer/interface/TrackProducerBase.h"
#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h"
#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "Math/GenVector/VectorUtil.h"
#include "Math/GenVector/PxPyPzE4D.h"
#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
#include "DataFormats/L1Trigger/interface/L1JetParticle.h"
#include "DataFormats/Provenance/interface/ProductID.h"
#include "Calibration/HcalAlCaRecoProducers/plugins/ConeDefinition.h"
#include <boost/regex.hpp>

Go to the source code of this file.

Functions

bool checkHLTMatch (edm::Event &iEvent, edm::EDGetTokenT< trigger::TriggerEvent > &hltToken, std::vector< std::string > hltFilterTag_, double eta, double phi, double hltMatchingCone_)
 
double getDist (double eta1, double phi1, double eta2, double phi2)
 
double getDistInCM (double eta1, double phi1, double eta2, double phi2)
 
std::pair< double, double > getL1triggerDirection (edm::Event &iEvent, edm::EDGetTokenT< trigger::TriggerEvent > &hltToken, std::string l1FilterTag_)
 

Function Documentation

bool checkHLTMatch ( edm::Event iEvent,
edm::EDGetTokenT< trigger::TriggerEvent > &  hltToken,
std::vector< std::string >  hltFilterTag_,
double  eta,
double  phi,
double  hltMatchingCone_ 
)

Definition at line 72 of file AlCaIsoTracksProducer.cc.

References trigger::TriggerObject::eta(), eta(), edm::Event::getByToken(), getDist(), prof2calltree::l, match(), phi, and trigger::TriggerObject::phi().

Referenced by AlCaIsoTracksProducer::produce().

73 {
74  bool match =false;
75  double minDDD=1000;
76 
78  iEvent.getByToken(hltToken,trEv);
79  const trigger::TriggerObjectCollection& TOCol(trEv->getObjects());
80 
81  trigger::Keys KEYS;
82  const trigger::size_type nFilt(trEv->sizeFilters());
83  for (trigger::size_type iFilt=0; iFilt!=nFilt; iFilt++)
84  {
85  for (unsigned l=0; l<hltFilterTag_.size(); l++)
86  {
87  if ((trEv->filterTag(iFilt).label()).substr(0,27)==hltFilterTag_[l])
88  {
89  KEYS=trEv->filterKeys(iFilt);
90  }
91  }
92  }
93  trigger::size_type nReg=KEYS.size();
94  for (trigger::size_type iReg=0; iReg<nReg; iReg++)
95  {
96  const trigger::TriggerObject& TObj(TOCol[KEYS[iReg]]);
97  double dHit=getDist(TObj.eta(),TObj.phi(),eta,phi);
98  if (dHit<minDDD) minDDD=dHit;
99  }
100  if (minDDD>hltMatchingCone_) match=false;
101  else match=true;
102 
103  return match;
104 }
double getDist(double eta1, double phi1, double eta2, double phi2)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
T eta() const
uint16_t size_type
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
std::vector< size_type > Keys
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
Definition: DDAxes.h:10
double getDist ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)

Definition at line 64 of file AlCaIsoTracksProducer.cc.

References funct::pow(), and mathSSE::sqrt().

Referenced by checkHLTMatch().

65 {
66  double dphi = fabs(phi1 - phi2);
67  if(dphi>acos(-1)) dphi = 2*acos(-1)-dphi;
68  double dr = sqrt(dphi*dphi + std::pow(eta1-eta2,2));
69  return dr;
70 }
T sqrt(T t)
Definition: SSEVec.h:48
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double getDistInCM ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)

Definition at line 46 of file AlCaIsoTracksProducer.cc.

References angle(), funct::cos(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, create_public_lumi_plots::exp, funct::sin(), and funct::tan().

47 {
48  double dR, Rec;
49  double theta1=2*atan(exp(-eta1));
50  double theta2=2*atan(exp(-eta2));
51  if (fabs(eta1)<1.479) Rec=129; //radius of ECAL barrel
52  else Rec=tan(theta1)*317; //distance from IP to ECAL endcap
53 
54  //|vect| times tg of acos(scalar product)
55  double angle=acos((sin(theta1)*sin(theta2)*(sin(phi1)*sin(phi2)+cos(phi1)*cos(phi2))+cos(theta1)*cos(theta2)));
56  if (angle<acos(-1)/2)
57  {
58  dR=fabs((Rec/sin(theta1))*tan(angle));
59  return dR;
60  }
61  else return 1000;
62 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
std::pair<double,double> getL1triggerDirection ( edm::Event iEvent,
edm::EDGetTokenT< trigger::TriggerEvent > &  hltToken,
std::string  l1FilterTag_ 
)

Definition at line 106 of file AlCaIsoTracksProducer.cc.

References trigger::TriggerObject::eta(), edm::Event::getByToken(), trigger::TriggerObject::phi(), and trigger::TriggerObject::pt().

Referenced by AlCaIsoTracksProducer::produce().

107 {
109  iEvent.getByToken(hltToken,trEv);
110  const trigger::TriggerObjectCollection& TOCol(trEv->getObjects());
111 
112  trigger::Keys KEYS;
113  const trigger::size_type nFilt(trEv->sizeFilters());
114  for (trigger::size_type iFilt=0; iFilt!=nFilt; iFilt++)
115  {
116  if ((trEv->filterTag(iFilt).label()).substr(0,14)==l1FilterTag_) KEYS=trEv->filterKeys(iFilt);
117  }
118  trigger::size_type nReg=KEYS.size();
119  double etaTrig=-10000;
120  double phiTrig=-10000;
121  double ptMax=0;
122  for (trigger::size_type iReg=0; iReg<nReg; iReg++)
123  {
124  const trigger::TriggerObject& TObj(TOCol[KEYS[iReg]]);
125  if (TObj.pt()>ptMax)
126  {
127  etaTrig=TObj.eta();
128  phiTrig=TObj.phi();
129  ptMax=TObj.pt();
130  }
131  }
132  return std::pair<double,double>(etaTrig,phiTrig);
133 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
uint16_t size_type
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
std::vector< size_type > Keys