CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
reco::helper::JetMuonHitsIDHelper Class Reference

#include <JetMuonHitsIDHelper.h>

Public Member Functions

void calculate (const edm::Event &event, const edm::EventSetup &isetup, const reco::Jet &jet, const int iDbg=0)
 
void fillDescription (edm::ParameterSetDescription &iDesc)
 
void initValues ()
 
 JetMuonHitsIDHelper ()
 
 JetMuonHitsIDHelper (edm::ParameterSet const &pset, edm::ConsumesCollector &&iC)
 
int numberOfHits1RPC () const
 
int numberOfHits2RPC () const
 
int numberOfHits3RPC () const
 
int numberOfHits4RPC () const
 
int numberOfHitsRPC () const
 
 ~JetMuonHitsIDHelper ()
 

Private Attributes

edm::EDGetTokenT< RPCRecHitCollectioninput_rpchits_token_
 
bool isRECO_
 
int numberOfHits1RPC_
 
int numberOfHits2RPC_
 
int numberOfHits3RPC_
 
int numberOfHits4RPC_
 
int numberOfHitsRPC_
 
edm::InputTag rpcRecHits_
 
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecordtrackingGeometryToken_
 

Detailed Description

Definition at line 21 of file JetMuonHitsIDHelper.h.

Constructor & Destructor Documentation

◆ JetMuonHitsIDHelper() [1/2]

reco::helper::JetMuonHitsIDHelper::JetMuonHitsIDHelper ( )
inline

Definition at line 24 of file JetMuonHitsIDHelper.h.

24 {}

◆ JetMuonHitsIDHelper() [2/2]

reco::helper::JetMuonHitsIDHelper::JetMuonHitsIDHelper ( edm::ParameterSet const &  pset,
edm::ConsumesCollector &&  iC 
)

Definition at line 27 of file JetMuonHitsIDHelper.cc.

References input_rpchits_token_, isRECO_, numberOfHits1RPC_, numberOfHits2RPC_, numberOfHits3RPC_, numberOfHits4RPC_, numberOfHitsRPC_, muonDTDigis_cfi::pset, and rpcRecHits_.

29  isRECO_ = true; // This will be "true" initially, then if the product isn't found, set to false once
34  numberOfHitsRPC_ = 0;
35  rpcRecHits_ = pset.getParameter<edm::InputTag>("rpcRecHits");
36 
38 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > trackingGeometryToken_
edm::EDGetTokenT< RPCRecHitCollection > input_rpchits_token_

◆ ~JetMuonHitsIDHelper()

reco::helper::JetMuonHitsIDHelper::~JetMuonHitsIDHelper ( )
inline

Definition at line 26 of file JetMuonHitsIDHelper.h.

26 {}

Member Function Documentation

◆ calculate()

void reco::helper::JetMuonHitsIDHelper::calculate ( const edm::Event event,
const edm::EventSetup isetup,
const reco::Jet jet,
const int  iDbg = 0 
)

Definition at line 40 of file JetMuonHitsIDHelper.cc.

References reco::deltaR(), edm::EventSetup::getData(), edm::HandleBase::isValid(), metsig::jet, RPCDetId::station(), and GeomDet::toGlobal().

Referenced by JetIDProducer::produce().

43  {
44  // initialize
49  numberOfHitsRPC_ = 0;
50 
51  if (isRECO_) { // This will be "true" initially, then if the product isn't found, set to false once
52 
53  // Get tracking geometry
54  auto const& trackingGeometry = iSetup.getData(trackingGeometryToken_);
55 
56  //####READ RPC RecHits Collection########
57  //#In config: RpcRecHits = cms.InputTag("rpcRecHits")
58  edm::Handle<RPCRecHitCollection> rpcRecHits_handle;
59  event.getByToken(input_rpchits_token_, rpcRecHits_handle);
60 
61  if (!rpcRecHits_handle.isValid()) {
62  // don't throw exception if not running on RECO
63  edm::LogWarning("DataNotAvailable") << "JetMuonHitsIDHelper will not be run at all, this is not a RECO file.";
64  isRECO_ = false;
65  return;
66  }
67 
68  //####calculate rpc variables for each jet########
69 
70  for (RPCRecHitCollection::const_iterator itRPC = rpcRecHits_handle->begin(), itRPCEnd = rpcRecHits_handle->end();
71  itRPC != itRPCEnd;
72  ++itRPC) {
73  RPCRecHit const& hit = *itRPC;
74  DetId detid = hit.geographicalId();
75  LocalPoint lp = hit.localPosition();
76  const GeomDet* gd = trackingGeometry.idToDet(detid);
77  GlobalPoint gp = gd->toGlobal(lp);
78  double dR2 = reco::deltaR(jet.eta(), jet.phi(), static_cast<double>(gp.eta()), static_cast<double>(gp.phi()));
79  if (dR2 < 0.5) {
80  RPCDetId rpcChamberId = (RPCDetId)detid;
82  if (rpcChamberId.station() == 1)
84  if (rpcChamberId.station() == 2)
86  if (rpcChamberId.station() == 3)
88  if (rpcChamberId.station() == 4)
90  }
91  }
92  }
93 }
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > trackingGeometryToken_
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
edm::EDGetTokenT< RPCRecHitCollection > input_rpchits_token_
Definition: DetId.h:17
int station() const
Definition: RPCDetId.h:78
bool isValid() const
Definition: HandleBase.h:70
Log< level::Warning, false > LogWarning

