|
ATLAS Offline Software
|
Go to the documentation of this file.
6 #include "CLHEP/Random/RandGaussZiggurat.h"
7 #include "CLHEP/Random/RandFlat.h"
10 constexpr
double percentage(
unsigned int numerator,
unsigned int denom) {
24 return StatusCode::SUCCESS;
27 std::stringstream statstr{};
29 for (
unsigned int g = 0;
g < m_allHits.size(); ++
g) {
30 allHits += m_allHits[
g];
31 statstr<<
" *** Layer "<<(
g+1)<<
" "<<percentage(m_acceptedHits[
g],m_allHits[
g])
32 <<
"% of "<<m_allHits[
g]<<std::endl;
34 if(!allHits)
return StatusCode::SUCCESS;
35 ATH_MSG_INFO(
"Tried to convert "<<allHits<<
" hits. Successes rate per layer "<<std::endl<<statstr.str());
36 return StatusCode::SUCCESS;
54 for (
const TimedHit& simHit : viewer) {
61 const Amg::Vector2D locPos{xAOD::toEigen(simHit->localPosition()).block<2,1>(0,0)};
64 const unsigned int hitGapInNsw = (idHelper.multilayer(hitId) -1) * 4 + idHelper.gasGap(hitId) -1;
65 ++m_allHits[hitGapInNsw];
70 int channelNumber = design.stripNumber(locPos);
72 if (!design.insideTrapezoid(locPos)) {
74 <<
" is outside bounds "<<std::endl<<design<<
" rejecting it");
78 const Identifier clusId = idHelper.channelID(hitId,
79 idHelper.multilayer(hitId),
80 idHelper.gasGap(hitId),
85 <<
" channel " << channelNumber <<
" locPos " <<
Amg::toString(locPos));
89 if(efficiencyMap && efficiencyMap->getEfficiency(clusId) < CLHEP::RandFlat::shoot(rndEngine, 0., 1.)){
97 errorCalibInput.
stripId = clusId;
98 errorCalibInput.locTheta =
M_PI- simHit->localDirection().theta();
99 errorCalibInput.clusterAuthor=66;
100 const double uncert = errorCalibDB->clusterUncertainty(errorCalibInput);
106 constexpr
int dummyResponseTime = 100;
107 constexpr
float dummyDepositedCharge = 66666;
109 const double newLocalX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locPos.x(), uncert);
110 const int newChannel = design.stripNumber(newLocalX * Amg::Vector2D::UnitX());
111 if (newChannel < 0) {
115 const Identifier digitId = idHelper.channelID(hitId,
116 idHelper.multilayer(hitId),
117 idHelper.gasGap(hitId),
122 <<
" channel " << newChannel <<
" locPos " <<
Amg::toString(locPos));
147 const double pull = (newLocalX - (*design.center(newChannel)).
x()) / (design.stripPitch() *
std::cos(design.stereoAngle()));
148 const double w1 = CLHEP::RandFlat::shoot(rndEngine, 0., 0.5 *(1. -
pull));
149 const double w2 = 1 -
pull -2*w1;
150 const double w3 =
pull + w1;
153 const Identifier digitIdB = idHelper.channelID(hitId,
154 idHelper.multilayer(hitId),
155 idHelper.gasGap(hitId),
159 outColl->
push_back(std::make_unique<MmDigit>(digitIdB, dummyResponseTime, w1 * dummyDepositedCharge));
161 outColl->
push_back(std::make_unique<MmDigit>(digitId,dummyResponseTime, w2 * dummyDepositedCharge));
163 const Identifier digitIdA = idHelper.channelID(hitId,
164 idHelper.multilayer(hitId),
165 idHelper.gasGap(hitId),
168 outColl->
push_back(std::make_unique<MmDigit>(digitIdA, dummyResponseTime, w3 * dummyDepositedCharge));
173 ++m_acceptedHits[hitGapInNsw];
175 }
while(viewer.next());
178 return StatusCode::SUCCESS;
void setIdentifier(const Identifier &id)
Sets the global ATLAS identifier.
Eigen::Matrix< double, 2, 1 > Vector2D
#define ATH_MSG_VERBOSE(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
bool empty() const
Test if the key is blank.
@ u
Enums for curvilinear frames.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
::StatusCode StatusCode
StatusCode definition for legacy code.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const StripLayer & stripLayer(const Identifier &measId) const
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
const StripDesign & design() const
Returns the underlying strip design.
This header ties the generic definitions in this package.
#define ATH_MSG_WARNING(x)