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;
48 double trackPt = isBrem ? 999. :
sqrt(atVertex.
momentum().Vect().Perp2());
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 rhsizeEta = rhsizeEta * horesolscale * (1.50 + 0.5/fracs.size()) + 0.2*fabs(dHEta);
246 rhsizePhi = rhsizePhi * horesolscale * (1.50 + 0.5/fracs.size()) + 0.2*fabs(dHPhi);
249 rhsizeEta *= 2.00 + 1.0/fracs.size()/
std::min(1.,trackPt/2.);
250 rhsizePhi *= 2.00 + 1.0/fracs.size()/
std::min(1.,trackPt/2.);
256 << posrep.Eta() <<
" "
257 << posrep.Phi() <<
" "
258 << rechit_cluster.
energy()
260 for (
unsigned jc=0; jc<4; ++jc )
262 <<
" "<<corners[jc].Phi()<<std::endl;
264 std::cout <<
"RecHit SizeEta=" << rhsizeEta
265 <<
" SizePhi=" << rhsizePhi << std::endl;
272 double deta = fabs(posrep.Eta() - tracketa);
273 double dphi = fabs(posrep.Phi() - trackphi);
274 if ( dphi >
M_PI ) dphi = 2.*
M_PI - dphi;
281 if(deta < (rhsizeEta/2.) && dphi < (rhsizePhi/2.))
282 std::cout <<
" link here !" << std::endl;
287 if(deta < (rhsizeEta/2.) && dphi < (rhsizePhi/2.)){
288 linkedbyrechit =
true;
312 for (
unsigned jc=0; jc<4; ++jc ) {
314 x[jc] = cornerposxyz.X() + (cornerposxyz.X()-posxyz.X())
315 * (1.00+0.50/fracs.size()/
std::min(1.,trackPt/2.));
316 y[jc] = cornerposxyz.Y() + (cornerposxyz.Y()-posxyz.Y())
317 * (1.00+0.50/fracs.size()/
std::min(1.,trackPt/2.));
322 <<
" " << cornerposxyz.X()
323 <<
" " << cornerposxyz.Y()
336 bool isinside = TMath::IsInside(track_X,
341 linkedbyrechit =
true;
348 if( linkedbyrechit ) {
351 std::cout <<
"Track and Cluster LINKED BY RECHIT" << std::endl;
387 static double resPSpitch = 0.19/
sqrt(12.);
388 static double resPSlength = 6.1/
sqrt(12.);
397 std::cout<<
"entering test link by rechit function for ECAL and PS"<<std::endl;
401 double zECAL = clusterECAL.
position().Z();
402 double xECAL = clusterECAL.
position().X();
403 double yECAL = clusterECAL.
position().Y();
406 double zPS = clusterPS.
position().Z();
407 double xPS = clusterPS.
position().X();
408 double yPS = clusterPS.
position().Y();
410 if (zECAL*zPS <0.)
return -1.;
414 switch (clusterPS.
layer()) {
417 deltaX = resPSpitch * sqr12;
418 deltaY = resPSlength * sqr12;
422 deltaY = resPSpitch * sqr12;
423 deltaX = resPSlength * sqr12;
430 const std::vector< reco::PFRecHitFraction >& fracs = clusterECAL.
recHitFractions();
431 bool linkedbyrechit =
false;
433 for(
unsigned int rhit = 0; rhit < fracs.size(); ++rhit){
436 double fraction = fracs[rhit].fraction();
437 if(fraction < 1E-4)
continue;
444 const std::vector< math::XYZPoint >& corners = rechit_cluster.
getCornersXYZ();
445 assert(corners.size() == 4);
450 std::cout <<
"Ecal rechit " << posxyz.X() <<
" " << posxyz.Y() << std::endl;
451 std::cout <<
"PS cluster " << xPS <<
" " << yPS << std::endl;
457 for (
unsigned jc=0; jc<4; ++jc ) {
461 x[jc] = cornerpos.X() + (cornerpos.X()-posxyz.X()) * (0.05 +1.0/fabs((cornerpos.X()-posxyz.X()))*deltaX/2.);
462 y[jc] = cornerpos.Y() + (cornerpos.Y()-posxyz.Y()) * (0.05 +1.0/fabs((cornerpos.Y()-posxyz.Y()))*deltaY/2.);
467 <<
" " << cornerpos.X() <<
" " << x[jc]
468 <<
" " << cornerpos.Y() <<
" " << y[jc]
481 bool isinside = TMath::IsInside(xPS,yPS,5,x,y);
484 linkedbyrechit =
true;
490 if( linkedbyrechit ) {
491 if( debug )
std::cout <<
"Cluster PS and Cluster ECAL LINKED BY RECHIT" << std::endl;
492 double dist =
computeDist( xECAL/1000.,yECAL/1000.,
512 double dX = posxyzEM.X()-posxyzHAD.X();
513 double dY = posxyzEM.Y()-posxyzHAD.Y();
514 double sameZ = posxyzEM.Z()*posxyzHAD.Z();
516 if(sameZ<0)
return -1.;
518 double dist2 = dX*dX + dY*dY;
522 double dist =
sqrt( dist2 );
532 double eta2,
double phi2,
535 double phicor = etaPhi ?
normalizedPhi(phi1 - phi2) : phi1 - phi2;
541 double dist =
std::sqrt( (eta1 - eta2)*(eta1 - eta2)
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
bool isNull() const
Checks for null.
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 reco::PFTrajectoryPoint & extrapolatedPoint(unsigned layerid) const
const math::XYZPoint & position() const
is seed ?
const REPPointVector & getCornersREP() const
rechit corners
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...
static double testTrackAndClusterByRecHit(const reco::PFRecTrack &track, const reco::PFCluster &cluster, bool isBrem=false, bool debug=false)
const REPPoint & positionREP() const
rechit cell centre rho, eta, phi. call calculatePositionREP before !