CMS 3D CMS Logo

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

#include <EventSkipperByID.h>

Public Member Functions

 EventSkipperByID (ParameterSet const &pset)
 
bool skipIt (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
bool skippingEvents () const
 
bool skippingLumis () const
 
bool somethingToSkip () const
 
 ~EventSkipperByID ()
 

Static Public Member Functions

static std::auto_ptr
< EventSkipperByID
create (ParameterSet const &pset)
 
static void fillDescription (ParameterSetDescription &desc)
 

Private Attributes

EventNumber_t firstEvent_
 
LuminosityBlockNumber_t firstLumi_
 
RunNumber_t firstRun_
 
bool skippingEvents_
 
bool skippingLumis_
 
bool somethingToSkip_
 
std::vector< EventRangewhichEventsToProcess_
 
std::vector< EventRangewhichEventsToSkip_
 
std::vector< LuminosityBlockRangewhichLumisToProcess_
 
std::vector< LuminosityBlockRangewhichLumisToSkip_
 

Detailed Description

Definition at line 17 of file EventSkipperByID.h.

Constructor & Destructor Documentation

edm::EventSkipperByID::EventSkipperByID ( ParameterSet const &  pset)
explicit

Definition at line 7 of file EventSkipperByID.cc.

References edm::sortAndRemoveOverlaps(), whichEventsToProcess_, whichEventsToSkip_, whichLumisToProcess_, and whichLumisToSkip_.

Referenced by create().

7  :
8  // The default value provided as the second argument to the getUntrackedParameter function call
9  // is not used when the ParameterSet has been validated and the parameters are not optional
10  // in the description. As soon as all primary input sources and all modules with a secondary
11  // input sources have defined descriptions, the defaults in the getUntrackedParameterSet function
12  // calls can and should be deleted from the code.
13  firstRun_(pset.getUntrackedParameter<unsigned int>("firstRun", 1U)),
14  firstLumi_(pset.getUntrackedParameter<unsigned int>("firstLuminosityBlock", 0U)),
15  firstEvent_(pset.existsAs<unsigned int>("firstEvent", false) ? pset.getUntrackedParameter<unsigned int>("firstEvent") :
16  pset.getUntrackedParameter<unsigned long long>("firstEvent", 1U)),
17  whichLumisToSkip_(pset.getUntrackedParameter<std::vector<LuminosityBlockRange> >("lumisToSkip", std::vector<LuminosityBlockRange>())),
18  whichLumisToProcess_(pset.getUntrackedParameter<std::vector<LuminosityBlockRange> >("lumisToProcess", std::vector<LuminosityBlockRange>())),
19  whichEventsToSkip_(pset.getUntrackedParameter<std::vector<EventRange> >("eventsToSkip",std::vector<EventRange>())),
20  whichEventsToProcess_(pset.getUntrackedParameter<std::vector<EventRange> >("eventsToProcess",std::vector<EventRange>())),
24 
29  }
LuminosityBlockNumber_t firstLumi_
std::vector< LuminosityBlockRange > whichLumisToSkip_
std::vector< EventRange > whichEventsToProcess_
std::vector< LuminosityBlockRange > whichLumisToProcess_
std::vector< EventRange > whichEventsToSkip_
EventNumber_t firstEvent_
std::vector< EventRange > & sortAndRemoveOverlaps(std::vector< EventRange > &eventRange)
Definition: EventRange.cc:102
edm::EventSkipperByID::~EventSkipperByID ( )

Definition at line 31 of file EventSkipperByID.cc.

31 {}

Member Function Documentation

std::auto_ptr< EventSkipperByID > edm::EventSkipperByID::create ( ParameterSet const &  pset)
static

Definition at line 34 of file EventSkipperByID.cc.

References EventSkipperByID().

34  {
35  std::auto_ptr<EventSkipperByID> evSkp(new EventSkipperByID(pset));
36  if (!evSkp->somethingToSkip()) {
37  evSkp.reset();
38  }
39  return evSkp;
40  }
EventSkipperByID(ParameterSet const &pset)
void edm::EventSkipperByID::fillDescription ( ParameterSetDescription desc)
static

Definition at line 112 of file EventSkipperByID.cc.

References edm::ParameterSetDescription::addNode(), edm::ParameterSetDescription::addUntracked(), and edm::ParameterDescriptionNode::setComment().

Referenced by edm::RootPrimaryFileSequence::fillDescription(), edm::StreamerFileReader::fillDescriptions(), and dqmservices::DQMStreamerReader::fillDescriptions().

