Skip to content

Instantly share code, notes, and snippets.

@pdeperio
Created September 19, 2015 15:07
Show Gist options
  • Save pdeperio/d40e720251a5f2378a7c to your computer and use it in GitHub Desktop.
Save pdeperio/d40e720251a5f2378a7c to your computer and use it in GitHub Desktop.
pax ROOT TTree Flattening
--------------------------------------
Title: flattenPaxRootTree.C
--------------------------------------
--------------------------------------
Purpose: C++ program for flattening ROOT output of XENON1T pax processor.
--------------------------------------
--------------------------------------
Compilation:
0) On xecluster, run 'latest_root', i.e. requires ROOT >= v5.34
1) Generate source code according to pax ROOT output format:
./MakeClass.sh <path to pax processed ROOT file>
This also builds the executable for the next step.
2) Flatten the trees:
./flattenPaxRootTree -i <path to pax processed ROOT file> -o <name of output flattened ROOT file>
--------------------------------------
--------------------------------------
Warnings:
- Must re-generate source code (step 1) for any change in pax output format or pax run-time configuration.
- If batch processing many files, length of filename used for MakeClass.sh must be the same for all files (since TTree::MakeClass creates a fixed-sized character array
for pax_info).
- For Mac OS X, need to modify sed commands in MakeClass.sh, since '-i' requires an argument: (sed -i) -> (sed -i '')
--------------------------------------
--------------------------------------
Notes: This is a very primitive program, quickly written to test a ROOT-based analysis. Modifications should be made in flattenPaxRootTree_in.C, e.g.
- Selecting peak types and detectors to include
- Ordering principle (currently reverse ordered by area for all peak types)
- Which branches to save (currently all except index variables)
or just re-write this all within pax.
--------------------------------------
--------------------------------------
Analysis: For interactive analysis, modify ana_flat.C with the file name you wish to analyze, then run 'root ana_flat.C' and use Event->Scan(), Event->Draw() as usual, e.g.
Event->Draw("log10(s2_tpc_area/s1_tpc_area):s1_tpc_area", "s2_tpc_area > 150 && s2_tpc_area < 5000 && n_s2_tpc < 10 && s1_tpc_hit_time_mean < s2_tpc_hit_time_mean && s
1_tpc_area<30","colz")
For batch (e.g. event-loop) analysis, a user-friendly framework still needs to be developed.
--------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment