tracking_eff.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. #include <iostream>
  2. #include <vector>
  3. #include <cmath>
  4. #include <TSystem.h>
  5. #include "filval.hpp"
  6. #include "root_filval.hpp"
  7. #include "analysis/TrackingNtupleObjs.hpp"
  8. SeedCollection seeds;
  9. SimTrackCollection sim_tracks;
  10. SimVertexCollection sim_vertices;
  11. TrackCollection gsf_tracks;
  12. void register_objects(TrackingDataSet& tds){
  13. seeds.init(tds);
  14. sim_tracks.init(tds);
  15. sim_vertices.init(tds);
  16. gsf_tracks.init(tds);
  17. }
  18. struct {
  19. Value<float>* x;
  20. Value<float>* y;
  21. Value<float>* z;
  22. Value<float>* sigma_x;
  23. Value<float>* sigma_y;
  24. Value<float>* sigma_z;
  25. } bs;
  26. bool in_lum_region(const SimVertex& vertex) {
  27. /* Here approximate the luminous region as a cylinder with length 5*\sigma_z and radius
  28. * sqrt(\simga_x^2 + \sigma_y^2) centered as beamspot position.
  29. */
  30. float dx = vertex.x() - bs.x->get();
  31. float dy = vertex.y() - bs.y->get();
  32. float dz = vertex.z() - bs.z->get();
  33. auto radius = static_cast<float>(5 * sqrt(pow(bs.sigma_x->get(), 2) + pow(bs.sigma_y->get(), 2)));
  34. float half_len = 5*bs.sigma_z->get();
  35. return sqrt(dx*dx + dy*dy) < radius and abs(dz) < half_len;
  36. };
  37. bool is_good_sim(const SimTrack& sim_track) {
  38. const auto& vertex = sim_vertices[sim_track.parentVtxIdx()];
  39. return abs(sim_track.pdgId()) == 11 and in_lum_region(vertex);
  40. };
  41. bool is_good_seed(const Seed& seed, float hoe_cut) {
  42. return seed.isECALDriven() and seed.hoe() < hoe_cut;
  43. }
  44. float reco_energy_rel_err(const SimTrack& sim_track, const Seed& seed) {
  45. return (sim_track.pt() - seed.Et()) / sim_track.pt() ;
  46. }
  47. bool reco_energy_consistent(const SimTrack& sim_track, const Seed& seed, float consistency_cut=0.1) {
  48. return fabs(reco_energy_rel_err(sim_track, seed)) < consistency_cut;
  49. }
  50. float reco_energy_rel_err(const SimTrack& sim_track, const Track& track) {
  51. return (sim_track.pt() - track.pt()) / sim_track.pt() ;
  52. }
  53. bool reco_energy_consistent(const SimTrack& sim_track, const Track& track, float consistency_cut=0.1) {
  54. return fabs(reco_energy_rel_err(sim_track, track)) < consistency_cut;
  55. }
  56. void run(bool silent){
  57. using namespace std;
  58. using namespace fv;
  59. using namespace fv_root;
  60. auto file_list = the_config->get_source_files();
  61. string output_filename = the_config->get_output_filename();
  62. TrackingDataSet tds(output_filename, file_list, "trackingNtuple/tree");
  63. register_objects(tds);
  64. float hoe_cut = the_config->get("hoe_cut").as<float>(999);
  65. bs = {
  66. tds.track_branch<float>("bsp_x"),
  67. tds.track_branch<float>("bsp_y"),
  68. tds.track_branch<float>("bsp_z"),
  69. tds.track_branch<float>("bsp_sigmax"),
  70. tds.track_branch<float>("bsp_sigmay"),
  71. tds.track_branch<float>("bsp_sigmaz")
  72. };
  73. enum TMType {
  74. NoMatch = 0,
  75. SeedMatched = 1,
  76. TrackMatched = 2,
  77. SeedAndTrackMatched = 3
  78. };
  79. std::map<std::tuple<int, int>, ContainerTH2<float>*> residuals_dRz;
  80. std::map<std::tuple<int, int>, ContainerTH2<float>*> residuals_dPhi;
  81. std::map<std::tuple<int, int, int>, ContainerTH2<float>*> BPIX_residuals_dRz;
  82. std::map<std::tuple<int, int, int>, ContainerTH2<float>*> BPIX_residuals_dPhi;
  83. std::map<std::tuple<int, int, int>, ContainerTH2<float>*> FPIX_residuals_dRz;
  84. std::map<std::tuple<int, int, int>, ContainerTH2<float>*> FPIX_residuals_dPhi;
  85. stringstream name;
  86. auto set_name = [&name](const std::string& var, const std::string& region,
  87. const int& layer, const int& hit, const int& tm_type) {
  88. name.str("");
  89. name << var << "_" << region;
  90. if (layer)
  91. name << "_L" << layer;
  92. name << "_H" << hit << "_v_Et";
  93. switch (tm_type) {
  94. case NoMatch:
  95. name << "_NoMatch";
  96. break;
  97. case SeedMatched:
  98. name << "_SeedMatched";
  99. break;
  100. case TrackMatched:
  101. name << "_TrackMatched";
  102. break;
  103. case SeedAndTrackMatched:
  104. name << "_SeedAndTrackMatched";
  105. break;
  106. default:
  107. break;
  108. }
  109. };
  110. THParams hist_params;
  111. for (int hit=1; hit<=3; hit++) {
  112. for (int tm_type = NoMatch; tm_type <= SeedAndTrackMatched; tm_type++) {
  113. for (int layer=1; layer<=4; layer++) {
  114. hist_params = (hit == 1) ? THParams::lookup("dRz_v_Et") : THParams::lookup("dRz_v_Et_outer_hits");
  115. set_name("dRz", "BPIX", layer, hit, tm_type);
  116. BPIX_residuals_dRz[{layer, hit, tm_type}] = tds.register_container<ContainerTH2<float>>(name.str(), hist_params);
  117. set_name("dRz", "FPIX", layer, hit, tm_type);
  118. FPIX_residuals_dRz[{layer, hit, tm_type}] = tds.register_container<ContainerTH2<float>>(name.str(), hist_params);
  119. hist_params = (hit == 1) ? THParams::lookup("dPhi_v_Et") : THParams::lookup("dPhi_v_Et_outer_hits");
  120. set_name("dPhi", "BPIX", layer, hit, tm_type);
  121. BPIX_residuals_dPhi[{layer, hit, tm_type}] = tds.register_container<ContainerTH2<float>>(name.str(), hist_params);
  122. set_name("dPhi", "FPIX", layer, hit, tm_type);
  123. FPIX_residuals_dPhi[{layer, hit, tm_type}] = tds.register_container<ContainerTH2<float>>(name.str(), hist_params);
  124. }
  125. hist_params = (hit == 1) ? THParams::lookup("dRz_v_Et") : THParams::lookup("dRz_v_Et_outer_hits");
  126. set_name("dRz", "ALL", 0, hit, tm_type);
  127. residuals_dRz[{hit, tm_type}] = tds.register_container<ContainerTH2<float>>(name.str(), hist_params);
  128. hist_params = (hit == 1) ? THParams::lookup("dPhi_v_Et") : THParams::lookup("dPhi_v_Et_outer_hits");
  129. set_name("dPhi", "ALL", 0, hit, tm_type);
  130. residuals_dPhi[{hit, tm_type}] = tds.register_container<ContainerTH2<float>>(name.str(), hist_params);
  131. }
  132. }
  133. std::map<int,vector<float>> eta_regions = {{1, {0.0, 1.1, 1.8, 3.0}},
  134. {2, {0.0, 1.4, 2.3, 3.0}},
  135. {3, {0.0, 1.0, 2.0, 3.0}}};
  136. auto get_region = [&eta_regions](int hit, float eta) {
  137. auto regions = eta_regions[hit];
  138. if (regions.size() <= 1) return 1;
  139. float abseta = abs(eta);
  140. for (int r_idx=1; r_idx < regions.size(); r_idx++) {
  141. if (abseta > regions[r_idx-1] and abseta < regions[r_idx]) {
  142. return r_idx;
  143. }
  144. }
  145. return static_cast<int>(regions.size());
  146. };
  147. std::map<int, ContainerTH2<float>*> dPhi_residuals_v_eta;
  148. std::map<int, ContainerTH2<float>*> dRz_residuals_v_eta;
  149. std::map<std::pair<int, int>, ContainerTH2<float>*> dPhi_residuals_v_region;
  150. std::map<std::pair<int, int>, ContainerTH2<float>*> dRz_residuals_v_region;
  151. for (int hit=1; hit<=3; hit++) {
  152. name.str("");
  153. name << "dPhi_residuals_v_eta_H" << hit;
  154. hist_params = (hit==1) ? THParams::lookup("dPhi_v_eta") : THParams::lookup("dPhi_v_eta_outer_hits");
  155. dPhi_residuals_v_eta[hit] = tds.register_container<ContainerTH2<float>>(name.str(), hist_params);
  156. name.str("");
  157. name << "dRz_residuals_v_eta_H" << hit;
  158. hist_params = (hit==1) ? THParams::lookup("dRz_v_eta") : THParams::lookup("dRz_v_eta_outer_hits");
  159. dRz_residuals_v_eta[hit] = tds.register_container<ContainerTH2<float>>(name.str(), hist_params);
  160. for (int region=1; region<=eta_regions[hit].size()-1; region++){
  161. hist_params = (hit==1) ? THParams::lookup("dRz_v_Et") : THParams::lookup("dRz_v_Et_outer_hits");
  162. name.str("");
  163. name << "dRz_residuals_H" << hit << "_R" << region;
  164. dRz_residuals_v_region[{hit, region}] = tds.register_container<ContainerTH2<float>>(name.str(), hist_params);
  165. hist_params = (hit==1) ? THParams::lookup("dPhi_v_Et") : THParams::lookup("dPhi_v_Et_outer_hits");
  166. name.str("");
  167. name << "dPhi_residuals_H" << hit << "_R" << region;
  168. dPhi_residuals_v_region[{hit, region}] = tds.register_container<ContainerTH2<float>>(name.str(), hist_params);
  169. }
  170. }
  171. auto& seed_eff_v_pt = *tds.register_container<EfficiencyContainer<float>>("seed_eff_v_pt", THParams::lookup("eff_v_pt"));
  172. auto& seed_eff_v_eta = *tds.register_container<EfficiencyContainer<float>>("seed_eff_v_eta", THParams::lookup("eff_v_eta"));
  173. auto& seed_eff_v_phi = *tds.register_container<EfficiencyContainer<float>>("seed_eff_v_phi", THParams::lookup("eff_v_phi"));
  174. auto& seed_eff_v_eta_pt = *tds.register_container<EfficiencyContainer2D<float>>("seed_eff_v_eta_pt", THParams::lookup("eff_v_eta_pt"));
  175. auto& tracking_eff_v_pt = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_pt", THParams::lookup("eff_v_pt"));
  176. auto& tracking_eff_v_eta = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_eta", THParams::lookup("eff_v_eta"));
  177. auto& tracking_eff_v_phi = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_phi", THParams::lookup("eff_v_phi"));
  178. auto& tracking_eff_v_eta_pt = *tds.register_container<EfficiencyContainer2D<float>>("tracking_eff_v_eta_pt", THParams::lookup("eff_v_eta_pt"));
  179. auto& tracking_eff_v_pt2 = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_pt2", THParams::lookup("eff_v_pt"));
  180. auto& tracking_eff_v_eta2 = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_eta2", THParams::lookup("eff_v_eta"));
  181. auto& tracking_eff_v_phi2 = *tds.register_container<EfficiencyContainer<float>>("tracking_eff_v_phi2", THParams::lookup("eff_v_phi"));
  182. auto& seed_pur_v_pt = *tds.register_container<EfficiencyContainer<float>>("seed_pur_v_pt", THParams::lookup("pur_v_pt"));
  183. auto& seed_pur_v_eta = *tds.register_container<EfficiencyContainer<float>>("seed_pur_v_eta", THParams::lookup("pur_v_eta"));
  184. auto& seed_pur_v_phi = *tds.register_container<EfficiencyContainer<float>>("seed_pur_v_phi", THParams::lookup("pur_v_phi"));
  185. auto& tracking_pur_v_pt = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_pt", THParams::lookup("pur_v_pt"));
  186. auto& tracking_pur_v_eta = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_eta", THParams::lookup("pur_v_eta"));
  187. auto& tracking_pur_v_phi = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_phi", THParams::lookup("pur_v_phi"));
  188. auto& tracking_pur_v_pt2 = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_pt2", THParams::lookup("pur_v_pt"));
  189. auto& tracking_pur_v_eta2 = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_eta2", THParams::lookup("pur_v_eta"));
  190. auto& tracking_pur_v_phi2 = *tds.register_container<EfficiencyContainer<float>>("tracking_pur_v_phi2", THParams::lookup("pur_v_phi"));
  191. auto& hit_vs_layer_barrel = *tds.register_container<ContainerTH2<int>>("hit_vs_layer_barrel", THParams::lookup("hit_vs_layer"));
  192. auto& hit_vs_layer_forward = *tds.register_container<ContainerTH2<int>>("hit_vs_layer_forward", THParams::lookup("hit_vs_layer"));
  193. auto& gsf_tracks_nmatch_sim_tracks = *tds.register_container<ContainerTH1<size_t>>("gsf_tracks_nmatch_sim_tracks ", THParams::lookup("gsf_tracks_nmatch_sim_tracks"));
  194. auto& ecal_energy_resolution = *tds.register_container<ContainerTH1<float>>("ecal_energy_resolution ", THParams::lookup("ecal_energy_resolution"));
  195. auto& n_seeds = *tds.register_container<ContainerTH1<size_t>>("n_seeds", THParams::lookup("n_seeds"));
  196. while (tds.next(!silent)) {
  197. for (const auto& sim_track : sim_tracks) {
  198. if (!is_good_sim(sim_track)) continue;
  199. if (seeds.size() == 0) continue;
  200. for (const auto &seed_idx : sim_track.seedIdx()) {
  201. const Seed& seed = seeds[seed_idx];
  202. if (!is_good_seed(seed, hoe_cut)) continue;
  203. ecal_energy_resolution.fill(reco_energy_rel_err(sim_track, seed));
  204. }
  205. }
  206. // Seeding Efficiency
  207. for (const auto& sim_track : sim_tracks) {
  208. if (!is_good_sim(sim_track)) continue;
  209. if (seeds.size() == 0) continue;
  210. bool matched = false;
  211. for (const auto& seed_idx : sim_track.seedIdx()) {
  212. const Seed& seed = seeds[seed_idx];
  213. if (is_good_seed(seed, hoe_cut)) {
  214. matched=true;
  215. break;
  216. }
  217. }
  218. seed_eff_v_eta_pt.fill(sim_track.eta(), sim_track.pt(), matched);
  219. if (abs(sim_track.eta()) < 2.4)
  220. seed_eff_v_pt.fill(sim_track.pt(), matched);
  221. if (sim_track.pt() > 20.0)
  222. seed_eff_v_eta.fill(sim_track.eta(), matched);
  223. if (abs(sim_track.eta()) < 2.4 and sim_track.pt() > 20)
  224. seed_eff_v_phi.fill(sim_track.phi(), matched);
  225. }
  226. // Tracking Efficiency
  227. for (const auto& sim_track : sim_tracks) {
  228. if (!is_good_sim(sim_track)) continue;
  229. if (gsf_tracks.size() == 0) continue;
  230. bool matched = false;
  231. for (const auto& track_idx : sim_track.trkIdx()) {
  232. const Seed& seed = seeds[gsf_tracks[track_idx].seedIdx()];
  233. if (is_good_seed(seed, hoe_cut)) {
  234. matched=true;
  235. break;
  236. }
  237. }
  238. tracking_eff_v_eta_pt.fill(sim_track.eta(), sim_track.pt(), matched);
  239. if (abs(sim_track.eta()) < 2.4)
  240. tracking_eff_v_pt.fill(sim_track.pt(), matched);
  241. if (sim_track.pt() > 20.0)
  242. tracking_eff_v_eta.fill(sim_track.eta(), matched);
  243. if (abs(sim_track.eta()) < 2.4 and sim_track.pt() > 20)
  244. tracking_eff_v_phi.fill(sim_track.phi(), matched);
  245. matched = false;
  246. for (const auto& seed_idx : sim_track.seedIdx()) {
  247. const Seed& seed = seeds[seed_idx];
  248. if (is_good_seed(seed, hoe_cut) and seed.trkIdx()>=0 and reco_energy_consistent(sim_track, seed)) {
  249. matched=true;
  250. break;
  251. }
  252. }
  253. if (abs(sim_track.eta()) < 2.4)
  254. tracking_eff_v_pt2.fill(sim_track.pt(), matched);
  255. if (sim_track.pt() > 20.0)
  256. tracking_eff_v_eta2.fill(sim_track.eta(), matched);
  257. if (abs(sim_track.eta()) < 2.4 and sim_track.pt() > 20)
  258. tracking_eff_v_phi2.fill(sim_track.phi(), matched);
  259. }
  260. // Seeding Purity
  261. for (const auto& seed : seeds) {
  262. if (!is_good_seed(seed, hoe_cut)) continue;
  263. bool match = false;
  264. for (const auto& sim_track_idx : seed.simTrkIdx()) {
  265. if(is_good_sim(sim_tracks[sim_track_idx])) {
  266. match = true;
  267. break;
  268. }
  269. }
  270. if (abs(seed.eta()) < 2.4)
  271. seed_pur_v_pt.fill(seed.pt(), match);
  272. if (seed.pt() > 20)
  273. seed_pur_v_eta.fill(seed.eta(), match);
  274. if (abs(seed.eta()) < 2.4 and seed.pt() > 20)
  275. seed_pur_v_phi.fill(seed.phi(), match);
  276. }
  277. // Tracking Purity
  278. for (const auto& gsf_track : gsf_tracks) {
  279. gsf_tracks_nmatch_sim_tracks.fill(gsf_track.simTrkIdx().size());
  280. const Seed& seed = seeds[gsf_track.seedIdx()];
  281. if (!is_good_seed(seed, hoe_cut)) continue;
  282. bool match = false;
  283. for (const auto& sim_track_idx : gsf_track.simTrkIdx()) {
  284. if (is_good_sim(sim_tracks[sim_track_idx])) {
  285. match = true;
  286. break;
  287. }
  288. }
  289. if (abs(gsf_track.eta()) < 2.4)
  290. tracking_pur_v_pt.fill(gsf_track.pt(), match);
  291. if (gsf_track.pt() > 20)
  292. tracking_pur_v_eta.fill(gsf_track.eta(), match);
  293. if (abs(gsf_track.eta()) < 2.4 and gsf_track.pt() > 20)
  294. tracking_pur_v_phi.fill(gsf_track.phi(), match);
  295. match = false;
  296. for (const auto& sim_track_idx : seed.simTrkIdx()) {
  297. if (is_good_sim(sim_tracks[sim_track_idx])) {
  298. match = true;
  299. break;
  300. }
  301. }
  302. if (abs(gsf_track.eta()) < 2.4)
  303. tracking_pur_v_pt2.fill(gsf_track.pt(), match);
  304. if (gsf_track.pt() > 20)
  305. tracking_pur_v_eta2.fill(gsf_track.eta(), match);
  306. if (abs(gsf_track.eta()) < 2.4 and gsf_track.pt() > 20)
  307. tracking_pur_v_phi2.fill(gsf_track.phi(), match);
  308. }
  309. // Hit Residuals
  310. for (const auto& seed : seeds) {
  311. if (seed.trkIdx() < 0) continue; // require that seed produced gsf-track
  312. if (!is_good_seed(seed, hoe_cut)) continue;
  313. bool is_seed_sim_matched = false;
  314. for (const auto& sim_track_idx : seed.simTrkIdx()) {
  315. const SimTrack& sim_track = sim_tracks[sim_track_idx];
  316. if (is_good_sim(sim_track) and reco_energy_consistent(sim_track, seed)) {
  317. is_seed_sim_matched = true;
  318. break;
  319. }
  320. }
  321. bool is_track_sim_matched = false;
  322. const auto the_track = gsf_tracks[seed.trkIdx()];
  323. for (const auto& sim_track_idx : the_track.simTrkIdx()) {
  324. const SimTrack& sim_track = sim_tracks[sim_track_idx];
  325. if (is_good_sim(sim_track) and reco_energy_consistent(sim_track, the_track)) {
  326. is_track_sim_matched = true;
  327. break;
  328. }
  329. }
  330. std::vector<TMType> tm_types;
  331. if (is_seed_sim_matched and is_track_sim_matched) {
  332. tm_types = {SeedAndTrackMatched, SeedMatched, TrackMatched};
  333. } else if (is_seed_sim_matched) {
  334. tm_types = {SeedMatched};
  335. } else if (is_track_sim_matched) {
  336. tm_types = {TrackMatched};
  337. } else {
  338. tm_types = {NoMatch};
  339. }
  340. vector<int> hits_valid;
  341. vector<float> hits_dRz;
  342. vector<float> hits_dPhi;
  343. if (the_track.q() == 1) {
  344. hits_valid = seed.isValidPos();
  345. hits_dRz = seed.dRZPos();
  346. hits_dPhi = seed.dPhiPos();
  347. } else {
  348. hits_valid = seed.isValidNeg();
  349. hits_dRz = seed.dRZNeg();
  350. hits_dPhi = seed.dPhiNeg();
  351. }
  352. const vector<int>& hits_isBarrel = seed.isBarrel();
  353. const vector<int>& hits_layerOrDiskNr = seed.layerOrDiskNr();
  354. for (const auto& tm_type : tm_types) {
  355. size_t nHits = hits_valid.size();
  356. for (size_t hit_idx = 0; hit_idx < nHits; hit_idx++) {
  357. if (!hits_valid[hit_idx]) continue;
  358. bool isBarrel = hits_isBarrel[hit_idx] == 1;
  359. int layerOrDiskNr = hits_layerOrDiskNr[hit_idx];
  360. float dRz = abs(hits_dRz[hit_idx]);
  361. float dPhi = abs(hits_dPhi[hit_idx]);
  362. int eta_region = get_region(static_cast<int>(hit_idx + 1), seed.eta());
  363. if (is_seed_sim_matched) {
  364. dRz_residuals_v_eta[hit_idx + 1]->fill(dRz, abs(seed.eta()));
  365. dPhi_residuals_v_eta[hit_idx + 1]->fill(dPhi, abs(seed.eta()));
  366. dRz_residuals_v_region[{hit_idx + 1, eta_region}]->fill(dRz, seed.Et());
  367. dPhi_residuals_v_region[{hit_idx + 1, eta_region}]->fill(dPhi, seed.Et());
  368. }
  369. residuals_dRz[{hit_idx + 1, tm_type}]->fill(dRz, seed.Et());
  370. residuals_dPhi[{hit_idx + 1, tm_type}]->fill(dPhi, seed.Et());
  371. if (layerOrDiskNr == -1) continue; // subDet is not set w/ old seeding
  372. if (isBarrel)
  373. hit_vs_layer_barrel.fill(layerOrDiskNr, static_cast<const int &>(hit_idx + 1));
  374. else
  375. hit_vs_layer_forward.fill(layerOrDiskNr, static_cast<const int &>(hit_idx + 1));
  376. if (isBarrel) {
  377. BPIX_residuals_dRz[{layerOrDiskNr, hit_idx + 1, tm_type}]->fill(dRz, seed.Et());
  378. BPIX_residuals_dPhi[{layerOrDiskNr, hit_idx + 1, tm_type}]->fill(dPhi, seed.Et());
  379. } else {
  380. FPIX_residuals_dRz[{layerOrDiskNr, hit_idx + 1, tm_type}]->fill(dRz, seed.Et());
  381. FPIX_residuals_dPhi[{layerOrDiskNr, hit_idx + 1, tm_type}]->fill(dPhi, seed.Et());
  382. }
  383. }
  384. }
  385. }
  386. n_seeds.fill(seeds.size());
  387. }
  388. tds.save_all();
  389. }
  390. int main(int argc, char * argv[]){
  391. using namespace fv_util;
  392. ArgParser args(argc, argv);
  393. bool silent = args.cmd_option_exists("-s");
  394. if(args.cmd_option_exists("-c")) {
  395. init_config(args.get_cmd_option("-c"));
  396. args.update_config();
  397. init_log(LogPriority::kLogInfo);
  398. // gSystem->Load("libfilval.so");
  399. run(silent);
  400. } else {
  401. cout << "Usage: ./" << argv[0] << " (-s) -c config_file.yaml" << endl;
  402. }
  403. return 0;
  404. }