◆ fillDescription()

void reco::helper::JetMuonHitsIDHelper::fillDescription ( edm::ParameterSetDescription iDesc)

◆ initValues()

void reco::helper::JetMuonHitsIDHelper::initValues ( )

◆ numberOfHits1RPC()

int reco::helper::JetMuonHitsIDHelper::numberOfHits1RPC ( ) const
inline

Definition at line 36 of file JetMuonHitsIDHelper.h.

References numberOfHits1RPC_.

◆ numberOfHits2RPC()

int reco::helper::JetMuonHitsIDHelper::numberOfHits2RPC ( ) const
inline

Definition at line 37 of file JetMuonHitsIDHelper.h.

References numberOfHits2RPC_.

Referenced by JetIDProducer::produce().

◆ numberOfHits3RPC()

int reco::helper::JetMuonHitsIDHelper::numberOfHits3RPC ( ) const
inline

Definition at line 38 of file JetMuonHitsIDHelper.h.

References numberOfHits3RPC_.

Referenced by JetIDProducer::produce().

◆ numberOfHits4RPC()

int reco::helper::JetMuonHitsIDHelper::numberOfHits4RPC ( ) const
inline

Definition at line 39 of file JetMuonHitsIDHelper.h.

References numberOfHits4RPC_.

◆ numberOfHitsRPC()

int reco::helper::JetMuonHitsIDHelper::numberOfHitsRPC ( ) const
inline

Definition at line 40 of file JetMuonHitsIDHelper.h.

References numberOfHitsRPC_.

Referenced by JetIDProducer::produce().

Member Data Documentation

◆ input_rpchits_token_

edm::EDGetTokenT<RPCRecHitCollection> reco::helper::JetMuonHitsIDHelper::input_rpchits_token_
private

Definition at line 52 of file JetMuonHitsIDHelper.h.

Referenced by JetMuonHitsIDHelper().

◆ isRECO_

bool reco::helper::JetMuonHitsIDHelper::isRECO_
private

Definition at line 44 of file JetMuonHitsIDHelper.h.

Referenced by JetMuonHitsIDHelper().

◆ numberOfHits1RPC_

int reco::helper::JetMuonHitsIDHelper::numberOfHits1RPC_
private

Definition at line 46 of file JetMuonHitsIDHelper.h.

Referenced by JetMuonHitsIDHelper(), and numberOfHits1RPC().

◆ numberOfHits2RPC_

int reco::helper::JetMuonHitsIDHelper::numberOfHits2RPC_
private

Definition at line 47 of file JetMuonHitsIDHelper.h.

Referenced by JetMuonHitsIDHelper(), and numberOfHits2RPC().

◆ numberOfHits3RPC_

int reco::helper::JetMuonHitsIDHelper::numberOfHits3RPC_
private

Definition at line 48 of file JetMuonHitsIDHelper.h.

Referenced by JetMuonHitsIDHelper(), and numberOfHits3RPC().

◆ numberOfHits4RPC_

int reco::helper::JetMuonHitsIDHelper::numberOfHits4RPC_
private

Definition at line 49 of file JetMuonHitsIDHelper.h.

Referenced by JetMuonHitsIDHelper(), and numberOfHits4RPC().

◆ numberOfHitsRPC_

int reco::helper::JetMuonHitsIDHelper::numberOfHitsRPC_
private

Definition at line 50 of file JetMuonHitsIDHelper.h.

Referenced by JetMuonHitsIDHelper(), and numberOfHitsRPC().

◆ rpcRecHits_

edm::InputTag reco::helper::JetMuonHitsIDHelper::rpcRecHits_
private

Definition at line 43 of file JetMuonHitsIDHelper.h.

Referenced by JetMuonHitsIDHelper().

◆ trackingGeometryToken_

edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> reco::helper::JetMuonHitsIDHelper::trackingGeometryToken_
private

Definition at line 53 of file JetMuonHitsIDHelper.h.