CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PhotonProducer Class Reference

#include <PhotonProducer.h>

Inheritance diagram for PhotonProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (edm::Run &r, edm::EventSetup const &es)
 
virtual void endRun (edm::Run &, edm::EventSetup const &)
 
 PhotonProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 
 ~PhotonProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

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, math::XYZPoint &vtx, reco::PhotonCollection &outputCollection, int &iSC)
 

Private Attributes

edm::InputTag barrelEcalHits_
 
edm::ParameterSet conf_
 
std::string conversionCollection_
 
std::string conversionProducer_
 
edm::InputTag endcapEcalHits_
 
EcalClusterFunctionBaseClassenergyCorrectionF
 
edm::InputTag hcalTowers_
 
double highEt_
 
double hOverEConeSize_
 
double maxHOverE_
 
double minR9Barrel_
 
double minR9Endcap_
 
double minSCEt_
 
std::string PhotonCollection_
 
edm::InputTag photonCoreProducer_
 
std::string pixelSeedProducer_
 
PositionCalc posCalculator_
 
std::vector< double > preselCutValuesBarrel_
 
std::vector< double > preselCutValuesEndcap_
 
edm::ESHandle< CaloGeometrytheCaloGeom_
 
edm::ESHandle< CaloTopologytheCaloTopo_
 
PhotonIsolationCalculatorthePhotonIsolationCalculator_
 
bool usePrimaryVertex_
 
bool validConversions_
 
bool validPixelSeeds_
 
std::string vertexProducer_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Id:
PhotonProducer.h,v 1.36 2009/05/29 18:11:15 nancy Exp
Date:
2009/05/29 18:11:15
Revision:
1.36
Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 38 of file PhotonProducer.h.

Constructor & Destructor Documentation

PhotonProducer::PhotonProducer ( const edm::ParameterSet ps)

Definition at line 29 of file PhotonProducer.cc.

References barrelEcalHits_, conf_, endcapEcalHits_, energyCorrectionF, reco::get(), edm::ParameterSet::getParameter(), hcalTowers_, highEt_, hOverEConeSize_, minR9Barrel_, minR9Endcap_, PhotonCollection_, photonCoreProducer_, posCalculator_, preselCutValuesBarrel_, preselCutValuesEndcap_, usePrimaryVertex_, and vertexProducer_.

