 |
ATLAS Offline Software
|
Go to the documentation of this file.
7 #include "CLHEP/Random/RandGaussZiggurat.h"
8 #include "CLHEP/Random/RandFlat.h"
11 constexpr
double percentage(
unsigned int numerator,
unsigned int denom) {
25 return StatusCode::SUCCESS;
28 std::stringstream statstr{};
30 for (
unsigned int g = 0;
g < m_allHits.size(); ++
g) {
31 allHits += m_allHits[
g];
32 statstr<<
" *** Layer "<<(
g+1)<<
" "<<percentage(m_acceptedHits[
g],m_allHits[
g])
33 <<
"% of "<<m_allHits[
g]<<std::endl;
35 if(!allHits)
return StatusCode::SUCCESS;
36 ATH_MSG_INFO(
"Tried to convert "<<allHits<<
" hits. Successes rate per layer "<<std::endl<<statstr.str());
37 return StatusCode::SUCCESS;
55 for (
const TimedHit& simHit : viewer) {
60 const double hitKineticEnergy = simHit->kineticEnergy();
71 const Amg::Vector2D locPos{xAOD::toEigen(simHit->localPosition()).block<2,1>(0,0)};
74 const unsigned int hitGapInNsw = (idHelper.multilayer(hitId) -1) * 4 + idHelper.gasGap(hitId) -1;
75 ++m_allHits[hitGapInNsw];
80 int channelNumber = design.stripNumber(locPos);
82 if (!design.insideTrapezoid(locPos)) {
84 <<
" is outside bounds "<<std::endl<<design<<
" rejecting it");
88 const Identifier clusId = idHelper.channelID(hitId,
89 idHelper.multilayer(hitId),
90 idHelper.gasGap(hitId),
95 <<
" channel " << channelNumber <<
" locPos " <<
Amg::toString(locPos));
99 if(efficiencyMap && efficiencyMap->getEfficiency(clusId) < CLHEP::RandFlat::shoot(rndEngine, 0., 1.)){
107 errorCalibInput.
stripId = clusId;
108 errorCalibInput.locTheta =
M_PI- simHit->localDirection().theta();
109 errorCalibInput.clusterAuthor=66;
110 const double uncert = errorCalibDB->clusterUncertainty(errorCalibInput);
116 constexpr
int dummyResponseTime = 100;
117 constexpr
float dummyDepositedCharge = 666666;
119 const double newLocalX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locPos.x(), uncert);
120 const int newChannel = design.stripNumber(newLocalX * Amg::Vector2D::UnitX());
121 if (newChannel < 0) {
125 const Identifier digitId = idHelper.channelID(hitId,
126 idHelper.multilayer(hitId),
127 idHelper.gasGap(hitId),
132 <<
" channel " << newChannel <<
" locPos " <<
Amg::toString(locPos));
157 const double pull = (newLocalX - (*design.center(newChannel)).
x()) / (design.stripPitch() *
std::cos(design.stereoAngle()));
158 const double w1 = CLHEP::RandFlat::shoot(rndEngine, 0., 0.5 *(1. -
pull));
159 const double w2 = 1 -
pull -2*w1;
160 const double w3 =
pull + w1;
163 const Identifier digitIdB = idHelper.channelID(hitId,
164 idHelper.multilayer(hitId),
165 idHelper.gasGap(hitId),
169 outColl->
push_back(std::make_unique<MmDigit>(digitIdB, dummyResponseTime, w1 * dummyDepositedCharge));
171 outColl->
push_back(std::make_unique<MmDigit>(digitId,dummyResponseTime, w2 * dummyDepositedCharge));
173 const Identifier digitIdA = idHelper.channelID(hitId,
174 idHelper.multilayer(hitId),
175 idHelper.gasGap(hitId),
178 outColl->
push_back(std::make_unique<MmDigit>(digitIdA, dummyResponseTime, w3 * dummyDepositedCharge));
183 ++m_acceptedHits[hitGapInNsw];
185 }
while(viewer.next());
188 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.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
::StatusCode StatusCode
StatusCode definition for legacy code.
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const StripDesign & design(bool phiView=false) const
Returns the underlying strip design.
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)
This header ties the generic definitions in this package.
#define ATH_MSG_WARNING(x)