CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PhotonProducer Class Reference

#include <PhotonProducer.h>

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

List of all members.

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 ()

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, reco::VertexCollection &pvVertices, reco::PhotonCollection &outputCollection, int &iSC, const EcalSeverityLevelAlgo *sevLv)

Private Attributes

edm::InputTag barrelEcalHits_
std::string candidateP4type_
edm::ParameterSet conf_
std::string conversionCollection_
std::string conversionProducer_
edm::InputTag endcapEcalHits_
EcalClusterFunctionBaseClassenergyCorrectionF
std::vector< int > flagsexclEB_
std::vector< int > flagsexclEE_
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_
bool runMIPTagger_
std::vector< int > severitiesexclEB_
std::vector< int > severitiesexclEE_
edm::ESHandle< CaloGeometrytheCaloGeom_
edm::ESHandle< CaloTopologytheCaloTopo_
PhotonEnergyCorrectorthePhotonEnergyCorrector_
PhotonIsolationCalculatorthePhotonIsolationCalculator_
PhotonMIPHaloTaggerthePhotonMIPHaloTagger_
bool usePrimaryVertex_
bool validConversions_
bool validPixelSeeds_
std::string vertexProducer_

Detailed Description

Id:
PhotonProducer.h,v 1.45 2012/04/26 21:09:42 sani Exp
Date:
2012/04/26 21:09:42
Revision:
1.45
Author:
Nancy Marinelli, U. of Notre Dame, US

Definition at line 41 of file PhotonProducer.h.


Constructor & Destructor Documentation

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

Definition at line 38 of file PhotonProducer.cc.

References barrelEcalHits_, candidateP4type_, conf_, endcapEcalHits_, flagsexclEB_, flagsexclEE_, edm::ParameterSet::getParameter(), hcalTowers_, highEt_, hOverEConeSize_, minR9Barrel_, minR9Endcap_, PhotonCollection_, photonCoreProducer_, posCalculator_, preselCutValuesBarrel_, preselCutValuesEndcap_, runMIPTagger_, severitiesexclEB_, severitiesexclEE_, usePrimaryVertex_, and vertexProducer_.

                                                            : 

  conf_(config)
{

  // use onfiguration file to setup input/output collection names

  photonCoreProducer_   = conf_.getParameter<edm::InputTag>("photonCoreProducer");
  barrelEcalHits_   = conf_.getParameter<edm::InputTag>("barrelEcalHits");
  endcapEcalHits_   = conf_.getParameter<edm::InputTag>("endcapEcalHits");
  vertexProducer_   = conf_.getParameter<std::string>("primaryVertexProducer");
  hcalTowers_ = conf_.getParameter<edm::InputTag>("hcalTowers");
  hOverEConeSize_   = conf_.getParameter<double>("hOverEConeSize");
  highEt_        = conf_.getParameter<double>("highEt");
  // R9 value to decide converted/unconverted
  minR9Barrel_        = conf_.getParameter<double>("minR9Barrel");
  minR9Endcap_        = conf_.getParameter<double>("minR9Endcap");
  usePrimaryVertex_   = conf_.getParameter<bool>("usePrimaryVertex");
  runMIPTagger_       = conf_.getParameter<bool>("runMIPTagger");

  candidateP4type_ = config.getParameter<std::string>("candidateP4type") ;
 
  edm::ParameterSet posCalcParameters = 
    config.getParameter<edm::ParameterSet>("posCalcParameters");
  posCalculator_ = PositionCalc(posCalcParameters);


  //AA
  //Flags and Severities to be excluded from photon calculations
  const std::vector<std::string> flagnamesEB = 
    config.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEB");

  const std::vector<std::string> flagnamesEE =
    config.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEE");

  flagsexclEB_= 
    StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);

  flagsexclEE_=
    StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);

  const std::vector<std::string> severitynamesEB = 
    config.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEB");

  severitiesexclEB_= 
    StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);

  const std::vector<std::string> severitynamesEE = 
    config.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEE");

  severitiesexclEE_= 
    StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);

  //AA

  //

  // Parameters for the position calculation:
  //  std::map<std::string,double> providedParameters;
  // providedParameters.insert(std::make_pair("LogWeighted",conf_.getParameter<bool>("posCalc_logweight")));
  //providedParameters.insert(std::make_pair("T0_barl",conf_.getParameter<double>("posCalc_t0_barl")));
  //providedParameters.insert(std::make_pair("T0_endc",conf_.getParameter<double>("posCalc_t0_endc")));
  //providedParameters.insert(std::make_pair("T0_endcPresh",conf_.getParameter<double>("posCalc_t0_endcPresh")));
  //providedParameters.insert(std::make_pair("W0",conf_.getParameter<double>("posCalc_w0")));
  //providedParameters.insert(std::make_pair("X0",conf_.getParameter<double>("posCalc_x0")));
  //posCalculator_ = PositionCalc(providedParameters);
  // cut values for pre-selection
  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("minSCEtBarrel")); 
  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("maxHoverEBarrel")); 
  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("ecalRecHitSumEtOffsetBarrel")); 
  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("ecalRecHitSumEtSlopeBarrel")); 
  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("hcalTowerSumEtOffsetBarrel"));
  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("hcalTowerSumEtSlopeBarrel"));
  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("nTrackSolidConeBarrel"));
  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("nTrackHollowConeBarrel"));     
  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("trackPtSumSolidConeBarrel"));     
  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("trackPtSumHollowConeBarrel"));     
  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("sigmaIetaIetaCutBarrel"));     
  //  
  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("minSCEtEndcap")); 
  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("maxHoverEEndcap")); 
  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("ecalRecHitSumEtOffsetEndcap")); 
  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("ecalRecHitSumEtSlopeEndcap")); 
  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("hcalTowerSumEtOffsetEndcap"));
  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("hcalTowerSumEtSlopeEndcap"));
  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("nTrackSolidConeEndcap"));
  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("nTrackHollowConeEndcap"));     
  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("trackPtSumSolidConeEndcap"));     
  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("trackPtSumHollowConeEndcap"));     
  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("sigmaIetaIetaCutEndcap"));     
  //

  // Register the product
  produces< reco::PhotonCollection >(PhotonCollection_);

}
PhotonProducer::~PhotonProducer ( )