29  :
30  conf_(config)
31 {
32 
33  // use onfiguration file to setup input/output collection names
34 
35  photonCoreProducer_ = conf_.getParameter<edm::InputTag>("photonCoreProducer");
36  barrelEcalHits_ = conf_.getParameter<edm::InputTag>("barrelEcalHits");
37  endcapEcalHits_ = conf_.getParameter<edm::InputTag>("endcapEcalHits");
38  vertexProducer_ = conf_.getParameter<std::string>("primaryVertexProducer");
40  hOverEConeSize_ = conf_.getParameter<double>("hOverEConeSize");
41  highEt_ = conf_.getParameter<double>("highEt");
42  // R9 value to decide converted/unconverted
43  minR9Barrel_ = conf_.getParameter<double>("minR9Barrel");
44  minR9Endcap_ = conf_.getParameter<double>("minR9Endcap");
45  usePrimaryVertex_ = conf_.getParameter<bool>("usePrimaryVertex");
46 
47  edm::ParameterSet posCalcParameters =
48  config.getParameter<edm::ParameterSet>("posCalcParameters");
49  posCalculator_ = PositionCalc(posCalcParameters);
50 
51  // Parameters for the position calculation:
52  // std::map<std::string,double> providedParameters;
53  // providedParameters.insert(std::make_pair("LogWeighted",conf_.getParameter<bool>("posCalc_logweight")));
54  //providedParameters.insert(std::make_pair("T0_barl",conf_.getParameter<double>("posCalc_t0_barl")));
55  //providedParameters.insert(std::make_pair("T0_endc",conf_.getParameter<double>("posCalc_t0_endc")));
56  //providedParameters.insert(std::make_pair("T0_endcPresh",conf_.getParameter<double>("posCalc_t0_endcPresh")));
57  //providedParameters.insert(std::make_pair("W0",conf_.getParameter<double>("posCalc_w0")));
58  //providedParameters.insert(std::make_pair("X0",conf_.getParameter<double>("posCalc_x0")));
59  //posCalculator_ = PositionCalc(providedParameters);
60  // cut values for pre-selection
61  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("minSCEtBarrel"));
62  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("maxHoverEBarrel"));
63  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("ecalRecHitSumEtOffsetBarrel"));
64  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("ecalRecHitSumEtSlopeBarrel"));
65  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("hcalTowerSumEtOffsetBarrel"));
66  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("hcalTowerSumEtSlopeBarrel"));
67  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("nTrackSolidConeBarrel"));
68  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("nTrackHollowConeBarrel"));
69  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("trackPtSumSolidConeBarrel"));
70  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("trackPtSumHollowConeBarrel"));
71  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("sigmaIetaIetaCutBarrel"));
72  //
73  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("minSCEtEndcap"));
74  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("maxHoverEEndcap"));
75  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("ecalRecHitSumEtOffsetEndcap"));
76  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("ecalRecHitSumEtSlopeEndcap"));
77  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("hcalTowerSumEtOffsetEndcap"));
78  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("hcalTowerSumEtSlopeEndcap"));
79  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("nTrackSolidConeEndcap"));
80  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("nTrackHollowConeEndcap"));
81  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("trackPtSumSolidConeEndcap"));
82  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("trackPtSumHollowConeEndcap"));
83  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("sigmaIetaIetaCutEndcap"));
84  //
85  energyCorrectionF = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyCorrection", conf_);
86 
87  // Register the product
88  produces< reco::PhotonCollection >(PhotonCollection_);
89 
90 }
T getParameter(std::string const &) const
std::vector< double > preselCutValuesEndcap_
edm::ParameterSet conf_
edm::InputTag hcalTowers_
PositionCalc posCalculator_
edm::InputTag photonCoreProducer_
EcalClusterFunctionBaseClass * energyCorrectionF
double hOverEConeSize_
std::string PhotonCollection_
std::vector< double > preselCutValuesBarrel_
edm::InputTag barrelEcalHits_
edm::InputTag endcapEcalHits_
T get(const Candidate &c)
Definition: component.h:56
std::string vertexProducer_
PhotonProducer::~PhotonProducer ( )

Definition at line 92 of file PhotonProducer.cc.

References energyCorrectionF.

92  {
93 
94  delete energyCorrectionF;
95 
96 }
EcalClusterFunctionBaseClass * energyCorrectionF

Member Function Documentation

