CMS 3D CMS Logo

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 ()
 
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_
 
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 ( )

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  : 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
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:173
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:174
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.

References L1TEGammaOffline_cfi::triggerNames.

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(), relativeConstraints::chamber, CSCGeometry::chamber(), chambers, MuonSubdetId::CSC, SiPixelRawToDigiRegional_cfi::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_, edm::EventSetup::get(), reco::CSCHaloData::GetCSCTrackImpactPositions(), 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, amptDefaultParameters_cff::mu, DetId::Muon, norm_chi2_threshold, PV3DBase< T, PVType, FrameType >::phi(), Pi, edm::ESHandle< T >::product(), 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().

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

References funct::abs(), SiPixelRawToDigiRegional_cfi::deltaPhi, EcalRecHit::energy(), getPosition(), EcalRecHit::id(), edm::SortedCollection< T, SORT >::size(), mathSSE::sqrt(), EcalRecHit::time(), and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by Calculate().

589  {
590  reco::Vertex::Point vtx(0, 0, 0);
591  for (size_t ihit = 0; ihit < rechitcoll->size(); ++ihit) {
592  const EcalRecHit& rechit = (*rechitcoll)[ihit];
593  math::XYZPoint rhpos = getPosition(rechit.id(), vtx);
594  double rhet = rechit.energy() / cosh(rhpos.eta());
595  double dphi_rhseg = abs(deltaPhi(rhpos.phi(), iPhi));
596  double dr_rhseg = sqrt(rhpos.x() * rhpos.x() + rhpos.y() * rhpos.y()) - iR;
597  double dtcorr_rhseg = rechit.time() - abs(rhpos.z() - iZ) / 30 - iT;
598  if ((rechit.time() < -1) && (rhpos.z() * iZ < 0 || abs(rhpos.z()) < 200) && rhet > et_thresh_rh &&
599  dphi_rhseg < dphi_thresh_segvsrh && dr_rhseg < dr_highthresh_segvsrh &&
600  dr_rhseg > dr_lowthresh_segvsrh && //careful: asymmetric cut might not be the most appropriate thing
601  dtcorr_rhseg > dt_lowthresh_segvsrh && dtcorr_rhseg < dr_highthresh_segvsrh)
602  return true;
603  }
604  return false;
605 }
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:39
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:545
size_type size() const
math::XYZPoint CSCHaloAlgo::getPosition ( const DetId id,
reco::Vertex::Point  vtx 
)
private

Definition at line 545 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().

545  {
546  const GlobalPoint pos = ((id.det() == DetId::Hcal) ? hgeo_->getPosition(id) : GlobalPoint(geo_->getPosition(id)));
547  math::XYZPoint posV(pos.x() - vtx.x(), pos.y() - vtx.y(), pos.z() - vtx.z());
548  return posV;
549 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:60
const CaloGeometry * geo_
Definition: CSCHaloAlgo.h:173
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:174
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 551 of file CSCHaloAlgo.cc.

References funct::abs(), SiPixelRawToDigiRegional_cfi::deltaPhi, CaloRecHit::energy(), getPosition(), HBHERecHit::id(), edm::SortedCollection< T, SORT >::size(), mathSSE::sqrt(), CaloRecHit::time(), and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by Calculate().

561  {
562  reco::Vertex::Point vtx(0, 0, 0);
563  for (size_t ihit = 0; ihit < rechitcoll->size(); ++ihit) {
564  const HBHERecHit& rechit = (*rechitcoll)[ihit];
565  math::XYZPoint rhpos = getPosition(rechit.id(), vtx);
566  double rhet = rechit.energy() / cosh(rhpos.eta());
567  double dphi_rhseg = abs(deltaPhi(rhpos.phi(), iPhi));
568  double dr_rhseg = sqrt(rhpos.x() * rhpos.x() + rhpos.y() * rhpos.y()) - iR;
569  double dtcorr_rhseg = rechit.time() - abs(rhpos.z() - iZ) / 30 - iT;
570  if ((rechit.time() < -3) && (rhpos.z() * iZ < 0 || abs(rhpos.z()) < 200) && rhet > et_thresh_rh &&
571  dphi_rhseg < dphi_thresh_segvsrh && dr_rhseg < dr_highthresh_segvsrh &&
572  dr_rhseg > dr_lowthresh_segvsrh && //careful: asymmetric cut might not be the most appropriate thing
573  dtcorr_rhseg > dt_lowthresh_segvsrh && dtcorr_rhseg < dt_highthresh_segvsrh)
574  return true;
575  }
576  return false;
577 }
constexpr float energy() const
Definition: CaloRecHit.h:29
HcalDetId id() const
get the id
Definition: HBHERecHit.h:39
T sqrt(T t)
Definition: SSEVec.h:19
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:39
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:545
size_type size() const
void CSCHaloAlgo::SetDetaThreshold ( float  x)
inline

Definition at line 113 of file CSCHaloAlgo.h.

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.

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.

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

Definition at line 132 of file CSCHaloAlgo.h.

void CSCHaloAlgo::SetMatchingDPhiThreshold ( float  x)
inline

Definition at line 131 of file CSCHaloAlgo.h.

void CSCHaloAlgo::SetMatchingDWireThreshold ( int  x)
inline

Definition at line 133 of file CSCHaloAlgo.h.

void CSCHaloAlgo::SetMaxDtMuonSegment ( float  x)
inline

Definition at line 134 of file CSCHaloAlgo.h.

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.

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

Definition at line 139 of file CSCHaloAlgo.h.

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.

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.

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 edm::max(), and edm::min().

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 edm::max(), and edm::min().

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 edm::max(), and edm::min().

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.

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.

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.

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(), and CSCHaloAlgo().

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(), and CSCHaloAlgo().

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().

const CaloGeometry* CSCHaloAlgo::geo_
private

Definition at line 173 of file CSCHaloAlgo.h.

Referenced by Calculate(), and getPosition().

const HcalGeometry* CSCHaloAlgo::hgeo_
private

Definition at line 174 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().

float CSCHaloAlgo::matching_dphi_threshold
private

Definition at line 156 of file CSCHaloAlgo.h.

Referenced by CSCHaloAlgo().

int CSCHaloAlgo::matching_dwire_threshold
private

Definition at line 158 of file CSCHaloAlgo.h.

Referenced by CSCHaloAlgo().

float CSCHaloAlgo::max_dt_muon_segment
private

Definition at line 159 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::max_free_inverse_beta
private

Definition at line 160 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::max_inner_radius
private

Definition at line 148 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::max_outer_radius
private

Definition at line 150 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::max_outer_theta
private

Definition at line 145 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::max_segment_phi_diff
private

Definition at line 163 of file CSCHaloAlgo.h.

Referenced by Calculate().

float CSCHaloAlgo::max_segment_r_diff
private

Definition at line 162 of file CSCHaloAlgo.h.

Referenced by Calculate().

float CSCHaloAlgo::max_segment_theta
private

Definition at line 164 of file CSCHaloAlgo.h.

Referenced by Calculate().

float CSCHaloAlgo::min_inner_radius
private

Definition at line 147 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::min_outer_radius
private

Definition at line 149 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::min_outer_theta
private

Definition at line 146 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::norm_chi2_threshold
private

Definition at line 152 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::recHit_t0
private

Definition at line 153 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

float CSCHaloAlgo::recHit_twindow
private

Definition at line 154 of file CSCHaloAlgo.h.

Referenced by Calculate(), and CSCHaloAlgo().

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

Definition at line 111 of file CSCHaloAlgo.h.