24 dr2_{
cfg.getParameter<
double>(
"MaxDeltaR2")}
26 produces<reco::CaloClusterCollection>();
27 produces<reco::SuperClusterCollection>();
28 produces< edm::ValueMap<reco::SuperClusterRef> >();
53 std::vector<reco::SuperClusterRef> superClustersValueMap;
57 caloClusters->reserve(ecalClusters.size());
60 std::vector< std::vector<int> > cluster_idx;
64 std::vector< std::vector<int> > pfcluster_idx;
68 std::vector< std::vector<float> > cluster_dr2min;
72 std::vector< std::vector<const reco::PFTrajectoryPoint*> >
points;
76 std::vector<const reco::PFTrajectoryPoint*> traj;
77 traj.reserve(trk.PFRecBrem().size()+1);
78 traj.push_back( &trk.extrapolatedPoint(reco::PFTrajectoryPoint::LayerType::ECALShowerMax) );
80 for (
auto const& brem : trk.PFRecBrem() ) {
81 traj.push_back( &brem.extrapolatedPoint(reco::PFTrajectoryPoint::LayerType::ECALShowerMax) );
83 auto size = traj.size();
86 cluster_idx.emplace_back(
size,-1);
87 pfcluster_idx.emplace_back(
size,-1);
88 cluster_dr2min.emplace_back(
size,1.e6);
92 for (
size_t iclu = 0; iclu < ecalClusters.size(); ++iclu ) {
93 std::pair<int,int>
point = std::make_pair(-1,-1);
96 for (
size_t jpoint = 0; jpoint < points[
ipoint].size(); ++jpoint ) {
97 if ( points[
ipoint][jpoint]->isValid() ) {
102 point = std::make_pair(
ipoint,jpoint);
107 if ( point.first >= 0 && point.second >= 0 &&
108 dr2min < cluster_dr2min[point.first][point.second] ) {
110 caloClusters->push_back(ecalClusters[iclu]);
112 cluster_idx[point.first][point.second] = caloClusters->size()-1;
113 pfcluster_idx[point.first][point.second] = iclu;
114 cluster_dr2min[point.first][point.second] = dr2min;
122 for (
size_t itrk = 0; itrk < gsfPfRecTracks->size(); ++itrk ) {
126 float X = 0.,
Y = 0.,
Z = 0.;
129 std::vector<const reco::PFCluster*> barePtrs;
135 if ( cluster_idx[itrk][
ipoint] < 0 ) {
continue; }
136 if ( cluster_dr2min[itrk][
ipoint] < dr2 ) {
137 dr2 = cluster_dr2min[itrk][
ipoint];
138 index = cluster_idx[itrk][
ipoint];
144 if ( cluster_idx[itrk][
ipoint] < 0 ) {
continue; }
146 if ( clu.
isNull() ) {
continue; }
147 if ( !( cluster_dr2min[itrk][ipoint] <
dr2_ ||
148 index == cluster_idx[itrk][ipoint] ) ) {
continue; }
149 if ( seed.
isNull() ) { seed = clu; }
151 energy += clu->correctedEnergy();
152 X += clu->position().X() * clu->correctedEnergy();
153 Y += clu->position().Y() * clu->correctedEnergy();
154 Z += clu->position().Z() * clu->correctedEnergy();
155 auto index = pfcluster_idx[itrk][
ipoint];
156 if(index <
static_cast<decltype(index)
>(ecalClusters.size())) {
157 barePtrs.push_back(&(ecalClusters[index]));
174 superClusters->push_back(sc);
177 superClustersValueMap.push_back(
reco::SuperClusterRef( superClustersRefProd, superClusters->size()-1 ) );
189 filler.
insert(gsfPfRecTracks, superClustersValueMap.begin(), superClustersValueMap.end());
203 for (
size_t ii = 0;
ii < clusters->size(); ++
ii ) {
204 if (
std::find( matched.begin(), matched.end(),
ii ) == matched.end() ) {
206 if ( dr2 < dr2min ) {
212 if ( dr2min < (
dr2_ - 1.
e-6) ) { matched.push_back( closest.
index() ); }
225 desc.
add<
double>(
"MaxDeltaR2",0.5);
226 descriptions.
add(
"defaultLowPtGsfElectronSuperClusters",desc);
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
T getParameter(std::string const &) const
const edm::EDGetTokenT< reco::PFClusterCollection > ecalClusters_
void push_back(Ptr< T > const &iPtr)
double pflowPhiWidth() const
void insert(const H &h, I begin, I end)
const edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracks_
def setup(process, global_tag, zero_tesla=False)
~LowPtGsfElectronSCProducer() override
void setSeed(const CaloClusterPtr &r)
list of used xtals by DetId // now inherited by CaloCluster
static void fillDescriptions(edm::ConfigurationDescriptions &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void setPhiWidth(double pw)
double pflowEtaWidth() const
void setClusters(const CaloClusterPtrVector &clusters)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
void setEtaWidth(double ew)
#define DEFINE_FWK_MODULE(type)
void produce(edm::Event &, const edm::EventSetup &) override
LowPtGsfElectronSCProducer(const edm::ParameterSet &)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
void setCorrectedEnergy(double cenergy)
edm::Ref< PFClusterCollection > PFClusterRef
persistent reference to PFCluster objects
bool isNull() const
Checks for null.
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
reco::PFClusterRef closestCluster(const reco::PFTrajectoryPoint &point, const edm::Handle< reco::PFClusterCollection > &clusters, std::vector< int > &matched)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isNonnull() const
Checks for non-null.
ProductID id() const
Accessor for product ID.
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
bool isValid() const
is this point valid ?
XYZPointD XYZPoint
point in space with cartesian internal representation
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
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