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 21 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 11 of file MM_StripResponse.cxx.

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

Member Function Documentation

◆ calculateSummaries()

void MM_StripResponse::calculateSummaries ( float  chargeThreshold)

Definition at line 95 of file MM_StripResponse.cxx.

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

◆ calculateTimeSeries()

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

Definition at line 34 of file MM_StripResponse.cxx.

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

◆ getElectrons()

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

Definition at line 26 of file MM_StripResponse.cxx.

26 { return m_Electrons; }

◆ getMaxCharge()

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

Definition at line 136 of file MM_StripResponse.cxx.

136 { return m_stripMaxCharge; }

◆ getMaxChargeVec()

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

Definition at line 141 of file MM_StripResponse.cxx.

141 { return m_v_stripMaxCharge; }

◆ getNElectrons()

int MM_StripResponse::getNElectrons ( ) const

Definition at line 18 of file MM_StripResponse.cxx.

18 { return m_Electrons.size(); }

◆ getStripVec()

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

Definition at line 138 of file MM_StripResponse.cxx.

138 { return m_v_strip; }

◆ getTimeMaxCharge()

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

Definition at line 137 of file MM_StripResponse.cxx.

137 { return m_stripTimeMaxCharge; }

◆ getTimeMaxChargeVec()

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

Definition at line 142 of file MM_StripResponse.cxx.

142 { return m_v_stripTimeMaxCharge; }

◆ getTimeThreshold()

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

Definition at line 134 of file MM_StripResponse.cxx.

134 { return m_stripTimeThreshold; }

◆ getTimeThresholdVec()

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

Definition at line 139 of file MM_StripResponse.cxx.

139 { return m_v_stripTimeThreshold; }

◆ getTotalCharge()

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

Definition at line 135 of file MM_StripResponse.cxx.

135 { return m_stripTotalCharge; }

◆ getTotalChargeVec()

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

Definition at line 140 of file MM_StripResponse.cxx.

140 { return m_v_stripTotalCharge; }

◆ simulateCrossTalk()

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

Definition at line 54 of file MM_StripResponse.cxx.

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

◆ timeOrderElectrons()

void MM_StripResponse::timeOrderElectrons ( )

Definition at line 28 of file MM_StripResponse.cxx.

28  {
29  std::sort(
30  m_Electrons.begin(), m_Electrons.end(),
31  [](const std::unique_ptr<MM_Electron>& a, const std::unique_ptr<MM_Electron>& b) -> bool { return a->getTime() < b->getTime(); });
32 }

◆ totalCharge()

float MM_StripResponse::totalCharge ( ) const

Definition at line 20 of file MM_StripResponse.cxx.

20  {
21  float qtot = 0;
22  for (const std::unique_ptr<MM_Electron>& electron : m_Electrons) { qtot += electron->getCharge(); }
23  return qtot;
24 }

Member Data Documentation

◆ m_Electrons

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

Definition at line 53 of file MM_StripResponse.h.

◆ m_maxstripID

int MM_StripResponse::m_maxstripID {0}
private

Definition at line 51 of file MM_StripResponse.h.

◆ m_minstripID

int MM_StripResponse::m_minstripID {0}
private

Definition at line 50 of file MM_StripResponse.h.

◆ m_stripCharges

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

Definition at line 56 of file MM_StripResponse.h.

◆ m_stripID

int MM_StripResponse::m_stripID {0}
private

Definition at line 49 of file MM_StripResponse.h.

◆ m_stripMaxCharge

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

Definition at line 61 of file MM_StripResponse.h.

◆ m_stripPitch

float MM_StripResponse::m_stripPitch {0.f}
private

Definition at line 48 of file MM_StripResponse.h.

◆ m_stripTimeMaxCharge

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

Definition at line 62 of file MM_StripResponse.h.

◆ m_stripTimeThreshold

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

Definition at line 59 of file MM_StripResponse.h.

◆ m_stripTotalCharge

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

Definition at line 60 of file MM_StripResponse.h.

◆ m_timeResolution

float MM_StripResponse::m_timeResolution {0.f}
private

Definition at line 47 of file MM_StripResponse.h.

◆ m_v_strip

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

Definition at line 65 of file MM_StripResponse.h.

◆ m_v_stripMaxCharge

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

Definition at line 68 of file MM_StripResponse.h.

◆ m_v_stripTimeMaxCharge

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

Definition at line 69 of file MM_StripResponse.h.

◆ m_v_stripTimeThreshold

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

Definition at line 66 of file MM_StripResponse.h.

◆ m_v_stripTotalCharge

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

Definition at line 67 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:69
MM_StripResponse::m_timeResolution
float m_timeResolution
Definition: MM_StripResponse.h:47
MM_StripResponse::m_stripPitch
float m_stripPitch
Definition: MM_StripResponse.h:48
MM_StripResponse::m_stripMaxCharge
std::map< int, float > m_stripMaxCharge
Definition: MM_StripResponse.h:61
MM_StripResponse::m_v_stripTotalCharge
std::vector< std::vector< float > > m_v_stripTotalCharge
Definition: MM_StripResponse.h:67
MM_StripResponse::m_v_stripTimeThreshold
std::vector< std::vector< float > > m_v_stripTimeThreshold
Definition: MM_StripResponse.h:66
MM_StripResponse::m_stripID
int m_stripID
Definition: MM_StripResponse.h:49
MM_StripResponse::m_minstripID
int m_minstripID
Definition: MM_StripResponse.h:50
MM_StripResponse::m_stripTotalCharge
std::map< int, float > m_stripTotalCharge
Definition: MM_StripResponse.h:60
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
checkTriggerxAOD.found
found
Definition: checkTriggerxAOD.py:328
MM_StripResponse::m_stripTimeThreshold
std::map< int, int > m_stripTimeThreshold
Definition: MM_StripResponse.h:59
a
TList * a
Definition: liststreamerinfos.cxx:10
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
MM_StripResponse::m_Electrons
std::vector< std::unique_ptr< MM_Electron > > m_Electrons
Definition: MM_StripResponse.h:53
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:51
MM_StripResponse::m_stripTimeMaxCharge
std::map< int, int > m_stripTimeMaxCharge
Definition: MM_StripResponse.h:62
MM_StripResponse::m_stripCharges
std::map< int, std::map< int, float > > m_stripCharges
Definition: MM_StripResponse.h:56
MM_StripResponse::m_v_stripMaxCharge
std::vector< float > m_v_stripMaxCharge
Definition: MM_StripResponse.h:68
MM_StripResponse::m_v_strip
std::vector< int > m_v_strip
Definition: MM_StripResponse.h:65