CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
muonisolation::JetExtractor Class Reference

#include <JetExtractor.h>

Inheritance diagram for muonisolation::JetExtractor:
reco::isodeposit::IsoDepositExtractor

Public Member Functions

reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const override
 
void fillVetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &tracks) override
 
 JetExtractor ()
 
 JetExtractor (const edm::ParameterSet &par, edm::ConsumesCollector &&iC)
 
 ~JetExtractor () override
 
- Public Member Functions inherited from reco::isodeposit::IsoDepositExtractor
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 make single IsoDeposit based on trackRef as input More...
 
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &track) const
 
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 make single IsoDeposit based on a CandidateBaseRef as input More...
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 
virtual void initEvent (const edm::Event &, const edm::EventSetup &)
 perform some constly initialization More...
 
virtual ~IsoDepositExtractor ()
 Destructor. More...
 

Private Attributes

TrackDetectorAssociatortheAssociator
 
TrackAssociatorParameterstheAssociatorParameters
 
double theDR_Max
 
double theDR_Veto
 
bool theExcludeMuonVeto
 
edm::EDGetTokenT< reco::CaloJetCollectiontheJetCollectionToken
 
bool thePrintTimeReport
 
std::string thePropagatorName
 
MuonServiceProxytheService
 the event setup proxy, it takes care the services update More...
 
double theThreshold
 

Detailed Description

Definition at line 34 of file JetExtractor.h.

Constructor & Destructor Documentation

muonisolation::JetExtractor::JetExtractor ( )
inline
JetExtractor::JetExtractor ( const edm::ParameterSet par,
edm::ConsumesCollector &&  iC 
)

Definition at line 33 of file JetExtractor.cc.

References edm::ParameterSet::getParameter(), TrackAssociatorParameters::loadParameters(), MuonServiceProxy_cff::MuonServiceProxy, theAssociator, theAssociatorParameters, theService, and muons1stStep_cfi::TrackAssociatorParameters.

33  :
35  thePropagatorName(par.getParameter<std::string>("PropagatorName")),
36  theThreshold(par.getParameter<double>("Threshold")),
37  theDR_Veto(par.getParameter<double>("DR_Veto")),
38  theDR_Max(par.getParameter<double>("DR_Max")),
39  theExcludeMuonVeto(par.getParameter<bool>("ExcludeMuonVeto")),
40  theService(nullptr),
41  theAssociator(nullptr),
42  thePrintTimeReport(par.getUntrackedParameter<bool>("PrintTimeReport"))
43 {
44  ParameterSet serviceParameters = par.getParameter<ParameterSet>("ServiceParameters");
45  theService = new MuonServiceProxy(serviceParameters);
46 
47  // theAssociatorParameters = new TrackAssociatorParameters(par.getParameter<edm::ParameterSet>("TrackAssociatorParameters"), iC_);
49  theAssociatorParameters->loadParameters(par.getParameter<edm::ParameterSet>("TrackAssociatorParameters"), iC);
51 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
edm::EDGetTokenT< reco::CaloJetCollection > theJetCollectionToken
Definition: JetExtractor.h:48
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
Definition: JetExtractor.h:61
TrackAssociatorParameters * theAssociatorParameters
Definition: JetExtractor.h:63
TrackDetectorAssociator * theAssociator
Definition: JetExtractor.h:64
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
JetExtractor::~JetExtractor ( )
override

Definition at line 53 of file JetExtractor.cc.

References theAssociator, theAssociatorParameters, and theService.

Referenced by JetExtractor().

53  {
55  if (theService) delete theService;
56  if (theAssociator) delete theAssociator;
57 }
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
Definition: JetExtractor.h:61
TrackAssociatorParameters * theAssociatorParameters
Definition: JetExtractor.h:63
TrackDetectorAssociator * theAssociator
Definition: JetExtractor.h:64

Member Function Documentation

IsoDeposit JetExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const
overridevirtual

make single IsoDeposit based on track as input purely virtual: have to implement in concrete implementations

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 67 of file JetExtractor.cc.

References TrackDetectorAssociator::associate(), ecalTB2006H4_GenSimDigiReco_cfg::bField, TrackDetMatchInfo::crossedTowerIds, TrackDetMatchInfo::crossedTowers, reco::deltaR(), reco::TrackBase::eta(), edm::EventSetup::get(), reco::TransientTrack::initialFreeState(), reco::TrackBase::phi(), TrackDetectorAssociator::setPropagator(), theAssociator, theAssociatorParameters, theDR_Max, theDR_Veto, theExcludeMuonVeto, theJetCollectionToken, thePropagatorName, theService, theThreshold, and TrackDetMatchInfo::trkGlobPosAtHcal.

Referenced by JetExtractor().

68 {
69 
70  theService->update(eventSetup);
72 
73  typedef IsoDeposit::Veto Veto;
74  IsoDeposit::Direction muonDir(muon.eta(), muon.phi());
75 
76  IsoDeposit depJet(muonDir);
77 
79  eventSetup.get<IdealMagneticFieldRecord>().get(bField);
80 
81 
82  reco::TransientTrack tMuon(muon, &*bField);
83  FreeTrajectoryState iFTS = tMuon.initialFreeState();
85 
86  reco::isodeposit::Direction vetoDirection(mInfo.trkGlobPosAtHcal.eta(), mInfo.trkGlobPosAtHcal.phi());
87  depJet.setVeto(Veto(vetoDirection, theDR_Veto));
88 
89 
91  event.getByToken(theJetCollectionToken, caloJetsH);
92 
93  //use calo towers
94  CaloJetCollection::const_iterator jetCI = caloJetsH->begin();
95  for (; jetCI != caloJetsH->end(); ++jetCI){
96  double deltar0 = reco::deltaR(muon,*jetCI);
97  if (deltar0>theDR_Max) continue;
98  if (jetCI->et() < theThreshold ) continue;
99 
100  //should I make a separate config option for this?
101  std::vector<CaloTowerPtr> jetConstituents = jetCI->getCaloConstituents();
102 
103  std::vector<DetId>::const_iterator crossedCI = mInfo.crossedTowerIds.begin();
104  std::vector<CaloTowerPtr>::const_iterator jetTowCI = jetConstituents.begin();
105 
106  double sumEtExcluded = 0;
107  for (;jetTowCI != jetConstituents.end(); ++ jetTowCI){
108  bool isExcluded = false;
109  double deltaRLoc = reco::deltaR(vetoDirection, *jetCI);
110  if (deltaRLoc < theDR_Veto){
111  isExcluded = true;
112  }
113  for(; ! isExcluded && crossedCI != mInfo.crossedTowerIds.end(); ++crossedCI){
114  if (crossedCI->rawId() == (*jetTowCI)->id().rawId()){
115  isExcluded = true;
116  }
117  }
118  if (isExcluded) sumEtExcluded += (*jetTowCI)->et();
119  }
120  if (theExcludeMuonVeto){
121  if (jetCI->et() - sumEtExcluded < theThreshold ) continue;
122  }
123 
124  double depositEt = jetCI->et();
125  if (theExcludeMuonVeto) depositEt = depositEt - sumEtExcluded;
126 
127  reco::isodeposit::Direction jetDir(jetCI->eta(), jetCI->phi());
128  depJet.addDeposit(jetDir, depositEt);
129 
130  }
131 
132  std::vector<const CaloTower*>::const_iterator crossedCI = mInfo.crossedTowers.begin();
133  double muSumEt = 0;
134  for (; crossedCI != mInfo.crossedTowers.end(); ++crossedCI){
135  muSumEt += (*crossedCI)->et();
136  }
137  depJet.addCandEnergy(muSumEt);
138 
139  return depJet;
140 
141 }
std::vector< const CaloTower * > crossedTowers
std::vector< DetId > crossedTowerIds
math::XYZPoint trkGlobPosAtHcal
void setPropagator(const Propagator *)
use a user configured propagator
edm::EDGetTokenT< reco::CaloJetCollection > theJetCollectionToken
Definition: JetExtractor.h:48
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
Definition: JetExtractor.h:61
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
TrackAssociatorParameters * theAssociatorParameters
Definition: JetExtractor.h:63
TrackDetectorAssociator * theAssociator
Definition: JetExtractor.h:64
Definition: event.py:1
void JetExtractor::fillVetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::TrackCollection tracks 
)
overridevirtual

