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 
5 
23 
24 #include "TMath.h"
25 #include <vector>
26 #include <iostream>
27 
28 using namespace std;
29 
30 
32 {
33  isRECO_ = true; // This will be "true" initially, then if the product isn't found, set to false once
34  numberOfHits1RPC_ = 0;
35  numberOfHits2RPC_ = 0;
36  numberOfHits3RPC_ = 0;
37  numberOfHits4RPC_ = 0;
38  numberOfHitsRPC_ = 0;
39  rpcRecHits_ = pset.getParameter<edm::InputTag>("rpcRecHits");
40 
41 }
42 
43 
44 
45 
47  const reco::Jet &jet, const int iDbg )
48 {
49 
50  // initialize
51  numberOfHits1RPC_ = 0;
52  numberOfHits2RPC_ = 0;
53  numberOfHits3RPC_ = 0;
54  numberOfHits4RPC_ = 0;
55  numberOfHitsRPC_ = 0;
56 
57 
58  if ( isRECO_ ) { // This will be "true" initially, then if the product isn't found, set to false once
59 
60  // Get tracking geometry
62  iSetup.get<GlobalTrackingGeometryRecord> ().get(trackingGeometry);
63 
64  //####READ RPC RecHits Collection########
65  //#In config: RpcRecHits = cms.InputTag("rpcRecHits")
66  edm::Handle<RPCRecHitCollection> rpcRecHits_handle;
67  event.getByLabel(rpcRecHits_, rpcRecHits_handle);
68 
69 
70  if ( ! rpcRecHits_handle.isValid() ) {
71  // don't throw exception if not running on RECO
72  edm::LogWarning("DataNotAvailable") << "JetMuonHitsIDHelper will not be run at all, this is not a RECO file.";
73  isRECO_ = false;
74  return;
75  }
76 
77  //####calculate rpc variables for each jet########
78 
79  for ( RPCRecHitCollection::const_iterator itRPC = rpcRecHits_handle->begin(),
80  itRPCBegin = rpcRecHits_handle->begin(),
81  itRPCEnd = rpcRecHits_handle->end();
82  itRPC != itRPCEnd; ++itRPC) {
83  RPCRecHit const & hit = *itRPC;
84  DetId detid = hit.geographicalId();
85  LocalPoint lp = hit.localPosition();
86  const GeomDet* gd = trackingGeometry->idToDet(detid);
87  GlobalPoint gp = gd->toGlobal(lp);
88  double dR2 = reco::deltaR(jet.eta(), jet.phi(),
89  static_cast<double>( gp.eta() ), static_cast<double>(gp.phi()) );
90  if (dR2 < 0.5) {
91  RPCDetId rpcChamberId = (RPCDetId) detid;
92  numberOfHitsRPC_++;
93  if (rpcChamberId.station() == 1)
94  numberOfHits1RPC_++;
95  if (rpcChamberId.station() == 2)
96  numberOfHits2RPC_++;
97  if (rpcChamberId.station() == 3)
98  numberOfHits3RPC_++;
99  if (rpcChamberId.station() == 4)
100  numberOfHits4RPC_++;
101  }
102  }
103  }
104 }
T getParameter(std::string const &) const
Base class for all types of Jets.
Definition: Jet.h:21
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
virtual double eta() const
momentum pseudorapidity
double deltaR(double eta1, double phi1, double eta2, double phi2)
Definition: deltaR.h:19
void calculate(const edm::Event &event, const edm::EventSetup &isetup, const reco::Jet &jet, const int iDbg=0)
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
tuple pset
Definition: CrabTask.py:85
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
Definition: DetId.h:20
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:18
DetId geographicalId() const
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: RPCRecHit.h:55
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::LocalCoordinateSystemTag > LocalPoint
point in local coordinate system
Definition: Point3D.h:16
virtual double phi() const
momentum azimuthal angle
int station() const
Definition: RPCDetId.h:98