23 int main(
int argc,
char **argv)
36 JParser<> zap(
"Example program to test policy method for missing module data.");
38 zap[
'a'] =
make_field(detectorFile,
"Detector file");
40 zap[
'N'] =
make_field(size,
"Minimal size") = 1;
46 catch(
const exception &error) {
47 FATAL(error.what() << endl);
50 gRandom->SetSeed(seed);
52 if (P <= 0.0 || P > 1.0) {
53 FATAL(
"Invalid probability " <<
P << endl);
69 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
70 if (gRandom->Rndm() <=
P) {
71 buffer.insert(module->getID());
75 DEBUG(
"Number of modules " << buffer.size() <<
"/" <<
detector.size() << endl);
78 const JPolicy policy(router, buffer.begin(), buffer.end(), size);
80 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
82 const int id = module->getID();
86 cout <<
"module: " << setw(10) <<
id <<
' '
87 <<
getLabel(module->getLocation()) <<
' '
90 if (buffer.count(
id) == 0) {
94 const JPolicy::mapped_type
result = policy.at(
id);
96 for (JPolicy::mapped_type::const_iterator i = result.begin(); i != result.end(); ++i) {
Utility class to parse command line options.
int main(int argc, char *argv[])
const JModule & getModule(const JObjectID &id) const
Get module parameters.
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications.
Router for direct addressing of module data in detector data structure.
Data structure for detector geometry and calibration.
Auxiliary class to define policy for invalid modules.
const JLocation & getLocation() const
Get location.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
Direct access to module in detector data structure.
Policy for invalid modules.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG