CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
L1Validator Class Reference

#include <L1Validator.h>

Inheritance diagram for L1Validator:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 L1Validator (const edm::ParameterSet &)
 
 ~L1Validator () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 

Private Member Functions

const reco::LeafCandidateFindBest (const reco::GenParticle *, const std::vector< l1extra::L1EmParticle > *, const std::vector< l1extra::L1EmParticle > *)
 
const reco::LeafCandidateFindBest (const reco::GenParticle *, const std::vector< l1extra::L1JetParticle > *, const std::vector< l1extra::L1JetParticle > *)
 
const reco::LeafCandidateFindBest (const reco::GenParticle *, const std::vector< l1extra::L1MuonParticle > *)
 

Private Attributes

std::string _dirName
 
std::string _fileName
 
edm::EDGetTokenT< reco::GenParticleCollection_GenSource
 
L1ValidatorHists _Hists
 
edm::EDGetTokenT< l1t::EGammaBxCollection_L1EGammaBXSource
 
edm::EDGetTokenT< reco::GenJetCollection_L1GenJetSource
 
edm::EDGetTokenT< l1t::JetBxCollection_L1JetBXSource
 
edm::EDGetTokenT< l1t::MuonBxCollection_L1MuonBXSource
 
edm::EDGetTokenT< l1t::TauBxCollection_L1TauBXSource
 
edm::EDGetTokenT< GenEventInfoProduct_srcToken
 

Detailed Description

Definition at line 67 of file L1Validator.h.

Constructor & Destructor Documentation

L1Validator::L1Validator ( const edm::ParameterSet iConfig)
explicit

Definition at line 54 of file L1Validator.cc.

References _dirName, _GenSource, _L1EGammaBXSource, _L1GenJetSource, _L1JetBXSource, _L1MuonBXSource, _L1TauBXSource, _srcToken, edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

54  {
55  _dirName = iConfig.getParameter<std::string>("dirName");
56  _GenSource = consumes<reco::GenParticleCollection>(iConfig.getParameter<edm::InputTag>("GenSource"));
57 
58  _L1MuonBXSource = consumes<l1t::MuonBxCollection>(iConfig.getParameter<edm::InputTag>("L1MuonBXSource"));
59  _L1EGammaBXSource = consumes<l1t::EGammaBxCollection>(iConfig.getParameter<edm::InputTag>("L1EGammaBXSource"));
60  _L1TauBXSource = consumes<l1t::TauBxCollection>(iConfig.getParameter<edm::InputTag>("L1TauBXSource"));
61  _L1JetBXSource = consumes<l1t::JetBxCollection>(iConfig.getParameter<edm::InputTag>("L1JetBXSource"));
62  _srcToken = mayConsume<GenEventInfoProduct>(iConfig.getParameter<edm::InputTag>("srcToken"));
63  _L1GenJetSource = consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("L1GenJetSource"));
64 
65  //_fileName = iConfig.getParameter<std::string>("fileName");
66 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::GenJetCollection > _L1GenJetSource
Definition: L1Validator.h:89
edm::EDGetTokenT< reco::GenParticleCollection > _GenSource
Definition: L1Validator.h:83
edm::EDGetTokenT< GenEventInfoProduct > _srcToken
Definition: L1Validator.h:88
edm::EDGetTokenT< l1t::TauBxCollection > _L1TauBXSource
Definition: L1Validator.h:86
edm::EDGetTokenT< l1t::JetBxCollection > _L1JetBXSource
Definition: L1Validator.h:87
std::string _dirName
Definition: L1Validator.h:80
edm::EDGetTokenT< l1t::MuonBxCollection > _L1MuonBXSource
Definition: L1Validator.h:84
edm::EDGetTokenT< l1t::EGammaBxCollection > _L1EGammaBXSource
Definition: L1Validator.h:85
L1Validator::~L1Validator ( )
override

Definition at line 68 of file L1Validator.cc.

68 {}

Member Function Documentation

void L1Validator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

select the final state (i.e status==1) muons (pdg==+/-13)

select the final state (i.e status==1) electrons (pdg==+/-11) and photons (pdg==22)