112  {
113 
114  desc.addUntracked<unsigned int>("firstRun", 1U)
115  ->setComment("Skip any run with run number < 'firstRun'.");
116  desc.addUntracked<unsigned int>("firstLuminosityBlock", 0U)
117  ->setComment("Skip any lumi in run 'firstRun' with lumi number < 'firstLuminosityBlock'.");
118 
119  desc.addNode( edm::ParameterDescription<unsigned int>("firstEvent", 1U, false) xor
120  edm::ParameterDescription<unsigned long long>("firstEvent", 1ULL, false))
121  ->setComment("'firstEvent' is an XOR group because it can have type uint32 or uint64, default:1\n"
122  "If 'firstLuminosityBlock' == 0, skip any event in run 'firstRun' with event number < 'firstEvent'.\n"
123  "If 'firstLuminosityBlock' != 0, skip any event in lumi 'firstRun:firstLuminosityBlock' with event number < 'firstEvent'.");
124 
125  std::vector<LuminosityBlockRange> defaultLumis;
126  desc.addUntracked<std::vector<LuminosityBlockRange> >("lumisToSkip", defaultLumis)
127  ->setComment("Skip any lumi inside the specified run:lumi range. In python do 'help(cms.LuminosityBlockRange)' for documentation.");
128  desc.addUntracked<std::vector<LuminosityBlockRange> >("lumisToProcess", defaultLumis)
129  ->setComment("If not empty, skip any lumi outside the specified run:lumi range. In python do 'help(cms.LuminosityBlockRange)' for documentation.");
130 
131  std::vector<EventRange> defaultEvents;
132  desc.addUntracked<std::vector<EventRange> >("eventsToSkip", defaultEvents)
133  ->setComment("Skip any event inside the specified run:event or run:lumi:event range. In python do 'help(cms.EventRange)' for documentation.");
134  desc.addUntracked<std::vector<EventRange> >("eventsToProcess", defaultEvents)
135  ->setComment("If not empty, skip any event outside the specified run:event or run:lumi:event range. In python do 'help(cms.EventRange)' for documentation.");
136  }
bool edm::EventSkipperByID::skipIt ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const

Definition at line 46 of file EventSkipperByID.cc.

References edm::binary_search_all(), firstEvent_, firstLumi_, firstRun_, edm::lessThan(), edm::lessThanSpecial(), lt, skippingEvents(), skippingLumis(), whichEventsToProcess_, whichEventsToSkip_, whichLumisToProcess_, and whichLumisToSkip_.

