Functions | Variables
cana_time_peak.C File Reference
#include <iostream>
#include <cmath>
#include "TArrow.h"
#include "TCanvas.h"
#include "TChain.h"
#include "TCut.h"
#include "TH1F.h"
#include "TMath.h"
#include "TMinuit.h"
#include "TStyle.h"
#include "TText.h"
#include "TLegend.h"
#include "TLatex.h"

Go to the source code of this file.

Functions

TCut run ("run>=15071&&run<=15131")
 
TCut activity ("nhit>=25&&nhitx>=3&&nhity>=3")
 
TCut y1cut ("y1<150")
 
TCut x1cut ("abs(x1)<100")
 
TCut z1cut ("280<z1 && z1<1200")
 
TCut fiducial (x1cut &&y1cut &&z1cut)
 
TCut cosnumi ("cosnumi>0.95")
 
TCut canacuts (run &&fiducial &&activity &&cosnumi)
 
TCut intime ("tave>=217.0 && tave<=227.8")
 
TCut outtime ("(tave>0.0&&tave<200.0) || (tave>250.0&&tave<450.0)")
 
void NDOSLabel ()
 
void Preliminary ()
 Put NOvA Preliminary on plots. More...
 
void CenterTitles (TH1 *histo)
 
void nhit_proj (TChain &ch)
 
void nhit_plot ()
 
void y1_proj (TChain &ch)
 
void y1_plot ()
 
void x1_proj (TChain &ch)
 
void x1_plot ()
 
void z1_proj (TChain &ch)
 
void z1_plot ()
 
void cosnumi_proj (TChain &ch)
 
void cosnumi_plot ()
 
void time_wide_proj (TChain &ch)
 
void time_wide_plot ()
 
void time_zoom_proj (TChain &ch)
 
double spill_profile (double t)
 
void make_template (double sigma)
 
void make_time_profile (double b, double f, double t0, double sigma)
 
double chi2 ()
 
void fcn (int &, double *, double &f, double *p, int)
 
void minimize ()
 
void time_zoom_plot ()
 
void proj_all (TChain &ch)
 
void plot_all ()
 

Variables

const char * label = "NDOS Data, 09/12/13 - 09/27/13"
 
double t1 = 217.0
 
double t2 = 227.8
 
double intimet = (t2-t1)
 
double outtimet = 400.0
 
TH1F * nhith
 
TH1F * y1h
 
TH1F * x1h
 
TH1F * z1h
 
TH1F * cosnumiinh
 
TH1F * cosnumiouth
 
TH1F * tavewideh
 
TH1F * tavezoomh
 
int ntbin_per_usec = 20
 
double zoom_tbin_sz = 1.0/(float)ntbin_per_usec
 
double zoom_tlo = floor(t1) - 5
 
double zoom_thi = floor(t2) + 6
 
int zoom_nbin = ntbin_per_usec*(zoom_thi-zoom_tlo)
 
static const int nbatch = 6
 
static const double dt_batch = 81*18.83E-3
 
static const double dt_gap = 5*18.83E-3
 
static const double dt_cycle = dt_batch + dt_gap
 
static const double spill_length = nbatch*dt_batch + (nbatch-1)*dt_gap
 
TH1F * template_spillh = 0
 
double template_tlo
 
double template_thi
 
int template_nbin
 
TH1F * time_profileh
 

Function Documentation

TCut activity ( "nhit>=25&&nhitx>=3&&nhity>=3"  )
TCut canacuts ( run &&fiducial &&activity &&  cosnumi)

Referenced by time_wide_proj(), and time_zoom_proj().

void CenterTitles ( TH1 *  histo)

Definition at line 77 of file cana_time_peak.C.

Referenced by cosnumi_plot(), nhit_plot(), time_wide_plot(), time_zoom_plot(), x1_plot(), y1_plot(), and z1_plot().

78 {
79  histo->GetXaxis()->CenterTitle();
80  histo->GetYaxis()->CenterTitle();
81  histo->GetZaxis()->CenterTitle();
82 }
TH2D * histo
double chi2 ( )

Definition at line 532 of file cana_time_peak.C.

References MECModelEnuComparisons::i, test_ParserArtEvents::log, nui, sum, tavezoomh, time_profileh, and zoom_nbin.

Referenced by upmuana::UpMuRecoAna::analyze(), upmuana::UpMuAnalysis::analyze(), cmf::ChiSqrCalculator::BinCNPChiSqr(), cmf::ChiSqrCalculator::BinPoissonChiSqr(), ana::CalcChi2(), CalcChi2(), Calculate1DChi2_simple(), Calculate2DChi2(), CalculateENuChi2(), CalculateQ2Chi2(), calculateWrongSignNumuQ1(), calculateWrongSignNumuQ2(), calculateWrongSignNumuQ3(), calculateWrongSignNumuQ4(), vdt::Segment::Chi2EndPoint(), ana::OscCovMxExperiment::ChiSq(), ana::CovMxExperiment::ChiSq(), cmf::ChiSqrCalculator::ChiSqrCNP(), cmf::ChiSqrCalculator::ChiSqrPoisson(), DedxComp(), DedxCompBirk(), DedxGamma(), align::SplitTracks::DemingRegFit(), doUnfolding(), FCContour(), fcn(), FindAngleFromChi2(), cosrej::CosRejFxs::fitchisq(), numusand::NumuSandFxs::fitchisq(), bpfit::DimuonFitter::FitView(), util::LinFit(), novaddt::TrackFit::LinFit(), geo::LinFit(), novaddt::TrackFit::LinFitMinDperp(), geo::LinFitMinDperp(), makeMatrixElementSurface(), nuebar_signif(), PionDedxComp(), ProtonDedxComp(), ProtonDedxCompBirk(), ana::test_best_spline(), and novaddt::TrackFit::UtilLinFit().