select the matrix element (i.e status==2) taus (pdg==+/-15) before decay

Definition at line 75 of file L1Validator.cc.

References _GenSource, _Hists, _L1EGammaBXSource, _L1GenJetSource, _L1JetBXSource, _L1MuonBXSource, _L1TauBXSource, _srcToken, funct::abs(), BXVector< T >::begin(), reco::deltaR(), BXVector< T >::end(), PVValHelper::eta, reco::LeafCandidate::eta(), L1ValidatorHists::Fill(), L1ValidatorHists::FillNumber(), nanoDQM_cfi::GenPart, TauGenJets_cfi::GenParticles, edm::Event::getByToken(), BXVector< T >::getFirstBX(), BXVector< T >::getLastBX(), mps_fire::i, metsig::jet, nanoDQM_cff::Jet, electronTrackIsolations_cfi::minDR, RPCpg::mu, nanoDQM_cff::Muon, L1ValidatorHists::NEvents, reco::LeafCandidate::pdgId(), phi, reco::LeafCandidate::phi(), EnergyCorrector::pt, reco::LeafCandidate::pt(), BXVector< T >::size(), mps_update::status, reco::LeafCandidate::status(), metsig::tau, and parallelization::uint().

75  {
76  using namespace edm;
77  using namespace std;
78  using namespace l1extra;
79  using namespace reco;
80 
86  Handle<GenEventInfoProduct> genEvtInfoProduct;
88 
89  bool GotEverything = true;
90 
91  if (!iEvent.getByToken(_GenSource, GenParticles))
92  GotEverything = false;
93  if (!iEvent.getByToken(_L1MuonBXSource, MuonsBX))
94  GotEverything = false;
95  if (!iEvent.getByToken(_L1EGammaBXSource, EGammasBX))
96  GotEverything = false;
97  if (!iEvent.getByToken(_L1TauBXSource, TausBX))
98  GotEverything = false;
99  if (!iEvent.getByToken(_L1JetBXSource, JetsBX))
100  GotEverything = false;
101  if (!iEvent.getByToken(_srcToken, genEvtInfoProduct))
102  GotEverything = false;
103  if (!iEvent.getByToken(_L1GenJetSource, GenJets))
104  GotEverything = false;
105 
106  if (!GotEverything)
107  return;
108 
109  /*
110  std::string moduleName = "";
111  if( genEvtInfoProduct.isValid() ) {
112  const edm::Provenance& prov =
113  iEvent.getProvenance(genEvtInfoProduct.id()); moduleName =
114  edm::moduleName(prov);
115  //cout<<" generator name: "<<moduleName<<endl;
116  }
117  */
118 
119  _Hists.NEvents++;
120 
121  int nL1Muons = 0, nL1EGammas = 0, nL1Taus = 0, nL1Jets = 0;
122  if (MuonsBX->getFirstBX() >= 0)
123  nL1Muons = MuonsBX->size(0);
124  if (EGammasBX->getFirstBX() >= 0)
125  nL1EGammas = EGammasBX->size(0);
126  if (TausBX->getFirstBX() >= 0)
127  nL1Taus = TausBX->size(0);
128  if (JetsBX->getFirstBX() >= 0)
129  nL1Jets = JetsBX->size(0);
130 
132  _Hists.FillNumber(L1ValidatorHists::Type::Egamma, nL1EGammas);
135 
136  // For gen jet
137 
138  for (auto &Genjet : *GenJets) {
139  // eta within calorimeter acceptance 4.7
140  if (fabs((&Genjet)->eta()) > 4.7)
141  continue;
142 
143  // only consider the gen jet with pt greater than 10 GeV
144  if ((&Genjet)->pt() < 10.0)
145  continue;
146 
147  double minDR = 999.0;
148 
149  // match L1T object
150  const l1t::Jet *L1Part = nullptr;
151  for (int iBx = JetsBX->getFirstBX(); iBx <= JetsBX->getLastBX(); ++iBx) {
152  if (iBx > 0)
153  continue;
154  for (std::vector<l1t::Jet>::const_iterator jet = JetsBX->begin(iBx); jet != JetsBX->end(iBx); ++jet) {
155  double idR = reco::deltaR((&Genjet)->eta(), (&Genjet)->phi(), jet->eta(), jet->phi());
156  if (idR < minDR) {
157  minDR = idR;
158  L1Part = &(*jet);
159  }
160  }
161  }
162  _Hists.Fill(L1ValidatorHists::Type::Jet, &Genjet, L1Part);
163  }
164 
165  for (uint i = 0; i < GenParticles->size(); i++) {
166  const GenParticle *GenPart = &GenParticles->at(i);
167 
168  int pdg = GenPart->pdgId(), status = GenPart->status();
169 
170  double minDR = 999.0;
171 
172  // only consider the gen particle with pt greater than 10 GeV
173  if (GenPart->pt() < 10.0)
174  continue;
175 
177  if (status == 1 && abs(pdg) == 13) { // Muon
178 
179  // eta within tracker acceptance 2.4
180  if (fabs(GenPart->eta()) > 2.4)
181  continue;
182 
183  // match L1T object
184  const l1t::Muon *L1Part = nullptr;
185  for (int iBx = MuonsBX->getFirstBX(); iBx <= MuonsBX->getLastBX(); ++iBx) {
186  if (iBx > 0)
187  continue;
188  for (std::vector<l1t::Muon>::const_iterator mu = MuonsBX->begin(iBx); mu != MuonsBX->end(iBx); ++mu) {
189  double idR = reco::deltaR(GenPart->eta(), GenPart->phi(), mu->eta(), mu->phi());
190  if (idR < minDR) {
191  minDR = idR;
192  L1Part = &(*mu);
193  }
194  }
195  _Hists.Fill(L1ValidatorHists::Type::Muon, GenPart, L1Part);
196  }
197 
200  } else if (status == 1 && (abs(pdg) == 11 || pdg == 22)) { // Egamma
201 
202  // eta within EM calorimeter acceptance 2.5
203  if (fabs(GenPart->eta()) > 2.5)
204  continue;
205 
206  // exclude the calorimeter barrel and endcap overlap region
207  if (fabs(GenPart->eta()) > 1.4442 && fabs(GenPart->eta()) < 1.5660)
208  continue;
209 
210  // match L1T object
211  const l1t::EGamma *L1Part = nullptr;
212  for (int iBx = EGammasBX->getFirstBX(); iBx <= EGammasBX->getLastBX(); ++iBx) {
213  if (iBx > 0)
214  continue;
215  for (std::vector<l1t::EGamma>::const_iterator eg = EGammasBX->begin(iBx); eg != EGammasBX->end(iBx); ++eg) {
216  double idR = reco::deltaR(GenPart->eta(), GenPart->phi(), eg->eta(), eg->phi());
217  if (idR < minDR) {
218  minDR = idR;
219  L1Part = &(*eg);
220  }
221  }
222  }
223  _Hists.Fill(L1ValidatorHists::Type::Egamma, GenPart, L1Part);
224 
227  } else if (status == 2 && abs(pdg) == 15) { // Tau
228 
229  // eta within tracker acceptance 2.4
230  if (fabs(GenPart->eta()) > 2.4)
231  continue;
232 
233  // match L1T object
234  const l1t::Tau *L1Part = nullptr;
235  for (int iBx = TausBX->getFirstBX(); iBx <= TausBX->getLastBX(); ++iBx) {
236  if (iBx > 0)
237  continue;
238  for (std::vector<l1t::Tau>::const_iterator tau = TausBX->begin(iBx); tau != TausBX->end(iBx); ++tau) {
239  double idR = reco::deltaR(GenPart->eta(), GenPart->phi(), tau->eta(), tau->phi());
240  if (idR < minDR) {
241  minDR = idR;
242  L1Part = &(*tau);
243  }
244  }
245  }
246  _Hists.Fill(L1ValidatorHists::Type::Tau, GenPart, L1Part);
247  }
248  }
249 }
void Fill(int, const reco::LeafCandidate *, const reco::LeafCandidate *)
const_iterator end(int bx) const
edm::EDGetTokenT< reco::GenJetCollection > _L1GenJetSource
Definition: L1Validator.h:89
int pdgId() const final
PDG identifier.
unsigned size(int bx) const
double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< reco::GenParticleCollection > _GenSource
Definition: L1Validator.h:83
Definition: Tau.h:21
edm::EDGetTokenT< GenEventInfoProduct > _srcToken
Definition: L1Validator.h:88
double pt() const final
transverse momentum
void FillNumber(int, int)
Definition: Jet.h:21
edm::EDGetTokenT< l1t::TauBxCollection > _L1TauBXSource
Definition: L1Validator.h:86
edm::EDGetTokenT< l1t::JetBxCollection > _L1JetBXSource
Definition: L1Validator.h:87
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const int mu
Definition: Constants.h:22
edm::EDGetTokenT< l1t::MuonBxCollection > _L1MuonBXSource
Definition: L1Validator.h:84
Definition: Muon.h:21
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
int getFirstBX() const
def uint(string)
L1ValidatorHists _Hists
Definition: L1Validator.h:91
fixed size matrix
HLT enums.
int getLastBX() const
int status() const final
status word
edm::EDGetTokenT< l1t::EGammaBxCollection > _L1EGammaBXSource
Definition: L1Validator.h:85
const_iterator begin(int bx) const
double phi() const final
momentum azimuthal angle
void L1Validator::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotected

Definition at line 70 of file L1Validator.cc.

References _dirName, _Hists, and L1ValidatorHists::Book().

70  {
71  // iBooker.setCurrentFolder(_dirName);
72  _Hists.Book(iBooker, _dirName);
73 };
void Book(DQMStore::IBooker &, std::string dirname)
std::string _dirName
Definition: L1Validator.h:80
L1ValidatorHists _Hists
Definition: L1Validator.h:91
void L1Validator::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 332 of file L1Validator.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

332  {
333  // The following says we do not know what parameters are allowed so do no
334  // validation
335  // Please change this to state exactly what you do use, even if it is no
336  // parameters
338  desc.setUnknown();
339  descriptions.addDefault(desc);
340 }
void addDefault(ParameterSetDescription const &psetDescription)
const reco::LeafCandidate * L1Validator::FindBest ( const reco::GenParticle GenPart,
const std::vector< l1extra::L1EmParticle > *  Collection1,
const std::vector< l1extra::L1EmParticle > *  Collection2 = 0 
)
private

Definition at line 253 of file L1Validator.cc.

References reco::deltaR(), reco::LeafCandidate::eta(), mps_fire::i, reco::LeafCandidate::phi(), and parallelization::uint().

255  {
256  const reco::LeafCandidate *BestPart = nullptr;
257  double BestDR = 999.;
258 
259  for (uint i = 0; i < Collection1->size(); i++) {
260  const reco::LeafCandidate *ThisPart = &Collection1->at(i);
261  double ThisDR = reco::deltaR(GenPart->eta(), GenPart->phi(), ThisPart->eta(), ThisPart->phi());
262  if (ThisDR < BestDR) {
263  BestDR = ThisDR;
264  BestPart = ThisPart;
265  }
266  }
267 
268  if (Collection2 == nullptr)
269  return BestPart;
270 
271  for (uint i = 0; i < Collection2->size(); i++) {
272  const reco::LeafCandidate *ThisPart = &Collection2->at(i);
273  double ThisDR = reco::deltaR(GenPart->eta(), GenPart->phi(), ThisPart->eta(), ThisPart->phi());
274  if (ThisDR < BestDR) {
275  BestDR = ThisDR;
276  BestPart = ThisPart;
277  }
278  }
279 
280  return BestPart;
281 }
double eta() const final
momentum pseudorapidity
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
def uint(string)
double phi() const final
momentum azimuthal angle
const reco::LeafCandidate * L1Validator::FindBest ( const reco::GenParticle GenPart,
const std::vector< l1extra::L1JetParticle > *  Collection1,
const std::vector< l1extra::L1JetParticle > *  Collection2 = 0 
)
private

