1 #ifndef __READOPTIONS__
2 #define __READOPTIONS__
20 using namespace JSUPPORT;
21 using namespace JLANG;
22 using namespace JDETECTOR;
43 string detector_file ;
96 if (zap.
read(argc, argv) != 0)
102 catch(
const exception &error) {
104 ERROR(error.what() << endl);
125 TFile* f =
new TFile(filename.c_str() ,
"recreate");
135 for (
auto & run : Runs){
137 sprintf(name ,
"RUN_%d_%2.1fV" , run->getRunNumber() , run->getVoltage()) ;
143 summary_refs[i]->Write() ;
145 for(
auto & sm : run->getSuperModules()){
147 sprintf(name ,
"RUN_%d_%2.1fV/NB_%d" , run->getRunNumber() , run->getVoltage() , sm->getFloor()) ;
153 for(
auto & spm : sm->get_ref_pmts()){
155 spm->getNBPulse()->gettime_vs_tot()->Write() ;
157 spm->getNBPulse()->gettime_peak()->Write() ;
159 spm->getNBPulse()->gettot_peak()->Write() ;
187 txtfile.open (filename);
189 txtfile <<
"# Table of optimal voltages: column 1 = floor , column 2 = voltage" << endl;
193 for (
auto & op : optimal_voltages){
195 txtfile << i+1 <<
"\t" << op.first << endl;
217 TFile* out_file =
new TFile(filename.c_str() ,
"recreate") ;
225 Run.Write(
"Run_Info") ;
227 int Ndoms = nFloors ;
231 for(
int i = 0 ; i < Ndoms ; ++i ) {
233 sprintf(dirname,
"S%iF%i", string_number, i + 1 ) ;
235 out_file->mkdir(dirname)->cd() ;
243 for (
auto & volt :optimal_voltages){
245 NBRun* r = Runs[volt.second] ;
249 for (
auto & tgt : targets){
251 int floor = tgt.first->getFloor() ;
253 sprintf( dirname ,
"S%iF%i", string_number , floor ) ;
255 out_file->cd(dirname) ;
257 for (
auto & spm : tgt.second){
259 spm->getNBPulse()->gettime_vs_tot()->Write() ;
265 sprintf(dirname ,
"S%iF%i", string_number , r->
getSuperModules()[nb_index]->getFloor()) ;
267 out_file->cd(dirname) ;
271 spm->getNBPulse()->gettime_vs_tot()->Write() ;
Utility class to parse command line options.
Logical location of module.
vector< SuperModule * > getSuperModules()
Get the SuperModules in the DU.
Structure to store the different command line arguments for JRunAnalyzer.
Data structure for detector geometry and calibration.
void write_output_opt(string filename, TTree *t, vector< TH2D * > summary_refs, vector< NBRun * > &Runs)
Writes a .root file with the optional output produced by JVoltageOptimizer.
JMultipleFileScanner ifnames
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
int read(const int argc, const char *const argv[])
Parse the program's command line options.
Utility class to parse command line options.
void write_output_txt(string filename, vector< pair< double, int > > optimal_voltages)
Writes a .txt file with the result produced by JVoltageOptimizer.
Class dedicated to the nanobeacon analyses, where the Modules in the detector are not regarded as sin...
int read_user_options(IO &options, int argc, char **argv)
Parses the command line options and fills an IO structure with them.
void write_output_cal(string filename, vector< pair< double, int > > &optimal_voltages, vector< NBRun * > &Runs, int string_number, int nFloors)
Writes a .root file with the optional output produced by JVoltageOptimizer.