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 Types | Private Attributes
L2TauJetsProvider Class Reference

#include <L2TauJetsProvider.h>

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

Public Member Functions

 L2TauJetsProvider (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~L2TauJetsProvider ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef std::vector
< edm::InputTag
vtag
 

Private Attributes

std::vector
< l1extra::L1JetParticleRef
jetCandRefVec
 
vtag jetSrc
 
std::vector< edm::EDGetTokenT
< reco::CaloJetCollection > > 
jetSrcToken
 
edm::EDGetTokenT
< l1extra::L1JetParticleCollection
l1ParticlesJet
 
edm::EDGetTokenT
< l1extra::L1JetParticleCollection
l1ParticlesTau
 
double mEt_Min
 
std::map< int, const
reco::CaloJet
myL2L1JetsMap
 
std::vector
< l1extra::L1JetParticleRef
objL1CandRefVec
 
l1extra::L1JetParticleRef tauCandRef
 
std::vector
< l1extra::L1JetParticleRef
tauCandRefVec
 
edm::EDGetTokenT
< trigger::TriggerFilterObjectWithRefs
tauTrigger
 

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 23 of file L2TauJetsProvider.h.

Member Typedef Documentation

typedef std::vector<edm::InputTag> L2TauJetsProvider::vtag
private

Definition at line 35 of file L2TauJetsProvider.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file L2TauJetsProvider.cc.

References edm::ParameterSet::getParameter(), HLT_25ns14e33_v1_cff::jetSrc, and alignCSCRings::s.

16 {
17  jetSrc = iConfig.getParameter<vtag>("JetSrc");
18  for( vtag::const_iterator s = jetSrc.begin(); s != jetSrc.end(); ++ s ) {
19  edm::EDGetTokenT<CaloJetCollection> aToken = consumes<CaloJetCollection>( *s );
20  jetSrcToken.push_back(aToken);
21  }
22  l1ParticlesTau = consumes<L1JetParticleCollection>(iConfig.getParameter<InputTag>("L1ParticlesTau"));
23  l1ParticlesJet = consumes<L1JetParticleCollection>(iConfig.getParameter<InputTag>("L1ParticlesJet"));
24  tauTrigger = consumes<trigger::TriggerFilterObjectWithRefs>(iConfig.getParameter<InputTag>("L1TauTrigger"));
25  mEt_Min = iConfig.getParameter<double>("EtMin");
26 
27  produces<CaloJetCollection>();
28 }
T getParameter(std::string const &) const
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tauTrigger
edm::EDGetTokenT< l1extra::L1JetParticleCollection > l1ParticlesJet
std::vector< edm::EDGetTokenT< reco::CaloJetCollection > > jetSrcToken
std::vector< edm::InputTag > vtag
edm::EDGetTokenT< l1extra::L1JetParticleCollection > l1ParticlesTau
L2TauJetsProvider::~L2TauJetsProvider ( )

Definition at line 30 of file L2TauJetsProvider.cc.

30 { }

Member Function Documentation

void L2TauJetsProvider::produce ( edm::Event iEvent,
const edm::EventSetup iES 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 32 of file L2TauJetsProvider.cc.

References edm::HandleBase::clear(), reco::deltaR(), HLT_25ns14e33_v1_cff::DeltaR, edm::Event::getByToken(), i, j, p4, reco::LeafCandidate::pt(), edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, alignCSCRings::s, trigger::TriggerL1CenJet, and trigger::TriggerL1TauJet.

33 {
34 
35  using namespace edm;
36  using namespace std;
37  using namespace reco;
38  using namespace trigger;
39  using namespace l1extra;
40 
41 
42  //Getting all the L1Seeds
43 
44 
45  //Getting the Collections of L2ReconstructedJets from L1Seeds
46  //and removing the collinear jets
47  myL2L1JetsMap.clear();
48  int iL1Jet = 0;
49  typedef std::vector<edm::EDGetTokenT<reco::CaloJetCollection> > vtag_token;
50  for( vtag_token::const_iterator s = jetSrcToken.begin(); s != jetSrcToken.end(); ++ s ) {
52  iEvent.getByToken( * s, tauJets );
53  CaloJetCollection::const_iterator iTau = tauJets->begin();
54  if(iTau != tauJets->end()){
55  //Create a Map to associate to every Jet its L1SeedId, i.e. 0,1,2 or 3
56  myL2L1JetsMap.insert(std::pair<int, const CaloJet>(iL1Jet, *(iTau)));
57  }
58  iL1Jet++;
59  }
60  std::auto_ptr<CaloJetCollection> tauL2jets(new CaloJetCollection);
61 
62  //Loop over the jetSrc to select the proper jets
63 
64  double deltaR = 0.1;
65  double matchingR = 0.01;
66  //Loop over the Map to find which jets has fired the trigger
67  //myL1Tau is the Collection of L1TauCandidates (from 0 to max 4 elements)
68  //get the list of trigger candidates from the HLTL1SeedGT filter
71 
72  iEvent.getByToken(l1ParticlesTau, tauColl);
73  iEvent.getByToken(l1ParticlesJet, jetColl);
74 
75  const L1JetParticleCollection myL1Tau = *(tauColl.product());
76 
77  const L1JetParticleCollection myL1Jet = *(jetColl.product());
78 
80  myL1Obj.reserve(8);
81 
82  for(unsigned int i=0;i<myL1Tau.size();i++)
83  {
84  myL1Obj.push_back(myL1Tau[i]);
85  }
86  for(unsigned int j=0;j<myL1Jet.size();j++)
87  {
88  myL1Obj.push_back(myL1Jet[j]);
89  }
90 
91 
93  if(iEvent.getByToken(tauTrigger,l1TriggeredTaus)){
94 
95 
96  tauCandRefVec.clear();
97  jetCandRefVec.clear();
98 
99  l1TriggeredTaus->getObjects( trigger::TriggerL1TauJet,tauCandRefVec);
100  l1TriggeredTaus->getObjects( trigger::TriggerL1CenJet,jetCandRefVec);
101 
102  for( unsigned int iL1Tau=0; iL1Tau <tauCandRefVec.size();iL1Tau++)
103  {
104  for(unsigned int iJet=0;iJet<myL1Obj.size();iJet++)
105  {
106  //Find the relative L2TauJets, to see if it has been reconstructed
107  std::map<int, const reco::CaloJet>::const_iterator myL2itr = myL2L1JetsMap.find(iJet);
108  if(myL2itr!=myL2L1JetsMap.end()){
109  //Calculate the DeltaR between L1TauCandidate and L1Tau which fired the trigger
110  if(&tauCandRefVec[iL1Tau])
111  deltaR = ROOT::Math::VectorUtil::DeltaR(myL1Obj[iJet].p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
112  if(deltaR < matchingR ) {
113  // Getting back from the map the L2TauJet
114  const CaloJet myL2TauJet = myL2itr->second;
115  if(myL2TauJet.pt() > mEt_Min) tauL2jets->push_back(myL2TauJet);
116  myL2L1JetsMap.erase(myL2itr->first);
117  break;
118 
119  }
120  }
121 
122  }
123  }
124 
125  for(unsigned int iL1Tau=0; iL1Tau <jetCandRefVec.size();iL1Tau++)
126  {
127  for(unsigned int iJet=0;iJet<myL1Obj.size();iJet++)
128  {
129  //Find the relative L2TauJets, to see if it has been reconstructed
130  std::map<int, const reco::CaloJet>::const_iterator myL2itr = myL2L1JetsMap.find(iJet);
131  if(myL2itr!=myL2L1JetsMap.end()){
132  //Calculate the DeltaR between L1TauCandidate and L1Tau which fired the trigger
133  if(&jetCandRefVec[iL1Tau])
134  deltaR = ROOT::Math::VectorUtil::DeltaR(myL1Obj[iJet].p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect());
135  if(deltaR < matchingR) {
136  // Getting back from the map the L2TauJet
137  const CaloJet myL2TauJet = myL2itr->second;
138 
139  if(myL2TauJet.pt() > mEt_Min) tauL2jets->push_back(myL2TauJet);
140  myL2L1JetsMap.erase(myL2itr->first);
141  break;
142 
143  }
144  }
145 
146  }
147  }
148 
149  }
150  // std::cout <<"Size of L2 jets "<<tauL2jets->size()<<std::endl;
151 
152  iEvent.put(tauL2jets);
153 
154 }
int i
Definition: DBlmapReader.cc:9
Jets made from CaloTowers.
Definition: CaloJet.h:29
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
virtual double pt() const
transverse momentum
std::map< int, const reco::CaloJet > myL2L1JetsMap
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
double p4[4]
Definition: TauolaWrapper.h:92
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tauTrigger
int j
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< l1extra::L1JetParticleCollection > l1ParticlesJet
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< edm::EDGetTokenT< reco::CaloJetCollection > > jetSrcToken
std::vector< l1extra::L1JetParticleRef > tauCandRefVec
std::vector< l1extra::L1JetParticleRef > jetCandRefVec
edm::EDGetTokenT< l1extra::L1JetParticleCollection > l1ParticlesTau
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects

Member Data Documentation

std::vector<l1extra::L1JetParticleRef> L2TauJetsProvider::jetCandRefVec
private

Definition at line 31 of file L2TauJetsProvider.h.

vtag L2TauJetsProvider::jetSrc
private

Definition at line 36 of file L2TauJetsProvider.h.

std::vector<edm::EDGetTokenT<reco::CaloJetCollection> > L2TauJetsProvider::jetSrcToken
private

Definition at line 37 of file L2TauJetsProvider.h.

edm::EDGetTokenT<l1extra::L1JetParticleCollection> L2TauJetsProvider::l1ParticlesJet
private

Definition at line 39 of file L2TauJetsProvider.h.

edm::EDGetTokenT<l1extra::L1JetParticleCollection> L2TauJetsProvider::l1ParticlesTau
private

Definition at line 38 of file L2TauJetsProvider.h.

double L2TauJetsProvider::mEt_Min
private

Definition at line 41 of file L2TauJetsProvider.h.

std::map<int, const reco::CaloJet> L2TauJetsProvider::myL2L1JetsMap
private

Definition at line 42 of file L2TauJetsProvider.h.

std::vector<l1extra::L1JetParticleRef> L2TauJetsProvider::objL1CandRefVec
private

Definition at line 32 of file L2TauJetsProvider.h.

l1extra::L1JetParticleRef L2TauJetsProvider::tauCandRef
private

Definition at line 33 of file L2TauJetsProvider.h.

std::vector<l1extra::L1JetParticleRef> L2TauJetsProvider::tauCandRefVec
private

Definition at line 30 of file L2TauJetsProvider.h.

edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> L2TauJetsProvider::tauTrigger
private

Definition at line 40 of file L2TauJetsProvider.h.