Closed tomeichlersmith closed 4 years ago
@jmmans I checked the changes for the ecal digi and veto using the following procedure. Unfortunately, as you can see, there is a difference. I am not familiar with how the EcalVeto operates, so I'm not sure if this is a big deal or not.
ldmx fire veto.py iss876
to produce veto_iss876_10000_events.root
ldmx fire veto.py master
to produce veto_master_10000_events.root
ldmx python3 compare.py
to produce the histogram below:
from LDMX.Framework import ldmxcfg
p = ldmxcfg.Process( "sim" )
p.maxEvents = 10000
p.logFrequency = 100
p.termLogLevel = 0
import sys
p.outputFiles = [ "veto_" + sys.argv[1] + "_"
+ str(p.maxEvents) + "_events.root" ]
from LDMX.SimCore import simulator as sim
mySim = sim.simulator( "mySim" )
mySim.setDetector( 'ldmx-det-v12' )
mySim.runNumber = 9001
from LDMX.SimCore import generators as gen
mySim.generators.append( gen.single_4gev_e_upstream_tagger() )
mySim.description = 'Test Ecal Veto'
mySim.randomSeeds = [ 1 , 2 ]
p.sequence.append( mySim )
from LDMX.Ecal import digi, vetos
p.sequence.extend([
digi.EcalDigiProducer(),
digi.EcalRecProducer(),
vetos.EcalVetoProcessor()
])
p.pause()
from LDMX.Event import dictionary
import ROOT
ROOT.gROOT.SetBatch( ROOT.kTRUE ) # batch run
f_master = ROOT.TFile( 'veto_master_10000_events.root' )
t_master = f_master.Get( 'LDMX_Events' )
veto_master = ROOT.ldmx.EcalVetoResult()
t_master.SetBranchAddress( 'EcalVeto_sim' , ROOT.AddressOf( veto_master ) )
f_iss876 = ROOT.TFile( 'veto_iss876_10000_events.root' )
t_iss876 = f_iss876.Get( 'LDMX_Events' )
veto_iss876 = ROOT.ldmx.EcalVetoResult()
t_iss876.SetBranchAddress( 'EcalVeto_sim' , ROOT.AddressOf( veto_iss876 ) )
h_diff = ROOT.TH1F( 'h_diff' ,
';Difference between master and iss876 for EcalVeto.discValue_' ,
201,-1.,1.)
nEvents = t_master.GetEntries()
for iEvent in range(nEvents) :
t_master.GetEntry(iEvent)
t_iss876.GetEntry(iEvent)
diff = veto_master.getDisc() - veto_iss876.getDisc()
h_diff.Fill( diff )
if abs(diff) > 1./201. :
print("%d -> %f"%(iEvent,diff))
#done with loop over events
c = ROOT.TCanvas()
c.SetLogy()
h_diff.Draw()
c.SaveAs( 'veto_disc_diff.png' )
f_master.Close()
f_iss876.Close()
After patching up the noise generation and some other issues that I found, the disc difference is now a thin and symmetric distribution around 0.
@jmmans Put this together to make the detector ID (1) more realistic and (2) more robust. I am making this PR to store the list of checks we want to do in the Ecal chain.
Checks
The detector ID changes span several submodules, so the checks need to be done where all the submodules (except MagFieldMap and Framework) are on the iss876 branch.