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;
343 hcalBlockRefs.push_back( blockref );
344 singleEcalOrHcal =
true;
348 hoBlockRefs.push_back( blockref );
349 singleEcalOrHcal =
true;
356 if(!singleEcalOrHcal) {
357 otherBlockRefs.push_back( blockref );
368 for(
const auto& blockref : otherBlockRefs ) {
371 const auto& elements = blockref->elements();
376 std::vector<bool> active( elements.
size(),
true );
378 pfeg_->RunPFEG(globalCache(),blockref,active);
380 if( !
pfeg_->getCandidates().empty() ) {
382 <<
"Block with " << elements.
size()
383 <<
" elements produced " 384 <<
pfeg_->getCandidates().size()
385 <<
" e-g candidates!" << std::endl;
390 reco::PFCandidateCollection::iterator eginsertfrom =
393 pfeg_->getCandidates().end(),
396 const size_t egxsize = egExtra_->size();
397 egExtra_->resize(egxsize +
pfeg_->getEGExtra().size());
398 reco::PFCandidateEGammaExtraCollection::iterator egxinsertfrom =
399 egExtra_->begin() + egxsize;
401 pfeg_->getEGExtra().end(),
404 const size_t rscsize = sClusters_->size();
405 sClusters_->resize(rscsize +
pfeg_->getRefinedSCs().size());
406 reco::SuperClusterCollection::iterator rscinsertfrom =
407 sClusters_->begin() + rscsize;
409 pfeg_->getRefinedSCs().end(),
414 <<
"Running PFEGammaAlgo on all blocks produced = " 438 auto caloClustersEBEE = std::make_unique<reco::CaloClusterCollection>();
439 auto caloClustersES = std::make_unique<reco::CaloClusterCollection>();
441 std::map<edm::Ptr<reco::CaloCluster>,
unsigned int> pfClusterMapEBEE;
442 std::map<edm::Ptr<reco::CaloCluster>,
unsigned int> pfClusterMapES;
444 for(
const auto&
sc : *sClusters_ ) {
446 if (!pfClusterMapEBEE.count(*pfclus)) {
448 caloClustersEBEE->push_back(caloclus);
449 pfClusterMapEBEE[*pfclus] = caloClustersEBEE->size() - 1;
453 <<
"Found an EB/EE pfcluster matched to more than one supercluster!" 458 if (!pfClusterMapES.count(*pfclus)) {
460 caloClustersES->push_back(caloclus);
461 pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
465 <<
"Found an ES pfcluster matched to more than one supercluster!" 476 for(
auto&
sc : *sClusters_ ) {
485 sc.setClusters(clusters);
492 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< 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