void PhotonProducer::beginRun ( edm::Run r,
edm::EventSetup const &  es 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 100 of file PhotonProducer.cc.

References conf_, edm::ParameterSet::getParameter(), PhotonIsolationCalculator::setup(), and thePhotonIsolationCalculator_.

100  {
101 
103  edm::ParameterSet isolationSumsCalculatorSet = conf_.getParameter<edm::ParameterSet>("isolationSumsCalculatorSet");
104  thePhotonIsolationCalculator_->setup(isolationSumsCalculatorSet);
105 
106 }
T getParameter(std::string const &) const
edm::ParameterSet conf_
void setup(const edm::ParameterSet &conf)
PhotonIsolationCalculator * thePhotonIsolationCalculator_
void PhotonProducer::endRun ( edm::Run r,
edm::EventSetup const &  theEventSetup 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 108 of file PhotonProducer.cc.

References thePhotonIsolationCalculator_.

108  {
109 
111 
112 }
PhotonIsolationCalculator * thePhotonIsolationCalculator_
void PhotonProducer::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,
math::XYZPoint vtx,
reco::PhotonCollection outputCollection,
int &  iSC 
)
private

fill shower shape block

Pre-selection loose isolation cuts

Definition at line 211 of file PhotonProducer.cc.

References PositionCalc::Calculate_Location(), EcalClusterTools::covariances(), EcalClusterTools::e1x5(), reco::Photon::ShowerShape::e1x5, reco::Photon::ShowerShape::e2x5, EcalClusterTools::e2x5Max(), EcalClusterTools::e3x3(), reco::Photon::ShowerShape::e3x3, EcalClusterTools::e5x5(), reco::Photon::ShowerShape::e5x5, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, EcalClusterTools::eMax(), energyCorrectionF, geometry, EgammaTowerIsolation::getTowerESum(), EcalClusterFunctionBaseClass::getValue(), reco::Photon::ShowerShape::hcalDepth1OverEcal, reco::Photon::ShowerShape::hcalDepth2OverEcal, highEt_, hOverEConeSize_, EcalClusterTools::localCovariances(), reco::Photon::ShowerShape::maxEnergyXtal, minR9Barrel_, minR9Endcap_, p4, posCalculator_, preselCutValuesBarrel_, preselCutValuesEndcap_, edm::Handle< T >::product(), edm::ESHandle< class >::product(), reco::Photon::ShowerShape::sigmaEtaEta, reco::Photon::ShowerShape::sigmaIetaIeta, mathSSE::sqrt(), theCaloGeom_, and thePhotonIsolationCalculator_.

Referenced by produce().

219  {
220 
222  const CaloSubdetectorGeometry* subDetGeometry =0 ;
223  const CaloSubdetectorGeometry* geometryES = theCaloGeom_->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
224  const EcalRecHitCollection* hits = 0 ;
225  std::vector<double> preselCutValues;
226  float minR9=0;
227 
228 
229 
230  for(unsigned int lSC=0; lSC < photonCoreHandle->size(); lSC++) {
231 
232  reco::PhotonCoreRef coreRef(reco::PhotonCoreRef(photonCoreHandle, lSC));
233  reco::SuperClusterRef scRef=coreRef->superCluster();
234  const reco::SuperCluster* pClus=&(*scRef);
235  iSC++;
236 
237  int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
238  subDetGeometry = theCaloGeom_->getSubdetectorGeometry(DetId::Ecal, subdet);
239 
240  if (subdet==EcalBarrel)
241  {
242  preselCutValues = preselCutValuesBarrel_;
243  minR9=minR9Barrel_;
244  hits= ecalBarrelHits;
245  }
246  else if (subdet==EcalEndcap)
247  {
248  preselCutValues = preselCutValuesEndcap_;
249  minR9=minR9Endcap_;
250  hits= ecalEndcapHits;
251  }
252  else
253  { edm::LogWarning("")<<"PhotonProducer: do not know if it is a barrel or endcap SuperCluster" ; }
254 
255 
256  // SC energy preselection
257  if (scRef->energy()/cosh(scRef->eta()) <= preselCutValues[0] ) continue;
258  // calculate HoE
259  const CaloTowerCollection* hcalTowersColl = hcalTowersHandle.product();
260  EgammaTowerIsolation towerIso1(hOverEConeSize_,0.,0.,1,hcalTowersColl) ;
261  EgammaTowerIsolation towerIso2(hOverEConeSize_,0.,0.,2,hcalTowersColl) ;
262  double HoE1=towerIso1.getTowerESum(&(*scRef))/scRef->energy();
263  double HoE2=towerIso2.getTowerESum(&(*scRef))/scRef->energy();
264  // std::cout << " PhotonProducer " << HoE1 << " HoE2 " << HoE2 << std::endl;
265  // std::cout << " PhotonProducer calcualtion of HoE1 " << HoE1 << " HoE2 " << HoE2 << std::endl;
266 
267 
268  // recalculate position of seed BasicCluster taking shower depth for unconverted photon
269  math::XYZPoint unconvPos = posCalculator_.Calculate_Location(scRef->seed()->hitsAndFractions(),hits,subDetGeometry,geometryES);
270 
271 
272  float maxXtal = EcalClusterTools::eMax( *(scRef->seed()), &(*hits) );
273  float e1x5 = EcalClusterTools::e1x5( *(scRef->seed()), &(*hits), &(*topology));
274  float e2x5 = EcalClusterTools::e2x5Max( *(scRef->seed()), &(*hits), &(*topology));
275  float e3x3 = EcalClusterTools::e3x3( *(scRef->seed()), &(*hits), &(*topology));
276  float e5x5 = EcalClusterTools::e5x5( *(scRef->seed()), &(*hits), &(*topology));
277  std::vector<float> cov = EcalClusterTools::covariances( *(scRef->seed()), &(*hits), &(*topology), geometry);
278  float sigmaEtaEta = sqrt(cov[0]);
279  std::vector<float> locCov = EcalClusterTools::localCovariances( *(scRef->seed()), &(*hits), &(*topology));
280  float sigmaIetaIeta = sqrt(locCov[0]);
281 
282  float r9 =e3x3/(scRef->rawEnergy());
283  // compute position of ECAL shower
284  math::XYZPoint caloPosition;
285  double photonEnergy=0;
286  if (r9>minR9) {
287  caloPosition = unconvPos;
288  // f(eta) correction to e5x5
289  double deltaE = energyCorrectionF->getValue(*pClus, 1);
290  if (subdet==EcalBarrel) e5x5 = e5x5 * (1.0 + deltaE/scRef->rawEnergy() );
291  photonEnergy= e5x5 + scRef->preshowerEnergy() ;
292  } else {
293  caloPosition = scRef->position();
294  photonEnergy=scRef->energy();
295  }
296 
297 
298  //std::cout << " dete " << subdet << " r9 " << r9 << " uncorrected e5x5 " << e5x5uncor << " corrected e5x5 " << e5x5 << " photon energy " << photonEnergy << std::endl;
299 
300  // compute momentum vector of photon from primary vertex and cluster position
301  math::XYZVector direction = caloPosition - vtx;
302  math::XYZVector momentum = direction.unit() * photonEnergy ;
303 
304  // Create candidate
305  const reco::Particle::LorentzVector p4(momentum.x(), momentum.y(), momentum.z(), photonEnergy );
306  reco::Photon newCandidate(p4, caloPosition, coreRef, vtx);
307 
308  // Calculate fiducial flags and isolation variable. Blocked are filled from the isolationCalculator
309  reco::Photon::FiducialFlags fiducialFlags;
310  reco::Photon::IsolationVariables isolVarR03, isolVarR04;
311  thePhotonIsolationCalculator_-> calculate ( &newCandidate,evt,es,fiducialFlags,isolVarR04, isolVarR03);
312  newCandidate.setFiducialVolumeFlags( fiducialFlags );
313  newCandidate.setIsolationVariables(isolVarR04, isolVarR03 );
314 
316  reco::Photon::ShowerShape showerShape;
317  showerShape.e1x5= e1x5;
318  showerShape.e2x5= e2x5;
319  showerShape.e3x3= e3x3;
320  showerShape.e5x5= e5x5;
321  showerShape.maxEnergyXtal = maxXtal;
322  showerShape.sigmaEtaEta = sigmaEtaEta;
323  showerShape.sigmaIetaIeta = sigmaIetaIeta;
324  showerShape.hcalDepth1OverEcal = HoE1;
325  showerShape.hcalDepth2OverEcal = HoE2;
326  newCandidate.setShowerShapeVariables ( showerShape );
327 
329  bool isLooseEM=true;
330  if ( newCandidate.pt() < highEt_) {
331  if ( newCandidate.hadronicOverEm() >= preselCutValues[1] ) isLooseEM=false;
332  if ( newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2]+ preselCutValues[3]*newCandidate.pt() ) isLooseEM=false;
333  if ( newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4]+ preselCutValues[5]*newCandidate.pt() ) isLooseEM=false;
334  if ( newCandidate.nTrkSolidConeDR04() > int(preselCutValues[6]) ) isLooseEM=false;
335  if ( newCandidate.nTrkHollowConeDR04() > int(preselCutValues[7]) ) isLooseEM=false;
336  if ( newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8] ) isLooseEM=false;
337  if ( newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9] ) isLooseEM=false;
338  if ( newCandidate.sigmaIetaIeta() > preselCutValues[10] ) isLooseEM=false;
339  }
340 
341 
342  if ( isLooseEM)
343  outputPhotonCollection.push_back(newCandidate);
344 
345 
346  }
347 }
std::vector< double > preselCutValuesEndcap_
PositionCalc posCalculator_
EcalClusterFunctionBaseClass * energyCorrectionF
static std::vector< float > covariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, float w0=4.7)
virtual float getValue(const reco::BasicCluster &, const EcalRecHitCollection &) const =0
double hOverEConeSize_
static std::vector< float > localCovariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=4.7)
T sqrt(T t)
Definition: SSEVec.h:28
double p4[4]
Definition: TauolaWrapper.h:92
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
PhotonIsolationCalculator * thePhotonIsolationCalculator_
edm::ESHandle< CaloGeometry > theCaloGeom_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
static float eMax(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
std::vector< double > preselCutValuesBarrel_
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
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)
Definition: PositionCalc.cc:40
static float e2x5Max(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float e1x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:26
void PhotonProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 117 of file PhotonProducer.cc.

References barrelEcalHits_, endcapEcalHits_, energyCorrectionF, fillPhotonCollection(), edm::EventSetup::get(), edm::Event::getByLabel(), hcalTowers_, EcalClusterFunctionBaseClass::init(), edm::InputTag::label(), PhotonCollection_, photonCoreProducer_, edm::ESHandle< class >::product(), edm::Event::put(), theCaloGeom_, theCaloTopo_, usePrimaryVertex_, GoodVertex_cfg::vertexCollection, and vertexProducer_.

117  {
118 
119  using namespace edm;
120  // nEvt_++;
121 
122  reco::PhotonCollection outputPhotonCollection;
123  std::auto_ptr< reco::PhotonCollection > outputPhotonCollection_p(new reco::PhotonCollection);
124 
125 
126  // Get the PhotonCore collection
127  bool validPhotonCoreHandle=true;
128  Handle<reco::PhotonCoreCollection> photonCoreHandle;
129  theEvent.getByLabel(photonCoreProducer_,photonCoreHandle);
130  if (!photonCoreHandle.isValid()) {
131  edm::LogError("PhotonProducer") << "Error! Can't get the product "<<photonCoreProducer_.label();
132  validPhotonCoreHandle=false;
133  }
134 
135  // Get EcalRecHits
136  bool validEcalRecHits=true;
137  Handle<EcalRecHitCollection> barrelHitHandle;
138  EcalRecHitCollection barrelRecHits;
139  theEvent.getByLabel(barrelEcalHits_, barrelHitHandle);
140  if (!barrelHitHandle.isValid()) {
141  edm::LogError("PhotonProducer") << "Error! Can't get the product "<<barrelEcalHits_.label();
142  validEcalRecHits=false;
143  }
144  if ( validEcalRecHits) barrelRecHits = *(barrelHitHandle.product());
145 
146 
147  Handle<EcalRecHitCollection> endcapHitHandle;
148  theEvent.getByLabel(endcapEcalHits_, endcapHitHandle);
149  EcalRecHitCollection endcapRecHits;
150  if (!endcapHitHandle.isValid()) {
151  edm::LogError("PhotonProducer") << "Error! Can't get the product "<<endcapEcalHits_.label();
152  validEcalRecHits=false;
153  }
154  if( validEcalRecHits) endcapRecHits = *(endcapHitHandle.product());
155 
156 
157 // get Hcal towers collection
158  Handle<CaloTowerCollection> hcalTowersHandle;
159  theEvent.getByLabel(hcalTowers_, hcalTowersHandle);
160 
161 
162  // get the geometry from the event setup:
163  theEventSetup.get<CaloGeometryRecord>().get(theCaloGeom_);
164 
165  //
166  // update energy correction function
167  energyCorrectionF->init(theEventSetup);
168 
169  edm::ESHandle<CaloTopology> pTopology;
170  theEventSetup.get<CaloTopologyRecord>().get(theCaloTopo_);
171  const CaloTopology *topology = theCaloTopo_.product();
172 
173  // Get the primary event vertex
174  Handle<reco::VertexCollection> vertexHandle;
176  bool validVertex=true;
177  if ( usePrimaryVertex_ ) {
178  theEvent.getByLabel(vertexProducer_, vertexHandle);
179  if (!vertexHandle.isValid()) {
180  edm::LogWarning("PhotonProducer") << "Error! Can't get the product primary Vertex Collection "<< "\n";
181  validVertex=false;
182  }
183  if (validVertex) vertexCollection = *(vertexHandle.product());
184  }
185  math::XYZPoint vtx(0.,0.,0.);
186  if (vertexCollection.size()>0) vtx = vertexCollection.begin()->position();
187 
188 
189  int iSC=0; // index in photon collection
190  // Loop over barrel and endcap SC collections and fill the photon collection
191  if ( validPhotonCoreHandle)
192  fillPhotonCollection(theEvent,
193  theEventSetup,
194  photonCoreHandle,
195  topology,
196  &barrelRecHits,
197  &endcapRecHits,
198  hcalTowersHandle,
199  vtx,
200  outputPhotonCollection,
201  iSC);
202 
203 
204  // put the product in the event
205  edm::LogInfo("PhotonProducer") << " Put in the event " << iSC << " Photon Candidates \n";
206  outputPhotonCollection_p->assign(outputPhotonCollection.begin(),outputPhotonCollection.end());
207  theEvent.put( outputPhotonCollection_p, PhotonCollection_);
208 
209 }
edm::InputTag hcalTowers_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::InputTag photonCoreProducer_
EcalClusterFunctionBaseClass * energyCorrectionF
tuple vertexCollection
edm::ESHandle< CaloTopology > theCaloTopo_
std::string PhotonCollection_
edm::ESHandle< CaloGeometry > theCaloGeom_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
T const * product() const
Definition: ESHandle.h:62
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, math::XYZPoint &vtx, reco::PhotonCollection &outputCollection, int &iSC)
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
edm::InputTag barrelEcalHits_
std::string const & label() const
Definition: InputTag.h:25
edm::InputTag endcapEcalHits_
virtual void init(const edm::EventSetup &es)=0
std::string vertexProducer_