533 {
534  int i;
535  double sum = 0;
536  double ni, nui;
537  for (i=1; i<=zoom_nbin; ++i) {
538  nui = time_profileh->GetBinContent(i);
539  ni = tavezoomh-> GetBinContent(i);
540  sum += nui;
541  if (ni>0.0) {
542  sum += ni*(log(ni/nui)-1);
543  }
544  }
545  return 2.0*sum;
546 }
TH1F * tavezoomh
TH1F * time_profileh
int nui
Definition: runWimpSim.h:118
Double_t sum
Definition: plot.C:31
int zoom_nbin
TCut cosnumi ( cosnumi,
0.95"   
)
void cosnumi_plot ( )

Definition at line 297 of file cana_time_peak.C.

References a1, a2, CenterTitles(), cosnumiinh, cosnumiouth, Draw(), kRed, NDOSLabel(), Preliminary(), std::sqrt(), x1, and y1.

Referenced by plot_all().

298 {
299  gStyle->SetOptStat(0);
300 
301  TCanvas* cosnumic = new TCanvas("cosnumic","cosnumic",800,600);
302 
303  cosnumiinh->SetMarkerStyle(20);
304  cosnumiouth->SetLineColor(kRed);
305  cosnumiouth->SetLineWidth(2);
306 
307  cosnumiouth->SetMaximum(cosnumiinh->GetMaximum()+
308  1.5*sqrt(cosnumiinh->GetMaximum()));
309 
311  cosnumiouth->Draw("hist");
312  cosnumiinh-> Draw("same,e");
313 
314  Preliminary();
315 
316  double x1 = cosnumiouth->GetBinCenter(4);
317  double y1 = cosnumiouth->GetBinContent(4);
318 
319  TLine* a1 = new TLine(x1+0.08, 1.12*y1, x1+0.03, 1.01*y1);
320  a1->SetLineWidth(1);
321  a1->SetLineColor(kRed);
322  a1->Draw();
323 
324  TText* tx1 = new TText(x1+0.09, 1.14*y1,"out of time tracks");
325  tx1->SetTextColor(kRed);
326  tx1->Draw();
327 
328  x1 = cosnumiinh->GetBinCenter(18);
329  y1 = cosnumiinh->GetBinContent(18);
330 
331  TLine* a2 = new TLine(x1-0.04, 1.01*y1, x1-0.08, 1.12*y1);
332  a2->SetLineWidth(1);
333  a2->SetLineColor(kBlack);
334  a2->Draw();
335 
336  TText* tx2 = new TText(x1-0.06, 1.20*y1,"in time tracks");
337  tx2->SetTextAlign(31);
338  tx2->SetTextColor(kBlack);
339  tx2->Draw();
340 
341  NDOSLabel();
342 
343  cosnumic->SaveAs("cana_cosnumic.pdf");
344  cosnumic->SaveAs("cana_cosnumic.png");
345 }
tree Draw("slc.nhit")
enum BeamMode kRed
TH1F * a2
Definition: f2_nu.C:545
Float_t y1[n_points_granero]
Definition: compare.C:5
void Preliminary()
Put NOvA Preliminary on plots.
Float_t x1[n_points_granero]
Definition: compare.C:5
T sqrt(T number)
Definition: d0nt_math.hpp:156
TH1F * cosnumiinh
void NDOSLabel()
TH1F * a1
Definition: f2_nu.C:476
void CenterTitles(TH1 *histo)
TH1F * cosnumiouth
void cosnumi_proj ( TChain &  ch)

Definition at line 284 of file cana_time_peak.C.

References activity(), cosnumiinh, cosnumiouth, fiducial(), intime(), intimet, outtime(), and outtimet.

Referenced by proj_all().

285 {
286  cosnumiinh = new TH1F("cosnumiinh",
287  ";cos #theta_{NuMI}; Events / 0.05",
288  20, 0.0, 1.0);
289  cosnumiouth = new TH1F("cosnumiouth",
290  ";cos #theta_{NuMI}; Events / 0.05",
291  20, 0.0, 1.0);
292  ch.Project("cosnumiinh", "cosnumi",run&&activity&&fiducial&&intime);
293  ch.Project("cosnumiouth","cosnumi",run&&activity&&fiducial&&outtime);
294 
295  cosnumiouth->Scale(intimet/outtimet);
296 }
TCut intime("tave>=217.0 && tave<=227.8")
TH1F * cosnumiinh
double outtimet
Definition: run.py:1
TCut activity("nhit>=25&&nhitx>=3&&nhity>=3")
TCut outtime("(tave>0.0&&tave<200.0) || (tave>250.0&&tave<450.0)")
TH1F * cosnumiouth
double intimet
TCut fiducial(x1cut &&y1cut &&z1cut)
void fcn ( int ,
double *  ,
double &  f,
double *  p,
int   
)

Definition at line 550 of file cana_time_peak.C.

References chi2(), and make_time_profile().

Referenced by minimize().

551 {
552  make_time_profile(p[0], p[1], p[2], p[3]);
553  f = chi2();
554 }
void make_time_profile(double b, double f, double t0, double sigma)
const char * p
Definition: xmltok.h:285
double chi2()
TCut fiducial ( x1cut &&y1cut &&  z1cut)
TCut intime ( "tave>=217.0 && tave<=227.8"  )
void make_template ( double  sigma)

Definition at line 448 of file cana_time_peak.C.

References stan::math::floor(), Gaus(), MECModelEnuComparisons::i, calib::j, spill_length, spill_profile(), template_nbin, template_spillh, template_thi, template_tlo, w, and zoom_tbin_sz.

Referenced by make_time_profile().

