CMS 3D CMS Logo

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

#include <DuplicationChecker.h>

Inheritance diagram for DuplicationChecker:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Types

typedef std::multimap< double,
edm::EventID
associationMap
 
typedef std::vector
< associationMap::iterator > 
itemList
 
- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 DuplicationChecker (const edm::ParameterSet &)
 
void findValuesAssociatedWithKey (associationMap &mMap, double &key, itemList &theObjects)
 
virtual ~DuplicationChecker ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Definition at line 39 of file DuplicationChecker.h.

Member Typedef Documentation

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

Definition at line 43 of file DuplicationChecker.h.

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

Definition at line 44 of file DuplicationChecker.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file DuplicationChecker.cc.

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

12  :
14  generatedCollection_(iPSet.getParameter<edm::InputTag>("hepmcCollection")),
15  searchForLHE_(iPSet.getParameter<bool>("searchForLHE"))
16 {
17  if (searchForLHE_) {
18  lheEventProduct_ = iPSet.getParameter<edm::InputTag>("lheEventProduct");
19  }
20  xBjorkenHistory.clear();
21 
22  if (searchForLHE_) lheEventProductToken_=consumes<LHEEventProduct>(lheEventProduct_);
23  else generatedCollectionToken_=consumes<HepMCProduct>(generatedCollection_);
24 
25 }
T getParameter(std::string const &) const
edm::EDGetTokenT< LHEEventProduct > lheEventProductToken_
edm::InputTag generatedCollection_
edm::EDGetTokenT< edm::HepMCProduct > generatedCollectionToken_
associationMap xBjorkenHistory
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
WeightManager wmanager_
edm::InputTag lheEventProduct_
DuplicationChecker::~DuplicationChecker ( )
virtual

Definition at line 27 of file DuplicationChecker.cc.

References xBjorkenHistory.

28 {
29  xBjorkenHistory.clear();
30 }
associationMap xBjorkenHistory

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 40 of file DuplicationChecker.cc.

References MonitorElement::Fill(), generatedCollectionToken_, edm::Event::getByToken(), hepeup_, edm::EventBase::id(), lheEventProductToken_, lhef::HEPEUP::PUP, searchForLHE_, WeightManager::weight(), histoStyle::weight, wmanager_, xBjorkenHistory, and xBjorkenME.

41 {
42 
43  double bjorken = 0;
44 
45  double weight = 1.;
46 
47  if (searchForLHE_) {
48 
50  iEvent.getByToken(lheEventProductToken_, evt);
51 
52  const lhef::HEPEUP hepeup_ = evt->hepeup();
53 
54  const std::vector<lhef::HEPEUP::FiveVector> pup_ = hepeup_.PUP;
55 
56  double pz1=(pup_[0])[3];
57  double pz2=(pup_[1])[3];
58  bjorken+=(pz1/(pz1+pz2));
59  }
60  else {
61  //change teh weight in this case
62  weight = wmanager_.weight(iEvent);
63 
66 
67  const HepMC::PdfInfo *pdf = evt->GetEvent()->pdf_info();
68  if(pdf){
69  bjorken = ((pdf->x1())/((pdf->x1())+(pdf->x2())));
70  }
71 
72  }
73 
74  xBjorkenHistory.insert(std::pair<double,edm::EventID>(bjorken,iEvent.id()));
75 
76  xBjorkenME->Fill(bjorken,weight);
77 
78 }//analyze
edm::EDGetTokenT< LHEEventProduct > lheEventProductToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
struct HEPEUP_ hepeup_
edm::EDGetTokenT< edm::HepMCProduct > generatedCollectionToken_
associationMap xBjorkenHistory
void Fill(long long x)
std::vector< FiveVector > PUP
Definition: LesHouches.h:248
WeightManager wmanager_
MonitorElement * xBjorkenME
edm::EventID id() const
Definition: EventBase.h:56
int weight
Definition: histoStyle.py:50
double weight(const edm::Event &)
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 32 of file DuplicationChecker.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::setCurrentFolder(), and xBjorkenME.

32  {
34  i.setCurrentFolder("Generator/DuplicationCheck");
35 
37  xBjorkenME = i.book1D("xBjorkenME", "x Bjorken ratio", 1000000, 0., 1.);
38 }
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:113
MonitorElement * xBjorkenME
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
void DuplicationChecker::findValuesAssociatedWithKey ( associationMap mMap,
double &  key,
itemList theObjects 
)

Definition at line 80 of file DuplicationChecker.cc.

81 {
82  associationMap::iterator itr;
83  associationMap::iterator lastElement;
84 
85  theObjects.clear();
86 
87  // locate an iterator to the first pair object associated with key
88  itr = mMap.find(key);
89  if (itr == mMap.end())
90  return; // no elements associated with key, so return immediately
91 
92  // get an iterator to the element that is one past the last element associated with key
93  lastElement = mMap.upper_bound(key);
94 
95  // for each element in the sequence [itr, lastElement)
96  for ( ; itr != lastElement; ++itr)
97  theObjects.push_back(itr);
98 }
list key
Definition: combine.py:13

Member Data Documentation

edm::InputTag DuplicationChecker::generatedCollection_
private

Definition at line 57 of file DuplicationChecker.h.

Referenced by DuplicationChecker().

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

Definition at line 67 of file DuplicationChecker.h.

Referenced by analyze(), and DuplicationChecker().

edm::InputTag DuplicationChecker::lheEventProduct_
private

Definition at line 58 of file DuplicationChecker.h.

Referenced by DuplicationChecker().

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

Definition at line 66 of file DuplicationChecker.h.

Referenced by analyze(), and DuplicationChecker().

bool DuplicationChecker::searchForLHE_
private

Definition at line 60 of file DuplicationChecker.h.

Referenced by analyze(), and DuplicationChecker().

WeightManager DuplicationChecker::wmanager_
private

Definition at line 55 of file DuplicationChecker.h.

Referenced by analyze().

associationMap DuplicationChecker::xBjorkenHistory
private

Definition at line 62 of file DuplicationChecker.h.

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

MonitorElement* DuplicationChecker::xBjorkenME
private

Definition at line 64 of file DuplicationChecker.h.

Referenced by analyze(), and bookHistograms().