CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetMuonHitsIDHelper.cc
Go to the documentation of this file.
2 
6 
8 // #include "TrackingTools/TrackAssociator/interface/MuonDetIdAssociator.h"
25 
26 #include "TMath.h"
27 #include <vector>
28 #include <iostream>
29 
30 using namespace std;
31 
32 
34 {
35  isRECO_ = true; // This will be "true" initially, then if the product isn't found, set to false once
36  numberOfHits1RPC_ = 0;
37  numberOfHits2RPC_ = 0;
38  numberOfHits3RPC_ = 0;
39  numberOfHits4RPC_ = 0;
40  numberOfHitsRPC_ = 0;
41  rpcRecHits_ = pset.getParameter<edm::InputTag>("rpcRecHits");
42 
43 }
44 
45 
46 
47 
49  const reco::Jet &jet, const int iDbg )
50 {
51 
52  // initialize
53  numberOfHits1RPC_ = 0;
54  numberOfHits2RPC_ = 0;
55  numberOfHits3RPC_ = 0;
56  numberOfHits4RPC_ = 0;
57  numberOfHitsRPC_ = 0;
58 
59 
60  if ( isRECO_ ) { // This will be "true" initially, then if the product isn't found, set to false once
61 
62  // Get tracking geometry
64  iSetup.get<GlobalTrackingGeometryRecord> ().get(trackingGeometry);
65 
66  //####READ RPC RecHits Collection########
67  //#In config: RpcRecHits = cms.InputTag("rpcRecHits")
68  edm::Handle<RPCRecHitCollection> rpcRecHits_handle;
69  event.getByLabel(rpcRecHits_, rpcRecHits_handle);
70 
71 
72  if ( ! rpcRecHits_handle.isValid() ) {
73  // don't throw exception if not running on RECO
74  edm::LogWarning("DataNotAvailable") << "JetMuonHitsIDHelper will not be run at all, this is not a RECO file.";
75  isRECO_ = false;
76  return;
77  }
78 
79  //####calculate rpc variables for each jet########
80 
81  for ( RPCRecHitCollection::const_iterator itRPC = rpcRecHits_handle->begin(),
82  itRPCEnd = rpcRecHits_handle->end();
83  itRPC != itRPCEnd; ++itRPC) {
84  RPCRecHit const & hit = *itRPC;
85  DetId detid = hit.geographicalId();
86  LocalPoint lp = hit.localPosition();
87  const GeomDet* gd = trackingGeometry->idToDet(detid);
88  GlobalPoint gp = gd->toGlobal(lp);
89  double dR2 = reco::deltaR(jet.eta(), jet.phi(),
90  static_cast<double>( gp.eta() ), static_cast<double>(gp.phi()) );
91  if (dR2 < 0.5) {
92  RPCDetId rpcChamberId = (RPCDetId) detid;
93  numberOfHitsRPC_++;
94  if (rpcChamberId.station() == 1)
95  numberOfHits1RPC_++;
96  if (rpcChamberId.station() == 2)
97  numberOfHits2RPC_++;
98  if (rpcChamberId.station() == 3)
99  numberOfHits3RPC_++;
100  if (rpcChamberId.station() == 4)
101  numberOfHits4RPC_++;
102  }
103  }
104  }
105 }
T getParameter(std::string const &) const
Base class for all types of Jets.
Definition: Jet.h:20
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
void calculate(const edm::Event &event, const edm::EventSetup &isetup, const reco::Jet &jet, const int iDbg=0)
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:76
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:17
DetId geographicalId() const
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: RPCRecHit.h:53
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::LocalCoordinateSystemTag > LocalPoint
point in local coordinate system
Definition: Point3D.h:15
int station() const
Definition: RPCDetId.h:96