Member Data Documentation

edm::InputTag PhotonProducer::barrelEcalHits_
private

Definition at line 69 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

edm::ParameterSet PhotonProducer::conf_
private

Definition at line 88 of file PhotonProducer.h.

Referenced by beginRun(), and PhotonProducer().

std::string PhotonProducer::conversionCollection_
private

Definition at line 75 of file PhotonProducer.h.

std::string PhotonProducer::conversionProducer_
private

Definition at line 74 of file PhotonProducer.h.

edm::InputTag PhotonProducer::endcapEcalHits_
private

Definition at line 70 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

EcalClusterFunctionBaseClass* PhotonProducer::energyCorrectionF
private

Definition at line 105 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), PhotonProducer(), produce(), and ~PhotonProducer().

edm::InputTag PhotonProducer::hcalTowers_
private

Definition at line 72 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

double PhotonProducer::highEt_
private

Definition at line 80 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

double PhotonProducer::hOverEConeSize_
private

Definition at line 77 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

double PhotonProducer::maxHOverE_
private

Definition at line 78 of file PhotonProducer.h.

double PhotonProducer::minR9Barrel_
private

Definition at line 81 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

double PhotonProducer::minR9Endcap_
private

Definition at line 82 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

double PhotonProducer::minSCEt_
private

