31 std::vector<BranchDescription const*>
46 void remove_whitespace(std::string&
s) {
47 s.erase(
std::remove(s.begin(), s.end(),
' '), s.end());
48 s.erase(
std::remove(s.begin(), s.end(),
'\t'), s.end());
51 void test_remove_whitespace() {
52 std::string
a(
"noblanks");
53 std::string
b(
"\t no blanks \t");
63 typedef std::pair<std::string, std::string> parsed_path_spec_t;
64 void parse_path_spec(std::string
const& path_spec,
65 parsed_path_spec_t&
output) {
66 std::string trimmed_path_spec(path_spec);
67 remove_whitespace(trimmed_path_spec);
70 if(colon == std::string::npos) {
71 output.first = trimmed_path_spec;
73 output.first = trimmed_path_spec.substr(0, colon);
74 output.second = trimmed_path_spec.substr(colon + 1,
75 trimmed_path_spec.size());
79 void test_parse_path_spec() {
80 std::vector<std::string>
paths;
81 paths.push_back(
"a:p1");
82 paths.push_back(
"b:p2");
83 paths.push_back(
" c");
84 paths.push_back(
"ddd\t:p3");
85 paths.push_back(
"eee: p4 ");
87 std::vector<parsed_path_spec_t> parsed(paths.size());
88 for(
size_t i = 0;
i < paths.size(); ++
i) {
89 parse_path_spec(paths[
i], parsed[i]);
92 assert(parsed[0].
first ==
"a");
93 assert(parsed[0].
second ==
"p1");
94 assert(parsed[1].
first ==
"b");
95 assert(parsed[1].
second ==
"p2");
96 assert(parsed[2].
first ==
"c");
97 assert(parsed[2].
second ==
"");
98 assert(parsed[3].
first ==
"ddd");
99 assert(parsed[3].
second ==
"p3");
100 assert(parsed[4].
first ==
"eee");
101 assert(parsed[4].
second ==
"p4");
108 test_remove_whitespace();
109 test_parse_path_spec();
116 remainingEvents_(maxEvents_),
118 hasNewlyDroppedBranch_(),
120 groupSelectorRules_(pset,
"outputCommands",
"OutputModule"),
122 moduleDescription_(),
125 wantAllEvents_(
false),
127 selector_config_id_(),
146 if(selectevents.
empty()) {
152 std::vector<std::string> path_specs =
153 selectevents.
getParameter<std::vector<std::string> >(
"SelectEvents");
155 if(path_specs.empty()) {
163 std::vector<parsed_path_spec_t> parsed_paths(path_specs.size());
164 for(
size_t i = 0;
i < path_specs.size(); ++
i) {
165 parse_path_spec(path_specs[
i], parsed_paths[i]);
183 ProductRegistry::ProductList::const_iterator it =
184 reg->productList().begin();
185 ProductRegistry::ProductList::const_iterator
end =
186 reg->productList().end();
188 for(; it !=
end; ++it) {
227 Event ev(const_cast<EventPrincipal&>(ep),
241 detail::CachedProducts&
p;
244 PVSentry(PVSentry
const&);
256 FDEBUG(2) <<
"writeEvent called\n";
295 FDEBUG(2) <<
"beginRun called\n";
305 FDEBUG(2) <<
"endRun called\n";
312 FDEBUG(2) <<
"writeRun called\n";
321 FDEBUG(2) <<
"beginLuminosityBlock called\n";
331 FDEBUG(2) <<
"endLuminosityBlock called\n";
337 FDEBUG(2) <<
"writeLuminosityBlock called\n";
431 static const std::string
kBaseType(
"OutputModule");
439 bool anyProductProduced) {
443 selectEventsInfo.
addParameter<
bool>(
"InProcessHistory", anyProductProduced);
445 std::vector<std::string> endPaths;
446 std::vector<int> endPathPositions;
450 if (!label.empty()) {
451 std::map<std::string, std::vector<std::pair<std::string, int> > >::const_iterator iter = outputModulePathPositions.find(label);
452 assert(iter != outputModulePathPositions.end());
453 for (std::vector<std::pair<std::string, int> >::const_iterator
i = iter->second.begin(),
e = iter->second.end();
455 endPaths.push_back(
i->first);
456 endPathPositions.push_back(
i->second);
459 selectEventsInfo.
addParameter<std::vector<std::string> >(
"EndPaths", endPaths);
460 selectEventsInfo.
addParameter<std::vector<int> >(
"EndPathPositions", endPathPositions);
461 if (!selectEventsInfo.
exists(
"SelectEvents")) {
462 selectEventsInfo.
addParameter<std::vector<std::string> >(
"SelectEvents", std::vector<std::string>());
472 if((*
i) && (*i)->productProvenancePtr() != 0) {
473 BranchID const& bid = (*i)->branchDescription().branchID();
476 it =
branchParents_.insert(std::make_pair(bid, std::set<ParentageID>())).first;
478 it->second.insert((*i)->productProvenancePtr()->parentageID());
489 std::set<ParentageID>
const& eIds =
i->second;
490 for(std::set<ParentageID>::const_iterator it = eIds.begin(), itEnd = eIds.end();
495 for(std::vector<BranchID>::const_iterator
j = parents.begin(), jEnd = parents.end();
nocap nocap const skelname & operator=(const skelname &)
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
T getParameter(std::string const &) const
virtual void doOpenFile()
virtual void writeProductDependencies()
std::vector< BranchDescription const * > getAllBranchDescriptions()
virtual void respondToCloseOutputFiles(FileBlock const &)
BranchType const & branchType() const
ModuleDescription moduleDescription_
virtual void writeFileFormatVersion()
bool doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, CurrentProcessingContext const *cpc)
const_iterator end() const
ModuleDescription const * moduleDescription() const
handle_t getOneTriggerResults(Event const &e)
ParameterSetID id() const
static ThreadSafeRegistry * instance()
CurrentProcessingContext const * current_context_
virtual void respondToOpenOutputFiles(FileBlock const &)
detail::CachedProducts selectors_
ParameterSet const & getParameterSet(ParameterSetID const &id)
virtual void writeIndexIntoFile()
virtual void endRun(RunPrincipal const &)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
boost::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
void insertEmpty(BranchID parent)
bool getMapped(key_type const &k, value_type &result) const
void insertChild(BranchID parent, BranchID child)
static const std::string & baseType()
void updateBranchParents(EventPrincipal const &ep)
virtual void beginRun(RunPrincipal const &)
virtual void finishEndFile()
static void fillDescription(ParameterSetDescription &desc, char const *parameterName)
bool selected(BranchDescription const &desc) const
virtual void writeParentageRegistry()
std::string const & moduleLabel() const
void doCloseFile()
Tell the OutputModule that is must end the current file.
std::vector< BranchID > const & parents() const
U second(std::pair< T, U > const &p)
void setEventSelectionInfo(std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
void run_all_output_module_tests()
std::string process_name_
virtual void endLuminosityBlock(LuminosityBlockPrincipal const &)
virtual void writeProcessConfigurationRegistry()
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
bool doEvent(EventPrincipal const &ep, EventSetup const &c, CurrentProcessingContext const *cpc)
ParameterSet const & getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
SelectionsArray keptProducts_
void addParameter(std::string const &name, T const &value)
void doWriteLuminosityBlock(LuminosityBlockPrincipal const &lbp)
void doPreForkReleaseResources()
virtual void beginLuminosityBlock(LuminosityBlockPrincipal const &)
GroupSelectorRules groupSelectorRules_
GroupSelector groupSelector_
void doRespondToCloseOutputFiles(FileBlock const &fb)
static void fillDescription(ParameterSetDescription &desc)
void copyForModify(ParameterSet const &other)
virtual void write(EventPrincipal const &e)=0
virtual bool isFileOpen() const
void doRespondToCloseInputFile(FileBlock const &fb)
virtual void writeFileIdentifier()
void fillDependencyGraph()
void setup(std::vector< parsed_path_spec_t > const &path_specs, std::vector< std::string > const &triggernames, const std::string &process_name)
virtual void postForkReacquireResources(unsigned int, unsigned int)
static void prevalidate(ConfigurationDescriptions &)
CurrentProcessingContext const * currentContext() const
virtual void writeRun(RunPrincipal const &)=0
const_iterator begin() const
void doWriteRun(RunPrincipal const &rp)
virtual void respondToOpenInputFile(FileBlock const &)
static void fillDescription(ParameterSetDescription &desc)
static const std::string kBaseType("EDAnalyzer")
bool doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, CurrentProcessingContext const *cpc)
boost::filter_iterator< FilledGroupPtr, GroupCollection::const_iterator > const_iterator
std::vector< std::string > const & getAllTriggerNames()
BranchChildren branchChildren_
bool selected(BranchDescription const &desc) const
Trig getTriggerResults(Event const &ep) const
virtual void writeParameterSetRegistry()
Strings const & getTrigPaths() const
void doRespondToOpenInputFile(FileBlock const &fb)
virtual void respondToCloseInputFile(FileBlock const &)
bool doEndRun(RunPrincipal const &rp, EventSetup const &c, CurrentProcessingContext const *cpc)
void configure(OutputModuleDescription const &desc)
virtual void openFile(FileBlock const &)
std::vector< BranchDescription const * > allBranchDescriptions() const
void setupDefault(std::vector< std::string > const &triggernames)
bool doBeginRun(RunPrincipal const &rp, EventSetup const &c, CurrentProcessingContext const *cpc)
void initialize(GroupSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
virtual void startEndFile()
ParameterSet const & registerIt()
virtual void writeBranchMapper()
virtual void writeLuminosityBlock(LuminosityBlockPrincipal const &)=0
ModuleDescription const & description() const
BranchParents branchParents_
virtual void preForkReleaseResources()
OutputModule(ParameterSet const &pset)
bool wantEvent(Event const &e)
virtual void writeBranchIDListRegistry()
virtual void writeProcessHistoryRegistry()
void doRespondToOpenOutputFiles(FileBlock const &fb)
virtual void writeProductDescriptionRegistry()
ParameterSetID selector_config_id_