Definition at line 283 of file L1Validator.cc.

References reco::deltaR(), reco::LeafCandidate::eta(), mps_fire::i, reco::LeafCandidate::phi(), and parallelization::uint().

285  {
286  const reco::LeafCandidate *BestPart = nullptr;
287  double BestDR = 999.;
288 
289  for (uint i = 0; i < Collection1->size(); i++) {
290  const reco::LeafCandidate *ThisPart = &Collection1->at(i);
291  double ThisDR = reco::deltaR(GenPart->eta(), GenPart->phi(), ThisPart->eta(), ThisPart->phi());
292  if (ThisDR < BestDR) {
293  BestDR = ThisDR;
294  BestPart = ThisPart;
295  }
296  }
297 
298  if (Collection2 == nullptr)
299  return BestPart;
300 
301  for (uint i = 0; i < Collection2->size(); i++) {
302  const reco::LeafCandidate *ThisPart = &Collection2->at(i);
303  double ThisDR = reco::deltaR(GenPart->eta(), GenPart->phi(), ThisPart->eta(), ThisPart->phi());
304  if (ThisDR < BestDR) {
305  BestDR = ThisDR;
306  BestPart = ThisPart;
307  }
308  }
309 
310  return BestPart;
311 }
double eta() const final
momentum pseudorapidity
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
def uint(string)
double phi() const final
momentum azimuthal angle
const reco::LeafCandidate * L1Validator::FindBest ( const reco::GenParticle GenPart,
const std::vector< l1extra::L1MuonParticle > *  Collection1 
)
private