449 {
450  if (template_spillh!=0) {
451  delete template_spillh;
452  template_spillh = 0;
453  }
454  if (template_spillh==0) {
455  template_tlo =
457  template_thi =
458  zoom_tbin_sz*
461  template_spillh = new TH1F("tempalte_spillh",";usec",
463  template_tlo,
464  template_thi);
465  }
466 
467  int i, j;
468  double ti, tj;
469  double s, w;
470  for (i=1; i<=template_nbin; ++i) {
471  ti = template_spillh->GetBinCenter(i);
472  s = spill_profile(ti);
473  for (j=1; j<template_nbin; ++j) {
474  tj = template_spillh->GetBinCenter(j);
475  w = TMath::Gaus(ti,tj,sigma);
476 
477  template_spillh->Fill(tj, w*s);
478  }
479  }
480  template_spillh->Scale(template_spillh->GetMaximum());
481 }
double template_tlo
const XML_Char * s
Definition: expat.h:262
int template_nbin
double zoom_tbin_sz
static const double spill_length
double Gaus(TH1D *h, double &err, bool isTruth)
Definition: absCal.cxx:489
const double j
Definition: BetheBloch.cxx:29
double sigma(TH1F *hist, double percentile)
TH1F * template_spillh
fvar< T > floor(const fvar< T > &x)
Definition: floor.hpp:11
double template_thi
Float_t w
Definition: plot.C:20
double spill_profile(double t)
void make_time_profile ( double  b,
double  f,
double  t0,
double  sigma 
)

Definition at line 488 of file cana_time_peak.C.

References MECModelEnuComparisons::i, make_template(), sigma(), confusionMatrixTree::t, template_nbin, template_spillh, time_profileh, zoom_nbin, zoom_thi, and zoom_tlo.

Referenced by fcn(), and minimize().

492 {
493  int i;
494 
495  static int ifirst = 1;
496  if (ifirst) {
497  time_profileh = new TH1F("time_profileh",
498  ";usec",
499  zoom_nbin,
500  zoom_tlo,
501  zoom_thi);
502  ifirst = 0;
503  }
504  time_profileh->Reset();
505 
506  static double last_sigma = 0.0;
507  if (last_sigma != sigma) {
508  last_sigma = sigma;
510  }
511 
512  double s, t;
513  //
514  // Put the background in
515  //
516  for (i=1; i<=time_profileh->GetNbinsX(); ++i) {
517  t = time_profileh->GetBinCenter(i);
518  time_profileh->Fill(t, b);
519  }
520  //
521  // Put the signal in
522  //
523  for (i=1; i<=template_nbin; ++i) {
524  t = template_spillh->GetBinCenter(i);
525  s = template_spillh->GetBinContent(i);
526  time_profileh->Fill(t+t0, f*s);
527  }
528 }
double zoom_tlo
const XML_Char * s
Definition: expat.h:262
int template_nbin
TH1F * time_profileh
double sigma(TH1F *hist, double percentile)
TH1F * template_spillh
const hit & b
Definition: hits.cxx:21
void make_template(double sigma)
int zoom_nbin
double zoom_thi
void minimize ( )

Definition at line 558 of file cana_time_peak.C.

References PandAna.Demos.pi0_spectra::bkg, om::cerr, e, allTimeWatchdog::endl, fcn(), stan::math::fmin(), MECModelEnuComparisons::i, make_time_profile(), std::sqrt(), getGoodRuns4SAM::t0, tavezoomh, febshutoff_auto::val, submit_syst::x, submit_syst::y, and zoom_nbin.

Referenced by proj_all().

559 {
560  int ierr;
561  TMinuit minuit;
562  minuit.SetPrintLevel(-99);
563  minuit.SetFCN(fcn);
564  minuit.mnparm(0, "bkg", 1e-3, 1e-4, 0, 10.0, ierr);
565  minuit.mnparm(1, "sf", 1e-3, 1e-4, 0, 10.0, ierr);
566  minuit.mnparm(2, "t0", 1e-3, 1e-4, 0, 10.0, ierr);
567  minuit.mnparm(3, "sigt", 1e-3, 1e-4, 0, 10.0, ierr);
568 
569  double chi2best = 99E99;
570  double p[4];
571  double sigp[4];
572 
573  int i;
574  double t0;
575  double x[zoom_nbin];
576  double y[zoom_nbin];
577  for (i=0; i<zoom_nbin; ++i) {
578  t0 = tavezoomh->GetBinCenter(i+1);
579 
580  minuit.mnparm(2, "t0", t0, 1e-3, 0.0, 500.0, ierr);
581  minuit.FixParameter(2);
582 
583  minuit.mnparm(3, "sigt", 0.512/sqrt(12)/sqrt(25), 1e-3, 0.0, 500.0, ierr);
584  minuit.FixParameter(3);
585 
586  minuit.Migrad();
587 
588  double fmin, fedm, errdef;
589  int npari, nparx, istat;
590  minuit.mnstat(fmin,fedm,errdef,npari,nparx,istat);
591  x[i] = t0;
592  y[i] = fmin;
593  std::cerr << i << "\t" << t0 << "\t" << fmin << std::endl;
594  if (fmin<chi2best) {
595  chi2best = fmin;
596 
597  double val, err, xlolim, xuplim;
598  int iuint;
599 
600  static TString bkg("bkg");
601  minuit.mnpout(0, bkg, val, err, xlolim, xuplim, iuint);
602  p[0] = val;
603  sigp[1] = err;
604 
605  static TString sf("sf");
606  minuit.mnpout(1, sf, val, err, xlolim, xuplim, iuint);
607  p[1] = val;
608  sigp[1] = err;
609 
610  static TString t0s("t0");
611  minuit.mnpout(2, t0s, val, err, xlolim, xuplim, iuint);
612  p[2] = val;
613  sigp[2] = err;
614 
615  static TString sigt("sigt");
616  minuit.mnpout(3, sigt, val, err, xlolim, xuplim, iuint);
617  p[3] = val;
618  sigp[3] = err;
619  }
620  }
621  make_time_profile(p[0], p[1], p[2], p[3]);
622 
623  std::cerr << "chi2 = " << chi2best << std::endl;
624  std::cerr << "Best b = " << p[0] <<" +/- " << sigp[0] << std::endl;
625  std::cerr << "Best sf = " << p[1] <<" +/- " << sigp[1] << std::endl;
626  std::cerr << "Best t0 = " << p[2] <<" +/- " << sigp[2] << std::endl;
627  std::cerr << "Best sigt= " << p[3] <<" +/- " << sigp[3] << std::endl;
628 }
fvar< T > fmin(const fvar< T > &x1, const fvar< T > &x2)
Definition: fmin.hpp:14
void make_time_profile(double b, double f, double t0, double sigma)
const char * p
Definition: xmltok.h:285
T sqrt(T number)
Definition: d0nt_math.hpp:156
void fcn(int &, double *, double &f, double *p, int)
OStream cerr
Definition: OStream.cxx:7
TH1F * tavezoomh
Float_t e
Definition: plot.C:35
int zoom_nbin
void NDOSLabel ( )

Definition at line 56 of file cana_time_peak.C.

References label.

Referenced by cosnumi_plot(), nhit_plot(), time_wide_plot(), time_zoom_plot(), x1_plot(), y1_plot(), and z1_plot().

57 {
58  TLatex* tx = new TLatex(0.1, .93, label);
59  tx->SetTextColor(kBlack);
60  tx->SetNDC();
61  tx->SetTextSize(1/30.);
62  tx->SetTextAlign(12);
63  tx->Draw();
64 }
const char * label
void nhit_plot ( )

Definition at line 95 of file cana_time_peak.C.

References CenterTitles(), kGreen, std::log10(), NDOSLabel(), nhith, cet::pow(), and Preliminary().

Referenced by plot_all().

96 {
97  gStyle->SetOptStat(0);
98 
99  TCanvas* nhitc = new TCanvas("nhitc","nhitc",800,600);
100  nhitc->SetLogy();
101 
102  nhith->SetFillColor(kGreen-10);
104  nhith->Draw();
105  Preliminary();
106 
107  TLine* nhitl = new TLine(25.0, 0, 25.0, nhith->GetMaximum());
108  nhitl->SetLineStyle(3);
109  nhitl->Draw();
110  double ya1 = 0.75*log10(nhith->GetMaximum());
111  double ya2 = 0.75*log10(nhith->GetMaximum())+0.9;
112  double ya3 = pow(10,0.5*(ya1+ya2));
113  ya1 = pow(10,ya1);
114  ya2 = pow(10,ya2);
115  TArrow* nhita1 = new TArrow(25.0, ya1, 30.0, ya1, 0.03);
116  TArrow* nhita2 = new TArrow(25.0, ya2, 30.0, ya2, 0.03);
117  nhita1->Draw();
118  nhita2->Draw();
119 
120  TText* tx2 = new TText(30.0, ya3, "selected");
121  tx2->SetTextFont(42);
122  tx2->SetTextAlign(12);
123  tx2->SetTextSize(0.035);
124  tx2->Draw();
125 
126  NDOSLabel();
127 
128  nhitc->SaveAs("cana_nhit.pdf");
129  nhitc->SaveAs("cana_nhit.png");
130 }
void Preliminary()
Put NOvA Preliminary on plots.
constexpr T pow(T x)
Definition: pow.h:75
void NDOSLabel()
TH1F * nhith
T log10(T number)
Definition: d0nt_math.hpp:120
void CenterTitles(TH1 *histo)
enum BeamMode kGreen
void nhit_proj ( TChain &  ch)

Definition at line 88 of file cana_time_peak.C.

References kGreen, and nhith.

Referenced by proj_all().

89 {
90  nhith = new TH1F("nhith",";N_{hit};Events",101,-0.5,100.5);
91  nhith->SetFillColor(kGreen-10);
92  ch.Project("nhith","nhit", run);
93 }
TH1F * nhith
Definition: run.py:1
enum BeamMode kGreen
TCut outtime ( "(tave>0.0&&tave<200.0) || (tave>250.0&&tave<450.0)"  )
void plot_all ( )

Definition at line 687 of file cana_time_peak.C.

References cosnumi_plot(), nhit_plot(), time_wide_plot(), time_zoom_plot(), x1_plot(), y1_plot(), and z1_plot().

688 {
689  nhit_plot();
690  y1_plot();
691  x1_plot();
692  z1_plot();
693  cosnumi_plot();
694  time_wide_plot();
695  time_zoom_plot();
696 }
void x1_plot()
void nhit_plot()
void y1_plot()
void z1_plot()
void time_zoom_plot()
void cosnumi_plot()
void time_wide_plot()
void Preliminary ( )

Put NOvA Preliminary on plots.

Definition at line 67 of file cana_time_peak.C.

References kBlue, and prelim.

Referenced by cosnumi_plot(), nhit_plot(), time_wide_plot(), time_zoom_plot(), x1_plot(), y1_plot(), and z1_plot().

68 {
69  TLatex* prelim = new TLatex(.9, .93, "NOvA Preliminary");
70  prelim->SetTextColor(kBlue);
71  prelim->SetNDC();
72  prelim->SetTextSize(1/30.);
73  prelim->SetTextAlign(32);
74  prelim->Draw();
75 }
TLatex * prelim
Definition: Xsec_final.C:133
enum BeamMode kBlue
void proj_all ( TChain &  ch)

Definition at line 663 of file cana_time_peak.C.

References cosnumi_proj(), om::cout, allTimeWatchdog::endl, minimize(), nhit_proj(), time_wide_proj(), time_zoom_proj(), x1_proj(), y1_proj(), and z1_proj().