fill vetoes: to exclude deposits at IsoDeposit creation stage check concrete extractors if it's no-op !

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 59 of file JetExtractor.cc.

Referenced by JetExtractor().

60 {
61 // LogWarning("JetExtractor")
62 // <<"fillVetos does nothing now: IsoDeposit provides enough functionality\n"
63 // <<"to remove a deposit at/around given (eta, phi)";
64 
65 }

Member Data Documentation

TrackDetectorAssociator* muonisolation::JetExtractor::theAssociator
private

Definition at line 64 of file JetExtractor.h.

Referenced by deposit(), JetExtractor(), and ~JetExtractor().

TrackAssociatorParameters* muonisolation::JetExtractor::theAssociatorParameters
private

Definition at line 63 of file JetExtractor.h.

Referenced by deposit(), JetExtractor(), and ~JetExtractor().

double muonisolation::JetExtractor::theDR_Max
private

Definition at line 55 of file JetExtractor.h.

Referenced by deposit().

double muonisolation::JetExtractor::theDR_Veto
private

Definition at line 54 of file JetExtractor.h.

Referenced by deposit().

bool muonisolation::JetExtractor::theExcludeMuonVeto
private

Definition at line 58 of file JetExtractor.h.

Referenced by deposit().

edm::EDGetTokenT<reco::CaloJetCollection> muonisolation::JetExtractor::theJetCollectionToken
private

Definition at line 48 of file JetExtractor.h.

Referenced by deposit().

bool muonisolation::JetExtractor::thePrintTimeReport
private

Definition at line 66 of file JetExtractor.h.

std::string muonisolation::JetExtractor::thePropagatorName
private

Definition at line 50 of file JetExtractor.h.

Referenced by deposit().

MuonServiceProxy* muonisolation::JetExtractor::theService
private

the event setup proxy, it takes care the services update

Definition at line 61 of file JetExtractor.h.

Referenced by deposit(), JetExtractor(), and ~JetExtractor().

double muonisolation::JetExtractor::theThreshold
private

Definition at line 53 of file JetExtractor.h.

Referenced by deposit().