11 #include "TApplication.h"
13 #include "TGraphErrors.h"
31 double getCount (TH1D* hptr,
int muon_threshold) {
33 for (
int i = hptr->GetXaxis()->FindBin(muon_threshold); i <= hptr->GetNbinsX(); i++) {
34 count += hptr->GetBinContent(i);
39 double getLiveTime (TH1D* hptr,
const JModule& module) {
41 double livetime = hptr->GetBinContent(hptr->GetXaxis()->FindBin(label.c_str()));
53 int main(
int argc,
char **argv)
74 JParser<> zap(
"Auxiliary program to find depth dependence of multiplicity rates");
76 zap[
'f'] =
make_field(inputFile,
"JMM input file");
82 zap[
'M'] =
make_field(minMultiplicity,
"Minimum multiplicity") = 8;
83 zap[
'T'] =
make_field(minLiveTime_s,
"Minimum DOM livetime [s] to be eligible for plotting") = 3600;
88 catch(
const exception &error) {
89 FATAL(error.what() << endl);
107 FATAL(
"Empty detector." << endl);
113 NOTICE(
"Detector base UTM z [m]: " << utm_z << endl);
120 DEBUG(
"Loading input file " << inputFile << endl);
122 TFile*
in = TFile::Open(inputFile.c_str(),
"exist");
124 if (
in == NULL || !
in->IsOpen()) {
125 FATAL(
"File: " << inputFile <<
" not opened." << endl);
133 DEBUG(
"Loading livetime histogram from " << inputFile << endl);
135 TH1D* liveTime = (TH1D*)
in->Get(
"LiveTime");
137 if (liveTime == NULL) {
138 FATAL(
"Missing live time histogram.");
145 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
147 if (module->
getString() != line) {
continue; }
149 STATUS(
"Loading data histogram for from input file: " <<
getLabel(*module) <<
"\t ID = " << module->
getID() << endl);
151 TH1D* data_histogram = (TH1D*)
in->Get(TString(
getLabel(*module)) +
"_P");
153 if (data_histogram != NULL) {
155 double data_count =
getCount(data_histogram, minMultiplicity);
156 double data_livetime = getLiveTime(liveTime, *module);
158 double module_depth = - utm_z - module->
getZ();
160 if (data_livetime > minLiveTime_s) {
162 double val = data_count / data_livetime;
163 double err = sqrt(data_count) / data_livetime;
165 NOTICE(module_depth <<
" " << val << endl);
167 rate_val.push_back(val);
168 rate_err.push_back(err);
169 depth.push_back( module_depth);
178 TGraph* gr_data =
new TGraphErrors(
depth.size(), &
depth[0], &rate_val[0], 0, &rate_err[0]);
180 gr_data->SetTitle(TString(
"KM3NeT Preliminary; Depth [m]; Inclusive ") + Form(
"%d", minMultiplicity) + TString(
"-fold coincidence rate [Hz]"));
Utility class to parse command line options.
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
Data structure for a composite optical module.
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.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int getID() const
Get identifier.
General purpose messaging.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Direct access to module in detector data structure.
int getString() const
Get string number.
Normalisation of MUPAGE events.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
int getCount(const T &hit)
Get hit count.
do set_variable DETECTOR_TXT $WORKDIR detector
KM3NeT DAQ constants, bit handling, etc.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
double getZ() const
Get z position.
#define DEBUG(A)
Message macros.