This is an example of a simple Analysis of ProtoDUNE-SP montecarlo data. This consists of a simple event selection and some systematics. The folder HIGHLAND_PATH/highland/protoDuneExampleAnalysis/v0r0/src contains the following files:

- BeamMomCorrection.cxx/.hxx: An event-by-event correction on the beam momentum for real data
- BeamMomSmearingCorrection.cxx/.hxx: An event-by-event correction on beam momentum for MC
- BrokenTrackDataCorrection.cxx/.hxx: An event-by-event correction that merges two tracks broken at the APA junction
- CryoWallBeamMomCorrection.cxx/.hxx: An event-by-event correction on beam momentum to account for energy loss in the cryostat wall
- dEdxCorrection.cxx/.hxx: An event-by-event correction on the measured dE/dx
- dEdxDataCorrection.cxx/.hxx: An event-by-event correction on the measured dE/dx for data
- dEdxVariation.cxx/.cxx: This is used to propagate numerically a dE/dx systematic
- protoDuneSelectionUtils.cxx/.hxx
- stoppingKaonSelection.cxx/.hxx:
- stoppingMuonSelection.cxx/.hxx:
- stoppingProtonSelection.cxx/.hxx:
- ToyBoxPD.cxx/.hxx:
- protoDuneExampleAnalysis.cxx/.hxx: This is the AnalysisAlgorithm where all objects below are used. Also the root-tree variables are defined and filled.

A file containing root trees with information about the analysis is produced. If you are inside HIGHLAND_PATH/highland/protoDuneExampleAnalysis/v0r0/cmt, to run the analysis just type

../BINARY_FOLDER/RunProtoDuneExampleAnalysis.exe -o output.root input.root

where input.root should be a ProtoDUNE AnaTree file (the converter for LarSoft files is not fully operational yet). ProtoDUNE-SP single kaon AnaTree files can be obtained from the DUNE production area. For 1GeV/c kaons:

- /pnfs/dune/scratch/dunepro/v06_05_00/mergeana/gen_protoDune_kaon_1GeV_mono/13405798_0/ana_hist.root
- /pnfs/dune/scratch/dunepro/v06_05_00/mergeana/gen_protoDune_kaon_1GeV_mono/13405798_1/ana_hist.root
- /pnfs/dune/scratch/dunepro/v06_05_00/mergeana/gen_protoDune_kaon_1GeV_mono/13405798_2/ana_hist.root
- /pnfs/dune/scratch/dunepro/v06_05_00/mergeana/gen_protoDune_kaon_1GeV_mono/13405798_3/ana_hist.root
- /pnfs/dune/scratch/dunepro/v06_05_00/mergeana/gen_protoDune_kaon_1GeV_mono/13405798_4/ana_hist.root

There is an option to run over a list of files. Just add the list of files above to a file, e.g. input.list and run normally:

../BINARY_FOLDER/RunProtoDuneExampleAnalysis.exe -o output.root input.list

Once the job finishes open the root file:

root -l output.root

create an instance of the DrawingTools:

root [0] DrawingTools draw("output.root")

and do your first plot:

root [1]  draw.SetTitleX("kaon candidate z end position (cm)");
root [2] draw.Draw(default,"seltrk_endpos[2]",50,-10,500,"particle","accum_level>0");

where colors correspond to different true particle types, as explained in the caption, and "accum_level>0" means for events passing cut number 0 (The first cut)

End position in Z of the candidate kaon track

The cuts applied and the number of events passing each of them can be

root [2] draw.DrawEventsVSCut(default)

Number of events passing each of the cuts

To see several types of plots that can be done use the plots.C root macro located under HIGHLAND_PATH/highland/protoDuneExampleAnalysis/v0r0/macros:

root -l output.root
root [0] .x ../macros/plots.C