Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
CalibAnaPlot Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-04-10/Calibration/calibana/CalibAnaPlot.h"

Inheritance diagram for CalibAnaPlot:
BrightnessModelPlots MEUPerCell MEUPerDiblock MEUPerFEB ValidCalibPDF

Public Member Functions

 CalibAnaPlot (std::string outpath)
 
virtual void SchedulePlots ()
 
virtual void ScheduleSamples ()
 
virtual void ScheduleEventVars ()
 
virtual void ScheduleTrackVars ()
 
virtual void ScheduleHitVars ()
 
virtual void FillEventPlots ()
 
virtual void FillTrackPlots ()
 
virtual void FillHitPlots ()
 
std::map< std::string, std::stringGetSamples ()
 
void Initialize ()
 
void SetTreeLoopLimit (unsigned int limit)
 
void SetTreeLoopStride (unsigned int stride)
 
void Draw (std::string pdfdir, std::vector< Plot > plots, Plot denom_plot, std::string ratio_title="")
 
void DrawPeriodLines (float ymin, float ymax, bool withEpochs=false)
 
void PrintUnderOverFlow (TH1 *h, std::string plotname, std::string samp)
 
void ProcessTrees (std::string sample)
 
void MakeDir (std::string path)
 
std::string LegendLabel (std::string key)
 
void HaddAllDataFile ()
 
bool ProcessedAllData ()
 
void PrintEpochLengths ()
 

Protected Member Functions

void SetEventBranches (TTree *t)
 
void SetTrackBranches (TTree *t)
 
void SetHitBranches (TTree *t)
 
bool UseEVar (std::string var)
 
bool UseTVar (std::string var)
 
bool UseHVar (std::string var)
 

Protected Attributes

std::map< std::string, TH1 * > fPlots
 
std::map< std::string, TH2 * > f2dPlots
 
std::map< std::string, std::stringfSamples
 
std::string fCurrentSample
 
std::vector< std::stringfProcessedSamples
 
std::string fOutPath
 
unsigned int fLimit
 
unsigned int fStride
 
std::string fEventVars
 
std::string fTrackVars
 
std::string fHitVars
 
DetectorfDet
 
int run
 
int subrun
 
int event
 
uint32_t evt_time
 
int evt_ntracks
 
int evt_ncellhits
 
int evt_nhits_tricell
 
int evt_nhits_traj
 
float trk_dcosz
 
float trk_dcosy
 
float trk_dcosx
 
float trk_totlength
 
float trk_totdisplace
 
int trk_pdg
 
int trk_ncellhits
 
int trk_nhits_tricell
 
int trk_nhits_avg
 
int trk_nhits_z
 
int trk_nhits_traj
 
TVector3 trk_startpos
 
TVector3 trk_endpos
 
bool istricell
 
bool istraj
 
bool isavg
 
bool isz
 
int diblock
 
int dcm
 
int apd
 
int pixel
 
int plane
 
int cell
 
int view
 
float w
 
float readdist
 
float xapprox
 
float yapprox
 
float zapprox
 
float pe
 
float pecorr
 
float pecorrtomev
 
float recoMeV
 
float path
 
float flightLen
 
float cmFromEnd
 
float tns
 
float truepath
 
float truepe
 
float truew
 
float trueMeV
 
float poissonlambda
 
int brightbin
 
int tdc
 
int adc
 

Private Member Functions

void progbar (int current, float max_inv)
 

Private Attributes

int fCurrentPercProg
 

Detailed Description

Definition at line 14 of file CalibAnaPlot.h.

Constructor & Destructor Documentation

CalibAnaPlot::CalibAnaPlot ( std::string  outpath)

Definition at line 149 of file CalibAnaPlot.h.

References om::cout, allTimeWatchdog::endl, fDet, Detector::FullName(), and MakeDir().

150 : fOutPath(outpath),
151  fStride(1),
152  fLimit(0),
153  fCurrentPercProg(-1)
154 {
155  MakeDir(outpath);
156  if (outpath.find("nd_")!=std::string::npos){ fDet = new Detector("nd"); }
157  else if(outpath.find("fd_")!=std::string::npos){ fDet = new Detector("fd"); }
158  else if(outpath.find("tb_")!=std::string::npos){ fDet = new Detector("tb"); }
159  else{
160  std::cout << "Outpath \"" <<outpath<< "\" does not denote detector." << std::endl;
161  std::abort(); }
162 
163  std::cout << "\nSet detector to " << fDet->FullName() << std::endl << std::endl;
164 }
std::string fOutPath
Definition: CalibAnaPlot.h:62
Detector
helper plotting scripts
Definition: PlotSpectra.h:39
int fCurrentPercProg
Definition: CalibAnaPlot.h:132
void MakeDir(std::string path)
Definition: CalibAnaPlot.h:489
unsigned int fStride
Definition: CalibAnaPlot.h:64
unsigned int fLimit
Definition: CalibAnaPlot.h:63
OStream cout
Definition: OStream.cxx:6
std::string FullName()
Definition: Detector.h:11
Detector * fDet
Definition: CalibAnaPlot.h:68

