88#include <g4main/PHG4Hit.h>
99#include <g4main/PHG4HitContainer.h>
1010#include <fun4all/Fun4AllReturnCodes.h>
11- #include <phool/PHNodeIterator.h>
12- #include <phool/PHTypedNodeIterator.h>
1311#include <phool/PHCompositeNode.h>
1412#include <phool/PHIODataNode.h>
13+ #include <phool/PHNodeIterator.h>
1514#include <fun4all/getClass.h>
1615#include <g4detectors/PHG4CylinderCellContainer.h>
1716#include <g4detectors/PHG4CylinderCellGeomContainer.h>
@@ -123,14 +122,11 @@ bool PHG4SvtxClusterizer::ladder_are_adjacent(const PHG4CylinderCell* lhs,
123122 return false;
124123}
125124
126- PHG4SvtxClusterizer ::PHG4SvtxClusterizer (const char * name ) :
125+ PHG4SvtxClusterizer ::PHG4SvtxClusterizer (const string & name ) :
127126 SubsysReco (name ),
128127 _hits (NULL ),
129128 _clusterlist (NULL ),
130129 _fraction_of_mip (0.5 ),
131- _thresholds_by_layer (),
132- _make_z_clustering (),
133- _make_e_weights (),
134130 _timer (PHTimeServer ::get ()-> insert_new (name )) {
135131}
136132
@@ -151,7 +147,7 @@ int PHG4SvtxClusterizer::InitRun(PHCompositeNode* topNode) {
151147
152148 // Looking for the DST node
153149 PHCompositeNode * dstNode
154- = static_cast < PHCompositeNode * > (iter .findFirst ("PHCompositeNode" ,"DST" ));
150+ = dynamic_cast < PHCompositeNode * > (iter .findFirst ("PHCompositeNode" ,"DST" ));
155151 if (!dstNode ) {
156152 cout << PHWHERE << "DST Node missing, doing nothing." << endl ;
157153 return Fun4AllReturnCodes ::ABORTRUN ;
@@ -215,16 +211,12 @@ int PHG4SvtxClusterizer::process_event(PHCompositeNode *topNode) {
215211
216212 _timer .get ()-> restart ();
217213
218- _clusterlist = 0 ;
219- PHTypedNodeIterator < SvtxClusterMap > clusteriter (topNode );
220- PHIODataNode < SvtxClusterMap > * SvtxClusterMapNode = clusteriter .find ("SvtxClusterMap" );
221- if (!SvtxClusterMapNode ) {
222- cout << PHWHERE << " ERROR: Can't find SvtxClusterMap." << endl ;
223- return Fun4AllReturnCodes ::ABORTRUN ;
224- } else {
225- _clusterlist = (SvtxClusterMap * )SvtxClusterMapNode -> getData ();
226- }
227-
214+ _clusterlist = findNode ::getClass < SvtxClusterMap > (topNode ,"SvtxClusterMap" );
215+ if (!_clusterlist )
216+ {
217+ cout << PHWHERE << " ERROR: Can't find SvtxClusterMap." << endl ;
218+ return Fun4AllReturnCodes ::ABORTRUN ;
219+ }
228220 _clusterlist -> Reset ();
229221
230222 ClusterCylinderCells (topNode );
@@ -239,12 +231,7 @@ int PHG4SvtxClusterizer::process_event(PHCompositeNode *topNode) {
239231void PHG4SvtxClusterizer ::CalculateCylinderThresholds (PHCompositeNode * topNode ) {
240232
241233 // get the SVX geometry object
242- PHG4CylinderCellGeomContainer * geom_container = 0 ;
243- PHTypedNodeIterator < PHG4CylinderCellGeomContainer > geomiter (topNode );
244- PHIODataNode < PHG4CylinderCellGeomContainer > * PHG4CylinderCellGeomContainerNode = geomiter .find ("CYLINDERCELLGEOM_SVTX" );
245- if (PHG4CylinderCellGeomContainerNode ) {
246- geom_container = (PHG4CylinderCellGeomContainer * ) PHG4CylinderCellGeomContainerNode -> getData ();
247- }
234+ PHG4CylinderCellGeomContainer * geom_container = findNode ::getClass < PHG4CylinderCellGeomContainer > (topNode ,"CYLINDERCELLGEOM_SVTX" );
248235 if (!geom_container ) return ;
249236
250237 // determine cluster thresholds and layer index mapping
@@ -276,21 +263,10 @@ void PHG4SvtxClusterizer::CalculateCylinderThresholds(PHCompositeNode *topNode)
276263
277264void PHG4SvtxClusterizer ::CalculateLadderThresholds (PHCompositeNode * topNode ) {
278265
279- PHG4CylinderCellContainer * cells = NULL ;
280- PHG4CylinderGeomContainer * geom_container = NULL ;
281-
282- PHTypedNodeIterator < PHG4CylinderCellContainer > celliter (topNode );
283- PHIODataNode < PHG4CylinderCellContainer > * cell_container_node = celliter .find ("G4CELL_SILICON_TRACKER" );
284- if (cell_container_node ) {
285- cells = (PHG4CylinderCellContainer * ) cell_container_node -> getData ();
286- }
266+ PHG4CylinderCellContainer * cells = findNode ::getClass < PHG4CylinderCellContainer > (topNode ,"G4CELL_SILICON_TRACKER" );
287267 if (!cells ) return ;
288-
289- PHTypedNodeIterator < PHG4CylinderGeomContainer > geomiter (topNode );
290- PHIODataNode < PHG4CylinderGeomContainer > * PHG4CylinderGeomContainerNode = geomiter .find ("CYLINDERGEOM_SILICON_TRACKER" );
291- if (PHG4CylinderGeomContainerNode ) {
292- geom_container = (PHG4CylinderGeomContainer * ) PHG4CylinderGeomContainerNode -> getData ();
293- }
268+
269+ PHG4CylinderGeomContainer * geom_container = findNode ::getClass < PHG4CylinderGeomContainer > (topNode ,"CYLINDERGEOM_SILICON_TRACKER" );
294270 if (!geom_container ) return ;
295271
296272 PHG4CylinderGeomContainer ::ConstRange layerrange = geom_container -> get_begin_end ();
@@ -326,28 +302,13 @@ void PHG4SvtxClusterizer::ClusterCylinderCells(PHCompositeNode *topNode) {
326302 //----------
327303
328304 // get the SVX geometry object
329- PHG4CylinderCellGeomContainer * geom_container = 0 ;
330- PHTypedNodeIterator < PHG4CylinderCellGeomContainer > geomiter (topNode );
331- PHIODataNode < PHG4CylinderCellGeomContainer > * PHG4CylinderCellGeomContainerNode = geomiter .find ("CYLINDERCELLGEOM_SVTX" );
332- if (PHG4CylinderCellGeomContainerNode ) {
333- geom_container = (PHG4CylinderCellGeomContainer * ) PHG4CylinderCellGeomContainerNode -> getData ();
334- }
305+ PHG4CylinderCellGeomContainer * geom_container = findNode ::getClass < PHG4CylinderCellGeomContainer > (topNode ,"CYLINDERCELLGEOM_SVTX" );
335306 if (!geom_container ) return ;
336307
337- PHG4HitContainer * g4hits = 0 ;
338- PHTypedNodeIterator < PHG4HitContainer > g4hititer (topNode );
339- PHIODataNode < PHG4HitContainer > * PHG4HitContainerNode = g4hititer .find ("G4HIT_SVTX" );
340- if (PHG4HitContainerNode ) {
341- g4hits = (PHG4HitContainer * )PHG4HitContainerNode -> getData ();
342- }
308+ PHG4HitContainer * g4hits = findNode ::getClass < PHG4HitContainer > (topNode ,"G4HIT_SVTX" );
343309 if (!g4hits ) return ;
344310
345- PHG4CylinderCellContainer * cells = 0 ;
346- PHTypedNodeIterator < PHG4CylinderCellContainer > celliter (topNode );
347- PHIODataNode < PHG4CylinderCellContainer > * cell_container_node = celliter .find ("G4CELL_SVTX" );
348- if (cell_container_node ) {
349- cells = (PHG4CylinderCellContainer * ) cell_container_node -> getData ();
350- }
311+ PHG4CylinderCellContainer * cells = findNode ::getClass < PHG4CylinderCellContainer > (topNode ,"G4CELL_SVTX" );
351312 if (!cells ) return ;
352313
353314 //-----------
@@ -612,28 +573,13 @@ void PHG4SvtxClusterizer::ClusterLadderCells(PHCompositeNode *topNode) {
612573 //----------
613574
614575 // get the SVX geometry object
615- PHG4CylinderGeomContainer * geom_container = 0 ;
616- PHTypedNodeIterator < PHG4CylinderGeomContainer > geomiter (topNode );
617- PHIODataNode < PHG4CylinderGeomContainer > * PHG4CylinderGeomContainerNode = geomiter .find ("CYLINDERGEOM_SILICON_TRACKER" );
618- if (PHG4CylinderGeomContainerNode ) {
619- geom_container = (PHG4CylinderGeomContainer * ) PHG4CylinderGeomContainerNode -> getData ();
620- }
576+ PHG4CylinderGeomContainer * geom_container = findNode ::getClass < PHG4CylinderGeomContainer > (topNode ,"CYLINDERGEOM_SILICON_TRACKER" );
621577 if (!geom_container ) return ;
622578
623- PHG4HitContainer * g4hits = 0 ;
624- PHTypedNodeIterator < PHG4HitContainer > g4hititer (topNode );
625- PHIODataNode < PHG4HitContainer > * PHG4HitContainerNode = g4hititer .find ("G4HIT_SILICON_TRACKER" );
626- if (PHG4HitContainerNode ) {
627- g4hits = (PHG4HitContainer * )PHG4HitContainerNode -> getData ();
628- }
579+ PHG4HitContainer * g4hits = findNode ::getClass < PHG4HitContainer > (topNode ,"G4HIT_SILICON_TRACKER" );
629580 if (!g4hits ) return ;
630581
631- PHG4CylinderCellContainer * cells = 0 ;
632- PHTypedNodeIterator < PHG4CylinderCellContainer > celliter (topNode );
633- PHIODataNode < PHG4CylinderCellContainer > * cell_container_node = celliter .find ("G4CELL_SILICON_TRACKER" );
634- if (cell_container_node ) {
635- cells = (PHG4CylinderCellContainer * ) cell_container_node -> getData ();
636- }
582+ PHG4CylinderCellContainer * cells = findNode ::getClass < PHG4CylinderCellContainer > (topNode ,"G4CELL_SILICON_TRACKER" );
637583 if (!cells ) return ;
638584
639585 //-----------
@@ -921,13 +867,11 @@ void PHG4SvtxClusterizer::PrintClusters(PHCompositeNode *topNode) {
921867
922868 if (verbosity >= 1 ) {
923869
924- PHTypedNodeIterator < SvtxClusterMap > clusteriter (topNode );
925- PHIODataNode < SvtxClusterMap > * SvtxClusterMapNode = clusteriter .find ("SvtxClusterMap" );
926- if (!SvtxClusterMapNode ) return ;
870+ SvtxClusterMap * clusterlist = findNode ::getClass < SvtxClusterMap > (topNode ,"SvtxClusterMap" );
871+ if (!clusterlist ) return ;
927872
928873 cout << "================= PHG4SvtxClusterizer::process_event() ====================" << endl ;
929874
930- SvtxClusterMap * clusterlist = (SvtxClusterMap * )SvtxClusterMapNode -> getData ();
931875
932876 cout << " Found and recorded the following " << clusterlist -> size () << " clusters: " << endl ;
933877
0 commit comments