Definition at line 135 of file PhotonProducer.cc.

{

  //delete energyCorrectionF;
}

Member Function Documentation

void PhotonProducer::beginRun ( edm::Run r,
edm::EventSetup const &  es 
) [virtual]
void PhotonProducer::endRun ( edm::Run r,
edm::EventSetup const &  theEventSetup 
) [virtual]
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,
reco::VertexCollection pvVertices,
reco::PhotonCollection outputCollection,
int &  iSC,
const EcalSeverityLevelAlgo sevLv 
) [private]

fill shower shape block

get ecal photon specific corrected energy plus values from regressions and store them in the Photon

Pre-selection loose isolation cuts

Definition at line 266 of file PhotonProducer.cc.

References PhotonEnergyCorrector::calculate(), PositionCalc::Calculate_Location(), candidateP4type_, EcalClusterTools::covariances(), reco::Photon::ShowerShape::e1x5, EcalClusterTools::e1x5(), reco::Photon::ShowerShape::e2x5, EcalClusterTools::e2x5Max(), reco::Photon::ShowerShape::e3x3, EcalClusterTools::e3x3(), reco::Photon::ShowerShape::e5x5, EcalClusterTools::e5x5(), DetId::Ecal, reco::Photon::ecal_photons, EcalBarrel, EcalEndcap, EcalPreshower, jptDQMConfig_cff::eMax, flagsexclEB_, flagsexclEE_, geometry, EgammaHadTower::getDepth1HcalESum(), EgammaHadTower::getDepth2HcalESum(), EgammaTowerIsolation::getTowerESum(), reco::Photon::ShowerShape::hcalDepth1OverEcal, reco::Photon::ShowerShape::hcalDepth1OverEcalBc, reco::Photon::ShowerShape::hcalDepth2OverEcal, reco::Photon::ShowerShape::hcalDepth2OverEcalBc, reco::Photon::ShowerShape::hcalTowersBehindClusters, highEt_, hOverEConeSize_, EcalClusterTools::localCovariances(), reco::Photon::ShowerShape::maxEnergyXtal, minR9Barrel_, minR9Endcap_, p4, posCalculator_, preselCutValuesBarrel_, preselCutValuesEndcap_, edm::ESHandle< T >::product(), edm::Handle< T >::product(), reco::Photon::regression1, runMIPTagger_, EgammaHadTower::setTowerCollection(), severitiesexclEB_, severitiesexclEE_, reco::Photon::ShowerShape::sigmaEtaEta, reco::Photon::ShowerShape::sigmaIetaIeta, mathSSE::sqrt(), theCaloGeom_, thePhotonEnergyCorrector_, thePhotonIsolationCalculator_, thePhotonMIPHaloTagger_, and EgammaHadTower::towersOf().

