|
@@ -83,16 +83,7 @@ float rad(const float& x, const float& y) {
|
|
|
}
|
|
|
|
|
|
void run_analysis(const vector<fv::util::DataFileDescriptor>& dfds, const string output_filename, bool silent){
|
|
|
- gSystem->Load("libfilval.so");
|
|
|
- auto replace_suffix = [](const std::string& input, const std::string& new_suffix){
|
|
|
- return input.substr(0, input.find_last_of(".")) + new_suffix;
|
|
|
- };
|
|
|
-
|
|
|
- string log_filename = replace_suffix(output_filename, ".log");
|
|
|
- fv::util::Log::init_logger(log_filename, fv::util::LogPriority::kLogInfo);
|
|
|
-
|
|
|
TrackingDataSet tds(output_filename, dfds, "trackingNtuple/tree");
|
|
|
- /* tds.set_max_events(11); */
|
|
|
register_objects(tds);
|
|
|
|
|
|
// Indices of prompt gen electrons
|
|
@@ -103,7 +94,8 @@ void run_analysis(const vector<fv::util::DataFileDescriptor>& dfds, const string
|
|
|
if (abs(sim_track.pdgId()) != 11) continue;
|
|
|
const SimVertex& sim_vertex = sim_vertices[sim_track.parentVtxIdx()];
|
|
|
float rho = rad(sim_vertex.x(), sim_vertex.y());
|
|
|
- if (rho > 1) continue;
|
|
|
+ float z = abs(sim_vertex.z());
|
|
|
+ if (rho > 1 or z > 10) continue;
|
|
|
idxs.push_back(sim_track.idx);
|
|
|
}
|
|
|
return idxs;
|
|
@@ -151,12 +143,50 @@ void run_analysis(const vector<fv::util::DataFileDescriptor>& dfds, const string
|
|
|
tds.register_container<EfficiencyContainer<size_t>>("track_eff_v_phi",
|
|
|
prompt_electrons, TH1Params::lookup("eff_v_phi"), nullptr, &with_track, &e_phi);
|
|
|
|
|
|
- /* std::ofstream printout("track_eff.txt"); */
|
|
|
- /* tds.register_container<Printer<vector<size_t>>>("prompt_electron_idx", prompt_electrons, &printout); */
|
|
|
- /* tds.register_container<Printer<vector<size_t>>>("with track: ", apply(with_seed, prompt_electrons), &printout); */
|
|
|
+ // Indices of ecal-driven seeds
|
|
|
+ auto ecal_seeds = func_value<vector<size_t>>("ecal_seeds",
|
|
|
+ FUNC(([](){
|
|
|
+ vector<size_t> idxs;
|
|
|
+ for(const auto& seed : seeds) {
|
|
|
+ if (seed.ecalDriven())
|
|
|
+ idxs.push_back(seed.idx);
|
|
|
+ }
|
|
|
+ return idxs;
|
|
|
+ })));
|
|
|
|
|
|
- /* tds.register_container<ContainerTH1Many<float>>("dxys", sim_tracks.val_pca_dxy, "dxys", */
|
|
|
- /* TH1Params::lookup("dxys")); */
|
|
|
+ function<bool(size_t)> with_sim_track = [](const size_t& seed_idx) {
|
|
|
+ for (const int& simTrkIdx : seeds[seed_idx].simTrkIdx()) {
|
|
|
+ const SimTrack& sim_track = sim_tracks[simTrkIdx];
|
|
|
+ if (abs(sim_track.pdgId()) != 11) continue;
|
|
|
+ const SimVertex& sim_vertex = sim_vertices[sim_track.parentVtxIdx()];
|
|
|
+ float rho = rad(sim_vertex.x(), sim_vertex.y());
|
|
|
+ float z = abs(sim_vertex.z());
|
|
|
+ if (rho > 1 or z > 10) continue;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ };
|
|
|
+
|
|
|
+ function<float(size_t)> seed_pt = [](const size_t& seed_idx) {
|
|
|
+ return seeds[seed_idx].pt();
|
|
|
+ };
|
|
|
+
|
|
|
+ function<float(size_t)> seed_eta = [](const size_t& seed_idx) {
|
|
|
+ return seeds[seed_idx].eta();
|
|
|
+ };
|
|
|
+
|
|
|
+ function<float(size_t)> seed_phi = [](const size_t& seed_idx) {
|
|
|
+ return seeds[seed_idx].phi();
|
|
|
+ };
|
|
|
+
|
|
|
+ tds.register_container<EfficiencyContainer<size_t>>("seed_pur_v_pt",
|
|
|
+ ecal_seeds, TH1Params::lookup("pur_v_pt"), nullptr, &with_sim_track, &seed_pt);
|
|
|
+
|
|
|
+ tds.register_container<EfficiencyContainer<size_t>>("seed_pur_v_eta",
|
|
|
+ ecal_seeds, TH1Params::lookup("pur_v_eta"), nullptr, &with_sim_track, &seed_eta);
|
|
|
+
|
|
|
+ tds.register_container<EfficiencyContainer<size_t>>("seed_pur_v_phi",
|
|
|
+ ecal_seeds, TH1Params::lookup("pur_v_phi"), nullptr, &with_sim_track, &seed_phi);
|
|
|
|
|
|
tds.process(silent);
|
|
|
tds.save_all();
|
|
@@ -165,22 +195,18 @@ void run_analysis(const vector<fv::util::DataFileDescriptor>& dfds, const string
|
|
|
int main(int argc, char * argv[]){
|
|
|
fv::util::ArgParser args(argc, argv);
|
|
|
bool silent = args.cmdOptionExists("-s");
|
|
|
- string output_filename = args.cmdOptionExists("-o") ? args.getCmdOption("-o") : "output.root";
|
|
|
- if(args.cmdOptionExists("-c")){
|
|
|
+ if(args.cmdOptionExists("-c")) {
|
|
|
fv::util::init_config(args.getCmdOption("-c"));
|
|
|
- }
|
|
|
- if(args.cmdOptionExists("-F")){
|
|
|
- auto file_list = fv::util::read_input_list(args.getCmdOption("-F"));
|
|
|
+ auto output_filename = fv::util::the_config->get_output_filename();
|
|
|
+ if (output_filename == "") return -1;
|
|
|
+
|
|
|
+ fv::util::init_log(fv::util::LogPriority::kLogInfo);
|
|
|
+ gSystem->Load("libfilval.so");
|
|
|
+
|
|
|
+ auto file_list = fv::util::the_config->get_source_files();
|
|
|
run_analysis(file_list, output_filename, silent);
|
|
|
- }else if(args.cmdOptionExists("-f")){
|
|
|
- string input_filename = args.getCmdOption("-f");
|
|
|
- string data_label = args.cmdOptionExists("-l") ? args.getCmdOption("-l") : "";
|
|
|
- string data_category = args.cmdOptionExists("-c") ? args.getCmdOption("-c") : "";
|
|
|
- fv::util::DataFileDescriptor dfd(input_filename, data_label, data_category);
|
|
|
- run_analysis(std::vector<fv::util::DataFileDescriptor>({dfd}), output_filename, silent);
|
|
|
- }else {
|
|
|
- cout << "Usage: ./tracking_eff (-s) {-o output_filename} -F datafiles.txt" << endl;
|
|
|
- cout << " ./tracking_eff (-s) {-l DATA_LABEL} {-c DATA_CATEGORY} {-o output_filename} -f treefile.root" << endl;
|
|
|
+ } else {
|
|
|
+ cout << "Usage: ./tracking_eff (-s) -c config_file.yaml" << endl;
|
|
|
}
|
|
|
return 0;
|
|
|
}
|