CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IsolationProducerForTracks.cc
Go to the documentation of this file.
10 
12 public:
14 private:
15  void produce(edm::Event& event, const edm::EventSetup& setup) override;
16 
20  double trackPtMin_;
21  double coneSize_;
22 
23 };
24 
25 
30 #include <iostream>
31 #include <iterator>
32 #include <vector>
33 
34 using namespace edm;
35 using namespace reco;
36 
38 
40  tracksToken_( consumes<CandidateView>( pset.getParameter<InputTag>( "tracks" ) ) ),
41  highPtTracksToken_( consumes<CandidateView>( pset.getParameter<InputTag>( "highPtTracks" ) ) ),
42  isoDepsToken_( consumes<IsoDepositMap>( pset.getParameter<InputTag>( "isoDeps" ) ) ),
43  trackPtMin_( pset.getParameter<double>( "trackPtMin" ) ),
44  coneSize_( pset.getParameter<double>( "coneSize" ) )
45  {
46  produces<TkIsoMap>();
47  }
48 
50  std::auto_ptr<TkIsoMap> caloIsolations(new TkIsoMap);
51  TkIsoMap::Filler filler(*caloIsolations);
52  {
54  event.getByToken(tracksToken_, tracks);
55 
57  event.getByToken(highPtTracksToken_, highPtTracks);
58 
59  Handle<IsoDepositMap> isoDeps;
60  event.getByToken(isoDepsToken_, isoDeps);
61 
62  int nTracks = tracks->size();
63  int nHighPtTracks = highPtTracks->size();
64  std::vector<double> iso(nTracks);
65 
67 
68  for(int i = 0; i < nTracks; ++i ) {
69  const Candidate & tkCand = (*tracks)[ i ];
70  double caloIso = - 1.0;
71  if( tkCand.pt() > trackPtMin_) {
72  for(int j = 0; j < nHighPtTracks; ++j ) {
73  const Candidate & highPtTkCand = (*highPtTracks)[ j ];
74  if(overlap(tkCand, highPtTkCand) ) {
75  CandidateBaseRef tkRef = highPtTracks->refAt(j);
76  const IsoDeposit &isoDep = (*isoDeps)[tkRef];
77  caloIso = isoDep.depositWithin(coneSize_);
78  break;
79  }
80  }
81  }
82  iso[i] = caloIso;
83  }
84  filler.insert(tracks, iso.begin(), iso.end());
85  }
86 
87  // really fill the association map
88  filler.fill();
89  event.put(caloIsolations);
90 }
91 
93 
int i
Definition: DBlmapReader.cc:9
const unsigned int nTracks(const reco::Vertex &sv)
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
void produce(edm::Event &event, const edm::EventSetup &setup) override
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
double depositWithin(double coneSize, const Vetos &vetos=Vetos(), bool skipDepositVeto=false) const
Get deposit.
Definition: IsoDeposit.cc:34
edm::EDGetTokenT< reco::IsoDepositMap > isoDepsToken_
int j
Definition: DBlmapReader.cc:9
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::EDGetTokenT< reco::CandidateView > highPtTracksToken_
edm::ValueMap< float > TkIsoMap
tuple tracks
Definition: testEve_cfg.py:39
edm::EDGetTokenT< reco::CandidateView > tracksToken_
IsolationProducerForTracks(const edm::ParameterSet &)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")