#include <DuplicationChecker.h>
Public Types | |
typedef std::multimap< double, edm::EventID > | associationMap |
typedef std::vector < associationMap::iterator > | itemList |
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 () |
Private Attributes | |
DQMStore * | dbe |
edm::InputTag | generatedCollection_ |
bool | searchForLHE_ |
associationMap | xBjorkenHistory |
MonitorElement * | xBjorkenME |
Definition at line 38 of file DuplicationChecker.h.
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.
DuplicationChecker::DuplicationChecker | ( | const edm::ParameterSet & | iPSet | ) | [explicit] |
Definition at line 14 of file DuplicationChecker.cc.
References dbe, cmsCodeRules::cppFunctionSkipper::operator, and xBjorkenHistory.
: generatedCollection_(iPSet.getParameter<edm::InputTag>("generatedCollection")), searchForLHE_(iPSet.getParameter<bool>("searchForLHE")) { dbe = 0; dbe = edm::Service<DQMStore>().operator->(); xBjorkenHistory.clear(); }
DuplicationChecker::~DuplicationChecker | ( | ) | [virtual] |
Definition at line 24 of file DuplicationChecker.cc.
References xBjorkenHistory.
{ xBjorkenHistory.clear(); }
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.
{ double bjorken = 0; if (searchForLHE_) { Handle<LHEEventProduct> evt; iEvent.getByType( evt ); const lhef::HEPEUP hepeup_ = evt->hepeup(); const std::vector<lhef::HEPEUP::FiveVector> pup_ = hepeup_.PUP; double pz1=(pup_[0])[3]; double pz2=(pup_[1])[3]; bjorken+=(pz1/(pz1+pz2)); } else { edm::Handle<HepMCProduct> evt; iEvent.getByLabel(generatedCollection_, evt); const HepMC::PdfInfo *pdf = evt->GetEvent()->pdf_info(); if(pdf){ bjorken = ((pdf->x1())/((pdf->x1())+(pdf->x2()))); } } xBjorkenHistory.insert(std::pair<double,edm::EventID>(bjorken,iEvent.id())); xBjorkenME->Fill(bjorken); }//analyze
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.
{ if(dbe){ dbe->setCurrentFolder("Generator/DuplicationCheck"); xBjorkenME = dbe->book1D("xBjorkenME", "x Bjorken ratio", 1000000, 0., 1.); } }
virtual void DuplicationChecker::beginRun | ( | const edm::Run & | , |
const edm::EventSetup & | |||
) | [inline, virtual] |
void DuplicationChecker::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 96 of file DuplicationChecker.cc.
References findValuesAssociatedWithKey(), i, edm::second(), and xBjorkenHistory.
{ itemList theObjects; theObjects.reserve(10); for (associationMap::iterator it = xBjorkenHistory.begin(); it != xBjorkenHistory.end(); it++) { double theKey = (*it).first; findValuesAssociatedWithKey(xBjorkenHistory, theKey, theObjects); if (theObjects.size() > 1) { edm::LogWarning("DuplicatedEventFound") << "Duplicated events found with xBjorken = " << std::fixed << std::setw(16) << std::setprecision(14) << theKey; for (unsigned int i = 0; i < theObjects.size(); i++) { edm::LogPrint("DuplicatedEventList") << "Event = " << (*theObjects[i]).second; } } theObjects.clear(); } }
virtual void DuplicationChecker::endRun | ( | const edm::Run & | , |
const edm::EventSetup & | |||
) | [inline, virtual] |
void DuplicationChecker::findValuesAssociatedWithKey | ( | associationMap & | mMap, |
double & | key, | ||
itemList & | theObjects | ||
) |
Definition at line 76 of file DuplicationChecker.cc.
Referenced by endJob().
{ associationMap::iterator itr; associationMap::iterator lastElement; theObjects.clear(); // locate an iterator to the first pair object associated with key itr = mMap.find(key); if (itr == mMap.end()) return; // no elements associated with key, so return immediately // get an iterator to the element that is one past the last element associated with key lastElement = mMap.upper_bound(key); // for each element in the sequence [itr, lastElement) for ( ; itr != lastElement; ++itr) theObjects.push_back(itr); }
DQMStore* DuplicationChecker::dbe [private] |
Definition at line 63 of file DuplicationChecker.h.
Referenced by beginJob(), and DuplicationChecker().
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().
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().