CMS 3D CMS Logo

CaloTowerFromL1TCreatorForTauHLT.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 
21  : mBX(p.getParameter<int>("BX")),
22  mVerbose(p.getUntrackedParameter<int>("verbose", 0)),
23  mtowers_token(consumes<CaloTowerCollection>(p.getParameter<InputTag>("towers"))),
24  mCone(p.getParameter<double>("UseTowersInCone")),
25  mTauTrigger_token(consumes<l1t::TauBxCollection>(p.getParameter<InputTag>("TauTrigger"))),
26  mEtThreshold(p.getParameter<double>("minimumEt")),
27  mEThreshold(p.getParameter<double>("minimumE")),
28  mTauId(p.getParameter<int>("TauId")) {
29  produces<CaloTowerCollection>();
30 }
31 
33 
37 
38  // imitate L1 seeds
40  evt.getByToken(mTauTrigger_token, jetsgen);
41 
42  std::unique_ptr<CaloTowerCollection> cands(new CaloTowerCollection);
43  cands->reserve(caloTowers->size());
44 
45  int idTau = 0;
46  if (jetsgen.isValid()) {
47  for (auto myL1Jet = jetsgen->begin(mBX); myL1Jet != jetsgen->end(mBX); myL1Jet++) {
48  if (idTau == mTauId) {
49  unsigned idx = 0;
50  for (; idx < caloTowers->size(); idx++) {
51  const CaloTower* cal = &((*caloTowers)[idx]);
52  bool isAccepted = false;
53  if (mVerbose == 2) {
54  edm::LogInfo("JetDebugInfo") << "CaloTowerFromL1TCreatorForTauHLT::produce-> " << idx
55  << " tower et/eta/phi/e: " << cal->et() << '/' << cal->eta() << '/'
56  << cal->phi() << '/' << cal->energy() << " is...";
57  }
58  if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold) {
59  math::PtEtaPhiELorentzVector p(cal->et(), cal->eta(), cal->phi(), cal->energy());
60  double delta = ROOT::Math::VectorUtil::DeltaR((*myL1Jet).p4().Vect(), p);
61  if (delta < mCone) {
62  isAccepted = true;
63  cands->push_back(*cal);
64  }
65  }
66  if (mVerbose == 2) {
67  if (isAccepted)
68  edm::LogInfo("JetDebugInfo") << "accepted \n";
69  else
70  edm::LogInfo("JetDebugInfo") << "rejected \n";
71  }
72  }
73  }
74  idTau++;
75  }
76  } else {
77  edm::LogWarning("MissingProduct") << "L1Upgrade jet bx collection not found." << std::endl;
78  }
79 
80  evt.put(std::move(cands));
81 }
82 
85 
86  aDesc.add<edm::InputTag>("TauTrigger", edm::InputTag("caloStage2Digis"))->setComment("L1 Tau collection for seeding");
87  aDesc.add<edm::InputTag>("towers", edm::InputTag("towerMaker"))->setComment("Input tower collection");
88  aDesc.add<int>("TauId", 0)->setComment("Item from L1 Tau collection used for seeding. From 0 to 11");
89  aDesc.add<double>("UseTowersInCone", 0.8)->setComment("Radius of cone around seed");
90  aDesc.add<double>("minimumE", 0.8)->setComment("Minimum tower energy");
91  aDesc.add<double>("minimumEt", 0.5)->setComment("Minimum tower ET");
92  aDesc.add<int>("BX", 0)->setComment("Set bunch crossing; 0 = in time, -1 = previous, 1 = following");
93  aDesc.addUntracked<int>("verbose", 0)->setComment("Verbosity level; 0=silent");
94 
95  desc.add("CaloTowerFromL1TCreatorForTauHLT", aDesc);
96  desc.setComment("Produce tower collection around L1 particle seed.");
97 }
98 
void setComment(std::string const &value)
void produce(edm::StreamID sid, edm::Event &evt, const edm::EventSetup &stp) const override
process one event
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:540
delete x;
Definition: CaloConfig.h:22
BXVector< Tau > TauBxCollection
Definition: Tau.h:10
const_iterator begin(int bx) const
double et(double vtxZ) const
Definition: CaloTower.h:150
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::EDGetTokenT< l1t::TauBxCollection > mTauTrigger_token
label of tau trigger type analysis
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const double mEtThreshold
imitator of L1 seeds
Log< level::Info, false > LogInfo
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
CaloTowerFromL1TCreatorForTauHLT(const edm::ParameterSet &)
constructor from parameter set
bool isValid() const
Definition: HandleBase.h:70
const_iterator end(int bx) const
fixed size matrix
HLT enums.
static void fillDescriptions(edm::ConfigurationDescriptions &desc)
Log< level::Warning, false > LogWarning
const edm::EDGetTokenT< CaloTowerCollection > mtowers_token
label of source collection
double phi() const final
momentum azimuthal angle
const double mCone
use only towers in cone mCone around L1 candidate for regional jet reco
def move(src, dest)
Definition: eostools.py:511
double energy() const final
energy
double eta() const final
momentum pseudorapidity