All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Signal.cc
Go to the documentation of this file.
1 #include "Signal.h"
2 #include "Colours.h"
3 #include <cstdlib>
4 #include <iomanip>
5 
6 // Include Marlin
7 #include <marlin/Global.h>
8 #include <streamlog/streamlog.h>
9 
10 // Namespaces
11 using namespace lcio;
12 using namespace marlin;
13 
14 namespace sistrip {
15 
16 //
17 // Update MC truth information - SimTrackerHit
18 //
19 void Signal::updateSimHitMap(EVENT::SimTrackerHit * simHit, float weight)
20 {
21  if(_simHitMap.find(simHit) != _simHitMap.end())
22  {
23  _simHitMap[simHit] += weight;
24  }
25  else
26  {
27  _simHitMap[simHit] = weight;
28  }
29 }
30 
31 void Signal::updateSimHitMap(SimTrackerHitMap simHitMap)
32 {
33  for(SimTrackerHitMap::const_iterator iterSHM=simHitMap.begin(); iterSHM!=simHitMap.end(); ++iterSHM)
34  {
35  EVENT::SimTrackerHit * simHit = iterSHM->first;
36  float weight = iterSHM->second;
37 
38  if(_simHitMap.find(simHit) != _simHitMap.end()) _simHitMap[simHit] += weight;
39  else _simHitMap[simHit] = weight;
40  }
41 }
42 
43 //
44 // Get MC truth information - sum of weights
45 //
46 float Signal::getSimHitWeightSum()
47 {
48  float weightSum = 0;
49 
50  for (SimTrackerHitMap::const_iterator iterSHM=_simHitMap.begin(); iterSHM!=_simHitMap.end(); ++iterSHM) {
51 
52  weightSum += iterSHM->second;
53  }
54 
55  return weightSum;
56 }
57 
58 } // Namespace
59 
std::map< EVENT::SimTrackerHit *, float > SimTrackerHitMap
Definition: Signal.h:17