49 std::vector<reco::SuperClusterRef> superClustersValueMap;
53 caloClusters->reserve(ecalClusters.size());
56 std::vector<std::vector<int> > cluster_idx;
60 std::vector<std::vector<int> > pfcluster_idx;
64 std::vector<std::vector<float> > cluster_dr2min;
68 std::vector<std::vector<const reco::PFTrajectoryPoint*> >
points;
72 std::vector<const reco::PFTrajectoryPoint*> traj;
73 traj.reserve(trk.PFRecBrem().size() + 1);
74 traj.push_back(&trk.extrapolatedPoint(reco::PFTrajectoryPoint::LayerType::ECALShowerMax));
76 for (
auto const& brem : trk.PFRecBrem()) {
77 traj.push_back(&brem.extrapolatedPoint(reco::PFTrajectoryPoint::LayerType::ECALShowerMax));
79 auto size = traj.size();
82 cluster_idx.emplace_back(
size, -1);
83 pfcluster_idx.emplace_back(
size, -1);
84 cluster_dr2min.emplace_back(
size, 1.e6);
88 for (
size_t iclu = 0; iclu < ecalClusters.size(); ++iclu) {
89 std::pair<int, int>
point = std::make_pair(-1, -1);
92 for (
size_t jpoint = 0; jpoint < points[
ipoint].size(); ++jpoint) {
93 if (points[
ipoint][jpoint]->isValid()) {
98 point = std::make_pair(
ipoint, jpoint);
103 if (point.first >= 0 && point.second >= 0 &&
104 dr2min < cluster_dr2min[point.first][point.second]) {
106 caloClusters->push_back(ecalClusters[iclu]);
108 cluster_idx[point.first][point.second] = caloClusters->size() - 1;
109 pfcluster_idx[point.first][point.second] = iclu;
110 cluster_dr2min[point.first][point.second] = dr2min;
118 for (
size_t itrk = 0; itrk < gsfPfRecTracks->size(); ++itrk) {
121 float X = 0.,
Y = 0.,
Z = 0.;
124 std::vector<const reco::PFCluster*> barePtrs;
130 if (cluster_idx[itrk][
ipoint] < 0) {
133 if (cluster_dr2min[itrk][
ipoint] < dr2) {
134 dr2 = cluster_dr2min[itrk][
ipoint];
135 index = cluster_idx[itrk][
ipoint];
141 if (cluster_idx[itrk][
ipoint] < 0) {
149 index == cluster_idx[itrk][
ipoint])) {
156 energy += clu->correctedEnergy();
157 X += clu->position().X() * clu->correctedEnergy();
158 Y += clu->position().Y() * clu->correctedEnergy();
159 Z += clu->position().Z() * clu->correctedEnergy();
160 auto index = pfcluster_idx[itrk][
ipoint];
161 if (index <
static_cast<decltype(index)
>(ecalClusters.size())) {
162 barePtrs.push_back(&(ecalClusters[index]));
172 sc.setCorrectedEnergy(energy);
174 sc.setClusters(clusters);
176 sc.setEtaWidth(pfwidth.pflowEtaWidth());
177 sc.setPhiWidth(pfwidth.pflowPhiWidth());
194 filler.insert(gsfPfRecTracks, superClustersValueMap.begin(), superClustersValueMap.end());
const edm::EDGetTokenT< reco::PFClusterCollection > ecalClusters_
void push_back(Ptr< T > const &iPtr)
const edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracks_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
bool isNull() const
Checks for null.
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
bool isNonnull() const
Checks for non-null.
ProductID id() const
Accessor for product ID.
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
auto makeValid(const U &iOtherHandleType) noexcept(false)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point