72 const std::vector<std::string> flagnamesEB =
73 config.
getParameter<std::vector<std::string> >(
"RecHitFlagToBeExcludedEB");
75 const std::vector<std::string> flagnamesEE =
76 config.
getParameter<std::vector<std::string> >(
"RecHitFlagToBeExcludedEE");
79 StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
82 StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
84 const std::vector<std::string> severitynamesEB =
85 config.
getParameter<std::vector<std::string> >(
"RecHitSeverityToBeExcludedEB");
88 StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
90 const std::vector<std::string> severitynamesEE =
91 config.
getParameter<std::vector<std::string> >(
"RecHitSeverityToBeExcludedEE");
94 StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
179 bool validPhotonCoreHandle=
true;
182 if (!photonCoreHandle.isValid()) {
184 <<
"Error! Can't get the photonCoreProducer";
185 validPhotonCoreHandle=
false;
189 bool validEcalRecHits=
true;
193 if (!barrelHitHandle.isValid()) {
195 <<
"Error! Can't get the barrelEcalHits";
196 validEcalRecHits=
false;
198 if ( validEcalRecHits) barrelRecHits = *(barrelHitHandle.product());
204 if (!endcapHitHandle.isValid()) {
206 <<
"Error! Can't get the endcapEcalHits";
207 validEcalRecHits=
false;
209 if( validEcalRecHits) endcapRecHits = *(endcapHitHandle.product());
237 bool validVertex=
true;
240 if (!vertexHandle.isValid()) {
241 edm::LogWarning(
"PhotonProducer") <<
"Error! Can't get the product primary Vertex Collection "<<
"\n";
252 if ( validPhotonCoreHandle)
262 outputPhotonCollection,
268 edm::LogInfo(
"PhotonProducer") <<
" Put in the event " << iSC <<
" Photon Candidates \n";
269 outputPhotonCollection_p->assign(outputPhotonCollection.begin(),outputPhotonCollection.end());
290 std::vector<double> preselCutValues;
294 std::vector<int> flags_, severitiesexcl_;
296 for(
unsigned int lSC=0; lSC < photonCoreHandle->size(); lSC++) {
303 int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
309 hits = ecalBarrelHits;
315 hits = ecalEndcapHits;
319 edm::LogWarning(
"")<<
"PhotonProducer: do not know if it is a barrel or endcap SuperCluster";
324 if (scRef->energy()/cosh(scRef->eta()) <= preselCutValues[0] )
continue;
330 double HoE1=towerIso1.
getTowerESum(&(*scRef))/scRef->energy();
331 double HoE2=towerIso2.
getTowerESum(&(*scRef))/scRef->energy();
335 std::vector<CaloTowerDetId> TowersBehindClus = towerIsoBehindClus.
towersOf(*scRef);
336 float hcalDepth1OverEcalBc = towerIsoBehindClus.
getDepth1HcalESum(TowersBehindClus)/scRef->energy();
337 float hcalDepth2OverEcalBc = towerIsoBehindClus.
getDepth2HcalESum(TowersBehindClus)/scRef->energy();
356 float sigmaEtaEta =
sqrt(cov[0]);
357 float sigmaIetaIeta =
sqrt(locCov[0]);
358 float r9 =e3x3/(scRef->rawEnergy());
363 caloPosition = unconvPos;
365 caloPosition = scRef->position();
369 double photonEnergy=1.;
371 if (vertexCollection.size()>0) vtx = vertexCollection.begin()->position();
387 newCandidate.setFiducialVolumeFlags( fiducialFlags );
388 newCandidate.setIsolationVariables(isolVarR04, isolVarR03 );
393 showerShape.
e1x5= e1x5;
394 showerShape.
e2x5= e2x5;
395 showerShape.
e3x3= e3x3;
396 showerShape.
e5x5= e5x5;
405 newCandidate.setShowerShapeVariables ( showerShape );
432 newCandidate.setMIPVariables(mipVar);
439 if ( newCandidate.pt() <
highEt_) {
440 if ( newCandidate.hadronicOverEm() >= preselCutValues[1] ) isLooseEM=
false;
441 if ( newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2]+ preselCutValues[3]*newCandidate.pt() ) isLooseEM=
false;
442 if ( newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4]+ preselCutValues[5]*newCandidate.pt() ) isLooseEM=
false;
443 if ( newCandidate.nTrkSolidConeDR04() > int(preselCutValues[6]) ) isLooseEM=
false;
444 if ( newCandidate.nTrkHollowConeDR04() > int(preselCutValues[7]) ) isLooseEM=
false;
445 if ( newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8] ) isLooseEM=
false;
446 if ( newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9] ) isLooseEM=
false;
447 if ( newCandidate.sigmaIetaIeta() > preselCutValues[10] ) isLooseEM=
false;
453 outputPhotonCollection.push_back(newCandidate);
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::VertexCollection > vertexProducer_
edm::EDGetTokenT< CaloTowerCollection > hcalTowers_
void fillPhotonCollection(edm::Event &evt, edm::EventSetup const &es, const edm::Handle< reco::PhotonCoreCollection > &photonCoreHandle, const CaloTopology *topology, const EcalRecHitCollection *ecalBarrelHits, const EcalRecHitCollection *ecalEndcapHits, const edm::Handle< CaloTowerCollection > &hcalTowersHandle, reco::VertexCollection &pvVertices, reco::PhotonCollection &outputCollection, int &iSC, const EcalSeverityLevelAlgo *sevLv)
std::vector< double > preselCutValuesEndcap_
std::vector< CaloTowerDetId > hcalTowersBehindClusters
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
float hcalDepth2OverEcalBc
std::vector< Vertex > VertexCollection
collection of Vertex objects
PositionCalc posCalculator_
edm::EDGetTokenT< reco::PhotonCoreCollection > photonCoreProducer_
void setTowerCollection(const CaloTowerCollection *towercollection)
edm::EDGetTokenT< EcalRecHitCollection > endcapEcalHits_
virtual void beginRun(edm::Run const &r, edm::EventSetup const &es) overridefinal
virtual void produce(edm::Event &evt, const edm::EventSetup &es)
std::vector< int > flagsexclEB_
double getDepth1HcalESum(const reco::SuperCluster &sc) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::ESHandle< CaloTopology > theCaloTopo_
std::vector< int > flagsexclEE_
std::string candidateP4type_
std::vector< int > severitiesexclEE_
double getTowerESum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
PhotonIsolationCalculator * thePhotonIsolationCalculator_
std::vector< int > severitiesexclEB_
std::string PhotonCollection_
edm::ESHandle< CaloGeometry > theCaloGeom_
PhotonEnergyCorrector * thePhotonEnergyCorrector_
void calculate(edm::Event &evt, reco::Photon &, int subdet, const reco::VertexCollection &vtxcol, const edm::EventSetup &iSetup)
float hcalDepth1OverEcalBc
void setup(const edm::ParameterSet &conf, std::vector< int > const &flagsEB_, std::vector< int > const &flagsEE_, std::vector< int > const &severitiesEB_, std::vector< int > const &severitiesEE_)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< double > preselCutValuesBarrel_
T const * product() const
std::vector< Photon > PhotonCollection
collectin of Photon objects
T const * product() const
std::vector< CaloTowerDetId > towersOf(const reco::SuperCluster &sc) const
double getDepth2HcalESum(const reco::SuperCluster &sc) const
ESHandle< TrackerGeometry > geometry
PhotonProducer(const edm::ParameterSet &ps)
edm::EDGetTokenT< EcalRecHitCollection > barrelEcalHits_
math::XYZPoint Calculate_Location(const HitsAndFractions &iDetIds, const edm::SortedCollection< HitType > *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=0)
PhotonMIPHaloTagger * thePhotonMIPHaloTagger_
void setup(const edm::ParameterSet &conf)
virtual void endRun(edm::Run const &, edm::EventSetup const &) overridefinal