664 {
665 
666  std::cout<<"starting proj"<<std::endl;
667  nhit_proj(ch);
668  std::cout<<"nhit done"<<std::endl;
669  y1_proj(ch);
670  std::cout<<"y1 done"<<std::endl;
671  x1_proj(ch);
672  std::cout<<"x1 done"<<std::endl;
673  z1_proj(ch);
674  std::cout<<"z1 done"<<std::endl;
675  cosnumi_proj(ch);
676  std::cout<<"cosnumi done"<<std::endl;
677  time_wide_proj(ch);
678  std::cout<<"time wide done"<<std::endl;
679  time_zoom_proj(ch);
680  std::cout<<"time zoom done"<<std::endl;
681  minimize();
682  std::cout<<"minimize done"<<std::endl;
683 }
void time_zoom_proj(TChain &ch)
void minimize()
void y1_proj(TChain &ch)
void cosnumi_proj(TChain &ch)
void z1_proj(TChain &ch)
void x1_proj(TChain &ch)
OStream cout
Definition: OStream.cxx:6
void nhit_proj(TChain &ch)
void time_wide_proj(TChain &ch)
TCut run ( "run>=15071&&run<=15131"  )
double spill_profile ( double  t)

Definition at line 424 of file cana_time_peak.C.

References dt_batch, dt_cycle, spill_length, and confusionMatrixTree::t.

Referenced by make_template().

425 {
426  if (t<0.0) return 0.0;
427  if (t>spill_length) return 0.0;
428 
429  // Rewind cycle by cycle
430  double ttmp = t;
431  while (ttmp>dt_cycle) ttmp -= dt_cycle;
432 
433  // Check it we are inside the "on" part of the cycle
434  if (ttmp<0.0) return 0.0;
435  if (ttmp>dt_batch) return 0.0;
436 
437  return 1.0;
438 }
static const double spill_length
static const double dt_batch
static const double dt_cycle
void time_wide_plot ( )

Definition at line 357 of file cana_time_peak.C.

References b, CenterTitles(), om::cout, allTimeWatchdog::endl, check_time_usage::float, stan::math::floor(), kGreen, NDOSLabel(), Preliminary(), std::sqrt(), t1, t2, and tavewideh.

Referenced by plot_all().

358 {
359  gStyle->SetOptStat(0);
360 
361  TCanvas* cana_tave_wide =
362  new TCanvas("cana_tave_wide","cana_tave_wide",800,600);
363  tavewideh->SetFillColor(kGreen-10);
365  tavewideh->SetMaximum(floor(tavewideh->GetMaximum())+1);
366  tavewideh->Draw();
367  Preliminary();
368 
369  unsigned int i1 = tavewideh->FindBin(t1);
370  unsigned int i2 = tavewideh->FindBin(t2);
371  double splusb = tavewideh->Integral(i1,i2);
372  double b =
373  tavewideh->Integral(i1-25,i1-1) +
374  tavewideh->Integral(i2+1,i2+25);
375  b *= (float)(i2-i1+1)/50.0;
376  double fom = (splusb-b)/sqrt(b);
377  std::cout << "FOM: " << fom << std::endl;
378 
379  NDOSLabel();
380 
381  /*
382  TText* tx4 = new TText(240, 15, "Best fit for NuMI beam spill window");
383  tx4->SetTextFont(32);
384  tx4->SetTextSize(0.035);
385  tx4->SetTextColor(kRed);
386  tx4->Draw();
387  */
388 
389  cana_tave_wide->SaveAs("cana_tave_wide.pdf");
390  cana_tave_wide->SaveAs("cana_tave_wide.png");
391 }
void Preliminary()
Put NOvA Preliminary on plots.
T sqrt(T number)
Definition: d0nt_math.hpp:156
void NDOSLabel()
double t1
double t2
OStream cout
Definition: OStream.cxx:6
TH1F * tavewideh
fvar< T > floor(const fvar< T > &x)
Definition: floor.hpp:11
const hit & b
Definition: hits.cxx:21
void CenterTitles(TH1 *histo)
enum BeamMode kGreen
void time_wide_proj ( TChain &  ch)

Definition at line 350 of file cana_time_peak.C.

References canacuts(), and tavewideh.

Referenced by proj_all().

351 {
352  tavewideh = new TH1F("tavewideh",
353  ";NDOS event time [#musec];Events / 2 #musec",
354  250,0,500);
355  ch.Project("tavewideh", "tave", canacuts);
356 }
TCut canacuts(run &&fiducial &&activity &&cosnumi)
TH1F * tavewideh
void time_zoom_plot ( )

Definition at line 632 of file cana_time_peak.C.

References CenterTitles(), kGreen, kRed, NDOSLabel(), Preliminary(), tavezoomh, and time_profileh.

Referenced by plot_all().

633 {
634  TCanvas* time_zoom_drawc =
635  new TCanvas("time_zoom_drawc",
636  "time_zoom_drawc",800,600);
637  tavezoomh->SetFillColor(kGreen-10);
639  tavezoomh->SetLineWidth(1);
640  tavezoomh->Draw();
641  Preliminary();
642 
643  if (time_profileh) {
644  time_profileh->SetLineWidth(2);
645  time_profileh->SetLineColor(kRed);
646  time_profileh->Draw("same");
647  }
648 
649  TLegend *tleg = new TLegend(0.15,0.75,0.43,0.85);
650  tleg->SetTextFont(42);
651  tleg->SetTextSize(0.04);
652  tleg->AddEntry(time_profileh,"Fit to NuMI Beam Structure");
653  tleg->Draw();
654 
655  NDOSLabel();
656 
657  time_zoom_drawc->SaveAs("cana_time_zoom.png");
658  time_zoom_drawc->SaveAs("cana_time_zoom.pdf");
659 }
enum BeamMode kRed
void Preliminary()
Put NOvA Preliminary on plots.
TH1F * tavezoomh
void NDOSLabel()
TH1F * time_profileh
void CenterTitles(TH1 *histo)
enum BeamMode kGreen
void time_zoom_proj ( TChain &  ch)

