pueoAnalysisTools
Loading...
Searching...
No Matches
effective_area.cpp
1#include <regex>
2#include "util.h"
3#include "effective_area.h"
4
5namespace fs = std::filesystem;
6
7// constructor, serving as the "main function"
8effective_area::effective_area(fs::path p): PUEO_MC_DATA(p) {
9 // if there's a run/ with nonexistent IceFinal.root file, have the program exit early.
10 if(Util::prepare_icefinal_chain(PUEO_MC_DATA, passTree_chain_ptr, allTree_chain_ptr)) {
11 std::cerr << "No further steps will be taken for " << PUEO_MC_DATA << ",\n"
12 << "Please fix the missing file problem and retry." << std::endl;
13 return;
14 } else {
15 total_num_neutrino_simulated = allTree_chain_ptr->GetEntries();
16 passTree_length = passTree_chain_ptr->GetEntries();
17 df = std::make_unique<ROOT::RDataFrame>(*passTree_chain_ptr);
18 }
19
20 if (passTree_length > 0) {
22
23 if (interaction_length > 0.) {
26 }
27 }
28}
29
31 auto comp = [this] (const double l){interaction_length += l;};
32 df->Foreach(comp, {"interaction.length"});
33 interaction_length /= (passTree_length * 1e3 ); // m -> km
34}
35
37
38 // a lambda expression to be applied to the DataFrame's weight columns.
39 auto count = [this] (const double &w1, const double &w2, const double &w3){
40 if (w1 >0 && w2 >0 && w3>0){
42 } else {
44 }
45 };
46 // loop through all entries in the dataframe to compute the total weight of each entry
47 df->Foreach(count,{"neutrino.path.weight", "loop.positionWeight", "loop.directionWeight"});
48}
49
double effective_area_score
The combined effective areas of all the runs in PUEO_MC_DATA.
const double ICE_VOLUME
Antarctica ice volume [km ].
void compute_total_weight()
Computes total_num_weighted_passEvents by going through the DataFrame df.
void compute_mean_interaction_length()
Computes the mean interaction_length by going through the DataFrame df.
double total_num_weighted_passEvents
The (combined) total number of passed events (weighted) in PUEO_MC_DATA.
int passTree_length
Similar to total_num_neutrino_simulated; this is the length of passTree_chain_ptr.
int total_num_neutrino_simulated
The (combined) total number of neutrinos thrown in PUEO_MC_DATA.
void compute_effective_area()
Computes effective_area_score based on all runs in PUEO_MC_DATA.
double interaction_length
Interaction length in kilometers.
std::unique_ptr< ROOT::RDataFrame > df
CERN ROOT DataFrame built based on passTree_chain_ptr.
Contains the definition for the effective_area class.
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