46  {
47 
48  if(run == 0U) run = 1U; // Correct zero run number
49  if(run < firstRun_) {
50  // Skip all entries before the first run.
51  return true;
52  }
53  if(lumi == 0U) {
54  // This is a run entry that is not before the first run.
55  // Keep it, since there are no other parameters to skip runs.
56  return false;
57  }
58  // If we get here, this is a lumi or event entry.
59  if(run == firstRun_) {
60  // This lumi or event entry is in the first run to be processed.
61  if(lumi < firstLumi_) {
62  // This lumi or event entry is for a lumi prior to the first lumi to be processed. Skip it.
63  return true;
64  }
65  if(firstLumi_ == 0 || lumi == firstLumi_) {
66  // If we get here, this entry is in the first lumi to be processed in the first run.
67  // Note that if firstLumi_ == 0, we are processing all lumis in the run.
68  if(event != 0U && event < firstEvent_) {
69  // This is an event entry prior to the first event to be processed. Skip it.
70  return true;
71  }
72  }
73  }
74  if (skippingLumis()) {
75  // If we get here, the entry was not skipped due to firstRun, firstLuminosityBlock, and/or firstEvent.
76  LuminosityBlockID lumiID = LuminosityBlockID(run, lumi);
77  LuminosityBlockRange lumiRange = LuminosityBlockRange(lumiID, lumiID);
78  bool(*lt)(LuminosityBlockRange const&, LuminosityBlockRange const&) = &lessThan;
79  if(binary_search_all(whichLumisToSkip_, lumiRange, lt)) {
80  // The entry is in a lumi specified in whichLumisToSkip. Skip it.
81  return true;
82  }
83  if(!whichLumisToProcess_.empty() && !binary_search_all(whichLumisToProcess_, lumiRange, lt)) {
84  // The entry is not in a lumi specified in non-empty whichLumisToProcess. Skip it.
85  return true;
86  }
87  }
88  if(event == 0U) {
89  // The entry is a lumi entry that was not skipped above. Keep it.
90  return false;
91  }
92  if (skippingEvents()) {
93  // If we get here, the entry was not skipped due to firstRun, firstLuminosityBlock, and/or firstEvent.
94  EventID eventID = EventID(run, lumi, event);
95  EventRange eventRange = EventRange(eventID, eventID);
96  EventID eventIDNoLumi = EventID(run, 0U, event);
97  EventRange eventRangeNoLumi = EventRange(eventIDNoLumi, eventIDNoLumi);
98  bool(*lt)(EventRange const&, EventRange const&) = &lessThanSpecial;
99  if(binary_search_all(whichEventsToSkip_, eventRange, lt) || binary_search_all(whichEventsToSkip_, eventRangeNoLumi, lt)) {
100  // The entry is an event specified in whichEventsToSkip. Skip it.
101  return true;
102  }
103  if(!whichEventsToProcess_.empty() && !binary_search_all(whichEventsToProcess_, eventRange, lt) && !binary_search_all(whichEventsToProcess_, eventRangeNoLumi, lt)) {
104  // The entry is not an event specified in non-empty whichEventsToProcess. Skip it.
105  return true;
106  }
107  }
108  return false;
109  }
bool skippingLumis() const
tuple lumi
Definition: fjr2json.py:35
LuminosityBlockNumber_t firstLumi_
bool skippingEvents() const
std::vector< LuminosityBlockRange > whichLumisToSkip_
std::vector< EventRange > whichEventsToProcess_
bool lessThanSpecial(EventRange const &lh, EventRange const &rh)
Definition: EventRange.cc:59
std::vector< LuminosityBlockRange > whichLumisToProcess_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< EventRange > whichEventsToSkip_
EventNumber_t firstEvent_
< trclass="colgroup">< tdclass="colgroup"colspan=5 > DT local reconstruction</td ></tr >< tr >< td >< ahref="classDTRecHit1DPair.html"> DTRecHit1DPair</a ></td >< td >< ahref="DataFormats_DTRecHit.html"> edm::RangeMap & lt
bool binary_search_all(ForwardSequence const &s, Datum const &d)
wrappers for std::binary_search
Definition: Algorithms.h:76
bool lessThan(EventRange const &lh, EventRange const &rh)
Definition: EventRange.cc:67
bool edm::EventSkipperByID::skippingEvents ( ) const
inline

Definition at line 23 of file EventSkipperByID.h.

References skippingEvents_.

Referenced by skipIt().

bool edm::EventSkipperByID::skippingLumis ( ) const
inline

Definition at line 22 of file EventSkipperByID.h.

References skippingLumis_.

Referenced by skipIt().

22 {return skippingLumis_;}
bool edm::EventSkipperByID::somethingToSkip ( ) const
inline

Definition at line 24 of file EventSkipperByID.h.

References somethingToSkip_.

Member Data Documentation

EventNumber_t edm::EventSkipperByID::firstEvent_
private

Definition at line 33 of file EventSkipperByID.h.

Referenced by skipIt().

LuminosityBlockNumber_t edm::EventSkipperByID::firstLumi_
private

Definition at line 32 of file EventSkipperByID.h.

Referenced by skipIt().

RunNumber_t edm::EventSkipperByID::firstRun_
private

Definition at line 31 of file EventSkipperByID.h.

Referenced by skipIt().

bool edm::EventSkipperByID::skippingEvents_
private

Definition at line 39 of file EventSkipperByID.h.

Referenced by skippingEvents().

bool edm::EventSkipperByID::skippingLumis_
private

Definition at line 38 of file EventSkipperByID.h.

Referenced by skippingLumis().

bool edm::EventSkipperByID::somethingToSkip_
private

Definition at line 40 of file EventSkipperByID.h.

Referenced by somethingToSkip().

std::vector<EventRange> edm::EventSkipperByID::whichEventsToProcess_
private

Definition at line 37 of file EventSkipperByID.h.

Referenced by EventSkipperByID(), and skipIt().

std::vector<EventRange> edm::EventSkipperByID::whichEventsToSkip_
private

Definition at line 36 of file EventSkipperByID.h.

Referenced by EventSkipperByID(), and skipIt().

std::vector<LuminosityBlockRange> edm::EventSkipperByID::whichLumisToProcess_
private

Definition at line 35 of file EventSkipperByID.h.

Referenced by EventSkipperByID(), and skipIt().

std::vector<LuminosityBlockRange> edm::EventSkipperByID::whichLumisToSkip_
private

Definition at line 34 of file EventSkipperByID.h.

Referenced by EventSkipperByID(), and skipIt().