Member Function Documentation

void CalibAnaPlot::Draw ( std::string  pdfdir,
std::vector< Plot plots,
Plot  denom_plot,
std::string  ratio_title = "" 
)

Definition at line 168 of file CalibAnaPlot.h.

References plot_validation_datamc::c, om::cout, DrawPeriodLines(), DrawUtils::DrawPlotStack(), allTimeWatchdog::endl, fOutPath, fSamples, DrawUtils::GetLastYMax(), DrawUtils::GetLastYMin(), MakeDir(), and Plot::name.

Referenced by ValidCalibPDF::DiblockTex(), BrightnessModelPlots::DoAna(), MEUPerDiblock::DoAna(), MEUPerCell::DoAna(), MEUPerFEB::MakeTex(), ValidCalibPDF::MakeTex(), and SetTreeLoopStride().

172 {
173  // Protect sample directories
174  if( fSamples.count(pdfdir) ){
175  std::cout << "Sample names reserved for their own directory, change output dir: "
176  << pdfdir << std::endl; return; }
177  MakeDir(fOutPath+"/"+pdfdir);
178 
179 
180  DrawUtils dutil;
181  // Manage our own canvases
182  TCanvas* c = new TCanvas("c","c");
183  TCanvas* cleg = new TCanvas( "cleg","cleg", 1800, 600);
184  dutil.DrawPlotStack( c, cleg, plots, denom_plot, ratio_title );
185  if(cleg){
186  cleg->Print(Form("%s/%s/legend.pdf",
187  fOutPath.c_str(),
188  pdfdir.c_str()));
189  }
190 
191  // plots vs time should denote period divisions
192  c->cd();
193  if(denom_plot.name.find("_time_")!=std::string::npos)
194  DrawPeriodLines( dutil.GetLastYMin(),
195  dutil.GetLastYMax(), true);
196 
197  c->Print(Form("%s/%s/%s.pdf",
198  fOutPath.c_str(),
199  pdfdir.c_str(),
200  denom_plot.name.c_str())); // does this need to be more specific?
201  delete c;
202  delete cleg;
203 
204  /*
205 
206  // 2d plots: Make colz plot for each sample
207  gStyle->SetPalette(kBird);
208  for( auto& pname : f2dPlots ){
209  std::string plotname = pname.first;
210  for( auto& samp : samples ){
211 
212  TH2* h2;
213  histfiles[samp]->GetObject( plotname.c_str(), h2);
214  if(!h2){ std::cout << "did not find " << plotname
215  << " in " << samp << std::endl; continue; }
216 
217  // Keep these separate from the pdfdir group of samples
218  // since we can only draw one sample at a time.
219  std::string pdf = Form("%s/%s/%s.pdf",
220  fOutPath.c_str(),
221  samp.c_str(),
222  plotname.c_str());
223 
224 
225  //if(FileMade(pdf)) continue; // dont redo this sample
226 
227  dutil.Draw2DPlot( c, h2 );
228  c->Print(pdf.c_str());
229  c->Clear();
230  //gROOT->SetStyle("novaStyle");
231  }
232  } // 2d plot loop
233 
234  */
235 
236 } // Draw
void DrawPeriodLines(float ymin, float ymax, bool withEpochs=false)
Definition: CalibAnaPlot.h:496
float GetLastYMax()
Definition: DrawUtils.h:108
std::string fOutPath
Definition: CalibAnaPlot.h:62
void MakeDir(std::string path)
Definition: CalibAnaPlot.h:489
void DrawPlotStack(TCanvas *&canv, TCanvas *&canvleg, const std::vector< Plot > &plot_vec, const Plot &plot_denom, std::string ratio_title="")
Definition: DrawUtils.h:145
const std::vector< Plot > plots
float GetLastYMin()
Definition: DrawUtils.h:107
OStream cout
Definition: OStream.cxx:6
std::map< std::string, std::string > fSamples
Definition: CalibAnaPlot.h:59
std::string name
Definition: DrawUtils.h:18
void CalibAnaPlot::DrawPeriodLines ( float  ymin,
float  ymax,
bool  withEpochs = false 
)

Definition at line 496 of file CalibAnaPlot.h.

References e, Detector::EndOfEpochMap(), Detector::EndOfPeriodMap(), fDet, and submit_hadd::l.

Referenced by Draw(), and SetTreeLoopStride().

497 {
498 
499  for( auto& p : fDet->EndOfPeriodMap() ){
500  TLine* l = new TLine(p.second, ymin, p.second,
501  ymin + 0.2*(ymax-ymin));
502  //l->SetLineColorAlpha(16,0.8);
503  l->SetLineColor(14);
504  l->SetLineWidth(3);
505  //l->SetLineStyle(9);
506  l->Draw();
507  }
508 
509  if( withEpochs ){
510  for( auto& e : fDet->EndOfEpochMap() ){
511  TLine* l = new TLine( e.second, ymin ,e.second,
512  ymin + 0.15*(ymax-ymin) );
513  l->SetLineColor(kCyan+3);
514  l->SetLineWidth(2);
515  l->Draw();
516  }
517  }
518 
519 }
std::map< std::string, uint32_t > EndOfPeriodMap()
Definition: Detector.h:23
const char * p
Definition: xmltok.h:285
std::map< std::string, uint32_t > EndOfEpochMap()
Definition: Detector.h:24
Double_t ymax
Definition: plot.C:25
Double_t ymin
Definition: plot.C:24
Float_t e
Definition: plot.C:35
Detector * fDet
Definition: CalibAnaPlot.h:68
virtual void CalibAnaPlot::FillEventPlots ( )
inlinevirtual

