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);
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);
102 for (
int ind_neighbour=1; ind_neighbour<=neighbour ; ind_neighbour++){
105 for (
const auto& string_1 : zmap) {
106 duarr[
string.getIndex(string_1.first)]=string_1.first;
108 for (
const auto& floor_1 : string_1.second) {
110 const int module_1 = floor_1.second;
118 for (
const auto& string_2 : zmap) {
119 duarr[
string.getIndex(string_2.first)]=string_2.first;
121 if (string_1.first != string_2.first) {
123 TH1D* h1 = H1[string_1.first][string_2.first].p;
127 h1 =
new TH1D(
MAKE_CSTRING(string_1.first <<
"_" << string_2.first <<
".2T"), NULL,
128 h2->GetYaxis()->GetNbins(), h2->GetYaxis()->GetXmin(), h2->GetYaxis()->GetXmax());
130 H1[string_1.first][string_2.first].p = h1;
133 for (
const auto& floor_2 : string_2.second) {
134 if (floor_1.first > floor_2.first && (floor_1.first - floor_2.first) == ind_neighbour) {
136 const int module_2 = floor_2.second;
138 TH1D* py = h2->ProjectionY(
"__py",
139 h2->GetXaxis()->FindBin(TString(Form(
"%i", module_2))),
140 h2->GetXaxis()->FindBin(TString(Form(
"%i", module_2))),
"e");
148 if (floor_1.first == 18){
150 double mm=h1->GetXaxis()->GetBinCenter(h1->GetMaximumBin());
152 f1.SetParameter(0,
double(h1->GetMaximum()));
153 f1.SetParameter(1,
double(mm));
154 f1.SetParameter(2, 50.);
158 if (h1->GetMaximum()>0){
160 h1->Fit(&f1,
"LQ",
"same");
164 maxarr[
string.getIndex(string_1.first) ][
string.getIndex(string_2.first) ][0] = h1->GetFunction(
"f1")->GetParameter(1);
165 maxarr[
string.getIndex(string_1.first) ][
string.getIndex(string_2.first) ][1] = h1->GetFunction(
"f1")->GetParameter(0);
166 maxarr[
string.getIndex(string_1.first) ][
string.getIndex(string_2.first) ][2] = h1->GetFunction(
"f1")->GetParameter(2);
175 for (
int i=0;i<number_of_strings;i++){
176 for (
int j=i+1;
j<number_of_strings;
j++){
177 if (maxarr[i][
j][1]>setmax && maxarr[
j][i][1]>setmax && maxarr[i][
j][2]>20. && maxarr[
j][i][2]>20.){
178 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] <<
" " << ind_neighbour << endl;
189 for (
auto& h1 : H1) {
190 for (
auto& h2 : h1.second) {
191 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.
Router for mapping of string identifier to index.
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