Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
NBRun Class Reference

Class dedicated to the nanobeacon analyses, where the Modules in the detector are not regarded as single entities. More...

#include <NBRun.hh>

Public Member Functions

 NBRun ()
 Default constructor. More...
 
 NBRun (string filename_, JDetector detector_, int string_, int pmt_top, int pmt_bottom, int max_distance_)
 Constructor. More...
 
 ~NBRun ()
 Destructor. More...
 
void computeMeanToTs ()
 Loops over all the SUPERMODULES to compute the mean ToT of the hits from the different nanobeacon pulses recorded by the different PMTs. More...
 
void find_good_couples ()
 Loops over all the SUPERMODULES. More...
 
void analyze (int option)
 Loops over all the SUPERMODULES. More...
 
void readFile ()
 Reads a .root file containing the nanobeacon pulses observed by the different PMTs in the detector. More...
 
void findSrcs (SuperModule *sm, TFile *file)
 Searches in the .root file for histograms corresponding to pulses produced in one target supermodule, by all the possible sources. More...
 
void setSrcs (TFile *file)
 Loops over all the SuoperModules in the DU. More...
 
void setRefs (TFile *file)
 Loops over all the SuoperModules in the DU. More...
 
void findRefs (SuperModule *sm, TFile *file)
 Searches in the .root file for histograms corresponding to pulses produced in one supermodule, by its own nanobeacon. More...
 
vector< SuperModule * > getSuperModules ()
 Get the SuperModules in the DU. More...
 
void setPMTs (int top_option, int bottom_option)
 Select the PMTs in the upper and lower hemispheres of a DOM. More...
 
void initializeSuperModules ()
 Sets the references between the different SuperModules in the DU. More...
 
void setDetector (JDetector detector_)
 Sets the detector. More...
 
JDetector getDetector ()
 Get the detector. More...
 
void readBasicInfo (TFile *file)
 Reads the basic info from the .root file such as the run number and the nanobeacon voltage. More...
 
int getRunNumber ()
 Get run number. More...
 
double getVoltage ()
 Get nanobeacon voltage. More...
 

Private Attributes

vector< int > topPMTs
 
vector< int > bottomPMTs
 
vector< int > srcPMTs
 
vector< int > tgtPMTs
 
int nSuperModules
 
int max_distance
 
int string_number
 
string filename
 
int run_number
 
double voltage
 
JDetector detector
 
vector< SuperModule * > SuperMods
 

Detailed Description

Class dedicated to the nanobeacon analyses, where the Modules in the detector are not regarded as single entities.

Author
rgruiz Instead, they are related to the rest of the DOMs in a DU through the emission of the nanobeacon pulses. A DOM can be emitter (source) of light that is detected by other DOMS, and it can also be a receiver (target) of the light emitted by the other DOMS. The SUPERRUN class is meant to own the different SUPERMODULEs in a DU, to coherently set their mutual rerefences and to analyze the signal produced by the different nanobeacons in the different PMTs of the DU.

Definition at line 24 of file NBRun.hh.

Constructor & Destructor Documentation

NBRun::NBRun ( )
inline

Default constructor.

Definition at line 50 of file NBRun.hh.

50 {} ;
NBRun::NBRun ( string  filename_,
JDetector  detector_,
int  string_,
int  pmt_top,
int  pmt_bottom,
int  max_distance_ 
)
inline

Constructor.

It initializes the Structure of SuperModules and leaves it ready for analyzing it.

Parameters
filename_The name of a .root file containing the time vs ToT hit distributions for different PMTs in the DU
detector_A detector file with the DU that is going to be analyzed.
string_String number of the string to be analyzed (as it appears in the detector file)
pmt_topInteger number representing the user's choice
pmt_bottomInteger number representing the user's choice
max_distance_Integer number representing the maximum number of neighbors to for each module.

Definition at line 65 of file NBRun.hh.

