pueoAnalysisTools
Loading...
Searching...
No Matches
plot_interaction_position.cpp
Go to the documentation of this file.
1
9
10#include <filesystem>
11
12#include "util.h"
13// CERN ROOT
14#include "ROOT/RDataFrame.hxx"
15#include "TH2.h"
16#include "TVector3.h"
17#include "TCanvas.h"
18
19// NiceMC
20// #include "Event.h"
21
22int main(int argc, char *argv[]){
23
24 std::unique_ptr<TChain> allTree_chain_ptr;
25 std::unique_ptr<TChain> passTree_chain_ptr;
26 std::filesystem::path PUEO_MC_DATA = argv[1];
27 (void) argc; // suppresses unused variable warning
28
29 Util::prepare_icefinal_chain(PUEO_MC_DATA, passTree_chain_ptr, allTree_chain_ptr);
30
31 TH2D int_pos_hist("",
32 "All-Event Interaction Positions; x (1e6, meters?); y (1e6, meters?)",
33 150, -0.2, 0.2, // horizontal bin number and bounds
34 100, -0.2, 0.2);
35
36
37 // a lambda expression that fills the above histogram
38 auto fill_histogram = [&int_pos_hist](
39 TVector3 & int_pos){
40 int_pos_hist.Fill(int_pos.X()/1e6, int_pos.Y()/1e6);
41 };
42
43 // use a dataframe to loop through each entry in the passTree
44 ROOT::RDataFrame df(*allTree_chain_ptr);
45 df.Foreach(
46 fill_histogram,
47 {
48 "eventSummary.interaction.position"
49 }
50 );
51
52 TCanvas canvas("", "");
53 int_pos_hist.Draw("colz");
54 int_pos_hist.SetStats(0);
55 canvas.SaveAs("Interaction_position_XY_histogram.svg");
56
57
58 return 0;
59}
Contains only one utility function currently.
int prepare_icefinal_chain(std::filesystem::path PUEO_MC_DATA, std::unique_ptr< TChain > &passTree_chain_ptr, std::unique_ptr< TChain > &allTree_chain_ptr)
Prepares two TChains that combine all the IceFinal_*_allTree.root files in the simulation output dire...
Definition util.h:21