CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
CSCHaloAlgo Class Reference

#include <CSCHaloAlgo.h>

Public Member Functions

reco::CSCHaloData Calculate (const CSCGeometry &TheCSCGeometry, edm::Handle< reco::MuonCollection > &TheCosmicMuons, const edm::Handle< reco::MuonTimeExtraMap > TheCSCTimeMap, edm::Handle< reco::MuonCollection > &TheMuons, edm::Handle< CSCSegmentCollection > &TheCSCSegments, edm::Handle< CSCRecHit2DCollection > &TheCSCRecHits, edm::Handle< L1MuGMTReadoutCollection > &TheL1GMTReadout, edm::Handle< HBHERecHitCollection > &hbhehits, edm::Handle< EcalRecHitCollection > &ecalebhits, edm::Handle< EcalRecHitCollection > &ecaleehits, edm::Handle< edm::TriggerResults > &TheHLTResults, const edm::TriggerNames *triggerNames, const edm::Handle< CSCALCTDigiCollection > &TheALCTs, MuonSegmentMatcher *TheMatcher, const edm::Event &TheEvent, const edm::EventSetup &TheEventSetup)
 
 CSCHaloAlgo (edm::ConsumesCollector iC)
 
void SetDetaThreshold (float x)
 
void SetDphiThreshold (float x)
 
void SetExpectedBX (int x)
 
void SetMatchingDEtaThreshold (float x)
 
void SetMatchingDPhiThreshold (float x)
 
void SetMatchingDWireThreshold (int x)
 
void SetMaxDtMuonSegment (float x)
 
void SetMaxFreeInverseBeta (float x)
 
void SetMaxSegmentPhiDiff (float x)
 
void SetMaxSegmentRDiff (float x)
 
void SetMaxSegmentTheta (float x)
 
void SetMinMaxInnerRadius (float min, float max)
 
void SetMinMaxOuterMomentumTheta (float min, float max)
 
void SetMinMaxOuterRadius (float min, float max)
 
void SetNormChi2Threshold (float x)
 
void SetRecHitTime0 (float x)
 
void SetRecHitTimeWindow (float x)
 
 ~CSCHaloAlgo ()
 

Public Attributes

std::vector< edm::InputTagvIT_HLTBit
 

Private Member Functions

bool ECALSegmentMatching (edm::Handle< EcalRecHitCollection > &rechitcoll, float et_thresh_rh, float dphi_thresh_segvsrh, float dr_lowthresh_segvsrh, float dr_highthresh_segvsrh, float dt_lowthresh_segvsrh, float dt_highthresh_segvsrh, float iZ, float iR, float iT, float iPhi)
 
math::XYZPoint getPosition (const DetId &id, reco::Vertex::Point vtx)
 
bool HCALSegmentMatching (edm::Handle< HBHERecHitCollection > &rechitcoll, float et_thresh_rh, float dphi_thresh_segvsrh, float dr_lowthresh_segvsrh, float dr_highthresh_segvsrh, float dt_lowthresh_segvsrh, float dt_highthresh_segvsrh, float iZ, float iR, float iT, float iPhi)
 

Private Attributes

float deta_threshold
 
float dphi_thresh_segvsrh_eb
 
float dphi_thresh_segvsrh_ee
 
float dphi_thresh_segvsrh_hbhe
 
float dphi_threshold
 
float dr_highthresh_segvsrh_eb
 
float dr_highthresh_segvsrh_ee
 
float dr_highthresh_segvsrh_hbhe
 
float dr_lowthresh_segvsrh_eb
 
float dr_lowthresh_segvsrh_ee
 
float dr_lowthresh_segvsrh_hbhe
 
float dt_highthresh_segvsrh_eb
 
float dt_highthresh_segvsrh_ee
 
float dt_highthresh_segvsrh_hbhe
 
float dt_lowthresh_segvsrh_eb
 
float dt_lowthresh_segvsrh_ee
 
float dt_lowthresh_segvsrh_hbhe
 
float et_thresh_rh_eb
 
float et_thresh_rh_ee
 
float et_thresh_rh_hbhe
 
int expected_BX
 
const CaloGeometrygeo_
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
geoToken_
 
const HcalGeometryhgeo_
 
float matching_deta_threshold
 
float matching_dphi_threshold
 
int matching_dwire_threshold
 
float max_dt_muon_segment
 
float max_free_inverse_beta
 
float max_inner_radius
 
float max_outer_radius
 
float max_outer_theta
 
float max_segment_phi_diff
 
float max_segment_r_diff
 
float max_segment_theta
 
float min_inner_radius
 
float min_outer_radius
 
float min_outer_theta
 
float norm_chi2_threshold
 
float recHit_t0
 
float recHit_twindow
 

Detailed Description

Definition at line 90 of file CSCHaloAlgo.h.

Constructor & Destructor Documentation

CSCHaloAlgo::CSCHaloAlgo ( edm::ConsumesCollector  iC)

Definition at line 17 of file CSCHaloAlgo.cc.

References deta_threshold, dphi_thresh_segvsrh_eb, dphi_thresh_segvsrh_ee, dphi_thresh_segvsrh_hbhe, dphi_threshold, dr_highthresh_segvsrh_eb, dr_highthresh_segvsrh_ee, dr_highthresh_segvsrh_hbhe, dr_lowthresh_segvsrh_eb, dr_lowthresh_segvsrh_ee, dr_lowthresh_segvsrh_hbhe, dt_highthresh_segvsrh_eb, dt_highthresh_segvsrh_ee, dt_highthresh_segvsrh_hbhe, dt_lowthresh_segvsrh_eb, dt_lowthresh_segvsrh_ee, dt_lowthresh_segvsrh_hbhe, et_thresh_rh_eb, et_thresh_rh_ee, et_thresh_rh_hbhe, expected_BX, matching_deta_threshold, matching_dphi_threshold, matching_dwire_threshold, max_dt_muon_segment, max_free_inverse_beta, max_inner_radius, max_outer_radius, max_outer_theta, min_inner_radius, min_outer_radius, min_outer_theta, norm_chi2_threshold, Pi, recHit_t0, and recHit_twindow.