Definition at line 23 of file CalibAnaPlot.h.

Referenced by ProcessTrees().

23 {};
virtual void CalibAnaPlot::FillHitPlots ( )
inlinevirtual

Reimplemented in ValidCalibPDF, MEUPerCell, MEUPerFEB, MEUPerDiblock, and BrightnessModelPlots.

Definition at line 25 of file CalibAnaPlot.h.

Referenced by ProcessTrees().

25 {};
virtual void CalibAnaPlot::FillTrackPlots ( )
inlinevirtual

Definition at line 24 of file CalibAnaPlot.h.

Referenced by ProcessTrees().

24 {};
std::map<std::string, std::string> CalibAnaPlot::GetSamples ( )
inline

Definition at line 28 of file CalibAnaPlot.h.

References fSamples, and Initialize().

Referenced by MakeMEUPerFEB(), and MakeValidCalibPDF().

28 {return fSamples;}
std::map< std::string, std::string > fSamples
Definition: CalibAnaPlot.h:59
void CalibAnaPlot::HaddAllDataFile ( )

Definition at line 464 of file CalibAnaPlot.h.

References fDet, fOutPath, Detector::name(), string, and system().

Referenced by ValidCalibPDF::DiblockTex(), ProcessTrees(), and SetTreeLoopStride().

465 {
466  std::string all_data_merge = fOutPath+"/"+fDet->name()+"_all_data.root";
467  std::string all_data_files = fOutPath+"/"+fDet->name()+"_data_ep*.root";
468  std::system(( "rm " + all_data_merge ).c_str() );
469  std::system(( "hadd " + all_data_merge + " " + all_data_files ).c_str() );
470 }
system("rm -rf microbeam.root")
std::string fOutPath
Definition: CalibAnaPlot.h:62
std::string name()
Definition: Detector.h:9
Detector * fDet
Definition: CalibAnaPlot.h:68
enum BeamMode string
void CalibAnaPlot::Initialize ( )

Definition at line 138 of file CalibAnaPlot.h.

References fOutPath, fSamples, MakeDir(), ScheduleEventVars(), ScheduleHitVars(), ScheduleSamples(), and ScheduleTrackVars().

Referenced by CheckBrightnessModel(), GetSamples(), MakeMEUPerCell(), MakeMEUPerDiblock(), MakeMEUPerFEB(), and MakeValidCalibPDF().

139 {
140  // initialize things that shouldn't be reset in ProcessTrees
141  ScheduleHitVars();
144  ScheduleSamples();
145  for(auto& samp : fSamples) MakeDir(fOutPath+"/"+samp.first);
146 }
std::string fOutPath
Definition: CalibAnaPlot.h:62
void MakeDir(std::string path)
Definition: CalibAnaPlot.h:489
virtual void ScheduleTrackVars()
Definition: CalibAnaPlot.h:21
virtual void ScheduleEventVars()
Definition: CalibAnaPlot.h:20
virtual void ScheduleHitVars()
Definition: CalibAnaPlot.h:22
std::map< std::string, std::string > fSamples
Definition: CalibAnaPlot.h:59
virtual void ScheduleSamples()
Definition: CalibAnaPlot.h:19
std::string CalibAnaPlot::LegendLabel ( std::string  key)

Definition at line 239 of file CalibAnaPlot.h.

References label, and string.

Referenced by BrightnessModelPlots::DoAna(), MEUPerFEB::MakeTex(), ValidCalibPDF::MakeTex(), and SetTreeLoopStride().

240 {
241  if( key=="nd_data_ep4b.1" ) return "Data: Epoch 4b.1";
242  if( key=="nd_data_ep4b.2" ) return "Data: Epoch 4b.2";
243 
244  if( key=="fd_mc_p2" ) return "MC P.2 Low Gain";
245  if( key=="fd_mc_p3" ) return "MC P.3 High Gain";
246  if( key=="fd_mc_p5" ) return "MC P.5 High Gain";
247  if( key=="fd_mc_p2_2016" ) return "MC P.2 Low Gain (2016)";
248  if( key=="fd_mc_p3_2016" ) return "MC P.3 High Gain (2016)";
249 
250  std::string label = key.find("mc")!=std::string::npos ? "MC" : "Data";
251 
252  if (key== "nd_data_ep10a") return "Data: Epoch 10a";
253  if (key== "nd_data_ep10b") return "Data: Epoch 10b";
254  if (key== "nd_data_ep10cd") return "Data: Epoch 10cd";
255 
256  if(key.find("ep")!=std::string::npos) {
257  label += ": Epoch " + key.substr(key.length()-3, 3);
258  }
259  return label;
260 }
const char * label
enum BeamMode string
void CalibAnaPlot::MakeDir ( std::string  path)

