71 #define LOGDRESSED(x) edm::LogInfo(x) 73 #define LOGDRESSED(x) LogDebug(x) 78 eetopsSrc_(consumes<
reco::PFCluster::EEtoPSAssociation>(iConfig.getParameter<
edm::
InputTag>(
"EEtoPS_source"))),
80 pfCandidateCollectionPutToken_{produces<reco::PFCandidateCollection>()},
81 pfCandidateEGammaExtraCollectionPutToken_{produces<reco::PFCandidateEGammaExtraCollection>()},
82 superClusterCollectionPutToken_{produces<reco::SuperClusterCollection>()},
83 caloClusterCollectionEBEEPutToken_{produces<reco::CaloClusterCollection>(
"EBEEClusters")},
84 caloClusterCollectionESPutToken_{produces<reco::CaloClusterCollection>(
"ESClusters")},
85 conversionCollectionPutToken_{produces<reco::ConversionCollection>()},
87 .mvaEleCut = iConfig.getParameter<
double>(
"pf_electron_mvaCut"),
89 .produceEGCandsWithNoSuperCluster = iConfig.getParameter<
bool>(
"produceEGCandsWithNoSuperCluster"),
90 .mvaConvCut = iConfig.getParameter<
double>(
"pf_conv_mvaCut"),
99 LOGDRESSED(
"PFEGammaProducer") <<
"START event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run()
115 if (
pv.isValid() && !
pv.isFake()) {
124 *esEEInterCalibHandle_,
125 *esChannelStatusHandle_,
130 LOGDRESSED(
"PFEGammaProducer") <<
"getting blocks" << std::endl;
133 LOGDRESSED(
"PFEGammaProducer") <<
"EGPFlow is starting..." << std::endl;
136 assert(
blocks.isValid() &&
"edm::Handle to blocks was null!");
137 std::ostringstream
str;
144 std::list<reco::PFBlockRef> hcalBlockRefs;
145 std::list<reco::PFBlockRef> ecalBlockRefs;
146 std::list<reco::PFBlockRef> hoBlockRefs;
147 std::list<reco::PFBlockRef> otherBlockRefs;
149 for (
unsigned i = 0;
i <
blocks->size(); ++
i) {
154 LOGDRESSED(
"PFEGammaProducer") <<
"Found " <<
elements.size() <<
" PFBlockElements in block: " <<
i << std::endl;
156 bool singleEcalOrHcal =
false;
160 edm::LogError(
"PFEGammaProducer") <<
"PFBLOCKALGO BUG!!!! Found a SuperCluster in a block by itself!";
165 ecalBlockRefs.push_back(blockref);
166 singleEcalOrHcal =
true;
173 hcalBlockRefs.push_back(blockref);
174 singleEcalOrHcal =
true;
178 hoBlockRefs.push_back(blockref);
179 singleEcalOrHcal =
true;
186 if (!singleEcalOrHcal) {
187 otherBlockRefs.push_back(blockref);
198 for (
const auto& blockref : otherBlockRefs) {
201 const auto&
elements = blockref->elements();
205 auto output = pfEGammaAlgo(blockref);
207 if (!
output.candidates.empty()) {
208 LOGDRESSED(
"PFEGammaProducer") <<
"Block with " <<
elements.size() <<
" elements produced " 209 <<
output.candidates.size() <<
" e-g candidates!" << std::endl;
212 const size_t egsize = egCandidates.size();
213 egCandidates.resize(egsize +
output.candidates.size());
216 const size_t egxsize = egExtra.size();
217 egExtra.resize(egxsize +
output.candidateExtras.size());
220 const size_t rscsize = sClusters.size();
221 sClusters.resize(rscsize +
output.refinedSuperClusters.size());
222 std::move(
output.refinedSuperClusters.begin(),
output.refinedSuperClusters.end(), sClusters.begin() + rscsize);
225 LOGDRESSED(
"PFEGammaProducer") <<
"Running PFEGammaAlgo on all blocks produced = " << egCandidates.size()
226 <<
" e-g candidates!" << std::endl;
232 for (
unsigned int i = 0;
i < egCandidates.size(); ++
i) {
240 cand.setSuperClusterRef(refinedSCRef);
241 cand.setPFEGammaExtraRef(extraref);
248 std::map<edm::Ptr<reco::CaloCluster>,
unsigned int> pfClusterMapEBEE;
249 std::map<edm::Ptr<reco::CaloCluster>,
unsigned int> pfClusterMapES;
251 for (
const auto& sc : sClusters) {
253 if (!pfClusterMapEBEE.count(*pfclus)) {
255 caloClustersEBEE.push_back(caloclus);
256 pfClusterMapEBEE[*pfclus] = caloClustersEBEE.size() - 1;
259 <<
"Found an EB/EE pfcluster matched to more than one supercluster!" <<
std::dec << std::endl;
264 if (!pfClusterMapES.count(*pfclus)) {
266 caloClustersES.push_back(caloclus);
267 pfClusterMapES[*pfclus] = caloClustersES.size() - 1;
270 <<
"Found an ES pfcluster matched to more than one supercluster!" <<
std::dec << std::endl;
280 for (
auto& sc : sClusters) {
297 sc.setPreshowerClusters(psclusters);
314 for (
auto& extra : extras) {
315 for (
const auto& tkrefmva : extra.singleLegConvTrackRefMva()) {
319 std::vector<reco::TrackRef> OneLegConvVector;
320 OneLegConvVector.push_back(tkrefmva.first);
321 std::vector<float> OneLegMvaVector;
322 OneLegMvaVector.push_back(tkrefmva.second);
323 std::vector<reco::CaloClusterPtr> dummymatchingBC;
327 std::vector<math::XYZPointF> trackPositionAtEcalVec;
328 std::vector<math::XYZPointF> innPointVec;
329 std::vector<math::XYZVectorF> trackPinVec;
330 std::vector<math::XYZVectorF> trackPoutVec;
332 trackPositionAtEcalVec.push_back(trackPositionAtEcal);
335 innPointVec.push_back(innPoint);
338 trackPinVec.push_back(trackPin);
341 trackPoutVec.push_back(trackPout);
343 float DCA = trk.
d0();
344 float mvaval = tkrefmva.second;
347 trackPositionAtEcalVec,
357 oneLegConversions.push_back(singleLegConvCandidate);
360 extra.addSingleLegConversionRef(convref);
363 return oneLegConversions;
368 desc.add<
bool>(
"produceEGCandsWithNoSuperCluster",
false)
369 ->setComment(
"Allow building of candidates with no input or output supercluster?");
370 desc.add<
double>(
"pf_electron_mvaCut", -0.1);
371 desc.add<
bool>(
"pf_electronID_crackCorrection",
false);
372 desc.add<
double>(
"pf_conv_mvaCut", 0.0);
375 ->setComment(
"EE to PS association");
378 edm::FileInPath(
"RecoParticleFlow/PFProducer/data/PfElectrons23Jan_BDT.weights.xml.gz"));
380 edm::FileInPath(
"RecoParticleFlow/PFProducer/data/pfConversionAug0411_BDT.weights.xml.gz"));
381 descriptions.
add(
"particleFlowEGamma",
desc);
const edm::EDPutTokenT< reco::CaloClusterCollection > caloClusterCollectionESPutToken_
void setSuperClusterRef(reco::SuperClusterRef sc)
set reference to the corresponding supercluster
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
const edm::EDPutTokenT< reco::ConversionCollection > conversionCollectionPutToken_
const math::XYZPoint & outerPosition() const
position of the outermost hit
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
#define DEFINE_FWK_MODULE(type)
void push_back(Ptr< T > const &iPtr)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Log< level::Error, false > LogError
const edm::EDPutTokenT< reco::PFCandidateEGammaExtraCollection > pfCandidateEGammaExtraCollectionPutToken_
std::vector< Vertex > VertexCollection
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::ESGetToken< ESChannelStatus, ESChannelStatusRcd > esChannelStatusToken_
const edm::EDPutTokenT< reco::PFCandidateCollection > pfCandidateCollectionPutToken_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
std::vector< reco::PFCandidateEGammaExtra > PFCandidateEGammaExtraCollection
collection of PFCandidateEGammaExtras
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
const edm::EDPutTokenT< reco::SuperClusterCollection > superClusterCollectionPutToken_
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
reco::ConversionCollection createSingleLegConversions(reco::PFCandidateEGammaExtraCollection &extras, const edm::RefProd< reco::ConversionCollection > &convProd) const
const edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > eetopsSrc_
const edm::ESGetToken< ESEEIntercalibConstants, ESEEIntercalibConstantsRcd > esEEInterCalibToken_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
const PFEGammaAlgo::GBRForests gbrForests_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const PFEGammaAlgo::PFEGConfigInfo pfEGConfigInfo_
particle flow algorithm configuration
const edm::EDGetTokenT< reco::VertexCollection > vertices_
const edm::EDGetTokenT< reco::PFBlockCollection > inputTagBlocks_
const edm::EDPutTokenT< reco::CaloClusterCollection > caloClusterCollectionEBEEPutToken_
Particle reconstructed by the particle flow algorithm.
void setOneLegMVA(const std::vector< float > &mva)
set the MVS output from PF for one leg conversions
PFEGammaProducer(const edm::ParameterSet &)
Producer for particle flow reconstructed particles (PFCandidates)
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
primaryVertex
hltOfflineBeamSpot for HLTMON
const math::XYZPoint & innerPosition() const
position of the innermost hit