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++) {
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++) {
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++;
212 const CaloTower* iTower = dynamic_cast<const CaloTower*>(
c);
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;