27 using namespace JDETECTOR ;
30 using namespace JSUPPORT;
31 using namespace JLANG;
32 using namespace JDETECTOR;
45 string detector_file ;
114 if (zap.
read(argc, argv) != 0)
120 catch(
const exception &error) {
122 ERROR(error.what() << endl);
141 store(filename , detector) ;
143 cout << endl <<
"New detector stored in file: " << endl ;
145 cout << filename << endl ;
147 cout <<
"------------------------------------" << endl << endl ;
165 if (filename.length()==0){
167 cout <<
"Omitting comparison with old detector" << endl ;
173 cout <<
"Writing comparison between new and old detx in file: " << endl ;
175 cout << filename << endl ;
177 cout <<
"------------------------------------" << endl << endl ;
189 txtfile.open (filename);
191 txtfile <<
"# Comparison between detector files: column 1 = Delta_t0 new detx , column 2 = Delta_t0 old detx , column 3 = column1 - column 2" << endl;
193 for(
int i=0 ; i<(int)t0_diff_new.size() ; i++){
195 txtfile << t0_diff_new[i] <<
"\t" << t0_diff_old[i] <<
"\t" << t0_diff_new[i] - t0_diff_old[i] << endl;
199 txtfile <<
"\n# t0 vs depth: column 1 = floor , columns 2,3,4 = depth_new, mean_centered_t0_new , error_new , columns 5,6,7 = depth_old, mean_centered_t0_old , error_old , column 8 = t0_old - t0_new " << endl ;
201 for (
int i=0 ; i < (int)t0_vs_depth_new.size() ; i++){
203 txtfile << i+1 <<
"\t"
204 << get<0>(t0_vs_depth_new[i]) <<
"\t"
205 << get<1>(t0_vs_depth_new[i]) <<
"\t"
206 << get<2>(t0_vs_depth_new[i]) <<
"\t"
207 << get<0>(t0_vs_depth_old[i]) <<
"\t"
208 << get<1>(t0_vs_depth_old[i]) <<
"\t"
209 << get<2>(t0_vs_depth_old[i]) <<
"\t"
210 << get<1>(t0_vs_depth_new[i]) - get<1>(t0_vs_depth_old[i]) << endl ;
227 if (filename.length()==0){
229 cout <<
"Omitting calibration checks..." << endl ;
235 cout <<
"Writing calibration checks in file: " << endl ;
237 cout << filename << endl ;
239 cout <<
"------------------------------------" << endl << endl ;
241 TFile outfile(filename.c_str() ,
"recreate") ;
255 outfile.mkdir(
"REF/Good") ;
256 outfile.mkdir(
"REF/Weak") ;
257 outfile.mkdir(
"REF/Saturated") ;
259 outfile.mkdir(
"TGT/Good") ;
260 outfile.mkdir(
"TGT/Weak") ;
261 outfile.mkdir(
"TGT/Saturated") ;
266 for (
auto & sm : SuperMods){
268 for (
auto & spm : sm->get_ref_pmts()){
270 if (spm->getNBPulse()->IsGood()==
true) outfile.cd(
"REF/Good") ;
272 if (spm->getNBPulse()->IsSaturatedHit()==
true) outfile.cd(
"REF/Saturated") ;
274 if (spm->getNBPulse()->IsWeak()==
true) outfile.cd(
"REF/Weak") ;
276 spm->getNBPulse()->getHtime_full()->Write() ;
278 if (spm->getNBPulse()->IsFitted()==
true){
280 RooWorkspace w = spm->getNBPulse()->getWorkspace() ;
282 TH1D* h = spm->getNBPulse()->getHtime_full() ;
296 for (
auto & sms : sm->get_sources()){
298 for (
auto & spm : sms.second){
300 if (spm->getNBPulse()->IsGood()==
true) outfile.cd(
"TGT/Good") ;
302 if (spm->getNBPulse()->IsSaturatedHit()==
true) outfile.cd(
"TGT/Saturated") ;
304 if (spm->getNBPulse()->IsWeak()==
true) outfile.cd(
"TGT/Weak") ;
306 spm->getNBPulse()->getHtime_full()->Write() ;
308 if (spm->getNBPulse()->IsFitted()==
true){
310 RooWorkspace w = spm->getNBPulse()->getWorkspace() ;
312 TH1D* h = spm->getNBPulse()->getHtime_full() ;
Utility class to parse command line options.
vector< tuple< double, double, double > > get_t0_offsets_vs_depth(int strNr, const JDetector &detector)
Logical location of module.
vector< SuperModule * > getSuperModules()
Get the SuperModules in the DU.
void write_output_checks(string filename, NBRun &run)
Writes a .root file with some objects that can be used to check the calibration.
Structure to store the different command line arguments for JRunAnalyzer.
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.
Data structure for detector geometry and calibration.
int read_options(IO &options, int argc, char **argv)
Parses the command line options and fills an IO structure with them.
void write_output_det(string filename, const JDetector &detector)
Writes a .detx file with a JDetector.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
TH2D * good_refs_th2(NBRun *Run)
Produces a TH2 to be read as a table that summarizes which pmts were used as good references for each...
TH2D * good_tgt_pmts_th2(NBRun *Run)
Produces a TH2 to be read as a table that summarizes which pmts were used as good references for each...
Direct access to PMT in detector data structure.
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.
TCanvas * c1
Global variables to handle mouse events.
int read(const int argc, const char *const argv[])
Parse the program's command line options.
Utility class to parse command line options.
void store(const JString &file_name, const JDetector &detector)
Store detector to output file.
TH2D * tgts_th2(NBRun *Run)
Produces a TH2 to be interpreted as a table that summarizes which modules were targets for each sourc...
Class dedicated to the nanobeacon analyses, where the Modules in the detector are not regarded as sin...
TCanvas * RooCanvas(RooWorkspace w, TH1D *h)
Produces a TCanvas with the nanobeacon peak and the fit performed with Roofit.
TH2D * srcs_th2(NBRun *Run)
Produces a TH2 to be read as a table that summarizes which modules were used as good sources for each...
vector< double > getDetFile_t0_differences(int strNr, JDetector detector, int ref_pmt, int tgt_pmt)
Loops over the floors in the string chosen by the user.