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:
edm::EDAnalyzer

Public Types

typedef std::multimap< double,
edm::EventID
associationMap
 
typedef std::vector
< associationMap::iterator > 
itemList
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
void beginJob ()
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
 DuplicationChecker (const edm::ParameterSet &)
 
void endJob ()
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
void findValuesAssociatedWithKey (associationMap &mMap, double &key, itemList &theObjects)
 
virtual ~DuplicationChecker ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

DQMStoredbe
 
edm::InputTag generatedCollection_
 
bool searchForLHE_
 
associationMap xBjorkenHistory
 
MonitorElementxBjorkenME
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 38 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 14 of file DuplicationChecker.cc.

References dbe, cmsCodeRules.cppFunctionSkipper::operator, and xBjorkenHistory.

14  :
15  generatedCollection_(iPSet.getParameter<edm::InputTag>("generatedCollection")),
16  searchForLHE_(iPSet.getParameter<bool>("searchForLHE"))
17 {
18  dbe = 0;
20 
21  xBjorkenHistory.clear();
22 }
T getParameter(std::string const &) const
edm::InputTag generatedCollection_
associationMap xBjorkenHistory
DuplicationChecker::~DuplicationChecker ( )
virtual

Definition at line 24 of file DuplicationChecker.cc.

References xBjorkenHistory.

25 {
26  xBjorkenHistory.clear();
27 }
associationMap xBjorkenHistory

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 40 of file DuplicationChecker.cc.

References MonitorElement::Fill(), generatedCollection_, edm::Event::getByLabel(), edm::Event::getByType(), hepeup_, edm::EventBase::id(), lhef::HEPEUP::PUP, searchForLHE_, xBjorkenHistory, and xBjorkenME.

41 {
42 
43  double bjorken = 0;
44 
45  if (searchForLHE_) {
46 
48  iEvent.getByType( evt );
49 
50  const lhef::HEPEUP hepeup_ = evt->hepeup();
51 
52  const std::vector<lhef::HEPEUP::FiveVector> pup_ = hepeup_.PUP;
53 
54  double pz1=(pup_[0])[3];
55  double pz2=(pup_[1])[3];
56  bjorken+=(pz1/(pz1+pz2));
57  }
58  else {
59 
61  iEvent.getByLabel(generatedCollection_, evt);
62 
63  const HepMC::PdfInfo *pdf = evt->GetEvent()->pdf_info();
64  if(pdf){
65  bjorken = ((pdf->x1())/((pdf->x1())+(pdf->x2())));
66  }
67 
68  }
69 
70  xBjorkenHistory.insert(std::pair<double,edm::EventID>(bjorken,iEvent.id()));
71 
72  xBjorkenME->Fill(bjorken);
73 
74 }//analyze
edm::InputTag generatedCollection_
struct HEPEUP_ hepeup_
bool getByType(Handle< PROD > &result) const
Definition: Event.h:397
associationMap xBjorkenHistory
void Fill(long long x)
std::vector< FiveVector > PUP
Definition: LesHouches.h:248
MonitorElement * xBjorkenME
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
edm::EventID id() const
Definition: EventBase.h:56
void DuplicationChecker::beginJob ( void  )
virtual

Setting the DQM top directories

Booking the ME's

Reimplemented from edm::EDAnalyzer.

Definition at line 29 of file DuplicationChecker.cc.

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

30 {
31  if(dbe){
33  dbe->setCurrentFolder("Generator/DuplicationCheck");
34 
36  xBjorkenME = dbe->book1D("xBjorkenME", "x Bjorken ratio", 1000000, 0., 1.);
37  }
38 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
MonitorElement * xBjorkenME
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
virtual void DuplicationChecker::beginRun ( const edm::Run ,
const edm::EventSetup  
)
inlinevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 51 of file DuplicationChecker.h.

51 { return;}
void DuplicationChecker::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 96 of file DuplicationChecker.cc.

References findValuesAssociatedWithKey(), i, edm::second(), and xBjorkenHistory.

97 {
98 
99  itemList theObjects;
100  theObjects.reserve(10);
101 
102  for (associationMap::iterator it = xBjorkenHistory.begin(); it != xBjorkenHistory.end(); it++) {
103  double theKey = (*it).first;
104 
105  findValuesAssociatedWithKey(xBjorkenHistory, theKey, theObjects);
106 
107  if (theObjects.size() > 1) {
108  edm::LogWarning("DuplicatedEventFound") << "Duplicated events found with xBjorken = " << std::fixed << std::setw(16) << std::setprecision(14) << theKey;
109  for (unsigned int i = 0; i < theObjects.size(); i++) {
110  edm::LogPrint("DuplicatedEventList") << "Event = " << (*theObjects[i]).second;
111  }
112  }
113 
114  theObjects.clear();
115 
116  }
117 
118 }
int i
Definition: DBlmapReader.cc:9
std::vector< associationMap::iterator > itemList
associationMap xBjorkenHistory
U second(std::pair< T, U > const &p)
void findValuesAssociatedWithKey(associationMap &mMap, double &key, itemList &theObjects)
virtual void DuplicationChecker::endRun ( const edm::Run ,
const edm::EventSetup  
)
inlinevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file DuplicationChecker.h.

52 { return;}
void DuplicationChecker::findValuesAssociatedWithKey ( associationMap mMap,
double &  key,
itemList theObjects 
)

Definition at line 76 of file DuplicationChecker.cc.

Referenced by endJob().

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

Member Data Documentation

DQMStore* DuplicationChecker::dbe
private

Definition at line 63 of file DuplicationChecker.h.

Referenced by beginJob(), and DuplicationChecker().

edm::InputTag DuplicationChecker::generatedCollection_
private

Definition at line 57 of file DuplicationChecker.h.

Referenced by analyze().

bool DuplicationChecker::searchForLHE_
private

Definition at line 59 of file DuplicationChecker.h.

Referenced by analyze().

associationMap DuplicationChecker::xBjorkenHistory
private

Definition at line 61 of file DuplicationChecker.h.

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

MonitorElement* DuplicationChecker::xBjorkenME
private

Definition at line 65 of file DuplicationChecker.h.

Referenced by analyze(), and beginJob().