65  :
66  nSuperModules (getNumberOfFloors(detector_))
67  {
68 
69  filename = filename_ ;
70 
71  string_number = string_ ;
72 
73  max_distance = max_distance_ ;
74 
75  setDetector (detector_) ;
76 
78 
79  setPMTs (pmt_top , pmt_bottom) ;
80 
81  readFile() ;
82 
83  }
void readFile()
Reads a .root file containing the nanobeacon pulses observed by the different PMTs in the detector...
Definition: NBRun.hh:170
int max_distance
Definition: NBRun.hh:30
int string_number
Definition: NBRun.hh:32
string filename
Definition: NBRun.hh:34
void setDetector(JDetector detector_)
Sets the detector.
Definition: NBRun.hh:384
int nSuperModules
Definition: NBRun.hh:28
int getNumberOfFloors(const JDetector &detector)
Get number of floors.
void setPMTs(int top_option, int bottom_option)
Select the PMTs in the upper and lower hemispheres of a DOM.
Definition: NBRun.hh:337
void initializeSuperModules()
Sets the references between the different SuperModules in the DU.
Definition: NBRun.hh:349
NBRun::~NBRun ( )
inline

Destructor.

Definition at line 90 of file NBRun.hh.

90  {
91 
92  for (auto & sm : SuperMods){
93 
94  delete(sm) ;
95 
96  }
97 
98  };
vector< SuperModule * > SuperMods
Definition: NBRun.hh:42

Member Function Documentation

void NBRun::computeMeanToTs ( )
inline

Loops over all the SUPERMODULES to compute the mean ToT of the hits from the different nanobeacon pulses recorded by the different PMTs.

Definition at line 105 of file NBRun.hh.

105  {
106 
107  for (auto & sm : SuperMods){
108 
109  sm->compute_mean_tot_ref() ;
110 
111  sm->compute_mean_tot_tgt() ;
112 
113  }
114 
115  }
vector< SuperModule * > SuperMods
Definition: NBRun.hh:42
void NBRun::find_good_couples ( )
inline

Loops over all the SUPERMODULES.

For each of them, it searches for good sources and good targets .

Definition at line 122 of file NBRun.hh.

122  {
123 
124  for (auto & sm : SuperMods){
125 
126  sm->select_good_srcs() ;
127 
128  sm->select_good_tgts() ;
129 
130  }
131 
132  }
vector< SuperModule * > SuperMods
Definition: NBRun.hh:42
void NBRun::analyze ( int  option)
inline

Loops over all the SUPERMODULES.

Analyzes the nanobeacon pulses detected by the different PMTs. After they have been analyzed, the method find_good_couples is called.

Parameters
optionLevel of analysis of the nanobeacon pulses. 0 for a fast analysis 1 for a fit to a model

Definition at line 140 of file NBRun.hh.

140  {
141 
142  for (auto & sm : SuperMods){
143 
144  switch(option){
145 
146  case 0 :
147 
148  sm->analyzeAll() ;
149 
150  break ;
151 
152  case 1 :
153 
154  sm->fitAll() ;
155 
156  break ;
157 
158  }
159 
160  }
161 
163 
164  }
vector< SuperModule * > SuperMods
Definition: NBRun.hh:42
void find_good_couples()
Loops over all the SUPERMODULES.
Definition: NBRun.hh:122
void NBRun::readFile ( )
inline

Reads a .root file containing the nanobeacon pulses observed by the different PMTs in the detector.

Definition at line 170 of file NBRun.hh.

170  {
171 
172  TFile* file = TFile::Open(filename.c_str()) ;
173 
174  readBasicInfo (file) ;
175 
176  setRefs (file) ;
177 
178  setSrcs (file) ;
179 
180  }
void setSrcs(TFile *file)
Loops over all the SuoperModules in the DU.
Definition: NBRun.hh:251
string filename
Definition: NBRun.hh:34
void setRefs(TFile *file)
Loops over all the SuoperModules in the DU.
Definition: NBRun.hh:268
void readBasicInfo(TFile *file)
Reads the basic info from the .root file such as the run number and the nanobeacon voltage...
Definition: NBRun.hh:409
void NBRun::findSrcs ( SuperModule sm,
TFile *  file 
)
inline