Definition at line 313 of file L1Validator.cc.

References reco::deltaR(), reco::LeafCandidate::eta(), mps_fire::i, reco::LeafCandidate::phi(), and parallelization::uint().

314  {
315  const reco::LeafCandidate *BestPart = nullptr;
316  double BestDR = 999.;
317 
318  for (uint i = 0; i < Collection1->size(); i++) {
319  const reco::LeafCandidate *ThisPart = &Collection1->at(i);
320  double ThisDR = reco::deltaR(GenPart->eta(), GenPart->phi(), ThisPart->eta(), ThisPart->phi());
321  if (ThisDR < BestDR) {
322  BestDR = ThisDR;
323  BestPart = ThisPart;
324  }
325  }
326 
327  return BestPart;
328 }
double eta() const final
momentum pseudorapidity
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
def uint(string)
double phi() const final
momentum azimuthal angle

Member Data Documentation

std::string L1Validator::_dirName
private

Definition at line 80 of file L1Validator.h.

Referenced by bookHistograms(), and L1Validator().

std::string L1Validator::_fileName
private

Definition at line 81 of file L1Validator.h.

Referenced by trackingPlots.TrackingSeedingLayerTable::draw().

edm::EDGetTokenT<reco::GenParticleCollection> L1Validator::_GenSource
private

Definition at line 83 of file L1Validator.h.

Referenced by analyze(), and L1Validator().

L1ValidatorHists L1Validator::_Hists
private

Definition at line 91 of file L1Validator.h.

Referenced by analyze(), and bookHistograms().

edm::EDGetTokenT<l1t::EGammaBxCollection> L1Validator::_L1EGammaBXSource
private

Definition at line 85 of file L1Validator.h.

Referenced by analyze(), and L1Validator().

edm::EDGetTokenT<reco::GenJetCollection> L1Validator::_L1GenJetSource
private

Definition at line 89 of file L1Validator.h.

Referenced by analyze(), and L1Validator().

edm::EDGetTokenT<l1t::JetBxCollection> L1Validator::_L1JetBXSource
private

Definition at line 87 of file L1Validator.h.

Referenced by analyze(), and L1Validator().

edm::EDGetTokenT<l1t::MuonBxCollection> L1Validator::_L1MuonBXSource
private

Definition at line 84 of file L1Validator.h.

Referenced by analyze(), and L1Validator().

edm::EDGetTokenT<l1t::TauBxCollection> L1Validator::_L1TauBXSource
private

Definition at line 86 of file L1Validator.h.

Referenced by analyze(), and L1Validator().

edm::EDGetTokenT<GenEventInfoProduct> L1Validator::_srcToken
private

Definition at line 88 of file L1Validator.h.

Referenced by analyze(), and L1Validator().