Classes | Functions
validation Namespace Reference

Class to run in order to validate ChannelInfo. More...

Classes

class  NoiseClusterAnalysis
 
class  ValidateChannelInfo
 
class  ValidateDAQ2RawDigit
 

Functions

def setup_nova ()
 
def setup_rootlogin ()
 
def sendemail ()
 
def mcvalidate (release1='S11.04.30', release2='S11.06.14', process='genie', horncurrent='nhc', swapping='none', det='ndos')
 
def recovalidate (release1='S11.04.30', release2='S11.06.14', det='NDOS', beam='numi', directory='recohist')
 

Detailed Description

Class to run in order to validate ChannelInfo.

DAQ2RawDigit validation.

Author
nowak.nosp@m.@umn.nosp@m..edu
Jarek Nowak
Date

Function Documentation

def validation.mcvalidate (   release1 = 'S11.04.30',
  release2 = 'S11.06.14',
  process = 'genie',
  horncurrent = 'nhc',
  swapping = 'none',
  det = 'ndos' 
)

Definition at line 121 of file validation.py.

References SetTitle().

Referenced by recovalidate().

121 def mcvalidate(release1='S11.04.30', release2='S11.06.14', process='genie',horncurrent='nhc', swapping='none', det='ndos'):
122 
123  histos = ('fVertexX',
124  'fVertexY',
125  'fVertexZ',
126  'fDCosX',
127  'fDCosY',
128  'fDCosZ',
129  'fMuMomentum',
130  'fMuDCosX',
131  'fMuDCosY',
132  'fMuDCosZ',
133  'fEMomentum',
134  'fEDCosX',
135  'fEDCosY',
136  'fEDCosZ',
137  'fECons',
138  'fVertexHadronDecayX',
139  'fVertexHadronDecayY',
140  'fVertexHadronDecayZ')
141 
142  gROOT.ForceStyle()
143  c1 = TCanvas("c1","c1",10,10,800,600)
144  gPad.SetLeftMargin(0.15)
145  c1.Clear()
146  c1.Divide(1,2)
147  gStyle.SetPalette(1)
148  gStyle.SetOptStat(000)
149  gStyle.SetFillColor(10)
150 
151  c1.Print("%s_%s_%s_%s_%s_%s.pdf["%(release1,release2,process,horncurrent,swapping,det))
152 
153  output1 = TFileMerger()
154  output1.OutputFile('%s.root'%release1)
155 
156  path = '/nova/data/mc/%s/%s/ndos/mccheckout'%(release1,process)
157  n = 0
158  for f in glob.glob(os.path.join(path,'*%s_*_%s_%s*.root'%(horncurrent,swapping,det))):
159  n = n + 1
160  if n <= 50:
161  output1.AddFile("%s"%f)
162  else:
163  pass
164  output1.Merge()
165  path = '/nova/data/mc/%s/%s/ndos/mccheckout'%(release2,process)
166  output2 = TFileMerger()
167  output2.OutputFile('%s.root'%release2)
168  n = 0
169  for f in glob.glob(os.path.join(path,'*%s_*_%s_%s*.root'%(horncurrent,swapping,det))):
170  n = n + 1
171  if n <= 20:
172  output2.AddFile("%s"%f)
173  else:
174  pass
175  output2.Merge()
176 
177  for histo in histos:
178 
179  f_tag1 = TFile('%s.root'%release1)
180  histo1 = f_tag1.Get("NeutrinoAna/%s"%histo)
181 
182  f_tag2 = TFile('%s.root'%release2)
183  histo2 = f_tag2.Get("NeutrinoAna/%s"%histo)
184 
185  scale = histo2.Integral()/histo1.Integral()
186 
187  c1.cd(1)
188  histo1.Scale(scale)
189  histo1.SetLineColor(kBlue)
190  histo1.SetFillColor(kBlue)
191  histo1.SetFillStyle(3004)
192  histo1.GetXaxis().SetTitle("%s"%histo)
193  histo1.GetYaxis().SetTitleOffset(1.2)
194  histo1.GetYaxis().SetTitle("Events")
195  histo1.DrawCopy()
196  histo2.SetLineColor(kRed)
197  histo2.DrawCopy("same")
198  kolmogorov = histo1.KolmogorovTest(histo2)
199  print kolmogorov
200 
201  legend1 = TLegend(0.70,0.80,0.89,0.89,"")
202  legend1.AddEntry(histo1,"%s"%release1,"f")
203  legend1.AddEntry(histo2,"%s"%release2,"l")
204  legend1.Draw()
205 
206  c1.cd(2)
207  histo1.Sumw2()
208  histo2.Sumw2()
209  ratio = histo1.Clone("ratio");
210  ratio.Divide(ratio,histo2,1,1,"")
211  ratio.SetLineColor(kBlue)
212  ratio.GetXaxis().SetTitle("%s"%histo)
213  ratio.GetYaxis().SetTitle("Ratio (%s / %s)"%(release2,release1))
214  ratio.DrawCopy()
215 
216  legend2 = TLegend(0.70,0.80,0.89,0.89,"")
217  legend2.AddEntry(ratio,"Ratio","l")
218  legend2.Draw()
219  c1.Print("%s_%s_%s_%s_%s_%s.pdf"%(release1,release2,process,horncurrent,swapping,det))
220 
221  c1.Print("%s_%s_%s_%s_%s_%s.pdf]"%(release1,release2,process,horncurrent,swapping,det))
222 
223 
def mcvalidate(release1='S11.04.30', release2='S11.06.14', process='genie', horncurrent='nhc', swapping='none', det='ndos')
Definition: validation.py:121
gargamelle SetTitle("Gargamelle #nu_{e} CC data")
def validation.recovalidate (   release1 = 'S11.04.30',
  release2 = 'S11.06.14',
  det = 'NDOS',
  beam = 'numi',
  directory = 'recohist' 
)

Definition at line 224 of file validation.py.

References BlessedPlots.main(), mcvalidate(), sendemail(), SetTitle(), setup_nova(), and setup_rootlogin().

224 def recovalidate(release1='S11.04.30', release2='S11.06.14', det='NDOS', beam='numi', directory='recohist'):
225 
226  histos = ('dcosX',
227  'dcosY',
228  'dcosZ',
229  'startX',
230  'startY',
231  'startZ',
232  'endX',
233  'endY',
234  'endZ',
235  'diffX',
236  'diffY',
237  'diffZ',
238  'dirX',
239  'dirY',
240  'fractionHitsUsed',
241  'fractionSigUsed',
242  'cellHitSig',
243  'endDistToEdge',
244  'vtxDistToEdge',
245  'hitXPosition',
246  'hitYPosition',
247  'hitZPosition',
248  'trackLengthInCell',
249  'trackLength',
250  'coscosmic',
251  'xRecoHitTNS',
252  'yRecoHitTNS')
253 
254  gROOT.ForceStyle()
255  c1 = TCanvas("c1","c1",10,10,800,600)
256  gPad.SetLeftMargin(0.15)
257  c1.Clear()
258  c1.Divide(1,2)
259  gStyle.SetPalette(1)
260  gStyle.SetOptStat(000)
261  gStyle.SetFillColor(10)
262 
263  c1.Print("%s_%s_%s_%s.pdf["%(release1,release2,det,directory))
264 
265  output1 = TFileMerger()
266  output1.OutputFile('%s.root'%release1)
267 
268  path = '/nova/data/novareco/%s/%s/%s'%(det,release1,directory)
269  n = 0
270  for f in glob.glob(os.path.join(path,'*%s*.root'%(beam))):
271  n = n + 1
272  if n <= 10:
273  output1.AddFile("%s"%f)
274  else:
275  pass
276  output1.Merge()
277  path = '/nova/data/novareco/%s/%s/%s'%(det,release2,directory)
278  output2 = TFileMerger()
279  output2.OutputFile('%s.root'%release2)
280  n = 0
281  for f in glob.glob(os.path.join(path,'*%s*.root'%(beam))):
282  n = n + 1
283  if n <= 10:
284  output2.AddFile("%s"%f)
285  else:
286  pass
287  output2.Merge()
288 
289  for histo in histos:
290 
291  f_tag1 = TFile('%s.root'%release1)
292  histo1 = f_tag1.Get("NeutrinoAna/%s"%histo)
293 
294  f_tag2 = TFile('%s.root'%release2)
295  histo2 = f_tag2.Get("NeutrinoAna/%s"%histo)
296 
297  scale = histo2.Integral()/histo1.Integral()
298 
299  c1.cd(1)
300  histo1.Scale(scale)
301  histo1.SetLineColor(kBlue)
302  histo1.SetFillColor(kBlue)
303  histo1.SetFillStyle(3004)
304  histo1.GetXaxis().SetTitle("%s"%histo)
305  histo1.GetYaxis().SetTitleOffset(1.5)
306  histo1.GetYaxis().SetTitle("Events")
307  histo1.DrawCopy()
308  histo2.SetLineColor(kRed)
309  histo2.DrawCopy("same")
310  kolmogorov = histo1.KolmogorovTest(histo2)
311  print kolmogorov
312 
313  legend1 = TLegend(0.70,0.80,0.89,0.89,"")
314  legend1.AddEntry(histo1,"%s"%release1,"f")
315  legend1.AddEntry(histo2,"%s"%release2,"l")
316  legend1.Draw()
317 
318  c1.cd(2)
319  histo1.Sumw2()
320  histo2.Sumw2()
321  ratio = histo1.Clone("ratio");
322  ratio.Divide(ratio,histo2,1,1,"")
323  ratio.SetLineColor(kBlue)
324  ratio.GetXaxis().SetTitle("%s"%histo)
325  ratio.GetYaxis().SetTitle("Ratio (%s / %s)"%(release2,release1))
326  ratio.DrawCopy()
327 
328  legend2 = TLegend(0.70,0.80,0.89,0.89,"")
329  legend2.AddEntry(ratio,"Ratio","l")
330  legend2.Draw()
331  c1.Print("%s_%s_%s_%s_%s.pdf"%(release1,release2,horncurrent,swapping,det))
332 
333  c1.Print("%s_%s_%s_%s_%s.pdf]"%(release1,release2,horncurrent,swapping,det))
334 
def recovalidate(release1='S11.04.30', release2='S11.06.14', det='NDOS', beam='numi', directory='recohist')
Definition: validation.py:224
gargamelle SetTitle("Gargamelle #nu_{e} CC data")
def validation.sendemail ( )

