Jpp
Classes | Functions
JVoltageOptimizer_utils.hh File Reference
#include <iostream>
#include "TH2D.h"
#include "NBRun.hh"

Go to the source code of this file.

Classes

struct  event
 Structure to store the ToT mean and standard deviation of the hits produced by a nanobeacon in a source and target modules. More...
 

Functions

vector< pair< double, int > > optimize_voltage (vector< vector< event > > evt_table, double max_tot)
 Optimizes the voltage of each nanobeacon. More...
 

Function Documentation

◆ optimize_voltage()

vector< pair < double , int > > optimize_voltage ( vector< vector< event > >  evt_table,
double  max_tot 
)
inline

Optimizes the voltage of each nanobeacon.

Parameters
max_totmaximum allowed ToT value
evt_tabletable of event structures for each nanobeacon and run
Returns
vector of pairs with optimal voltage and corresponding run number

Definition at line 49 of file JVoltageOptimizer_utils.hh.

49  {
50 
51  int Nbeacons = evt_table.size() ;
52 
53  int Nruns = evt_table[0].size() ;
54 
55  vector < pair < double , int > > optimal_voltages (Nbeacons) ;
56 
57  for (int i=0 ; i<Nbeacons ; i++){
58 
59  for(int j=Nruns-1 ; j>=0 ; j--){
60 
61  if(evt_table[i][j].meanToT_ref < max_tot){
62 
63  cout << evt_table[i][j].meanToT_ref << "\t " << evt_table[i][j].V << endl ;
64 
65  optimal_voltages[i] = make_pair(evt_table[i][j].V , j);
66 
67  break ;
68 
69  }
70 
71  }
72 
73  }
74 
75  return optimal_voltages ;
76 
77 }
std::vector
Definition: JSTDTypes.hh:12
JTOOLS::j
int j
Definition: JPolint.hh:634