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;
151 int N_Unmatched_Tracks = 0;
153 for (std::vector<GlobalPoint>::iterator Pos = TheGlobalPositions.begin(); Pos != TheGlobalPositions.end(); Pos++) {
155 float global_phi = Pos->phi();
156 float global_r = TMath::Sqrt(Pos->x() * Pos->x() + Pos->y() * Pos->y());
161 bool MATCHED =
false;
164 for (std::vector<PhiWedge>::iterator iWedge = EcalWedges.begin(); iWedge != EcalWedges.end(); iWedge++) {
165 if ((TMath::Abs(global_EcaliPhi - iWedge->iPhi()) <= 5) && (global_r >
Ecal_R_Min && global_r <
Ecal_R_Max)) {
166 bool StoreWedge =
true;
167 for (
unsigned int i = 0;
i < vEcaliPhi.size();
i++)
168 if (vEcaliPhi[
i] == iWedge->iPhi())
173 NewWedge.SetOverlappingCSCSegments(EcalOverlapping_CSCSegments[iWedge->iPhi()]);
174 NewWedge.SetOverlappingCSCRecHits(EcalOverlapping_CSCRecHits[iWedge->iPhi()]);
175 vEcaliPhi.push_back(iWedge->iPhi());
182 for (std::vector<PhiWedge>::iterator iWedge = HcalWedges.begin(); iWedge != HcalWedges.end(); iWedge++) {
183 if ((TMath::Abs(global_HcaliPhi - iWedge->iPhi()) <= 2) && (global_r >
Hcal_R_Min && global_r <
Hcal_R_Max)) {
184 bool StoreWedge =
true;
185 for (
unsigned int i = 0;
i < vHcaliPhi.size();
i++)
186 if (vHcaliPhi[
i] == iWedge->iPhi())
190 vHcaliPhi.push_back(iWedge->iPhi());
192 NewWedge.SetOverlappingCSCSegments(HcalOverlapping_CSCSegments[iWedge->iPhi()]);
193 NewWedge.SetOverlappingCSCRecHits(HcalOverlapping_CSCRecHits[iWedge->iPhi()]);
201 N_Unmatched_Tracks++;
218 for (
unsigned int x = 0;
x < vEcaliPhi.size();
x++) {
219 if (
iphi == vEcaliPhi[
x]) {
220 dMEx += (TMath::Cos(iTower->
phi()) * iTower->
emEt());
221 dMEy += (TMath::Sin(iTower->
phi()) * iTower->
emEt());
224 for (
unsigned int x = 0;
x < vHcaliPhi.size();
x++) {
225 if (
iphi == vHcaliPhi[
x]) {
226 dMEx += (TMath::Cos(iTower->
phi()) * iTower->
hadEt());
227 dMEy += (TMath::Sin(iTower->
phi()) * iTower->
hadEt());
241 bool ECALBmatched(
false), ECALEmatched(
false), HCALBmatched(
false), HCALEmatched(
false);
243 if (TheCSCSegments.
isValid()) {
246 CSCDetId iCscDetID = iSegment->cscDetId();
247 bool Segment1IsGood =
true;
251 for (reco::MuonCollection::const_iterator
mu = TheMuons->begin();
mu != TheMuons->end() && (Segment1IsGood);
253 if (!
mu->isTrackerMuon() && !
mu->isGlobalMuon() &&
mu->isStandAloneMuon())
255 if (!
mu->isGlobalMuon() &&
mu->isTrackerMuon() &&
mu->pt() < 3)
257 const std::vector<MuonChamberMatch>
chambers =
mu->matches();
258 for (std::vector<MuonChamberMatch>::const_iterator kChamber =
chambers.begin(); kChamber !=
chambers.end();
262 for (std::vector<reco::MuonSegmentMatch>::const_iterator kSegment = kChamber->segmentMatches.begin();
263 kSegment != kChamber->segmentMatches.end();
266 CSCDetId kCscDetID = cscSegRef->cscDetId();
268 if (kCscDetID == iCscDetID) {
269 Segment1IsGood =
false;
280 LocalPoint iLocalPosition = iSegment->localPosition();
281 LocalVector iLocalDirection = iSegment->localDirection();
286 float iTheta = iGlobalDirection.
theta();
290 float iPhi = iGlobalPosition.
phi();
291 float iR =
sqrt(iGlobalPosition.
perp2());
292 float iZ = iGlobalPosition.
z();
293 float iT = iSegment->time();
300 bool ebmatched =
SegmentMatchingEB(TheGlobalHaloData, hccandEB, iZ, iR, iT, iPhi, ishlt);
301 bool eematched =
SegmentMatchingEE(TheGlobalHaloData, hccandEE, iZ, iR, iT, iPhi, ishlt);
302 bool hbmatched =
SegmentMatchingHB(TheGlobalHaloData, hccandHB, iZ, iR, iT, iPhi, ishlt);
303 bool hematched =
SegmentMatchingHE(TheGlobalHaloData, hccandHE, iZ, iR, iT, iPhi, ishlt);
305 ECALBmatched |= ebmatched;
306 ECALEmatched |= eematched;
307 HCALBmatched |= hbmatched;
308 HCALEmatched |= hematched;
321 bool HaloPatternFoundInEB =
false;
322 for (
auto& hcand : hccandEB) {
323 if ((hcand.getIsHaloFromPattern() && !ishlt) || (hcand.getIsHaloFromPattern_HLT() && ishlt)) {
324 HaloPatternFoundInEB =
true;
330 bool HaloPatternFoundInEE =
false;
331 for (
auto& hcand : hccandEE) {
332 if ((hcand.getIsHaloFromPattern() && !ishlt) || (hcand.getIsHaloFromPattern_HLT() && ishlt)) {
333 HaloPatternFoundInEE =
true;
339 bool HaloPatternFoundInHB =
false;
340 for (
auto& hcand : hccandHB) {
341 if ((hcand.getIsHaloFromPattern() && !ishlt) || (hcand.getIsHaloFromPattern_HLT() && ishlt)) {
342 HaloPatternFoundInHB =
true;
348 bool HaloPatternFoundInHE =
false;
349 for (
auto& hcand : hccandHE) {
350 if ((hcand.getIsHaloFromPattern() && !ishlt) || (hcand.getIsHaloFromPattern_HLT() && ishlt)) {
351 HaloPatternFoundInHE =
true;
361 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)