17  : geoToken_(iC.esConsumes()), geo_(nullptr), hgeo_(nullptr) {
18  deta_threshold = 0.;
19  min_inner_radius = 0.;
20  max_inner_radius = 9999.;
21  min_outer_radius = 0.;
22  max_outer_radius = 9999.;
23  dphi_threshold = 999.;
24  norm_chi2_threshold = 999.;
25  recHit_t0 = 0.;
26  recHit_twindow = 25.;
27  expected_BX = 3;
28  max_dt_muon_segment = -10.0;
30 
31  min_outer_theta = 0.;
33 
34  matching_dphi_threshold = 0.18; //radians
37 
38  et_thresh_rh_hbhe = 25; //GeV
39  et_thresh_rh_ee = 10;
40  et_thresh_rh_eb = 10;
41 
42  dphi_thresh_segvsrh_hbhe = 0.05; //radians
45 
46  dr_lowthresh_segvsrh_hbhe = -20; //cm
49 
53 
57 
61 }
float recHit_t0
Definition: CSCHaloAlgo.h:153
const double Pi
float dt_lowthresh_segvsrh_hbhe
Definition: CSCHaloAlgo.h:166
float et_thresh_rh_ee
Definition: CSCHaloAlgo.h:170
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geoToken_
Definition: CSCHaloAlgo.h:173
float min_outer_radius
Definition: CSCHaloAlgo.h:149
float recHit_twindow
Definition: CSCHaloAlgo.h:154
float max_outer_radius
Definition: CSCHaloAlgo.h:150
float et_thresh_rh_hbhe
Definition: CSCHaloAlgo.h:166
float dr_lowthresh_segvsrh_hbhe
Definition: CSCHaloAlgo.h:166
float dr_highthresh_segvsrh_ee
Definition: CSCHaloAlgo.h:170
float dt_highthresh_segvsrh_eb
Definition: CSCHaloAlgo.h:168
float dphi_threshold
Definition: CSCHaloAlgo.h:151
float dt_highthresh_segvsrh_hbhe
Definition: CSCHaloAlgo.h:166
float deta_threshold
Definition: CSCHaloAlgo.h:144
float max_inner_radius
Definition: CSCHaloAlgo.h:148
float min_outer_theta
Definition: CSCHaloAlgo.h:146
float matching_dphi_threshold
Definition: CSCHaloAlgo.h:156
float matching_deta_threshold
Definition: CSCHaloAlgo.h:157
const CaloGeometry * geo_
Definition: CSCHaloAlgo.h:174
float dr_lowthresh_segvsrh_ee
Definition: CSCHaloAlgo.h:170
float dt_lowthresh_segvsrh_ee
Definition: CSCHaloAlgo.h:170
float max_outer_theta
Definition: CSCHaloAlgo.h:145
float max_dt_muon_segment
Definition: CSCHaloAlgo.h:159
float dphi_thresh_segvsrh_ee
Definition: CSCHaloAlgo.h:170
float dt_highthresh_segvsrh_ee
Definition: CSCHaloAlgo.h:170
float et_thresh_rh_eb
Definition: CSCHaloAlgo.h:168
float dphi_thresh_segvsrh_hbhe
Definition: CSCHaloAlgo.h:166
const HcalGeometry * hgeo_
Definition: CSCHaloAlgo.h:175
float min_inner_radius
Definition: CSCHaloAlgo.h:147
float dr_highthresh_segvsrh_hbhe
Definition: CSCHaloAlgo.h:166
float max_free_inverse_beta
Definition: CSCHaloAlgo.h:160
int matching_dwire_threshold
Definition: CSCHaloAlgo.h:158
float norm_chi2_threshold
Definition: CSCHaloAlgo.h:152
float dt_lowthresh_segvsrh_eb
Definition: CSCHaloAlgo.h:168
float dr_highthresh_segvsrh_eb
Definition: CSCHaloAlgo.h:168
float dr_lowthresh_segvsrh_eb
Definition: CSCHaloAlgo.h:168
float dphi_thresh_segvsrh_eb
Definition: CSCHaloAlgo.h:168
CSCHaloAlgo::~CSCHaloAlgo ( )
inline

Definition at line 93 of file CSCHaloAlgo.h.

93 {}

Member Function Documentation

reco::CSCHaloData CSCHaloAlgo::Calculate ( const CSCGeometry TheCSCGeometry,
edm::Handle< reco::MuonCollection > &  TheCosmicMuons,
const edm::Handle< reco::MuonTimeExtraMap TheCSCTimeMap,
edm::Handle< reco::MuonCollection > &  TheMuons,
edm::Handle< CSCSegmentCollection > &  TheCSCSegments,
edm::Handle< CSCRecHit2DCollection > &  TheCSCRecHits,
edm::Handle< L1MuGMTReadoutCollection > &  TheL1GMTReadout,
edm::Handle< HBHERecHitCollection > &  hbhehits,
edm::Handle< EcalRecHitCollection > &  ecalebhits,
edm::Handle< EcalRecHitCollection > &  ecaleehits,
edm::Handle< edm::TriggerResults > &  TheHLTResults,
const edm::TriggerNames triggerNames,
const edm::Handle< CSCALCTDigiCollection > &  TheALCTs,
MuonSegmentMatcher TheMatcher,
const edm::Event TheEvent,
const edm::EventSetup TheEventSetup 
)

Definition at line 63 of file CSCHaloAlgo.cc.