Searches in the .root file for histograms corresponding to pulses produced in one target supermodule, by all the possible sources.

Parameters
smsupermodule
fileroot file

Definition at line 190 of file NBRun.hh.

190  {
191 
192  int thisfloor = sm->getFloor () ;
193 
194  int thisstring = sm->getString () ;
195 
196  vector<SuperModule*> possible_srcs = sm->get_possible_srcs () ;
197 
198  for (auto & src : possible_srcs){
199 
200  int thatfloor = src->getFloor () ;
201 
202  int thatstring = src->getString () ;
203 
204  vector<SuperPMT*> spms ;
205 
206  char name[250] ;
207 
208  for (auto & pm : bottomPMTs){
209 
210  sprintf(name , "S%dF%d/S%dF%dPMT%d_beaconS%dF%d" , thisstring , thisfloor, thisstring , thisfloor , pm , thatstring , thatfloor);
211 
212  if (file -> Get (name) ){
213 
214  TH2D* h = (TH2D*)file -> Get(name) ;
215 
216  h->SetDirectory(0) ;
217 
218  JPMT pmt = sm->getPMT ( pm ) ;
219 
220  SuperPMT* p = new SuperPMT ( pmt , h , pm) ;
221 
222  spms.push_back (p) ;
223 
224  }
225 
226  }
227 
228  if(spms.size()>0){
229 
230  pair < SuperModule* , vector<SuperPMT*> > src_pair (src , spms) ;
231 
232  pair < SuperModule* , vector<SuperPMT*> > tgt_pair (sm , spms) ;
233 
234  sm->add_src (src_pair) ;
235 
236  src->add_tgt (tgt_pair) ;
237 
238  }
239 
240  }
241 
242  }
int getString()
Returns the string of this supermodule.
Definition: SUPERMODULE.hh:651
int getFloor()
Returns the floor of this supermodule.
Definition: SUPERMODULE.hh:638
Class containing a JPMT and a NBPulse object.
Definition: SUPERPMT.hh:22
Data structure for PMT geometry and calibration.
Definition: JPMT.hh:52
JPMT getPMT(int i)
Returns a JPMT from this supermodule.
Definition: SUPERMODULE.hh:625
vector< int > bottomPMTs
Definition: NBRun.hh:26
void add_src(pair< SuperModule *, vector< SuperPMT * > > p)
Adds a source.
Definition: SUPERMODULE.hh:599
vector< SuperModule * > get_possible_srcs()
Returns vector with pointers to all the supermodules below this one in the DU.
Definition: SUPERMODULE.hh:690
void NBRun::setSrcs ( TFile *  file)
inline

Loops over all the SuoperModules in the DU.

For each supermodule, it calls the findSrcs method.

Parameters
fileroot file

Definition at line 251 of file NBRun.hh.

251  {
252 
253  for(auto & sm : SuperMods){
254 
255  findSrcs (sm , file) ;
256 
257  }
258 
259  }
vector< SuperModule * > SuperMods
Definition: NBRun.hh:42
void findSrcs(SuperModule *sm, TFile *file)
Searches in the .root file for histograms corresponding to pulses produced in one target supermodule...
Definition: NBRun.hh:190
void NBRun::setRefs ( TFile *  file)
inline

Loops over all the SuoperModules in the DU.

For each supermodule, it calls the findRefs method.

Parameters
fileroot file

Definition at line 268 of file NBRun.hh.

