Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
FWCore
Modules
src
IterateNTimesLooper.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: Modules
4
// Class : IterateNTimesLooper
5
//
6
// Implementation:
7
// <Notes on implementation>
8
//
9
// Original Author: Chris Jones
10
// Created: Tue Jul 11 11:16:14 EDT 2006
11
//
12
13
// system include files
14
15
// user include files
16
#include "
FWCore/Framework/interface/EDLooper.h
"
17
#include "
FWCore/Framework/interface/LooperFactory.h
"
18
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
19
20
namespace
edm {
21
22
class
IterateNTimesLooper
:
public
EDLooper
{
23
24
public
:
25
IterateNTimesLooper
(
ParameterSet
const
&);
26
virtual
~IterateNTimesLooper
();
27
28
// ---------- const member functions ---------------------
29
30
// ---------- static member functions --------------------
31
32
// ---------- member functions ---------------------------
33
virtual
void
startingNewLoop
(
unsigned
int
);
34
virtual
Status
duringLoop
(
Event
const
&,
EventSetup
const
&);
35
virtual
Status
endOfLoop
(
EventSetup
const
&,
unsigned
int
);
36
37
private
:
38
IterateNTimesLooper
(
IterateNTimesLooper
const
&);
// stop default
39
40
IterateNTimesLooper
const
&
operator=
(
IterateNTimesLooper
const
&);
// stop default
41
42
// ---------- member data --------------------------------
43
unsigned
int
max_
;
44
unsigned
int
times_
;
45
bool
shouldStop_
;
46
};
47
48
//
49
//
50
// constructors and destructor
51
//
52
IterateNTimesLooper::IterateNTimesLooper
(
ParameterSet
const
& iConfig) :
53
max_(iConfig.getParameter<unsigned int>(
"nTimes"
)),
54
times_(0),
55
shouldStop_(
false
) {
56
}
57
58
// IterateNTimesLooper::IterateNTimesLooper(IterateNTimesLooper const& rhs) {
59
// // do actual copying here;
60
// }
61
62
IterateNTimesLooper::~IterateNTimesLooper
() {
63
}
64
65
//
66
// assignment operators
67
//
68
// IterateNTimesLooper const& IterateNTimesLooper::operator=(IterateNTimesLooper const& rhs) {
69
// //An exception safe implementation is
70
// IterateNTimesLooper temp(rhs);
71
// swap(rhs);
72
//
73
// return *this;
74
// }
75
76
//
77
// member functions
78
//
79
void
80
IterateNTimesLooper::startingNewLoop
(
unsigned
int
iIteration) {
81
times_
= iIteration;
82
if
(iIteration >=
max_
) {
83
shouldStop_
=
true
;
84
}
85
}
86
87
EDLooper::Status
88
IterateNTimesLooper::duringLoop
(
Event
const
&,
EventSetup
const
&) {
89
return
shouldStop_
?
kStop
:
kContinue
;
90
}
91
92
EDLooper::Status
93
IterateNTimesLooper::endOfLoop
(
EventSetup
const
&,
unsigned
int
/*iCounter*/
) {
94
++
times_
;
95
return
(
times_
<
max_
) ?
kContinue
:
kStop
;
96
}
97
}
98
99
using
edm::IterateNTimesLooper
;
100
DEFINE_FWK_LOOPER
(
IterateNTimesLooper
);
edm::IterateNTimesLooper::duringLoop
virtual Status duringLoop(Event const &, EventSetup const &)
Definition:
IterateNTimesLooper.cc:88
edm::EDLooperBase::Status
Status
Definition:
EDLooperBase.h:74
funct::false
false
Definition:
Factorize.h:34
edm::IterateNTimesLooper::IterateNTimesLooper
IterateNTimesLooper(ParameterSet const &)
Definition:
IterateNTimesLooper.cc:52
DEFINE_FWK_LOOPER
#define DEFINE_FWK_LOOPER(type)
Definition:
LooperFactory.h:108
edm::EDLooperBase::kContinue
Definition:
EDLooperBase.h:74
ParameterSet.h
edm::IterateNTimesLooper::startingNewLoop
virtual void startingNewLoop(unsigned int)
Definition:
IterateNTimesLooper.cc:80
LooperFactory.h
edm::IterateNTimesLooper::~IterateNTimesLooper
virtual ~IterateNTimesLooper()
Definition:
IterateNTimesLooper.cc:62
edm::EDLooper
Definition:
EDLooper.h:28
edm::IterateNTimesLooper::operator=
IterateNTimesLooper const & operator=(IterateNTimesLooper const &)
edm::EventSetup
Definition:
EventSetup.h:44
edm::IterateNTimesLooper::max_
unsigned int max_
Definition:
IterateNTimesLooper.cc:43
edm::IterateNTimesLooper::endOfLoop
virtual Status endOfLoop(EventSetup const &, unsigned int)
Definition:
IterateNTimesLooper.cc:93
edm::IterateNTimesLooper
Definition:
IterateNTimesLooper.cc:22
edm::IterateNTimesLooper::times_
unsigned int times_
Definition:
IterateNTimesLooper.cc:44
edm::EDLooperBase::kStop
Definition:
EDLooperBase.h:74
edm::ParameterSet
Definition:
ParameterSet.h:35
EDLooper.h
edm::Event
Definition:
Event.h:50
edm::IterateNTimesLooper::shouldStop_
bool shouldStop_
Definition:
IterateNTimesLooper.cc:45
Generated for CMSSW Reference Manual by
1.8.5