CMS 3D CMS Logo

ElectronSqPtTkIsolationProducer.cc
Go to the documentation of this file.
7 
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);
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::unique_ptr<reco::CandViewDoubleAssociations> isolMap(isoMap);
66  iEvent.put(std::move(isolMap));
67 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
double getPtTracks(const reco::GsfElectron *) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:15
Definition: config.py:1
void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:230
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:245
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:535
T const * product() const
Definition: Handle.h:81
et
define resolution functions of each parameter
ElectronSqPtTkIsolationProducer(const edm::ParameterSet &)
edm::AssociationVector< CandidateBaseRefProd, std::vector< double > > CandViewDoubleAssociations
void setValue(size_type i, typename CVal::value_type const &val)
def move(src, dest)
Definition: eostools.py:510