17 std::cout<<
"entering test link by rechit function"<<std::endl;
25 double clusterZ = cluster.
position().Z();
30 double horesolscale=1.0;
39 double tracketa = 999999.9;
40 double trackphi = 999999.9;
41 double track_X = 999999.9;
42 double track_Y = 999999.9;
43 double track_Z = 999999.9;
51 switch (cluster.
layer()) {
56 std::cout <<
"Fetching Ecal Resolution Maps"
60 if( ! atECAL.
isValid() )
return -1.;
80 std::cout <<
"Fetching Hcal Resolution Maps"
92 if( ! atHCAL.
isValid() )
return -1.;
97 if ( dHPhi >
M_PI ) dHPhi = dHPhi - 2.*
M_PI;
98 else if ( dHPhi < -
M_PI ) dHPhi = dHPhi + 2.*
M_PI;
116 std::cout <<
"Fetching HO Resolution Maps"
127 if( ! atHO.
isValid() )
return -1.;
137 if ( fabs(track_Z) > 700.25 )
return -1.;
164 std::cout <<
"No link by rechit possible for pre-shower yet!"
180 if ( !hcal && fabs(track_Z) < 300. )
return -1.;
181 if ( track_Z * clusterZ < 0. )
return -1.;
186 if ( !hcal && fabs(track_Z) > 300. )
return -1.;
193 if(debug)
std::cout<<
"test link by rechit "<< dist <<
" "<<std::endl;
196 <<
" clusterphi " << clusterphi
197 <<
" tracketa " << tracketa
198 <<
" trackphi " << trackphi << std::endl;
207 const std::vector< reco::PFRecHitFraction >&
210 bool linkedbyrechit =
false;
212 for(
unsigned int rhit = 0; rhit < fracs.size(); ++rhit){
215 double fraction = fracs[rhit].fraction();
216 if(fraction < 1E-4)
continue;
227 const std::vector< math::XYZPoint >&
229 const std::vector<reco::PFRecHit::REPPoint>& corners =
231 assert(corners.size() == 4);
233 if( barrel || hcal ){
240 = fabs(corners[0].
Eta() - corners[2].
Eta());
242 = fabs(corners[0].
Phi() - corners[2].
Phi());
243 if ( rhsizePhi >
M_PI ) rhsizePhi = 2.*
M_PI - rhsizePhi;
245 const double mult = horesolscale * (1.50 + 0.5/fracs.size());
246 rhsizeEta = rhsizeEta * mult + 0.2*fabs(dHEta);
247 rhsizePhi = rhsizePhi * mult + 0.2*fabs(dHPhi);
250 const double mult = 2.00 + 1.0/(fracs.size()*
std::min(1.,0.5*trackPt));
258 << posrep.Eta() <<
" "
259 << posrep.Phi() <<
" "
260 << rechit_cluster.
energy()
262 for (
unsigned jc=0; jc<4; ++jc )
264 <<
" "<<corners[jc].Phi()<<std::endl;
266 std::cout <<
"RecHit SizeEta=" << rhsizeEta
267 <<
" SizePhi=" << rhsizePhi << std::endl;
274 double deta = fabs(posrep.Eta() - tracketa);
275 double dphi = fabs(posrep.Phi() - trackphi);
276 if ( dphi >
M_PI ) dphi = 2.*
M_PI - dphi;
283 if(deta < (0.5*rhsizeEta) && dphi < (0.5*rhsizePhi))
284 std::cout <<
" link here !" << std::endl;
289 if(deta < (0.5*rhsizeEta) && dphi < (0.5*rhsizePhi)){
290 linkedbyrechit =
true;
314 for (
unsigned jc=0; jc<4; ++jc ) {
316 const double mult = (1.00+0.50/(fracs.size()*
std::min(1.,0.5*trackPt)));
317 x[jc] = cornerposxyz.X() + (cornerposxyz.X()-posxyz.X()) * mult;
318 y[jc] = cornerposxyz.Y() + (cornerposxyz.Y()-posxyz.Y()) * mult;
323 <<
" " << cornerposxyz.X()
324 <<
" " << cornerposxyz.Y()
337 bool isinside = TMath::IsInside(track_X,
342 linkedbyrechit =
true;
349 if( linkedbyrechit ) {
352 std::cout <<
"Track and Cluster LINKED BY RECHIT" << std::endl;
388 static const double resPSpitch = 0.19/
sqrt(12.);
389 static const double resPSlength = 6.1/
sqrt(12.);
398 std::cout<<
"entering test link by rechit function for ECAL and PS"<<std::endl;
402 double zECAL = clusterECAL.
position().Z();
403 double xECAL = clusterECAL.
position().X();
404 double yECAL = clusterECAL.
position().Y();
407 double zPS = clusterPS.
position().Z();
408 double xPS = clusterPS.
position().X();
409 double yPS = clusterPS.
position().Y();
411 if (zECAL*zPS <0.)
return -1.;
415 switch (clusterPS.
layer()) {
418 deltaX = resPSpitch * sqr12;
419 deltaY = resPSlength * sqr12;
423 deltaY = resPSpitch * sqr12;
424 deltaX = resPSlength * sqr12;
431 const std::vector< reco::PFRecHitFraction >& fracs = clusterECAL.
recHitFractions();
432 bool linkedbyrechit =
false;
434 for(
unsigned int rhit = 0; rhit < fracs.size(); ++rhit){
437 double fraction = fracs[rhit].fraction();
438 if(fraction < 1E-4)
continue;
445 const std::vector< math::XYZPoint >& corners = rechit_cluster.
getCornersXYZ();
446 assert(corners.size() == 4);
451 std::cout <<
"Ecal rechit " << posxyz.X() <<
" " << posxyz.Y() << std::endl;
452 std::cout <<
"PS cluster " << xPS <<
" " << yPS << std::endl;
458 for (
unsigned jc=0; jc<4; ++jc ) {
462 x[jc] = cornerpos.X() + (cornerpos.X()-posxyz.X()) * (0.05 +1.0/fabs((cornerpos.X()-posxyz.X()))*0.5*deltaX);
463 y[jc] = cornerpos.Y() + (cornerpos.Y()-posxyz.Y()) * (0.05 +1.0/fabs((cornerpos.Y()-posxyz.Y()))*0.5*deltaY);
468 <<
" " << cornerpos.X() <<
" " << x[jc]
469 <<
" " << cornerpos.Y() <<
" " << y[jc]
482 bool isinside = TMath::IsInside(xPS,yPS,5,x,y);
485 linkedbyrechit =
true;
491 if( linkedbyrechit ) {
492 if( debug )
std::cout <<
"Cluster PS and Cluster ECAL LINKED BY RECHIT" << std::endl;
493 double dist =
computeDist( xECAL/1000.,yECAL/1000.,
513 double dX = posxyzEM.X()-posxyzHAD.X();
514 double dY = posxyzEM.Y()-posxyzHAD.Y();
515 double sameZ = posxyzEM.Z()*posxyzHAD.Z();
517 if(sameZ<0)
return -1.;
519 double dist2 = dX*dX + dY*dY;
523 double dist =
sqrt( dist2 );
533 double eta2,
double phi2,
536 const double phicor = etaPhi ?
normalizedPhi(phi1 - phi2) : phi1 - phi2;
537 const double etadiff = eta1 - eta2;
543 return std::sqrt(etadiff*etadiff + phicor*phicor);
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
const math::XYZPoint & position() const
cluster centroid position
reconstructed track used as an input to particle flow
static double computeDist(double eta1, double phi1, double eta2, double phi2, bool etaPhi=true)
computes a chisquare
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< Double32_t > > REPPoint
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
static double testECALAndPSByRecHit(const reco::PFCluster &clusterECAL, const reco::PFCluster &clusterPS, bool debug=false)
const math::XYZPoint & position() const
cartesian position (x, y, z)
const std::vector< math::XYZPoint > & getCornersXYZ() const
rechit corners
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Point of closest approach from beam axis (initial point in the case of PFSimParticle) ...
const REPPoint & positionREP() const
cluster position: rho, eta, phi
const std::vector< REPPoint > & getCornersREP() const
const reco::PFTrajectoryPoint & extrapolatedPoint(unsigned layerid) const
bool isNull() const
Checks for null.
const math::XYZPoint & position() const
rechit cell centre x, y, z
const math::XYZTLorentzVector & momentum() const
4-momenta quadrivector
bool isValid() const
is this point valid ?
XYZPointD XYZPoint
point in space with cartesian internal representation
static double testHFEMAndHFHADByRecHit(const reco::PFCluster &clusterHFEM, const reco::PFCluster &clusterHFHAD, bool debug=false)
test association between HFEM and HFHAD, by rechit
double energy() const
rechit energy
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
const REPPoint & positionREP() const
static double testTrackAndClusterByRecHit(const reco::PFRecTrack &track, const reco::PFCluster &cluster, bool isBrem=false, bool debug=false)