CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
BetaCalculatorRPC Class Reference

#include <BetaCalculatorRPC.h>

Public Member Functions

void addInfoToCandidate (susybsm::HSCParticle &candidate, const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
void algo (const std::vector< susybsm::RPCHit4D > &HSCPRPCRecHits)
 
float beta ()
 
 BetaCalculatorRPC (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 

Private Member Functions

float dist (float phi1, float phi2)
 
float dist3 (float phi1, float phi2, float phi3)
 
float etarange (float eta1, float eta2, float eta3)
 

Private Attributes

float betavalue
 
float etavalue
 
bool foundvalue
 
float phivalue
 
edm::EDGetTokenT< RPCRecHitCollectionrpcRecHitsToken
 

Detailed Description

Definition at line 29 of file BetaCalculatorRPC.h.

Constructor & Destructor Documentation

◆ BetaCalculatorRPC()

BetaCalculatorRPC::BetaCalculatorRPC ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 5 of file BetaCalculatorRPC.cc.

5  {
7 }

References edm::ParameterSet::getParameter().

Member Function Documentation

◆ addInfoToCandidate()

void BetaCalculatorRPC::addInfoToCandidate ( susybsm::HSCParticle candidate,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 112 of file BetaCalculatorRPC.cc.

114  {
116  iSetup.get<MuonGeometryRecord>().get(rpcGeo);
117 
119  iEvent.getByToken(rpcRecHitsToken, rpcHits);
120 
121  // here we do basically as in RPCHSCPCANDIDATE.cc, but just for the hits on the muon of interest
123  std::vector<RPCHit4D> hits;
124  // so, loop on the RPC hits of the muon
127 
128  if (candidate.hasMuonRef() && candidate.muonRef()->combinedMuon().isNonnull()) {
129  start = candidate.muonRef()->combinedMuon()->recHitsBegin();
130  stop = candidate.muonRef()->combinedMuon()->recHitsEnd();
131  } else if (candidate.hasMuonRef() && candidate.muonRef()->standAloneMuon().isNonnull()) {
132  track = *(candidate.muonRef()->standAloneMuon());
133  start = candidate.muonRef()->standAloneMuon()->recHitsBegin();
134  stop = candidate.muonRef()->standAloneMuon()->recHitsEnd();
135  } else
136  return;
137  /*
138  if(candidate.hasMuonCombinedTrack()) {
139  start = candidate.combinedTrack().recHitsBegin();
140  stop = candidate.combinedTrack().recHitsEnd();
141  } else if(candidate.hasMuonStaTrack()) {
142  start = candidate.staTrack().recHitsBegin();
143  stop = candidate.staTrack().recHitsEnd();
144  } else return;
145 */
146 
147  for (trackingRecHit_iterator recHit = start; recHit != stop; ++recHit) {
148  if ((*recHit)->geographicalId().subdetId() != MuonSubdetId::RPC)
149  continue;
150  if ((*recHit)->geographicalId().det() != DetId::Muon)
151  continue;
152  if (!(*recHit)->isValid())
153  continue; //Is Valid?
154 
155  RPCDetId rollId = (RPCDetId)(*recHit)->geographicalId();
156 
157  typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
158  rangeRecHits recHitCollection = rpcHits->get(rollId);
160  int size = 0;
161  int clusterS = 0;
162 
163  for (recHitC = recHitCollection.first; recHitC != recHitCollection.second; recHitC++) {
164  clusterS = (*recHitC).clusterSize();
165  // RPCDetId rollId = (RPCDetId)(*recHitC).geographicalId();
166  // std::cout<<"\t \t \t \t"<<rollId<<" bx "<<(*recHitC).BunchX()<<std::endl;
167  size++;
168  }
169  if (size > 1)
170  continue; //Is the only RecHit in this roll.?
171  if (clusterS > 4)
172  continue; //Is the Cluster Size 5 or bigger?
173 
174  LocalPoint recHitPos = (*recHit)->localPosition();
175  const RPCRoll* rollasociated = rpcGeo->roll(rollId);
176  const BoundPlane& RPCSurface = rollasociated->surface();
177 
178  RPCHit4D ThisHit;
179  ThisHit.bx = ((RPCRecHit*)(&(**recHit)))->BunchX();
180  ThisHit.gp = RPCSurface.toGlobal(recHitPos);
181  ThisHit.id = (RPCDetId)(*recHit)->geographicalId().rawId();
182  hits.push_back(ThisHit);
183  }
184  // here we go on with the RPC procedure
185  std::sort(hits.begin(), hits.end());
186  int lastbx = -7;
187  bool increasing = true;
188  bool outOfTime = false;
189  for (std::vector<RPCHit4D>::iterator point = hits.begin(); point < hits.end(); ++point) {
190  outOfTime |= (point->bx != 0); //condition 1: at least one measurement must have BX!=0
191  increasing &= (point->bx >= lastbx); //condition 2: BX must increase when going inside-out.
192  lastbx = point->bx;
193  }
194  result.isCandidate = (outOfTime && increasing);
195 
196  //result.beta = 1; // here we should get some pattern-based estimate
197  algo(hits);
198  result.beta = beta();
199  candidate.setRpc(result);
200 }

References zMuMuMuonUserData::beta, susybsm::RPCHit4D::bx, edm::EventSetup::get(), get, susybsm::RPCHit4D::gp, susybsm::HSCParticle::hasMuonRef(), hfClusterShapes_cfi::hits, susybsm::RPCHit4D::id, iEvent, edm::Ref< C, T, F >::isNonnull(), DetId::Muon, susybsm::HSCParticle::muonRef(), point, rpcPointValidation_cfi::recHit, mps_fire::result, RPCGeometry::roll(), MuonSubdetId::RPC, susybsm::HSCParticle::setRpc(), findQualityFiles::size, command_line::start, GeomDet::surface(), and HLT_FULL_cff::track.

◆ algo()

void BetaCalculatorRPC::algo ( const std::vector< susybsm::RPCHit4D > &  HSCPRPCRecHits)

Definition at line 9 of file BetaCalculatorRPC.cc.

9  {
10  std::vector<susybsm::RPCHit4D> HSCPRPCRecHits = uHSCPRPCRecHits;
11  int lastbx = -7;
12  bool outOfTime = false;
13  bool increasing = true;
14  bool anydifferentzero = true;
15  bool anydifferentone = true;
16 
17  //std::cout<<"Inside BetaCalculatorRPC \t \t Preliminar loop on the RPCHit4D!!!"<<std::endl;
18 
19  std::sort(HSCPRPCRecHits.begin(), HSCPRPCRecHits.end()); //Organizing them
20 
21  for (std::vector<susybsm::RPCHit4D>::iterator point = HSCPRPCRecHits.begin(); point < HSCPRPCRecHits.end(); ++point) {
22  outOfTime |= (point->bx != 0); //condition 1: at least one measurement must have BX!=0
23  increasing &= (point->bx >= lastbx); //condition 2: BX must be increase when going inside-out.
24  anydifferentzero &= (!(point->bx == 0)); //to check one knee withoutzeros
25  anydifferentone &= (!(point->bx == 1)); //to check one knee withoutones
26  lastbx = point->bx;
27  //float r=point->gp.mag();
28  //std::cout<<"Inside BetaCalculatorRPC \t \t r="<<r<<" phi="<<point->gp.phi()<<" eta="<<point->gp.eta()<<" bx="<<point->bx<<" outOfTime"<<outOfTime<<" increasing"<<increasing<<" anydifferentzero"<<anydifferentzero<<std::endl;
29  }
30 
31  bool Candidate = (outOfTime && increasing);
32 
33  // here we should get some pattern-based estimate
34 
35  //Counting knees
36 
37  float delay = 12.5;
38  lastbx = -7; //already declared for the preliminar loop
39  int knees = 0;
40  float maginknee = 0;
41  float maginfirstknee = 0;
42  for (std::vector<susybsm::RPCHit4D>::iterator point = HSCPRPCRecHits.begin(); point < HSCPRPCRecHits.end(); ++point) {
43  if (lastbx == -7) {
44  maginfirstknee = point->gp.mag();
45  } else if ((lastbx != point->bx)) {
46  //std::cout<<"Inside BetaCalculatorRPC \t \t \t one knee between"<<lastbx<<point->bx<<std::endl;
47  maginknee = point->gp.mag();
48  knees++;
49  }
50  lastbx = point->bx;
51  }
52 
53  if (knees == 0) {
54  //std::cout<<"Inside BetaCalculatorRPC \t \t \t \t knees="<<knees<<std::endl;
55  betavalue = maginfirstknee / (25. - delay + maginfirstknee / 30.) / 30.;
56  } else if (knees == 1) {
57  float betavalue1 = 0;
58  float betavalue2 = 0;
59  //std::cout<<"Inside BetaCalculatorRPC \t \t \t \t knees="<<knees<<std::endl;
60  //std::cout<<"Inside BetaCalculatorRPC \t \t \t \t anydifferentzero="<<anydifferentzero<<" anydifferentone="<<anydifferentone<<std::endl;
61  if (!anydifferentzero) {
62  betavalue = maginknee / (25 - delay + maginknee / 30.) / 30.;
63  } else if (!anydifferentone) { //i.e non zeros and no ones
64  betavalue = maginknee / (50 - delay + maginknee / 30.) / 30.;
65  } else {
66  betavalue1 = maginknee / (25 - delay + maginknee / 30.) / 30.;
67  float dr = (maginknee - maginfirstknee);
68  betavalue2 = dr / (25. - delay + dr / 30.);
69  //std::cout<<"Inside BetaCalculatorRPC \t \t \t \t \t not zero neither ones betavalue1="<<betavalue1<<" betavalue2="<<betavalue2<<std::endl;
70  betavalue = (betavalue1 + betavalue2) * 0.5;
71  }
72  } else if (knees == 2) {
73  //std::cout<<"Inside BetaCalculatorRPC \t \t \t \t knees="<<knees<<std::endl;
74  knees = 0;
75  float betavalue1 = 0;
76  float betavalue2 = 0;
77  lastbx = -7;
78  //std::cout<<"Inside BetaCalculatorRPC \t \t \t \t looping again on the RPCRecHits4D="<<knees<<std::endl;
79  for (std::vector<susybsm::RPCHit4D>::iterator point = HSCPRPCRecHits.begin(); point < HSCPRPCRecHits.end();
80  ++point) {
81  if (lastbx == -7) {
82  maginfirstknee = point->gp.mag();
83  } else if ((lastbx != point->bx)) {
84  //std::cout<<"Inside BetaCalculatorRPC \t \t \t \t \t one knee between"<<lastbx<<point->bx<<std::endl;
85  knees++;
86  if (knees == 2) {
87  float maginsecondknee = point->gp.mag();
88  betavalue1 = maginknee / (25 - delay + maginknee / 30.) / 30.;
89  float dr = (maginknee - maginsecondknee);
90  betavalue2 = dr / (25. + dr / 30.);
91  //std::cout<<"Inside BetaCalculatorRPC \t \t \t \t \t betavalue1="<<betavalue1<<" betavalue2="<<betavalue2<<std::endl;
92  }
93  }
94  lastbx = point->bx;
95  }
96  betavalue = (betavalue1 + betavalue2) * 0.5;
97  }
98 
99  if (Candidate) {
100  //std::cout<<"Inside BetaCalculatorRPC \t \t \t yes! We found an HSCPs let's try to estimate beta"<<std::endl;
101  } else {
102  //std::cout<<"Inside BetaCalculatorRPC \t \t \t seems that there is no RPC HSCP Candidate in the set of RPC4DHit"<<std::endl;
103  betavalue = 1.;
104  }
105 
106  if (HSCPRPCRecHits.empty()) {
107  //std::cout<<"Inside BetaCalculatorRPC \t WARINNG EMPTY RPC4DRecHits CONTAINER!!!"<<std::endl;
108  betavalue = 1.;
109  }
110 }

References configurableAnalysis::Candidate, phase2TrackerDigitizer_cfi::delay, flavorHistoryFilter_cfi::dr, and point.

◆ beta()

float BetaCalculatorRPC::beta ( )
inline

Definition at line 34 of file BetaCalculatorRPC.h.

34 { return betavalue; }

References betavalue.

◆ dist()

float BetaCalculatorRPC::dist ( float  phi1,
float  phi2 
)
private

◆ dist3()

float BetaCalculatorRPC::dist3 ( float  phi1,
float  phi2,
float  phi3 
)
private

◆ etarange()

float BetaCalculatorRPC::etarange ( float  eta1,
float  eta2,
float  eta3 
)
private

Member Data Documentation

◆ betavalue

float BetaCalculatorRPC::betavalue
private

Definition at line 40 of file BetaCalculatorRPC.h.

Referenced by beta().

◆ etavalue

float BetaCalculatorRPC::etavalue
private

Definition at line 39 of file BetaCalculatorRPC.h.

◆ foundvalue

bool BetaCalculatorRPC::foundvalue
private

Definition at line 37 of file BetaCalculatorRPC.h.

◆ phivalue

float BetaCalculatorRPC::phivalue
private

Definition at line 38 of file BetaCalculatorRPC.h.

◆ rpcRecHitsToken

edm::EDGetTokenT<RPCRecHitCollection> BetaCalculatorRPC::rpcRecHitsToken
private

Definition at line 46 of file BetaCalculatorRPC.h.

RPCRoll
Definition: RPCRoll.h:12
start
Definition: start.py:1
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
configurableAnalysis::Candidate
char Candidate[]
Definition: modules.cc:20
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
susybsm::HSCParticle::hasMuonRef
bool hasMuonRef() const
Definition: HSCParticle.h:48
RPCDetId
Definition: RPCDetId.h:16
RPCGeometry::roll
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
edm::Handle< RPCRecHitCollection >
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
susybsm::RPCHit4D
Definition: HSCParticle.h:23
RPCRecHitCollection
RPCRecHit
Definition: RPCRecHit.h:14
reco::Track
Definition: Track.h:27
edm::ESHandle< RPCGeometry >
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
susybsm::RPCHit4D::id
int id
Definition: HSCParticle.h:25
Point3DBase< float, LocalTag >
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
susybsm::RPCHit4D::bx
int bx
Definition: HSCParticle.h:26
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
susybsm::HSCParticle::setRpc
void setRpc(const RPCBetaMeasurement &data)
Definition: HSCParticle.h:60
edm::RangeMap::const_iterator
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
iEvent
int iEvent
Definition: GenABIO.cc:224
susybsm::HSCParticle::muonRef
reco::MuonRef muonRef() const
Definition: HSCParticle.h:66
get
#define get
BetaCalculatorRPC::betavalue
float betavalue
Definition: BetaCalculatorRPC.h:40
BetaCalculatorRPC::beta
float beta()
Definition: BetaCalculatorRPC.h:34
BetaCalculatorRPC::rpcRecHitsToken
edm::EDGetTokenT< RPCRecHitCollection > rpcRecHitsToken
Definition: BetaCalculatorRPC.h:46
MuonSubdetId::RPC
static constexpr int RPC
Definition: MuonSubdetId.h:13
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
BoundPlane
susybsm::RPCBetaMeasurement
Definition: HSCParticle.h:31
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
susybsm::RPCHit4D::gp
GlobalPoint gp
Definition: HSCParticle.h:27
mps_fire.result
result
Definition: mps_fire.py:311
phase2TrackerDigitizer_cfi.delay
delay
Definition: phase2TrackerDigitizer_cfi.py:49
DetId::Muon
Definition: DetId.h:26
command_line.start
start
Definition: command_line.py:167
BetaCalculatorRPC::algo
void algo(const std::vector< susybsm::RPCHit4D > &HSCPRPCRecHits)
Definition: BetaCalculatorRPC.cc:9
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
edm::InputTag
Definition: InputTag.h:15
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443