268  {
269 
270  for (auto & sm : SuperMods){
271 
272  findRefs (sm , file) ;
273 
274  }
275 
276  }
vector< SuperModule * > SuperMods
Definition: NBRun.hh:42
void findRefs(SuperModule *sm, TFile *file)
Searches in the .root file for histograms corresponding to pulses produced in one supermodule...
Definition: NBRun.hh:286
void NBRun::findRefs ( SuperModule sm,
TFile *  file 
)
inline

Searches in the .root file for histograms corresponding to pulses produced in one supermodule, by its own nanobeacon.

Parameters
smsupermodule
fileroot file

Definition at line 286 of file NBRun.hh.

286  {
287 
288  int floor = sm->getFloor () ;
289 
290  int string = sm->getString () ;
291 
292  char name[250] ;
293 
294  for (auto & pm : topPMTs){
295 
296  sprintf(name , "S%dF%d/S%dF%dPMT%d_beaconS%dF%d" , string , floor, string , floor , pm , string , floor);
297 
298  if (file -> Get (name) ){
299 
300  TH2D* h = (TH2D*)file -> Get(name) ;
301 
302  h->SetDirectory(0) ;
303 
304  JPMT pmt = sm->getPMT ( pm ) ;
305 
306  SuperPMT* p = new SuperPMT (pmt , h , pm) ;
307 
308  sm->add_ref_pmt(p) ;
309 
310  }
311 
312  }
313 
314  }
int getString()
Returns the string of this supermodule.
Definition: SUPERMODULE.hh:651
int getFloor()
Returns the floor of this supermodule.
Definition: SUPERMODULE.hh:638
Class containing a JPMT and a NBPulse object.
Definition: SUPERPMT.hh:22
void add_ref_pmt(SuperPMT *superPM)
Adds a reference SUPERPMT to this supermodule.
Definition: SUPERMODULE.hh:716
Data structure for PMT geometry and calibration.
Definition: JPMT.hh:52
vector< int > topPMTs
Definition: NBRun.hh:26
JPMT getPMT(int i)
Returns a JPMT from this supermodule.
Definition: SUPERMODULE.hh:625
vector<SuperModule*> NBRun::getSuperModules ( )
inline

Get the SuperModules in the DU.

Returns
Vector of SuperModules

Definition at line 323 of file NBRun.hh.

323  {
324 
325  return SuperMods ;
326 
327  }
vector< SuperModule * > SuperMods
Definition: NBRun.hh:42
void NBRun::setPMTs ( int  top_option,
int  bottom_option 
)
inline

Select the PMTs in the upper and lower hemispheres of a DOM.

Parameters
top_optionuser choice
bottom_optionuser choice

Definition at line 337 of file NBRun.hh.

337  {
338 
339  topPMTs = setTopPMTs (top_option) ;
340 
341  bottomPMTs = setBottomPMTs (bottom_option) ;
342 
343  }
vector< int > setTopPMTs(int option)
Select the PMTs in the upper hemisphere of a DOM.
Definition: PMT_choice.hh:48
vector< int > setBottomPMTs(int option)
Select the PMTs in the lower hemisphere of a DOM.
Definition: PMT_choice.hh:100
vector< int > topPMTs
Definition: NBRun.hh:26
vector< int > bottomPMTs
Definition: NBRun.hh:26
void NBRun::initializeSuperModules ( )
inline

Sets the references between the different SuperModules in the DU.

Definition at line 349 of file NBRun.hh.

