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 Attributes
EgammaEcalRecHitIsolationProducer Class Reference

#include <EgammaEcalRecHitIsolationProducer.h>

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

Public Member Functions

 EgammaEcalRecHitIsolationProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~EgammaEcalRecHitIsolationProducer ()
 
- 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 Attributes

edm::ParameterSet conf_
 
edm::InputTag ecalBarrelRecHitCollection_
 
edm::InputTag ecalBarrelRecHitProducer_
 
edm::InputTag ecalEndcapRecHitCollection_
 
edm::InputTag ecalEndcapRecHitProducer_
 
double egIsoConeSizeInBarrel_
 
double egIsoConeSizeInEndcap_
 
double egIsoConeSizeOut_
 
double egIsoEMinBarrel_
 
double egIsoEMinEndcap_
 
double egIsoJurassicWidth_
 
double egIsoPtMinBarrel_
 
double egIsoPtMinEndcap_
 
edm::InputTag emObjectProducer_
 
bool subtract_
 
bool tryBoth_
 
bool useIsolEt_
 
bool useNumCrystals_
 
bool vetoClustered_
 

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

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 conf_, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, emObjectProducer_, edm::ParameterSet::getParameter(), subtract_, tryBoth_, useIsolEt_, useNumCrystals_, and vetoClustered_.

28  : conf_(config)
29 {
30  // use configuration file to setup input/output collection names
31  //inputs
32  emObjectProducer_ = conf_.getParameter<edm::InputTag>("emObjectProducer");
33  ecalBarrelRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitProducer");
34  ecalBarrelRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitCollection");
35  ecalEndcapRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitProducer");
36  ecalEndcapRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitCollection");
37 
38  //vetos
39  egIsoPtMinBarrel_ = conf_.getParameter<double>("etMinBarrel");
40  egIsoEMinBarrel_ = conf_.getParameter<double>("eMinBarrel");
41  egIsoPtMinEndcap_ = conf_.getParameter<double>("etMinEndcap");
42  egIsoEMinEndcap_ = conf_.getParameter<double>("eMinEndcap");
43  egIsoConeSizeInBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
44  egIsoConeSizeInEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
45  egIsoConeSizeOut_ = conf_.getParameter<double>("extRadius");
46  egIsoJurassicWidth_ = conf_.getParameter<double>("jurassicWidth");
47 
48 
49 
50  // options
51  useIsolEt_ = conf_.getParameter<bool>("useIsolEt");
52  tryBoth_ = conf_.getParameter<bool>("tryBoth");
53  subtract_ = conf_.getParameter<bool>("subtract");
54  useNumCrystals_ = conf_.getParameter<bool>("useNumCrystals");
55  vetoClustered_ = conf_.getParameter<bool>("vetoClustered");
56 
57  //register your products
58  produces < edm::ValueMap<double> >();
59 }
T getParameter(std::string const &) const
EgammaEcalRecHitIsolationProducer::~EgammaEcalRecHitIsolationProducer ( )

Definition at line 62 of file EgammaEcalRecHitIsolationProducer.cc.

62 {}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 71 of file EgammaEcalRecHitIsolationProducer.cc.

References DetId::Ecal, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, emObjectProducer_, funct::exp(), edm::helper::Filler< Map >::fill(), edm::EventSetup::get(), edm::Ref< C, T, F >::get(), edm::Event::getByLabel(), EgammaRecHitIsolation::getEnergySum(), EgammaRecHitIsolation::getEtSum(), i, edm::helper::Filler< Map >::insert(), edm::InputTag::label(), edm::ESHandle< class >::product(), edm::Event::put(), EgammaRecHitIsolation::setUseNumCrystals(), EgammaRecHitIsolation::setVetoClustered(), funct::sin(), subtract_, tryBoth_, useIsolEt_, useNumCrystals_, and vetoClustered_.