Definition at line 489 of file CalibAnaPlot.h.

References om::cout, allTimeWatchdog::endl, exit(), and system().

Referenced by ValidCalibPDF::CalibAllSamples(), CalibAnaPlot(), Draw(), Initialize(), and SetTreeLoopStride().

489  {
490  if( -1 == std::system(( "mkdir -p " + path ).c_str() ) ){
491  std::cout << "Error creating directory: " << path << std::endl; exit(1); }
492 }
system("rm -rf microbeam.root")
OStream cout
Definition: OStream.cxx:6
exit(0)
void CalibAnaPlot::PrintEpochLengths ( )

Definition at line 522 of file CalibAnaPlot.h.

References om::cout, e, allTimeWatchdog::endl, Detector::EndOfEpochMap(), fDet, and string.

Referenced by SetTreeLoopStride(), and ValidCalibPDF::ValidCalibPDF().

523 {
524  std::string prev_epoch="2a";
525  std::map< std::string, uint32_t > epoch_end_map = fDet->EndOfEpochMap();
526  for( auto& e : epoch_end_map ){
527  if(e.first=="2a") continue;
528  std::cout << prev_epoch << " end -- " << e.first << " end: "
529  << 1.*(e.second-epoch_end_map[prev_epoch])/86400
530  << " days" << std::endl;
531  prev_epoch=e.first;
532  }
533 }
std::map< std::string, uint32_t > EndOfEpochMap()
Definition: Detector.h:24
OStream cout
Definition: OStream.cxx:6
Float_t e
Definition: plot.C:35
Detector * fDet
Definition: CalibAnaPlot.h:68
enum BeamMode string
void CalibAnaPlot::PrintUnderOverFlow ( TH1 *  h,
std::string  plotname,
std::string  samp 
)

Definition at line 264 of file CalibAnaPlot.h.

References om::cout, e, and allTimeWatchdog::endl.

Referenced by SetTreeLoopStride().

267 {
268  float underflow = 100.*h->GetBinContent(0)/h->Integral(0,h->GetNbinsX()+1);
269  float overflow = 100.*h->GetBinContent(h->GetNbinsX()+1)/h->Integral(0,h->GetNbinsX()+1);
270  if(underflow>1e-2)
271  std::cout << plotname << " " << samp << " underflow %: " << underflow << std::endl;
272  if(overflow>1e-2)
273  std::cout << plotname << " " << samp << " overflow %: " << overflow << std::endl;
274  return;
275 }
OStream cout
Definition: OStream.cxx:6
Float_t e
Definition: plot.C:35
bool CalibAnaPlot::ProcessedAllData ( )

Definition at line 473 of file CalibAnaPlot.h.

References fProcessedSamples, and fSamples.

Referenced by ProcessTrees(), and SetTreeLoopStride().

474 {
475  // for every data sample, check if it has been processed
476  for(auto& samp : fSamples){
477  if(samp.first.find("data")!=std::string::npos) continue;
478  bool processed = false;
479  for(auto& done : fProcessedSamples)
480  if(samp.first==done) processed = true;
481  if(!processed) return false;
482  }
483  return true;
484 }
std::vector< std::string > fProcessedSamples
Definition: CalibAnaPlot.h:61
std::map< std::string, std::string > fSamples
Definition: CalibAnaPlot.h:59
void CalibAnaPlot::ProcessTrees ( std::string  sample)

Definition at line 334 of file CalibAnaPlot.h.

References om::cout, e, allTimeWatchdog::endl, MakeMiniprodValidationCuts::f, f2dPlots, fCurrentSample, fEventVars, fHitVars, FillEventPlots(), FillHitPlots(), FillTrackPlots(), fLimit, fOutPath, fPlots, fProcessedSamples, fSamples, fStride, fTrackVars, HaddAllDataFile(), makeTrainCVSamples::int, it, getGoodRuns4SAM::n, outf, ProcessedAllData(), progbar(), SchedulePlots(), SetEventBranches(), SetHitBranches(), and SetTrackBranches().

Referenced by MEUPerDiblock::DoAna(), MEUPerCell::DoAna(), MakeMEUPerFEB(), MakeValidCalibPDF(), and SetTreeLoopStride().

