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::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 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 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 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 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

◆ JetExtractor() [1/2]

muonisolation::JetExtractor::JetExtractor ( )
inline

Definition at line 36 of file JetExtractor.h.

36 {};

◆ JetExtractor() [2/2]

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

Definition at line 32 of file JetExtractor.cc.

34  thePropagatorName(par.getParameter<std::string>("PropagatorName")),
35  theThreshold(par.getParameter<double>("Threshold")),
36  theDR_Veto(par.getParameter<double>("DR_Veto")),
37  theDR_Max(par.getParameter<double>("DR_Max")),
38  theExcludeMuonVeto(par.getParameter<bool>("ExcludeMuonVeto")),
39  theService(nullptr),
40  theAssociator(nullptr),
41  thePrintTimeReport(par.getUntrackedParameter<bool>("PrintTimeReport")) {
42  ParameterSet serviceParameters = par.getParameter<ParameterSet>("ServiceParameters");
43  theService = new MuonServiceProxy(serviceParameters, edm::ConsumesCollector(iC));
44 
45  // theAssociatorParameters = new TrackAssociatorParameters(par.getParameter<edm::ParameterSet>("TrackAssociatorParameters"), iC_);
47  theAssociatorParameters->loadParameters(par.getParameter<edm::ParameterSet>("TrackAssociatorParameters"), iC);
49 }

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

◆ ~JetExtractor()

JetExtractor::~JetExtractor ( )
override

Definition at line 51 of file JetExtractor.cc.

51  {
54  if (theService)
55  delete theService;
56  if (theAssociator)
57  delete theAssociator;
58 }

References theAssociator, theAssociatorParameters, and theService.

Member Function Documentation

◆ deposit()

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 66 of file JetExtractor.cc.

66  {
67  theService->update(eventSetup);
69 
70  typedef IsoDeposit::Veto Veto;
71  IsoDeposit::Direction muonDir(muon.eta(), muon.phi());
72 
73  IsoDeposit depJet(muonDir);
74 
76  eventSetup.get<IdealMagneticFieldRecord>().get(bField);
77 
79  FreeTrajectoryState iFTS = tMuon.initialFreeState();
81 
82  reco::isodeposit::Direction vetoDirection(mInfo.trkGlobPosAtHcal.eta(), mInfo.trkGlobPosAtHcal.phi());
83  depJet.setVeto(Veto(vetoDirection, theDR_Veto));
84 
86  event.getByToken(theJetCollectionToken, caloJetsH);
87 
88  //use calo towers
89  CaloJetCollection::const_iterator jetCI = caloJetsH->begin();
90  for (; jetCI != caloJetsH->end(); ++jetCI) {
91  double deltar0 = reco::deltaR(muon, *jetCI);
92  if (deltar0 > theDR_Max)
93  continue;
94  if (jetCI->et() < theThreshold)
95  continue;
96 
97  //should I make a separate config option for this?
98  std::vector<CaloTowerPtr> jetConstituents = jetCI->getCaloConstituents();
99 
100  std::vector<DetId>::const_iterator crossedCI = mInfo.crossedTowerIds.begin();
101  std::vector<CaloTowerPtr>::const_iterator jetTowCI = jetConstituents.begin();
102 
103  double sumEtExcluded = 0;
104  for (; jetTowCI != jetConstituents.end(); ++jetTowCI) {
105  bool isExcluded = false;
106  double deltaRLoc = reco::deltaR(vetoDirection, *jetCI);
107  if (deltaRLoc < theDR_Veto) {
108  isExcluded = true;
109  }
110  for (; !isExcluded && crossedCI != mInfo.crossedTowerIds.end(); ++crossedCI) {
111  if (crossedCI->rawId() == (*jetTowCI)->id().rawId()) {
112  isExcluded = true;
113  }
114  }
115  if (isExcluded)
116  sumEtExcluded += (*jetTowCI)->et();
117  }
118  if (theExcludeMuonVeto) {
119  if (jetCI->et() - sumEtExcluded < theThreshold)
120  continue;
121  }
122 
123  double depositEt = jetCI->et();
124  if (theExcludeMuonVeto)
125  depositEt = depositEt - sumEtExcluded;
126 
127  reco::isodeposit::Direction jetDir(jetCI->eta(), jetCI->phi());
128  depJet.addDeposit(jetDir, depositEt);
129  }
130 
131  std::vector<const CaloTower*>::const_iterator crossedCI = mInfo.crossedTowers.begin();
132  double muSumEt = 0;
133  for (; crossedCI != mInfo.crossedTowers.end(); ++crossedCI) {
134  muSumEt += (*crossedCI)->et();
135  }
136  depJet.addCandEnergy(muSumEt);
137 
138  return depJet;
139 }

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

◆ fillVetos()

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 60 of file JetExtractor.cc.

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 }