Definition at line 79 of file PhotonProducer.h.

std::string PhotonProducer::PhotonCollection_
private

Definition at line 67 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

edm::InputTag PhotonProducer::photonCoreProducer_
private

Definition at line 68 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

std::string PhotonProducer::pixelSeedProducer_
private

Definition at line 85 of file PhotonProducer.h.

PositionCalc PhotonProducer::posCalculator_
private

Definition at line 90 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

std::vector<double> PhotonProducer::preselCutValuesBarrel_
private

Definition at line 102 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

std::vector<double> PhotonProducer::preselCutValuesEndcap_
private

Definition at line 103 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

edm::ESHandle<CaloGeometry> PhotonProducer::theCaloGeom_
private

Definition at line 93 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and produce().

edm::ESHandle<CaloTopology> PhotonProducer::theCaloTopo_
private

Definition at line 94 of file PhotonProducer.h.

Referenced by produce().

PhotonIsolationCalculator* PhotonProducer::thePhotonIsolationCalculator_
private

Definition at line 99 of file PhotonProducer.h.

Referenced by beginRun(), endRun(), and fillPhotonCollection().

bool PhotonProducer::usePrimaryVertex_
private

Definition at line 87 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

bool PhotonProducer::validConversions_
private

Definition at line 84 of file PhotonProducer.h.

bool PhotonProducer::validPixelSeeds_
private

Definition at line 98 of file PhotonProducer.h.

std::string PhotonProducer::vertexProducer_
private

Definition at line 86 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().