CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TauJetSelectorForHLTTrackSeeding Class Reference

#include <TauJetSelectorForHLTTrackSeeding.h>

Inheritance diagram for TauJetSelectorForHLTTrackSeeding:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TauJetSelectorForHLTTrackSeeding (const edm::ParameterSet &)
 
 ~TauJetSelectorForHLTTrackSeeding ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const double etaMaxCaloJet_
 
const double etaMinCaloJet_
 
const double fractionMaxChargedPUInCaloCone_
 
const double fractionMinCaloInTauCone_
 
edm::EDGetTokenT
< reco::CaloJetCollection
inputCaloJetToken_
 
edm::EDGetTokenT
< reco::TrackJetCollection
inputTrackJetToken_
 
edm::EDGetTokenT
< reco::TrackCollection
inputTrackToken_
 
const double isolationConeSize_
 
const int nTrkMaxInCaloCone_
 
const double ptMinCaloJet_
 
const double ptTrkMaxInCaloCone_
 
const double tauConeSize_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 24 of file TauJetSelectorForHLTTrackSeeding.h.

Constructor & Destructor Documentation

TauJetSelectorForHLTTrackSeeding::TauJetSelectorForHLTTrackSeeding ( const edm::ParameterSet iConfig)
explicit

Definition at line 6 of file TauJetSelectorForHLTTrackSeeding.cc.

References edm::ParameterSet::getParameter(), inputCaloJetToken_, inputTrackJetToken_, and inputTrackToken_.

6  :
7  ptMinCaloJet_(iConfig.getParameter< double > ("ptMinCaloJet")),
8  etaMinCaloJet_(iConfig.getParameter< double > ("etaMinCaloJet")),
9  etaMaxCaloJet_(iConfig.getParameter< double > ("etaMaxCaloJet")),
10  tauConeSize_(iConfig.getParameter< double > ("tauConeSize")),
11  isolationConeSize_(iConfig.getParameter< double > ("isolationConeSize")),
12  fractionMinCaloInTauCone_(iConfig.getParameter< double > ("fractionMinCaloInTauCone")),
13  fractionMaxChargedPUInCaloCone_(iConfig.getParameter< double > ("fractionMaxChargedPUInCaloCone")),
14  ptTrkMaxInCaloCone_(iConfig.getParameter< double > ("ptTrkMaxInCaloCone")),
15  nTrkMaxInCaloCone_(iConfig.getParameter< int > ("nTrkMaxInCaloCone"))
16 {
17  //now do what ever initialization is needed
18  inputTrackJetToken_ = consumes< reco::TrackJetCollection >(iConfig.getParameter< edm::InputTag > ("inputTrackJetTag"));
19  inputCaloJetToken_ = consumes< reco::CaloJetCollection >(iConfig.getParameter< edm::InputTag > ("inputCaloJetTag"));
20  inputTrackToken_ = consumes< reco::TrackCollection >(iConfig.getParameter< edm::InputTag > ("inputTrackTag"));
21 
22  produces<reco::TrackJetCollection>();
23 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackJetCollection > inputTrackJetToken_
edm::EDGetTokenT< reco::TrackCollection > inputTrackToken_
edm::EDGetTokenT< reco::CaloJetCollection > inputCaloJetToken_
TauJetSelectorForHLTTrackSeeding::~TauJetSelectorForHLTTrackSeeding ( )

Definition at line 26 of file TauJetSelectorForHLTTrackSeeding.cc.

27 {
28 
29  // do anything here that needs to be done at desctruction time
30  // (e.g. close files, deallocate resources etc.)
31 
32 }

Member Function Documentation

void TauJetSelectorForHLTTrackSeeding::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 144 of file TauJetSelectorForHLTTrackSeeding.cc.

144 {}
void TauJetSelectorForHLTTrackSeeding::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 148 of file TauJetSelectorForHLTTrackSeeding.cc.

148 {}
void TauJetSelectorForHLTTrackSeeding::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 41 of file TauJetSelectorForHLTTrackSeeding.cc.

References SiPixelRawToDigiRegional_cfi::deltaPhi, reco::deltaR2(), etaMaxCaloJet_, etaMinCaloJet_, fractionMaxChargedPUInCaloCone_, fractionMinCaloInTauCone_, edm::Event::getByToken(), inputCaloJetToken_, inputTrackJetToken_, inputTrackToken_, isolationConeSize_, nTrkMaxInCaloCone_, p4, phi, ptMinCaloJet_, ptTrkMaxInCaloCone_, edm::Event::put(), tauConeSize_, reco::btau::trackEta, reco::btau::trackPhi, and testEve_cfg::tracks.

42 {
43  std::auto_ptr< reco::TrackJetCollection > augmentedTrackJets (new reco::TrackJetCollection);
44 
46  iEvent.getByToken(inputTrackJetToken_, trackjets);
47 
48  for (reco::TrackJetCollection::const_iterator trackjet = trackjets->begin();
49  trackjet != trackjets->end(); trackjet++) {
50  augmentedTrackJets->push_back(*trackjet);
51  }
52 
54  iEvent.getByToken(inputTrackToken_,tracks);
55 
57  iEvent.getByToken(inputCaloJetToken_,calojets);
58 
59  const double tauConeSize2 = tauConeSize_ * tauConeSize_;
60  const double isolationConeSize2 = isolationConeSize_ * isolationConeSize_;
61 
62  for (reco::CaloJetCollection::const_iterator calojet = calojets->begin();
63  calojet != calojets->end(); calojet++) {
64 
65  if ( calojet->pt() < ptMinCaloJet_ ) continue;
66  double etaJet = calojet->eta();
67  double phiJet = calojet->phi();
68  if ( etaJet < etaMinCaloJet_ ) continue;
69  if ( etaJet > etaMaxCaloJet_ ) continue;
70 
71  std::vector <CaloTowerPtr> const & theTowers = calojet->getCaloConstituents();
72  double ptIn = 0.;
73  double ptOut = 0.;
74  for ( unsigned int itwr = 0; itwr < theTowers.size(); ++itwr ) {
75  double etaTwr = theTowers[itwr]->eta() - etaJet;
76  double phiTwr = deltaPhi(theTowers[itwr]->phi(), phiJet);
77  double deltaR2 = etaTwr*etaTwr + phiTwr*phiTwr;
78  //std::cout << "Tower eta/phi/et : " << etaTwr << " " << phiTwr << " " << theTowers[itwr]->pt() << std::endl;
79  if ( deltaR2 < tauConeSize2 ) {
80  ptIn += theTowers[itwr]->pt();
81  } else if ( deltaR2 < isolationConeSize2 ) {
82  ptOut += theTowers[itwr]->pt();
83  }
84  }
85  double ptTot = ptIn+ptOut;
86  double fracIn = ptIn/ptTot;
87 
88  // We are looking for isolated tracks
89  if ( fracIn < fractionMinCaloInTauCone_) continue;
90 
91  int ntrk = 0;
92  double ptTrk = 0.;
93 
94  for (reco::TrackJetCollection::const_iterator trackjet = trackjets->begin();
95  trackjet != trackjets->end(); trackjet++) {
96  for (unsigned itr=0; itr<trackjet->numberOfTracks(); ++itr) {
97  edm::Ptr<reco::Track> track = trackjet->track(itr);
98  double trackEta = track->eta() - etaJet;
99  double trackPhi = deltaPhi(track->phi(), phiJet);
100  double deltaR2 = trackEta*trackEta + trackPhi*trackPhi;
101  if ( deltaR2 < isolationConeSize2 ) {
102  ntrk++;
103  ptTrk += track->pt();
104  }
105  }
106  }
107  // We are looking for calojets without signal tracks already in
108  if ( ntrk > nTrkMaxInCaloCone_ ) continue;
109  if ( ptTrk > ptTrkMaxInCaloCone_ ) continue;
110 
111  int ntrk2 = 0;
112  double ptTrk2 = 0.;
113 
114  for (reco::TrackCollection::const_iterator track = tracks->begin();
115  track != tracks->end(); track++) {
116  double trackEta = track->eta() - etaJet;
117  double trackPhi = deltaPhi(track->phi(), phiJet);
118  double deltaR2 = trackEta*trackEta + trackPhi*trackPhi;
119  if ( deltaR2 < isolationConeSize2 ) {
120  ntrk2++;
121  ptTrk2 += track->pt();
122  }
123  }
124  // We are looking for signal jets, not PU jets
125  double fractionChargedPU = ptTrk2/calojet->pt();
126  if ( fractionChargedPU > fractionMaxChargedPUInCaloCone_ ) continue;
127  /*
128  std::cout << "Calo Jet " << calojet->pt() << " " << calojet->eta()
129  << " " << ptIn << " " << ptOut << " " << fracIn
130  << " " << ptTrk << " " << ntrk
131  << " " << fractionChargedPU
132  << std::endl;
133  */
134  math::XYZTLorentzVector p4(calojet->p4());
135  math::XYZPoint vertex(calojet->vertex());
136  augmentedTrackJets->push_back(reco::TrackJet(p4,vertex));
137  }
138 
139  iEvent.put(augmentedTrackJets);
140 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< reco::TrackJetCollection > inputTrackJetToken_
edm::EDGetTokenT< reco::TrackCollection > inputTrackToken_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
double p4[4]
Definition: TauolaWrapper.h:92
double deltaR2(const T1 &t1, const T2 &t2)
Definition: deltaR.h:36
Jets made out of tracks.
Definition: TrackJet.h:27
tuple tracks
Definition: testEve_cfg.py:39
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< TrackJet > TrackJetCollection
collection of TrackJet objects
edm::EDGetTokenT< reco::CaloJetCollection > inputCaloJetToken_
Definition: DDAxes.h:10

Member Data Documentation

const double TauJetSelectorForHLTTrackSeeding::etaMaxCaloJet_
private

Definition at line 42 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

const double TauJetSelectorForHLTTrackSeeding::etaMinCaloJet_
private

Definition at line 41 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

const double TauJetSelectorForHLTTrackSeeding::fractionMaxChargedPUInCaloCone_
private

Definition at line 46 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

const double TauJetSelectorForHLTTrackSeeding::fractionMinCaloInTauCone_
private

Definition at line 45 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

edm::EDGetTokenT<reco::CaloJetCollection> TauJetSelectorForHLTTrackSeeding::inputCaloJetToken_
private

Definition at line 38 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce(), and TauJetSelectorForHLTTrackSeeding().

edm::EDGetTokenT<reco::TrackJetCollection> TauJetSelectorForHLTTrackSeeding::inputTrackJetToken_
private

Definition at line 37 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce(), and TauJetSelectorForHLTTrackSeeding().

edm::EDGetTokenT<reco::TrackCollection> TauJetSelectorForHLTTrackSeeding::inputTrackToken_
private

Definition at line 39 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce(), and TauJetSelectorForHLTTrackSeeding().

const double TauJetSelectorForHLTTrackSeeding::isolationConeSize_
private

Definition at line 44 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

const int TauJetSelectorForHLTTrackSeeding::nTrkMaxInCaloCone_
private

Definition at line 48 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

const double TauJetSelectorForHLTTrackSeeding::ptMinCaloJet_
private

Definition at line 40 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

const double TauJetSelectorForHLTTrackSeeding::ptTrkMaxInCaloCone_
private

Definition at line 47 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

const double TauJetSelectorForHLTTrackSeeding::tauConeSize_
private

Definition at line 43 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().