Referenced by produce().

                                                                               {
  
  const CaloGeometry* geometry = theCaloGeom_.product();
  const CaloSubdetectorGeometry* subDetGeometry =0 ;
  const CaloSubdetectorGeometry* geometryES = theCaloGeom_->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
  const EcalRecHitCollection* hits = 0 ;
  std::vector<double> preselCutValues;
  float minR9=0;


  std::vector<int> flags_, severitiesexcl_;

  for(unsigned int lSC=0; lSC < photonCoreHandle->size(); lSC++) {

    reco::PhotonCoreRef coreRef(reco::PhotonCoreRef(photonCoreHandle, lSC));
    reco::SuperClusterRef scRef=coreRef->superCluster();
    //    const reco::SuperCluster* pClus=&(*scRef);
    iSC++;

    int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
    subDetGeometry =  theCaloGeom_->getSubdetectorGeometry(DetId::Ecal, subdet);

    if (subdet==EcalBarrel) { 
      preselCutValues = preselCutValuesBarrel_;
      minR9 = minR9Barrel_;
      hits = ecalBarrelHits;
      flags_ = flagsexclEB_;
      severitiesexcl_ = severitiesexclEB_;
    } else if  (subdet==EcalEndcap)  { 
      preselCutValues = preselCutValuesEndcap_;
      minR9 = minR9Endcap_;
      hits = ecalEndcapHits;
      flags_ = flagsexclEE_;
      severitiesexcl_ = severitiesexclEE_;
    } else {
      edm::LogWarning("")<<"PhotonProducer: do not know if it is a barrel or endcap SuperCluster"; 
    }

    
    // SC energy preselection
    if (scRef->energy()/cosh(scRef->eta()) <= preselCutValues[0] ) continue;
    // calculate HoE

    const CaloTowerCollection* hcalTowersColl = hcalTowersHandle.product();
    EgammaTowerIsolation towerIso1(hOverEConeSize_,0.,0.,1,hcalTowersColl) ;  
    EgammaTowerIsolation towerIso2(hOverEConeSize_,0.,0.,2,hcalTowersColl) ;  
    double HoE1=towerIso1.getTowerESum(&(*scRef))/scRef->energy();
    double HoE2=towerIso2.getTowerESum(&(*scRef))/scRef->energy(); 
    
    EgammaHadTower towerIsoBehindClus(es); 
    towerIsoBehindClus.setTowerCollection(hcalTowersHandle.product());
    std::vector<CaloTowerDetId> TowersBehindClus =  towerIsoBehindClus.towersOf(*scRef);
    float hcalDepth1OverEcalBc = towerIsoBehindClus.getDepth1HcalESum(TowersBehindClus)/scRef->energy();
    float hcalDepth2OverEcalBc = towerIsoBehindClus.getDepth2HcalESum(TowersBehindClus)/scRef->energy();
    //    std::cout << " PhotonProducer calculation of HoE with towers in a cone " << HoE1  << "  " << HoE2 << std::endl;
    //std::cout << " PhotonProducer calcualtion of HoE with towers behind the BCs " << hcalDepth1OverEcalBc  << "  " << hcalDepth2OverEcalBc << std::endl;


    // recalculate position of seed BasicCluster taking shower depth for unconverted photon
    math::XYZPoint unconvPos = posCalculator_.Calculate_Location(scRef->seed()->hitsAndFractions(),hits,subDetGeometry,geometryES);


    float maxXtal =   EcalClusterTools::eMax( *(scRef->seed()), &(*hits) );
    //AA
    //Change these to consider severity level of hits
    float e1x5    =   EcalClusterTools::e1x5(  *(scRef->seed()), &(*hits), &(*topology), flags_, severitiesexcl_, sevLv);
    float e2x5    =   EcalClusterTools::e2x5Max(  *(scRef->seed()), &(*hits), &(*topology),flags_, severitiesexcl_, sevLv );    
    float e3x3    =   EcalClusterTools::e3x3(  *(scRef->seed()), &(*hits), &(*topology), flags_, severitiesexcl_, sevLv);
    float e5x5    =   EcalClusterTools::e5x5( *(scRef->seed()), &(*hits), &(*topology),flags_, severitiesexcl_, sevLv);   
    std::vector<float> cov =  EcalClusterTools::covariances( *(scRef->seed()), &(*hits), &(*topology), geometry,flags_, severitiesexcl_, sevLv);
    std::vector<float> locCov =  EcalClusterTools::localCovariances( *(scRef->seed()), &(*hits), &(*topology),flags_, severitiesexcl_, sevLv);
      
    float sigmaEtaEta = sqrt(cov[0]);
    float sigmaIetaIeta = sqrt(locCov[0]);
    float r9 =e3x3/(scRef->rawEnergy());

    // compute position of ECAL shower
    math::XYZPoint caloPosition;
    if (r9>minR9) {
      caloPosition = unconvPos;
    } else {
      caloPosition = scRef->position();
    }

    double photonEnergy=1.;
    math::XYZPoint vtx(0.,0.,0.);
    if (vertexCollection.size()>0) vtx = vertexCollection.begin()->position();
    // compute momentum vector of photon from primary vertex and cluster position
    math::XYZVector direction = caloPosition - vtx;
    //math::XYZVector momentum = direction.unit() * photonEnergy ;
    math::XYZVector momentum = direction.unit() ;

    // Create dummy candidate with unit momentum and zero energy to allow setting of all variables. The energy is set for last.
    math::XYZTLorentzVectorD p4(momentum.x(), momentum.y(), momentum.z(), photonEnergy );
    reco::Photon newCandidate(p4, caloPosition, coreRef, vtx);
    //std::cout << " standard p4 before " << newCandidate.p4() << " energy " << newCandidate.energy() <<  std::endl;
    //std::cout << " type " <<newCandidate.getCandidateP4type() <<  " standard p4 after " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;

    // Calculate fiducial flags and isolation variable. Blocked are filled from the isolationCalculator
    reco::Photon::FiducialFlags fiducialFlags;
    reco::Photon::IsolationVariables isolVarR03, isolVarR04;
    thePhotonIsolationCalculator_-> calculate ( &newCandidate,evt,es,fiducialFlags,isolVarR04, isolVarR03);
    newCandidate.setFiducialVolumeFlags( fiducialFlags );
    newCandidate.setIsolationVariables(isolVarR04, isolVarR03 );

    
    reco::Photon::ShowerShape  showerShape;
    showerShape.e1x5= e1x5;
    showerShape.e2x5= e2x5;
    showerShape.e3x3= e3x3;
    showerShape.e5x5= e5x5;
    showerShape.maxEnergyXtal =  maxXtal;
    showerShape.sigmaEtaEta =    sigmaEtaEta;
    showerShape.sigmaIetaIeta =  sigmaIetaIeta;
    showerShape.hcalDepth1OverEcal = HoE1;
    showerShape.hcalDepth2OverEcal = HoE2;
    showerShape.hcalDepth1OverEcalBc = hcalDepth1OverEcalBc;
    showerShape.hcalDepth2OverEcalBc = hcalDepth2OverEcalBc;
    showerShape.hcalTowersBehindClusters =  TowersBehindClus;
    newCandidate.setShowerShapeVariables ( showerShape ); 

    // Photon candidate takes by default (set in photons_cfi.py)  a 4-momentum derived from the ecal photon-specific corrections. 
    thePhotonEnergyCorrector_->calculate(evt, newCandidate, subdet, vertexCollection,es);
    if ( candidateP4type_ == "fromEcalEnergy") {
      newCandidate.setP4( newCandidate.p4(reco::Photon::ecal_photons) );
      newCandidate.setCandidateP4type(reco::Photon::ecal_photons);
    } else if ( candidateP4type_ == "fromRegression") {
      newCandidate.setP4( newCandidate.p4(reco::Photon::regression1) );
      newCandidate.setCandidateP4type(reco::Photon::regression1);
    }

    //       std::cout << " final p4 " << newCandidate.p4() << " energy " << newCandidate.energy() <<  std::endl;


    // std::cout << " PhotonProducer from candidate HoE with towers in a cone " << newCandidate.hadronicOverEm()  << "  " <<  newCandidate.hadronicDepth1OverEm()  << " " <<  newCandidate.hadronicDepth2OverEm()  << std::endl;
    //    std::cout << " PhotonProducer from candidate  of HoE with towers behind the BCs " <<  newCandidate.hadTowOverEm()  << "  " << newCandidate.hadTowDepth1OverEm() << " " << newCandidate.hadTowDepth2OverEm() << std::endl;


  // fill MIP Vairables for Halo: Block for MIP are filled from PhotonMIPHaloTagger
   reco::Photon::MIPVariables mipVar ;
   if(subdet==EcalBarrel && runMIPTagger_ )
    {
  
     thePhotonMIPHaloTagger_-> MIPcalculate( &newCandidate,evt,es,mipVar);
    newCandidate.setMIPVariables(mipVar);
    }



    bool isLooseEM=true;
    if ( newCandidate.pt() < highEt_) { 
      if ( newCandidate.hadronicOverEm()                   >= preselCutValues[1] )                                            isLooseEM=false;
      if ( newCandidate.ecalRecHitSumEtConeDR04()          > preselCutValues[2]+ preselCutValues[3]*newCandidate.pt() )       isLooseEM=false;
      if ( newCandidate.hcalTowerSumEtConeDR04()           > preselCutValues[4]+ preselCutValues[5]*newCandidate.pt() )       isLooseEM=false;
      if ( newCandidate.nTrkSolidConeDR04()                > int(preselCutValues[6]) )                                        isLooseEM=false;
      if ( newCandidate.nTrkHollowConeDR04()               > int(preselCutValues[7]) )                                        isLooseEM=false;
      if ( newCandidate.trkSumPtSolidConeDR04()            > preselCutValues[8] )                                             isLooseEM=false;
      if ( newCandidate.trkSumPtHollowConeDR04()           > preselCutValues[9] )                                             isLooseEM=false;
      if ( newCandidate.sigmaIetaIeta()                    > preselCutValues[10] )                                            isLooseEM=false;
    } 
    

        
    if ( isLooseEM)  
      outputPhotonCollection.push_back(newCandidate);
      
        
  }
}
void PhotonProducer::produce ( edm::Event evt,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 164 of file PhotonProducer.cc.

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

                                                                                   {

  using namespace edm;
  //  nEvt_++;
 
  reco::PhotonCollection outputPhotonCollection;
  std::auto_ptr< reco::PhotonCollection > outputPhotonCollection_p(new reco::PhotonCollection);


  // Get the PhotonCore collection
  bool validPhotonCoreHandle=true;
  Handle<reco::PhotonCoreCollection> photonCoreHandle;
  theEvent.getByLabel(photonCoreProducer_,photonCoreHandle);
  if (!photonCoreHandle.isValid()) {
    edm::LogError("PhotonProducer") << "Error! Can't get the product "<<photonCoreProducer_.label();
    validPhotonCoreHandle=false;
  }

 // Get EcalRecHits
  bool validEcalRecHits=true;
  Handle<EcalRecHitCollection> barrelHitHandle;
  EcalRecHitCollection barrelRecHits;
  theEvent.getByLabel(barrelEcalHits_, barrelHitHandle);
  if (!barrelHitHandle.isValid()) {
    edm::LogError("PhotonProducer") << "Error! Can't get the product "<<barrelEcalHits_.label();
    validEcalRecHits=false; 
  }
  if (  validEcalRecHits)  barrelRecHits = *(barrelHitHandle.product());

  
  Handle<EcalRecHitCollection> endcapHitHandle;
  theEvent.getByLabel(endcapEcalHits_, endcapHitHandle);
  EcalRecHitCollection endcapRecHits;
  if (!endcapHitHandle.isValid()) {
    edm::LogError("PhotonProducer") << "Error! Can't get the product "<<endcapEcalHits_.label();
    validEcalRecHits=false; 
  }
  if( validEcalRecHits) endcapRecHits = *(endcapHitHandle.product());

  //AA
  //Get the severity level object
  edm::ESHandle<EcalSeverityLevelAlgo> sevLv;
  theEventSetup.get<EcalSeverityLevelAlgoRcd>().get(sevLv);
  //


// get Hcal towers collection 
  Handle<CaloTowerCollection> hcalTowersHandle;
  theEvent.getByLabel(hcalTowers_, hcalTowersHandle);


  // get the geometry from the event setup:
  theEventSetup.get<CaloGeometryRecord>().get(theCaloGeom_);

  //
  // update energy correction function
  //  energyCorrectionF->init(theEventSetup);  

  edm::ESHandle<CaloTopology> pTopology;
  theEventSetup.get<CaloTopologyRecord>().get(theCaloTopo_);
  const CaloTopology *topology = theCaloTopo_.product();

  // Get the primary event vertex
  Handle<reco::VertexCollection> vertexHandle;
  reco::VertexCollection vertexCollection;
  bool validVertex=true;
  if ( usePrimaryVertex_ ) {
    theEvent.getByLabel(vertexProducer_, vertexHandle);
    if (!vertexHandle.isValid()) {
      edm::LogWarning("PhotonProducer") << "Error! Can't get the product primary Vertex Collection "<< "\n";
      validVertex=false;
    }
    if (validVertex) vertexCollection = *(vertexHandle.product());
  }
  //  math::XYZPoint vtx(0.,0.,0.);
  //if (vertexCollection.size()>0) vtx = vertexCollection.begin()->position();


  int iSC=0; // index in photon collection
  // Loop over barrel and endcap SC collections and fill the  photon collection
  if ( validPhotonCoreHandle) 
    fillPhotonCollection(theEvent,
                         theEventSetup,
                         photonCoreHandle,
                         topology,
                         &barrelRecHits,
                         &endcapRecHits,
                         hcalTowersHandle,
                         //vtx,
                         vertexCollection,
                         outputPhotonCollection,
                         iSC,
                         sevLv.product());
 

  // put the product in the event
  edm::LogInfo("PhotonProducer") << " Put in the event " << iSC << " Photon Candidates \n";
  outputPhotonCollection_p->assign(outputPhotonCollection.begin(),outputPhotonCollection.end());
  theEvent.put( outputPhotonCollection_p, PhotonCollection_);

}

Member Data Documentation

Definition at line 70 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

std::string PhotonProducer::candidateP4type_ [private]

Definition at line 117 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

Definition at line 99 of file PhotonProducer.h.

Referenced by beginRun(), and PhotonProducer().

Definition at line 76 of file PhotonProducer.h.

std::string PhotonProducer::conversionProducer_ [private]

Definition at line 75 of file PhotonProducer.h.

Definition at line 71 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

Definition at line 115 of file PhotonProducer.h.

std::vector<int> PhotonProducer::flagsexclEB_ [private]

Definition at line 81 of file PhotonProducer.h.

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

std::vector<int> PhotonProducer::flagsexclEE_ [private]

Definition at line 82 of file PhotonProducer.h.

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

Definition at line 73 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

double PhotonProducer::highEt_ [private]

Definition at line 90 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

Definition at line 87 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

double PhotonProducer::maxHOverE_ [private]

Definition at line 88 of file PhotonProducer.h.

double PhotonProducer::minR9Barrel_ [private]

Definition at line 91 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

double PhotonProducer::minR9Endcap_ [private]

Definition at line 92 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

double PhotonProducer::minSCEt_ [private]

Definition at line 89 of file PhotonProducer.h.

std::string PhotonProducer::PhotonCollection_ [private]

Definition at line 68 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

Definition at line 69 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

std::string PhotonProducer::pixelSeedProducer_ [private]

Definition at line 96 of file PhotonProducer.h.

Definition at line 101 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

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

Definition at line 112 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

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

Definition at line 113 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

Definition at line 93 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

std::vector<int> PhotonProducer::severitiesexclEB_ [private]

Definition at line 83 of file PhotonProducer.h.

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

std::vector<int> PhotonProducer::severitiesexclEE_ [private]

Definition at line 84 of file PhotonProducer.h.

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

Definition at line 103 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and produce().

Definition at line 104 of file PhotonProducer.h.

Referenced by produce().

Definition at line 116 of file PhotonProducer.h.

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

Definition at line 107 of file PhotonProducer.h.

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

Definition at line 110 of file PhotonProducer.h.

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

Definition at line 98 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

Definition at line 95 of file PhotonProducer.h.

Definition at line 106 of file PhotonProducer.h.

std::string PhotonProducer::vertexProducer_ [private]

Definition at line 97 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().