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

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

Detailed Description

Definition at line 37 of file JetExtractor.h.

Constructor & Destructor Documentation

◆ JetExtractor() [1/2]

JetExtractor::JetExtractor ( )

Definition at line 26 of file JetExtractor.cc.

26 {}

◆ JetExtractor() [2/2]

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

Definition at line 28 of file JetExtractor.cc.

References edm::ParameterSet::getParameter(), theAssociator, theAssociatorParameters, and theService.

30  thePropagatorName(par.getParameter<std::string>("PropagatorName")),
32  theThreshold(par.getParameter<double>("Threshold")),
33  theDR_Veto(par.getParameter<double>("DR_Veto")),
34  theDR_Max(par.getParameter<double>("DR_Max")),
35  theExcludeMuonVeto(par.getParameter<bool>("ExcludeMuonVeto")),
36  theService(nullptr),
37  theAssociator(nullptr),
38  thePrintTimeReport(par.getUntrackedParameter<bool>("PrintTimeReport")) {
39  ParameterSet serviceParameters = par.getParameter<ParameterSet>("ServiceParameters");
40  theService = std::make_unique<MuonServiceProxy>(serviceParameters, edm::ConsumesCollector(iC));
41 
42  // theAssociatorParameters = new TrackAssociatorParameters(par.getParameter<edm::ParameterSet>("TrackAssociatorParameters"), iC_);
43  theAssociatorParameters = std::make_unique<TrackAssociatorParameters>();
44  theAssociatorParameters->loadParameters(par.getParameter<edm::ParameterSet>("TrackAssociatorParameters"), iC);
45  theAssociator = std::make_unique<TrackDetectorAssociator>();
46 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::unique_ptr< TrackAssociatorParameters > theAssociatorParameters
Definition: JetExtractor.h:67
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theFieldToken
Definition: JetExtractor.h:54
std::unique_ptr< MuonServiceProxy > theService
the event setup proxy, it takes care the services update
Definition: JetExtractor.h:65
std::unique_ptr< TrackDetectorAssociator > theAssociator
Definition: JetExtractor.h:68
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::CaloJetCollection > theJetCollectionToken
Definition: JetExtractor.h:50
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects

◆ ~JetExtractor()

JetExtractor::~JetExtractor ( )
override

Definition at line 48 of file JetExtractor.cc.

48 {}

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

References Calorimetry_cff::bField, TrackDetMatchInfo::crossedTowerIds, TrackDetMatchInfo::crossedTowers, reco::deltaR(), options_cfi::eventSetup, reco::TransientTrack::initialFreeState(), theAssociator, theAssociatorParameters, theDR_Max, theDR_Veto, theExcludeMuonVeto, theFieldToken, theJetCollectionToken, thePropagatorName, theService, theThreshold, and TrackDetMatchInfo::trkGlobPosAtHcal.

56  {
57  theService->update(eventSetup);
58  theAssociator->setPropagator(&*(theService->propagator(thePropagatorName)));
59 
60  typedef IsoDeposit::Veto Veto;
61  IsoDeposit::Direction muonDir(muon.eta(), muon.phi());
62 
63  IsoDeposit depJet(muonDir);
64 
65  auto const& bField = eventSetup.getData(theFieldToken);
66 
68  FreeTrajectoryState iFTS = tMuon.initialFreeState();
70 
71  reco::isodeposit::Direction vetoDirection(mInfo.trkGlobPosAtHcal.eta(), mInfo.trkGlobPosAtHcal.phi());
72  depJet.setVeto(Veto(vetoDirection, theDR_Veto));
73 
75  event.getByToken(theJetCollectionToken, caloJetsH);
76 
77  //use calo towers
78  CaloJetCollection::const_iterator jetCI = caloJetsH->begin();
79  for (; jetCI != caloJetsH->end(); ++jetCI) {
80  double deltar0 = reco::deltaR(muon, *jetCI);
81  if (deltar0 > theDR_Max)
82  continue;
83  if (jetCI->et() < theThreshold)
84  continue;
85 
86  //should I make a separate config option for this?
87  std::vector<CaloTowerPtr> jetConstituents = jetCI->getCaloConstituents();
88 
89  std::vector<DetId>::const_iterator crossedCI = mInfo.crossedTowerIds.begin();
90  std::vector<CaloTowerPtr>::const_iterator jetTowCI = jetConstituents.begin();
91 
92  double sumEtExcluded = 0;
93  for (; jetTowCI != jetConstituents.end(); ++jetTowCI) {
94  bool isExcluded = false;
95  double deltaRLoc = reco::deltaR(vetoDirection, *jetCI);
96  if (deltaRLoc < theDR_Veto) {
97  isExcluded = true;
98  }
99  for (; !isExcluded && crossedCI != mInfo.crossedTowerIds.end(); ++crossedCI) {
100  if (crossedCI->rawId() == (*jetTowCI)->id().rawId()) {
101  isExcluded = true;
102  }
103  }
104  if (isExcluded)
105  sumEtExcluded += (*jetTowCI)->et();
106  }
107  if (theExcludeMuonVeto) {
108  if (jetCI->et() - sumEtExcluded < theThreshold)
109  continue;
110  }
111 
112  double depositEt = jetCI->et();
113  if (theExcludeMuonVeto)
114  depositEt = depositEt - sumEtExcluded;
115 
116  reco::isodeposit::Direction jetDir(jetCI->eta(), jetCI->phi());
117  depJet.addDeposit(jetDir, depositEt);
118  }
119 
120  std::vector<const CaloTower*>::const_iterator crossedCI = mInfo.crossedTowers.begin();
121  double muSumEt = 0;
122  for (; crossedCI != mInfo.crossedTowers.end(); ++crossedCI) {
123  muSumEt += (*crossedCI)->et();
124  }
125  depJet.addCandEnergy(muSumEt);
126 
127  return depJet;
128 }
std::unique_ptr< TrackAssociatorParameters > theAssociatorParameters
Definition: JetExtractor.h:67
std::vector< const CaloTower * > crossedTowers
std::vector< DetId > crossedTowerIds
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theFieldToken
Definition: JetExtractor.h:54
std::unique_ptr< MuonServiceProxy > theService
the event setup proxy, it takes care the services update
Definition: JetExtractor.h:65
math::XYZPoint trkGlobPosAtHcal
std::unique_ptr< TrackDetectorAssociator > theAssociator
Definition: JetExtractor.h:68
edm::EDGetTokenT< reco::CaloJetCollection > theJetCollectionToken
Definition: JetExtractor.h:50
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
Definition: event.py:1

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

50  {
51  // LogWarning("JetExtractor")
52  // <<"fillVetos does nothing now: IsoDeposit provides enough functionality\n"
53  // <<"to remove a deposit at/around given (eta, phi)";
54 }

Member Data Documentation

◆ theAssociator

std::unique_ptr<TrackDetectorAssociator> muonisolation::JetExtractor::theAssociator
private

Definition at line 68 of file JetExtractor.h.

Referenced by deposit(), and JetExtractor().

◆ theAssociatorParameters

std::unique_ptr<TrackAssociatorParameters> muonisolation::JetExtractor::theAssociatorParameters
private

Definition at line 67 of file JetExtractor.h.

Referenced by deposit(), and JetExtractor().

◆ theDR_Max

double muonisolation::JetExtractor::theDR_Max
private

Definition at line 59 of file JetExtractor.h.

Referenced by deposit().

◆ theDR_Veto

double muonisolation::JetExtractor::theDR_Veto
private

Definition at line 58 of file JetExtractor.h.

Referenced by deposit().

◆ theExcludeMuonVeto

bool muonisolation::JetExtractor::theExcludeMuonVeto
private

Definition at line 62 of file JetExtractor.h.

Referenced by deposit().

◆ theFieldToken

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> muonisolation::JetExtractor::theFieldToken
private

Definition at line 54 of file JetExtractor.h.

Referenced by deposit().

◆ theJetCollectionToken

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

Definition at line 50 of file JetExtractor.h.

Referenced by deposit().

◆ thePrintTimeReport

bool muonisolation::JetExtractor::thePrintTimeReport
private

Definition at line 70 of file JetExtractor.h.

◆ thePropagatorName

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

Definition at line 52 of file JetExtractor.h.

Referenced by deposit().

◆ theService

std::unique_ptr<MuonServiceProxy> muonisolation::JetExtractor::theService
private

the event setup proxy, it takes care the services update

Definition at line 65 of file JetExtractor.h.

Referenced by deposit(), and JetExtractor().

◆ theThreshold

double muonisolation::JetExtractor::theThreshold
private

Definition at line 57 of file JetExtractor.h.

Referenced by deposit().