15 float phi_degrees = phi * (360.) / ( 2. *
TMath::Pi() ) ;
16 int iPhi = (int) ( ( phi_degrees/5. ) + 1.);
18 return iPhi < 73 ? iPhi : 73 ;
24 float phi_degrees = phi * (360.) / ( 2. *
TMath::Pi() ) ;
25 int iPhi = (int) ( phi_degrees + 1.);
27 return iPhi < 361 ? iPhi : 360 ;
44 float METOverSumEt = TheCaloMET.
sumEt() ? TheCaloMET.
pt() / TheCaloMET.
sumEt() : 0 ;
50 int EcalOverlapping_CSCRecHits[361];
51 int EcalOverlapping_CSCSegments[361];
52 int HcalOverlapping_CSCRecHits[73];
53 int HcalOverlapping_CSCSegments[73];
59 bool EcalOverlap[361];
61 for(
int i = 0 ;
i < 361 ;
i++ )
63 EcalOverlap[
i] =
false;
64 if(
i < 73 ) HcalOverlap[
i] =
false;
67 std::vector<CSCRecHit2D> Hits = iSegment->specificRecHits() ;
68 for(std::vector<CSCRecHit2D>::iterator iHit = Hits.begin() ; iHit != Hits.end(); iHit++ )
70 DetId TheDetUnitId(iHit->geographicalId());
75 LocalPoint TheLocalPosition = iHit->localPosition();
81 float x = TheGlobalPosition.
x();
82 float y = TheGlobalPosition.
y();
84 float r = TMath::Sqrt( x*x + y*y);
86 if( r < Ecal_R_Max && r > Ecal_R_Min )
87 EcalOverlap[Ecal_iphi] =
true;
88 if( r < Hcal_R_Max && r > Hcal_R_Max )
89 HcalOverlap[Hcal_iphi] =
true;
91 for(
int i = 0 ;
i < 361 ;
i++ )
93 if( EcalOverlap[
i] ) EcalOverlapping_CSCSegments[
i]++;
94 if( i < 73 && HcalOverlap[i] )
95 HcalOverlapping_CSCSegments[
i]++;
104 DetId TheDetUnitId(iCSCRecHit->geographicalId());
109 LocalPoint TheLocalPosition = iCSCRecHit->localPosition();
115 float x = TheGlobalPosition.
x();
116 float y = TheGlobalPosition.
y();
118 float r = TMath::Sqrt(x*x + y*y);
120 if( r < Ecal_R_Max && r > Ecal_R_Min )
121 EcalOverlapping_CSCRecHits[Ecaliphi] ++;
122 if( r < Hcal_R_Max && r > Hcal_R_Max )
123 HcalOverlapping_CSCRecHits[Hcaliphi] ++ ;
129 std::vector<PhiWedge> EcalWedges = TheEcalHaloData.
GetPhiWedges();
132 std::vector<PhiWedge> HcalWedges = TheHcalHaloData.
GetPhiWedges();
143 std::vector<int> vEcaliPhi, vHcaliPhi;
146 int N_Unmatched_Tracks = 0;
148 for( std::vector<GlobalPoint>::iterator Pos = TheGlobalPositions.begin() ; Pos != TheGlobalPositions.end() ; Pos ++ )
151 float global_phi = Pos->phi();
152 float global_r = TMath::Sqrt(Pos->x()*Pos->x() + Pos->y()*Pos->y());
157 bool MATCHED =
false;
160 for( std::vector<PhiWedge>::iterator iWedge = EcalWedges.begin() ; iWedge != EcalWedges.end() ; iWedge++ )
162 if( (TMath::Abs( global_EcaliPhi - iWedge->iPhi() ) <= 5 ) && (global_r > Ecal_R_Min && global_r < Ecal_R_Max ) )
164 bool StoreWedge =
true;
165 for(
unsigned int i = 0 ;
i< vEcaliPhi.size() ;
i++ )
if ( vEcaliPhi[
i] == iWedge->iPhi() ) StoreWedge =
false;
172 vEcaliPhi.push_back( iWedge->iPhi() );
179 for( std::vector<PhiWedge>::iterator iWedge = HcalWedges.begin() ; iWedge != HcalWedges.end() ; iWedge++ )
181 if( (TMath::Abs( global_HcaliPhi - iWedge->iPhi() ) <= 2 ) && (global_r > Hcal_R_Min && global_r < Hcal_R_Max ) )
183 bool StoreWedge =
true;
184 for(
unsigned int i = 0 ;
i < vHcaliPhi.size() ;
i++ )
if( vHcaliPhi[
i] == iWedge->iPhi() ) StoreWedge =
false;
188 vHcaliPhi.push_back( iWedge->iPhi() ) ;
198 if( !MATCHED ) N_Unmatched_Tracks ++;
211 if( iTower->
et() < TowerEtThreshold )
continue;
212 if(
abs(iTower->
ieta()) > 24 )
continue;
213 int iphi = iTower->
iphi();
214 for(
unsigned int x = 0 ;
x < vEcaliPhi.size() ;
x++ )
216 if( iphi == vEcaliPhi[
x] )
218 dMEx += ( TMath::Cos(iTower->
phi())*iTower->
emEt() );
219 dMEy += ( TMath::Sin(iTower->
phi())*iTower->
emEt() );
222 for(
unsigned int x = 0 ;
x < vHcaliPhi.size() ;
x++ )
224 if( iphi == vHcaliPhi[
x] )
226 dMEx += ( TMath::Cos(iTower->
phi() )*iTower->
hadEt() ) ;
227 dMEy += ( TMath::Sin(iTower->
phi() )*iTower->
hadEt() ) ;
234 return TheGlobalHaloData;
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const std::vector< PhiWedge > & GetPhiWedges() const
Geom::Phi< T > phi() const
void SetMETOverSumEt(float x)
reco::GlobalHaloData Calculate(const CaloGeometry &TheCaloGeometry, const CSCGeometry &TheCSCGeometry, const reco::CaloMET &TheCaloMET, edm::Handle< edm::View< reco::Candidate > > &TheCaloTowers, edm::Handle< CSCSegmentCollection > &TheCSCSegments, edm::Handle< CSCRecHit2DCollection > &TheCSCRecHits, const reco::CSCHaloData &TheCSCHaloData, const reco::EcalHaloData &TheEcalHaloData, const reco::HcalHaloData &TheHcalHaloData)
std::vector< PhiWedge > & GetMatchedEcalPhiWedges()
C::const_iterator const_iterator
constant access iterator type
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
int Phi_To_HcaliPhi(float phi)
const std::vector< GlobalPoint > & GetCSCTrackImpactPositions() const
void SetMETCorrections(float x, float y)
virtual double pt() const
transverse momentum
void SetOverlappingCSCRecHits(int x)
const BoundPlane & surface() const
The nominal surface of the GeomDet.
std::vector< PhiWedge > & GetMatchedHcalPhiWedges()
void SetOverlappingCSCSegments(int x)
int Phi_To_EcaliPhi(float phi)
const std::vector< PhiWedge > & GetPhiWedges() const
double et(double vtxZ) const
virtual double phi() const
momentum azimuthal angle