CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTTauProducer.cc
Go to the documentation of this file.
3 //
4 // class decleration
5 //
6 
7 
9 {
10  emIsolatedJetsL2_ = iConfig.getParameter<edm::InputTag>("L2EcalIsoJets");
11  trackIsolatedJetsL25_ = iConfig.getParameter<edm::InputTag>("L25TrackIsoJets");
12  trackIsolatedJetsL3_ = iConfig.getParameter<edm::InputTag>("L3TrackIsoJets");
13  matchingCone_ = iConfig.getParameter<double>("MatchingCone");
14  signalCone_ = iConfig.getParameter<double>("SignalCone");
15  isolationCone_ = iConfig.getParameter<double>("IsolationCone");
16  ptMin_ = iConfig.getParameter<double>("MinPtTracks");
17  produces<reco::HLTTauCollection>();
18 }
19 
21 
23 {
24 
25  using namespace reco;
26  using namespace edm;
27  using namespace std;
28 
29 
30  HLTTauCollection * jetCollection = new HLTTauCollection;
31 
33  iEvent.getByLabel(emIsolatedJetsL2_ , tauL2Jets );
34 
36  iEvent.getByLabel(trackIsolatedJetsL25_, tauL25Jets );
37 
39  iEvent.getByLabel(trackIsolatedJetsL3_, tauL3Jets );
40 
41  IsolatedTauTagInfoCollection tauL25 = *(tauL25Jets.product());
42  IsolatedTauTagInfoCollection tauL3 = *(tauL3Jets.product());
43 
44  int i=0;
45  float eta_, phi_, pt_;
46  int nTracksL25, nTracksL3;
47  float sumPtTracksL25 = 1000.;
48  float sumPtTracksL3 = 1000.;
49  double ptLeadTkL25=0.;
50  double ptLeadTkL3=0.;
51  for(L2TauInfoAssociation::const_iterator p = tauL2Jets->begin();p!=tauL2Jets->end();++p)
52  {
53  //Retrieve The L2TauIsolationInfo Class from the AssociationMap
54  const L2TauIsolationInfo l2info = p->val;
55  //Retrieve the Jet
56  // const CaloJet& jet =*(p->key);
57 
58 
59  double emIsol = l2info.ecalIsolEt();
60 
61  JetTracksAssociationRef jetTracks = tauL25[i].jtaRef();
62  math::XYZVector jetDirL25(jetTracks->first->px(),jetTracks->first->py(),jetTracks->first->pz());
63  eta_ = jetDirL25.eta();
64  phi_ = jetDirL25.phi();
65  pt_ = jetTracks->first->pt();
66 
67  int trackIsolationL25 = (int)tauL25[i].discriminator(jetDirL25,matchingCone_, signalCone_, isolationCone_,1.,ptMin_,0);
68  const TrackRef leadTkL25 = tauL25[i].leadingSignalTrack(jetDirL25,matchingCone_, 1.);
69  ptLeadTkL25 = 0.;
70  nTracksL25 = 1000;
71  if(!leadTkL25)
72  {}else{
73  ptLeadTkL25 = (*leadTkL25).pt();
74  const TrackRefVector signalTracks = tauL25[i].tracksInCone((*leadTkL25).momentum(), signalCone_, ptMin_ );
75  const TrackRefVector isolationTracks = tauL25[i].tracksInCone((*leadTkL25).momentum(), isolationCone_, ptMin_ );
76  nTracksL25 = isolationTracks.size() - signalTracks.size();
77 
78  for(unsigned int j=0;j<isolationTracks.size();j++)
79  sumPtTracksL25 = sumPtTracksL25 + isolationTracks[j]->pt();
80  for(unsigned int j=0;j<signalTracks.size();j++)
81  sumPtTracksL25 = sumPtTracksL25 - signalTracks[j]->pt();
82 
83  }
84  jetTracks = tauL3[i].jtaRef();
85  math::XYZVector jetDirL3(jetTracks->first->px(),jetTracks->first->py(),jetTracks->first->pz());
86  int trackIsolationL3 = (int)tauL3[i].discriminator(jetDirL3,matchingCone_, signalCone_, isolationCone_,1.,ptMin_,0);
87 
88  const TrackRef leadTkL3 = tauL3[i].leadingSignalTrack(jetDirL3,matchingCone_,1.);
89  ptLeadTkL3=0.;
90  nTracksL3 = 1000;
91  if(!leadTkL3)
92  {}else{
93  ptLeadTkL3 = (*leadTkL3).pt();
94  const TrackRefVector signalTracks = tauL3[i].tracksInCone((*leadTkL25).momentum(), signalCone_, ptMin_ );
95  const TrackRefVector isolationTracks = tauL3[i].tracksInCone((*leadTkL25).momentum(), isolationCone_, ptMin_ );
96  nTracksL3 = isolationTracks.size() - signalTracks.size();
97  float sumPtTracksL3 = 0.;
98  for(unsigned int j=0;j<isolationTracks.size();j++)
99  sumPtTracksL3 = sumPtTracksL3 + isolationTracks[j]->pt();
100  for(unsigned int j=0;j<signalTracks.size();j++)
101  sumPtTracksL3 = sumPtTracksL3 - signalTracks[j]->pt();
102  }
103 
104  HLTTau pippo(eta_,phi_,pt_,emIsol,trackIsolationL25,ptLeadTkL25,trackIsolationL3,ptLeadTkL3);
105  pippo.setNL25TrackIsolation(nTracksL25);
106  pippo.setNL3TrackIsolation(nTracksL3);
107  pippo.setSumPtTracksL25(sumPtTracksL25);
108  pippo.setSumPtTracksL3(sumPtTracksL3);
109  pippo.setSeedEcalHitEt(l2info.seedEcalHitEt());
110  pippo.setEcalClusterShape(l2info.ecalClusterShape());
111  pippo.setNEcalHits(l2info.nEcalHits());
112  pippo.setHcalIsolEt(l2info.hcalIsolEt());
113  pippo.setSeedHcalHitEt(l2info.seedHcalHitEt());
114  pippo.setHcalClusterShape(l2info.hcalClusterShape());
115  pippo.setNHcalHits(l2info.nHcalHits());
116  jetCollection->push_back(pippo);
117  i++;
118  }
119 
120  std::auto_ptr<reco::HLTTauCollection> selectedTaus(jetCollection);
121 
122  iEvent.put(selectedTaus);
123 
124 
125 
126 
127 }
void setSumPtTracksL3(double sumPt)
Definition: HLTTau.h:80
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
double isolationCone_
virtual void produce(edm::Event &, const edm::EventSetup &) override
void setHcalClusterShape(const std::vector< double > &clusters)
Definition: HLTTau.h:87
void setSeedHcalHitEt(double seed)
Definition: HLTTau.h:86
void setNEcalHits(int nhits)
Definition: HLTTau.h:83
void setSeedEcalHitEt(double seed)
Definition: HLTTau.h:81
std::vector< double > hcalClusterShape() const
void setEcalClusterShape(const std::vector< double > &clusters)
Definition: HLTTau.h:82
edm::InputTag trackIsolatedJetsL3_
double matchingCone_
edm::InputTag trackIsolatedJetsL25_
int iEvent
Definition: GenABIO.cc:243
HLTTauProducer(const edm::ParameterSet &)
void setNL25TrackIsolation(int nTracks)
Definition: HLTTau.h:77
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::InputTag emIsolatedJetsL2_
int j
Definition: DBlmapReader.cc:9
std::vector< HLTTau > HLTTauCollection
collection of HLTTau objects
Definition: HLTTauFwd.h:9
void setHcalIsolEt(double hcalIso)
Definition: HLTTau.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
void setNL3TrackIsolation(int nTracks)
Definition: HLTTau.h:78
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
std::vector< double > ecalClusterShape() const
void setNHcalHits(int nhits)
Definition: HLTTau.h:88
void setSumPtTracksL25(double sumPt)
Definition: HLTTau.h:79