References funct::abs(), PV3DBase< T, PVType, FrameType >::barePhi(), CSCGeometry::chamber(), chambers, MuonSubdetId::CSC, CSCDetId, srCondWrite_cfg::deltaPhi, deta_threshold, dphi_thresh_segvsrh_eb, dphi_thresh_segvsrh_ee, dphi_thresh_segvsrh_hbhe, dphi_threshold, dr_highthresh_segvsrh_eb, dr_highthresh_segvsrh_ee, dr_highthresh_segvsrh_hbhe, dr_lowthresh_segvsrh_eb, dr_lowthresh_segvsrh_ee, dr_lowthresh_segvsrh_hbhe, dt_highthresh_segvsrh_eb, dt_highthresh_segvsrh_ee, dt_highthresh_segvsrh_hbhe, dt_lowthresh_segvsrh_eb, dt_lowthresh_segvsrh_ee, dt_lowthresh_segvsrh_hbhe, ECALSegmentMatching(), et_thresh_rh_eb, et_thresh_rh_ee, et_thresh_rh_hbhe, PV3DBase< T, PVType, FrameType >::eta(), reco::MuonTimeExtra::freeInverseBeta(), geo_, geoToken_, reco::CSCHaloData::GetCSCTrackImpactPositions(), edm::EventSetup::getData(), CaloGeometry::getSubdetectorGeometry(), reco::CSCHaloData::GetTracks(), DetId::Hcal, HCALSegmentMatching(), hgeo_, CSCGeometry::idToDetUnit(), edm::HandleBase::isValid(), dqmiolumiharvest::j, PV3DBase< T, PVType, FrameType >::mag2(), MuonSegmentMatcher::matchCSC(), max_dt_muon_segment, max_free_inverse_beta, max_inner_radius, max_outer_radius, max_outer_theta, max_segment_phi_diff, max_segment_r_diff, max_segment_theta, min_inner_radius, min_outer_radius, min_outer_theta, RPCpg::mu, DetId::Muon, norm_chi2_threshold, PV3DBase< T, PVType, FrameType >::phi(), Pi, edm::RefVector< C, T, F >::push_back(), recHit_t0, recHit_twindow, reco::CSCHaloData::SetHLTBit(), reco::CSCHaloData::SetNFlatHaloSegments(), reco::CSCHaloData::SetNFlatHaloSegments_TrkMuUnVeto(), reco::CSCHaloData::SetNIncomingTracks(), reco::CSCHaloData::SetNOutOfTimeHits(), reco::CSCHaloData::SetNOutOfTimeTriggers(), reco::CSCHaloData::SetNumberOfHaloTriggers(), reco::CSCHaloData::SetNumberOfHaloTriggers_TrkMuUnVeto(), reco::CSCHaloData::SetSegmentIsCaloMatched(), reco::CSCHaloData::SetSegmentIsEBCaloMatched(), reco::CSCHaloData::SetSegmentIsEECaloMatched(), reco::CSCHaloData::SetSegmentIsHCaloMatched(), reco::CSCHaloData::SetSegmentsBothEndcaps(), reco::CSCHaloData::SetSegmentsBothEndcaps_Loose_dTcut_TrkMuUnVeto(), reco::CSCHaloData::SetSegmentsBothEndcaps_Loose_TrkMuUnVeto(), mathSSE::sqrt(), GeomDet::surface(), PV3DBase< T, PVType, FrameType >::theta(), theta(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by reco::CSCHaloDataProducer::produce().

78  {
79  reco::CSCHaloData TheCSCHaloData;
80  int imucount = 0;
81 
82  bool calomatched = false;
83  bool ECALBmatched = false;
84  bool ECALEmatched = false;
85  bool HCALmatched = false;
86 
87  geo_ = &TheSetup.getData(geoToken_);
88  hgeo_ = dynamic_cast<const HcalGeometry*>(geo_->getSubdetectorGeometry(DetId::Hcal, 1));
89 
90  //}
91  bool trkmuunvetoisdefault = false; //Pb with low pt tracker muons that veto good csc segments/halo triggers.
92  //Test to "unveto" low pt trk muons.
93  //For now, we just recalculate everything without the veto and add an extra set of variables to the class CSCHaloData.
94  //If this is satisfactory, these variables can become the default ones by setting trkmuunvetoisdefault to true.
95  if (TheCosmicMuons.isValid()) {
96  short int n_tracks_small_beta = 0;
97  short int n_tracks_small_dT = 0;
98  short int n_tracks_small_dT_and_beta = 0;
99  for (reco::MuonCollection::const_iterator iMuon = TheCosmicMuons->begin(); iMuon != TheCosmicMuons->end();
100  iMuon++, imucount++) {
101  reco::TrackRef Track = iMuon->outerTrack();
102  if (!Track)
103  continue;
104 
105  bool StoreTrack = false;
106  // Calculate global phi coordinate for central most rechit in the track
107  float innermost_global_z = 1500.;
108  float outermost_global_z = 0.;
109  GlobalPoint InnerMostGlobalPosition(0., 0., 0.); // smallest abs(z)
110  GlobalPoint OuterMostGlobalPosition(0., 0., 0.); // largest abs(z)
111  int nCSCHits = 0;
112  for (unsigned int j = 0; j < Track->extra()->recHitsSize(); j++) {
113  auto hit = Track->extra()->recHitRef(j);
114  if (!hit->isValid())
115  continue;
116  DetId TheDetUnitId(hit->geographicalId());
117  if (TheDetUnitId.det() != DetId::Muon)
118  continue;
119  if (TheDetUnitId.subdetId() != MuonSubdetId::CSC)
120  continue;
121 
122  const GeomDetUnit* TheUnit = TheCSCGeometry.idToDetUnit(TheDetUnitId);
123  LocalPoint TheLocalPosition = hit->localPosition();
124  const BoundPlane& TheSurface = TheUnit->surface();
125  const GlobalPoint TheGlobalPosition = TheSurface.toGlobal(TheLocalPosition);
126 
127  float z = TheGlobalPosition.z();
128  if (abs(z) < innermost_global_z) {
129  innermost_global_z = abs(z);
130  InnerMostGlobalPosition = GlobalPoint(TheGlobalPosition);
131  }
132  if (abs(z) > outermost_global_z) {
133  outermost_global_z = abs(z);
134  OuterMostGlobalPosition = GlobalPoint(TheGlobalPosition);
135  }
136  nCSCHits++;
137  }
138 
139  std::vector<const CSCSegment*> MatchedSegments = TheMatcher->matchCSC(*Track, TheEvent);
140  // Find the inner and outer segments separately in case they don't agree completely with recHits
141  // Plan for the possibility segments in both endcaps
142  float InnerSegmentTime[2] = {0, 0};
143  float OuterSegmentTime[2] = {0, 0};
144  float innermost_seg_z[2] = {1500, 1500};
145  float outermost_seg_z[2] = {0, 0};
146  for (std::vector<const CSCSegment*>::const_iterator segment = MatchedSegments.begin();
147  segment != MatchedSegments.end();
148  ++segment) {
149  CSCDetId TheCSCDetId((*segment)->cscDetId());
150  const CSCChamber* TheCSCChamber = TheCSCGeometry.chamber(TheCSCDetId);
151  LocalPoint TheLocalPosition = (*segment)->localPosition();
152  const GlobalPoint TheGlobalPosition = TheCSCChamber->toGlobal(TheLocalPosition);
153  float z = TheGlobalPosition.z();
154  int TheEndcap = TheCSCDetId.endcap();
155  if (abs(z) < innermost_seg_z[TheEndcap - 1]) {
156  innermost_seg_z[TheEndcap - 1] = abs(z);
157  InnerSegmentTime[TheEndcap - 1] = (*segment)->time();
158  }
159  if (abs(z) > outermost_seg_z[TheEndcap - 1]) {
160  outermost_seg_z[TheEndcap - 1] = abs(z);
161  OuterSegmentTime[TheEndcap - 1] = (*segment)->time();
162  }
163  }
164 
165  if (nCSCHits < 3)
166  continue; // This needs to be optimized, but is the minimum
167 
168  float dT_Segment = 0; // default safe value, looks like collision muon
169 
170  if (innermost_seg_z[0] < outermost_seg_z[0]) // two segments in ME+
171  dT_Segment = OuterSegmentTime[0] - InnerSegmentTime[0];
172  if (innermost_seg_z[1] < outermost_seg_z[1]) // two segments in ME-
173  {
174  // replace the measurement if there weren't segments in ME+ or
175  // if the track in ME- has timing more consistent with an incoming particle
176  if (dT_Segment == 0.0 || OuterSegmentTime[1] - InnerSegmentTime[1] < dT_Segment)
177  dT_Segment = OuterSegmentTime[1] - InnerSegmentTime[1];
178  }
179 
180  if (OuterMostGlobalPosition.x() == 0. || OuterMostGlobalPosition.y() == 0. || OuterMostGlobalPosition.z() == 0.)
181  continue;
182  if (InnerMostGlobalPosition.x() == 0. || InnerMostGlobalPosition.y() == 0. || InnerMostGlobalPosition.z() == 0.)
183  continue;
184 
185  //Its a CSC Track,store it if it passes halo selection
186  StoreTrack = true;
187 
188  float deta = abs(OuterMostGlobalPosition.eta() - InnerMostGlobalPosition.eta());
189  float dphi = abs(deltaPhi(OuterMostGlobalPosition.barePhi(), InnerMostGlobalPosition.barePhi()));
190  float theta = Track->outerMomentum().theta();
191  float innermost_x = InnerMostGlobalPosition.x();
192  float innermost_y = InnerMostGlobalPosition.y();
193  float outermost_x = OuterMostGlobalPosition.x();
194  float outermost_y = OuterMostGlobalPosition.y();
195  float innermost_r = TMath::Sqrt(innermost_x * innermost_x + innermost_y * innermost_y);
196  float outermost_r = TMath::Sqrt(outermost_x * outermost_x + outermost_y * outermost_y);
197 
198  if (deta < deta_threshold)
199  StoreTrack = false;
200  if (theta > min_outer_theta && theta < max_outer_theta)
201  StoreTrack = false;
202  if (dphi > dphi_threshold)
203  StoreTrack = false;
204  if (innermost_r < min_inner_radius)
205  StoreTrack = false;
206  if (innermost_r > max_inner_radius)
207  StoreTrack = false;
208  if (outermost_r < min_outer_radius)
209  StoreTrack = false;
210  if (outermost_r > max_outer_radius)
211  StoreTrack = false;
212  if (Track->normalizedChi2() > norm_chi2_threshold)
213  StoreTrack = false;
214 
215  if (StoreTrack) {
216  TheCSCHaloData.GetCSCTrackImpactPositions().push_back(InnerMostGlobalPosition);
217  TheCSCHaloData.GetTracks().push_back(Track);
218  }
219 
220  // Analyze the MuonTimeExtra information
221  if (TheCSCTimeMap.isValid()) {
222  reco::MuonRef muonR(TheCosmicMuons, imucount);
223  const reco::MuonTimeExtraMap& timeMapCSC = *TheCSCTimeMap;
224  reco::MuonTimeExtra timecsc = timeMapCSC[muonR];
225  float freeInverseBeta = timecsc.freeInverseBeta();
226 
227  if (dT_Segment < max_dt_muon_segment)
228  n_tracks_small_dT++;
229  if (freeInverseBeta < max_free_inverse_beta)
230  n_tracks_small_beta++;
231  if ((dT_Segment < max_dt_muon_segment) && (freeInverseBeta < max_free_inverse_beta))
232  n_tracks_small_dT_and_beta++;
233  } else {
234  static std::atomic<bool> MuonTimeFail{false};
235  bool expected = false;
236  if (MuonTimeFail.compare_exchange_strong(expected, true, std::memory_order_acq_rel)) {
237  edm::LogWarning("InvalidInputTag")
238  << "The MuonTimeExtraMap does not appear to be in the event. Some beam halo "
239  << " identification variables will be empty";
240  }
241  }
242  }
243  TheCSCHaloData.SetNIncomingTracks(n_tracks_small_dT, n_tracks_small_beta, n_tracks_small_dT_and_beta);
244  } else // collection is invalid
245  {
246  static std::atomic<bool> CosmicFail{false};
247  bool expected = false;
248  if (CosmicFail.compare_exchange_strong(expected, true, std::memory_order_acq_rel)) {
249  edm::LogWarning("InvalidInputTag")
250  << " The Cosmic Muon collection does not appear to be in the event. These beam halo "
251  << " identification variables will be empty";
252  }
253  }
254 
255  // Loop over the CSCRecHit2D collection to look for out-of-time recHits
256  // Out-of-time is defined as tpeak outside [t_0 + TOF - t_window, t_0 + TOF + t_window]
257  // where t_0 and t_window are configurable parameters
258  short int n_recHitsP = 0;
259  short int n_recHitsM = 0;
260  if (TheCSCRecHits.isValid()) {
262  for (dRHIter = TheCSCRecHits->begin(); dRHIter != TheCSCRecHits->end(); dRHIter++) {
263  if (!((*dRHIter).isValid()))
264  continue; // only interested in valid hits
265  CSCDetId idrec = (CSCDetId)(*dRHIter).cscDetId();
266  float RHTime = (*dRHIter).tpeak();
267  LocalPoint rhitlocal = (*dRHIter).localPosition();
268  const CSCChamber* chamber = TheCSCGeometry.chamber(idrec);
269  GlobalPoint globalPosition = chamber->toGlobal(rhitlocal);
270  float globZ = globalPosition.z();
271  if (RHTime < (recHit_t0 - recHit_twindow)) {
272  if (globZ > 0)
273  n_recHitsP++;
274  else
275  n_recHitsM++;
276  }
277 
278  /*
279 
280  float globX = globalPosition.x();
281  float globY = globalPosition.y();
282  float globZ = globalPosition.z();
283  float TOF = (sqrt(globX*globX+ globY*globY + globZ*globZ))/29.9792458 ; //cm -> ns
284  if ( (RHTime < (recHit_t0 + TOF - recHit_twindow)) || (RHTime > (recHit_t0 + TOF + recHit_twindow)) )
285  {
286  if( globZ > 0 )
287  n_recHitsP++;
288  else
289  n_recHitsM++;
290  }
291  */
292  }
293  } else {
294  static std::atomic<bool> RecHitFail{false};
295  bool expected = false;
296  if (RecHitFail.compare_exchange_strong(expected, true, std::memory_order_acq_rel)) {
297  edm::LogWarning("InvalidInputTag")
298  << "The requested CSCRecHit2DCollection does not appear to be in the event. The CSC RecHit "
299  << " variables used for halo identification will not be calculated or stored";
300  }
301  }
302  TheCSCHaloData.SetNOutOfTimeHits(n_recHitsP + n_recHitsM);
303  // MLR
304  // Loop through CSCSegments and count the number of "flat" segments with the same (r,phi),
305  // saving the value in TheCSCHaloData.
306  short int maxNSegments = 0;
307  bool plus_endcap = false;
308  bool minus_endcap = false;
309  bool both_endcaps = false;
310  bool both_endcaps_loose = false;
311  // bool both_endcaps_dtcut = false;
312 
313  short int maxNSegments_alt = 0;
314  bool both_endcaps_alt = false;
315  bool both_endcaps_loose_alt = false;
316  bool both_endcaps_loose_dtcut_alt = false;
317 
318  //float r = 0., phi = 0.;
319  if (TheCSCSegments.isValid()) {
320  for (CSCSegmentCollection::const_iterator iSegment = TheCSCSegments->begin(); iSegment != TheCSCSegments->end();
321  iSegment++) {
322  CSCDetId iCscDetID = iSegment->cscDetId();
323  bool Segment1IsGood = true;
324  bool Segment1IsGood_alt = true;
325 
326  //avoid segments from collision muons
327  if (TheMuons.isValid()) {
328  for (reco::MuonCollection::const_iterator mu = TheMuons->begin();
329  mu != TheMuons->end() && (Segment1IsGood || !trkmuunvetoisdefault);
330  mu++) {
331  bool lowpttrackmu = false;
332  if (!mu->isTrackerMuon() && !mu->isGlobalMuon() && mu->isStandAloneMuon())
333  continue;
334  if (!mu->isTrackerMuon() && !mu->isGlobalMuon() && mu->isStandAloneMuon() && trkmuunvetoisdefault)
335  continue;
336  if (!mu->isGlobalMuon() && mu->isTrackerMuon() && mu->pt() < 3)
337  lowpttrackmu = true;
338  const std::vector<MuonChamberMatch> chambers = mu->matches();
339  for (std::vector<MuonChamberMatch>::const_iterator kChamber = chambers.begin(); kChamber != chambers.end();
340  kChamber++) {
341  if (kChamber->detector() != MuonSubdetId::CSC)
342  continue;
343  for (std::vector<reco::MuonSegmentMatch>::const_iterator kSegment = kChamber->segmentMatches.begin();
344  kSegment != kChamber->segmentMatches.end();
345  kSegment++) {
346  edm::Ref<CSCSegmentCollection> cscSegRef = kSegment->cscSegmentRef;
347  CSCDetId kCscDetID = cscSegRef->cscDetId();
348 
349  if (kCscDetID == iCscDetID) {
350  Segment1IsGood = false;
351  if (!lowpttrackmu)
352  Segment1IsGood_alt = false;
353  }
354  }
355  }
356  }
357  }
358  if (!Segment1IsGood && !Segment1IsGood_alt)
359  continue;
360 
361  // Get local direction vector; if direction runs parallel to beamline,
362  // count this segment as beam halo candidate.
363  LocalPoint iLocalPosition = iSegment->localPosition();
364  LocalVector iLocalDirection = iSegment->localDirection();
365 
366  GlobalPoint iGlobalPosition = TheCSCGeometry.chamber(iCscDetID)->toGlobal(iLocalPosition);
367  GlobalVector iGlobalDirection = TheCSCGeometry.chamber(iCscDetID)->toGlobal(iLocalDirection);
368 
369  float iTheta = iGlobalDirection.theta();
370  if (iTheta > max_segment_theta && iTheta < TMath::Pi() - max_segment_theta)
371  continue;
372 
373  float iPhi = iGlobalPosition.phi();
374  float iR = TMath::Sqrt(iGlobalPosition.x() * iGlobalPosition.x() + iGlobalPosition.y() * iGlobalPosition.y());
375  float iZ = iGlobalPosition.z();
376  float iT = iSegment->time();
377 
378  // if(abs(iZ)<650&& TheEvent.id().run()< 251737) iT-= 25;
379  //Calo matching:
380 
381  bool hbhematched = HCALSegmentMatching(hbhehits,
388  iZ,
389  iR,
390  iT,
391  iPhi);
392  bool ebmatched = ECALSegmentMatching(ecalebhits,
399  iZ,
400  iR,
401  iT,
402  iPhi);
403  bool eematched = ECALSegmentMatching(ecaleehits,
410  iZ,
411  iR,
412  iT,
413  iPhi);
414  calomatched |= (hbhematched || ebmatched || eematched);
415  HCALmatched |= hbhematched;
416  ECALBmatched |= ebmatched;
417  ECALEmatched |= eematched;
418 
419  short int nSegs = 0;
420  short int nSegs_alt = 0;
421  // Changed to loop over all Segments (so N^2) to catch as many segments as possible.
422  for (CSCSegmentCollection::const_iterator jSegment = TheCSCSegments->begin(); jSegment != TheCSCSegments->end();
423  jSegment++) {
424  if (jSegment == iSegment)
425  continue;
426  bool Segment2IsGood = true;
427  bool Segment2IsGood_alt = true;
428  LocalPoint jLocalPosition = jSegment->localPosition();
429  LocalVector jLocalDirection = jSegment->localDirection();
430  CSCDetId jCscDetID = jSegment->cscDetId();
431  GlobalPoint jGlobalPosition = TheCSCGeometry.chamber(jCscDetID)->toGlobal(jLocalPosition);
432  GlobalVector jGlobalDirection = TheCSCGeometry.chamber(jCscDetID)->toGlobal(jLocalDirection);
433  float jTheta = jGlobalDirection.theta();
434  float jPhi = jGlobalPosition.phi();
435  float jR = TMath::Sqrt(jGlobalPosition.x() * jGlobalPosition.x() + jGlobalPosition.y() * jGlobalPosition.y());
436  float jZ = jGlobalPosition.z();
437  float jT = jSegment->time();
438  // if(abs(jZ)<650&& TheEvent.id().run() < 251737)jT-= 25;
439  if (std::abs(deltaPhi(jPhi, iPhi)) <= max_segment_phi_diff &&
440  (std::abs(jR - iR) < 0.05 * std::abs(jZ - iZ) || jZ * iZ > 0) &&
441  ((jR - iR) > -0.02 * std::abs(jZ - iZ) || iT > jT || jZ * iZ > 0) &&
442  ((iR - jR) > -0.02 * std::abs(jZ - iZ) || iT < jT || jZ * iZ > 0) &&
443  (std::abs(jR - iR) <= max_segment_r_diff || jZ * iZ < 0) &&
444  (jTheta < max_segment_theta || jTheta > TMath::Pi() - max_segment_theta)) {
446  if (TheMuons.isValid()) {
447  for (reco::MuonCollection::const_iterator mu = TheMuons->begin();
448  mu != TheMuons->end() && (Segment2IsGood || !trkmuunvetoisdefault);
449  mu++) {
450  bool lowpttrackmu = false;
451  if (!mu->isTrackerMuon() && !mu->isGlobalMuon() && mu->isStandAloneMuon())
452  continue;
453  if (!mu->isGlobalMuon() && mu->isTrackerMuon() && mu->pt() < 3)
454  lowpttrackmu = true;
455  const std::vector<MuonChamberMatch> chambers = mu->matches();
456  for (std::vector<MuonChamberMatch>::const_iterator kChamber = chambers.begin();
457  kChamber != chambers.end();
458  kChamber++) {
459  if (kChamber->detector() != MuonSubdetId::CSC)
460  continue;
461  for (std::vector<reco::MuonSegmentMatch>::const_iterator kSegment = kChamber->segmentMatches.begin();
462  kSegment != kChamber->segmentMatches.end();
463  kSegment++) {
464  edm::Ref<CSCSegmentCollection> cscSegRef = kSegment->cscSegmentRef;
465  CSCDetId kCscDetID = cscSegRef->cscDetId();
466 
467  if (kCscDetID == jCscDetID) {
468  Segment2IsGood = false;
469  if (!lowpttrackmu)
470  Segment2IsGood_alt = false;
471  }
472  }
473  }
474  }
475  }
476  if (Segment1IsGood && Segment2IsGood) {
477  nSegs++;
478  minus_endcap = iGlobalPosition.z() < 0 || jGlobalPosition.z() < 0;
479  plus_endcap = iGlobalPosition.z() > 0 || jGlobalPosition.z() > 0;
480  // if( abs(jT-iT)/sqrt( (jR-iR)*(jR-iR)+(jZ-iZ)*(jZ-iZ) )<0.05 && abs(jT-iT)/sqrt( (jR-iR)*(jR-iR)+(jZ-iZ)*(jZ-iZ) )>0.02 && minus_endcap&&plus_endcap ) both_endcaps_dtcut =true;
481  }
482  if (Segment1IsGood_alt && Segment2IsGood_alt) {
483  nSegs_alt++;
484  minus_endcap = iGlobalPosition.z() < 0 || jGlobalPosition.z() < 0;
485  plus_endcap = iGlobalPosition.z() > 0 || jGlobalPosition.z() > 0;
486  double iTBX = iT + sqrt(iGlobalPosition.mag2()) / c_cm_per_ns;
487  double jTBX = jT + sqrt(jGlobalPosition.mag2()) / c_cm_per_ns;
488  double truedt = (iTBX > jTBX) ? iTBX - jTBX - std::abs(iZ - jZ) / c_cm_per_ns
489  : jTBX - iTBX - std::abs(iZ - jZ) / c_cm_per_ns;
490  if (std::abs(truedt) < 15 && (iT > -15 || jT > -15) && minus_endcap && plus_endcap)
491  both_endcaps_loose_dtcut_alt = true;
492  }
493  }
494  }
495  // Correct the fact that the way nSegs counts will always be short by 1
496  if (nSegs > 0)
497  nSegs++;
498 
499  // The opposite endcaps segments do not need to belong to the longest chain.
500  if (nSegs > 0)
501  both_endcaps_loose = both_endcaps_loose ? both_endcaps_loose : minus_endcap && plus_endcap;
502  if (nSegs_alt > 0)
503  nSegs_alt++;
504  if (nSegs_alt > 0)
505  both_endcaps_loose_alt = both_endcaps_loose_alt ? both_endcaps_loose_alt : minus_endcap && plus_endcap;
506 
507  // if (nSegs > 0) both_endcaps_dt20ns = both_endcaps_dt20ns ? both_endcaps_dt20ns : minus_endcap && plus_endcap &&dt20ns;
508  if (nSegs > maxNSegments) {
509  // Use value of r, phi to collect halo CSCSegments for examining timing (not coded yet...)
510  //r = iR;
511  //phi = iPhi;
512  maxNSegments = nSegs;
513  both_endcaps = both_endcaps ? both_endcaps : minus_endcap && plus_endcap;
514  }
515 
516  if (nSegs_alt > maxNSegments_alt) {
517  maxNSegments_alt = nSegs_alt;
518  both_endcaps_alt = both_endcaps_alt ? both_endcaps_alt : minus_endcap && plus_endcap;
519  }
520  }
521  }
522 
523  //Deprecated methods, kept for backward compatibility
524  TheCSCHaloData.SetHLTBit(false);
525  TheCSCHaloData.SetNumberOfHaloTriggers(0, 0);
526  TheCSCHaloData.SetNumberOfHaloTriggers_TrkMuUnVeto(0, 0);
527  TheCSCHaloData.SetNOutOfTimeTriggers(0, 0);
528 
529  //Current methods used
530  TheCSCHaloData.SetNFlatHaloSegments(maxNSegments);
531  TheCSCHaloData.SetSegmentsBothEndcaps(both_endcaps);
532  TheCSCHaloData.SetNFlatHaloSegments_TrkMuUnVeto(maxNSegments_alt);
533  TheCSCHaloData.SetSegmentsBothEndcaps_Loose_TrkMuUnVeto(both_endcaps_loose_alt);
534  TheCSCHaloData.SetSegmentsBothEndcaps_Loose_dTcut_TrkMuUnVeto(both_endcaps_loose_dtcut_alt);
535  TheCSCHaloData.SetSegmentIsCaloMatched(calomatched);
536  TheCSCHaloData.SetSegmentIsHCaloMatched(HCALmatched);
537  TheCSCHaloData.SetSegmentIsEBCaloMatched(ECALBmatched);
538  TheCSCHaloData.SetSegmentIsEECaloMatched(ECALEmatched);
539 
540  return TheCSCHaloData;
541 }
float recHit_t0
Definition: CSCHaloAlgo.h:153
const double Pi
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
float dt_lowthresh_segvsrh_hbhe
Definition: CSCHaloAlgo.h:166
T mag2() const
Definition: PV3DBase.h:63
float et_thresh_rh_ee
Definition: CSCHaloAlgo.h:170
float max_segment_r_diff
Definition: CSCHaloAlgo.h:162
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geoToken_
Definition: CSCHaloAlgo.h:173
float min_outer_radius
Definition: CSCHaloAlgo.h:149
float recHit_twindow
Definition: CSCHaloAlgo.h:154
float max_outer_radius
Definition: CSCHaloAlgo.h:150
float et_thresh_rh_hbhe
Definition: CSCHaloAlgo.h:166
void SetNFlatHaloSegments_TrkMuUnVeto(short int nSegments)
Definition: CSCHaloData.h:110
float dr_lowthresh_segvsrh_hbhe
Definition: CSCHaloAlgo.h:166
float dr_highthresh_segvsrh_ee
Definition: CSCHaloAlgo.h:170
float dt_highthresh_segvsrh_eb
Definition: CSCHaloAlgo.h:168
float dphi_threshold
Definition: CSCHaloAlgo.h:151
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
float dt_highthresh_segvsrh_hbhe
Definition: CSCHaloAlgo.h:166
void SetSegmentIsEECaloMatched(bool b)
Definition: CSCHaloData.h:118
void SetSegmentsBothEndcaps_Loose_TrkMuUnVeto(bool b)
Definition: CSCHaloData.h:111
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
T y() const
Definition: PV3DBase.h:60
std::vector< const CSCSegment * > matchCSC(const reco::Track &muon, const edm::Event &event)
float deta_threshold
Definition: CSCHaloAlgo.h:144
float max_inner_radius
Definition: CSCHaloAlgo.h:148
float min_outer_theta
Definition: CSCHaloAlgo.h:146
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
float max_segment_phi_diff
Definition: CSCHaloAlgo.h:163
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
const CaloGeometry * geo_
Definition: CSCHaloAlgo.h:174
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
float dr_lowthresh_segvsrh_ee
Definition: CSCHaloAlgo.h:170
float dt_lowthresh_segvsrh_ee
Definition: CSCHaloAlgo.h:170
float max_outer_theta
Definition: CSCHaloAlgo.h:145
float max_dt_muon_segment
Definition: CSCHaloAlgo.h:159
float dphi_thresh_segvsrh_ee
Definition: CSCHaloAlgo.h:170
T sqrt(T t)
Definition: SSEVec.h:19
float dt_highthresh_segvsrh_ee
Definition: CSCHaloAlgo.h:170
void SetSegmentIsCaloMatched(bool b)
Definition: CSCHaloData.h:115
T z() const
Definition: PV3DBase.h:61
float et_thresh_rh_eb
Definition: CSCHaloAlgo.h:168
const std::vector< GlobalPoint > & GetCSCTrackImpactPositions() const
Definition: CSCHaloData.h:100
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void SetSegmentsBothEndcaps(bool b)
Definition: CSCHaloData.h:108
float dphi_thresh_segvsrh_hbhe
Definition: CSCHaloAlgo.h:166
const HcalGeometry * hgeo_
Definition: CSCHaloAlgo.h:175
const int mu
Definition: Constants.h:22
float min_inner_radius
Definition: CSCHaloAlgo.h:147
bool isValid() const
Definition: HandleBase.h:70
void SetHLTBit(bool status)
Definition: CSCHaloData.h:96
Definition: DetId.h:17
void SetNFlatHaloSegments(short int nSegments)
Definition: CSCHaloData.h:107
float dr_highthresh_segvsrh_hbhe
Definition: CSCHaloAlgo.h:166
void SetNIncomingTracks(short int n_small_dT, short int n_small_beta, short int n_small_both)
Definition: CSCHaloData.h:89
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
void SetNumberOfHaloTriggers(int PlusZ, int MinusZ)
Definition: CSCHaloData.h:73
float max_segment_theta
Definition: CSCHaloAlgo.h:164
float max_free_inverse_beta
Definition: CSCHaloAlgo.h:160
void SetSegmentIsHCaloMatched(bool b)
Definition: CSCHaloData.h:116
float norm_chi2_threshold
Definition: CSCHaloAlgo.h:152
float dt_lowthresh_segvsrh_eb
Definition: CSCHaloAlgo.h:168
float freeInverseBeta() const
Definition: MuonTimeExtra.h:36
void SetSegmentsBothEndcaps_Loose_dTcut_TrkMuUnVeto(bool b)
Definition: CSCHaloData.h:112
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:67
bool ECALSegmentMatching(edm::Handle< EcalRecHitCollection > &rechitcoll, float et_thresh_rh, float dphi_thresh_segvsrh, float dr_lowthresh_segvsrh, float dr_highthresh_segvsrh, float dt_lowthresh_segvsrh, float dt_highthresh_segvsrh, float iZ, float iR, float iT, float iPhi)
Definition: CSCHaloAlgo.cc:577
void SetNOutOfTimeHits(short int num)
Definition: CSCHaloData.h:87
void SetNumberOfHaloTriggers_TrkMuUnVeto(int PlusZ, int MinusZ)
Definition: CSCHaloData.h:77
Log< level::Warning, false > LogWarning
void SetNOutOfTimeTriggers(short int PlusZ, short int MinusZ)
Definition: CSCHaloData.h:82
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
bool HCALSegmentMatching(edm::Handle< HBHERecHitCollection > &rechitcoll, float et_thresh_rh, float dphi_thresh_segvsrh, float dr_lowthresh_segvsrh, float dr_highthresh_segvsrh, float dt_lowthresh_segvsrh, float dt_highthresh_segvsrh, float iZ, float iR, float iT, float iPhi)
Definition: CSCHaloAlgo.cc:549
void SetSegmentIsEBCaloMatched(bool b)
Definition: CSCHaloData.h:117
static constexpr int CSC
Definition: MuonSubdetId.h:12
T x() const
Definition: PV3DBase.h:59
float dr_highthresh_segvsrh_eb
Definition: CSCHaloAlgo.h:168
float dr_lowthresh_segvsrh_eb
Definition: CSCHaloAlgo.h:168
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: CSCGeometry.cc:89
edm::RefVector< reco::TrackCollection > & GetTracks()
Definition: CSCHaloData.h:69
float dphi_thresh_segvsrh_eb
Definition: CSCHaloAlgo.h:168
bool CSCHaloAlgo::ECALSegmentMatching ( edm::Handle< EcalRecHitCollection > &  rechitcoll,
float  et_thresh_rh,
float  dphi_thresh_segvsrh,
float  dr_lowthresh_segvsrh,
float  dr_highthresh_segvsrh,
float  dt_lowthresh_segvsrh,
float  dt_highthresh_segvsrh,
float  iZ,
float  iR,
float  iT,
float  iPhi 
)
private

Definition at line 577 of file CSCHaloAlgo.cc.

References funct::abs(), srCondWrite_cfg::deltaPhi, EcalRecHit::energy(), getPosition(), EcalRecHit::id(), mathSSE::sqrt(), and EcalRecHit::time().

Referenced by Calculate().

587  {
588  reco::Vertex::Point vtx(0, 0, 0);
589  for (size_t ihit = 0; ihit < rechitcoll->size(); ++ihit) {
590  const EcalRecHit& rechit = (*rechitcoll)[ihit];
591  math::XYZPoint rhpos = getPosition(rechit.id(), vtx);
592  double rhet = rechit.energy() / cosh(rhpos.eta());
593  double dphi_rhseg = abs(deltaPhi(rhpos.phi(), iPhi));
594  double dr_rhseg = sqrt(rhpos.x() * rhpos.x() + rhpos.y() * rhpos.y()) - iR;
595  double dtcorr_rhseg = rechit.time() - abs(rhpos.z() - iZ) / 30 - iT;
596  if ((rechit.time() < -1) && (rhpos.z() * iZ < 0 || abs(rhpos.z()) < 200) && rhet > et_thresh_rh &&
597  dphi_rhseg < dphi_thresh_segvsrh && dr_rhseg < dr_highthresh_segvsrh &&
598  dr_rhseg > dr_lowthresh_segvsrh && //careful: asymmetric cut might not be the most appropriate thing
599  dtcorr_rhseg > dt_lowthresh_segvsrh && dtcorr_rhseg < dr_highthresh_segvsrh)
600  return true;
601  }
602  return false;
603 }
float time() const
Definition: EcalRecHit.h:70
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float energy() const
Definition: EcalRecHit.h:68
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
DetId id() const
get the id
Definition: EcalRecHit.h:77
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
math::XYZPoint getPosition(const DetId &id, reco::Vertex::Point vtx)
Definition: CSCHaloAlgo.cc:543
math::XYZPoint CSCHaloAlgo::getPosition ( const DetId id,
reco::Vertex::Point  vtx 
)
private

Definition at line 543 of file CSCHaloAlgo.cc.

References geo_, CaloGeometry::getPosition(), HcalGeometry::getPosition(), DetId::Hcal, hgeo_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by ECALSegmentMatching(), and HCALSegmentMatching().

543  {
544  const GlobalPoint pos = ((id.det() == DetId::Hcal) ? hgeo_->getPosition(id) : GlobalPoint(geo_->getPosition(id)));
545  math::XYZPoint posV(pos.x() - vtx.x(), pos.y() - vtx.y(), pos.z() - vtx.z());
546  return posV;
547 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:60
const CaloGeometry * geo_
Definition: CSCHaloAlgo.h:174
T z() const
Definition: PV3DBase.h:61
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
const HcalGeometry * hgeo_
Definition: CSCHaloAlgo.h:175
GlobalPoint getPosition(const DetId &id) const
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
T x() const
Definition: PV3DBase.h:59
bool CSCHaloAlgo::HCALSegmentMatching ( edm::Handle< HBHERecHitCollection > &  rechitcoll,
float  et_thresh_rh,
float  dphi_thresh_segvsrh,
float  dr_lowthresh_segvsrh,
float  dr_highthresh_segvsrh,
float  dt_lowthresh_segvsrh,
float  dt_highthresh_segvsrh,
float  iZ,
float  iR,
float  iT,
float  iPhi 
)
private

Definition at line 549 of file CSCHaloAlgo.cc.

References funct::abs(), srCondWrite_cfg::deltaPhi, CaloRecHit::energy(), getPosition(), HBHERecHit::id(), mathSSE::sqrt(), and CaloRecHit::time().

Referenced by Calculate().

559  {
560  reco::Vertex::Point vtx(0, 0, 0);
561  for (size_t ihit = 0; ihit < rechitcoll->size(); ++ihit) {
562  const HBHERecHit& rechit = (*rechitcoll)[ihit];
563  math::XYZPoint rhpos = getPosition(rechit.id(), vtx);
564  double rhet = rechit.energy() / cosh(rhpos.eta());
565  double dphi_rhseg = abs(deltaPhi(rhpos.phi(), iPhi));
566  double dr_rhseg = sqrt(rhpos.x() * rhpos.x() + rhpos.y() * rhpos.y()) - iR;
567  double dtcorr_rhseg = rechit.time() - abs(rhpos.z() - iZ) / 30 - iT;
568  if ((rechit.time() < -3) && (rhpos.z() * iZ < 0 || abs(rhpos.z()) < 200) && rhet > et_thresh_rh &&
569  dphi_rhseg < dphi_thresh_segvsrh && dr_rhseg < dr_highthresh_segvsrh &&
570  dr_rhseg > dr_lowthresh_segvsrh && //careful: asymmetric cut might not be the most appropriate thing
571  dtcorr_rhseg > dt_lowthresh_segvsrh && dtcorr_rhseg < dt_highthresh_segvsrh)
572  return true;
573  }
574  return false;
575 }
constexpr float energy() const
Definition: CaloRecHit.h:29
T sqrt(T t)
Definition: SSEVec.h:19
constexpr HcalDetId id() const
get the id
Definition: HBHERecHit.h:41
constexpr float time() const
Definition: CaloRecHit.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
math::XYZPoint getPosition(const DetId &id, reco::Vertex::Point vtx)
Definition: CSCHaloAlgo.cc:543
void CSCHaloAlgo::SetDetaThreshold ( float  x)
inline

Definition at line 113 of file CSCHaloAlgo.h.

References deta_threshold, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

113 { deta_threshold = x; }
float deta_threshold
Definition: CSCHaloAlgo.h:144
void CSCHaloAlgo::SetDphiThreshold ( float  x)
inline

Definition at line 122 of file CSCHaloAlgo.h.

References dphi_threshold, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

122 { dphi_threshold = x; }
float dphi_threshold
Definition: CSCHaloAlgo.h:151
void CSCHaloAlgo::SetExpectedBX ( int  x)
inline

Definition at line 126 of file CSCHaloAlgo.h.

References expected_BX, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

126 { expected_BX = x; }
void CSCHaloAlgo::SetMatchingDEtaThreshold ( float  x)
inline

Definition at line 132 of file CSCHaloAlgo.h.

References matching_deta_threshold, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

float matching_deta_threshold
Definition: CSCHaloAlgo.h:157
void CSCHaloAlgo::SetMatchingDPhiThreshold ( float  x)
inline

Definition at line 131 of file CSCHaloAlgo.h.

References matching_dphi_threshold, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

float matching_dphi_threshold
Definition: CSCHaloAlgo.h:156
void CSCHaloAlgo::SetMatchingDWireThreshold ( int  x)
inline

Definition at line 133 of file CSCHaloAlgo.h.

References matching_dwire_threshold, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

void CSCHaloAlgo::SetMaxDtMuonSegment ( float  x)
inline

Definition at line 134 of file CSCHaloAlgo.h.

References max_dt_muon_segment, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

134 { max_dt_muon_segment = x; }
float max_dt_muon_segment
Definition: CSCHaloAlgo.h:159
void CSCHaloAlgo::SetMaxFreeInverseBeta ( float  x)
inline

Definition at line 135 of file CSCHaloAlgo.h.

References max_free_inverse_beta, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

float max_free_inverse_beta
Definition: CSCHaloAlgo.h:160
void CSCHaloAlgo::SetMaxSegmentPhiDiff ( float  x)
inline

Definition at line 139 of file CSCHaloAlgo.h.

References max_segment_phi_diff, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

139 { max_segment_phi_diff = x; }
float max_segment_phi_diff
Definition: CSCHaloAlgo.h:163
void CSCHaloAlgo::SetMaxSegmentRDiff ( float  x)
inline

Definition at line 138 of file CSCHaloAlgo.h.

References max_segment_r_diff, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

138 { max_segment_r_diff = x; }
float max_segment_r_diff
Definition: CSCHaloAlgo.h:162
void CSCHaloAlgo::SetMaxSegmentTheta ( float  x)
inline

Definition at line 140 of file CSCHaloAlgo.h.

References max_segment_theta, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

140 { max_segment_theta = x; }
float max_segment_theta
Definition: CSCHaloAlgo.h:164
void CSCHaloAlgo::SetMinMaxInnerRadius ( float  min,
float  max 
)
inline

Definition at line 114 of file CSCHaloAlgo.h.

References SiStripPI::max, max_inner_radius, min(), and min_inner_radius.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

114  {
117  }
float max_inner_radius
Definition: CSCHaloAlgo.h:148
T min(T a, T b)
Definition: MathUtil.h:58
float min_inner_radius
Definition: CSCHaloAlgo.h:147
void CSCHaloAlgo::SetMinMaxOuterMomentumTheta ( float  min,
float  max 
)
inline

Definition at line 127 of file CSCHaloAlgo.h.

References SiStripPI::max, max_outer_theta, min(), and min_outer_theta.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

127  {
130  }
float min_outer_theta
Definition: CSCHaloAlgo.h:146
float max_outer_theta
Definition: CSCHaloAlgo.h:145
T min(T a, T b)
Definition: MathUtil.h:58
void CSCHaloAlgo::SetMinMaxOuterRadius ( float  min,
float  max 
)
inline

Definition at line 118 of file CSCHaloAlgo.h.

References SiStripPI::max, max_outer_radius, min(), and min_outer_radius.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

118  {
121  }
float min_outer_radius
Definition: CSCHaloAlgo.h:149
float max_outer_radius
Definition: CSCHaloAlgo.h:150
T min(T a, T b)
Definition: MathUtil.h:58
void CSCHaloAlgo::SetNormChi2Threshold ( float  x)
inline

Definition at line 123 of file CSCHaloAlgo.h.

References norm_chi2_threshold, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

123 { norm_chi2_threshold = x; }
float norm_chi2_threshold
Definition: CSCHaloAlgo.h:152
void CSCHaloAlgo::SetRecHitTime0 ( float  x)
inline

Definition at line 124 of file CSCHaloAlgo.h.

References recHit_t0, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

124 { recHit_t0 = x; }
float recHit_t0
Definition: CSCHaloAlgo.h:153
void CSCHaloAlgo::SetRecHitTimeWindow ( float  x)
inline

Definition at line 125 of file CSCHaloAlgo.h.

References recHit_twindow, and x.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().

125 { recHit_twindow = x; }
float recHit_twindow
Definition: CSCHaloAlgo.h:154

Member Data Documentation

float CSCHaloAlgo::deta_threshold
private

Definition at line 144 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetDetaThreshold().

float CSCHaloAlgo::dphi_thresh_segvsrh_eb
private

Definition at line 168 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dphi_thresh_segvsrh_ee
private

Definition at line 170 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dphi_thresh_segvsrh_hbhe
private

Definition at line 166 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dphi_threshold
private

Definition at line 151 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetDphiThreshold().

float CSCHaloAlgo::dr_highthresh_segvsrh_eb
private

Definition at line 168 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dr_highthresh_segvsrh_ee
private

Definition at line 170 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dr_highthresh_segvsrh_hbhe
private

Definition at line 166 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dr_lowthresh_segvsrh_eb
private

Definition at line 168 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dr_lowthresh_segvsrh_ee
private

Definition at line 170 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dr_lowthresh_segvsrh_hbhe
private

Definition at line 166 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dt_highthresh_segvsrh_eb
private

Definition at line 168 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dt_highthresh_segvsrh_ee
private

Definition at line 170 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dt_highthresh_segvsrh_hbhe
private

Definition at line 166 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dt_lowthresh_segvsrh_eb
private

Definition at line 168 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dt_lowthresh_segvsrh_ee
private

Definition at line 170 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::dt_lowthresh_segvsrh_hbhe
private

Definition at line 166 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::et_thresh_rh_eb
private

Definition at line 168 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::et_thresh_rh_ee
private

Definition at line 170 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::et_thresh_rh_hbhe
private

Definition at line 166 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

int CSCHaloAlgo::expected_BX
private

Definition at line 155 of file CSCHaloAlgo.h.

Referenced by CSCHaloAlgo(), and SetExpectedBX().

const CaloGeometry* CSCHaloAlgo::geo_
private

Definition at line 174 of file CSCHaloAlgo.h.

Referenced by Calculate(), and getPosition().

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> CSCHaloAlgo::geoToken_
private

Definition at line 173 of file CSCHaloAlgo.h.

Referenced by Calculate().

const HcalGeometry* CSCHaloAlgo::hgeo_
private

Definition at line 175 of file CSCHaloAlgo.h.

Referenced by Calculate(), and getPosition().

float CSCHaloAlgo::matching_deta_threshold
private

Definition at line 157 of file CSCHaloAlgo.h.

Referenced by CSCHaloAlgo(), and SetMatchingDEtaThreshold().

float CSCHaloAlgo::matching_dphi_threshold
private

Definition at line 156 of file CSCHaloAlgo.h.

Referenced by CSCHaloAlgo(), and SetMatchingDPhiThreshold().

int CSCHaloAlgo::matching_dwire_threshold
private

Definition at line 158 of file CSCHaloAlgo.h.

Referenced by CSCHaloAlgo(), and SetMatchingDWireThreshold().

float CSCHaloAlgo::max_dt_muon_segment
private

Definition at line 159 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetMaxDtMuonSegment().

float CSCHaloAlgo::max_free_inverse_beta
private

Definition at line 160 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetMaxFreeInverseBeta().

float CSCHaloAlgo::max_inner_radius
private

Definition at line 148 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetMinMaxInnerRadius().

float CSCHaloAlgo::max_outer_radius
private

Definition at line 150 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetMinMaxOuterRadius().

float CSCHaloAlgo::max_outer_theta
private

Definition at line 145 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetMinMaxOuterMomentumTheta().

float CSCHaloAlgo::max_segment_phi_diff
private

Definition at line 163 of file CSCHaloAlgo.h.

Referenced by Calculate(), and SetMaxSegmentPhiDiff().

float CSCHaloAlgo::max_segment_r_diff
private

Definition at line 162 of file CSCHaloAlgo.h.

Referenced by Calculate(), and SetMaxSegmentRDiff().

float CSCHaloAlgo::max_segment_theta
private

Definition at line 164 of file CSCHaloAlgo.h.

Referenced by Calculate(), and SetMaxSegmentTheta().

float CSCHaloAlgo::min_inner_radius
private

Definition at line 147 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetMinMaxInnerRadius().

float CSCHaloAlgo::min_outer_radius
private

Definition at line 149 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetMinMaxOuterRadius().

float CSCHaloAlgo::min_outer_theta
private

Definition at line 146 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetMinMaxOuterMomentumTheta().

float CSCHaloAlgo::norm_chi2_threshold
private

Definition at line 152 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetNormChi2Threshold().

float CSCHaloAlgo::recHit_t0
private

Definition at line 153 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetRecHitTime0().

float CSCHaloAlgo::recHit_twindow
private

Definition at line 154 of file CSCHaloAlgo.h.

Referenced by Calculate(), CSCHaloAlgo(), and SetRecHitTimeWindow().

std::vector<edm::InputTag> CSCHaloAlgo::vIT_HLTBit

Definition at line 111 of file CSCHaloAlgo.h.

Referenced by reco::CSCHaloDataProducer::CSCHaloDataProducer().