CMS 3D CMS Logo

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 }
L2TauJetsMerger::SorterByPt
Definition: L2TauJetsMerger.h:33
reco::LeafCandidate::setPdgId
void setPdgId(int pdgId) final
Definition: LeafCandidate.h:178
edm::StreamID
Definition: StreamID.h:30
reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
mps_fire.i
i
Definition: mps_fire.py:428
L2TauJetsMerger.h
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TriggerTypeDefs.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::Handle
Definition: AssociativeIterator.h:50
EDMException.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HLTMuonOfflineAnalyzer_cfi.inputTags
inputTags
All input tags are specified in this pset for convenience.
Definition: HLTMuonOfflineAnalyzer_cfi.py:82
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
L2TauJetsMerger::mEt_Min
const double mEt_Min
Definition: L2TauJetsMerger.h:31
edm::ParameterSet
Definition: ParameterSet.h:47
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
edm::ConfigurationDescriptions::setComment
void setComment(std::string const &value)
Definition: ConfigurationDescriptions.cc:48
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::CaloJetCollection
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Definition: CaloJetCollection.h:15
p4
double p4[4]
Definition: TauolaWrapper.h:92
edm::EventSetup
Definition: EventSetup.h:58
L2TauJetsMerger::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: L2TauJetsMerger.cc:71
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
L2TauJetsMerger::L2TauJetsMerger
L2TauJetsMerger(const edm::ParameterSet &)
Definition: L2TauJetsMerger.cc:12
MCScenario_CRAFT1_22X.sorter
def sorter(a, b)
Definition: MCScenario_CRAFT1_22X.py:97
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
L2TauJetsMerger::jetSrc_token
vtoken_cjets jetSrc_token
Definition: L2TauJetsMerger.h:30
L2TauJetsMerger::vtag
std::vector< edm::InputTag > vtag
Definition: L2TauJetsMerger.h:27
L2TauJetsMerger::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: L2TauJetsMerger.cc:24
edm::Event
Definition: Event.h:73
DisplacedJet_Monitor_cff.jetSrc
jetSrc
Definition: DisplacedJet_Monitor_cff.py:79
L2TauJetsMerger::jetSrc
const vtag jetSrc
Definition: L2TauJetsMerger.h:29
edm::InputTag
Definition: InputTag.h:15
L2TauJetsMerger::~L2TauJetsMerger
~L2TauJetsMerger() override
Definition: L2TauJetsMerger.cc:22