28 int main(
int argc,
char **argv)
36 int neighbour, setmax;
41 JParser<> zap(
"Program to extract time offsets of DOM-DOM correlations");
43 zap[
'f'] =
make_field(inputFile,
"input file") =
"monitor.root";
45 zap[
'a'] =
make_field(detectorFile,
"detector file");
46 zap[
'n'] =
make_field(neighbour,
"neighbour level") = 5;
47 zap[
'm'] =
make_field(setmax,
"minimal entries") = 5;
50 if (zap.
read(argc, argv) != 0) {
54 catch(
const exception &error) {
55 FATAL(error.what() << endl);
64 catch(
const JException& error) {
73 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
74 zmap[module->getString()][module->getFloor()] = module->getID();
85 TF1
f1(
"f1",
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2])) + [3]");
91 double maxarr[number_of_strings][number_of_strings][3];
92 int duarr[number_of_strings];
96 TFile*
in = TFile::Open(inputFile.c_str(),
"exist");
98 if (
in == NULL || !
in->IsOpen()) {
99 FATAL(
"File: " << inputFile <<
" not opened." << endl);
103 for (
const auto& string_1 : zmap) {
104 duarr[
string.getIndex(string_1.first)]=string_1.first;
106 for (
const auto& floor_1 : string_1.second) {
108 const int module_1 = floor_1.second;
116 for (
const auto& string_2 : zmap) {
117 duarr[
string.getIndex(string_2.first)]=string_2.first;
119 if (string_1.first != string_2.first) {
121 TH1D* h1 = H1[string_1.first][string_2.first].p;
125 h1 =
new TH1D(
MAKE_CSTRING(string_1.first <<
"_" << string_2.first <<
"_" << neighbour <<
".2T"), NULL,
126 h2->GetYaxis()->GetNbins(), h2->GetYaxis()->GetXmin(), h2->GetYaxis()->GetXmax());
128 H1[string_1.first][string_2.first].p = h1;
131 for (
const auto& floor_2 : string_2.second) {
132 if (floor_1.first > floor_2.first && (floor_1.first - floor_2.first) == neighbour) {
134 const int module_2 = floor_2.second;
136 TH1D* py = h2->ProjectionY(
"__py",
137 h2->GetXaxis()->FindBin(TString(Form(
"%i", module_2))),
138 h2->GetXaxis()->FindBin(TString(Form(
"%i", module_2))),
"e");
146 if (floor_1.first == 18){
148 double mm=h1->GetXaxis()->GetBinCenter(h1->GetMaximumBin());
150 f1.SetParameter(0,
double(h1->GetMaximum()));
151 f1.SetParameter(1,
double(mm));
152 f1.SetParameter(2, 50.);
156 if (h1->GetMaximum()>0){
158 h1->Fit(&f1,
"LQ",
"same");
162 maxarr[
string.getIndex(string_1.first) ][
string.getIndex(string_2.first) ][0] = h1->GetFunction(
"f1")->GetParameter(1);
163 maxarr[
string.getIndex(string_1.first) ][
string.getIndex(string_2.first) ][1] = h1->GetFunction(
"f1")->GetParameter(0);
164 maxarr[
string.getIndex(string_1.first) ][
string.getIndex(string_2.first) ][2] = h1->GetFunction(
"f1")->GetParameter(2);
173 for (
int i=0;i<number_of_strings;i++){
174 for (
int j=i+1;
j<number_of_strings;
j++){
175 if (maxarr[i][
j][1]>setmax && maxarr[
j][i][1]>setmax && maxarr[i][
j][2]>20. && maxarr[
j][i][2]>20.){
176 cout << i <<
" " <<
j <<
" " << maxarr[i][
j][0] <<
" " << maxarr[
j][i][0] <<
" " << (maxarr[i][
j][0]-maxarr[
j][i][0])/2. <<
" " << maxarr[i][
j][1] <<
" " << maxarr[
j][i][1] <<
" " <<
" " << duarr[i] <<
" " << duarr[
j] <<
" " << neighbour << endl;
187 for (
auto& h1 : H1) {
188 for (
auto& h2 : h1.second) {
189 h2.second.p->Write();
Utility class to parse command line options.
int main(int argc, char *argv[])
#define MAKE_CSTRING(A)
Make C-string.
Data structure for detector geometry and calibration.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
Direct access to string in detector data structure.
int read(const int argc, const char *const argv[])
Parse the program's command line options.
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
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