CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L2TauJetsMerger.cc
Go to the documentation of this file.
2 #include "Math/GenVector/VectorUtil.h"
5 //
6 // class decleration
7 //
8 using namespace reco;
9 using namespace std;
10 using namespace edm;
11 
13  : jetSrc(iConfig.getParameter<vtag>("JetSrc")), mEt_Min(iConfig.getParameter<double>("EtMin")) {
14  for (vtag::const_iterator it = jetSrc.begin(); it != jetSrc.end(); ++it) {
15  edm::EDGetTokenT<CaloJetCollection> aToken = consumes<CaloJetCollection>(*it);
16  jetSrc_token.push_back(aToken);
17  }
18 
19  produces<CaloJetCollection>();
20 }
21 
23 
25  using namespace edm;
26  using namespace std;
27  using namespace reco;
28 
29  //Getting the Collections of L2ReconstructedJets from L1Seeds
30  //and removing the collinear jets
31  CaloJetCollection myTmpJets;
32 
33  int iL1Jet = 0;
34  for (vtoken_cjets::const_iterator s = jetSrc_token.begin(); s != jetSrc_token.end(); ++s) {
36  iEvent.getByToken(*s, tauJets);
37  for (CaloJetCollection::const_iterator iTau = tauJets->begin(); iTau != tauJets->end(); ++iTau) {
38  if (iTau->et() > mEt_Min) {
39  //Add the Pdg Id here
40  CaloJet myJet = *iTau;
41  myJet.setPdgId(15);
42  myTmpJets.push_back(myJet);
43  }
44  }
45  iL1Jet++;
46  }
47 
48  std::unique_ptr<CaloJetCollection> tauL2jets(new CaloJetCollection);
49 
50  //Removing the collinear jets correctly!
51 
52  //First sort the jets you have merged
54  std::sort(myTmpJets.begin(), myTmpJets.end(), sorter);
55 
56  //Remove Collinear Jets by prefering the highest ones!
57  while (!myTmpJets.empty()) {
58  tauL2jets->push_back(myTmpJets[0]);
60  for (unsigned int i = 1; i < myTmpJets.size(); ++i) {
61  double DR = ROOT::Math::VectorUtil::DeltaR(myTmpJets[0].p4(), myTmpJets[i].p4());
62  if (DR > 0.1)
63  tmp.push_back(myTmpJets[i]);
64  }
65  myTmpJets.swap(tmp);
66  }
67 
68  iEvent.put(std::move(tauL2jets));
69 }
70 
73  std::vector<edm::InputTag> inputTags;
74  inputTags.push_back(edm::InputTag("hltAkIsoTau1Regional"));
75  inputTags.push_back(edm::InputTag("hltAkIsoTau2Regional"));
76  inputTags.push_back(edm::InputTag("hltAkIsoTau3Regional"));
77  inputTags.push_back(edm::InputTag("hltAkIsoTau4Regional"));
78  desc.add<std::vector<edm::InputTag> >("JetSrc", inputTags)->setComment("CaloJet collections to merge");
79  desc.add<double>("EtMin", 20.0)->setComment("Minimal ET of jet to merge");
80  descriptions.setComment("Merges CaloJet collections removing duplicates");
81  descriptions.add("L2TauJetsMerger", desc);
82 }
void setComment(std::string const &value)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
L2TauJetsMerger(const edm::ParameterSet &)
Jets made from CaloTowers.
Definition: CaloJet.h:27
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
~L2TauJetsMerger() override
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
vtoken_cjets jetSrc_token
const vtag jetSrc
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void setComment(std::string const &value)
const double mEt_Min
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< edm::InputTag > vtag
tmp
align.sh
Definition: createJobs.py:716
void setPdgId(int pdgId) final
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects