CMS 3D CMS Logo

EgammaEcalRecHitIsolationProducer Class Reference

#include <EgammaAnalysis/EgammaIsolationProducers/interface/EgammaEcalRecHitIsolationProducer.h>

Inheritance diagram for EgammaEcalRecHitIsolationProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 EgammaEcalRecHitIsolationProducer (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~EgammaEcalRecHitIsolationProducer ()

Private Attributes

bool absolut_
edm::ParameterSet conf_
edm::InputTag ecalBarrelRecHitCollection_
edm::InputTag ecalBarrelRecHitProducer_
edm::InputTag ecalEndcapRecHitCollection_
edm::InputTag ecalEndcapRecHitProducer_
double egIsoConeSizeIn_
double egIsoConeSizeOut_
double egIsoPtMin_
edm::InputTag emObjectProducer_
bool useIsolEt_


Detailed Description

Definition at line 34 of file EgammaEcalRecHitIsolationProducer.h.


Constructor & Destructor Documentation

EgammaEcalRecHitIsolationProducer::EgammaEcalRecHitIsolationProducer ( const edm::ParameterSet config  )  [explicit]

Definition at line 28 of file EgammaEcalRecHitIsolationProducer.cc.

References absolut_, conf_, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeIn_, egIsoConeSizeOut_, egIsoPtMin_, emObjectProducer_, edm::ParameterSet::getParameter(), and useIsolEt_.

00028                                                                                                   : conf_(config)
00029 {
00030  // use configuration file to setup input/output collection names
00031   emObjectProducer_               = conf_.getParameter<edm::InputTag>("emObjectProducer");
00032 
00033   ecalBarrelRecHitProducer_     = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitProducer");
00034   ecalBarrelRecHitCollection_   = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitCollection");
00035   ecalEndcapRecHitProducer_     = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitProducer");
00036  ecalEndcapRecHitCollection_     = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitCollection");
00037 
00038   egIsoPtMin_               = conf_.getParameter<double>("etMin");
00039   egIsoConeSizeIn_            = conf_.getParameter<double>("intRadius");
00040   egIsoConeSizeOut_            = conf_.getParameter<double>("extRadius");
00041 
00042  absolut_ = conf_.getParameter<bool>("absolut");
00043  useIsolEt_ = conf_.getParameter<bool>("useIsolEt");
00044 
00045   //register your products
00046   produces < reco::CandViewDoubleAssociations >();
00047 }

EgammaEcalRecHitIsolationProducer::~EgammaEcalRecHitIsolationProducer (  ) 

Definition at line 50 of file EgammaEcalRecHitIsolationProducer.cc.

00050 {}


Member Function Documentation

void EgammaEcalRecHitIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 59 of file EgammaEcalRecHitIsolationProducer.cc.

References absolut_, DetId::Ecal, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeIn_, egIsoConeSizeOut_, egIsoPtMin_, emObjectProducer_, relval_parameters_module::energy, funct::exp(), edm::EventSetup::get(), edm::Ref< C, T, F >::get(), edm::Event::getByLabel(), EgammaRecHitIsolation::getEnergySum(), EgammaRecHitIsolation::getEtSum(), i, edm::InputTag::label(), edm::ESHandle< T >::product(), edm::Event::put(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::setValue(), funct::sin(), and useIsolEt_.

00060 {
00061   //very confused by all the rec hit collections, here are nuggets of info I have obtained
00062   //EcalRecHitCollection : typedef to edm::SortedCollection<EcalRecHit>, contains either barrel, endcap or preshower hits
00063   //EBRecHitCollection, EERecHitCollection, ESRecHitCollection are all typedefs to EcalRecHitCollection, there is NO (c++) difference between them
00064   //HBHERecHitCollection is a typedef to edm::SortedCollection<HBHERecHit> 
00065   //HBHERecHitMetaCollection: typedef to SimpleCaloRecHitMetaCollection<HBHERecHitCollection>
00066   //EcalRecHitMetaCollection: typedef to SimpleCaloRecHitMetaCollection<EcalRecHitCollection>
00067   //SimpleCaloRecHitMetaCollection takes a HBHE/EcalRecHitCollection as the sole constructor arguement and allows implicit conversions from *RecHitCollections
00068   //SimpleCaloRecHitMetaCollection inherits from CaloRecHitMetaCollectionV which is a non templated class unlike SimpleCaloRecHitMetaCollection
00069   //So from a c++ function view, HBHERecHitMetaCollection, EcalRecHitMetaCollection are created from respective RecHitCollections and can be both passed in as CaloRecHitMetaCollectionV pointers
00070   //as far as I can tell, that is the sole reason for the CaloRecHitMetaCollection class existing, it wraps up the templated RecHitCollections into a generic object which can be passed easily into functions without having to template them
00071 
00072 
00073 
00074   // Get the  filtered objects
00075   edm::Handle< edm::View<reco::Candidate> > emObjectHandle;
00076   iEvent.getByLabel(emObjectProducer_,emObjectHandle);
00077   
00078   
00079   // Next get Ecal hits
00080   edm::Handle<EcalRecHitCollection> ecalBarrelRecHitHandle; //EcalRecHitCollection is a typedef to 
00081   iEvent.getByLabel(ecalBarrelRecHitProducer_.label(),ecalBarrelRecHitCollection_.label(), ecalBarrelRecHitHandle);
00082 
00083   // Next get Ecal hits
00084   edm::Handle<EcalRecHitCollection> ecalEndcapRecHitHandle;
00085   iEvent.getByLabel(ecalEndcapRecHitProducer_.label(), ecalEndcapRecHitCollection_.label(),ecalEndcapRecHitHandle);
00086   
00087   //create the meta hit collections inorder that we can pass them into the isolation objects
00088 
00089   EcalRecHitMetaCollection ecalBarrelHits(*ecalBarrelRecHitHandle);
00090   EcalRecHitMetaCollection ecalEndcapHits(*ecalEndcapRecHitHandle);
00091 
00092   
00093 
00094   //Get Calo Geometry
00095   edm::ESHandle<CaloGeometry> pG;
00096   iSetup.get<CaloGeometryRecord>().get(pG);
00097   const CaloGeometry* caloGeom = pG.product();
00098 
00099 
00100   reco::CandViewDoubleAssociations* isoMap = new reco::CandViewDoubleAssociations( reco::CandidateBaseRefProd( emObjectHandle ) );
00101 
00102 
00103   EgammaRecHitIsolation ecalBarrelIsol(egIsoConeSizeOut_,egIsoConeSizeIn_,0.0,egIsoPtMin_,caloGeom,&ecalBarrelHits,DetId::Ecal);
00104   EgammaRecHitIsolation ecalEndcapIsol(egIsoConeSizeOut_,egIsoConeSizeIn_,0.0,egIsoPtMin_,caloGeom,&ecalEndcapHits,DetId::Ecal);
00105   
00106   
00107   for( size_t i = 0 ; i < emObjectHandle->size(); ++i) {
00108     
00109     //i need to know if its in the barrel/endcap so I get the supercluster handle to find out the detector eta
00110     //this might not be the best way, are we guaranteed that eta<1.5 is barrel
00111     //this can be safely replaced by another method which determines where the emobject is
00112     //then we either get the isolation Et or isolation Energy depending on user selection 
00113     double isoValue =0.;
00114 
00115     
00116     reco::SuperClusterRef superClus = emObjectHandle->at(i).get<reco::SuperClusterRef>();
00117     if(fabs(superClus->eta())<1.5){ //barrel
00118       if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i)));
00119       else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i)));
00120     }else{//endcap
00121       if(useIsolEt_) isoValue = ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
00122       else isoValue = ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
00123     }
00124 
00125     //now we put the isolation into our container, either the absolute value or relative value, NOTE we subtract off the electron energy here as well
00126     if(useIsolEt_){ //we want isolation et
00127       double et = superClus.get()->rawEnergy()*sin(2*atan(exp(-superClus.get()->eta())));
00128       if(absolut_)isoMap->setValue(i,isoValue-et); 
00129       else isoMap->setValue(i,(isoValue-et)/et);
00130     }else{ //we want isolation nrgy
00131       double energy = superClus.get()->rawEnergy();
00132       if(absolut_) isoMap->setValue(i,isoValue-energy); 
00133       else isoMap->setValue(i,(isoValue-energy)/energy);
00134     }
00135     //all done, isolation is now in the map
00136 
00137   }//end of loop over em objects
00138   
00139 
00140   std::auto_ptr<reco::CandViewDoubleAssociations> isolMap(isoMap);
00141   iEvent.put(isolMap);
00142 
00143 }


Member Data Documentation

bool EgammaEcalRecHitIsolationProducer::absolut_ [private]

Definition at line 54 of file EgammaEcalRecHitIsolationProducer.h.

Referenced by EgammaEcalRecHitIsolationProducer(), and produce().

edm::ParameterSet EgammaEcalRecHitIsolationProducer::conf_ [private]

Definition at line 57 of file EgammaEcalRecHitIsolationProducer.h.

Referenced by EgammaEcalRecHitIsolationProducer().

edm::InputTag EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitCollection_ [private]

Definition at line 46 of file EgammaEcalRecHitIsolationProducer.h.

Referenced by EgammaEcalRecHitIsolationProducer(), and produce().

edm::InputTag EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitProducer_ [private]

Definition at line 45 of file EgammaEcalRecHitIsolationProducer.h.

Referenced by EgammaEcalRecHitIsolationProducer(), and produce().

edm::InputTag EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitCollection_ [private]

Definition at line 48 of file EgammaEcalRecHitIsolationProducer.h.

Referenced by EgammaEcalRecHitIsolationProducer(), and produce().

edm::InputTag EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitProducer_ [private]

Definition at line 47 of file EgammaEcalRecHitIsolationProducer.h.

Referenced by EgammaEcalRecHitIsolationProducer(), and produce().

double EgammaEcalRecHitIsolationProducer::egIsoConeSizeIn_ [private]

Definition at line 52 of file EgammaEcalRecHitIsolationProducer.h.

Referenced by EgammaEcalRecHitIsolationProducer(), and produce().

double EgammaEcalRecHitIsolationProducer::egIsoConeSizeOut_ [private]

Definition at line 51 of file EgammaEcalRecHitIsolationProducer.h.

Referenced by EgammaEcalRecHitIsolationProducer(), and produce().

double EgammaEcalRecHitIsolationProducer::egIsoPtMin_ [private]

Definition at line 50 of file EgammaEcalRecHitIsolationProducer.h.

Referenced by EgammaEcalRecHitIsolationProducer(), and produce().

edm::InputTag EgammaEcalRecHitIsolationProducer::emObjectProducer_ [private]

Definition at line 44 of file EgammaEcalRecHitIsolationProducer.h.

Referenced by EgammaEcalRecHitIsolationProducer(), and produce().

bool EgammaEcalRecHitIsolationProducer::useIsolEt_ [private]

Definition at line 55 of file EgammaEcalRecHitIsolationProducer.h.

Referenced by EgammaEcalRecHitIsolationProducer(), and produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:09 2009 for CMSSW by  doxygen 1.5.4