ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
MM_StripResponse Class Reference

#include <MM_StripResponse.h>

Collaboration diagram for MM_StripResponse:

Public Member Functions

 MM_StripResponse ()=default
 
 MM_StripResponse (std::vector< std::unique_ptr< MM_IonizationCluster >> &IonizationClusters, float timeResolution, float stripPitch, int stripID, int minstripID, int maxstripID)
 
void timeOrderElectrons ()
 
void calculateTimeSeries (float thetaD, int gasgap)
 
void simulateCrossTalk (float crossTalk1, float crossTalk2)
 
void calculateSummaries (float chargeThreshold)
 
const std::map< int, int > & getTimeThreshold () const
 
const std::map< int, float > & getTotalCharge () const
 
const std::map< int, float > & getMaxCharge () const
 
const std::map< int, int > & getTimeMaxCharge () const
 
const std::vector< int > & getStripVec () const
 
const std::vector< std::vector< float > > & getTimeThresholdVec () const
 
const std::vector< std::vector< float > > & getTotalChargeVec () const
 
const std::vector< float > & getMaxChargeVec () const
 
const std::vector< float > & getTimeMaxChargeVec () const
 
int getNElectrons () const
 
float totalCharge () const
 
std::vector< std::unique_ptr< MM_Electron > > & getElectrons ()
 

Private Attributes

float m_timeResolution {0.f}
 
float m_stripPitch {0.f}
 
int m_stripID {0}
 
int m_minstripID {0}
 
int m_maxstripID {0}
 
std::vector< std::unique_ptr< MM_Electron > > m_Electrons {}
 
std::map< int, std::map< int, float > > m_stripCharges {}
 
std::map< int, int > m_stripTimeThreshold {}
 
std::map< int, float > m_stripTotalCharge {}
 
std::map< int, float > m_stripMaxCharge {}
 
std::map< int, int > m_stripTimeMaxCharge {}
 
std::vector< int > m_v_strip {}
 
std::vector< std::vector< float > > m_v_stripTimeThreshold {}
 
std::vector< std::vector< float > > m_v_stripTotalCharge {}
 
std::vector< float > m_v_stripMaxCharge {}
 
std::vector< float > m_v_stripTimeMaxCharge {}
 

Detailed Description

Definition at line 20 of file MM_StripResponse.h.

Constructor & Destructor Documentation

◆ MM_StripResponse() [1/2]

MM_StripResponse::MM_StripResponse ( )
default

◆ MM_StripResponse() [2/2]

MM_StripResponse::MM_StripResponse ( std::vector< std::unique_ptr< MM_IonizationCluster >> &  IonizationClusters,
float  timeResolution,
float  stripPitch,
int  stripID,
int  minstripID,
int  maxstripID 
)

Definition at line 7 of file MM_StripResponse.cxx.

8  :
9  m_timeResolution(timeResolution), m_stripPitch(stripPitch), m_stripID(stripID), m_minstripID(minstripID), m_maxstripID(maxstripID) {
10  for (auto& IonizationCluster : IonizationClusters)
11  for (auto& Electron : IonizationCluster->getElectrons()) m_Electrons.push_back(std::move(Electron));
12 }

Member Function Documentation

◆ calculateSummaries()

void MM_StripResponse::calculateSummaries ( float  chargeThreshold)

Definition at line 91 of file MM_StripResponse.cxx.

91  {
92  std::map<int, std::map<int, float>> stripChargesCopy2;
93  stripChargesCopy2.insert(m_stripCharges.begin(), m_stripCharges.end());
94  for (auto& stripTimeSeries : stripChargesCopy2) {
95  int timeBin = stripTimeSeries.first;
96  for (auto& stripCharge : stripTimeSeries.second) {
97  int stripVal = stripCharge.first;
98  // remove dead (missing) strips
99  // First active strip starts at m_minstripID
100  // Last active strip numbrer is maxStripID-1
101  if (stripVal < m_minstripID || stripVal > m_maxstripID - 1) continue;
102  // remove PCB gap strips
103  if (stripVal == 1024 || stripVal == 1025 || stripVal == 2048 || stripVal == 2049 || stripVal == 3072 || stripVal == 3073 ||
104  stripVal == 4096 || stripVal == 4097)
105  continue;
106  float stripChargeVal = stripCharge.second;
107  if (stripChargeVal < chargeThreshold) continue;
108 
109  bool found = false;
110  for (size_t ii = 0; ii < m_v_strip.size(); ii++) {
111  if (m_v_strip.at(ii) == stripVal) {
112  m_v_stripTimeThreshold.at(ii).push_back(timeBin * m_timeResolution);
113  m_v_stripTotalCharge.at(ii).push_back(stripChargeVal);
114  found = true;
115  break;
116  }
117  }
118  if (!found) { // // strip not in vector, add new entry
119  m_v_strip.push_back(stripVal);
120  std::vector<float> qTemp;
121  qTemp.push_back(stripChargeVal);
122  m_v_stripTotalCharge.push_back(qTemp);
123  std::vector<float> tTemp;
124  tTemp.push_back(timeBin * m_timeResolution);
125  m_v_stripTimeThreshold.push_back(tTemp);
126  }
127  }
128  }
129 }

◆ calculateTimeSeries()

void MM_StripResponse::calculateTimeSeries ( float  thetaD,
int  gasgap 
)

Definition at line 30 of file MM_StripResponse.cxx.

30  {
31  for (auto& Electron : m_Electrons) {
32  int timeBin = (int)(Electron->getTime() / m_timeResolution);
33  // m_stripID defines the initial strip where the muon entered the gas gap
34 
35  int stripVal = 0;
36  if (std::abs(Electron->getX()) > m_stripPitch / 2) {
37  if (Electron->getX() > 0.0)
38  stripVal = m_stripID + int((Electron->getX() - m_stripPitch / 2) / m_stripPitch) + 1;
39  else
40  stripVal = m_stripID + int((Electron->getX() + m_stripPitch / 2) / m_stripPitch) - 1;
41  } else
42  stripVal = m_stripID;
43 
44  // Only add the strips that are either read out, or can cross talk to the read out strips
45  if (stripVal < m_minstripID - 2 || stripVal > m_maxstripID + 1) stripVal = -1;
46  if (stripVal > 0) m_stripCharges[timeBin][stripVal] += Electron->getCharge();
47  }
48 }

◆ getElectrons()

std::vector< std::unique_ptr< MM_Electron > > & MM_StripResponse::getElectrons ( )

Definition at line 22 of file MM_StripResponse.cxx.

22 { return m_Electrons; }

◆ getMaxCharge()

const std::map< int, float > & MM_StripResponse::getMaxCharge ( ) const

Definition at line 134 of file MM_StripResponse.cxx.

134 { return m_stripMaxCharge; }

◆ getMaxChargeVec()

const std::vector< float > & MM_StripResponse::getMaxChargeVec ( ) const

Definition at line 139 of file MM_StripResponse.cxx.

139 { return m_v_stripMaxCharge; }

◆ getNElectrons()

int MM_StripResponse::getNElectrons ( ) const

Definition at line 14 of file MM_StripResponse.cxx.

14 { return m_Electrons.size(); }

◆ getStripVec()

const std::vector< int > & MM_StripResponse::getStripVec ( ) const

Definition at line 136 of file MM_StripResponse.cxx.

136 { return m_v_strip; }

◆ getTimeMaxCharge()

const std::map< int, int > & MM_StripResponse::getTimeMaxCharge ( ) const

Definition at line 135 of file MM_StripResponse.cxx.

135 { return m_stripTimeMaxCharge; }

◆ getTimeMaxChargeVec()

const std::vector< float > & MM_StripResponse::getTimeMaxChargeVec ( ) const

Definition at line 140 of file MM_StripResponse.cxx.

140 { return m_v_stripTimeMaxCharge; }

◆ getTimeThreshold()

const std::map< int, int > & MM_StripResponse::getTimeThreshold ( ) const

Definition at line 132 of file MM_StripResponse.cxx.

132 { return m_stripTimeThreshold; }

◆ getTimeThresholdVec()

const std::vector< std::vector< float > > & MM_StripResponse::getTimeThresholdVec ( ) const

Definition at line 137 of file MM_StripResponse.cxx.

137 { return m_v_stripTimeThreshold; }

◆ getTotalCharge()

const std::map< int, float > & MM_StripResponse::getTotalCharge ( ) const

Definition at line 133 of file MM_StripResponse.cxx.

133 { return m_stripTotalCharge; }

◆ getTotalChargeVec()

const std::vector< std::vector< float > > & MM_StripResponse::getTotalChargeVec ( ) const

Definition at line 138 of file MM_StripResponse.cxx.

138 { return m_v_stripTotalCharge; }

◆ simulateCrossTalk()

void MM_StripResponse::simulateCrossTalk ( float  crossTalk1,
float  crossTalk2 
)

Definition at line 50 of file MM_StripResponse.cxx.

50  {
51  // if no cross talk is simulate just skip everything and keep m_stripCharges as it was
52  if (crossTalk1 > 0.) {
53  // Unfortunately get stuck in the loop if you edit the map in the loop
54  // So make a copy!
55 
56  std::map<int, std::map<int, float>> stripChargesCopy1;
57  stripChargesCopy1.insert(m_stripCharges.begin(), m_stripCharges.end());
58 
59  // clear strip charge map since charge on the main strip needs to be scaled
60  m_stripCharges.clear();
61 
62  for (auto& stripTimeSeries : stripChargesCopy1) {
63  int timeBin = stripTimeSeries.first;
64  for (auto& stripCharge : stripTimeSeries.second) {
65  int stripVal = stripCharge.first;
66  float stripChargeVal = stripCharge.second;
67 
68  if (stripChargeVal == 0.) continue;
69 
70  // scale factcor for the charge on the main strip to account for the cross talk charge
71  float chargeScaleFactor = 1.0 / (1. + ((stripVal - 1 > 0) + (stripVal + 1 < m_maxstripID)) * crossTalk1 +
72  ((stripVal - 2 > 0) + (stripVal + 2 < m_maxstripID)) * crossTalk2);
73  stripChargeVal *= chargeScaleFactor;
74 
75  m_stripCharges[timeBin][stripVal] += stripChargeVal;
76 
77  // Allow crosstalk between strips that exist.
78  // Will check for read out strips in calculateSummaries function
79  if (stripVal - 1 > 0) m_stripCharges[timeBin][stripVal - 1] += stripChargeVal * crossTalk1;
80  if (stripVal + 1 < m_maxstripID) m_stripCharges[timeBin][stripVal + 1] += stripChargeVal * crossTalk1;
81 
82  if (crossTalk2 > 0.) {
83  if (stripVal - 2 > 0) m_stripCharges[timeBin][stripVal - 2] += stripChargeVal * crossTalk2;
84  if (stripVal + 2 < m_maxstripID) m_stripCharges[timeBin][stripVal + 2] += stripChargeVal * crossTalk2;
85  }
86  }
87  }
88  }
89 }

◆ timeOrderElectrons()

void MM_StripResponse::timeOrderElectrons ( )

Definition at line 24 of file MM_StripResponse.cxx.

24  {
25  std::sort(
26  m_Electrons.begin(), m_Electrons.end(),
27  [](const std::unique_ptr<MM_Electron>& a, const std::unique_ptr<MM_Electron>& b) -> bool { return a->getTime() < b->getTime(); });
28 }

◆ totalCharge()

float MM_StripResponse::totalCharge ( ) const

Definition at line 16 of file MM_StripResponse.cxx.

16  {
17  float qtot = 0;
18  for (const std::unique_ptr<MM_Electron>& electron : m_Electrons) { qtot += electron->getCharge(); }
19  return qtot;
20 }

Member Data Documentation

◆ m_Electrons

std::vector<std::unique_ptr<MM_Electron> > MM_StripResponse::m_Electrons {}
private

Definition at line 52 of file MM_StripResponse.h.

◆ m_maxstripID

int MM_StripResponse::m_maxstripID {0}
private

Definition at line 50 of file MM_StripResponse.h.

◆ m_minstripID

int MM_StripResponse::m_minstripID {0}
private

Definition at line 49 of file MM_StripResponse.h.

◆ m_stripCharges

std::map<int, std::map<int, float> > MM_StripResponse::m_stripCharges {}
private

Definition at line 55 of file MM_StripResponse.h.

◆ m_stripID

int MM_StripResponse::m_stripID {0}
private

Definition at line 48 of file MM_StripResponse.h.

◆ m_stripMaxCharge

std::map<int, float> MM_StripResponse::m_stripMaxCharge {}
private

Definition at line 60 of file MM_StripResponse.h.

◆ m_stripPitch

float MM_StripResponse::m_stripPitch {0.f}
private

Definition at line 47 of file MM_StripResponse.h.

◆ m_stripTimeMaxCharge

std::map<int, int> MM_StripResponse::m_stripTimeMaxCharge {}
private

Definition at line 61 of file MM_StripResponse.h.

◆ m_stripTimeThreshold

std::map<int, int> MM_StripResponse::m_stripTimeThreshold {}
private

Definition at line 58 of file MM_StripResponse.h.

◆ m_stripTotalCharge

std::map<int, float> MM_StripResponse::m_stripTotalCharge {}
private

Definition at line 59 of file MM_StripResponse.h.

◆ m_timeResolution

float MM_StripResponse::m_timeResolution {0.f}
private

Definition at line 46 of file MM_StripResponse.h.

◆ m_v_strip

std::vector<int> MM_StripResponse::m_v_strip {}
private

Definition at line 64 of file MM_StripResponse.h.

◆ m_v_stripMaxCharge

std::vector<float> MM_StripResponse::m_v_stripMaxCharge {}
private

Definition at line 67 of file MM_StripResponse.h.

◆ m_v_stripTimeMaxCharge

std::vector<float> MM_StripResponse::m_v_stripTimeMaxCharge {}
private

Definition at line 68 of file MM_StripResponse.h.

◆ m_v_stripTimeThreshold

std::vector<std::vector<float> > MM_StripResponse::m_v_stripTimeThreshold {}
private

Definition at line 65 of file MM_StripResponse.h.

◆ m_v_stripTotalCharge

std::vector<std::vector<float> > MM_StripResponse::m_v_stripTotalCharge {}
private

Definition at line 66 of file MM_StripResponse.h.


The documentation for this class was generated from the following files:
MM_StripResponse::m_v_stripTimeMaxCharge
std::vector< float > m_v_stripTimeMaxCharge
Definition: MM_StripResponse.h:68
MM_StripResponse::m_timeResolution
float m_timeResolution
Definition: MM_StripResponse.h:46
MM_StripResponse::m_stripPitch
float m_stripPitch
Definition: MM_StripResponse.h:47
MM_StripResponse::m_stripMaxCharge
std::map< int, float > m_stripMaxCharge
Definition: MM_StripResponse.h:60
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
MM_StripResponse::m_v_stripTotalCharge
std::vector< std::vector< float > > m_v_stripTotalCharge
Definition: MM_StripResponse.h:66
MM_StripResponse::m_v_stripTimeThreshold
std::vector< std::vector< float > > m_v_stripTimeThreshold
Definition: MM_StripResponse.h:65
MM_StripResponse::m_stripID
int m_stripID
Definition: MM_StripResponse.h:48
MM_StripResponse::m_minstripID
int m_minstripID
Definition: MM_StripResponse.h:49
MM_StripResponse::m_stripTotalCharge
std::map< int, float > m_stripTotalCharge
Definition: MM_StripResponse.h:59
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
MM_StripResponse::m_stripTimeThreshold
std::map< int, int > m_stripTimeThreshold
Definition: MM_StripResponse.h:58
a
TList * a
Definition: liststreamerinfos.cxx:10
MM_StripResponse::m_Electrons
std::vector< std::unique_ptr< MM_Electron > > m_Electrons
Definition: MM_StripResponse.h:52
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
Electron
Class describing an electron.
xAOD::EgammaParameters::electron
@ electron
Definition: EgammaEnums.h:18
MM_StripResponse::m_maxstripID
int m_maxstripID
Definition: MM_StripResponse.h:50
MM_StripResponse::m_stripTimeMaxCharge
std::map< int, int > m_stripTimeMaxCharge
Definition: MM_StripResponse.h:61
MM_StripResponse::m_stripCharges
std::map< int, std::map< int, float > > m_stripCharges
Definition: MM_StripResponse.h:55
MM_StripResponse::m_v_stripMaxCharge
std::vector< float > m_v_stripMaxCharge
Definition: MM_StripResponse.h:67
MM_StripResponse::m_v_strip
std::vector< int > m_v_strip
Definition: MM_StripResponse.h:64