385def compare():
386 test(eospath+'pythia8_Geant4_onlyMuons.root')
387 for x in ['','_>E']:
388 for z in ['p','pt']:
389 for ahist in ['mu-','mu+','mu','mu-charm','mu+charm','mucharm']:
390 h['TP'+z+ahist+x]=h['T'+z+ahist+x].Clone('CT'+ahist+x)
391 test(eospath+'pythia8_Geant4_Yandex_onlyNeutrinos.root')
392 for x in ['','_>E']:
393 for z in ['p','pt']:
394 for ahist in ['numusum','nuesum','numusumcharm','nuesumcharm','numu','numubar','nue','nuebar','numucharm','numubarcharm','nuecharm','nuebarcharm']:
395 h['TP'+z+ahist+x]=h['T'+z+ahist+x].Clone('CT'+ahist+x)
396 test(eospath+'Mbias/pythia8_Geant4-withCharm-ram.root')
397 for x in ['','_>E']:
398 for z in ['p','pt']:
399 t = z.upper()
400 if x != '' : t='>'+t
401 t1=h[t].cd(1)
402 p = z+'mu'
403 h['T'+p+x].SetTitle('musum')
404 h['T'+p+x].Draw()
405 h['T'+p+'charm'+x].Draw('same')
406 h['TP'+p+x].Draw('same')
407 h['TP'+p+x].SetLineColor(6)
408 h['TP'+p+'charm'+x].Draw('same')
409 h['TP'+p+'charm'+x].SetLineColor(3)
410 h['T'+p+'charm'+x].SetLineColor(2)
411 h['T'+p+x].SetLineColor(4)
412 h['L'+p+x] = ROOT.TLegend(0.33,0.69,0.99,0.94)
413 h['L'+p+x].AddEntry(h['T'+p+x],'muon new with charm, cascade, k-fac','PL')
414 h['L'+p+x].AddEntry(h['T'+p+'charm'+x],'muon from charm new with charm, cascade, k-fac','PL')
415 h['L'+p+x].AddEntry(h['TP'+p+x],'muon old CERN-Cracow prod','PL')
416 h['L'+p+x].AddEntry(h['TP'+p+'charm'+x],'muon from charm old CERN-Cracow prod','PL')
417 h['L'+p+x].Draw()
418 h[t].cd(2)
419 p = z+'numusum'
420 h['T'+p+x].Draw()
421 h['T'+p+'charm'+x].Draw('same')
422 h['TP'+p+x].Draw('same')
423 h['TP'+p+x].SetLineColor(6)
424 h['TP'+p+'charm'+x].Draw('same')
425 h['TP'+p+'charm'+x].SetLineColor(3)
426 h['T'+p+'charm'+x].SetLineColor(2)
427 h['T'+p+x].SetLineColor(4)
428 h['L'+p+x] = ROOT.TLegend(0.33,0.69,0.99,0.94)
429 h['L'+p+x].AddEntry(h['T'+p+x],'nu_mu new with charm, cascade, k-fac','PL')
430 h['L'+p+x].AddEntry(h['T'+p+'charm'+x],'nu_mu from charm new with charm, cascade, k-fac','PL')
431 h['L'+p+x].AddEntry(h['TP'+p+x],'nu_mu old CERN-Cracow prod','PL')
432 h['L'+p+x].AddEntry(h['TP'+p+'charm'+x],'nu_mu from charm old CERN-Cracow prod','PL')
433 h['L'+p+x].Draw()
434 t3=h[t].cd(3)
435 t3.SetLogy(1)
436 p = z+'nuesum'
437 h['T'+p+x].Draw()
438 h['T'+p+'charm'+x].Draw('same')
439 h['TP'+p+x].Draw('same')
440 h['TP'+p+x].SetLineColor(6)
441 h['TP'+p+'charm'+x].Draw('same')
442 h['TP'+p+'charm'+x].SetLineColor(3)
443 h['T'+p+'charm'+x].SetLineColor(2)
444 h['T'+p+x].SetLineColor(4)
445 h['L'+p+x] = ROOT.TLegend(0.33,0.69,0.99,0.94)
446 h['L'+p+x].AddEntry(h['T'+p+x],'nu_e new with charm, cascade, k-fac','PL')
447 h['L'+p+x].AddEntry(h['T'+p+'charm'+x],'nu_e from charm new with charm, cascade, k-fac','PL')
448 h['L'+p+x].AddEntry(h['TP'+p+x],'nu_e old CERN-Cracow prod','PL')
449 h['L'+p+x].AddEntry(h['TP'+p+'charm'+x],'nu_e from charm old CERN-Cracow prod','PL')
450 h['L'+p+x].Draw()
451
452 t4 = h[t].cd(4)
453 t4.SetLogy(1)
454 h['Lmuc'+z+x] = ROOT.TLegend(0.33,0.73,0.99,0.94)
455 p = z+'mu-'
456 h['T'+p+x].SetTitle('mu-/mu+')
457 h['T'+p+x].Draw()
458 h['TP'+p+x].Draw('same')
459 h['TP'+p+x].SetLineColor(6)
460 h['T'+p+x].SetLineColor(4)
461 h['Lmuc'+z+x].AddEntry(h['T'+p+x],'mu- new with charm, cascade, k-fac','PL')
462 h['Lmuc'+z+x].AddEntry(h['TP'+p+x],'mu- old Yandex prod','PL')
463 p = z+'mu+'
464 h['T'+p+x].Draw('same')
465 h['TP'+p+x].Draw('same')
466 h['TP'+p+x].SetLineColor(3)
467 h['T'+p+x].SetLineColor(2)
468 h['Lmuc'+z+x].AddEntry(h['T'+p+x],'mu+ new with charm, cascade, k-fac','PL')
469 h['Lmuc'+z+x].AddEntry(h['TP'+p+x],'mu+ old Yandex prod','PL')
470 h['Lmuc'+z+x].Draw()
471
472 t5 = h[t].cd(5)
473 t5.SetLogy(1)
474 h['Lnumu'+z+x] = ROOT.TLegend(0.33,0.73,0.99,0.94)
475 p = z+'numu'
476 h['T'+p+x].SetTitle('numu/numubar')
477 h['T'+p+x].Draw()
478 h['TP'+p+x].Draw('same')
479 h['TP'+p+x].SetLineColor(6)
480 h['T'+p+x].SetLineColor(4)
481 h['Lnumu'+z+x].AddEntry(h['T'+p+x],'nu_mu new with charm, cascade, k-fac','PL')
482 h['Lnumu'+z+x].AddEntry(h['TP'+p+x],'nu_mu old Yandex prod','PL')
483 p = z+'numubar'
484 h['T'+p+x].Draw('same')
485 h['TP'+p+x].Draw('same')
486 h['TP'+p+x].SetLineColor(3)
487 h['T'+p+x].SetLineColor(2)
488 h['Lnumu'+z+x].AddEntry(h['T'+p+x],'anti nu_mu new with charm, cascade, k-fac','PL')
489 h['Lnumu'+z+x].AddEntry(h['TP'+p+x],'anti nu_mu old Yandex prod','PL')
490 h['Lnumu'+z+x].Draw()
491 t6 = h[t].cd(6)
492 t6.SetLogy(1)
493 p = z+'nue'
494 h['Lnue'+z+x] = ROOT.TLegend(0.33,0.73,0.99,0.94)
495 h['T'+p+x].SetTitle('nue/nuebar')
496 h['T'+p+x].Draw()
497 h['TP'+p+x].Draw('same')
498 h['TP'+p+x].SetLineColor(6)
499 h['T'+p+x].SetLineColor(4)
500 h['Lnue'+z+x].AddEntry(h['T'+p+x],'nu_e new with charm, cascade, k-fac','PL')
501 h['Lnue'+z+x].AddEntry(h['TP'+p+x],'nu_e old Yandex prod','PL')
502 p = z+'nuebar'
503 h['T'+p+x].Draw('same')
504 h['TP'+p+x].Draw('same')
505 h['TP'+p+x].SetLineColor(3)
506 h['T'+p+x].SetLineColor(2)
507 h['Lnue'+z+x].AddEntry(h['T'+p+x],'anti nu_e new with charm, cascade, k-fac','PL')
508 h['Lnue'+z+x].AddEntry(h['TP'+p+x],'anti nu_e old Yandex prod','PL')
509 h['Lnue'+z+x].Draw()
510
511 h[t].Print('comparison'+z+x.replace('_>','')+'.png')
512 h[t].Print('comparison'+z+x.replace('_>','')+'.pdf')
513
514 x = '_>E'
515 for z in ['p','pt']:
516 h[z+'muRatio'+x]=h['T'+z+'mu'+x].Clone(z+'muRatio'+x)
517 h[z+'muRatio'+x].Divide(h['TP'+z+'mu'+x])
518 h[z+'numuRatio'+x]=h['T'+z+'numusum'+x].Clone(z+'numuRatio'+x)
519 h[z+'numuRatio'+x].Divide(h['TP'+z+'numusum'+x])
520 h[z+'nueRatio'+x]=h['T'+z+'nuesum'+x].Clone(z+'nueRatio'+x)
521 h[z+'nueRatio'+x].Divide(h['TP'+z+'nuesum'+x])
522 ut.bookCanvas(h,key='ratios',title='ratios',nx=1800,ny=600,cx=2,cy=1)
523 n = 1
524 for z in ['p','pt']:
525 h['Lratio'+z+x] = ROOT.TLegend(0.21,0.74,0.71,0.85)
526 tc = h['ratios'].cd(n)
527 n+=1
528 h[z+'muRatio'+x].SetLineColor(2)
529 h[z+'muRatio'+x].SetMaximum(max(h[z+'muRatio'+x].GetMaximum(),h[z+'numuRatio'+x].GetMaximum()))
530 h[z+'muRatio'+x].SetMinimum(0)
531 h[z+'muRatio'+x].SetStats(0)
532 h[z+'muRatio'+x].Draw()
533 h[z+'numuRatio'+x].SetLineColor(3)
534 h[z+'numuRatio'+x].SetStats(0)
535 h[z+'numuRatio'+x].Draw('same')
536
537
538 h['Lratio'+z+x].AddEntry(h[z+'muRatio'+x],'muon flux new / old ','PL')
539 h['Lratio'+z+x].AddEntry(h[z+'numuRatio'+x],'nu_mu flux new / old ','PL')
540
541 h['Lratio'+z+x].Draw()
542 h['ratios'].Print('comparisonRatios.png')
543 h['ratios'].Print('comparisonRatios.pdf')
544