SVAC Event Filter
The SVAC event filter can be used to filter
out events from a digi/mc/recon root file either using cuts on variables from
the Merit or SVAC ntuples or using an event list. The new and reduced
digi/mc/recon root file can then, for example, be used with Fred for
visualization.
Using the event filter with
cuts on Merit or
SVAC ntuple variables:
- Start root:
- root[0] .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/loader.C
- root[1] TCut
myCuts="CalTwrGap>300.0&&GltTower==8.0" // Define all your cuts
here
- root[2] .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/evtFilter.C("Ntuple.root",
"digi.root", myCuts, "output.root")
- 'Ntuple.root'
is either the Merit or SVAC ntuple you're looking at.
- 'digi.root'
is the input digi, recon or mc root file.
- 'myCuts'
are your cuts.
- 'output.root'
is the name of the output digi/recon/mc root file.
- Note that you can only filter one
file at the time (digi, recon or mc root). To get all of them, you have to run
the filter three times.
Using the event filter with an already made
event list using Event ID (Merit ntuple variable
'EvtEventId' or SVAC ntuple variable 'EventID'):
- If you need to make cuts on your own
variables i.e. not standard SVAC or Merit variables, a different solution
exists.
- First make the event list:
- Make a list of Event IDs.
- The event list file is just a simple
text file containg one Event ID per line.
- Start root:
- root[0]
.x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/loader.C
- .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/evtFilterEventID.C("events.dat","digi.root","output.root")
- 'events.dat'
is the list of Event IDs
- 'digi.root'
is the input digi,recon or mc root file.
- 'output.root'
is the name of the output digi/mc root file.
- Note that you can only filter one
file at the time (digi, recon or mc root). To get all of them, you have
to run the filter three times.
- NB! Currently this
filter is incredibly
slow and I suggest you use the event index filter instead!
Using the event filter with an already made
event list using event indices:
- If you need to make cuts on your own
variables i.e. not standard SVAC or Merit variables, a different solution
exists.
- First make the event list:
- Make a list of event
indices using for example the Root macro
'/nfs/slac/g/svac/common/builds/Root/Example_output2file/Output.C'
- The event list file is just a simple
text file containg one index per line. 'Index' here means the order in
which the event appears in the run. It is not the Event ID!
- Note that the index starts
counting from 0.
- Start root:
- root[0]
.x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/loader.C
- .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/evtFilterEvtList.C("events.dat","digi.root","output.root")
- 'events.dat'
is the list of event indices
- 'digi.root'
is the input digi,recon or mc root file.
- 'output.root'
is the name of the output digi/mc root file.
- Note that you can only filter one
file at the time (digi, recon or mc root). To get all of them, you have
to run the filter three times.
You can now use the reduced digi/recon/mc root files
in Fred and look at the filtered events. Please note that the abovementioned
problem with MC variables in Merit being zero does not affect the MC information
in FRED.
SVAC
Ntuple Pruners
Use the ntuple pruners with
cuts on either Merit or
SVAC ntuple variables to reduce the size of your ntuples. Keep only the events
you are interested in! To look at the pruned Root files you sometimes have to
quit Root and start it up again. I'm sure it's a feature .....
Prune a single ntuple with cuts using
variables from the same Ntuple:
- Start root:
- root[0] .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/loaderLight.C
- root[1] TCut
myCuts="CalTwrGap>300.0&&GltTower==8.0" // Define all your cuts
here
- root[2] .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/evtPrunerSingle.C("Ntuple.root", myCuts, "output.root")
- 'Ntuple.root'
is either the Merit or SVAC ntuple you're looking at.
- 'myCuts'
are your cuts.
- 'output.root'
is the name of the output Merit/SVAC root file.
- Note that you can only filter one
file at the time (Merit or SVAC).
Prune a single TChain of ntuples with cuts
using variables from the same TChain:
- Start root:
- root[0] .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/loaderLight.C
- root[1] TCut
myCuts="CalTwrGap>300.0&&GltTower==8.0" // Define all your cuts
here
- root[2] TChain
merit("MeritTuple") // You have to have the correct Tree name,
either 'MeritTuple' for Merit or 'Output' for SVAC.
- root[3]
merit.Add("meritNtuple-1.root")
- root[4]
merit.Add("meritNtuple-2.root")
- root[5] .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/evtPrunerTChainSingle.C(&merit, myCuts, "output.root")
- '&merit'
is either the Merit or SVAC TChain you're looking at.
- 'myCuts'
are your cuts.
- 'output.root'
is the name of the output Merit/SVAC root file.
- Note that you can only filter one
file at the time (Merit or SVAC).
Pruning a single ntuple with cuts using
variables from a different Ntuple:
- Start root:
- root[0] .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/loaderLight.C
- root[1] TCut
myCuts="CalTwrGap>300.0&&GltTower==8.0" // Define all your cuts
here
- root[2] .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/evtPrunerMultiple.C("CutNtuple.root",
"FilterNtuple.root", myCuts, "output.root")
- 'CutNtuple.root'
is either the Merit or SVAC ntuple you want to make a cut on.
- 'FilterNtuple.root'
is either the Merit or SVAC ntuple you want to filter
- 'myCuts'
are your cuts.
- 'output.root'
is the name of the output Merit/SVAC root file.
- Note that you can only filter one
file at the time (Merit or SVAC). If you want to prune both SVAC and
Merit you have to run it twice.
- Note that all four combinations of
SVAC and Merit are valid.
Pruning a TChain with cuts using variables
from a different TChain:
- Start root:
- root[0] .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/loaderLight.C
- root[1] TCut
myCuts="CalTwrGap>300.0&&GltTower==8.0" // Define all your cuts
here
- root[2] TChain
merit("MeritTuple") // You have to have the correct Tree name,
either 'MeritTuple' for Merit or 'Output' for SVAC.
- root[3]
merit.Add("meritNtuple-1.root")
- root[4]
merit.Add("meritNtuple-2.root")
- root[5] TChain
svac("Output") // You have to have the correct Tree name, either
'MeritTuple' for Merit or 'Output' for SVAC.
- root[6]
svac.Add("svacNtuple-1.root")
- root[7]
svac.Add("svacNtuple-2.root")
- root[8] .x
/nfs/slac/g/svac/common/builds/Fred/EventFilter/evtPrunerTChainMultiple.C(&merit,
&svac, myCuts, "output.root")
- '&merit'
is either the Merit or SVAC TChain you want to make a cut on.
- '&svac'
is either the Merit or SVAC TChain you want to filter
- 'myCuts'
are your cuts.
- 'output.root'
is the name of the output Merit/SVAC root file.
- Note that you can only filter one
file at the time (Merit or SVAC). If you want to prune both SVAC and
Merit you have to run it twice.
- Note that all four pruning
combinations of SVAC and Merit are valid i.e. (&merit, &svac), (&merit,
&merit), (&svac, &merit) and (&svac, &svac) are all OK.