CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L2TauJetsMerger.cc
Go to the documentation of this file.
2 #include "Math/GenVector/VectorUtil.h"
7 //
8 // class decleration
9 //
10 using namespace reco;
11 using namespace std;
12 using namespace edm;
13 using namespace l1extra;
14 
16 {
17  jetSrc = iConfig.getParameter<vtag>("JetSrc");
18  //l1ParticlesTau = iConfig.getParameter<InputTag>("L1ParticlesTau");
19  //l1ParticlesJet = iConfig.getParameter<InputTag>("L1ParticlesJet");
20  //tauTrigger = iConfig.getParameter<InputTag>("L1TauTrigger");
21  mEt_Min = iConfig.getParameter<double>("EtMin");
22 
23  produces<CaloJetCollection>();
24 }
25 
27 
29 {
30 
31  using namespace edm;
32  using namespace std;
33  using namespace reco;
34 
35  //Getting all the L1Seeds
36 
37 
38  //Getting the Collections of L2ReconstructedJets from L1Seeds
39  //and removing the collinear jets
40  myL2L1JetsMap.clear();
41  CaloJetCollection myTmpJets;
42  myTmpJets.clear();
43 
44  int iL1Jet = 0;
45  for( vtag::const_iterator s = jetSrc.begin(); s != jetSrc.end(); ++ s ) {
47  iEvent.getByLabel( * s, tauJets );
48  for(CaloJetCollection::const_iterator iTau = tauJets->begin();iTau !=tauJets->end();iTau++)
49  {
50  //Create a Map to associate to every Jet its L1SeedId, i.e. 0,1,2 or 3
51  if(iTau->et() > mEt_Min) {
52 
53  //Add the Pdg Id here
54  CaloJet myJet = *iTau;
55  myJet.setPdgId(15);
56  myTmpJets.push_back(myJet);
57  }
58  }
59  iL1Jet++;
60  }
61 
62  std::auto_ptr<CaloJetCollection> tauL2jets(new CaloJetCollection);
63 
64  //Removing the collinear jets correctly!
65 
66  //First sort the jets you have merged
68  std::sort(myTmpJets.begin(),myTmpJets.end(),sorter);
69 
70 //Remove Collinear Jets by prefering the highest ones!
71 
72  while(myTmpJets.size()>0) {
73  tauL2jets->push_back(myTmpJets.at(0));
75  for(unsigned int i=1 ;i<myTmpJets.size();++i) {
76  double DR = ROOT::Math::VectorUtil::DeltaR(myTmpJets.at(0).p4(),myTmpJets.at(i).p4());
77  if(DR>0.1)
78  tmp.push_back(myTmpJets.at(i));
79  }
80  myTmpJets.swap(tmp);
81  tmp.clear();
82  }
83 
84 
85  iEvent.put(tauL2jets);
86 
87 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
L2TauJetsMerger(const edm::ParameterSet &)
Jets made from CaloTowers.
Definition: CaloJet.h:29
virtual void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::vector< edm::InputTag > vtag
virtual void setPdgId(int pdgId) GCC11_FINAL
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects