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);
197 for (
const auto& blockref : otherBlockRefs) {
199 const auto&
elements = blockref->elements();
203 auto output = pfEGammaAlgo(blockref);
205 if (!
output.candidates.empty()) {
206 LOGDRESSED(
"PFEGammaProducer") <<
"Block with " <<
elements.size() <<
" elements produced " 207 <<
output.candidates.size() <<
" e-g candidates!" << std::endl;
210 const size_t egsize = egCandidates.size();
211 egCandidates.resize(egsize +
output.candidates.size());
214 const size_t egxsize = egExtra.size();
215 egExtra.resize(egxsize +
output.candidateExtras.size());
218 const size_t rscsize = sClusters.size();
219 sClusters.resize(rscsize +
output.refinedSuperClusters.size());
220 std::move(
output.refinedSuperClusters.begin(),
output.refinedSuperClusters.end(), sClusters.begin() + rscsize);
223 LOGDRESSED(
"PFEGammaProducer") <<
"Running PFEGammaAlgo on all blocks produced = " << egCandidates.size()
224 <<
" e-g candidates!" << std::endl;
230 for (
unsigned int i = 0;
i < egCandidates.size(); ++
i) {
238 cand.setSuperClusterRef(refinedSCRef);
239 cand.setPFEGammaExtraRef(extraref);
246 std::map<edm::Ptr<reco::CaloCluster>,
unsigned int> pfClusterMapEBEE;
247 std::map<edm::Ptr<reco::CaloCluster>,
unsigned int> pfClusterMapES;
249 for (
const auto& sc : sClusters) {
251 if (!pfClusterMapEBEE.count(*pfclus)) {
253 caloClustersEBEE.push_back(caloclus);
254 pfClusterMapEBEE[*pfclus] = caloClustersEBEE.size() - 1;
257 <<
"Found an EB/EE pfcluster matched to more than one supercluster!" <<
std::dec << std::endl;
262 if (!pfClusterMapES.count(*pfclus)) {
264 caloClustersES.push_back(caloclus);
265 pfClusterMapES[*pfclus] = caloClustersES.size() - 1;
268 <<
"Found an ES pfcluster matched to more than one supercluster!" <<
std::dec << std::endl;
278 for (
auto& sc : sClusters) {
295 sc.setPreshowerClusters(psclusters);
312 for (
auto& extra : extras) {
313 for (
const auto& tkrefmva : extra.singleLegConvTrackRefMva()) {
317 std::vector<reco::TrackRef> OneLegConvVector;
318 OneLegConvVector.push_back(tkrefmva.first);
319 std::vector<float> OneLegMvaVector;
320 OneLegMvaVector.push_back(tkrefmva.second);
321 std::vector<reco::CaloClusterPtr> dummymatchingBC;
325 std::vector<math::XYZPointF> trackPositionAtEcalVec;
326 std::vector<math::XYZPointF> innPointVec;
327 std::vector<math::XYZVectorF> trackPinVec;
328 std::vector<math::XYZVectorF> trackPoutVec;
330 trackPositionAtEcalVec.push_back(trackPositionAtEcal);
333 innPointVec.push_back(innPoint);
336 trackPinVec.push_back(trackPin);
339 trackPoutVec.push_back(trackPout);
341 float DCA =
trk.d0();
342 float mvaval = tkrefmva.second;
345 trackPositionAtEcalVec,
355 oneLegConversions.push_back(singleLegConvCandidate);
358 extra.addSingleLegConversionRef(convref);
361 return oneLegConversions;
366 desc.add<
bool>(
"produceEGCandsWithNoSuperCluster",
false)
367 ->setComment(
"Allow building of candidates with no input or output supercluster?");
368 desc.add<
double>(
"pf_electron_mvaCut", -0.1);
369 desc.add<
bool>(
"pf_electronID_crackCorrection",
false);
370 desc.add<
double>(
"pf_conv_mvaCut", 0.0);
373 ->setComment(
"EE to PS association");
376 edm::FileInPath(
"RecoParticleFlow/PFProducer/data/PfElectrons23Jan_BDT.weights.xml.gz"));
378 edm::FileInPath(
"RecoParticleFlow/PFProducer/data/pfConversionAug0411_BDT.weights.xml.gz"));
379 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_
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
#define DEFINE_FWK_MODULE(type)
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
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)
primaryVertex
hltOfflineBeamSpot for HLTMON