24 int main(
int argc,
char **argv)
37 JParser<> zap(
"Example program to test policy method for missing module data.");
39 zap[
'a'] =
make_field(detectorFile,
"Detector file");
41 zap[
'N'] =
make_field(size,
"Minimal size") = 1;
47 catch(
const exception &error) {
48 FATAL(error.what() << endl);
51 gRandom->SetSeed(seed);
53 if (P <= 0.0 || P > 1.0) {
54 FATAL(
"Invalid probability " <<
P << endl);
78 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
79 strings[module->getString()].count += 1;
84 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
85 if (gRandom->Rndm() <=
P ||
strings[module->getString()].count == 1)
86 buffer.insert(module->getID());
88 strings[module->getString()].count -= 1;
91 DEBUG(
"Number of modules " << buffer.size() <<
"/" <<
detector.size() << endl);
94 const JPolicy policy(router, buffer.begin(), buffer.end(), size);
96 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
98 const int id = module->getID();
102 cout <<
"module: " << setw(10) <<
id <<
' '
103 <<
getLabel(module->getLocation()) <<
' '
104 << buffer.count(
id) << flush;
106 if (buffer.count(
id) == 0) {
110 if (module->getFloor() != 0) {
112 const JPolicy::mapped_type
result = policy.at(
id);
114 for (JPolicy::mapped_type::const_iterator i = result.begin(); i != result.end(); ++i) {
120 cout <<
' ' <<
"skip";
127 if (module->getFloor() != 0) {
128 ASSERT(buffer.count(
id) != 0 || !policy.at(
id).empty(),
"Test policy module at " << module->getLocation());
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.
then usage $script< detector specific pre-calibration script >< option > nAuxiliary script to make scan of pre stretching of detector strings(see JEditDetector)." "\nPossible options
Long64_t counter_type
Type definition for counter.
Data structure for detector geometry and calibration.
#define ASSERT(A,...)
Assert macro.
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.
do set_variable DETECTOR_TXT $WORKDIR detector
#define DEBUG(A)
Message macros.