Definition at line 401 of file cana_time_peak.C.

References canacuts(), tavezoomh, zoom_nbin, zoom_thi, and zoom_tlo.

Referenced by proj_all().

402 {
403  gStyle->SetOptStat(0);
404 
405  tavezoomh = new TH1F("tavezoomh",
406  ";NDOS event time [#musec];Events / 50 nsec",
407  zoom_nbin,
408  zoom_tlo,
409  zoom_thi);
410  ch.Project("tavezoomh", "tave", canacuts);
411 }
TH1F * tavezoomh
double zoom_tlo
TCut canacuts(run &&fiducial &&activity &&cosnumi)
int zoom_nbin
double zoom_thi
void x1_plot ( )

Definition at line 185 of file cana_time_peak.C.

References CenterTitles(), kGreen, NDOSLabel(), Preliminary(), and x1h.

Referenced by plot_all().

186 {
187  gStyle->SetOptStat(0);
188 
189  TCanvas* x1c = new TCanvas("x1c","x1c",800,600);
190 
191  x1h->SetFillColor(kGreen-10);
192  CenterTitles(x1h);
193  x1h->Draw();
194  Preliminary();
195 
196  TLine* x1l1 = new TLine(-100.0, 0, -100.0, x1h->GetMaximum());
197  TLine* x1l2 = new TLine( 100.0, 0, 100.0, x1h->GetMaximum());
198  x1l1->SetLineStyle(3);
199  x1l2->SetLineStyle(3);
200  x1l1->Draw();
201  x1l2->Draw();
202  double ya1 = 0.66*x1h->GetMaximum();
203  double ya2 = 0.60*x1h->GetMaximum();
204  double ya3 = 0.5*(ya1+ya2);
205 
206  TArrow* x1a1 = new TArrow(-100.0, ya1, -80.0, ya1, 0.02);
207  TArrow* x1a2 = new TArrow(-100.0, ya2, -80.0, ya2, 0.02);
208  x1a1->Draw();
209  x1a2->Draw();
210 
211  TText* tx2 = new TText(0.0,ya3,"selected");
212  tx2->SetTextFont(42);
213  tx2->SetTextAlign(22);
214  tx2->SetTextSize(0.035);
215  tx2->Draw();
216 
217  TArrow* x1a3 = new TArrow(100.0, ya1, 80.0, ya1, 0.025);
218  TArrow* x1a4 = new TArrow(100.0, ya2, 80.0, ya2, 0.025);
219  x1a3->Draw();
220  x1a4->Draw();
221 
222  NDOSLabel();
223 
224  x1c->SaveAs("cana_x1c.pdf");
225  x1c->SaveAs("cana_x1c.png");
226 }
void Preliminary()
Put NOvA Preliminary on plots.
TH1F * x1h
void NDOSLabel()
void CenterTitles(TH1 *histo)
enum BeamMode kGreen
void x1_proj ( TChain &  ch)

Definition at line 179 of file cana_time_peak.C.

References activity(), x1h, and y1cut().

Referenced by proj_all().

180 {
181  x1h = new TH1F("x1h",";upper end x location (cm); Events / cm",
182  500,-250,250);
183  ch.Project("x1h","x1", run&&activity&&y1cut);
184 }
TH1F * x1h
Definition: run.py:1
TCut y1cut("y1<150")
TCut activity("nhit>=25&&nhitx>=3&&nhity>=3")
TCut x1cut ( )

Referenced by z1_proj().

void y1_plot ( )

Definition at line 141 of file cana_time_peak.C.

References CenterTitles(), kGreen, NDOSLabel(), Preliminary(), and y1h.

Referenced by plot_all().

142 {
143  gStyle->SetOptStat(0);
144 
145  TCanvas* y1c = new TCanvas("y1c","y1c",800,600);
146 
147  y1h->SetFillColor(kGreen-10);
148  CenterTitles(y1h);
149  y1h->Draw();
150  Preliminary();
151 
152  TLine* y1l = new TLine(150.0, 0, 150.0, y1h->GetMaximum());
153  y1l->SetLineStyle(3);
154  y1l->Draw();
155  double ya1 = 0.66*y1h->GetMaximum();
156  double ya2 = 0.60*y1h->GetMaximum();
157  double ya3 = 0.5*(ya1+ya2);
158 
159  TArrow* y1a1 = new TArrow(150.0, ya1, 120.0, ya1, 0.03);
160  TArrow* y1a2 = new TArrow(150.0, ya2, 120.0, ya2, 0.03);
161  y1a1->Draw();
162  y1a2->Draw();
163 
164  NDOSLabel();
165 
166  TText* tx2 = new TText(110.0,ya3,"selected");
167  tx2->SetTextAlign(32);
168  tx2->SetTextFont(42);
169  tx2->SetTextSize(0.035);
170  tx2->Draw();
171 
172  y1c->SaveAs("cana_y1c.pdf");
173  y1c->SaveAs("cana_y1c.png");
174 }
void Preliminary()
Put NOvA Preliminary on plots.
void NDOSLabel()
TH1F * y1h
void CenterTitles(TH1 *histo)
enum BeamMode kGreen
void y1_proj ( TChain &  ch)

Definition at line 135 of file cana_time_peak.C.

References activity(), and y1h.

Referenced by proj_all().

