CMS 3D CMS Logo

L1TCaloRCTToUpgradeConverter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1Trigger/L1TCalorimeter
4 // Class: L1TCaloRCTToUpgradeConverter
5 //
13 //
14 // Original Author: James Brooke
15 // Created: Thu, 05 Dec 2013 17:39:27 GMT
16 //
17 //
29 
33 
35 
38 
40 
41 #include <vector>
42 
43 namespace l1t {
44 
46  public:
48 
49  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
50 
51  private:
52  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
53 
54  // ----------member data ---------------------------
55 
58 
61  };
62 
63 } // namespace l1t
64 
65 using namespace l1t;
66 
68  : rgnToken_{consumes<L1CaloRegionCollection>(ps.getParameter<edm::InputTag>("regionTag"))},
69  emToken_{consumes<L1CaloEmCollection>(ps.getParameter<edm::InputTag>("emTag"))},
70  rgnPutToken_{produces<CaloRegionBxCollection>()},
71  emPutToken_{produces<CaloEmCandBxCollection>()} {}
72 
73 // ------------ method called to produce the data ------------
75  // check status of RCT conditions & renew if needed
76 
77  // store new formats
78  BXVector<CaloEmCand> emcands;
80 
81  // get old formats
82  auto const& ems = iEvent.get(emToken_);
83  auto const& rgns = iEvent.get(rgnToken_);
84 
85  // get the firstBx_ and lastBx_ from the input datatypes (assume bx for em same as rgn)
86  int firstBx = 0;
87  int lastBx = 0;
88  for (auto const& em : ems) {
89  int bx = em.bx();
90  if (bx < firstBx)
91  firstBx = bx;
92  if (bx > lastBx)
93  lastBx = bx;
94  }
95 
96  emcands.setBXRange(firstBx, lastBx);
97  regions.setBXRange(firstBx, lastBx);
98 
99  const ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > p4(0, 0, 0, 0);
100 
101  // loop over EM
102  for (auto const& em : ems) {
103  // get physical units
104  // double pt = 0.;
105  // double eta = 0.;
106  // double phi = 0.;
107  //math::PtEtaPhiMLorentzVector p4( pt+1.e-6, eta, phi, 0. );
108 
109  //CaloStage1Cluster cluster;
110  CaloEmCand EmCand(p4, (int)em.rank(), (int)em.regionId().ieta(), (int)em.regionId().iphi(), (int)em.index());
111 
112  EmCand.setHwIso((int)em.isolated());
113  //std::cout<<"ISO: "<<EmCand.hwIso()<<" "<<em.isolated()<<std::endl;
114 
115  // create new format
116  emcands.push_back(em.bx(), EmCand);
117  }
118 
119  // loop over regions
120  for (auto const& rgn : rgns) {
121  // get physical units
122  // double pt = 0.;
123  // double eta = 0.;
124  // double phi = 0.;
125  //math::PtEtaPhiMLorentzVector p4( pt+1.e-6, eta, phi, 0 );
126 
127  bool tauVeto = rgn.fineGrain(); //equivalent to tauVeto for HB/HE, includes extra info for HF
128  int hwQual = (int)tauVeto;
129 
130  // create new format
131  // several values here are stage 2 only, leave empty
132  CaloRegion region(p4, // LorentzVector& p4,
133  0., // etEm,
134  0., // etHad,
135  (int)rgn.et(), // pt,
136  (int)rgn.id().ieta(), // eta,
137  (int)rgn.id().iphi(), // phi,
138  hwQual, // qual,
139  0, // hwEtEm,
140  0); // hwEtHad
141 
142  // add to output
143  regions.push_back(rgn.bx(), region);
144  }
145 
146  iEvent.emplace(emPutToken_, std::move(emcands));
148 }
149 
150 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
153  desc.add<edm::InputTag>("regionTag");
154  desc.add<edm::InputTag>("emTag");
155  descriptions.addDefault(desc);
156 }
157 
158 //define this as a plug-in
edm::StreamID
Definition: StreamID.h:30
l1t::L1TCaloRCTToUpgradeConverter::rgnToken_
const edm::EDGetTokenT< L1CaloRegionCollection > rgnToken_
Definition: L1TCaloRCTToUpgradeConverter.cc:56
L1CaloEmCand.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
BXVector.h
ESHandle.h
edm::EDGetTokenT< L1CaloRegionCollection >
edm::EDPutTokenT
Definition: EDPutToken.h:33
l1t::L1TCaloRCTToUpgradeConverter::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: L1TCaloRCTToUpgradeConverter.cc:74
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
l1t::L1TCaloRCTToUpgradeConverter::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: L1TCaloRCTToUpgradeConverter.cc:151
l1t::L1TCaloRCTToUpgradeConverter::L1TCaloRCTToUpgradeConverter
L1TCaloRCTToUpgradeConverter(const edm::ParameterSet &ps)
Definition: L1TCaloRCTToUpgradeConverter.cc:67
l1t::L1TCaloRCTToUpgradeConverter::emPutToken_
const edm::EDPutTokenT< CaloEmCandBxCollection > emPutToken_
Definition: L1TCaloRCTToUpgradeConverter.cc:60
BXVector
Definition: BXVector.h:15
MakerMacros.h
CaloRegion.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EDGetToken.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
l1t
delete x;
Definition: CaloConfig.h:22
EDPutToken.h
LorentzVector.h
createfilelist.int
int
Definition: createfilelist.py:10
L1CaloCollections.h
iEvent
int iEvent
Definition: GenABIO.cc:224
p4
double p4[4]
Definition: TauolaWrapper.h:92
l1t::L1TCaloRCTToUpgradeConverter
Definition: L1TCaloRCTToUpgradeConverter.cc:45
edm::EventSetup
Definition: EventSetup.h:57
InputTag.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
CaloEmCand.h
Frameworkfwd.h
l1t::CaloRegion
Definition: CaloRegion.h:9
l1t::L1Candidate::setHwIso
void setHwIso(int iso)
Definition: L1Candidate.h:32
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
EventSetup.h
l1t::L1TCaloRCTToUpgradeConverter::emToken_
const edm::EDGetTokenT< L1CaloEmCollection > emToken_
Definition: L1TCaloRCTToUpgradeConverter.cc:57
AlignmentPI::regions
regions
Definition: AlignmentPayloadInspectorHelper.h:76
ParameterSet.h
EDProducer.h
l1t::L1TCaloRCTToUpgradeConverter::rgnPutToken_
const edm::EDPutTokenT< CaloRegionBxCollection > rgnPutToken_
Definition: L1TCaloRCTToUpgradeConverter.cc:59
BXVector::setBXRange
void setBXRange(int bxFirst, int bxLast)
edm::Event
Definition: Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
BXVector::push_back
void push_back(int bx, T object)
edm::InputTag
Definition: InputTag.h:15
L1CaloRegion.h
l1t::CaloEmCand
Definition: CaloEmCand.h:8