37 int neighbour, setmax;
42 JParser<> zap(
"Program to extract time offsets of DOM-DOM correlations");
44 zap[
'f'] =
make_field(inputFile,
"input file") =
"monitor.root";
46 zap[
'a'] =
make_field(detectorFile,
"detector file");
47 zap[
'n'] =
make_field(neighbour,
"neighbour level") = 5;
48 zap[
'm'] =
make_field(setmax,
"minimal entries") = 5;
51 if (zap.read(argc, argv) != 0) {
55 catch(
const exception &error) {
56 FATAL(error.what() << endl);
74 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
75 zmap[module->getString()][module->getFloor()] = module->getID();
86 TF1
f1(
"f1",
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2])) + [3]");
92 double maxarr[number_of_strings][number_of_strings][3];
93 int duarr[number_of_strings];
97 TFile* in = TFile::Open(inputFile.c_str(),
"exist");
99 if (in == NULL || !in->IsOpen()) {
100 FATAL(
"File: " << inputFile <<
" not opened." << endl);
104 for (
const auto& string_1 : zmap) {
105 duarr[
string.getIndex(string_1.first)]=string_1.first;
107 for (
const auto& floor_1 : string_1.second) {
109 const int module_1 = floor_1.second;
111 TH2D* h2 = (TH2D*) in->Get(
MAKE_CSTRING(module_1 <<
".2S"));
117 for (
const auto& string_2 : zmap) {
118 duarr[
string.getIndex(string_2.first)]=string_2.first;
120 if (string_1.first != string_2.first) {
122 TH1D* h1 = H1[string_1.first][string_2.first].p;
126 h1 =
new TH1D(
MAKE_CSTRING(string_1.first <<
"_" << string_2.first <<
"_" << neighbour <<
".2T"), NULL,
127 h2->GetYaxis()->GetNbins(), h2->GetYaxis()->GetXmin(), h2->GetYaxis()->GetXmax());
129 H1[string_1.first][string_2.first].p = h1;
132 for (
const auto& floor_2 : string_2.second) {
133 if (floor_1.first > floor_2.first && (floor_1.first - floor_2.first) == neighbour) {
135 const int module_2 = floor_2.second;
137 TH1D* py = h2->ProjectionY(
"__py",
138 h2->GetXaxis()->FindBin(TString(Form(
"%i", module_2))),
139 h2->GetXaxis()->FindBin(TString(Form(
"%i", module_2))),
"e");
147 if (floor_1.first == 18){
149 double mm=h1->GetXaxis()->GetBinCenter(h1->GetMaximumBin());
151 f1.SetParameter(0,
double(h1->GetMaximum()));
152 f1.SetParameter(1,
double(mm));
153 f1.SetParameter(2, 50.);
155 for (Int_t i = 0; i !=
f1.GetNpar(); ++i) {
156 f1.SetParError(i, 0.0);
161 if (h1->GetMaximum()>0){
163 h1->Fit(&
f1,
"LQ",
"same");
167 maxarr[
string.getIndex(string_1.first) ][
string.getIndex(string_2.first) ][0] = h1->GetFunction(
"f1")->GetParameter(1);
168 maxarr[
string.getIndex(string_1.first) ][
string.getIndex(string_2.first) ][1] = h1->GetFunction(
"f1")->GetParameter(0);
169 maxarr[
string.getIndex(string_1.first) ][
string.getIndex(string_2.first) ][2] = h1->GetFunction(
"f1")->GetParameter(2);
178 for (
int i=0;i<number_of_strings;i++){
179 for (
int j=i+1;
j<number_of_strings;
j++){
180 if (maxarr[i][
j][1]>setmax && maxarr[
j][i][1]>setmax && maxarr[i][
j][2]>20. && maxarr[
j][i][2]>20.){
181 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;
192 for (
auto& h1 : H1) {
193 for (
auto& h2 : h1.second) {
194 h2.second.p->Write();
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
Utility class to parse command line options.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Router for mapping of string identifier to index.