CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
l1t::L1ComparatorRun2 Class Reference

#include <L1ComparatorRun2.h>

Inheritance diagram for l1t::L1ComparatorRun2:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1ComparatorRun2 (const edm::ParameterSet &ps)
 
 ~L1ComparatorRun2 () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector
< edm::ProductResolverIndex >
const & 
indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector
< edm::ProductResolverIndex >
const & 
putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void produce (edm::Event &, edm::EventSetup const &) override
 

Private Attributes

int bxMax_
 
int bxMin_
 
edm::EDGetToken CaloTowerDataToken_
 
edm::EDGetToken CaloTowerEmulToken_
 
bool doLayer1_
 
bool doLayer2_
 
edm::EDGetToken EGammaDataToken_
 
edm::EDGetToken EGammaEmulToken_
 
edm::EDGetToken EtSumDataToken_
 
edm::EDGetToken EtSumEmulToken_
 
edm::EDGetToken JetDataToken_
 
edm::EDGetToken JetEmulToken_
 
edm::EDGetToken TauDataToken_
 
edm::EDGetToken TauEmulToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 40 of file L1ComparatorRun2.h.

Constructor & Destructor Documentation

L1ComparatorRun2::L1ComparatorRun2 ( const edm::ParameterSet ps)
explicit

Definition at line 7 of file L1ComparatorRun2.cc.

References edm::ParameterSet::getParameter().

7  {
8  produces<L1DataEmulResultBxCollection>();
9 
10  JetDataToken_ = consumes<JetBxCollection>(ps.getParameter<InputTag>("JetData"));
11  JetEmulToken_ = consumes<JetBxCollection>(ps.getParameter<InputTag>("JetEmul"));
12  EGammaDataToken_ = consumes<EGammaBxCollection>(ps.getParameter<InputTag>("EGammaData"));
13  EGammaEmulToken_ = consumes<EGammaBxCollection>(ps.getParameter<InputTag>("EGammaEmul"));
14  TauDataToken_ = consumes<TauBxCollection>(ps.getParameter<InputTag>("TauData"));
15  TauEmulToken_ = consumes<TauBxCollection>(ps.getParameter<InputTag>("TauEmul"));
16  EtSumDataToken_ = consumes<EtSumBxCollection>(ps.getParameter<InputTag>("EtSumData"));
17  EtSumEmulToken_ = consumes<EtSumBxCollection>(ps.getParameter<InputTag>("EtSumEmul"));
18  CaloTowerDataToken_ = consumes<CaloTowerBxCollection>(ps.getParameter<InputTag>("CaloTowerData"));
19  CaloTowerEmulToken_ = consumes<CaloTowerBxCollection>(ps.getParameter<InputTag>("CaloTowerEmul"));
20  bxMax_ = ps.getParameter<int>("bxMax");
21  bxMin_ = ps.getParameter<int>("bxMin");
22  doLayer2_ = ps.getParameter<bool>("doLayer2");
23  doLayer1_ = ps.getParameter<bool>("doLayer1");
24 }
edm::EDGetToken JetDataToken_
edm::EDGetToken TauDataToken_
edm::EDGetToken CaloTowerDataToken_
edm::EDGetToken EtSumEmulToken_
edm::EDGetToken JetEmulToken_
edm::EDGetToken TauEmulToken_
edm::EDGetToken EGammaDataToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetToken EGammaEmulToken_
edm::EDGetToken CaloTowerEmulToken_
edm::EDGetToken EtSumDataToken_
L1ComparatorRun2::~L1ComparatorRun2 ( )
override

Definition at line 26 of file L1ComparatorRun2.cc.

26 {}

Member Function Documentation

void L1ComparatorRun2::produce ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 28 of file L1ComparatorRun2.cc.

References makePileupJSON::bx, HLT_FULL_cff::distance, edm::Event::getByToken(), good, eostools::move(), edm::Event::put(), mps_fire::result, and findQualityFiles::size.

