CMS 3D CMS Logo

CaloTowerCreatorForTauHLT.cc
Go to the documentation of this file.
1 // makes CaloTowerCandidates from CaloTowers
2 // original author: L.Lista INFN, modifyed by: F.Ratnikov UMd
3 // Author for regionality A. Nikitenko
4 // Modified by S. Gennai
5 
12 // Math
13 #include "Math/GenVector/VectorUtil.h"
14 #include <cmath>
15 
16 using namespace edm;
17 using namespace reco;
18 using namespace std;
19 using namespace l1extra;
20 
22  : mVerbose(p.getUntrackedParameter<int>("verbose", 0)),
23  mtowers_token(consumes<CaloTowerCollection>(p.getParameter<InputTag>("towers"))),
24  mCone(p.getParameter<double>("UseTowersInCone")),
25  mCone2(mCone * mCone),
26  mTauTrigger_token(consumes<L1JetParticleCollection>(p.getParameter<InputTag>("TauTrigger"))),
27  mEtThreshold(p.getParameter<double>("minimumEt")),
28  mEThreshold(p.getParameter<double>("minimumE")),
29  mTauId(p.getParameter<int>("TauId")) {
30  produces<CaloTowerCollection>();
31 }
32 
36 
37  // imitate L1 seeds
39  evt.getByToken(mTauTrigger_token, jetsgen);
40 
41  std::unique_ptr<CaloTowerCollection> cands(new CaloTowerCollection);
42  cands->reserve(caloTowers->size());
43 
44  if (mCone < 0.) {
45  evt.put(std::move(cands));
46  return;
47  }
48 
49  int idTau = 0;
50  L1JetParticleCollection::const_iterator myL1Jet = jetsgen->begin();
51  for (; myL1Jet != jetsgen->end(); myL1Jet++) {
52  if (idTau == mTauId) {
53  unsigned idx = 0;
54  for (; idx < caloTowers->size(); idx++) {
55  const CaloTower* cal = &((*caloTowers)[idx]);
56  bool isAccepted = false;
57  if (mVerbose == 2) {
58  edm::LogInfo("JetDebugInfo") << "CaloTowerCreatorForTauHLT::produce-> " << idx
59  << " tower et/eta/phi/e: " << cal->et() << '/' << cal->eta() << '/' << cal->phi()
60  << '/' << cal->energy() << " is...";
61  }
62  if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold) {
63  math::PtEtaPhiELorentzVector p(cal->et(), cal->eta(), cal->phi(), cal->energy());
64  double delta2 = ROOT::Math::VectorUtil::DeltaR2((*myL1Jet).p4().Vect(), p);
65 
66  if (delta2 < mCone2) {
67  isAccepted = true;
68  cands->push_back(*cal);
69  }
70  }
71  if (mVerbose == 2) {
72  if (isAccepted)
73  edm::LogInfo("JetDebugInfo") << "accepted \n";
74  else
75  edm::LogInfo("JetDebugInfo") << "rejected \n";
76  }
77  }
78  }
79  idTau++;
80  }
81 
82  evt.put(std::move(cands));
83 }
84 
87  aDesc.add<edm::InputTag>("TauTrigger", edm::InputTag("l1extraParticles", "Tau"))
88  ->setComment("L1ExtraJet collection for seeding");
89  aDesc.add<int>("TauId", 0)->setComment("Item from L1ExtraJet collection used for seeding");
90  aDesc.add<edm::InputTag>("towers", edm::InputTag("towerMaker"))->setComment("Input tower collection");
91  aDesc.add<double>("UseTowersInCone", 0.8)->setComment("Radius of cone around seed");
92  aDesc.add<double>("minimumE", 0.8)->setComment("Minimum tower energy");
93  aDesc.add<double>("minimumEt", 0.5)->setComment("Minimum tower ET");
94  aDesc.addUntracked<int>("verbose", 0)->setComment("Verbosity level; 0=silent");
95  desc.setComment("Produce tower collection around L1ExtraJetParticle seed.");
96  desc.add("caloTowerMakerHLT", aDesc);
97 }
98 
void setComment(std::string const &value)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
const double mCone
use only towers in cone mCone around L1 candidate for regional jet reco
double et(double vtxZ) const
Definition: CaloTower.h:150
void produce(edm::StreamID sid, edm::Event &evt, const edm::EventSetup &stp) const override
process one event
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< l1extra::L1JetParticleCollection > mTauTrigger_token
label of tau trigger type analysis
Log< level::Info, false > LogInfo
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
fixed size matrix
HLT enums.
const edm::EDGetTokenT< CaloTowerCollection > mtowers_token
label of source collection
CaloTowerCreatorForTauHLT(const edm::ParameterSet &)
constructor from parameter set
const double mEThreshold
E threshold.
const double mEtThreshold
ET threshold.
double phi() const final
momentum azimuthal angle
def move(src, dest)
Definition: eostools.py:511
static void fillDescriptions(edm::ConfigurationDescriptions &desc)
double energy() const final
energy
double eta() const final
momentum pseudorapidity