Go to the source code of this file.
|
struct | IO |
| Structure to store the different command line arguments for JRunAnalyzer. More...
|
|
|
int | read_user_options (IO &options, int argc, char **argv) |
| Parses the command line options and fills an IO structure with them. More...
|
|
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. More...
|
|
void | write_output_txt (string filename, vector< pair< double, int > > optimal_voltages) |
| Writes a .txt file with the result produced by JVoltageOptimizer. More...
|
|
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. More...
|
|
◆ read_user_options()
int read_user_options |
( |
IO & |
options, |
|
|
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
|
inline |
Parses the command line options and fills an IO structure with them.
- Parameters
-
options | an option structure |
argc | the number of command line arguments |
argv | the command line arguments |
- Returns
- 1 if works 2 if it doesn't work
Definition at line 68 of file JVoltageOptimizer_IO.hh.
96 if (zap.
read(argc, argv) != 0)
102 catch(
const exception &error) {
104 ERROR(error.what() << endl);
◆ write_output_opt()
void write_output_opt |
( |
string |
filename, |
|
|
TTree * |
t, |
|
|
vector< TH2D * > |
summary_refs, |
|
|
vector< NBRun * > & |
Runs |
|
) |
| |
|
inline |
Writes a .root file with the optional output produced by JVoltageOptimizer.
- Parameters
-
filename | to output .root filex |
t | a root TTree. |
summary_refs | a TH2 with information of which reference pmts were used for optimizing the nano-beacon voltages. |
Runs | The list of nanobeacon Runs analyzed for the optimization. |
Definition at line 123 of file JVoltageOptimizer_IO.hh.
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() ;
◆ write_output_txt()
void write_output_txt |
( |
string |
filename, |
|
|
vector< pair< double, int > > |
optimal_voltages |
|
) |
| |
|
inline |
Writes a .txt file with the result produced by JVoltageOptimizer.
This file contains a list of nanobeacons and optimal voltages
- Parameters
-
filename | path to the name of the .txt file |
optimal_voltages | List of pairs containing optimal voltage and the corresponding run number for each nanobeacon |
Definition at line 183 of file JVoltageOptimizer_IO.hh.
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;
◆ write_output_cal()
void write_output_cal |
( |
string |
filename, |
|
|
vector< pair< double, int > > & |
optimal_voltages, |
|
|
vector< NBRun * > & |
Runs, |
|
|
int |
string_number, |
|
|
int |
nFloors |
|
) |
| |
|
inline |
Writes a .root file with the optional output produced by JVoltageOptimizer.
This file has the format needed by JInterDomCal to perform a calibration of the DU and contains the pulses corresponding to the optimized voltages.
- Parameters
-
filename | path to the name of the .root |
optimal_voltages | List of pairs containing optimal voltage and the corresponding run number for each nanobeacon |
Runs | vector of NBruns |
string_number | Number of the DU to calibrate. |
nFloors | Number of floors in the detector. |
Definition at line 215 of file JVoltageOptimizer_IO.hh.
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) ;
269 for (
auto & spm :
r->getSuperModules()[nb_index]->get_ref_pmts()){
271 spm->getNBPulse()->gettime_vs_tot()->Write() ;