CMS 3D CMS Logo

TauJetSelectorForHLTTrackSeeding.cc
Go to the documentation of this file.
2 
4 
6  : ptMinCaloJet_(iConfig.getParameter<double>("ptMinCaloJet")),
7  etaMinCaloJet_(iConfig.getParameter<double>("etaMinCaloJet")),
8  etaMaxCaloJet_(iConfig.getParameter<double>("etaMaxCaloJet")),
9  tauConeSize_(iConfig.getParameter<double>("tauConeSize")),
10  isolationConeSize_(iConfig.getParameter<double>("isolationConeSize")),
11  fractionMinCaloInTauCone_(iConfig.getParameter<double>("fractionMinCaloInTauCone")),
12  fractionMaxChargedPUInCaloCone_(iConfig.getParameter<double>("fractionMaxChargedPUInCaloCone")),
13  ptTrkMaxInCaloCone_(iConfig.getParameter<double>("ptTrkMaxInCaloCone")),
14  nTrkMaxInCaloCone_(iConfig.getParameter<int>("nTrkMaxInCaloCone")) {
15  //now do what ever initialization is needed
16  inputTrackJetToken_ = consumes<reco::TrackJetCollection>(iConfig.getParameter<edm::InputTag>("inputTrackJetTag"));
17  inputCaloJetToken_ = consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("inputCaloJetTag"));
18  inputTrackToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputTrackTag"));
19 
20  produces<reco::TrackJetCollection>();
21 }
22 
24  // do anything here that needs to be done at desctruction time
25  // (e.g. close files, deallocate resources etc.)
26 }
27 
28 //
29 // member functions
30 //
31 
32 // ------------ method called on each new Event ------------
35  const edm::EventSetup& iSetup) const {
36  std::unique_ptr<reco::TrackJetCollection> augmentedTrackJets(new reco::TrackJetCollection);
37 
39  iEvent.getByToken(inputTrackJetToken_, trackjets);
40 
41  for (reco::TrackJetCollection::const_iterator trackjet = trackjets->begin(); trackjet != trackjets->end();
42  trackjet++) {
43  augmentedTrackJets->push_back(*trackjet);
44  }
45 
47  iEvent.getByToken(inputTrackToken_, tracks);
48 
50  iEvent.getByToken(inputCaloJetToken_, calojets);
51 
52  const double tauConeSize2 = tauConeSize_ * tauConeSize_;
53  const double isolationConeSize2 = isolationConeSize_ * isolationConeSize_;
54 
55  for (reco::CaloJetCollection::const_iterator calojet = calojets->begin(); calojet != calojets->end(); calojet++) {
56  if (calojet->pt() < ptMinCaloJet_)
57  continue;
58  double etaJet = calojet->eta();
59  double phiJet = calojet->phi();
60  if (etaJet < etaMinCaloJet_)
61  continue;
62  if (etaJet > etaMaxCaloJet_)
63  continue;
64 
65  std::vector<CaloTowerPtr> const& theTowers = calojet->getCaloConstituents();
66  double ptIn = 0.;
67  double ptOut = 0.;
68  for (unsigned int itwr = 0; itwr < theTowers.size(); ++itwr) {
69  double etaTwr = theTowers[itwr]->eta() - etaJet;
70  double phiTwr = deltaPhi(theTowers[itwr]->phi(), phiJet);
71  double deltaR2 = etaTwr * etaTwr + phiTwr * phiTwr;
72  //std::cout << "Tower eta/phi/et : " << etaTwr << " " << phiTwr << " " << theTowers[itwr]->pt() << std::endl;
73  if (deltaR2 < tauConeSize2) {
74  ptIn += theTowers[itwr]->pt();
75  } else if (deltaR2 < isolationConeSize2) {
76  ptOut += theTowers[itwr]->pt();
77  }
78  }
79  double ptTot = ptIn + ptOut;
80  double fracIn = ptIn / ptTot;
81 
82  // We are looking for isolated tracks
83  if (fracIn < fractionMinCaloInTauCone_)
84  continue;
85 
86  int ntrk = 0;
87  double ptTrk = 0.;
88 
89  for (reco::TrackJetCollection::const_iterator trackjet = trackjets->begin(); trackjet != trackjets->end();
90  trackjet++) {
91  for (unsigned itr = 0; itr < trackjet->numberOfTracks(); ++itr) {
92  edm::Ptr<reco::Track> track = trackjet->track(itr);
93  double trackEta = track->eta() - etaJet;
94  double trackPhi = deltaPhi(track->phi(), phiJet);
95  double deltaR2 = trackEta * trackEta + trackPhi * trackPhi;
96  if (deltaR2 < isolationConeSize2) {
97  ntrk++;
98  ptTrk += track->pt();
99  }
100  }
101  }
102  // We are looking for calojets without signal tracks already in
103  if (ntrk > nTrkMaxInCaloCone_)
104  continue;
105  if (ptTrk > ptTrkMaxInCaloCone_)
106  continue;
107 
108  int ntrk2 = 0;
109  double ptTrk2 = 0.;
110 
111  for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); track++) {
112  double trackEta = track->eta() - etaJet;
113  double trackPhi = deltaPhi(track->phi(), phiJet);
114  double deltaR2 = trackEta * trackEta + trackPhi * trackPhi;
115  if (deltaR2 < isolationConeSize2) {
116  ntrk2++;
117  ptTrk2 += track->pt();
118  }
119  }
120  // We are looking for signal jets, not PU jets
121  double fractionChargedPU = ptTrk2 / calojet->pt();
122  if (fractionChargedPU > fractionMaxChargedPUInCaloCone_)
123  continue;
124  /*
125  std::cout << "Calo Jet " << calojet->pt() << " " << calojet->eta()
126  << " " << ptIn << " " << ptOut << " " << fracIn
127  << " " << ptTrk << " " << ntrk
128  << " " << fractionChargedPU
129  << std::endl;
130  */
131  math::XYZTLorentzVector p4(calojet->p4());
132  math::XYZPoint vertex(calojet->vertex());
133  augmentedTrackJets->push_back(reco::TrackJet(p4, vertex));
134  }
135 
136  iEvent.put(std::move(augmentedTrackJets));
137 }
138 
139 // ------------ method called once each job just before starting event loop ------------
141 
142 // ------------ method called once each job just after ending the event loop ------------
144 
147  desc.add<edm::InputTag>("inputTrackJetTag", edm::InputTag("hltAntiKT5TrackJetsIter0"))
148  ->setComment("Oryginal TrackJet collection");
149  desc.add<edm::InputTag>("inputCaloJetTag", edm::InputTag("hltAntiKT5CaloJetsPFEt5"))
150  ->setComment("CaloJet collection");
151  desc.add<edm::InputTag>("inputTrackTag", edm::InputTag("hltPFlowTrackSelectionHighPurity"))
152  ->setComment("Track collection for track isolation");
153  desc.add<double>("ptMinCaloJet", 5.0)->setComment("Min. pT of CaloJet");
154  desc.add<double>("etaMinCaloJet", -2.7)->setComment("Min. eta of CaloJet");
155  desc.add<double>("etaMaxCaloJet", +2.7)->setComment("Max. eta of CaloJet");
156  desc.add<double>("tauConeSize", 0.2)->setComment("Radius of tau signal cone");
157  desc.add<double>("isolationConeSize", 0.5)->setComment("Radius of isolation cone");
158  desc.add<double>("fractionMinCaloInTauCone", 0.8)->setComment("Min. fraction of calo energy in tau signal cone");
159  desc.add<double>("fractionMaxChargedPUInCaloCone", 0.2)
160  ->setComment("Max. fraction of PU charged energy Sum(Pt_trks)/Pt_jet in signal cone");
161  desc.add<double>("ptTrkMaxInCaloCone", 1.0)->setComment("Max. sum of pT of tracks in isolation cone");
162  desc.add<int>("nTrkMaxInCaloCone", 0)->setComment("Max. no. of tracks in isolation cone");
163  descriptions.setComment(
164  "This module produces a collection of TrackJets to seed iterative tracking.\nIt is done by enriching the input "
165  "TrackJet collection with CaloJets passing isolation critera - tau candidates");
166  descriptions.add("tauJetSelectorForHLTTrackSeeding", desc);
167 }
edm::StreamID
Definition: StreamID.h:30
reco::TrackJetCollection
std::vector< TrackJet > TrackJetCollection
collection of TrackJet objects
Definition: TrackJetCollection.h:14
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
deltaPhi.h
TauJetSelectorForHLTTrackSeeding::beginJob
void beginJob() override
Definition: TauJetSelectorForHLTTrackSeeding.cc:140
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TauJetSelectorForHLTTrackSeeding.h
TauJetSelectorForHLTTrackSeeding::fractionMinCaloInTauCone_
const double fractionMinCaloInTauCone_
Definition: TauJetSelectorForHLTTrackSeeding.h:48
reco::btau::trackEta
Definition: TaggingVariable.h:42
edm::Handle
Definition: AssociativeIterator.h:50
TauJetSelectorForHLTTrackSeeding::isolationConeSize_
const double isolationConeSize_
Definition: TauJetSelectorForHLTTrackSeeding.h:47
reco::TrackJet
Jets made out of tracks.
Definition: TrackJet.h:24
TauJetSelectorForHLTTrackSeeding::~TauJetSelectorForHLTTrackSeeding
~TauJetSelectorForHLTTrackSeeding() override
Definition: TauJetSelectorForHLTTrackSeeding.cc:23
TauJetSelectorForHLTTrackSeeding::ptMinCaloJet_
const double ptMinCaloJet_
Definition: TauJetSelectorForHLTTrackSeeding.h:43
TauJetSelectorForHLTTrackSeeding::tauConeSize_
const double tauConeSize_
Definition: TauJetSelectorForHLTTrackSeeding.h:46
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
TauJetSelectorForHLTTrackSeeding::inputTrackToken_
edm::EDGetTokenT< reco::TrackCollection > inputTrackToken_
Definition: TauJetSelectorForHLTTrackSeeding.h:42
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
TauJetSelectorForHLTTrackSeeding::ptTrkMaxInCaloCone_
const double ptTrkMaxInCaloCone_
Definition: TauJetSelectorForHLTTrackSeeding.h:50
TauJetSelectorForHLTTrackSeeding::nTrkMaxInCaloCone_
const int nTrkMaxInCaloCone_
Definition: TauJetSelectorForHLTTrackSeeding.h:51
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
edm::ParameterSet
Definition: ParameterSet.h:47
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
edm::ConfigurationDescriptions::setComment
void setComment(std::string const &value)
Definition: ConfigurationDescriptions.cc:48
reco::btau::trackPhi
Definition: TaggingVariable.h:43
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
TauJetSelectorForHLTTrackSeeding::endJob
void endJob() override
Definition: TauJetSelectorForHLTTrackSeeding.cc:143
p4
double p4[4]
Definition: TauolaWrapper.h:92
edm::EventSetup
Definition: EventSetup.h:58
edm::Ptr< reco::Track >
DDAxes::phi
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
TauJetSelectorForHLTTrackSeeding::fractionMaxChargedPUInCaloCone_
const double fractionMaxChargedPUInCaloCone_
Definition: TauJetSelectorForHLTTrackSeeding.h:49
TauJetSelectorForHLTTrackSeeding::etaMinCaloJet_
const double etaMinCaloJet_
Definition: TauJetSelectorForHLTTrackSeeding.h:44
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
TauJetSelectorForHLTTrackSeeding::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: TauJetSelectorForHLTTrackSeeding.cc:33
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TauJetSelectorForHLTTrackSeeding::inputTrackJetToken_
edm::EDGetTokenT< reco::TrackJetCollection > inputTrackJetToken_
Definition: TauJetSelectorForHLTTrackSeeding.h:40
TauJetSelectorForHLTTrackSeeding::etaMaxCaloJet_
const double etaMaxCaloJet_
Definition: TauJetSelectorForHLTTrackSeeding.h:45
TauJetSelectorForHLTTrackSeeding::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TauJetSelectorForHLTTrackSeeding.cc:145
edm::Event
Definition: Event.h:73
TauJetSelectorForHLTTrackSeeding::inputCaloJetToken_
edm::EDGetTokenT< reco::CaloJetCollection > inputCaloJetToken_
Definition: TauJetSelectorForHLTTrackSeeding.h:41
edm::InputTag
Definition: InputTag.h:15
TauJetSelectorForHLTTrackSeeding::TauJetSelectorForHLTTrackSeeding
TauJetSelectorForHLTTrackSeeding(const edm::ParameterSet &)
Definition: TauJetSelectorForHLTTrackSeeding.cc:5