#include <string>
#include <iostream>
#include <sstream>
#include <iomanip>
#include "TCanvas.h"
#include "RooPlot.h"
#include "RooDerivative.h"
#include "TLine.h"
#include "TF1.h"
#include "NBRun.hh"
#include "Detector.hh"
Go to the source code of this file.
|
TH2D * | refs_th2 (NBRun *Run) |
| Produces a TH2 to be read as a table that summarizes which pmts were used as references for each module. More...
|
|
TH2D * | good_refs_th2 (NBRun *Run) |
| Produces a TH2 to be read as a table that summarizes which pmts were used as good references for each module. More...
|
|
TH2D * | good_tgt_pmts_th2 (NBRun *Run) |
| Produces a TH2 to be read as a table that summarizes which pmts were used as good references for each module. More...
|
|
TH2D * | srcs_th2 (NBRun *Run) |
| Produces a TH2 to be read as a table that summarizes which modules were used as good sources for each target module. More...
|
|
TH2D * | tgts_th2 (NBRun *Run) |
| Produces a TH2 to be interpreted as a table that summarizes which modules were targets for each source module. More...
|
|
TCanvas * | RooCanvas (RooWorkspace w, TH1D *h) |
| Produces a TCanvas with the nanobeacon peak and the fit performed with Roofit. More...
|
|
TH2D* refs_th2 |
( |
NBRun * |
Run | ) |
|
|
inline |
Produces a TH2 to be read as a table that summarizes which pmts were used as references for each module.
- Parameters
-
Run | a pointer to a nanobeacon run |
- Returns
- A TH2
Definition at line 27 of file Control_utils.hh.
37 sprintf(name ,
"refs_Run_%d_%2.1fV", run_number , voltage) ;
41 sprintf(title ,
"Used reference PMTs") ;
43 TH2D* refs =
new TH2D(name , title , 18 , 0.5 , 18.5 , 12 , -0.5 , 11.5) ;
45 for (
auto & sm : SuperMods) {
47 if (sm->get_ref_pmts().size()>0) {
49 for (
auto & ref : sm->get_ref_pmts()) {
51 refs->Fill(sm->getFloor() , ref->getChannel()) ;
59 refs->GetXaxis()->SetTitle(
"Nanobeacon Floor") ;
61 refs->GetYaxis()->SetTitle(
"PMT Channel (FPGA)") ;
63 refs->SetOption(
"colz") ;
vector< SuperModule * > getSuperModules()
Get the SuperModules in the DU.
double getVoltage()
Get nanobeacon voltage.
int getRunNumber()
Get run number.
TH2D* good_refs_th2 |
( |
NBRun * |
Run | ) |
|
|
inline |
Produces a TH2 to be read as a table that summarizes which pmts were used as good references for each module.
- Parameters
-
Run | a pointer to a nanobeacon run |
- Returns
- A TH2
Definition at line 79 of file Control_utils.hh.
89 sprintf(name ,
"refs_Run_%d_%2.1fV", run_number , voltage) ;
93 sprintf(title ,
"Used reference PMTs") ;
95 TH2D* refs =
new TH2D(name , title , 18 , 0.5 , 18.5 , 12 , -0.5 , 11.5) ;
97 for (
auto & sm : SuperMods) {
99 if (sm->get_ref_pmts().size()>0) {
101 for (
auto & ref : sm->get_ref_pmts()) {
103 refs->Fill(sm->getFloor() , ref->getChannel()) ;
105 if (ref->getNBPulse()->IsGood()==
true){
107 refs->Fill(sm->getFloor() , ref->getChannel()) ;
117 refs->GetXaxis()->SetTitle(
"Nanobeacon Floor") ;
119 refs->GetYaxis()->SetTitle(
"PMT Channel (FPGA)") ;
121 refs->SetOption(
"colz") ;
vector< SuperModule * > getSuperModules()
Get the SuperModules in the DU.
double getVoltage()
Get nanobeacon voltage.
int getRunNumber()
Get run number.
TH2D* good_tgt_pmts_th2 |
( |
NBRun * |
Run | ) |
|
|
inline |
Produces a TH2 to be read as a table that summarizes which pmts were used as good references for each module.
- Parameters
-
Run | a pointer to a nanobeacon run |
- Returns
- A TH2
Definition at line 136 of file Control_utils.hh.
146 sprintf(name ,
"tgt_pmts_Run_%d_%2.1fV", run_number , voltage) ;
150 sprintf(title ,
"Target PMTs used for the closest good source.") ;
152 TH2D* tgts =
new TH2D(name , title , 18 , 0.5 , 18.5 , 19 , 11.5 , 30.5) ;
154 for (
auto & sm : SuperMods) {
156 if(sm->has_good_sources()==
true){
158 for (
auto & spm : sm->get_closest_good_source().second){
160 tgts->Fill(sm->getFloor() , spm->getChannel());
162 if (spm->getNBPulse()->IsGood()==
true){
164 tgts->Fill(sm->getFloor() , spm->getChannel());
174 tgts->GetXaxis()->SetTitle(
"Nanobeacon Floor") ;
176 tgts->GetYaxis()->SetTitle(
"PMT Channel (FPGA)") ;
178 tgts->SetOption(
"colz") ;
vector< SuperModule * > getSuperModules()
Get the SuperModules in the DU.
double getVoltage()
Get nanobeacon voltage.
int getRunNumber()
Get run number.
TH2D* srcs_th2 |
( |
NBRun * |
Run | ) |
|
|
inline |
Produces a TH2 to be read as a table that summarizes which modules were used as good sources for each target module.
- Parameters
-
Run | a pointer to a nanobeacon run |
- Returns
- A TH2
Definition at line 194 of file Control_utils.hh.
204 sprintf(name ,
"srcs_Run_%d_%2.1fV", run_number , voltage) ;
208 sprintf(title ,
"Sources for each target module.") ;
210 TH2D* srcs =
new TH2D(name , title , 18 , 0.5 , 18.5 , 18 , 0.5 , 18.5);
212 for(
auto & sm : SuperMods){
214 int thisfloor = sm->getFloor() ;
216 if(sm->get_sources().size()>0){
218 for (
auto & src : sm->get_sources()){
220 int thatfloor = src.first->getFloor();
222 srcs->Fill(thisfloor , thatfloor ) ;
227 if(sm->get_good_sources().size()>0){
229 for (
auto & src : sm->get_good_sources()){
231 int thatfloor = src.first->getFloor();
233 srcs->Fill(thisfloor , thatfloor) ;
236 int thatfloor = sm->get_closest_good_source().first->getFloor();
238 srcs->Fill(thisfloor , thatfloor) ;
243 srcs->GetXaxis()->SetTitle(
"Target Floor") ;
245 srcs->GetYaxis()->SetTitle(
"Source Floor") ;
247 srcs->SetOption(
"colz") ;
vector< SuperModule * > getSuperModules()
Get the SuperModules in the DU.
double getVoltage()
Get nanobeacon voltage.
int getRunNumber()
Get run number.
TH2D* tgts_th2 |
( |
NBRun * |
Run | ) |
|
|
inline |
Produces a TH2 to be interpreted as a table that summarizes which modules were targets for each source module.
- Parameters
-
Run | a pointer to a nanobeacon run |
- Returns
- A TH2
Definition at line 262 of file Control_utils.hh.
272 sprintf(name ,
"tgts_Run_%d_%2.1fV", run_number , voltage) ;
276 sprintf(title ,
"Targets for each source module.") ;
278 TH2D* tgts =
new TH2D(name , title , 18 , 0.5 , 18.5 , 18 , 0.5 , 18.5) ;
280 for(
auto & sm : SuperMods){
282 int thisfloor = sm->getFloor() ;
284 if(sm->get_targets().size()>0){
286 for (
auto & tgt : sm->get_targets()){
288 int thatfloor = tgt.first->getFloor() ;
290 tgts->Fill(thisfloor , thatfloor ) ;
295 if(sm->get_good_targets().size()>0){
297 for (
auto & tgt : sm->get_good_targets()){
299 int thatfloor = tgt.first->getFloor() ;
301 tgts->Fill(thisfloor , thatfloor) ;
305 int thatfloor = sm->get_closest_good_target().first->getFloor() ;
307 tgts->Fill(thisfloor , thatfloor) ;
312 tgts->SetOption(
"colz") ;
314 tgts->GetXaxis()->SetTitle(
"Source Floor") ;
316 tgts->GetYaxis()->SetTitle(
"Target Floor") ;
318 tgts->SetOption(
"colz") ;
vector< SuperModule * > getSuperModules()
Get the SuperModules in the DU.
double getVoltage()
Get nanobeacon voltage.
int getRunNumber()
Get run number.
TCanvas* RooCanvas |
( |
RooWorkspace |
w, |
|
|
TH1D * |
h |
|
) |
| |
|
inline |
Produces a TCanvas with the nanobeacon peak and the fit performed with Roofit.
- Parameters
-
w | A Rooworkspace that contains all the information relative to the fit. |
h | The histogram with the nanobeacon peak. |
- Returns
- A TCanvas
Definition at line 334 of file Control_utils.hh.
336 TCanvas * c =
new TCanvas( (std::string(
"canvas_")+h->GetName()).c_str() , (std::string(
"canvas_")+h->GetName()).c_str() );
340 RooPlot* frame = w.var(
"time")->frame() ;
342 RooDataHist Data (
"data" ,
"data" , *w.var(
"time") , Import(*h)) ;
346 w.function(
"Model")->plotOn(frame) ;
348 w.function(
"L1")->plotOn(frame , LineStyle(kDashed)) ;
350 w.function(
"G1")->plotOn(frame , LineStyle(kDashed) , LineColor(kRed)) ;
354 TLine* line =
new TLine ( w.var(
"mpv")->getVal() , 1 , w.var(
"mpv")->getVal() , 1e5) ;
356 line->SetLineColor(kBlue) ;
358 TLine* line2 =
new TLine ( w.var(
"tpeak")->getVal() , 1 , w.var(
"tpeak")->getVal() , 1e5) ;
360 line2->SetLineColor(kBlack) ;
364 line2->Draw(
"same") ;