CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
DuplicationChecker Class Reference

#include <DuplicationChecker.h>

Inheritance diagram for DuplicationChecker:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Types

typedef std::multimap< double, edm::EventIDassociationMap
 
typedef std::vector< associationMap::iterator > itemList
 
- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 DuplicationChecker (const edm::ParameterSet &)
 
void findValuesAssociatedWithKey (associationMap &mMap, double &key, itemList &theObjects)
 
 ~DuplicationChecker () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::InputTag generatedCollection_
 
edm::EDGetTokenT< edm::HepMCProductgeneratedCollectionToken_
 
edm::InputTag lheEventProduct_
 
edm::EDGetTokenT< LHEEventProductlheEventProductToken_
 
bool searchForLHE_
 
WeightManager wmanager_
 
associationMap xBjorkenHistory
 
MonitorElementxBjorkenME
 

Additional Inherited Members

- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 38 of file DuplicationChecker.h.

Member Typedef Documentation

◆ associationMap

typedef std::multimap<double, edm::EventID> DuplicationChecker::associationMap

Definition at line 40 of file DuplicationChecker.h.

◆ itemList

typedef std::vector<associationMap::iterator> DuplicationChecker::itemList

Definition at line 41 of file DuplicationChecker.h.

Constructor & Destructor Documentation

◆ DuplicationChecker()

DuplicationChecker::DuplicationChecker ( const edm::ParameterSet iPSet)
explicit

Definition at line 12 of file DuplicationChecker.cc.

13  : wmanager_(iPSet, consumesCollector()),
14  generatedCollection_(iPSet.getParameter<edm::InputTag>("hepmcCollection")),
15  searchForLHE_(iPSet.getParameter<bool>("searchForLHE")) {
16  if (searchForLHE_) {
17  lheEventProduct_ = iPSet.getParameter<edm::InputTag>("lheEventProduct");
18  }
19  xBjorkenHistory.clear();
20 
21  if (searchForLHE_)
22  lheEventProductToken_ = consumes<LHEEventProduct>(lheEventProduct_);
23  else
24  generatedCollectionToken_ = consumes<HepMCProduct>(generatedCollection_);
25 }

References generatedCollection_, generatedCollectionToken_, edm::ParameterSet::getParameter(), lheEventProduct_, lheEventProductToken_, searchForLHE_, and xBjorkenHistory.

◆ ~DuplicationChecker()

DuplicationChecker::~DuplicationChecker ( )
override

Definition at line 27 of file DuplicationChecker.cc.

27 { xBjorkenHistory.clear(); }

References xBjorkenHistory.

Member Function Documentation

◆ analyze()

void DuplicationChecker::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 38 of file DuplicationChecker.cc.

38  {
39  double bjorken = 0;
40 
41  double weight = 1.;
42 
43  if (searchForLHE_) {
45  iEvent.getByToken(lheEventProductToken_, evt);
46 
47  const lhef::HEPEUP hepeup_ = evt->hepeup();
48 
49  const std::vector<lhef::HEPEUP::FiveVector> pup_ = hepeup_.PUP;
50 
51  double pz1 = (pup_[0])[3];
52  double pz2 = (pup_[1])[3];
53  bjorken += (pz1 / (pz1 + pz2));
54  } else {
55  //change teh weight in this case
57 
59  iEvent.getByToken(generatedCollectionToken_, evt);
60 
61  const HepMC::PdfInfo *pdf = evt->GetEvent()->pdf_info();
62  if (pdf) {
63  bjorken = ((pdf->x1()) / ((pdf->x1()) + (pdf->x2())));
64  }
65  }
66 
67  xBjorkenHistory.insert(std::pair<double, edm::EventID>(bjorken, iEvent.id()));
68 
69  xBjorkenME->Fill(bjorken, weight);
70 
71 } //analyze

References dqm::impl::MonitorElement::Fill(), generatedCollectionToken_, edm::HepMCProduct::GetEvent(), LHEEventProduct::hepeup(), hepeup_, iEvent, lheEventProductToken_, searchForLHE_, WeightManager::weight(), wmanager_, xBjorkenHistory, and xBjorkenME.

◆ bookHistograms()

void DuplicationChecker::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Setting the DQM top directories

Booking the ME's

Implements DQMEDAnalyzer.

Definition at line 29 of file DuplicationChecker.cc.

29  {
31  DQMHelper dqm(&i);
32  i.setCurrentFolder("Generator/DuplicationCheck");
33 
35  xBjorkenME = dqm.book1dHisto("xBjorkenME", "x Bjorken ratio", 1000000, 0., 1.);
36 }

