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";
323 if(hits == 0)
continue;
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());
372 float full5x5_sigmaEtaEta =
sqrt(full5x5_cov[0]);
373 float full5x5_sigmaIetaIeta =
sqrt(full5x5_locCov[0]);
378 caloPosition = unconvPos;
380 caloPosition = scRef->position();
384 double photonEnergy=1.;
386 if (vertexCollection.size()>0) vtx = vertexCollection.begin()->position();
402 newCandidate.setFiducialVolumeFlags( fiducialFlags );
403 newCandidate.setIsolationVariables(isolVarR04, isolVarR03 );
408 showerShape.
e1x5= e1x5;
409 showerShape.
e2x5= e2x5;
410 showerShape.
e3x3= e3x3;
411 showerShape.
e5x5= e5x5;
420 newCandidate.setShowerShapeVariables ( showerShape );
424 full5x5_showerShape.
e1x5= full5x5_e1x5;
425 full5x5_showerShape.
e2x5= full5x5_e2x5;
426 full5x5_showerShape.
e3x3= full5x5_e3x3;
427 full5x5_showerShape.
e5x5= full5x5_e5x5;
429 full5x5_showerShape.
sigmaEtaEta = full5x5_sigmaEtaEta;
431 newCandidate.full5x5_setShowerShapeVariables ( full5x5_showerShape );
458 newCandidate.setMIPVariables(mipVar);
465 if ( newCandidate.pt() <
highEt_) {
466 if ( newCandidate.hadronicOverEm() >= preselCutValues[1] ) isLooseEM=
false;
467 if ( newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2]+ preselCutValues[3]*newCandidate.pt() ) isLooseEM=
false;
468 if ( newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4]+ preselCutValues[5]*newCandidate.pt() ) isLooseEM=
false;
469 if ( newCandidate.nTrkSolidConeDR04() > int(preselCutValues[6]) ) isLooseEM=
false;
470 if ( newCandidate.nTrkHollowConeDR04() > int(preselCutValues[7]) ) isLooseEM=
false;
471 if ( newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8] ) isLooseEM=
false;
472 if ( newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9] ) isLooseEM=
false;
473 if ( newCandidate.sigmaIetaIeta() > preselCutValues[10] ) isLooseEM=
false;
479 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
T const * product() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< Photon > PhotonCollection
collectin of Photon objects
std::vector< double > preselCutValuesBarrel_
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