335 {
336  fCurrentSample = samp;
337 
338  if(fSamples.count(samp)==0){
339  std::cout << "\nNo sample scheduled with name \"" << samp
340  << "\". Possible samples:" << std::endl;
341  for(auto& s : fSamples) std::cout << s.first << ": " << s.second << std::endl;
342  std::abort();
343  } else {
344  std::cout << "\nProcessing " << samp << " from " << fSamples[samp] << std::endl;
345  }
346 
347  bool isMC = samp.find("mc")!=std::string::npos;
348 
349  TFile* f = new TFile(fSamples[samp].c_str());
350  if(!f){ std::cout << "did not find " << fSamples[samp] << std::endl; return; }
351 
352  SchedulePlots();
353 
354  /*
355  // Get information about the calibration
356  TTree* t_meta;
357  f->GetObject("calibana/file_tree",t_meta);
358  std::string csvpath_atten;
359  t_meta->SetBranchAddress( "csvpath_atten", &csvpath_atten );
360  t_meta->GetEntry(0);
361  std::cout << t_meta->GetEntries() << " files calibrated with: \n"
362  << " Atten: " << csvpath_atten << std::endl;
363  */
364 
365 
366  if(fEventVars!=""){
367  TTree* eventTree;
368  f->GetObject("calibana/event_tree",eventTree);
369  if(!eventTree) std::cout << "Did not find calibana/event_tree" << std::endl;
370  SetEventBranches(eventTree);
371  std::cout << " ... Event Tree" << std::endl;
372  size_t n = eventTree->GetEntries();
373  if(fLimit && n>fLimit) n = fLimit;
374  size_t e=0;
375  while(e<n){
376  eventTree->GetEntry(e);
377  if(e%1000000==0) std::cout << e << "/" << n << std::endl;
378  FillEventPlots();
379  e += 1; // e += fStride; shouldn't need stride for event loop
380  }
381  }
382 
383 
384  if(fTrackVars!=""){
385  TTree* trackTree;
386  f->GetObject("calibana/track_tree",trackTree);
387  if(!trackTree) std::cout << "Did not find calibana/track_tree" << std::endl;
388  SetTrackBranches(trackTree);
389  std::cout << " ... Track Tree" << std::endl;
390  size_t n = trackTree->GetEntries();
391  if(fLimit && n>fLimit) n = fLimit;
392  size_t e=0;
393  while(e<n){
394  trackTree->GetEntry(e);
395  if(e%1000000==0) std::cout << e << "/" << n << std::endl;
396  FillTrackPlots();
397  e += 1; // e += fStride; shouldn't need stride for track loop
398  }
399  }
400 
401  if(fHitVars!=""){
402  TTree* tricellTree;
403  f->GetObject("calibana/tricell_tree",tricellTree);
404  if(!tricellTree) std::cout << "Did not find calibana/tricell_tree" << std::endl;
405  SetHitBranches(tricellTree);
406  size_t n = tricellTree->GetEntries();
407  std::cout << " ... Tricell Hits Tree: " << n << " entries" << std::endl;
408  if(fStride>1){
409  std::cout << " Using stride " << fStride
410  << ", for about " << (int)n/fStride << " hits processed." << std::endl;
411  } else if(fLimit && n>fLimit){
412  n = fLimit;
413  std::cout << " Limiting to " << fLimit
414  << " hits.\nWarning: Prefer stride over limit for getting a better sweep of runs."
415  << std::endl;
416  }
417  size_t e=0;
418  float nverse=1./n;
419  while(e<n){
420  tricellTree->GetEntry(e);
421  progbar(e,nverse);
422  FillHitPlots();
423  e += fStride;
424  }
425  progbar(n+1,nverse); // ensure last print, floor((n+1)/n)=1.
426 
427  }
428 
429 
430  // Dump everything to an output file to be read in by Draw
431  TFile* outf = new TFile(Form("%s/%s.root",
432  fOutPath.c_str(), samp.c_str()),"recreate");
433  for( auto it=fPlots.begin(); it!=fPlots.end(); it++ ) it->second->Write();
434  for( auto it=f2dPlots.begin(); it!=f2dPlots.end(); it++ ) it->second->Write();
435  outf->Close();
436 
437  // Log sample as processed and hadd into total sample if done
438  fProcessedSamples.push_back(samp);
440 
441  // Need to empty and remake these every sample
442  fPlots.clear();
443  f2dPlots.clear();
444 
445 } // Process Trees
std::map< std::string, TH1 * > fPlots
Definition: CalibAnaPlot.h:57
std::vector< std::string > fProcessedSamples
Definition: CalibAnaPlot.h:61
set< int >::iterator it
bool ProcessedAllData()
Definition: CalibAnaPlot.h:473
std::map< std::string, TH2 * > f2dPlots
Definition: CalibAnaPlot.h:58
std::string fOutPath
Definition: CalibAnaPlot.h:62
void SetTrackBranches(TTree *t)
Definition: CalibAnaPlot.h:287
void SetHitBranches(TTree *t)
Definition: CalibAnaPlot.h:293
void SetEventBranches(TTree *t)
Definition: CalibAnaPlot.h:281
virtual void SchedulePlots()
Definition: CalibAnaPlot.h:18
const XML_Char * s
Definition: expat.h:262
std::string fHitVars
Definition: CalibAnaPlot.h:67
virtual void FillEventPlots()
Definition: CalibAnaPlot.h:23
unsigned int fStride
Definition: CalibAnaPlot.h:64
unsigned int fLimit
Definition: CalibAnaPlot.h:63
std::string fEventVars
Definition: CalibAnaPlot.h:65
TFile * outf
Definition: testXsec.C:51
virtual void FillTrackPlots()
Definition: CalibAnaPlot.h:24
OStream cout
Definition: OStream.cxx:6
std::string fTrackVars
Definition: CalibAnaPlot.h:66
void HaddAllDataFile()
Definition: CalibAnaPlot.h:464
Float_t e
Definition: plot.C:35
std::map< std::string, std::string > fSamples
Definition: CalibAnaPlot.h:59
void progbar(int current, float max_inv)
Definition: CalibAnaPlot.h:449
std::string fCurrentSample
Definition: CalibAnaPlot.h:60
virtual void FillHitPlots()
Definition: CalibAnaPlot.h:25
void CalibAnaPlot::progbar ( int  current,
float  max_inv 
)
private