136 {
137  y1h = new TH1F("y1h",";upper end y location (cm); Events / cm",
138  500,-250,250);
139  ch.Project("y1h","y1", run&&activity);
140 }
TH1F * y1h
Definition: run.py:1
TCut activity("nhit>=25&&nhitx>=3&&nhity>=3")
TCut y1cut ( )

Referenced by x1_proj(), and z1_proj().

void z1_plot ( )

Definition at line 237 of file cana_time_peak.C.

References CenterTitles(), kGreen, NDOSLabel(), Preliminary(), and z1h.

Referenced by plot_all().

238 {
239  gStyle->SetOptStat(0);
240 
241  TCanvas* z1c = new TCanvas("z1c","z1c",800,600);
242 
243  z1h->SetFillColor(kGreen-10);
244  CenterTitles(z1h);
245  z1h->Draw();
246  Preliminary();
247 
248  TLine* z1l1 = new TLine( 280.0, 0, 280.0, z1h->GetMaximum());
249  TLine* z1l2 = new TLine(1200.0, 0, 1200.0, z1h->GetMaximum());
250  z1l1->SetLineStyle(3);
251  z1l2->SetLineStyle(3);
252  z1l1->Draw();
253  z1l2->Draw();
254  double ya1 = 0.66*z1h->GetMaximum();
255  double ya2 = 0.60*z1h->GetMaximum();
256  double ya3 = 0.5*(ya1+ya2);
257 
258  TArrow* z1a1 = new TArrow(280.0, ya1, 330.0, ya1, 0.025);
259  TArrow* z1a2 = new TArrow(280.0, ya2, 330.0, ya2, 0.025);
260  z1a1->Draw();
261  z1a2->Draw();
262 
263  TText* tx2 = new TText(700.0,ya3,"selected");
264  tx2->SetTextFont(42);
265  tx2->SetTextAlign(22);
266  tx2->SetTextSize(0.035);
267  tx2->Draw();
268 
269  TArrow* z1a3 = new TArrow(1200.0, ya1, 1150.0, ya1, 0.025);
270  TArrow* z1a4 = new TArrow(1200.0, ya2, 1150.0, ya2, 0.025);
271  z1a3->Draw();
272  z1a4->Draw();
273 
274  NDOSLabel();
275 
276  z1c->SaveAs("cana_z1c.pdf");
277  z1c->SaveAs("cana_z1c.png");
278 }
void Preliminary()
Put NOvA Preliminary on plots.
void NDOSLabel()
TH1F * z1h
void CenterTitles(TH1 *histo)
enum BeamMode kGreen
void z1_proj ( TChain &  ch)

Definition at line 231 of file cana_time_peak.C.

References activity(), x1cut(), y1cut(), and z1h.

Referenced by proj_all().

232 {
233  z1h = new TH1F("z1h",";upper end z location (cm); Events / 10 cm",
234  140,0,1400);
235  ch.Project("z1h","z1",run&&activity&&y1cut&&x1cut);
236 }
TCut x1cut("abs(x1)<100")
TH1F * z1h
Definition: run.py:1
TCut y1cut("y1<150")
TCut activity("nhit>=25&&nhitx>=3&&nhity>=3")
TCut z1cut ( )

Variable Documentation

TH1F* cosnumiinh

Definition at line 282 of file cana_time_peak.C.

Referenced by cosnumi_plot(), and cosnumi_proj().

TH1F* cosnumiouth

Definition at line 283 of file cana_time_peak.C.

Referenced by cosnumi_plot(), and cosnumi_proj().

const double dt_batch = 81*18.83E-3
static

Definition at line 419 of file cana_time_peak.C.

Referenced by spill_profile().

const double dt_cycle = dt_batch + dt_gap
static

Definition at line 421 of file cana_time_peak.C.

Referenced by spill_profile().

const double dt_gap = 5*18.83E-3
static

Definition at line 420 of file cana_time_peak.C.

double intimet = (t2-t1)

Definition at line 53 of file cana_time_peak.C.

Referenced by cosnumi_proj().

const char* label = "NDOS Data, 09/12/13 - 09/27/13"

Definition at line 34 of file cana_time_peak.C.

