1 #ifndef __PULSE_UTILS__
2 #define __PULSE_UTILS__
31 using namespace KM3NETDAQ ;
32 using namespace JSUPPORT;
33 using namespace JLANG;
34 using namespace JDETECTOR ;
57 double time_of_flight = distance_pmt_nb / c_w ;
61 double delta_traw = time_of_flight - delta_t0 ;
67 int total_offset = (int)round( delta_traw + stagger_delay + overall_delay);
90 int nHistosPerFloor = top_pmts.size() + max_distance * bottom_pmts.size() ;
96 for (
int tgt_floor = 1 ; tgt_floor <= nFloors ; ++tgt_floor){
102 for(
auto & top_pmt : top_pmts){
104 int total_offset =
get_offset(tgt_module.
getPMT(top_pmt) , tgt_module , c_w , options) ;
108 histograms[tgt_floor - 1][index] =
new TH2D( name , NULL , 400 , total_offset - 0.5 , 400 + total_offset - 0.5 , 256 , -0.5 , 255.5 ) ;
110 histograms[tgt_floor - 1][index]->SetOption(
"colz") ;
116 for (
int src_floor = tgt_floor - max_distance ; src_floor < tgt_floor ; ++src_floor){
122 for (
auto & bottom_pmt : bottom_pmts){
124 int total_offset =
get_offset(tgt_module.
getPMT(bottom_pmt) , src_module , c_w , options) ;
128 histograms[tgt_floor - 1][index] =
new TH2D( name , NULL , 400 , total_offset - 0.5 , 400 + total_offset - 0.5 , 256 , -0.5 , 255.5 ) ;
130 histograms[tgt_floor - 1][index]->SetOption(
"colz") ;
169 int slicecounter = 0 ;
193 buffer[hit->getPMT()].push_back(*hit) ;
199 for (
auto & top_pmt : top_pmts){
201 for (
int hit = 0 ; hit < (int)buffer[top_pmt].size() - 1 ; hit++){
203 double tot = buffer[top_pmt][hit].getToT() ;
205 double raw_time = buffer[top_pmt][hit].getT() ;
211 double mod_double = raw_time - pulse_period * int(raw_time/pulse_period) ;
213 histograms[module.
getFloor()-1][i]->Fill(mod_double , tot) ;
224 for (
auto & bottom_pmt : bottom_pmts){
226 for (
int hit = 0 ; hit < (int)buffer[bottom_pmt].size() - 1 ; hit++){
228 double tot = buffer[bottom_pmt][hit].getToT() ;
230 double raw_time = buffer[bottom_pmt][hit].getT() ;
236 double mod_double = raw_time - pulse_period * int(raw_time/pulse_period) ;
238 for (
int j = 1 ; j <= max_distance ; j++){
240 if (module.
getFloor() - j <=0)
continue ;
242 histograms[module.
getFloor() - 1][top_pmts.size() + (j-1)*bottom_pmts.size() + i]->Fill(mod_double , tot) ;
274 for (
int i=0 ; i<(int)ToT_vs_time.size() ; i++){
276 for (
int j=0 ; j<(int)ToT_vs_time[0].size() ; j++){
278 if (ToT_vs_time[i][j]==NULL) continue ;
280 TH1D* p_y = ToT_vs_time[i][j]->ProjectionY((
string(
"ToT_") + ToT_vs_time[i][j]->GetName()).c_str() , 1 , ToT_vs_time[i][j]->GetNbinsX()-1) ;
304 for (
int i=0 ; i<(int)ToT_vs_time.size() ; i++){
306 for (
int j=0 ; j<(int)ToT_vs_time[0].size() ; j++){
308 if (ToT_vs_time[i][j]==NULL) continue ;
310 TH1D* p_x = ToT_vs_time[i][j]->ProjectionX((
string(
"htime_") + ToT_vs_time[i][j]->GetName()).c_str() , 1 , ToT_vs_time[i][j]->GetNbinsY()-1) ;
unsigned int pulse_period_16ns
bool hasSuperFrame(const JDAQModuleIdentifier &module) const
Check presence of module.
virtual const pointer_type & next()
Get next element.
Data structure for all trigger parameters.
const JDAQSuperFrame & getSuperFrame(const JDAQModuleIdentifier &module) const
Get super frame.
Basic data structure for L0 hit.
Data structure for a composite optical module.
void configure(const JDAQTimeslice ×lice)
Configure.
Structure to store the different command line arguments for JRunAnalyzer.
Router for direct addressing of module data in detector data structure.
int numberOfBins
number of bins for lookup table of timeslice
int getNumberOfPMTs(const JModule &module)
Get number of PMTs.
Data structure for detector geometry and calibration.
vector< vector< TH1D * > > project_time(vector< vector< TH2D * > > ToT_vs_time)
Projects the hit time vs ToT histograms for all the combinations nanobeacon - pmt on the X axis...
vector< vector< TH2D * > > allocate_histograms(JDetector detector, IO options, double c_w, vector< int > top_pmts, vector< int > bottom_pmts, int max_distance)
Allocates histograms to store the tot vs time hit distribution for all the combinations nanobeacon - ...
JMultipleFileScanner ifnames
Basic data structure for L0 hit.
int getFloor() const
Get floor number.
int getString() const
Get string number.
vector< vector< TH1D * > > project_ToT(vector< vector< TH2D * > > ToT_vs_time)
Projects the hit time vs ToT histograms for all the combinations nanobeacon - pmt on the Y axis...
Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the op...
const_iterator begin() const
int getID() const
Get identifier.
Data structure for PMT geometry and calibration.
int getNumberOfFloors(const JDetector &detector)
Get number of floors.
const JPosition3D & getPosition() const
Get position.
const JPMT & getPMT(const int index) const
Get PMT.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
const JModule & getModule(const JModuleAddress &address) const
Get module parameters.
Direct access to module in detector data structure.
virtual bool hasNext()
Check availability of next element.
General purpose class for object reading from a list of file names.
ROOT TTree parameter settings.
KM3NeT DAQ constants, bit handling, etc.
void fill_histograms(vector< vector< TH2D * > > &histograms, IO options, JDetector detector, vector< int > top_pmts, vector< int > bottom_pmts, int max_distance)
Fills the hit time vs ToT histograms for all the combinations nanobeacon - pmt.
Data frame of one optical module.
int get_offset(JPMT pmt, JModule NB, double c_w, IO options)
Calculates an offset for a combinataion nanobeacon-pmt that allows to define the histogram range in a...
Timeslice data structure for L0 data.
Logical location of module.
const_iterator end() const
double getT0() const
Get time offset.