15 ESRecHits_(ESRecHits),
29 std::vector<PreshowerCluster>PFPreShowerClust;
34 cout << endl <<
"Attention! More than 100 ES clusters!" << endl;
36 energies[
jj] = (*ps)->energy();
39 if(fabs(energies[
kk]-(*ps)->energy())<0.0000001){
49 std::vector< std::pair<DetId, float> > psCells=(*ps)->hitsAndFractions();
53 for(
unsigned int s=0;
s<psCells.size(); ++
s){
55 if(es->id().rawId()==psCells[
s].first.rawId()){
58 if(
id.plane()==1)PS1E=PS1E + es->energy() * psCells[
s].second;
59 if(
id.plane()==2)PS2E=PS2E + es->energy() * psCells[
s].second;
67 PFPreShowerClust.push_back(PS1);
71 PFPreShowerClust.push_back(PS2);
74 return PFPreShowerClust;
80 std::map<unsigned int,unsigned int> linkedIndices;
81 std::map<double, unsigned int> links;
83 for(
unsigned int j=0;
j<PFPS.size(); ++
j){
84 for(
unsigned int i=0;
i<PF.size(); ++
i){
87 links.insert(std::make_pair(link_,i));
89 std::map<double,unsigned int>::iterator itlinks = links.begin();
90 if((*itlinks).first>=0.)
91 linkedIndices.insert(std::make_pair(
j, (*itlinks).second));
102 static double resPSpitch = 0.19/
sqrt(12.);
103 static double resPSlength = 6.1/
sqrt(12.);
106 double zECAL = clusterECAL.
position().Z();
107 double xECAL = clusterECAL.
position().X();
108 double yECAL = clusterECAL.
position().Y();
111 double zPS = clusterPS.
position().Z();
112 double xPS = clusterPS.
position().X();
113 double yPS = clusterPS.
position().Y();
116 if (zECAL*zPS < 0.)
return -1.;
120 switch (clusterPS.
plane()) {
123 deltaX = resPSpitch * sqr12;
124 deltaY = resPSlength * sqr12;
128 deltaY = resPSpitch * sqr12;
129 deltaX = resPSlength * sqr12;
136 const std::vector< std::pair<DetId, float> > fracs = clusterECAL.
hitsAndFractions();
137 bool linkedbyrechit =
false;
139 for(
unsigned int rhit = 0; rhit < fracs.size(); rhit++){
140 double fraction = fracs[rhit].second;
141 if(fraction < 1E-4)
continue;
142 if(fracs[rhit].
first.null())
continue;
153 corners[0] =
math::XYZPoint(corners_vec[3].
x(), corners_vec[3].
y(), corners_vec[3].
z() );
154 corners[1] =
math::XYZPoint(corners_vec[2].
x(), corners_vec[2].
y(), corners_vec[2].
z() );
155 corners[2] =
math::XYZPoint(corners_vec[1].
x(), corners_vec[1].
y(), corners_vec[1].
z() );
156 corners[3] =
math::XYZPoint(corners_vec[0].
x(), corners_vec[0].
y(), corners_vec[0].
z() );
164 for (
unsigned jc=0; jc<4; ++jc ) {
168 x[jc] = cornerpos.X() + (cornerpos.X()-posxyz.X()) * (0.05 +1.0/fabs((cornerpos.X()-posxyz.X()))*deltaX/2.);
169 y[jc] = cornerpos.Y() + (cornerpos.Y()-posxyz.Y()) * (0.05 +1.0/fabs((cornerpos.Y()-posxyz.Y()))*deltaY/2.);
177 bool isinside = TMath::IsInside(xPS,yPS,5,x,y);
180 linkedbyrechit =
true;
186 if( linkedbyrechit ) {
187 double dist =
std::sqrt( (xECAL/1000. - xPS/1000.)*(xECAL/1000. - xPS/1000.)
188 + (yECAL/1000. - yPS/1000.)*(yECAL/1000. - yPS/1000.) );
const math::XYZPoint & position() const
cluster centroid position
CaloCluster_iterator preshowerClustersBegin() const
fist iterator over PreshowerCluster constituents
const CaloSubdetectorGeometry * geomEnd_
std::map< unsigned int, unsigned int > getClosestEECls(vector< reco::PreshowerCluster > PFPS, vector< reco::CaloCluster > PF)
ggPFESClusters(edm::Handle< EcalRecHitCollection > &ESRecHits, const CaloSubdetectorGeometry *geomEnd)
std::vector< EcalRecHit >::const_iterator const_iterator
int plane() const
Preshower plane.
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
virtual ~ggPFESClusters()
XYZPointD XYZPoint
point in space with cartesian internal representation
virtual vector< reco::PreshowerCluster > getPFESClusters(reco::SuperCluster sc)
Handle< EcalRecHitCollection > ESRecHits_
double getLinkDist(reco::PreshowerCluster clusterPS, reco::CaloCluster clusterECAL)
CaloCluster_iterator preshowerClustersEnd() const
last iterator over PreshowerCluster constituents