Referenced by cvn::RegPixelMap::Add(), cvn::PixelMap::Add(), Ana2017_sb_opening_macro(), AnaResultsSpectra(), cheat::TestTrackIds::beginJob(), dprf::ChannelPlots::beginRun(), BestFitToDataRelease(), BicountEllipse_dCP(), bin_composition_pie_chart(), BiprobEllipse_dCP(), dbutils::gui::BitmapEditor::BitmapEditor(), caf_numu_fd_validation_data(), caf_numu_fd_validation_MC(), caf_numu_fd_validation_MC_no_tau(), CalculateXSec(), dbutils::gui::ConfigSelectionDialog::ConfigSelectionDialog(), ana::CountingExperimentErrorBarChart(), cvn::RegPixelMapProducer::CreateMapGivenBoundary(), cvn::PixelMapProducer::CreateMapGivenBoundary(), cvn::RegPixelMapProducer::CreateMapGivenShowerVertex(), cvn::RegPixelMapProducer::CreateMapGivenVertex(), data_over_mc_profile(), DataVtxDistributionAna(), DataVtxDistributionLoad(), demoFitContours(), demoFitSlices(), DirNameToProbe(), DirNameToTarget(), DrawDeltaChiSqrWithContours(), DrawHCLabel(), drawLongTerm(), DrawResBin(), drawTimePlots(), drawVsPOT(), efficiency(), efficiencySA(), skim::CellHitSkimmer::EvaluateSlices(), ExtendedAxesAna(), fake_future_data(), FD_plots(), fiducial_opt(), FitParamEffectsAna(), FitSystEffectsAna(), genie_contours(), getBatch(), getBNBPlots(), art::DataViewImpl::getByLabel(), GetGENIEShiftLabels(), getTimePeakPlots(), GetXSecShiftLabels(), goodness_of_fit(), GraphsToDataRelease(), dprf::ChannelPlots::HRFebToStringLabel(), rb::IsFiltered(), joint_fit_2017_slices(), joint_fit_2018_contours(), joint_fit_2018_slices(), joint_fit_2019_bestfit(), joint_fit_2019_contours(), joint_fit_2019_slices(), joint_fit_future_bestfit_univ(), joint_fit_future_contour_univ(), jointsensitivity(), CalibAnaPlot::LegendLabel(), ana::NumuSyst::LoadFrom(), ana::NCSyst::LoadFrom(), ana::LoadFrom(), ana::NueSyst::LoadFrom(), ana::FluxReweight::LoadFrom(), ana::NDOscillatableSpectrum::LoadFrom(), ana::ReweightableSpectrum::LoadFrom(), ana::OscillatableSpectrum::LoadFrom(), ana::SystMakerShift::LoadFrom(), ana::GenericSystematicDef< SRType >::LoadFrom(), ana::TruthReweight::LoadFrom(), ana::RecoReweight::LoadFrom(), ana::SystMaker::LoadFrom(), ana::Spectrum::LoadFrom(), ana::LoadFromFile(), make_pi0_xcheck(), make_pid(), calib::MakeAttenuationProfiles::MakeAttenuationProfiles(), MakePlots(), MakeSummaryTable(), NDOSLabel(), cvn::RegPixelMap::NInput(), cvn::PixelMap::NInput(), nuint09_1pi1(), nuint09_1pi2(), nuint09_1pi3(), nuint09_1pi4(), nuint09_coh1(), nuint09_coh2(), nuint09_coh3(), nuint09_qel1(), nuint09_qel2(), nuint09_qel3(), nuint09_qel4(), nuint09_qel5(), nuint09_qel6(), order_chns::operator()(), genie::flux::operator<<(), ana::CutOptimization::OptimizedSigmaOverSigma(), evdb::ParameterSetEdit::ParameterSetEdit(), pi0_xcheck(), plot_joint_fit_2020_slices(), plot_pid(), PlotEvents(), ana::PlotPurEff(), ana::PlotSpectra(), preselection_cutflow(), fxwgt::FluxWeightCalculator::produce(), reco_minus_true_panels(), skim::CellHitSkimmer::reconfigure(), run_joint_fit_2020_bestfit(), run_joint_fit_2020_contours(), run_joint_fit_2020_slices(), ana::SaveTo(), sensitivity2018(), sensitivity2020(), set_labels_1D(), set_labels_2D(), ana::SpectrumHandler::SetLoader(), evd::SliceButtonBar::SliceButtonBar(), SpectrumParamEffectsAna(), TheoryEllipse_dCP(), timingPeak(), Tutorial2019Fit(), Tutorial2019FitContours(), Tutorial2019FitSlices(), om::WatchListBox::UpdateCurrentList(), validationscript(), cvn::CVNEventDump::WriteMapTH2(), cvn::CVNCosmicEventDump::WriteMapTH2(), calib::MakeAttenuationProfiles::writeResults(), FDPredictionHandler::~FDPredictionHandler(), and NDPredictionHandler::~NDPredictionHandler().

const int nbatch = 6
static

Definition at line 418 of file cana_time_peak.C.

TH1F* nhith

Definition at line 87 of file cana_time_peak.C.

Referenced by make_nhitc(), nhit_plot(), and nhit_proj().

int ntbin_per_usec = 20

Definition at line 396 of file cana_time_peak.C.

double outtimet = 400.0

Definition at line 54 of file cana_time_peak.C.

Referenced by cosnumi_proj().

const double spill_length = nbatch*dt_batch + (nbatch-1)*dt_gap
static

Definition at line 422 of file cana_time_peak.C.

Referenced by make_template(), and spill_profile().

double t1 = 217.0

Definition at line 49 of file cana_time_peak.C.

Referenced by time_wide_plot().

double t2 = 227.8
TH1F* tavewideh

Definition at line 349 of file cana_time_peak.C.

Referenced by time_wide_plot(), and time_wide_proj().

TH1F* tavezoomh

Definition at line 395 of file cana_time_peak.C.

Referenced by chi2(), minimize(), time_zoom_plot(), and time_zoom_proj().

int template_nbin

Definition at line 447 of file cana_time_peak.C.

Referenced by make_template(), and make_time_profile().

TH1F* template_spillh = 0

Definition at line 444 of file cana_time_peak.C.

Referenced by make_template(), and make_time_profile().

double template_thi

Definition at line 446 of file cana_time_peak.C.

Referenced by make_template().

double template_tlo

Definition at line 445 of file cana_time_peak.C.

Referenced by make_template().

TH1F* time_profileh

Definition at line 487 of file cana_time_peak.C.

Referenced by chi2(), make_time_profile(), and time_zoom_plot().

TH1F* x1h

Definition at line 178 of file cana_time_peak.C.

Referenced by x1_plot(), and x1_proj().

TH1F* y1h

Definition at line 134 of file cana_time_peak.C.

Referenced by y1_plot(), and y1_proj().

TH1F* z1h

Definition at line 230 of file cana_time_peak.C.

Referenced by z1_plot(), and z1_proj().

Definition at line 400 of file cana_time_peak.C.

Referenced by chi2(), make_time_profile(), minimize(), and time_zoom_proj().

double zoom_tbin_sz = 1.0/(float)ntbin_per_usec

Definition at line 397 of file cana_time_peak.C.

Referenced by make_template().

double zoom_thi = floor(t2) + 6

Definition at line 399 of file cana_time_peak.C.

Referenced by make_time_profile(), and time_zoom_proj().

double zoom_tlo = floor(t1) - 5

Definition at line 398 of file cana_time_peak.C.

Referenced by make_time_profile(), and time_zoom_proj().