48 float METOverSumEt = TheCaloMET.
sumEt() ? TheCaloMET.
pt() / TheCaloMET.
sumEt() : 0 ;
51 int EcalOverlapping_CSCRecHits[361] = {};
52 int EcalOverlapping_CSCSegments[361] = {};
53 int HcalOverlapping_CSCRecHits[73] = {};
54 int HcalOverlapping_CSCSegments[73] = {};
60 bool EcalOverlap[361];
62 for(
int i = 0 ;
i < 361 ;
i++ )
64 EcalOverlap[
i] =
false;
65 if(
i < 73 ) HcalOverlap[
i] =
false;
68 std::vector<CSCRecHit2D> Hits = iSegment->specificRecHits() ;
69 for(std::vector<CSCRecHit2D>::iterator iHit = Hits.begin() ; iHit != Hits.end(); iHit++ )
71 DetId TheDetUnitId(iHit->geographicalId());
76 LocalPoint TheLocalPosition = iHit->localPosition();
78 const GlobalPoint TheGlobalPosition = TheSurface.toGlobal(TheLocalPosition);
82 float x = TheGlobalPosition.
x();
83 float y = TheGlobalPosition.
y();
85 float r = TMath::Sqrt( x*x + y*y);
88 EcalOverlap[Ecal_iphi] =
true;
90 HcalOverlap[Hcal_iphi] =
true;
92 for(
int i = 0 ;
i < 361 ;
i++ )
94 if( EcalOverlap[
i] ) EcalOverlapping_CSCSegments[
i]++;
95 if( i < 73 && HcalOverlap[i] )
96 HcalOverlapping_CSCSegments[
i]++;
105 DetId TheDetUnitId(iCSCRecHit->geographicalId());
110 LocalPoint TheLocalPosition = iCSCRecHit->localPosition();
112 const GlobalPoint TheGlobalPosition = TheSurface.toGlobal(TheLocalPosition);
116 float x = TheGlobalPosition.
x();
117 float y = TheGlobalPosition.
y();
119 float r = TMath::Sqrt(x*x + y*y);
121 if( r < Ecal_R_Max && r > Ecal_R_Min )
122 EcalOverlapping_CSCRecHits[Ecaliphi] ++;
124 HcalOverlapping_CSCRecHits[Hcaliphi] ++ ;
130 std::vector<PhiWedge> EcalWedges = TheEcalHaloData.
GetPhiWedges();
133 std::vector<PhiWedge> HcalWedges = TheHcalHaloData.
GetPhiWedges();
144 std::vector<int> vEcaliPhi, vHcaliPhi;
147 int N_Unmatched_Tracks = 0;
149 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());
158 bool MATCHED =
false;
161 for( std::vector<PhiWedge>::iterator iWedge = EcalWedges.begin() ; iWedge != EcalWedges.end() ; iWedge++ )
163 if( (
TMath::Abs( global_EcaliPhi - iWedge->iPhi() ) <= 5 ) && (global_r > Ecal_R_Min && global_r <
Ecal_R_Max ) )
165 bool StoreWedge =
true;
166 for(
unsigned int i = 0 ;
i< vEcaliPhi.size() ;
i++ )
if ( vEcaliPhi[
i] == iWedge->iPhi() ) StoreWedge =
false;
171 NewWedge.SetOverlappingCSCSegments( EcalOverlapping_CSCSegments[iWedge->iPhi()] );
172 NewWedge.SetOverlappingCSCRecHits( EcalOverlapping_CSCRecHits[iWedge->iPhi()] );
173 vEcaliPhi.push_back( iWedge->iPhi() );
180 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++ )
if( vHcaliPhi[
i] == iWedge->iPhi() ) StoreWedge =
false;
189 vHcaliPhi.push_back( iWedge->iPhi() ) ;
191 NewWedge.SetOverlappingCSCSegments( HcalOverlapping_CSCSegments[iWedge->iPhi()] );
192 NewWedge.SetOverlappingCSCRecHits( HcalOverlapping_CSCRecHits[iWedge->iPhi()] );
199 if( !MATCHED ) N_Unmatched_Tracks ++;
213 if(
abs(iTower->
ieta()) > 24 )
continue;
214 int iphi = iTower->
iphi();
215 for(
unsigned int x = 0 ; x < vEcaliPhi.size() ; x++ )
217 if( iphi == vEcaliPhi[x] )
219 dMEx += ( TMath::Cos(iTower->
phi())*iTower->
emEt() );
220 dMEy += ( TMath::Sin(iTower->
phi())*iTower->
emEt() );
223 for(
unsigned int x = 0 ; x < vHcaliPhi.size() ; x++ )
225 if( iphi == vHcaliPhi[x] )
227 dMEx += ( TMath::Cos(iTower->
phi() )*iTower->
hadEt() ) ;
228 dMEy += ( TMath::Sin(iTower->
phi() )*iTower->
hadEt() ) ;
244 bool ECALBmatched(
false), ECALEmatched(
false),HCALBmatched(
false),HCALEmatched(
false);
246 if (TheCSCSegments.
isValid()) {
248 iSegment != TheCSCSegments->end();
251 CSCDetId iCscDetID = iSegment->cscDetId();
252 bool Segment1IsGood=
true;
258 for(reco::MuonCollection::const_iterator
mu = TheMuons->begin();
mu!= TheMuons->end() && (Segment1IsGood) ;
mu++ )
261 if( !
mu->isTrackerMuon() && !
mu->isGlobalMuon() &&
mu->isStandAloneMuon() )
continue;
262 if( !
mu->isGlobalMuon() &&
mu->isTrackerMuon() &&
mu->pt()<3)
continue;
263 const std::vector<MuonChamberMatch>
chambers =
mu->matches();
264 for(std::vector<MuonChamberMatch>::const_iterator kChamber = chambers.begin();
265 kChamber != chambers.end(); kChamber ++ )
268 for( std::vector<reco::MuonSegmentMatch>::const_iterator kSegment = kChamber->segmentMatches.begin();
269 kSegment != kChamber->segmentMatches.end(); kSegment++ )
272 CSCDetId kCscDetID = cscSegRef->cscDetId();
274 if( kCscDetID == iCscDetID )
276 Segment1IsGood =
false;
283 if(!Segment1IsGood)
continue;
287 LocalPoint iLocalPosition = iSegment->localPosition();
288 LocalVector iLocalDirection = iSegment->localDirection();
293 float iTheta = iGlobalDirection.
theta();
296 float iPhi = iGlobalPosition.
phi();
297 float iR =
sqrt(iGlobalPosition.
perp2()) ;
298 float iZ = iGlobalPosition.
z();
299 float iT = iSegment->time();
306 bool ebmatched =
SegmentMatchingEB(TheGlobalHaloData,hccandEB,iZ,iR,iT,iPhi,ishlt);
307 bool eematched =
SegmentMatchingEE(TheGlobalHaloData,hccandEE,iZ,iR,iT,iPhi,ishlt);
308 bool hbmatched =
SegmentMatchingHB(TheGlobalHaloData,hccandHB,iZ,iR,iT,iPhi,ishlt);
309 bool hematched =
SegmentMatchingHE(TheGlobalHaloData,hccandHE,iZ,iR,iT,iPhi,ishlt);
311 ECALBmatched |= ebmatched;
312 ECALEmatched |= eematched;
313 HCALBmatched |= hbmatched;
314 HCALEmatched |= hematched;
330 bool HaloPatternFoundInEB =
false;
331 for(
auto & hcand : hccandEB){
332 if((hcand.getIsHaloFromPattern() &&!ishlt)||(hcand.getIsHaloFromPattern_HLT() &&ishlt)){
333 HaloPatternFoundInEB =
true;
340 bool HaloPatternFoundInEE =
false;
341 for(
auto & hcand : hccandEE){
342 if((hcand.getIsHaloFromPattern() &&!ishlt)||(hcand.getIsHaloFromPattern_HLT() &&ishlt)){
343 HaloPatternFoundInEE =
true;
350 bool HaloPatternFoundInHB =
false;
351 for(
auto & hcand : hccandHB){
352 if((hcand.getIsHaloFromPattern() &&!ishlt)||(hcand.getIsHaloFromPattern_HLT() &&ishlt)){
353 HaloPatternFoundInHB =
true;
360 bool HaloPatternFoundInHE =
false;
361 for(
auto & hcand : hccandHE){
362 if((hcand.getIsHaloFromPattern() &&!ishlt)||(hcand.getIsHaloFromPattern_HLT() &&ishlt)){
363 HaloPatternFoundInHE =
true;
373 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
C::const_iterator const_iterator
constant access iterator type
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
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)