67 const std::vector<std::string> flagnamesEB =
68 config.
getParameter<std::vector<std::string> >(
"RecHitFlagToBeExcludedEB");
70 const std::vector<std::string> flagnamesEE =
71 config.
getParameter<std::vector<std::string> >(
"RecHitFlagToBeExcludedEE");
74 StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
77 StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
79 const std::vector<std::string> severitynamesEB =
80 config.
getParameter<std::vector<std::string> >(
"RecHitSeverityToBeExcludedEB");
83 StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
85 const std::vector<std::string> severitynamesEE =
86 config.
getParameter<std::vector<std::string> >(
"RecHitSeverityToBeExcludedEE");
89 StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
174 bool validPhotonCoreHandle=
true;
177 if (!photonCoreHandle.isValid()) {
179 validPhotonCoreHandle=
false;
183 bool validEcalRecHits=
true;
187 if (!barrelHitHandle.isValid()) {
189 validEcalRecHits=
false;
191 if ( validEcalRecHits) barrelRecHits = *(barrelHitHandle.product());
197 if (!endcapHitHandle.isValid()) {
199 validEcalRecHits=
false;
201 if( validEcalRecHits) endcapRecHits = *(endcapHitHandle.product());
229 bool validVertex=
true;
232 if (!vertexHandle.isValid()) {
233 edm::LogWarning(
"PhotonProducer") <<
"Error! Can't get the product primary Vertex Collection "<<
"\n";
244 if ( validPhotonCoreHandle)
254 outputPhotonCollection,
260 edm::LogInfo(
"PhotonProducer") <<
" Put in the event " << iSC <<
" Photon Candidates \n";
261 outputPhotonCollection_p->assign(outputPhotonCollection.begin(),outputPhotonCollection.end());
282 std::vector<double> preselCutValues;
286 std::vector<int> flags_, severitiesexcl_;
288 for(
unsigned int lSC=0; lSC < photonCoreHandle->size(); lSC++) {
295 int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
301 hits = ecalBarrelHits;
307 hits = ecalEndcapHits;
311 edm::LogWarning(
"")<<
"PhotonProducer: do not know if it is a barrel or endcap SuperCluster";
316 if (scRef->energy()/cosh(scRef->eta()) <= preselCutValues[0] )
continue;
322 double HoE1=towerIso1.
getTowerESum(&(*scRef))/scRef->energy();
323 double HoE2=towerIso2.
getTowerESum(&(*scRef))/scRef->energy();
327 std::vector<CaloTowerDetId> TowersBehindClus = towerIsoBehindClus.
towersOf(*scRef);
328 float hcalDepth1OverEcalBc = towerIsoBehindClus.
getDepth1HcalESum(TowersBehindClus)/scRef->energy();
329 float hcalDepth2OverEcalBc = towerIsoBehindClus.
getDepth2HcalESum(TowersBehindClus)/scRef->energy();
341 float e1x5 =
EcalClusterTools::e1x5( *(scRef->seed()), &(*hits), &(*topology), flags_, severitiesexcl_, sevLv);
343 float e3x3 =
EcalClusterTools::e3x3( *(scRef->seed()), &(*hits), &(*topology), flags_, severitiesexcl_, sevLv);
344 float e5x5 =
EcalClusterTools::e5x5( *(scRef->seed()), &(*hits), &(*topology),flags_, severitiesexcl_, sevLv);
348 float sigmaEtaEta =
sqrt(cov[0]);
349 float sigmaIetaIeta =
sqrt(locCov[0]);
350 float r9 =e3x3/(scRef->rawEnergy());
355 caloPosition = unconvPos;
357 caloPosition = scRef->position();
361 double photonEnergy=1.;
363 if (vertexCollection.size()>0) vtx = vertexCollection.begin()->position();
379 newCandidate.setFiducialVolumeFlags( fiducialFlags );
380 newCandidate.setIsolationVariables(isolVarR04, isolVarR03 );
385 showerShape.
e1x5= e1x5;
386 showerShape.
e2x5= e2x5;
387 showerShape.
e3x3= e3x3;
388 showerShape.
e5x5= e5x5;
397 newCandidate.setShowerShapeVariables ( showerShape );
424 newCandidate.setMIPVariables(mipVar);
431 if ( newCandidate.pt() <
highEt_) {
432 if ( newCandidate.hadronicOverEm() >= preselCutValues[1] ) isLooseEM=
false;
433 if ( newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2]+ preselCutValues[3]*newCandidate.pt() ) isLooseEM=
false;
434 if ( newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4]+ preselCutValues[5]*newCandidate.pt() ) isLooseEM=
false;
435 if ( newCandidate.nTrkSolidConeDR04() > int(preselCutValues[6]) ) isLooseEM=
false;
436 if ( newCandidate.nTrkHollowConeDR04() > int(preselCutValues[7]) ) isLooseEM=
false;
437 if ( newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8] ) isLooseEM=
false;
438 if ( newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9] ) isLooseEM=
false;
439 if ( newCandidate.sigmaIetaIeta() > preselCutValues[10] ) isLooseEM=
false;
445 outputPhotonCollection.push_back(newCandidate);
T getParameter(std::string const &) const
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.
float hcalDepth2OverEcalBc
edm::InputTag hcalTowers_
std::vector< Vertex > VertexCollection
collection of Vertex objects
PositionCalc posCalculator_
edm::InputTag photonCoreProducer_
void setTowerCollection(const CaloTowerCollection *towercollection)
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) 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
edm::InputTag barrelEcalHits_
std::vector< CaloTowerDetId > towersOf(const reco::SuperCluster &sc) const
double getDepth2HcalESum(const reco::SuperCluster &sc) const
ESHandle< TrackerGeometry > geometry
math::XYZPoint Calculate_Location(const std::vector< std::pair< DetId, float > > &iDetIds, const EcalRecHitCollection *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=0)
PhotonProducer(const edm::ParameterSet &ps)
edm::InputTag endcapEcalHits_
PhotonMIPHaloTagger * thePhotonMIPHaloTagger_
void setup(const edm::ParameterSet &conf)
virtual void endRun(edm::Run const &, edm::EventSetup const &) overridefinal
std::string vertexProducer_