247 <<
" in run "<<iEvent.
id().
run()<<std::endl;
251 egCandidates_ = std::make_unique<reco::PFCandidateCollection>();
252 egExtra_ = std::make_unique<reco::PFCandidateEGammaExtraCollection>();
253 sClusters_ = std::make_unique<reco::SuperClusterCollection>();
258 pfeg_->setEEtoPSAssociation(eetops);
263 pfeg_->setAlphaGamma_ESplanes_fromDB(esEEInterCalibHandle_.
product());
267 pfeg_->setESChannelStatus(esChannelStatusHandle_.
product());
274 std::ostringstream err;
275 err<<
"Cannot find vertices for this event.Continuing Without them ";
286 LOGDRESSED(
"PFEGammaProducer")<<
"getting blocks"<<std::endl;
291 std::ostringstream err;
292 err<<
"cannot find blocks: (tag index)" 300 <<
"EGPFlow is starting..."<<std::endl;
303 assert( blocks.isValid() &&
"edm::Handle to blocks was null!");
304 std::ostringstream
str;
307 LOGDRESSED(
"PFEGammaProducer") <<str.str()<<std::endl;
311 std::list< reco::PFBlockRef > hcalBlockRefs;
312 std::list< reco::PFBlockRef > ecalBlockRefs;
313 std::list< reco::PFBlockRef > hoBlockRefs;
314 std::list< reco::PFBlockRef > otherBlockRefs;
316 for(
unsigned i=0;
i<blocks->size(); ++
i ) {
325 <<
"Found " << elements.
size()
326 <<
" PFBlockElements in block: " <<
i << std::endl;
328 bool singleEcalOrHcal =
false;
329 if( elements.
size() == 1 ){
330 switch( elements[0].
type() ) {
333 <<
"PFBLOCKALGO BUG!!!! Found a SuperCluster in a block by itself!";
337 ecalBlockRefs.push_back( blockref );
338 singleEcalOrHcal =
true;
344 hcalBlockRefs.push_back( blockref );
345 singleEcalOrHcal =
true;
349 hoBlockRefs.push_back( blockref );
350 singleEcalOrHcal =
true;
357 if(!singleEcalOrHcal) {
358 otherBlockRefs.push_back( blockref );
369 for(
const auto& blockref : otherBlockRefs ) {
372 const auto& elements = blockref->elements();
377 std::vector<bool> active( elements.
size(),
true );
379 pfeg_->RunPFEG(globalCache(),blockref,active);
381 if( !
pfeg_->getCandidates().empty() ) {
383 <<
"Block with " << elements.
size()
384 <<
" elements produced " 385 <<
pfeg_->getCandidates().size()
386 <<
" e-g candidates!" << std::endl;
391 reco::PFCandidateCollection::iterator eginsertfrom =
394 pfeg_->getCandidates().end(),
397 const size_t egxsize = egExtra_->size();
398 egExtra_->resize(egxsize +
pfeg_->getEGExtra().size());
399 reco::PFCandidateEGammaExtraCollection::iterator egxinsertfrom =
400 egExtra_->begin() + egxsize;
402 pfeg_->getEGExtra().end(),
405 const size_t rscsize = sClusters_->size();
406 sClusters_->resize(rscsize +
pfeg_->getRefinedSCs().size());
407 reco::SuperClusterCollection::iterator rscinsertfrom =
408 sClusters_->begin() + rscsize;
410 pfeg_->getRefinedSCs().end(),
415 <<
"Running PFEGammaAlgo on all blocks produced = " 439 auto caloClustersEBEE = std::make_unique<reco::CaloClusterCollection>();
440 auto caloClustersES = std::make_unique<reco::CaloClusterCollection>();
442 std::map<edm::Ptr<reco::CaloCluster>,
unsigned int> pfClusterMapEBEE;
443 std::map<edm::Ptr<reco::CaloCluster>,
unsigned int> pfClusterMapES;
445 for(
const auto&
sc : *sClusters_ ) {
447 if (!pfClusterMapEBEE.count(*pfclus)) {
449 caloClustersEBEE->push_back(caloclus);
450 pfClusterMapEBEE[*pfclus] = caloClustersEBEE->size() - 1;
454 <<
"Found an EB/EE pfcluster matched to more than one supercluster!" 459 if (!pfClusterMapES.count(*pfclus)) {
461 caloClustersES->push_back(caloclus);
462 pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
466 <<
"Found an ES pfcluster matched to more than one supercluster!" 477 for(
auto&
sc : *sClusters_ ) {
486 sc.setClusters(clusters);
493 sc.setPreshowerClusters(psclusters);
EventNumber_t event() const
void createSingleLegConversions(reco::PFCandidateEGammaExtraCollection &extras, reco::ConversionCollection &oneLegConversions, const edm::RefProd< reco::ConversionCollection > &convProd)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void setSuperClusterRef(reco::SuperClusterRef sc)
set reference to the corresponding supercluster
std::unique_ptr< reco::PFCandidateEGammaExtraCollection > egExtra_
edm::EDGetTokenT< reco::VertexCollection > vertices_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void push_back(Ptr< T > const &iPtr)
bool useVerticesForNeutral_
unsigned int index() const
std::vector< Variable::Flags > flags
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
void setPFVertexParameters(bool useVertex, const reco::VertexCollection *primaryVertices)
std::vector< reco::PFCandidateEGammaExtra > PFCandidateEGammaExtraCollection
collection of PFCandidateEGammaExtras
std::string ebeeClustersCollection_
std::unique_ptr< reco::PFCandidateCollection > egCandidates_
std::unique_ptr< reco::ConversionCollection > singleLegConv_
std::string esClustersCollection_
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > eetopsSrc_
RefProd< PROD > getRefBeforePut()
T const * product() const
std::unique_ptr< PFEGammaAlgo > pfeg_
the unfiltered electron collection
edm::EDGetTokenT< reco::PFBlockCollection > inputTagBlocks_
Particle reconstructed by the particle flow algorithm.
void setPFEGammaExtraRef(const reco::PFCandidateEGammaExtraRef &ref)
set the PF EGamma Extra Ref
void setSuperClusterRef(const reco::SuperClusterRef &scRef)
std::unique_ptr< reco::SuperClusterCollection > sClusters_
T const * product() const