48 float METOverSumEt = TheCaloMET.
sumEt() ? TheCaloMET.
pt() / TheCaloMET.
sumEt() : 0 ;
54 int EcalOverlapping_CSCRecHits[361];
55 int EcalOverlapping_CSCSegments[361];
56 int HcalOverlapping_CSCRecHits[73];
57 int HcalOverlapping_CSCSegments[73];
63 bool EcalOverlap[361];
65 for(
int i = 0 ;
i < 361 ;
i++ )
67 EcalOverlap[
i] =
false;
68 if(
i < 73 ) HcalOverlap[
i] =
false;
71 std::vector<CSCRecHit2D> Hits = iSegment->specificRecHits() ;
72 for(std::vector<CSCRecHit2D>::iterator iHit = Hits.begin() ; iHit != Hits.end(); iHit++ )
74 DetId TheDetUnitId(iHit->geographicalId());
79 LocalPoint TheLocalPosition = iHit->localPosition();
81 const GlobalPoint TheGlobalPosition = TheSurface.toGlobal(TheLocalPosition);
85 float x = TheGlobalPosition.
x();
86 float y = TheGlobalPosition.
y();
88 float r = TMath::Sqrt( x*x + y*y);
91 EcalOverlap[Ecal_iphi] =
true;
93 HcalOverlap[Hcal_iphi] =
true;
95 for(
int i = 0 ;
i < 361 ;
i++ )
97 if( EcalOverlap[
i] ) EcalOverlapping_CSCSegments[
i]++;
98 if( i < 73 && HcalOverlap[i] )
99 HcalOverlapping_CSCSegments[
i]++;
108 DetId TheDetUnitId(iCSCRecHit->geographicalId());
113 LocalPoint TheLocalPosition = iCSCRecHit->localPosition();
115 const GlobalPoint TheGlobalPosition = TheSurface.toGlobal(TheLocalPosition);
119 float x = TheGlobalPosition.
x();
120 float y = TheGlobalPosition.
y();
122 float r = TMath::Sqrt(x*x + y*y);
124 if( r < Ecal_R_Max && r > Ecal_R_Min )
125 EcalOverlapping_CSCRecHits[Ecaliphi] ++;
127 HcalOverlapping_CSCRecHits[Hcaliphi] ++ ;
133 std::vector<PhiWedge> EcalWedges = TheEcalHaloData.
GetPhiWedges();
136 std::vector<PhiWedge> HcalWedges = TheHcalHaloData.
GetPhiWedges();
147 std::vector<int> vEcaliPhi, vHcaliPhi;
150 int N_Unmatched_Tracks = 0;
152 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 if( (
TMath::Abs( global_EcaliPhi - iWedge->iPhi() ) <= 5 ) && (global_r > Ecal_R_Min && global_r <
Ecal_R_Max ) )
168 bool StoreWedge =
true;
169 for(
unsigned int i = 0 ;
i< vEcaliPhi.size() ;
i++ )
if ( vEcaliPhi[
i] == iWedge->iPhi() ) StoreWedge =
false;
174 NewWedge.SetOverlappingCSCSegments( EcalOverlapping_CSCSegments[iWedge->iPhi()] );
175 NewWedge.SetOverlappingCSCRecHits( EcalOverlapping_CSCRecHits[iWedge->iPhi()] );
176 vEcaliPhi.push_back( iWedge->iPhi() );
183 for( std::vector<PhiWedge>::iterator iWedge = HcalWedges.begin() ; iWedge != HcalWedges.end() ; iWedge++ )
187 bool StoreWedge =
true;
188 for(
unsigned int i = 0 ;
i < vHcaliPhi.size() ;
i++ )
if( vHcaliPhi[
i] == iWedge->iPhi() ) StoreWedge =
false;
192 vHcaliPhi.push_back( iWedge->iPhi() ) ;
194 NewWedge.SetOverlappingCSCSegments( HcalOverlapping_CSCSegments[iWedge->iPhi()] );
195 NewWedge.SetOverlappingCSCRecHits( HcalOverlapping_CSCRecHits[iWedge->iPhi()] );
202 if( !MATCHED ) N_Unmatched_Tracks ++;
216 if(
abs(iTower->
ieta()) > 24 )
continue;
217 int iphi = iTower->
iphi();
218 for(
unsigned int x = 0 ; x < vEcaliPhi.size() ; x++ )
220 if( iphi == vEcaliPhi[x] )
222 dMEx += ( TMath::Cos(iTower->
phi())*iTower->
emEt() );
223 dMEy += ( TMath::Sin(iTower->
phi())*iTower->
emEt() );
226 for(
unsigned int x = 0 ; x < vHcaliPhi.size() ; x++ )
228 if( iphi == vHcaliPhi[x] )
230 dMEx += ( TMath::Cos(iTower->
phi() )*iTower->
hadEt() ) ;
231 dMEy += ( TMath::Sin(iTower->
phi() )*iTower->
hadEt() ) ;
247 bool ECALBmatched(
false), ECALEmatched(
false),HCALBmatched(
false),HCALEmatched(
false);
249 if (TheCSCSegments.
isValid()) {
251 iSegment != TheCSCSegments->end();
254 CSCDetId iCscDetID = iSegment->cscDetId();
255 bool Segment1IsGood=
true;
261 for(reco::MuonCollection::const_iterator
mu = TheMuons->begin();
mu!= TheMuons->end() && (Segment1IsGood) ;
mu++ )
264 if( !
mu->isTrackerMuon() && !
mu->isGlobalMuon() &&
mu->isStandAloneMuon() )
continue;
265 if( !
mu->isGlobalMuon() &&
mu->isTrackerMuon() &&
mu->pt()<3)
continue;
266 const std::vector<MuonChamberMatch>
chambers =
mu->matches();
267 for(std::vector<MuonChamberMatch>::const_iterator kChamber = chambers.begin();
268 kChamber != chambers.end(); kChamber ++ )
271 for( std::vector<reco::MuonSegmentMatch>::const_iterator kSegment = kChamber->segmentMatches.begin();
272 kSegment != kChamber->segmentMatches.end(); kSegment++ )
275 CSCDetId kCscDetID = cscSegRef->cscDetId();
277 if( kCscDetID == iCscDetID )
279 Segment1IsGood =
false;
286 if(!Segment1IsGood)
continue;
290 LocalPoint iLocalPosition = iSegment->localPosition();
291 LocalVector iLocalDirection = iSegment->localDirection();
296 float iTheta = iGlobalDirection.
theta();
299 float iPhi = iGlobalPosition.
phi();
300 float iR =
sqrt(iGlobalPosition.
perp2()) ;
301 float iZ = iGlobalPosition.
z();
302 float iT = iSegment->time();
309 bool ebmatched =
SegmentMatchingEB(TheGlobalHaloData,hccandEB,iZ,iR,iT,iPhi,ishlt);
310 bool eematched =
SegmentMatchingEE(TheGlobalHaloData,hccandEE,iZ,iR,iT,iPhi,ishlt);
311 bool hbmatched =
SegmentMatchingHB(TheGlobalHaloData,hccandHB,iZ,iR,iT,iPhi,ishlt);
312 bool hematched =
SegmentMatchingHE(TheGlobalHaloData,hccandHE,iZ,iR,iT,iPhi,ishlt);
314 ECALBmatched |= ebmatched;
315 ECALEmatched |= eematched;
316 HCALBmatched |= hbmatched;
317 HCALEmatched |= hematched;
333 bool HaloPatternFoundInEB =
false;
334 for(
auto & hcand : hccandEB){
335 if((hcand.getIsHaloFromPattern() &&!ishlt)||(hcand.getIsHaloFromPattern_HLT() &&ishlt)){
336 HaloPatternFoundInEB =
true;
343 bool HaloPatternFoundInEE =
false;
344 for(
auto & hcand : hccandEE){
345 if((hcand.getIsHaloFromPattern() &&!ishlt)||(hcand.getIsHaloFromPattern_HLT() &&ishlt)){
346 HaloPatternFoundInEE =
true;
353 bool HaloPatternFoundInHB =
false;
354 for(
auto & hcand : hccandHB){
355 if((hcand.getIsHaloFromPattern() &&!ishlt)||(hcand.getIsHaloFromPattern_HLT() &&ishlt)){
356 HaloPatternFoundInHB =
true;
363 bool HaloPatternFoundInHE =
false;
364 for(
auto & hcand : hccandHE){
365 if((hcand.getIsHaloFromPattern() &&!ishlt)||(hcand.getIsHaloFromPattern_HLT() &&ishlt)){
366 HaloPatternFoundInHE =
true;
376 return TheGlobalHaloData;
const std::vector< HaloClusterCandidateHCAL > & getHaloClusterCandidatesHB() const
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)
void SetSegmentIsEECaloMatched(bool b)
const std::vector< PhiWedge > & GetPhiWedges() const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
void SetMETOverSumEt(float x)
double pt() const final
transverse momentum
std::vector< PhiWedge > & GetMatchedEcalPhiWedges()
const Plane & surface() const
The nominal surface of the GeomDet.
void SetHaloPatternFoundHE(bool b)
Geom::Theta< T > theta() const
const_iterator begin() const
const std::vector< HaloClusterCandidateECAL > & getHaloClusterCandidatesEB() const
int Phi_To_HcaliPhi(float phi)
void SetHaloPatternFoundEE(bool b)
void SetSegmentIsEBCaloMatched(bool b)
const std::vector< GlobalPoint > & GetCSCTrackImpactPositions() const
Abs< T >::type abs(const T &t)
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)
void AddtoBeamHaloHBHERechits(edm::RefVector< HBHERecHitCollection > &bhtaggedrechits, reco::GlobalHaloData &thehalodata)
void SetMETCorrections(float x, float y)
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::vector< PhiWedge > & GetMatchedHcalPhiWedges()
const std::vector< HaloClusterCandidateHCAL > & getHaloClusterCandidatesHE() 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)
const std::vector< PhiWedge > & GetPhiWedges() const
void SetSegmentIsHECaloMatched(bool b)
double et(double vtxZ) const
const_iterator end() const
void SetSegmentIsHBCaloMatched(bool b)
const std::vector< HaloClusterCandidateECAL > & getHaloClusterCandidatesEE() const
static char chambers[264][20]
double phi() const final
momentum azimuthal angle
void SetHaloPatternFoundHB(bool b)
void SetHaloPatternFoundEB(bool b)