Definition at line 449 of file CalibAnaPlot.h.

References om::cout, allTimeWatchdog::endl, fCurrentPercProg, stan::math::floor(), add_attributes::prog, and string.

Referenced by ProcessTrees().

449  {
450  float prog = current * max_inv; // fractional progress
451  unsigned short prog_perc_floor = (unsigned short)std::floor(100*prog);
452  if( prog_perc_floor == fCurrentPercProg ) return; // dont waste time printing every entry
453 
454  fCurrentPercProg = prog_perc_floor;
455  std::cout << std::fixed << std::setprecision(2)
456  << "\r [" << std::string(prog_perc_floor, '.')
457  << std::string(100 - prog_perc_floor, ' ') << "] " << prog_perc_floor << "%";
458  if (prog_perc_floor == 100){ std::cout << std::endl; fCurrentPercProg=-1; }
459  else{ std::cout.flush(); }
460 }
int fCurrentPercProg
Definition: CalibAnaPlot.h:132
OStream cout
Definition: OStream.cxx:6
fvar< T > floor(const fvar< T > &x)
Definition: floor.hpp:11
enum BeamMode string
virtual void CalibAnaPlot::ScheduleEventVars ( )
inlinevirtual

Definition at line 20 of file CalibAnaPlot.h.

Referenced by Initialize().

20 {};
virtual void CalibAnaPlot::ScheduleHitVars ( )
inlinevirtual

Reimplemented in ValidCalibPDF, MEUPerCell, MEUPerFEB, MEUPerDiblock, and BrightnessModelPlots.

Definition at line 22 of file CalibAnaPlot.h.

Referenced by Initialize().

22 {};
virtual void CalibAnaPlot::SchedulePlots ( )
inlinevirtual

Reimplemented in ValidCalibPDF, MEUPerCell, MEUPerFEB, MEUPerDiblock, and BrightnessModelPlots.

Definition at line 18 of file CalibAnaPlot.h.

Referenced by ProcessTrees().

18 {};
virtual void CalibAnaPlot::ScheduleSamples ( )
inlinevirtual

Reimplemented in ValidCalibPDF, MEUPerCell, MEUPerFEB, MEUPerDiblock, and BrightnessModelPlots.

Definition at line 19 of file CalibAnaPlot.h.

Referenced by Initialize().

19 {};
virtual void CalibAnaPlot::ScheduleTrackVars ( )
inlinevirtual

Definition at line 21 of file CalibAnaPlot.h.

Referenced by Initialize().

21 {};
void CalibAnaPlot::SetEventBranches ( TTree *  t)
protected

Definition at line 281 of file CalibAnaPlot.h.

References evt_nhits_tricell, and UseEVar().

Referenced by ProcessTrees().

282 {
283  if(UseEVar("evt_nhits_tricell")) t->SetBranchAddress( "evt_nhits_tricell", &evt_nhits_tricell );
284 }
int evt_nhits_tricell
Definition: CalibAnaPlot.h:83
bool UseEVar(std::string var)
Definition: CalibAnaPlot.h:317
void CalibAnaPlot::SetHitBranches ( TTree *  t)
protected

Definition at line 293 of file CalibAnaPlot.h.

References brightbin, cell, cmFromEnd, diblock, evt_time, path, pe, pecorr, plane, subrun, trueMeV, truepath, UseHVar(), view, and w.

Referenced by ProcessTrees().