28  {
29  unique_ptr<L1DataEmulResultBxCollection> RESULT(new L1DataEmulResultBxCollection);
30 
31  if (doLayer2_) {
32  for (int bx = bxMin_; bx <= bxMax_; bx++) {
33  Handle<JetBxCollection> jet_data;
34  Handle<JetBxCollection> jet_emul;
35 
36  iEvent.getByToken(JetDataToken_, jet_data);
37  iEvent.getByToken(JetEmulToken_, jet_emul);
38 
39  int size = (jet_data->size(bx) > jet_emul->size(bx)) ? jet_data->size(bx) : jet_emul->size(bx);
40 
41  int dataonly = size - jet_emul->size(bx);
42  int emulonly = size - jet_data->size(bx);
43 
44  int ptgood = 0;
45  int locgood = 0;
46  int good = 0;
47  int compared = 0;
48 
49  for (JetBxCollection::const_iterator itd = jet_data->begin(bx); itd != jet_data->end(bx); itd++) {
50  for (JetBxCollection::const_iterator ite = jet_emul->begin(bx); ite != jet_emul->end(bx); ite++) {
51  if (distance(jet_data->begin(bx), itd) == distance(jet_emul->begin(bx), ite)) {
52  compared += 1;
53  if (itd->hwPt() == ite->hwPt())
54  ptgood += 1;
55  if (itd->hwEta() == ite->hwEta() && itd->hwPhi() == ite->hwPhi())
56  locgood += 1;
57  if (itd->hwPt() == ite->hwPt() && itd->hwEta() == ite->hwEta() && itd->hwPhi() == ite->hwPhi())
58  good += 1;
59  }
60  }
61  }
62 
63  int ptbad = compared - ptgood;
64  int locbad = compared - locgood;
65  int bad = size - good;
66 
67  bool flag = (bad == 0) ? true : false;
68 
69  L1DataEmulResult result(flag, ptbad, locbad, bad, dataonly, emulonly, 0, 0, "JetBxCollection");
70 
71  RESULT->push_back(bx, result);
72  }
73  }
74 
77 
78  iEvent.getByToken(EGammaDataToken_, eg_data);
79  iEvent.getByToken(EGammaEmulToken_, eg_emul);
80 
81  if (doLayer2_) {
82  for (int bx = bxMin_; bx <= bxMax_; bx++) {
83  int size = (eg_data->size(bx) > eg_emul->size(bx)) ? eg_data->size(bx) : eg_emul->size(bx);
84 
85  int dataonly = size - eg_emul->size(bx);
86  int emulonly = size - eg_data->size(bx);
87 
88  int ptgood = 0;
89  int locgood = 0;
90  int good = 0;
91  int compared = 0;
92 
93  for (EGammaBxCollection::const_iterator itd = eg_data->begin(bx); itd != eg_data->end(bx); itd++) {
94  for (EGammaBxCollection::const_iterator ite = eg_emul->begin(bx); ite != eg_emul->end(bx); ite++) {
95  if (distance(eg_data->begin(bx), itd) == distance(eg_emul->begin(bx), ite)) {
96  compared += 1;
97  if (itd->hwPt() == ite->hwPt())
98  ptgood += 1;
99  if (itd->hwEta() == ite->hwEta() && itd->hwPhi() == ite->hwPhi())
100  locgood += 1;
101  if (itd->hwPt() == ite->hwPt() && itd->hwEta() == ite->hwEta() && itd->hwPhi() == ite->hwPhi() &&
102  itd->hwIso() == ite->hwIso())
103  good += 1;
104  }
105  }
106  }
107 
108  int ptbad = compared - ptgood;
109  int locbad = compared - locgood;
110  int bad = size - good;
111 
112  bool flag = (bad == 0) ? true : false;
113 
114  L1DataEmulResult result(flag, ptbad, locbad, bad, dataonly, emulonly, 0, 0, "EGammaBxCollection");
115 
116  RESULT->push_back(bx, result);
117  }
118  }
119 
120  Handle<TauBxCollection> tau_data;
121  Handle<TauBxCollection> tau_emul;
122 
123  iEvent.getByToken(TauDataToken_, tau_data);
124  iEvent.getByToken(TauEmulToken_, tau_emul);
125 
126  if (doLayer2_) {
127  for (int bx = bxMin_; bx <= bxMax_; bx++) {
128  int size = (tau_data->size(bx) > tau_emul->size(bx)) ? tau_data->size(bx) : tau_emul->size(bx);
129 
130  int dataonly = size - tau_emul->size(bx);
131  int emulonly = size - tau_data->size(bx);
132 
133  int ptgood = 0;
134  int locgood = 0;
135  int good = 0;
136  int compared = 0;
137 
138  for (TauBxCollection::const_iterator itd = tau_data->begin(bx); itd != tau_data->end(bx); itd++) {
139  for (TauBxCollection::const_iterator ite = tau_emul->begin(bx); ite != tau_emul->end(bx); ite++) {
140  if (distance(tau_data->begin(bx), itd) == distance(tau_emul->begin(bx), ite)) {
141  compared += 1;
142  if (itd->hwPt() == ite->hwPt())
143  ptgood += 1;
144  if (itd->hwEta() == ite->hwEta() && itd->hwPhi() == ite->hwPhi())
145  locgood += 1;
146  if (itd->hwPt() == ite->hwPt() && itd->hwEta() == ite->hwEta() && itd->hwPhi() == ite->hwPhi() &&
147  itd->hwIso() == ite->hwIso())
148  good += 1;
149  }
150  }
151  }
152 
153  int ptbad = compared - ptgood;
154  int locbad = compared - locgood;
155  int bad = size - good;
156 
157  bool flag = (bad == 0) ? true : false;
158 
159  L1DataEmulResult result(flag, ptbad, locbad, bad, dataonly, emulonly, 0, 0, "TauBxCollection");
160 
161  RESULT->push_back(bx, result);
162  }
163  }
164 
167 
168  iEvent.getByToken(EtSumDataToken_, et_data);
169  iEvent.getByToken(EtSumEmulToken_, et_emul);
170 
171  if (doLayer2_) {
172  for (int bx = bxMin_; bx <= bxMax_; bx++) {
173  int size = (et_data->size(bx) > et_emul->size(bx)) ? et_data->size(bx) : et_emul->size(bx);
174 
175  int dataonly = size - et_emul->size(bx);
176  int emulonly = size - et_data->size(bx);
177 
178  int ptgood = 0;
179  int locgood = 0;
180  int good = 0;
181  int compared = 0;
182 
183  for (EtSumBxCollection::const_iterator itd = et_data->begin(bx); itd != et_data->end(bx); itd++) {
184  for (EtSumBxCollection::const_iterator ite = et_emul->begin(bx); ite != et_emul->end(bx); ite++) {
185  if (distance(et_data->begin(bx), itd) == distance(et_emul->begin(bx), ite)) {
186  compared += 1;
187  if (itd->hwPt() == ite->hwPt())
188  ptgood += 1;
189  if (itd->hwEta() == ite->hwEta() && itd->hwPhi() == ite->hwPhi())
190  locgood += 1;
191  if (itd->hwPt() == ite->hwPt() && itd->hwEta() == ite->hwEta() && itd->hwPhi() == ite->hwPhi() &&
192  itd->getType() == ite->getType())
193  good += 1;
194  }
195  }
196  }
197 
198  int ptbad = compared - ptgood;
199  int locbad = compared - locgood;
200  int bad = size - good;
201 
202  bool flag = (bad == 0) ? true : false;
203 
204  L1DataEmulResult result(flag, ptbad, locbad, bad, dataonly, emulonly, 0, 0, "EtSumBxCollection");
205 
206  RESULT->push_back(bx, result);
207  }
208  }
209 
212 
213  iEvent.getByToken(CaloTowerDataToken_, tower_data);
214  iEvent.getByToken(CaloTowerEmulToken_, tower_emul);
215 
216  if (doLayer1_) {
217  for (int bx = bxMin_; bx <= bxMax_; bx++) {
218  int size = (tower_data->size(bx) > tower_emul->size(bx)) ? tower_data->size(bx) : tower_emul->size(bx);
219 
220  int dataonly = size - tower_emul->size(bx);
221  int emulonly = size - tower_data->size(bx);
222 
223  int ptgood = 0;
224  int locgood = 0;
225  int good = 0;
226  int compared = 0;
227  int hcalgood = 0;
228  int ecalgood = 0;
229 
230  for (CaloTowerBxCollection::const_iterator itd = tower_data->begin(bx); itd != tower_data->end(bx); itd++) {
231  for (CaloTowerBxCollection::const_iterator ite = tower_emul->begin(bx); ite != tower_emul->end(bx); ite++) {
232  if (distance(tower_data->begin(bx), itd) == distance(tower_emul->begin(bx), ite)) {
233  compared += 1;
234  if (itd->hwPt() == ite->hwPt())
235  ptgood += 1;
236  if (itd->hwEta() == ite->hwEta() && itd->hwPhi() == ite->hwPhi())
237  locgood += 1;
238  if (itd->hwEtHad() == ite->hwEtHad())
239  hcalgood += 1;
240  if (itd->hwEtEm() == ite->hwEtEm())
241  ecalgood += 1;
242  if (itd->hwPt() == ite->hwPt() && itd->hwEta() == ite->hwEta() && itd->hwPhi() == ite->hwPhi() &&
243  itd->hwEtEm() == ite->hwEtEm() && itd->hwEtHad() == ite->hwEtHad())
244  good += 1;
245  }
246  }
247  }
248 
249  int ptbad = compared - ptgood;
250  int locbad = compared - locgood;
251  int bad = size - good;
252  int hcalbad = compared - hcalgood;
253  int ecalbad = compared - ecalgood;
254 
255  bool flag = (bad == 0) ? true : false;
256 
257  L1DataEmulResult result(flag, ptbad, locbad, bad, dataonly, emulonly, hcalbad, ecalbad, "CaloTowerBxCollection");
258 
259  RESULT->push_back(bx, result);
260  }
261  }
262 
263  iEvent.put(std::move(RESULT));
264 }
edm::EDGetToken JetDataToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EDGetToken TauDataToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetToken CaloTowerDataToken_
edm::EDGetToken EtSumEmulToken_
tuple result
Definition: mps_fire.py:311
std::vector< T >::const_iterator const_iterator
Definition: BXVector.h:18
edm::EDGetToken JetEmulToken_
def move
Definition: eostools.py:511
edm::EDGetToken TauEmulToken_
auto const good
min quality of good
edm::EDGetToken EGammaDataToken_
edm::EDGetToken EGammaEmulToken_
edm::EDGetToken CaloTowerEmulToken_
tuple size
Write out results.
edm::EDGetToken EtSumDataToken_

