4444#include < unordered_set>
4545#include < vector>
4646
47- class TGeoNode ; // forward declaration (ROOT geometry node)
47+ class TGeoNode ; // forward declaration (ROOT geometry node)
4848
4949namespace eicrecon {
5050
@@ -55,95 +55,82 @@ using PlacementPath = std::vector<TGeoNode*>;
5555
5656/* One bit-field of the read-out and the discrete values seen in a scan. */
5757struct FieldInfo {
58- std::string name; // /< Bit-field name as in ID encoding
59- std::vector<int > values; // /< Values found in this component
58+ std::string name; // /< Bit-field name as in ID encoding
59+ std::vector<int > values; // /< Values found in this component
6060};
6161
6262/* Quick handle for the EICrecon algorithm template. */
6363using RandomNoiseAlgorithm =
64- algorithms::Algorithm< algorithms::Input <edm4eic::RawTrackerHitCollection>,
65- algorithms::Output<edm4eic::RawTrackerHitCollection> >;
64+ algorithms::Algorithm<algorithms::Input<edm4eic::RawTrackerHitCollection>,
65+ algorithms::Output<edm4eic::RawTrackerHitCollection>>;
6666
6767// -------------------------------------------------------------------------
6868// Main class
6969// -------------------------------------------------------------------------
70- class RandomNoise : public RandomNoiseAlgorithm ,
71- public WithPodConfig<RandomNoiseConfig>
72- {
70+ class RandomNoise : public RandomNoiseAlgorithm , public WithPodConfig <RandomNoiseConfig> {
7371public:
74- /* Map field-name → (min,max) returned by ScanComponent. */
75- using ComponentBounds = std::map<std::string, std::pair<long ,long >>;
72+ /* Map field-name → (min,max) returned by ScanComponent. */
73+ using ComponentBounds = std::map<std::string, std::pair<long , long >>;
7674
77- /* One complete volID path (field-name → value) and a list thereof. */
78- using VolIDMap = std::unordered_map<std::string,int >;
79- using VolIDMapArray = std::vector<VolIDMap>;
75+ /* One complete volID path (field-name → value) and a list thereof. */
76+ using VolIDMap = std::unordered_map<std::string, int >;
77+ using VolIDMapArray = std::vector<VolIDMap>;
8078
81- explicit RandomNoise (std::string_view name)
82- : RandomNoiseAlgorithm{
83- name,
84- {" inputRawHitCollection" }, // default input tag
85- {" outputRawHitCollection" }, // default output tag
86- " Injects random noise hits into a RawTrackerHitCollection." }
87- {}
79+ explicit RandomNoise (std::string_view name)
80+ : RandomNoiseAlgorithm{name,
81+ {" inputRawHitCollection" }, // default input tag
82+ {" outputRawHitCollection" }, // default output tag
83+ " Injects random noise hits into a RawTrackerHitCollection." } {}
8884
89- /* Called once – stores pointer to DD4hep geometry. */
90- void init (const dd4hep::Detector* detector);
85+ /* Called once – stores pointer to DD4hep geometry. */
86+ void init (const dd4hep::Detector* detector);
9187
92- /* Override default input tag (needed by factory). */
93- void setInputCollectionName (const std::string& name)
94- { m_input_collection_name = name; }
88+ /* Override default input tag (needed by factory). */
89+ void setInputCollectionName (const std::string& name) { m_input_collection_name = name; }
9590
96- /* Framework entry point – executed for every event. */
97- void process (const Input&, const Output&) const final ;
91+ /* Framework entry point – executed for every event. */
92+ void process (const Input&, const Output&) const final ;
9893
99- // -------------------------------------------------------------------------
100- // Geometry helpers (public for unit tests, otherwise used internally)
101- // -------------------------------------------------------------------------
102- /* Return all ID-paths from ‘de’ to its *sensitive* leaves.
94+ // -------------------------------------------------------------------------
95+ // Geometry helpers (public for unit tests, otherwise used internally)
96+ // -------------------------------------------------------------------------
97+ /* Return all ID-paths from ‘de’ to its *sensitive* leaves.
10398 If keepDeepestOnly==true (default) only the longest paths are kept. */
104- VolIDMapArray ScanDetectorElement (dd4hep::DetElement de,
105- bool keepDeepestOnly=true ) const ;
99+ VolIDMapArray ScanDetectorElement (dd4hep::DetElement de, bool keepDeepestOnly = true ) const ;
106100
107- /* Determine min / max of every local segmentation field that appears
101+ /* Determine min / max of every local segmentation field that appears
108102 inside ‘de’. Parameter ‘name’ is reserved for future filters. */
109- ComponentBounds ScanComponent (dd4hep::DetElement de,
110- std::string name=" " ) const ;
103+ ComponentBounds ScanComponent (dd4hep::DetElement de, std::string name = " " ) const ;
111104
112105private:
113- // =====================================================================
114- // Noise generation helpers
115- // =====================================================================
116-
117- /* Add noise hits belonging to one DetElement to the global hit-map. */
118- void add_noise_hits (
119- std::unordered_map<std::uint64_t , edm4eic::MutableRawTrackerHit>& hitMap,
120- const dd4hep::DetElement& det) const ;
121-
122- /* Core routine that creates the actual RawTrackerHits. */
123- void inject_noise_hits (
124- std::unordered_map<std::uint64_t , edm4eic::MutableRawTrackerHit>& map,
125- const dd4hep::DetElement& det,
126- const VolIDMapArray& idPaths,
127- const ComponentBounds& bounds) const ;
128-
129- // =====================================================================
130- // Recursive helper used by ScanDetectorElement
131- // =====================================================================
132- void PrintVolIDsRecursive (const dd4hep::PlacedVolume& pv,
133- VolIDMapArray& result,
134- VolIDMap& current,
135- int depth) const ;
136-
137- /* True if every key in ‘keys’ exists in map ‘m’. */
138- static bool hasAllKeys (const VolIDMap& m,
139- const std::vector<std::string>& keys);
140-
141- // -------------------------------------------------------------------------
142- // Data members
143- // -------------------------------------------------------------------------
144- mutable TRandom3 m_random{0 }; // /< ROOT RNG (not used atm)
145- const dd4hep::Detector* m_dd4hepGeo = nullptr ;// /< DD4hep geometry handle
146- std::string m_input_collection_name; // /< Input tag override
106+ // =====================================================================
107+ // Noise generation helpers
108+ // =====================================================================
109+
110+ /* Add noise hits belonging to one DetElement to the global hit-map. */
111+ void add_noise_hits (std::unordered_map<std::uint64_t , edm4eic::MutableRawTrackerHit>& hitMap,
112+ const dd4hep::DetElement& det) const ;
113+
114+ /* Core routine that creates the actual RawTrackerHits. */
115+ void inject_noise_hits (std::unordered_map<std::uint64_t , edm4eic::MutableRawTrackerHit>& map,
116+ const dd4hep::DetElement& det, const VolIDMapArray& idPaths,
117+ const ComponentBounds& bounds) const ;
118+
119+ // =====================================================================
120+ // Recursive helper used by ScanDetectorElement
121+ // =====================================================================
122+ void PrintVolIDsRecursive (const dd4hep::PlacedVolume& pv, VolIDMapArray& result,
123+ VolIDMap& current, int depth) const ;
124+
125+ /* True if every key in ‘keys’ exists in map ‘m’. */
126+ static bool hasAllKeys (const VolIDMap& m, const std::vector<std::string>& keys);
127+
128+ // -------------------------------------------------------------------------
129+ // Data members
130+ // -------------------------------------------------------------------------
131+ mutable TRandom3 m_random{0 }; // /< ROOT RNG (not used atm)
132+ const dd4hep::Detector* m_dd4hepGeo = nullptr ; // /< DD4hep geometry handle
133+ std::string m_input_collection_name; // /< Input tag override
147134};
148135
149- } // namespace eicrecon
136+ } // namespace eicrecon
0 commit comments