294 {
295  // Set branches for all variables we want to use
296  // Speed things up by not filling variables not intended to use
297  if(UseHVar("run")) t->SetBranchAddress( "run", &run );
298  if(UseHVar("subrun")) t->SetBranchAddress( "run", &subrun );
299  if(UseHVar("event")) t->SetBranchAddress( "event", &run );
300  if(UseHVar("view")) t->SetBranchAddress( "view", &view );
301  if(UseHVar("diblock")) t->SetBranchAddress( "diblock", &diblock );
302  if(UseHVar("pe")) t->SetBranchAddress( "pe", &pe );
303  if(UseHVar("pecorr")) t->SetBranchAddress( "pecorr", &pecorr );
304  if(UseHVar("path")) t->SetBranchAddress( "path", &path );
305  if(UseHVar("w")) t->SetBranchAddress( "w", &w );
306  if(UseHVar("cmFromEnd")) t->SetBranchAddress( "cmFromEnd", &cmFromEnd );
307  if(UseHVar("plane")) t->SetBranchAddress( "plane", &plane );
308  if(UseHVar("cell")) t->SetBranchAddress( "cell", &cell );
309  if(UseHVar("recoMeV")) t->SetBranchAddress( "recoMeV", &trueMeV );
310  if(UseHVar("trueMeV")) t->SetBranchAddress( "trueMeV", &trueMeV );
311  if(UseHVar("truepath")) t->SetBranchAddress( "truepath", &truepath );
312  if(UseHVar("brightbin")) t->SetBranchAddress( "brightbin", &brightbin );
313  if(UseHVar("evt_time")) t->SetBranchAddress( "evt_time", &evt_time ); // drift studies
314 }
bool UseHVar(std::string var)
Definition: CalibAnaPlot.h:327
uint32_t evt_time
Definition: CalibAnaPlot.h:80
Definition: run.py:1
void CalibAnaPlot::SetTrackBranches ( TTree *  t)
protected

Definition at line 287 of file CalibAnaPlot.h.

References trk_nhits_tricell, and UseTVar().

Referenced by ProcessTrees().

288 {
289  if(UseTVar("trk_nhits_tricell")) t->SetBranchAddress( "trk_nhits_tricell", &trk_nhits_tricell );
290 }
bool UseTVar(std::string var)
Definition: CalibAnaPlot.h:322
int trk_nhits_tricell
Definition: CalibAnaPlot.h:92
void CalibAnaPlot::SetTreeLoopLimit ( unsigned int  limit)
inline

Definition at line 31 of file CalibAnaPlot.h.

References fLimit, and PandAna.Demos.demo_prong::limit.

Referenced by MakeMEUPerFEB(), and MakeValidCalibPDF().

31 {fLimit=limit;}
unsigned int fLimit
Definition: CalibAnaPlot.h:63
void CalibAnaPlot::SetTreeLoopStride ( unsigned int  stride)
inline
bool CalibAnaPlot::UseEVar ( std::string  var)
protected

Definition at line 317 of file CalibAnaPlot.h.

References fEventVars.

Referenced by SetEventBranches().

318 {
319  return ( fEventVars.find(var+",")!=std::string::npos );
320 }
std::string fEventVars
Definition: CalibAnaPlot.h:65
bool CalibAnaPlot::UseHVar ( std::string  var)
protected

Definition at line 327 of file CalibAnaPlot.h.

References fHitVars.

Referenced by SetHitBranches().

328 {
329  return ( fHitVars.find(var+",")!=std::string::npos );
330 }
std::string fHitVars
Definition: CalibAnaPlot.h:67
bool CalibAnaPlot::UseTVar ( std::string  var)
protected

Definition at line 322 of file CalibAnaPlot.h.

References fTrackVars.

Referenced by SetTrackBranches().

323 {
324  return ( fTrackVars.find(var+",")!=std::string::npos );
325 }
std::string fTrackVars
Definition: CalibAnaPlot.h:66

Member Data Documentation

int CalibAnaPlot::adc
protected

Definition at line 129 of file CalibAnaPlot.h.

int CalibAnaPlot::apd
protected

Definition at line 106 of file CalibAnaPlot.h.

int CalibAnaPlot::brightbin
protected
int CalibAnaPlot::cell
protected
float CalibAnaPlot::cmFromEnd
protected
int CalibAnaPlot::dcm
protected

Definition at line 105 of file CalibAnaPlot.h.

int CalibAnaPlot::diblock
protected
int CalibAnaPlot::event
protected

Definition at line 79 of file CalibAnaPlot.h.

int CalibAnaPlot::evt_ncellhits
protected

Definition at line 82 of file CalibAnaPlot.h.

int CalibAnaPlot::evt_nhits_traj
protected

Definition at line 84 of file CalibAnaPlot.h.

int CalibAnaPlot::evt_nhits_tricell
protected

Definition at line 83 of file CalibAnaPlot.h.

Referenced by SetEventBranches().

int CalibAnaPlot::evt_ntracks
protected

Definition at line 81 of file CalibAnaPlot.h.

uint32_t CalibAnaPlot::evt_time
protected
std::map< std::string, TH2* > CalibAnaPlot::f2dPlots
protected
int CalibAnaPlot::fCurrentPercProg
private

Definition at line 132 of file CalibAnaPlot.h.

Referenced by progbar().

std::string CalibAnaPlot::fCurrentSample
protected

Definition at line 60 of file CalibAnaPlot.h.

Referenced by ValidCalibPDF::FillHitPlots(), and ProcessTrees().

Detector* CalibAnaPlot::fDet
protected
std::string CalibAnaPlot::fEventVars
protected

Definition at line 65 of file CalibAnaPlot.h.

Referenced by ProcessTrees(), and UseEVar().

std::string CalibAnaPlot::fHitVars
protected
float CalibAnaPlot::flightLen
protected

Definition at line 119 of file CalibAnaPlot.h.

unsigned int CalibAnaPlot::fLimit
protected

Definition at line 63 of file CalibAnaPlot.h.

Referenced by ProcessTrees(), and SetTreeLoopLimit().

std::string CalibAnaPlot::fOutPath
protected
std::map< std::string, TH1* > CalibAnaPlot::fPlots
protected
std::vector< std::string > CalibAnaPlot::fProcessedSamples
protected

Definition at line 61 of file CalibAnaPlot.h.

Referenced by ProcessedAllData(), and ProcessTrees().

std::map<std::string, std::string> CalibAnaPlot::fSamples
protected
unsigned int CalibAnaPlot::fStride
protected

Definition at line 64 of file CalibAnaPlot.h.

Referenced by ProcessTrees(), and SetTreeLoopStride().

std::string CalibAnaPlot::fTrackVars
protected

Definition at line 66 of file CalibAnaPlot.h.

Referenced by ProcessTrees(), and UseTVar().

bool CalibAnaPlot::isavg
protected

Definition at line 102 of file CalibAnaPlot.h.

bool CalibAnaPlot::istraj
protected

Definition at line 101 of file CalibAnaPlot.h.

bool CalibAnaPlot::istricell
protected

Definition at line 100 of file CalibAnaPlot.h.

bool CalibAnaPlot::isz
protected

Definition at line 103 of file CalibAnaPlot.h.

float CalibAnaPlot::path
protected
float CalibAnaPlot::pe
protected
float CalibAnaPlot::pecorr
protected
float CalibAnaPlot::pecorrtomev
protected

Definition at line 116 of file CalibAnaPlot.h.

int CalibAnaPlot::pixel
protected

Definition at line 107 of file CalibAnaPlot.h.

int CalibAnaPlot::plane
protected
float CalibAnaPlot::poissonlambda
protected

Definition at line 126 of file CalibAnaPlot.h.

float CalibAnaPlot::readdist
protected

Definition at line 112 of file CalibAnaPlot.h.

float CalibAnaPlot::recoMeV
protected

Definition at line 117 of file CalibAnaPlot.h.

Referenced by ValidCalibPDF::FillHitPlots().

int CalibAnaPlot::run
protected

Definition at line 79 of file CalibAnaPlot.h.

Referenced by Metric.Metric::__repr__(), and fabricate.Builder::memoize().

int CalibAnaPlot::subrun
protected

Definition at line 79 of file CalibAnaPlot.h.

Referenced by SetHitBranches().

int CalibAnaPlot::tdc
protected

Definition at line 128 of file CalibAnaPlot.h.

float CalibAnaPlot::tns
protected

Definition at line 121 of file CalibAnaPlot.h.

float CalibAnaPlot::trk_dcosx
protected

Definition at line 87 of file CalibAnaPlot.h.

float CalibAnaPlot::trk_dcosy
protected

Definition at line 87 of file CalibAnaPlot.h.

float CalibAnaPlot::trk_dcosz
protected

Definition at line 87 of file CalibAnaPlot.h.

TVector3 CalibAnaPlot::trk_endpos
protected

Definition at line 97 of file CalibAnaPlot.h.

int CalibAnaPlot::trk_ncellhits
protected

Definition at line 91 of file CalibAnaPlot.h.

int CalibAnaPlot::trk_nhits_avg
protected

Definition at line 93 of file CalibAnaPlot.h.

int CalibAnaPlot::trk_nhits_traj
protected

Definition at line 95 of file CalibAnaPlot.h.

int CalibAnaPlot::trk_nhits_tricell
protected

Definition at line 92 of file CalibAnaPlot.h.

Referenced by SetTrackBranches().

int CalibAnaPlot::trk_nhits_z
protected

Definition at line 94 of file CalibAnaPlot.h.

int CalibAnaPlot::trk_pdg
protected

Definition at line 90 of file CalibAnaPlot.h.

TVector3 CalibAnaPlot::trk_startpos
protected

Definition at line 96 of file CalibAnaPlot.h.

float CalibAnaPlot::trk_totdisplace
protected

Definition at line 89 of file CalibAnaPlot.h.

float CalibAnaPlot::trk_totlength
protected

Definition at line 88 of file CalibAnaPlot.h.

float CalibAnaPlot::trueMeV
protected

Definition at line 125 of file CalibAnaPlot.h.

Referenced by ValidCalibPDF::FillHitPlots(), and SetHitBranches().

float CalibAnaPlot::truepath
protected

Definition at line 122 of file CalibAnaPlot.h.

Referenced by SetHitBranches().

float CalibAnaPlot::truepe
protected

Definition at line 123 of file CalibAnaPlot.h.

float CalibAnaPlot::truew
protected

Definition at line 124 of file CalibAnaPlot.h.

int CalibAnaPlot::view
protected
float CalibAnaPlot::w
protected
float CalibAnaPlot::xapprox
protected

Definition at line 113 of file CalibAnaPlot.h.

float CalibAnaPlot::yapprox
protected

Definition at line 113 of file CalibAnaPlot.h.

float CalibAnaPlot::zapprox
protected

Definition at line 113 of file CalibAnaPlot.h.


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