From 254d7ed2d8c0ba8173b9a3f8e58651e0d9b40dad Mon Sep 17 00:00:00 2001
From: Whitney Armstrong <warmstrong@anl.gov>
Date: Thu, 20 May 2021 21:55:14 -0500
Subject: [PATCH] modified: scripts/tutorial3_id_spec.cxx
---
scripts/tutorial3_id_spec.cxx | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/scripts/tutorial3_id_spec.cxx b/scripts/tutorial3_id_spec.cxx
index 0eb3b98..3e95d71 100644
--- a/scripts/tutorial3_id_spec.cxx
+++ b/scripts/tutorial3_id_spec.cxx
@@ -32,7 +32,7 @@ R__LOAD_LIBRARY(libfmt.so)
/** Hit position example.
*
*/
-void tutorial2_cell_size(const char* fname = "gem_tracker_sim.root") {
+void tutorial3_id_spec(const char* fname = "gem_tracker_sim.root") {
using namespace ROOT::Math;
TChain* t = new TChain("events");
@@ -49,10 +49,12 @@ void tutorial2_cell_size(const char* fname = "gem_tracker_sim.root") {
detector.fromCompact("gem_tracker.xml");
dd4hep::rec::CellIDPositionConverter cellid_converter(detector);
+ fmt::print("--------------------------");
+ fmt::print("ID specification:");
auto decoder = detector.readout("GEMTrackerHits").idSpec().decoder();
fmt::print("{}\n", decoder->fieldDescription());
auto layer_index = decoder->index("layer");
- fmt::print(" layer index is {}.\n", layer_index);
+ fmt::print(" \"layer\" index is {}.\n", layer_index);
// Simple lambda to define nhits branch
auto nhits = [](const std::vector<dd4pod::TrackerHitData>& evt) { return (int)evt.size(); };
@@ -101,16 +103,16 @@ void tutorial2_cell_size(const char* fname = "gem_tracker_sim.root") {
};
auto d1 = d0.Define("nhits", nhits, {"GEMTrackerHits"})
- .Filter([=](const std::vector<dd4pod::TrackerHitData>& hits) {
- for (auto h : hits) {
- auto pos = ROOT::Math::XYZVector(h.position.x,h.position.y,h.position.z);
- if ((pos.r() > 100.0) && (std::abs(pos.phi()-M_PI/2.0)< M_PI/6)) {
- return true;
- }
- }
- return false;
- },
- {"GEMTrackerHits"})
+ //.Filter([=](const std::vector<dd4pod::TrackerHitData>& hits) {
+ // for (auto h : hits) {
+ // auto pos = ROOT::Math::XYZVector(h.position.x,h.position.y,h.position.z);
+ // if ((pos.r() > 100.0) && (std::abs(pos.phi()-M_PI/2.0)< M_PI/6)) {
+ // return true;
+ // }
+ // }
+ // return false;
+ // },
+ // {"GEMTrackerHits"})
.Define("xy_hit_pos", local_position, {"GEMTrackerHits"})
.Define("x_pos", x_pos, {"xy_hit_pos"})
.Define("y_pos", y_pos, {"xy_hit_pos"});
--
GitLab