CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ElectronSqPtTkIsolationProducer.cc
Go to the documentation of this file.
7 
10 
11 
14 
16 {
17  // use configuration file to setup input/output collection names
18  electronProducer_ = conf_.getParameter<edm::InputTag>("electronProducer");
19 
20  trackProducer_ = conf_.getParameter<edm::InputTag>("trackProducer");
21 
22  ptMin_ = conf_.getParameter<double>("ptMin");
23  intRadius_ = conf_.getParameter<double>("intRadius");
24  extRadius_ = conf_.getParameter<double>("extRadius");
25  maxVtxDist_ = conf_.getParameter<double>("maxVtxDist");
26 
27  absolut_ = conf_.getParameter<bool>("absolut");
28 
29  //register your products
30  produces < reco::CandViewDoubleAssociations>();
31 
32 }
33 
35 
36 
37 
39 {
40  // Get the filtered objects
42  iEvent.getByLabel(electronProducer_,electronHandle);
43 
44  //get the tracks
46  iEvent.getByLabel(trackProducer_,tracks);
47  const reco::TrackCollection* trackCollection = tracks.product();
48 
50 
51  ElectronSqPtTkIsolation myTkIsolation (extRadius_,intRadius_,ptMin_,maxVtxDist_,trackCollection) ;
52 
53  for(unsigned int i = 0 ; i < electronHandle->size(); ++i ){
54  double isoValue = myTkIsolation.getPtTracks(&(electronHandle->at(i)));
55  if(absolut_==true){
56  isoMap->setValue(i,isoValue);
57  }
58  else{
59  reco::SuperClusterRef sc = (electronHandle->at(i)).superCluster();
60  double et = sc.get()->energy()*sin(2*atan(exp(-sc.get()->eta())));
61  isoMap->setValue(i,isoValue/et);
62  }
63  }
64 
65  std::auto_ptr<reco::CandViewDoubleAssociations> isolMap(isoMap);
66  iEvent.put(isolMap);
67 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
double getPtTracks(const reco::GsfElectron *) const
virtual void produce(edm::Event &, const edm::EventSetup &)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
tuple tracks
Definition: testEve_cfg.py:39
T const * product() const
Definition: Handle.h:81
ElectronSqPtTkIsolationProducer(const edm::ParameterSet &)
edm::AssociationVector< CandidateBaseRefProd, std::vector< double > > CandViewDoubleAssociations
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
void setValue(size_type i, typename CVal::value_type const &val)