1 #ifndef __PULSE_UTILS__
2 #define __PULSE_UTILS__
33 using namespace JLANG;
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) ;