Member Data Documentation

int l1t::L1ComparatorRun2::bxMax_
private

Definition at line 59 of file L1ComparatorRun2.h.

int l1t::L1ComparatorRun2::bxMin_
private

Definition at line 60 of file L1ComparatorRun2.h.

edm::EDGetToken l1t::L1ComparatorRun2::CaloTowerDataToken_
private

Definition at line 56 of file L1ComparatorRun2.h.

edm::EDGetToken l1t::L1ComparatorRun2::CaloTowerEmulToken_
private

Definition at line 57 of file L1ComparatorRun2.h.

bool l1t::L1ComparatorRun2::doLayer1_
private

Definition at line 63 of file L1ComparatorRun2.h.

bool l1t::L1ComparatorRun2::doLayer2_
private

Definition at line 62 of file L1ComparatorRun2.h.

edm::EDGetToken l1t::L1ComparatorRun2::EGammaDataToken_
private

Definition at line 50 of file L1ComparatorRun2.h.

edm::EDGetToken l1t::L1ComparatorRun2::EGammaEmulToken_
private

Definition at line 51 of file L1ComparatorRun2.h.

edm::EDGetToken l1t::L1ComparatorRun2::EtSumDataToken_
private

Definition at line 54 of file L1ComparatorRun2.h.

edm::EDGetToken l1t::L1ComparatorRun2::EtSumEmulToken_
private

Definition at line 55 of file L1ComparatorRun2.h.

edm::EDGetToken l1t::L1ComparatorRun2::JetDataToken_
private

Definition at line 48 of file L1ComparatorRun2.h.

edm::EDGetToken l1t::L1ComparatorRun2::JetEmulToken_
private

Definition at line 49 of file L1ComparatorRun2.h.

edm::EDGetToken l1t::L1ComparatorRun2::TauDataToken_
private

Definition at line 52 of file L1ComparatorRun2.h.

edm::EDGetToken l1t::L1ComparatorRun2::TauEmulToken_
private

Definition at line 53 of file L1ComparatorRun2.h.