55 auto outputPhotonCoreCollection_p = std::make_unique<reco::PhotonCoreCollection>();
58 bool validBarrelSCHandle=
true;
61 if (!scBarrelHandle.
isValid()) {
63 <<
"Error! Can't get the scHybridBarrelProducer";
64 validBarrelSCHandle=
false;
69 bool validEndcapSCHandle=
true;
72 if (!scEndcapHandle.
isValid()) {
74 <<
"Error! Can't get the scIslandEndcapProducer";
75 validEndcapSCHandle=
false;
83 if (!conversionHandle.
isValid()) {
96 if (!pixelSeedHandle.
isValid()) {
110 outputPhotonCoreCollection,
117 outputPhotonCoreCollection,
121 edm::LogInfo(
"PhotonCoreProducer") <<
" Put in the event " << iSC <<
" Photon Candidates \n";
122 outputPhotonCoreCollection_p->assign(outputPhotonCoreCollection.begin(),outputPhotonCoreCollection.end());
134 for(
unsigned int lSC=0; lSC < scHandle->size(); lSC++) {
142 if (scRef->energy()/cosh(scRef->eta()) <=
minSCEt_)
continue;
155 for(
unsigned int icp = 0; icp < conversionHandle->size(); icp++) {
157 if ( cpRef->caloCluster().empty())
continue;
158 if (!( scRef.
id() == cpRef->caloCluster()[0].
id() && scRef.
key() == cpRef->caloCluster()[0].
key() ))
continue;
159 if ( !cpRef->isConverted() )
continue;
169 for(
unsigned int icp = 0; icp < pixelSeedHandle->size(); icp++) {
171 if ( ! cpRef->isEcalDriven() )
continue;
172 if (!( scRef.
id() == cpRef->caloCluster().
id() && scRef.
key() == cpRef->caloCluster().
key() ))
continue;
177 outputPhotonCoreCollection.push_back(newCandidate);
190 std::multimap<reco::ConversionRef, double > convMap;
191 for (
unsigned int icp=0; icp< conversionHandle->size(); icp++) {
195 if (!( scRef.
id() == cpRef->caloCluster()[0].
id() && scRef.
key() == cpRef->caloCluster()[0].
key() ))
continue;
196 if ( !cpRef->isConverted() )
continue;
197 double like = cpRef->MVAout();
198 convMap.insert ( std::make_pair(cpRef,like) );
204 std::multimap<reco::ConversionRef, double >::iterator iMap;
208 for (iMap=convMap.begin(); iMap!=convMap.end(); iMap++) {
209 double like = iMap->second;
224 for (iMap=convMap.begin(); iMap!=convMap.end(); iMap++) {
227 const std::vector<edm::RefToBase<reco::Track> >
tracks = convRef->tracks();
228 float px=tracks[0]->innerMomentum().x();
229 float py=tracks[0]->innerMomentum().y();
230 float pz=tracks[0]->innerMomentum().z();
231 float p=
sqrt(px*px+py*py+pz*pz);
232 ep=fabs(1.-convRef->caloCluster()[0]->energy()/
p);
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void addConversion(const reco::ConversionRef &r)
add single ConversionRef to the vector of Refs
bool isNonnull() const
Checks for non-null.
edm::EDGetTokenT< reco::ConversionCollection > conversionProducer_
edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedProducer_
void fillPhotonCollection(edm::Event &evt, edm::EventSetup const &es, const edm::Handle< reco::SuperClusterCollection > &scHandle, const edm::Handle< reco::ConversionCollection > &conversionHandle, const edm::Handle< reco::ElectronSeedCollection > &pixelSeeds, reco::PhotonCoreCollection &outputCollection, int &iSC)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
key_type key() const
Accessor for product key.
ProductID id() const
Accessor for product ID.
reco::ConversionRef solveAmbiguity(const edm::Handle< reco::ConversionCollection > &conversionHandle, reco::SuperClusterRef &sc)
void setParentSuperCluster(const reco::SuperClusterRef &r)
set reference to PFlow SuperCluster
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
PhotonCoreProducer(const edm::ParameterSet &ps)
edm::EDGetTokenT< reco::SuperClusterCollection > scHybridBarrelProducer_
~PhotonCoreProducer() override
void produce(edm::Event &evt, const edm::EventSetup &es) override
std::vector< PhotonCore > PhotonCoreCollection
collectin of PhotonCore objects
edm::EDGetTokenT< reco::SuperClusterCollection > scIslandEndcapProducer_
std::string PhotonCoreCollection_
void addElectronPixelSeed(const reco::ElectronSeedRef &r)
set electron pixel seed ref