72 {
73 
74 
75  // Get the filtered objects
77  iEvent.getByLabel(emObjectProducer_,emObjectHandle);
78 
79  // Next get Ecal hits barrel
80  edm::Handle<EcalRecHitCollection> ecalBarrelRecHitHandle; //EcalRecHitCollection is a typedef to
82 
83  // Next get Ecal hits endcap
84  edm::Handle<EcalRecHitCollection> ecalEndcapRecHitHandle;
86 
87  //create the meta hit collections inorder that we can pass them into the isolation objects
88 
89  EcalRecHitMetaCollection ecalBarrelHits(*ecalBarrelRecHitHandle);
90  EcalRecHitMetaCollection ecalEndcapHits(*ecalEndcapRecHitHandle);
91 
92  //Get Calo Geometry
94  iSetup.get<CaloGeometryRecord>().get(pG);
95  const CaloGeometry* caloGeom = pG.product();
96 
97  //reco::CandViewDoubleAssociations* isoMap = new reco::CandViewDoubleAssociations( reco::CandidateBaseRefProd( emObjectHandle ) );
98  std::auto_ptr<edm::ValueMap<double> > isoMap(new edm::ValueMap<double>());
99  edm::ValueMap<double>::Filler filler(*isoMap);
100  std::vector<double> retV(emObjectHandle->size(),0);
101 
102 
104  ecalBarrelIsol.setUseNumCrystals(useNumCrystals_);
105  ecalBarrelIsol.setVetoClustered(vetoClustered_);
106 
108  ecalEndcapIsol.setUseNumCrystals(useNumCrystals_);
109  ecalEndcapIsol.setVetoClustered(vetoClustered_);
110 
111 
112  for( size_t i = 0 ; i < emObjectHandle->size(); ++i) {
113 
114  //i need to know if its in the barrel/endcap so I get the supercluster handle to find out the detector eta
115  //this might not be the best way, are we guaranteed that eta<1.5 is barrel
116  //this can be safely replaced by another method which determines where the emobject is
117  //then we either get the isolation Et or isolation Energy depending on user selection
118  double isoValue =0.;
119 
120  reco::SuperClusterRef superClus = emObjectHandle->at(i).get<reco::SuperClusterRef>();
121 
122  if(tryBoth_){ //barrel + endcap
123  if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
124  else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
125  }
126  else if( fabs(superClus->eta())<1.479) { //barrel
127  if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i)));
128  else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i)));
129  }
130  else{ //endcap
131  if(useIsolEt_) isoValue = ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
132  else isoValue = ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
133  }
134 
135  //we subtract off the electron energy here as well
136  double subtractVal=0;
137 
138  if(useIsolEt_) subtractVal = superClus.get()->rawEnergy()*sin(2*atan(exp(-superClus.get()->eta())));
139  else subtractVal = superClus.get()->rawEnergy();
140 
141  if(subtract_) isoValue-= subtractVal;
142 
143  retV[i]=isoValue;
144  //all done, isolation is now in the map
145 
146  }//end of loop over em objects
147 
148  filler.insert(emObjectHandle,retV.begin(),retV.end());
149  filler.fill();
150 
151  //std::auto_ptr<reco::CandViewDoubleAssociations> isolMap(isoMap);
152  iEvent.put(isoMap);
153 
154 }
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::string const & label() const
Definition: InputTag.h:25
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:239

Member Data Documentation

edm::ParameterSet EgammaEcalRecHitIsolationProducer::conf_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitCollection_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitProducer_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitCollection_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitProducer_
private
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInBarrel_
private
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInEndcap_
private
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeOut_
private
double EgammaEcalRecHitIsolationProducer::egIsoEMinBarrel_
private
double EgammaEcalRecHitIsolationProducer::egIsoEMinEndcap_
private
double EgammaEcalRecHitIsolationProducer::egIsoJurassicWidth_
private
double EgammaEcalRecHitIsolationProducer::egIsoPtMinBarrel_
private
double EgammaEcalRecHitIsolationProducer::egIsoPtMinEndcap_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::emObjectProducer_
private
bool EgammaEcalRecHitIsolationProducer::subtract_
private
bool EgammaEcalRecHitIsolationProducer::tryBoth_
private
bool EgammaEcalRecHitIsolationProducer::useIsolEt_
private
bool EgammaEcalRecHitIsolationProducer::useNumCrystals_
private
bool EgammaEcalRecHitIsolationProducer::vetoClustered_
private