33#include "CLHEP/Random/RandLandau.h"
34#include "CLHEP/Random/RandGaussZiggurat.h"
45 const IInterface* p ) :
49 m_measTool(
"Muon::MuonTGMeasurementTool/MuonTGMeasurementTool"),
77 declareProperty(
"MeasurementTool",
m_measTool);
80 declareProperty(
"RandomNumberService",
m_randomSvc,
"Random number generator");
81 declareProperty(
"RandomStreamName",
m_randomEngineName,
"Name of the random number stream");
122 return StatusCode::FAILURE;
135 ATH_MSG_INFO(
"Processing configuration for layouts with BMG chambers.");
139 for(
int side=-1; side<2; side+=2) {
141 for(
int roe=1; roe<= ((
m_muonMgr->getMuonStation(
"BMG", side*
eta,
phi) )->nMuonReadoutElements()); roe++) {
152 return StatusCode::SUCCESS;
159 if ( inc.type() == IncidentType::BeginEvent ){
235 const std::vector<Trk::HitInfo>& hits)
const {
238 std::vector<Trk::HitInfo>::const_iterator plIter = hits.begin();
239 std::vector<Trk::HitInfo>::const_iterator plIterEnd = hits.end();
240 for ( ; plIter != plIterEnd; ++plIter ){
243 double timeInfo = (*plIter).time;
246 if (!currLay)
continue;
256 double mom = parm->
momentum().mag();
257 double mass = isp.
mass();
258 double eKin = sqrt( mom*mom+mass*mass) - mass;
260 double energyDeposit = 1.;
265 float segLengthSTGC = 2.85/cosAngle;
267 const Amg::Vector3D& entryPos(pos - 0.5*segLengthSTGC*unitMom);
268 const Amg::Vector3D& exitPos(pos + 0.5*segLengthSTGC*unitMom);
276 energyDeposit, partLink) ;
280 isp.
pdgCode(), unitMom, energyDeposit,
281 partLink, eKin, entryPos);
293 bool hitCreated =
createHit(isp, currLay,parm,hid,timeInfo,pitch,
true);
297 if (!mdtROE)
continue;
302 while (tCur+next>0) {
310 hitCreated =
createHit(isp, currLay,parm,nextId,timeInfo,pitch,
true);
311 if (!hitCreated)
break;
315 while (tCur+next <= tMax) {
323 hitCreated =
createHit(isp, currLay,parm,nextId,timeInfo,pitch,
true);
324 if (!hitCreated)
break;
337 hid =
m_measTool->nearestDetEl(currLay,parm,
true,pitch);
357 ATH_MSG_VERBOSE(
"[ muhit ] Creating MDTSimHit with identifier " << simId );
363 if( std::find( (myIt->second).begin(), (myIt->second).end(),
id) != (myIt->second).end() ) {
372 double residual =
m_measTool->residual(lay,parm,
id);
373 if (std::abs(residual)<15.075) {
375 double dlh = sqrt(15.075*15.075-residual*residual);
376 double de = 0.02*dlh/15.075;
377 double energyDeposit= de + 0.005*CLHEP::RandGaussZiggurat::shoot(
m_randomEngine);
378 while (energyDeposit<0.) energyDeposit= de + 0.005*CLHEP::RandGaussZiggurat::shoot(
m_randomEngine);
402 ATH_MSG_VERBOSE(
"[ muhit ] Creating RPCSimHit with identifier " << simId );
404 double energyDeposit= 1.5e-03 + 3.9e-04*CLHEP::RandLandau::shoot(
m_randomEngine);
405 while (energyDeposit<0.) energyDeposit= 1.5e-03 + 3.9e-04*CLHEP::RandLandau::shoot(
m_randomEngine);
424 ATH_MSG_VERBOSE(
"[ muhit ] Creating TGCSimHit with identifier " << simId );
427 double energyDeposit= 1.3e-03 + 6.e-04*CLHEP::RandGaussZiggurat::shoot(
m_randomEngine);
428 while (energyDeposit<0.) energyDeposit= 1.3e-03 + 6.e-04*CLHEP::RandGaussZiggurat::shoot(
m_randomEngine);
429 double stepLength=3.;
435 m_tgcSimHitCollection->Emplace(simId,globalTimeEstimate, localPos, localDir, partLink, energyDeposit, stepLength ) ;
442 float energyDeposit= 0.24e-03 + 1.1e-03*CLHEP::RandGaussZiggurat::shoot(
m_randomEngine);
443 while (energyDeposit<0.) energyDeposit= 0.24e-03 + 1.1e-03*CLHEP::RandGaussZiggurat::shoot(
m_randomEngine);
446 float hitlength = 5./cs;
459 if (pdgcode == 22) lundcode=1;
460 else if (pdgcode == 13 ) lundcode=6;
461 else if (pdgcode == -13) lundcode=5;
469 ATH_MSG_VERBOSE(
"[ muhit ] Creating CSCSimHit with identifier " << simId );
475 const double kineticEnergy{-1.};
476 m_cscSimHitCollection->Emplace(simId,globalTimeEstimate,energyDeposit, hitStart, hitEnd, lundcode, partLink, kineticEnergy ) ;
491 if ( check_id !=
id ) {
507 if ( check_id !=
id ) {
522 PVConstLink cv = mydetEl->getMaterialGeom();
523 int nGrandchildren = cv->getNChildVols();
524 if(nGrandchildren <= 0)
return;
528 int name =
m_idHelperSvc->mdtIdHelper().stationName(detElId);
532 std::vector<Identifier> deadTubes;
534 for(
int layer = 1; layer <= mydetEl->
getNLayers(); layer++){
536 bool tubefound =
false;
537 for(
unsigned int kk=0; kk < cv->getNChildVols(); kk++) {
538 int tubegeo = cv->getIdOfChildVol(kk).value() % maxNTubesPerLayer;
539 int layergeo = ( cv->getIdOfChildVol(kk).value() - tubegeo ) / maxNTubesPerLayer;
540 if( tubegeo == tube && layergeo == layer ) {
544 if( layergeo > layer )
break;
548 deadTubes.push_back( deadTubeId );
550 <<
"), phi(" <<
phi <<
"), eta(" <<
eta <<
"), name(" << name
551 <<
"), multilayerId(" << ml <<
") and identifier " << deadTubeId <<
" .");
555 std::sort(deadTubes.begin(), deadTubes.end());
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
AtlasHitsVector< CSCSimHit > CSCSimHitCollection
AtlasHitsVector< MDTSimHit > MDTSimHitCollection
AtlasHitsVector< MMSimHit > MMSimHitCollection
AtlasHitsVector< RPCSimHit > RPCSimHitCollection
AtlasHitsVector< TGCSimHit > TGCSimHitCollection
static const CscHitIdHelper * GetHelper()
a link optimized in size for a GenParticle in a McEventCollection
The generic ISF particle definition,.
const Amg::Vector3D & momentum() const
The current momentum vector of the ISFParticle.
int pdgCode() const
PDG value.
double mass() const
mass of the particle
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
static const MdtHitIdHelper * GetHelper(unsigned int nTubes=78)
static constexpr int maxNTubesPerLayer
The maxNTubesPerLayer represents the absolute maximum of tubes which are built into a single multilay...
int getNLayers() const
Returns the number of tube layers inside the multilayer.
int getNtubesperlayer() const
Returns the number of tubes in each tube layer.
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
static const RpcHitIdHelper * GetHelper(unsigned int nGasGaps=2)
static const TgcHitIdHelper * GetHelper()
Base Class for a Detector Layer in the Tracking realm.
int layerType() const
get the Layer coding
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
ToolHandle< Trk::ITimedExtrapolator > m_extrapolator
Tool using the track creator per event.
ToolHandle< Muon::IMuonTGMeasTool > m_measTool
Muon TrackingGeometry Measurement Tool.
const CscHitIdHelper * m_cscHitIdHelper
const MdtHitIdHelper * m_mdtHitIdHelper
int offIdToSimId(Identifier id) const
void initDeadChannels(const MuonGM::MdtReadoutElement *mydetEl)
ServiceHandle< IIncidentSvc > m_incidentSvc
Incident Service.
const RpcHitIdHelper * m_rpcHitIdHelper
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
CSCSimHitCollection * m_cscSimHitCollection
void handle(const Incident &inc)
handle for incident service
SimHitCreatorMS(const std::string &, const std::string &, const IInterface *)
std::map< Identifier, std::vector< Identifier > > m_DeadChannels
MMSimHitCollection * m_mmSimHitCollection
std::string m_rpcCollectionName
RPCSimHitCollection * m_rpcSimHitCollection
const MuonGM::MuonDetectorManager * m_muonMgr
bool createHit(const ISF::ISFParticle &isp, const Trk::Layer *, const Trk::TrackParameters *, Identifier, double, double, bool) const
Private HitCreate method - returns bool for a successful hit creation.
void createHits(const ISF::ISFParticle &isp, const std::vector< Trk::HitInfo > &hits) const
Loop over the hits and call the hit creator - also provide the ISF particle to register the truth lin...
ServiceHandle< IAtRndmGenSvc > m_randomSvc
Pointer to the random number generator service.
const TgcHitIdHelper * m_tgcHitIdHelper
MM_SimIdToOfflineId * m_mmOffToSimId
MDTSimHitCollection * m_mdtSimHitCollection
sTgcSimIdToOfflineId * m_stgcOffToSimId
sTGCSimHitCollection * m_stgcSimHitCollection
double m_mdtSigmaDriftRadius
std::string m_cscCollectionName
virtual StatusCode initialize()
std::string m_randomEngineName
Name of the random number stream.
std::string m_mmCollectionName
TGCSimHitCollection * m_tgcSimHitCollection
CLHEP::HepRandomEngine * m_randomEngine
Random Engine.
std::string m_stgcCollectionName
std::string m_tgcCollectionName
std::string m_mdtCollectionName
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D
ParametersBase< TrackParametersDim, Charged > TrackParameters
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
AtlasHitsVector< sTGCSimHit > sTGCSimHitCollection