test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  :
22  mBX (p.getParameter <int> ("BX" ) ),
23  mVerbose (p.getUntrackedParameter<int> ("verbose" , 0) ),
24  mtowers_token (consumes<CaloTowerCollection> (p.getParameter<InputTag> ("towers" ))),
25  mCone (p.getParameter<double> ("UseTowersInCone" ) ),
26  mTauTrigger_token (consumes<l1t::TauBxCollection> (p.getParameter<InputTag> ("TauTrigger" ))),
27  mEtThreshold (p.getParameter<double> ("minimumEt" ) ),
28  mEThreshold (p.getParameter<double> ("minimumE" ) ),
29  mTauId (p.getParameter<int> ("TauId" ) )
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  if (jetsgen.isValid()){
50  for (auto myL1Jet = jetsgen->begin(mBX); myL1Jet != jetsgen->end(mBX); myL1Jet++){
51  if(idTau == mTauId){
52  double Sum08 = 0.;
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") << "CaloTowerFromL1TCreatorForTauHLT::produce-> " << idx
59  << " tower et/eta/phi/e: " << cal->et() << '/'
60  << cal->eta() << '/'
61  << cal->phi() << '/'
62  << cal->energy()
63  << " is...";
64  }
65  if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold ) {
66  math::PtEtaPhiELorentzVector p( cal->et(), cal->eta(), cal->phi(), cal->energy() );
67  double delta = ROOT::Math::VectorUtil::DeltaR((*myL1Jet).p4().Vect(), p);
68  if(delta < mCone) {
69  isAccepted = true;
70  Sum08 += cal->et();
71  cands->push_back( *cal );
72  }
73  }
74  if (mVerbose == 2){
75  if (isAccepted) edm::LogInfo("JetDebugInfo") << "accepted \n";
76  else edm::LogInfo("JetDebugInfo") << "rejected \n";
77  }
78  }
79  }
80  idTau++;
81  }
82  }
83  else {
84  edm::LogWarning("MissingProduct") << "L1Upgrade jet bx collection not found." << std::endl;
85  }
86 
87  evt.put( cands );
88 
89 }
90 
92 
94 
95  aDesc.add<edm::InputTag>("TauTrigger" , edm::InputTag("caloStage2Digis"))->setComment("L1 Tau collection for seeding" );
96  aDesc.add<edm::InputTag>("towers" , edm::InputTag("towerMaker" ))->setComment("Input tower collection" );
97  aDesc.add<int> ("TauId" , 0 )->setComment("Item from L1 Tau collection used for seeding. From 0 to 11" );
98  aDesc.add<double> ("UseTowersInCone", 0.8 )->setComment("Radius of cone around seed" );
99  aDesc.add<double> ("minimumE" , 0.8 )->setComment("Minimum tower energy" );
100  aDesc.add<double> ("minimumEt" , 0.5 )->setComment("Minimum tower ET" );
101  aDesc.add<int> ("BX" , 0 )->setComment("Set bunch crossing; 0 = in time, -1 = previous, 1 = following");
102  aDesc.addUntracked<int> ("verbose" , 0 )->setComment("Verbosity level; 0=silent" );
103 
104  desc.add ("CaloTowerFromL1TCreatorForTauHLT", aDesc);
105  desc.setComment ("Produce tower collection around L1 particle seed.");
106 
107 }
dbl * delta
Definition: mlp_gen.cc:36
void produce(edm::StreamID sid, edm::Event &evt, const edm::EventSetup &stp) const override
process one event
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
virtual double energy() const final
energy
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
virtual double phi() const final
momentum azimuthal angle
BXVector< Tau > TauBxCollection
Definition: Tau.h:10
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
const edm::EDGetTokenT< l1t::TauBxCollection > mTauTrigger_token
label of tau trigger type analysis
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:75
const double mEtThreshold
imitator of L1 seeds
void setComment(std::string const &value)
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...
void add(std::string const &label, ParameterSetDescription const &psetDescription)
CaloTowerFromL1TCreatorForTauHLT(const edm::ParameterSet &)
constructor from parameter set
mVerbose(fConfig.getUntrackedParameter< bool >("verbose", false))
static void fillDescriptions(edm::ConfigurationDescriptions &desc)
double et(double vtxZ) const
Definition: CaloTower.h:129
virtual double eta() const final
momentum pseudorapidity
const edm::EDGetTokenT< CaloTowerCollection > mtowers_token
label of source collection
const double mCone
use only towers in cone mCone around L1 candidate for regional jet reco