All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
StripCluster.cc
Go to the documentation of this file.
1 #include "StripCluster.h"
2 #include "Colours.h"
3 #include <stdlib.h>
4 
5 // Include Marlin
6 #include <streamlog/streamlog.h>
7 #include <cstdlib>
8 
9 // Namespaces
10 using namespace CLHEP;
11 using namespace lcio;
12 
13 namespace sistrip {
14 
15 //
16 // Destructor
17 //
18 StripCluster::~StripCluster()
19 {
20 // std::cout << "Deleting StripCluster" << std::endl;
21 }
22 
23 //
24 // Set cluster position Three vector
25 //
26 void StripCluster::set3Position( const Hep3Vector & position)
27 {
28  _position.setX( position.getX());
29  _position.setY( position.getY());
30  _position.setZ( position.getZ());
31 }
32 
33 //
34 // Set cluster - position sigma Three vector
35 //
36 void StripCluster::set3PosSigma( const Hep3Vector & posSigma)
37 {
38  _posSigma.setX( posSigma.getX());
39  _posSigma.setY( posSigma.getY());
40  _posSigma.setZ( posSigma.getZ());
41 }
42 
43 //
44 // Update MC truth information - SimTrackerHit
45 //
46 void StripCluster::updateSimHitMap(SimTrackerHitMap simHitMap)
47 {
48  for (SimTrackerHitMap::const_iterator iterSHM=simHitMap.begin(); iterSHM!=simHitMap.end(); iterSHM++) {
49 
50  EVENT::SimTrackerHit * simHit = iterSHM->first;
51  float weight = iterSHM->second;
52 
53  if (_simHitMap.find(simHit) != _simHitMap.end()) _simHitMap[simHit] += weight;
54  else _simHitMap[simHit] = weight;
55  }
56 }
57 
58 //
59 // Get MC truth information - sum of weights
60 //
61 float StripCluster::getSimHitWeightSum()
62 {
63  float weightSum = 0;
64 
65  for (SimTrackerHitMap::const_iterator iterSHM=_simHitMap.begin(); iterSHM!=_simHitMap.end(); iterSHM++) {
66 
67  weightSum += iterSHM->second;
68  }
69 
70  return weightSum;
71 }
72 
73 } // Namespace;
74 
std::map< EVENT::SimTrackerHit *, float > SimTrackerHitMap
Definition: Signal.h:17