#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 | |
WeightManager | _wmanager |
DQMStore * | dbe |
edm::InputTag | generatedCollection_ |
bool | searchForLHE_ |
associationMap | xBjorkenHistory |
MonitorElement * | xBjorkenME |
Definition at line 40 of file DuplicationChecker.h.
typedef std::multimap<double,edm::EventID> DuplicationChecker::associationMap |
Definition at line 45 of file DuplicationChecker.h.
typedef std::vector<associationMap::iterator> DuplicationChecker::itemList |
Definition at line 46 of file DuplicationChecker.h.
DuplicationChecker::DuplicationChecker | ( | const edm::ParameterSet & | iPSet | ) | [explicit] |
Definition at line 14 of file DuplicationChecker.cc.
References dbe, cppFunctionSkipper::operator, and xBjorkenHistory.
: _wmanager(iPSet), generatedCollection_(iPSet.getParameter<edm::InputTag>("hepmcCollection")), searchForLHE_(iPSet.getParameter<bool>("searchForLHE")) { dbe = 0; dbe = edm::Service<DQMStore>().operator->(); xBjorkenHistory.clear(); }
DuplicationChecker::~DuplicationChecker | ( | ) | [virtual] |
Definition at line 25 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 41 of file DuplicationChecker.cc.
References _wmanager, MonitorElement::Fill(), generatedCollection_, edm::Event::getByLabel(), edm::Event::getByType(), hepeup_, edm::EventBase::id(), lhef::HEPEUP::PUP, searchForLHE_, CommonMethods::weight(), WeightManager::weight(), xBjorkenHistory, and xBjorkenME.
{ double bjorken = 0; double weight = _wmanager.weight(iEvent); 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,weight); }//analyze
void DuplicationChecker::beginJob | ( | void | ) | [virtual] |
Setting the DQM top directories
Booking the ME's
Reimplemented from edm::EDAnalyzer.
Definition at line 30 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 99 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 79 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); }
WeightManager DuplicationChecker::_wmanager [private] |
Definition at line 58 of file DuplicationChecker.h.
Referenced by analyze().
DQMStore* DuplicationChecker::dbe [private] |
Definition at line 66 of file DuplicationChecker.h.
Referenced by beginJob(), and DuplicationChecker().
Definition at line 60 of file DuplicationChecker.h.
Referenced by analyze().
bool DuplicationChecker::searchForLHE_ [private] |
Definition at line 62 of file DuplicationChecker.h.
Referenced by analyze().
Definition at line 64 of file DuplicationChecker.h.
Referenced by analyze(), DuplicationChecker(), endJob(), and ~DuplicationChecker().
MonitorElement* DuplicationChecker::xBjorkenME [private] |
Definition at line 68 of file DuplicationChecker.h.
Referenced by analyze(), and beginJob().