References mps_fire::i, and xBjorkenME.

◆ findValuesAssociatedWithKey()

void DuplicationChecker::findValuesAssociatedWithKey ( associationMap mMap,
double &  key,
itemList theObjects 
)

Definition at line 73 of file DuplicationChecker.cc.

73  {
74  associationMap::iterator itr;
75  associationMap::iterator lastElement;
76 
77  theObjects.clear();
78 
79  // locate an iterator to the first pair object associated with key
80  itr = mMap.find(key);
81  if (itr == mMap.end())
82  return; // no elements associated with key, so return immediately
83 
84  // get an iterator to the element that is one past the last element associated with key
85  lastElement = mMap.upper_bound(key);
86 
87  // for each element in the sequence [itr, lastElement)
88  for (; itr != lastElement; ++itr)
89  theObjects.push_back(itr);
90 }

References crabWrapper::key.

Member Data Documentation

◆ generatedCollection_

edm::InputTag DuplicationChecker::generatedCollection_
private

Definition at line 54 of file DuplicationChecker.h.

Referenced by DuplicationChecker().

◆ generatedCollectionToken_

edm::EDGetTokenT<edm::HepMCProduct> DuplicationChecker::generatedCollectionToken_
private

Definition at line 64 of file DuplicationChecker.h.

Referenced by analyze(), and DuplicationChecker().

◆ lheEventProduct_

edm::InputTag DuplicationChecker::lheEventProduct_
private

Definition at line 55 of file DuplicationChecker.h.

Referenced by DuplicationChecker().

◆ lheEventProductToken_

edm::EDGetTokenT<LHEEventProduct> DuplicationChecker::lheEventProductToken_
private

Definition at line 63 of file DuplicationChecker.h.

Referenced by analyze(), and DuplicationChecker().

◆ searchForLHE_

bool DuplicationChecker::searchForLHE_
private

Definition at line 57 of file DuplicationChecker.h.

Referenced by analyze(), and DuplicationChecker().

◆ wmanager_

WeightManager DuplicationChecker::wmanager_
private

Definition at line 52 of file DuplicationChecker.h.

Referenced by analyze().

◆ xBjorkenHistory

associationMap DuplicationChecker::xBjorkenHistory
private

Definition at line 59 of file DuplicationChecker.h.

Referenced by analyze(), DuplicationChecker(), and ~DuplicationChecker().

◆ xBjorkenME

MonitorElement* DuplicationChecker::xBjorkenME
private

Definition at line 61 of file DuplicationChecker.h.

Referenced by analyze(), and bookHistograms().

mps_fire.i
i
Definition: mps_fire.py:428
DuplicationChecker::lheEventProduct_
edm::InputTag lheEventProduct_
Definition: DuplicationChecker.h:55
DuplicationChecker::wmanager_
WeightManager wmanager_
Definition: DuplicationChecker.h:52
edm::Handle
Definition: AssociativeIterator.h:50
hepeup_
struct HEPEUP_ hepeup_
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
DuplicationChecker::lheEventProductToken_
edm::EDGetTokenT< LHEEventProduct > lheEventProductToken_
Definition: DuplicationChecker.h:63
DuplicationChecker::searchForLHE_
bool searchForLHE_
Definition: DuplicationChecker.h:57
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:29
DuplicationChecker::generatedCollection_
edm::InputTag generatedCollection_
Definition: DuplicationChecker.h:54
lhef::HEPEUP
Definition: LesHouches.h:138
WeightManager::weight
double weight(const edm::Event &)
Definition: WeightManager.cc:24
DuplicationChecker::xBjorkenME
MonitorElement * xBjorkenME
Definition: DuplicationChecker.h:61
DQMHelper
Definition: DQMHelper.h:15
LHEEventProduct::hepeup
const lhef::HEPEUP & hepeup() const
Definition: LHEEventProduct.h:46
DuplicationChecker::generatedCollectionToken_
edm::EDGetTokenT< edm::HepMCProduct > generatedCollectionToken_
Definition: DuplicationChecker.h:64
DuplicationChecker::xBjorkenHistory
associationMap xBjorkenHistory
Definition: DuplicationChecker.h:59
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm
Definition: DQMStore.h:18
crabWrapper.key
key
Definition: crabWrapper.py:19
edm::InputTag
Definition: InputTag.h:15
weight
Definition: weight.py:1