52 float METOverSumEt = TheCaloMET.
sumEt() ? TheCaloMET.
pt() / TheCaloMET.
sumEt() : 0;
55 int EcalOverlapping_CSCRecHits[361] = {};
56 int EcalOverlapping_CSCSegments[361] = {};
57 int HcalOverlapping_CSCRecHits[73] = {};
58 int HcalOverlapping_CSCSegments[73] = {};
63 bool EcalOverlap[361];
65 for (
int i = 0;
i < 361;
i++) {
66 EcalOverlap[
i] =
false;
68 HcalOverlap[
i] =
false;
71 std::vector<CSCRecHit2D> Hits = iSegment->specificRecHits();
72 for (std::vector<CSCRecHit2D>::iterator iHit = Hits.begin(); iHit != Hits.end(); iHit++) {
73 DetId TheDetUnitId(iHit->geographicalId());
80 LocalPoint TheLocalPosition = iHit->localPosition();
82 const GlobalPoint TheGlobalPosition = TheSurface.toGlobal(TheLocalPosition);
86 float x = TheGlobalPosition.
x();
87 float y = TheGlobalPosition.
y();
89 float r = TMath::Sqrt(
x *
x +
y *
y);
92 EcalOverlap[Ecal_iphi] =
true;
94 HcalOverlap[Hcal_iphi] =
true;
96 for (
int i = 0;
i < 361;
i++) {
98 EcalOverlapping_CSCSegments[
i]++;
99 if (
i < 73 && HcalOverlap[
i])
100 HcalOverlapping_CSCSegments[
i]++;
107 DetId TheDetUnitId(iCSCRecHit->geographicalId());
114 LocalPoint TheLocalPosition = iCSCRecHit->localPosition();
116 const GlobalPoint TheGlobalPosition = TheSurface.toGlobal(TheLocalPosition);
120 float x = TheGlobalPosition.
x();
121 float y = TheGlobalPosition.
y();
123 float r = TMath::Sqrt(
x *
x +
y *
y);
126 EcalOverlapping_CSCRecHits[Ecaliphi]++;
128 HcalOverlapping_CSCRecHits[Hcaliphi]++;
134 std::vector<PhiWedge> EcalWedges = TheEcalHaloData.
GetPhiWedges();
137 std::vector<PhiWedge> HcalWedges = TheHcalHaloData.
GetPhiWedges();
148 std::vector<int> vEcaliPhi, vHcaliPhi;
150 for (std::vector<GlobalPoint>::iterator Pos = TheGlobalPositions.begin(); Pos != TheGlobalPositions.end(); Pos++) {
152 float global_phi = Pos->phi();
153 float global_r = TMath::Sqrt(Pos->x() * Pos->x() + Pos->y() * Pos->y());
160 for (std::vector<PhiWedge>::iterator iWedge = EcalWedges.begin(); iWedge != EcalWedges.end(); iWedge++) {
161 if ((TMath::Abs(global_EcaliPhi - iWedge->iPhi()) <= 5) && (global_r >
Ecal_R_Min && global_r <
Ecal_R_Max)) {
162 bool StoreWedge =
true;
163 for (
unsigned int i = 0;
i < vEcaliPhi.size();
i++)
164 if (vEcaliPhi[
i] == iWedge->iPhi())
169 NewWedge.SetOverlappingCSCSegments(EcalOverlapping_CSCSegments[iWedge->iPhi()]);
170 NewWedge.SetOverlappingCSCRecHits(EcalOverlapping_CSCRecHits[iWedge->iPhi()]);
171 vEcaliPhi.push_back(iWedge->iPhi());
177 for (std::vector<PhiWedge>::iterator iWedge = HcalWedges.begin(); iWedge != HcalWedges.end(); iWedge++) {
178 if ((TMath::Abs(global_HcaliPhi - iWedge->iPhi()) <= 2) && (global_r >
Hcal_R_Min && global_r <
Hcal_R_Max)) {
179 bool StoreWedge =
true;
180 for (
unsigned int i = 0;
i < vHcaliPhi.size();
i++)
181 if (vHcaliPhi[
i] == iWedge->iPhi())
185 vHcaliPhi.push_back(iWedge->iPhi());
187 NewWedge.SetOverlappingCSCSegments(HcalOverlapping_CSCSegments[iWedge->iPhi()]);
188 NewWedge.SetOverlappingCSCRecHits(HcalOverlapping_CSCRecHits[iWedge->iPhi()]);
210 for (
unsigned int x = 0;
x < vEcaliPhi.size();
x++) {
211 if (
iphi == vEcaliPhi[
x]) {
212 dMEx += (TMath::Cos(iTower->
phi()) * iTower->
emEt());
213 dMEy += (TMath::Sin(iTower->
phi()) * iTower->
emEt());
216 for (
unsigned int x = 0;
x < vHcaliPhi.size();
x++) {
217 if (
iphi == vHcaliPhi[
x]) {
218 dMEx += (TMath::Cos(iTower->
phi()) * iTower->
hadEt());
219 dMEy += (TMath::Sin(iTower->
phi()) * iTower->
hadEt());
233 bool ECALBmatched(
false), ECALEmatched(
false), HCALBmatched(
false), HCALEmatched(
false);
235 if (TheCSCSegments.
isValid()) {
238 CSCDetId iCscDetID = iSegment->cscDetId();
239 bool Segment1IsGood =
true;
243 for (reco::MuonCollection::const_iterator
mu = TheMuons->begin();
mu != TheMuons->end() && (Segment1IsGood);
245 if (!
mu->isTrackerMuon() && !
mu->isGlobalMuon() &&
mu->isStandAloneMuon())
247 if (!
mu->isGlobalMuon() &&
mu->isTrackerMuon() &&
mu->pt() < 3)
249 const std::vector<MuonChamberMatch>
chambers =
mu->matches();
250 for (std::vector<MuonChamberMatch>::const_iterator kChamber =
chambers.begin(); kChamber !=
chambers.end();
254 for (std::vector<reco::MuonSegmentMatch>::const_iterator kSegment = kChamber->segmentMatches.begin();
255 kSegment != kChamber->segmentMatches.end();
258 CSCDetId kCscDetID = cscSegRef->cscDetId();
260 if (kCscDetID == iCscDetID) {
261 Segment1IsGood =
false;
272 LocalPoint iLocalPosition = iSegment->localPosition();
273 LocalVector iLocalDirection = iSegment->localDirection();
278 float iTheta = iGlobalDirection.
theta();
282 float iPhi = iGlobalPosition.
phi();
283 float iR =
sqrt(iGlobalPosition.
perp2());
284 float iZ = iGlobalPosition.
z();
285 float iT = iSegment->time();
292 bool ebmatched =
SegmentMatchingEB(TheGlobalHaloData, hccandEB, iZ, iR, iT, iPhi, ishlt);
293 bool eematched =
SegmentMatchingEE(TheGlobalHaloData, hccandEE, iZ, iR, iT, iPhi, ishlt);
294 bool hbmatched =
SegmentMatchingHB(TheGlobalHaloData, hccandHB, iZ, iR, iT, iPhi, ishlt);
295 bool hematched =
SegmentMatchingHE(TheGlobalHaloData, hccandHE, iZ, iR, iT, iPhi, ishlt);
297 ECALBmatched |= ebmatched;
298 ECALEmatched |= eematched;
299 HCALBmatched |= hbmatched;
300 HCALEmatched |= hematched;
313 bool HaloPatternFoundInEB =
false;
314 for (
auto& hcand : hccandEB) {
315 if ((hcand.getIsHaloFromPattern() && !ishlt) || (hcand.getIsHaloFromPattern_HLT() && ishlt)) {
316 HaloPatternFoundInEB =
true;
322 bool HaloPatternFoundInEE =
false;
323 for (
auto& hcand : hccandEE) {
324 if ((hcand.getIsHaloFromPattern() && !ishlt) || (hcand.getIsHaloFromPattern_HLT() && ishlt)) {
325 HaloPatternFoundInEE =
true;
331 bool HaloPatternFoundInHB =
false;
332 for (
auto& hcand : hccandHB) {
333 if ((hcand.getIsHaloFromPattern() && !ishlt) || (hcand.getIsHaloFromPattern_HLT() && ishlt)) {
334 HaloPatternFoundInHB =
true;
340 bool HaloPatternFoundInHE =
false;
341 for (
auto& hcand : hccandHE) {
342 if ((hcand.getIsHaloFromPattern() && !ishlt) || (hcand.getIsHaloFromPattern_HLT() && ishlt)) {
343 HaloPatternFoundInHE =
true;
353 return TheGlobalHaloData;
bool SegmentMatchingEE(reco::GlobalHaloData &thehalodata, const std::vector< reco::HaloClusterCandidateECAL > &haloclustercands, float iZ, float iR, float iT, float iPhi, bool ishlt)
void AddtoBeamHaloEBEERechits(edm::RefVector< EcalRecHitCollection > &bhtaggedrechits, reco::GlobalHaloData &thehalodata, bool isbarrel)
double pt() const final
transverse momentum
void SetSegmentIsEECaloMatched(bool b)
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Geom::Phi< T > phi() const
void SetMETOverSumEt(float x)
const std::vector< HaloClusterCandidateHCAL > & getHaloClusterCandidatesHB() const
std::vector< PhiWedge > & GetMatchedEcalPhiWedges()
const std::vector< HaloClusterCandidateHCAL > & getHaloClusterCandidatesHE() const
void SetHaloPatternFoundHE(bool b)
double et(double vtxZ) const
C::const_iterator const_iterator
constant access iterator type
int Phi_To_HcaliPhi(float phi)
void SetHaloPatternFoundEE(bool b)
void SetSegmentIsEBCaloMatched(bool b)
Abs< T >::type abs(const T &t)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
bool SegmentMatchingHB(reco::GlobalHaloData &thehalodata, const std::vector< reco::HaloClusterCandidateHCAL > &haloclustercands, float iZ, float iR, float iT, float iPhi, bool ishlt)
bool SegmentMatchingEB(reco::GlobalHaloData &thehalodata, const std::vector< reco::HaloClusterCandidateECAL > &haloclustercands, float iZ, float iR, float iT, float iPhi, bool ishlt)
const Plane & surface() const
The nominal surface of the GeomDet.
void AddtoBeamHaloHBHERechits(edm::RefVector< HBHERecHitCollection > &bhtaggedrechits, reco::GlobalHaloData &thehalodata)
void SetMETCorrections(float x, float y)
const std::vector< HaloClusterCandidateECAL > & getHaloClusterCandidatesEB() const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::vector< PhiWedge > & GetMatchedHcalPhiWedges()
const std::vector< HaloClusterCandidateECAL > & getHaloClusterCandidatesEE() const
bool SegmentMatchingHE(reco::GlobalHaloData &thehalodata, const std::vector< reco::HaloClusterCandidateHCAL > &haloclustercands, float iZ, float iR, float iT, float iPhi, bool ishlt)
int Phi_To_EcaliPhi(float phi)
void SetSegmentIsHECaloMatched(bool b)
const std::vector< GlobalPoint > & GetCSCTrackImpactPositions() const
void SetSegmentIsHBCaloMatched(bool b)
static char chambers[264][20]
double phi() const final
momentum azimuthal angle
const std::vector< PhiWedge > & GetPhiWedges() const
void SetHaloPatternFoundHB(bool b)
Geom::Theta< T > theta() const
const std::vector< PhiWedge > & GetPhiWedges() const
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
void SetHaloPatternFoundEB(bool b)