349  {
350 
351  SuperMods.resize(nSuperModules) ;
352 
353  for (int i = 0 ; i < (int)SuperMods.size() ; i++){
354 
356 
357  SuperModule* s_m = new SuperModule (m) ;
358 
359  for (int j = i+1 ; (j < i + 1 + max_distance) && (j<(int)nSuperModules) ; j++){
360 
361  s_m->add_possible_tgt(SuperMods[j]) ;
362 
363  }
364 
365  for (int j = max(i - max_distance , 0) ; j<i ; j++){
366 
367  s_m->add_possible_src(SuperMods[j]) ;
368 
369  }
370 
371  SuperMods[i] = s_m ;
372 
373  }
374 
375  }
vector< SuperModule * > SuperMods
Definition: NBRun.hh:42
Class dedicated to the nanobeacon analyses, where the Modules in the detector are not regarded as sin...
Definition: SUPERMODULE.hh:26
Data structure for a composite optical module.
Definition: JModule.hh:47
int max_distance
Definition: NBRun.hh:30
int string_number
Definition: NBRun.hh:32
void add_possible_src(SuperModule *super_m)
Adds a SUPERMODULE to the list of possible sources of this supermodule.
Definition: SUPERMODULE.hh:729
JDetector detector
Definition: NBRun.hh:40
void add_possible_tgt(SuperModule *super_m)
Adds a SUPERMODULE to the list of possible targets of this supermodule.
Definition: SUPERMODULE.hh:742
int nSuperModules
Definition: NBRun.hh:28
const JModule & getModule(const JModuleAddress &address) const
Get module parameters.
Definition: JDetector.hh:180
Logical location of module.
void NBRun::setDetector ( JDetector  detector_)
inline

Sets the detector.

Parameters
detector_a JDetector

Definition at line 384 of file NBRun.hh.

384  {
385 
386  detector = detector_ ;
387 
388  }
JDetector detector
Definition: NBRun.hh:40
JDetector NBRun::getDetector ( )
inline

Get the detector.

Returns
a JDetector

Definition at line 396 of file NBRun.hh.

396  {
397 
398  return detector ;
399 
400  }
JDetector detector
Definition: NBRun.hh:40
void NBRun::readBasicInfo ( TFile *  file)
inline

Reads the basic info from the .root file such as the run number and the nanobeacon voltage.

Parameters
fileroot file

Definition at line 409 of file NBRun.hh.

409  {
410 
411  filename = file->GetName() ;
412 
413  TVectorD* run_info = (TVectorD*)file->Get("Run_Info") ;
414 
415  run_number = (*run_info)(0) ;
416 
417  voltage = (*run_info)(1) ;
418 
419  }
string filename
Definition: NBRun.hh:34
int run_number
Definition: NBRun.hh:36
double voltage
Definition: NBRun.hh:38
int NBRun::getRunNumber ( )
inline

Get run number.

Returns
run number

Definition at line 427 of file NBRun.hh.

427  {
428 
429  return run_number ;
430 
431  }
int run_number
Definition: NBRun.hh:36
double NBRun::getVoltage ( )
inline

Get nanobeacon voltage.

Returns
nanobeacon voltage

Definition at line 439 of file NBRun.hh.

439  {
440 
441  return voltage ;
442 
443  }
double voltage
Definition: NBRun.hh:38

Member Data Documentation

vector<int> NBRun::topPMTs
private

Definition at line 26 of file NBRun.hh.

vector<int> NBRun::bottomPMTs
private

Definition at line 26 of file NBRun.hh.

vector<int> NBRun::srcPMTs
private

Definition at line 26 of file NBRun.hh.

vector<int> NBRun::tgtPMTs
private

Definition at line 26 of file NBRun.hh.

int NBRun::nSuperModules
private

Definition at line 28 of file NBRun.hh.

int NBRun::max_distance
private

Definition at line 30 of file NBRun.hh.

int NBRun::string_number
private

Definition at line 32 of file NBRun.hh.

string NBRun::filename
private

Definition at line 34 of file NBRun.hh.

int NBRun::run_number
private

Definition at line 36 of file NBRun.hh.

double NBRun::voltage
private

Definition at line 38 of file NBRun.hh.

JDetector NBRun::detector
private

Definition at line 40 of file NBRun.hh.

vector<SuperModule*> NBRun::SuperMods
private

Definition at line 42 of file NBRun.hh.


The documentation for this class was generated from the following file: