CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

EventIDChecker Class Reference

#include <FWCore/Modules/src/EventIDChecker.cc>

Inheritance diagram for EventIDChecker:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EventIDChecker (edm::ParameterSet const &)
 ~EventIDChecker ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Member Functions

virtual void analyze (edm::Event const &, edm::EventSetup const &)
virtual void beginJob ()
virtual void endJob ()
virtual void postForkReacquireResources (unsigned int iChildIndex, unsigned int iNumberOfChildren)

Private Attributes

std::vector< edm::EventIDids_
unsigned int index_
unsigned int multiProcessSequentialEvents_
bool mustSearch_
unsigned int numberOfEventsLeftBeforeSearch_

Detailed Description

Description: Checks that the events passed to it come in the order specified in its configuration

Implementation: <Notes on="" implementation>="">

Definition at line 37 of file EventIDChecker.cc.


Constructor & Destructor Documentation

EventIDChecker::EventIDChecker ( edm::ParameterSet const &  iConfig) [explicit]

Definition at line 70 of file EventIDChecker.cc.

                                                             :
  ids_(iConfig.getUntrackedParameter<std::vector<edm::EventID> >("eventSequence")),
  index_(0),
  multiProcessSequentialEvents_(iConfig.getUntrackedParameter<unsigned int>("multiProcessSequentialEvents")),
  numberOfEventsLeftBeforeSearch_(0),
  mustSearch_(false)
{
   //now do what ever initialization is needed

}
EventIDChecker::~EventIDChecker ( )

Definition at line 82 of file EventIDChecker.cc.

                                {

   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void EventIDChecker::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &   
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 107 of file EventIDChecker.cc.

References edm::EventID::event(), Exception, edm::EventBase::id(), ids_, index_, multiProcessSequentialEvents_, mustSearch_, numberOfEventsLeftBeforeSearch_, and edm::EventID::run().

                                                                    {
   if(mustSearch_) {
      if(0 == numberOfEventsLeftBeforeSearch_) {
         numberOfEventsLeftBeforeSearch_ = multiProcessSequentialEvents_;
         //the event must be after the last event in our list since multicore doesn't go backwards
         std::vector<edm::EventID>::iterator itFind= std::find_if(ids_.begin()+index_, ids_.end(), CompareWithoutLumi(iEvent.id()));
         if(itFind == ids_.end()) {
            throw cms::Exception("MissedEvent") << "The event " << iEvent.id() << "is not in the list.\n";
         }
         index_ = itFind-ids_.begin();
      }
      --numberOfEventsLeftBeforeSearch_;
   }

   if(index_ >= ids_.size()) {
      throw cms::Exception("TooManyEvents") << "Was passes " << ids_.size() << " EventIDs but have processed more events than that\n";
   }
   if(iEvent.id().run() != ids_[index_].run() || iEvent.id().event() != ids_[index_].event()) {
      throw cms::Exception("WrongEvent") << "Was expecting event " << ids_[index_] << " but was given " << iEvent.id() << "\n";
   }
   ++index_;
}
void EventIDChecker::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 132 of file EventIDChecker.cc.

                         {
}
void EventIDChecker::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 137 of file EventIDChecker.cc.

                       {
}
void EventIDChecker::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDAnalyzer.

Definition at line 142 of file EventIDChecker.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::addUntracked().

                                                                           {
  edm::ParameterSetDescription desc;
  desc.addUntracked<std::vector<edm::EventID> >("eventSequence");
  desc.addUntracked<unsigned int>("multiProcessSequentialEvents", 0U);
  descriptions.add("eventIDChecker", desc);
}
void EventIDChecker::postForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 150 of file EventIDChecker.cc.

References mustSearch_.

                                                                         {
   mustSearch_ = true;
}

Member Data Documentation

std::vector<edm::EventID> EventIDChecker::ids_ [private]

Definition at line 51 of file EventIDChecker.cc.

Referenced by analyze().

unsigned int EventIDChecker::index_ [private]

Definition at line 52 of file EventIDChecker.cc.

Referenced by analyze().

Definition at line 54 of file EventIDChecker.cc.

Referenced by analyze().

Definition at line 56 of file EventIDChecker.cc.

Referenced by analyze(), and postForkReacquireResources().

Definition at line 55 of file EventIDChecker.cc.

Referenced by analyze().