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);
181 bool validPhotonCoreHandle=
true;
184 if (!photonCoreHandle.isValid()) {
186 <<
"Error! Can't get the photonCoreProducer";
187 validPhotonCoreHandle=
false;
191 bool validEcalRecHits=
true;
195 if (!barrelHitHandle.isValid()) {
197 <<
"Error! Can't get the barrelEcalHits";
198 validEcalRecHits=
false;
200 if ( validEcalRecHits) barrelRecHits = *(barrelHitHandle.product());
206 if (!endcapHitHandle.isValid()) {
208 <<
"Error! Can't get the endcapEcalHits";
209 validEcalRecHits=
false;
211 if( validEcalRecHits) endcapRecHits = *(endcapHitHandle.product());
239 bool validVertex=
true;
242 if (!vertexHandle.isValid()) {
243 edm::LogWarning(
"PhotonProducer") <<
"Error! Can't get the product primary Vertex Collection "<<
"\n";
254 if ( validPhotonCoreHandle)
264 outputPhotonCollection,
270 edm::LogInfo(
"PhotonProducer") <<
" Put in the event " << iSC <<
" Photon Candidates \n";
271 outputPhotonCollection_p->assign(outputPhotonCollection.begin(),outputPhotonCollection.end());
292 std::vector<double> preselCutValues;
296 std::vector<int> flags_, severitiesexcl_;
298 for(
unsigned int lSC=0; lSC < photonCoreHandle->size(); lSC++) {
305 int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
311 hits = ecalBarrelHits;
317 hits = ecalEndcapHits;
321 edm::LogWarning(
"")<<
"PhotonProducer: do not know if it is a barrel or endcap SuperCluster";
326 if (scRef->energy()/cosh(scRef->eta()) <= preselCutValues[0] )
continue;
332 double HoE1=towerIso1.
getTowerESum(&(*scRef))/scRef->energy();
333 double HoE2=towerIso2.
getTowerESum(&(*scRef))/scRef->energy();
337 std::vector<CaloTowerDetId> TowersBehindClus = towerIsoBehindClus.
towersOf(*scRef);
338 float hcalDepth1OverEcalBc = towerIsoBehindClus.
getDepth1HcalESum(TowersBehindClus)/scRef->energy();
339 float hcalDepth2OverEcalBc = towerIsoBehindClus.
getDepth2HcalESum(TowersBehindClus)/scRef->energy();
348 float maxXtal = EcalClusterTools::eMax( *(scRef->seed()), &(*hits) );
351 float e1x5 = EcalClusterTools::e1x5( *(scRef->seed()), &(*hits), &(*topology));
352 float e2x5 = EcalClusterTools::e2x5Max( *(scRef->seed()), &(*hits), &(*topology));
353 float e3x3 = EcalClusterTools::e3x3( *(scRef->seed()), &(*hits), &(*topology));
354 float e5x5 = EcalClusterTools::e5x5( *(scRef->seed()), &(*hits), &(*topology));
355 std::vector<float> cov = EcalClusterTools::covariances( *(scRef->seed()), &(*hits), &(*topology),
geometry);
356 std::vector<float> locCov = EcalClusterTools::localCovariances( *(scRef->seed()), &(*hits), &(*topology));
358 float sigmaEtaEta =
sqrt(cov[0]);
359 float sigmaIetaIeta =
sqrt(locCov[0]);
360 float r9 =e3x3/(scRef->rawEnergy());
365 caloPosition = unconvPos;
367 caloPosition = scRef->position();
371 double photonEnergy=1.;
373 if (vertexCollection.size()>0) vtx = vertexCollection.begin()->position();
389 newCandidate.setFiducialVolumeFlags( fiducialFlags );
390 newCandidate.setIsolationVariables(isolVarR04, isolVarR03 );
395 showerShape.
e1x5= e1x5;
396 showerShape.
e2x5= e2x5;
397 showerShape.
e3x3= e3x3;
398 showerShape.
e5x5= e5x5;
407 newCandidate.setShowerShapeVariables ( showerShape );
434 newCandidate.setMIPVariables(mipVar);
441 if ( newCandidate.pt() <
highEt_) {
442 if ( newCandidate.hadronicOverEm() >= preselCutValues[1] ) isLooseEM=
false;
443 if ( newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2]+ preselCutValues[3]*newCandidate.pt() ) isLooseEM=
false;
444 if ( newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4]+ preselCutValues[5]*newCandidate.pt() ) isLooseEM=
false;
445 if ( newCandidate.nTrkSolidConeDR04() > int(preselCutValues[6]) ) isLooseEM=
false;
446 if ( newCandidate.nTrkHollowConeDR04() > int(preselCutValues[7]) ) isLooseEM=
false;
447 if ( newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8] ) isLooseEM=
false;
448 if ( newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9] ) isLooseEM=
false;
449 if ( newCandidate.sigmaIetaIeta() > preselCutValues[10] ) isLooseEM=
false;
455 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.
CaloTopology const * topology(0)
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.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
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_, edm::ConsumesCollector &&iC)
edm::ESHandle< CaloTopology > theCaloTopo_
std::vector< int > flagsexclEE_
std::string candidateP4type_
std::vector< int > severitiesexclEE_
void setup(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
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
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_
virtual void endRun(edm::Run const &, edm::EventSetup const &) overridefinal