Member Data Documentation

◆ theAssociator

TrackDetectorAssociator* muonisolation::JetExtractor::theAssociator
private

Definition at line 63 of file JetExtractor.h.

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

◆ theAssociatorParameters

TrackAssociatorParameters* muonisolation::JetExtractor::theAssociatorParameters
private

Definition at line 62 of file JetExtractor.h.

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

◆ theDR_Max

double muonisolation::JetExtractor::theDR_Max
private

Definition at line 54 of file JetExtractor.h.

Referenced by deposit().

◆ theDR_Veto

double muonisolation::JetExtractor::theDR_Veto
private

Definition at line 53 of file JetExtractor.h.

Referenced by deposit().

◆ theExcludeMuonVeto

bool muonisolation::JetExtractor::theExcludeMuonVeto
private

Definition at line 57 of file JetExtractor.h.

Referenced by deposit().

◆ theJetCollectionToken

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

Definition at line 47 of file JetExtractor.h.

Referenced by deposit().

◆ thePrintTimeReport

bool muonisolation::JetExtractor::thePrintTimeReport
private

Definition at line 65 of file JetExtractor.h.

◆ thePropagatorName

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

Definition at line 49 of file JetExtractor.h.

Referenced by deposit().

◆ theService

MuonServiceProxy* muonisolation::JetExtractor::theService
private

the event setup proxy, it takes care the services update

Definition at line 60 of file JetExtractor.h.

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

◆ theThreshold

double muonisolation::JetExtractor::theThreshold
private

Definition at line 52 of file JetExtractor.h.

Referenced by deposit().

muonisolation::JetExtractor::theDR_Max
double theDR_Max
Definition: JetExtractor.h:54
muon
Definition: MuonCocktails.h:17
TrackDetMatchInfo::crossedTowers
std::vector< const CaloTower * > crossedTowers
Definition: TrackDetMatchInfo.h:62
TrackDetMatchInfo::trkGlobPosAtHcal
math::XYZPoint trkGlobPosAtHcal
Definition: TrackDetMatchInfo.h:39
reco::IsoDeposit::Veto
Definition: IsoDeposit.h:59
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
muonisolation::JetExtractor::theDR_Veto
double theDR_Veto
Definition: JetExtractor.h:53
muonisolation::JetExtractor::theThreshold
double theThreshold
Definition: JetExtractor.h:52
edm::Handle
Definition: AssociativeIterator.h:50
TrackDetMatchInfo::crossedTowerIds
std::vector< DetId > crossedTowerIds
Definition: TrackDetMatchInfo.h:69
MuonServiceProxy_cff.MuonServiceProxy
MuonServiceProxy
Definition: MuonServiceProxy_cff.py:14
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
PDWG_EXOHSCP_cff.TrackAssociatorParameters
TrackAssociatorParameters
Definition: PDWG_EXOHSCP_cff.py:60
muonisolation::JetExtractor::theExcludeMuonVeto
bool theExcludeMuonVeto
Definition: JetExtractor.h:57
edm::ESHandle< MagneticField >
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
TrackAssociatorParameters::loadParameters
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
Definition: TrackAssociatorParameters.cc:18
TrackDetectorAssociator::setPropagator
void setPropagator(const Propagator *)
use a user configured propagator
Definition: TrackDetectorAssociator.cc:76
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
muonisolation::JetExtractor::theJetCollectionToken
edm::EDGetTokenT< reco::CaloJetCollection > theJetCollectionToken
Definition: JetExtractor.h:47
edm::ParameterSet
Definition: ParameterSet.h:47
muonisolation::JetExtractor::thePrintTimeReport
bool thePrintTimeReport
Definition: JetExtractor.h:65
TrackDetectorAssociator
Definition: TrackDetectorAssociator.h:44
reco::CaloJetCollection
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Definition: CaloJetCollection.h:15
get
#define get
muonisolation::JetExtractor::thePropagatorName
std::string thePropagatorName
Definition: JetExtractor.h:49
TrackDetMatchInfo
Definition: TrackDetMatchInfo.h:13
muonisolation::JetExtractor::theService
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
Definition: JetExtractor.h:60
reco::TransientTrack
Definition: TransientTrack.h:19
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
Calorimetry_cff.bField
bField
Definition: Calorimetry_cff.py:292
muonisolation::JetExtractor::theAssociator
TrackDetectorAssociator * theAssociator
Definition: JetExtractor.h:63
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
reco::deltaR
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
reco::IsoDeposit
Definition: IsoDeposit.h:49
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackDetectorAssociator::associate
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
Definition: TrackDetectorAssociator.cc:110
muonisolation::JetExtractor::theAssociatorParameters
TrackAssociatorParameters * theAssociatorParameters
Definition: JetExtractor.h:62
event
Definition: event.py:1
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45