Filters - Event Selection

With a noisy source as the FEL, it is very important to select the events you would like to use for your analysis. For this, the ana object has the concept of "selections". Upon start, a couple of selections are created that required that event have both X-ray and optical laser present ("on") or X-ray, but no laser ("off"). You can add more stringent requirements to this selection and/or create different "pots" of events: e.g. laser-off event or magnet on/off selections. You add new requirements to an event selection like this:
LDAna In: ana.addCut('ipm2/sum',0.05,10.,'on')
This add a requirement of a minimal X-ray intensity to a bucket of events called "on". Should the Selection "on" not exist yet, it will be created. 
You can then specify "useFilter=<selectionName>" for both plotVar and plotScan and only events passing the requirements will be used. This is illustrated here:

 

SDana In [10]: ana.addCut('lightStatus/xray',0.5,1.5,'on') 
SDana In [11]: ana.addCut('lightStatus/laser',0.5,1.5,'on')
SDana In [12]: ana.addCut('ipm2/sum',0.05,10.,'on') 
SDana In [13]: ana.addCut('tt/FLTPOSFWHM',90.,120.,'on') 
SDana In [14]: ana.printCuts('on')
Cut 0: 0.500000 < lightStatus/xray < 1.500000
Cut 1: 0.500000 < lightStatus/laser < 1.500000
Cut 2: 0.050000 < ipm2/sum < 10.000000
Cut 3: 90.000000 < tt/FLTPOSFWHM < 120.000000 
SDana In [15]: fig = plt.figure(figsize=(8,5)) 
SDana In [16]: pos = ana.plotVar('ipm3/sum',fig=fig)
plot tt/FLTPOS from 0 to 722.58 
SDana In [17]: posCut = ana.plotVar('ipm3/sum',fig=fig,useFilter='on')
plot tt/FLTPOS from 291.069 to 505.09

 

 

  • No labels