Definition at line 87 of file validation.py.

Referenced by recovalidate().

87 def sendemail():
88  import smtplib
89 
90  SERVER = "localhost"
91 
92  FROM = "tianxc@gmail.com"
93  TO = ["tianxc@fnal.gov"]
94 # must be a list
95 
96  SUBJECT = "Today's auto-validation results"
97 
98  today = datetime.date.today()
99 
100  TEXT = "Today's auto-validation results: http://nusoft.fnal.gov/nova/novasoft/dailyValidation/daily_validation_%s.pdf"%(today)
101  TEXT2 = "With K-S or chi^2 p-value less than 0.05: http://nusoft.fnal.gov/nova/novasoft/dailyValidation/daily_low_pValue_%s.pdf"%(today)
102 
103  # Prepare actual message
104 
105  message = """\
106 From: %s
107 To: %s
108 Subject: %s
109 
110 %s
111 %s
112  """ % (FROM, ", ".join(TO), SUBJECT, TEXT, TEXT2)
113 
114  # Send the mail
115 
116  server = smtplib.SMTP(SERVER)
117  server.sendmail(FROM, TO, message)
118  server.quit()
119 
120 
def sendemail()
Definition: validation.py:87
def validation.setup_nova ( )

Definition at line 8 of file validation.py.

Referenced by recovalidate().

8 def setup_nova():
9  print os.getenv("PWD")
10  if os.getenv("SRT_PUBLIC_CONTEXT") and os.getenv("SRT_PRIVATE_CONTEXT"):
11  print "The base and test release have been setup correctly"
12  else:
13  print "The base and test release have not been setup correctly"
14 
def setup_nova()
Definition: validation.py:8
def validation.setup_rootlogin ( )

Definition at line 15 of file validation.py.

Referenced by recovalidate().

16  # Defaults to classic style, but that's OK, we can fix it
17  novaStyle = TStyle("novaStyle", "NOvA Style");
18 
19  # Centre title
20  novaStyle.SetTitleAlign(22);
21  novaStyle.SetTitleX(.5);
22  novaStyle.SetTitleY(.95);
23  novaStyle.SetTitleBorderSize(0);
24 
25  # No info box
26  novaStyle.SetOptStat(0);
27 
28  # set the background color to white
29  novaStyle.SetFillColor(10);
30  novaStyle.SetFrameFillColor(10);
31  novaStyle.SetCanvasColor(10);
32  novaStyle.SetPadColor(10);
33  novaStyle.SetTitleFillColor(0);
34  novaStyle.SetStatColor(10);
35 
36  # Don't put a colored frame around the plots
37  novaStyle.SetFrameBorderMode(0);
38  novaStyle.SetCanvasBorderMode(0);
39  novaStyle.SetPadBorderMode(0);
40 
41  # Set the default line color for a fit function to be red
42  novaStyle.SetFuncColor(kRed);
43 
44  # Marker settings
45  # novaStyle.SetMarkerStyle(kFullCircle);
46 
47  # No border on legends
48  novaStyle.SetLegendBorderSize(0);
49 
50  # Scientific notation on axes
51  # TGaxis::SetMaxDigits(3);
52 
53  # Axis titles
54  novaStyle.SetTitleSize(.05, "xyz");
55  novaStyle.SetTitleOffset(.8, "xyz");
56  # More space for y-axis to avoid clashing with big numbers
57  novaStyle.SetTitleOffset(.9, "y");
58  # This applies the same settings to the overall plot title
59  novaStyle.SetTitleSize(.05, "");
60  novaStyle.SetTitleOffset(.8, "");
61  # Axis labels (numbering)
62  novaStyle.SetLabelSize(.04, "xyz");
63  novaStyle.SetLabelOffset(.005, "xyz");
64 
65  # Thicker lines
66  novaStyle.SetHistLineWidth(2);
67  novaStyle.SetFrameLineWidth(2);
68  novaStyle.SetFuncWidth(2);
69 
70  # Set the number of tick marks to show
71  novaStyle.SetNdivisions(506, "xyz");
72 
73  # Set the tick mark style
74  novaStyle.SetPadTickX(1);
75  novaStyle.SetPadTickY(1);
76 
77  # Fonts
78  novaStyle.SetStatFont(42);
79  novaStyle.SetLabelFont(42, "xyz");
80  novaStyle.SetTitleFont(42, "xyz");
81  novaStyle.SetTitleFont(42, ""); # Apply same setting to plot titles
82  novaStyle.SetTextFont(42);
83  # novaStyle.SetLegendFont(kNovaFont);
84 
85  gROOT.SetStyle("novaStyle");
86 
def setup_rootlogin()
Definition: validation.py:15