Jpp test-rotations-old-57-g407471f53
the software that should make you happy
Loading...
Searching...
No Matches
JPrintAppliedWeights.cc File Reference

Program for printing the applied event-weights for each header type
contained in a given set of input files. More...

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program for printing the applied event-weights for each header type
contained in a given set of input files.

Author
bjjung

Definition in file JPrintAppliedWeights.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 110 of file JPrintAppliedWeights.cc.

111{
112 using namespace std;
113 using namespace JPP;
114
115
116 JMultipleFileScanner_t inputFiles;
117
118 JEvtWeightFactorMap factors;
119
120 int debug;
121
122 try {
123
124 JParser<> zap;
125
126 zap['f'] = make_field(inputFiles);
127 zap['@'] = make_field(factors) = JPARSER::initialised();
128 zap['d'] = make_field(debug) = 1;
129
130 zap(argc, argv);
131 }
132 catch(const exception& error) {
133 FATAL(error.what() << endl);
134 }
135
136
137 JEvtWeightFileScannerSet<> scanners(inputFiles);
138
139 if (scanners.setEvtWeightFactor(factors) == 0) {
140 WARNING("No flux functions set." << endl);
141 }
142
143 for (JEvtWeightFileScannerSet<>::iterator scanner = scanners.begin(); scanner != scanners.end(); ++scanner) {
144
145 const JHead& header = scanner->getHeader();
146 const JEvtWeight& weighter = scanner->getEvtWeighter();
147
148 const JEvtCategorySet categories = getCategories(header);
149
150 const JEvtWeightFactorHelper* p = dynamic_cast<const JEvtWeightFactorHelper*>(&weighter);
151
152 if (p == NULL) { continue; }
153
154 JEvtWeightFactorMap Fmap(factors.getOscProb());
155
156 if (*p) {
157
158 for (JEvtCategorySet::const_iterator i = categories.cbegin(); i != categories.cend(); ++i) {
159 Fmap.insert(*i, *p);
160 }
161
162 } else {
163
164 const JEvtWeightFactorHelper helper(make_shared<JEvtWeightFactorUndefined>());
165
166 for (JEvtCategorySet::const_iterator i = categories.cbegin(); i != categories.cend(); ++i) {
167 Fmap.insert(*i, helper);
168 }
169 }
170
171 NOTICE("scanner " << distance(scanners.begin(), scanner) << ":" << endl <<
172 "======================================================" << endl);
173 DEBUG (endl << header << endl << endl);
174 NOTICE(Fmap << endl);
175 }
176
177 return 0;
178}
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define NOTICE(A)
Definition JMessage.hh:64
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define WARNING(A)
Definition JMessage.hh:65
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Template specialisation for a map between event categories and event-weight factor products.
const JOscProbHelper & getOscProb() const
Get oscillation probability calculator.
Monte Carlo run header.
Definition JHead.hh:1236
const JHead & getHeader() const
Get header.
Definition JHead.hh:1270
Utility class to parse command line options.
Definition JParser.hh:1698
JEvtCategorySet getCategories(const JHead &header)
Auxiliary method to retrieve the unique event categories corresponding to a MC header.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Container for a set of event categories.
Helper class for event-weight factor.
Abstract base class for event weighing.
Definition JEvtWeight.hh:31
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68
Auxiliary class for organising Monte Carlo file scanners associated with event weighters.
std::vector< filescanner_type >::iterator iterator
Auxiliary base class for list of file names.