Jpp
JInterDomCal.cc
Go to the documentation of this file.
1 // c++ standard library
2 #include <string>
3 #include <iostream>
4 #include <sstream>
5 #include <iomanip>
6 #include <tuple>
7 
8 #include "TCanvas.h"
9 #include "TTree.h"
10 #include "RooPlot.h"
11 #include "TLine.h"
12 #include "TF1.h"
13 
14 
15 #include "JDetector/JPMTRouter.hh"
16 #include "JLang/JObjectID.hh"
17 
18 #include "JInterDomCal_IO.hh"
19 #include "JInterDomCal_utils.hh"
20 #include "Detector.hh"
21 #include "NBRun.hh"
22 
23 // namespaces
24 
25 using namespace std;
26 
27 
28 int main(int argc, char **argv) {
29 
30  // Read user inputs
31 
32  IO options ;
33 
34  read_options(options, argc, argv) ;
35 
36  // Read the detector file. Compute the time of flight of the light from one DOM to the other based on their positions and the difference between their t0s.
37 
38  JDetector detector = loadDetector(options.detector_file) ;
39 
40  NBRun run (options.ifname , detector , options.string_number , options.up_pmts , options.down_pmts , options.number_neighbors) ;
41 
42  cout << "Calibrating DOM t0s with run number: " << run.getRunNumber() << endl ;
43 
44  cout << options.ifname << endl ;
45 
46  run.analyze(options.analysis_level) ;
47 
48  JDetector new_det = Update_Detector(detector , run.getSuperModules()) ;
49 
50  write_output_det(options.ofname_detx , new_det) ;
51 
52  write_output_compare(options.ofname_txt , detector , new_det , options.string_number , options.ref_pmt , options.tgt_pmt) ;
53 
54  write_output_checks(options.ofname_checks , run) ;
55 
56 }
57 
58 
IO::analysis_level
int analysis_level
Definition: JInterDomCal_IO.hh:63
IO::ofname_checks
string ofname_checks
Definition: JInterDomCal_IO.hh:49
IO::down_pmts
int down_pmts
Definition: JInterDomCal_IO.hh:59
write_output_checks
void write_output_checks(string filename, NBRun &run)
Writes a .root file with some objects that can be used to check the calibration.
Definition: JInterDomCal_IO.hh:225
IO::ofname_detx
string ofname_detx
Definition: JInterDomCal_IO.hh:47
NBRun
Class dedicated to the nanobeacon analyses, where the Modules in the detector are not regarded as sin...
Definition: NBRun.hh:24
JObjectID.hh
read_options
int read_options(IO &options, int argc, char **argv)
Parses the command line options and fills an IO structure with them.
Definition: JInterDomCal_IO.hh:82
IO
Structure to store the different command line arguments for JRunAnalyzer.
Definition: JRunAnalyzer.cc:40
NBRun::getRunNumber
int getRunNumber()
Get run number.
Definition: NBRun.hh:427
Update_Detector
JDetector Update_Detector(JDetector detector, const vector< SuperModule * > &SuperMods)
Produces a new detector file by updating the existing t0s of the PMTs.
Definition: JInterDomCal_utils.hh:76
write_output_det
void write_output_det(string filename, const JDetector &detector)
Writes a .detx file with a JDetector.
Definition: JInterDomCal_IO.hh:139
JInterDomCal_IO.hh
NBRun::analyze
void analyze(int option)
Loops over all the SUPERMODULES.
Definition: NBRun.hh:140
IO::ref_pmt
int ref_pmt
Definition: JInterDomCal_IO.hh:65
IO::ifname
string ifname
Definition: JRunAnalyzer.cc:42
JInterDomCal_utils.hh
IO::up_pmts
int up_pmts
Definition: JInterDomCal_IO.hh:57
IO::ofname_txt
string ofname_txt
Definition: JInterDomCal_IO.hh:51
IO::string_number
int string_number
Definition: JInterDomCal_IO.hh:55
JDETECTOR::JDetector
Detector data structure.
Definition: JDetector.hh:80
IO::tgt_pmt
int tgt_pmt
Definition: JInterDomCal_IO.hh:67
JPMTRouter.hh
IO::detector_file
string detector_file
Definition: JRunAnalyzer.cc:46
std
Definition: jaanetDictionary.h:36
write_output_compare
void write_output_compare(string filename, const JDetector &old_detector, const JDetector &new_detector, int string_number, int ref_pmt, int tgt_pmt)
Writes a .txt with the comparison of the t0s in a given DU for two JDetectors.
Definition: JInterDomCal_IO.hh:163
loadDetector
JDetector loadDetector(string detectorFile)
Loads the content of a detector file in a JDetector object.
Definition: Detector.hh:28
Detector.hh
IO::number_neighbors
int number_neighbors
Definition: JInterDomCal_IO.hh:61
NBRun.hh
NBRun::getSuperModules
vector< SuperModule * > getSuperModules()
Get the SuperModules in the DU.
Definition: NBRun.hh:323
main
int main(int argc, char **argv)
Definition: JInterDomCal.cc:28