CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
11 // Math
12 #include "Math/GenVector/VectorUtil.h"
13 #include <cmath>
14 
15 using namespace edm;
16 using namespace reco;
17 using namespace std;
18 using namespace l1extra ;
19 
21  :
22  mVerbose (p.getUntrackedParameter<int> ("verbose", 0)),
23  mCone (p.getParameter<double> ("UseTowersInCone")),
24  mEtThreshold (p.getParameter<double> ("minimumEt")),
25  mEThreshold (p.getParameter<double> ("minimumE")),
26  mTauId (p.getParameter<int> ("TauId"))
27 {
28  mtowers_token = consumes<CaloTowerCollection>(p.getParameter<InputTag>("towers") );
29  mTauTrigger_token = consumes<L1JetParticleCollection>(p.getParameter<InputTag>("TauTrigger") );
30 
31  produces<CaloTowerCollection>();
32 }
33 
35 }
36 
39  evt.getByToken( mtowers_token, caloTowers );
40 
41  // imitate L1 seeds
43  evt.getByToken( mTauTrigger_token, jetsgen);
44 
45  std::auto_ptr<CaloTowerCollection> cands( new CaloTowerCollection );
46  cands->reserve( caloTowers->size() );
47 
48  int idTau =0;
49  L1JetParticleCollection::const_iterator myL1Jet = jetsgen->begin();
50  for(;myL1Jet != jetsgen->end();myL1Jet++)
51  {
52  if(idTau == mTauId)
53  {
54  double Sum08 = 0.;
55 
56  unsigned idx = 0;
57  for (; idx < caloTowers->size(); idx++) {
58  const CaloTower* cal = &((*caloTowers) [idx]);
59  if (mVerbose == 2) {
60  std::cout << "CaloTowerCreatorForTauHLT::produce-> " << idx << " tower et/eta/phi/e: "
61  << cal->et() << '/' << cal->eta() << '/' << cal->phi() << '/' << cal->energy() << " is...";
62  }
63  if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold ) {
64  math::PtEtaPhiELorentzVector p( cal->et(), cal->eta(), cal->phi(), cal->energy() );
65  double delta = ROOT::Math::VectorUtil::DeltaR((*myL1Jet).p4().Vect(), p);
66 
67  if(delta < mCone) {
68  Sum08 += cal->et();
69  cands->push_back( *cal );
70  }
71  }
72  else {
73  if (mVerbose == 2) std::cout << "rejected " << std::endl;
74  }
75  }
76 
77  }
78  idTau++;
79  }
80 
81  evt.put( cands );
82 
83 }
dbl * delta
Definition: mlp_gen.cc:36
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< l1extra::L1JetParticleCollection > mTauTrigger_token
label of tau trigger type analysis
virtual float phi() const
momentum azimuthal angle
double mEtThreshold
imitator of L1 seeds
virtual double energy() const
energy
double mCone
use only towers in cone mCone around L1 candidate for regional jet reco
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
virtual float eta() const
momentum pseudorapidity
void produce(edm::Event &e, const edm::EventSetup &) override
process one event
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
CaloTowerCreatorForTauHLT(const edm::ParameterSet &)
constructor from parameter set
tuple cout
Definition: gather_cfg.py:121
double et(double vtxZ) const
Definition: CaloTower.h:116
edm::EDGetTokenT< CaloTowerCollection > mtowers_token
label of source collection