|
ATLAS Offline Software
|
Go to the documentation of this file.
105 if (
detStore()->contains<MuonGM::MuonDetectorManager>(
"Muon")) {
107 ATH_MSG_DEBUG(
"Retrieved MuonGeoModelDetectorManager from StoreGate");
118 return StatusCode::FAILURE;
143 return StatusCode::SUCCESS;
147 ATH_MSG_DEBUG(
"MdtDigitizationTool::prepareEvent() called for " << nInputEvents <<
" input events");
150 m_thpcMDT = std::make_unique<TimedHitCollection<MDTSimHit>>();
152 return StatusCode::SUCCESS;
156 ATH_MSG_DEBUG(
"MdtDigitizationTool::processBunchXing() " << bunchXing);
159 TimedHitCollList hitCollList;
162 hitCollList.empty()) {
164 return StatusCode::FAILURE;
173 for (; iColl != endColl; ++iColl) {
177 ATH_MSG_DEBUG(
"MDTSimHitCollection found with " << hitCollPtr->
size() <<
" hits");
180 m_thpcMDT->insert(timeIndex, hitCollPtr);
184 return StatusCode::SUCCESS;
196 if (!hitCollection.
isValid()) {
197 ATH_MSG_ERROR(
"Could not get MDTSimHitCollection container " << hitCollection.
name() <<
" from store "
198 << hitCollection.
store());
199 return StatusCode::FAILURE;
203 m_thpcMDT = std::make_unique<TimedHitCollection<MDTSimHit>>(1);
205 ATH_MSG_DEBUG(
"MDTSimHitCollection found with " << hitCollection->
size() <<
" hits");
207 return StatusCode::SUCCESS;
211 TimedHitCollList hitCollList;
215 return StatusCode::FAILURE;
217 if (hitCollList.empty()) {
219 return StatusCode::FAILURE;
225 m_thpcMDT = std::make_unique<TimedHitCollection<MDTSimHit>>();
230 while (iColl != endColl) {
232 m_thpcMDT->insert(iColl->first, p_collection);
233 ATH_MSG_DEBUG(
"MDTSimHitCollection found with " << p_collection->
size() <<
" hits");
236 return StatusCode::SUCCESS;
242 rngWrapper->
setSeed(rngName, ctx);
252 ATH_MSG_DEBUG(
"Recorded MdtDigitContainer called " << digitContainer.
name() <<
" in store " << digitContainer.
store());
256 ATH_CHECK(sdoContainer.
record(std::make_unique<MuonSimDataCollection>()));
257 ATH_MSG_DEBUG(
"Recorded MuonSimDataCollection called " << sdoContainer.
name() <<
" in store " << sdoContainer.
store());
263 for (
size_t coll_hash = 0; coll_hash < collections.size(); ++coll_hash) {
264 if (collections[coll_hash]) {
272 while (MDTHitColl != MDTHitCollEnd) {
273 delete (*MDTHitColl);
287 ATH_MSG_DEBUG(
"Recorded MdtDigitContainer called " << digitContainer.
name() <<
" in store " << digitContainer.
store());
291 ATH_CHECK(sdoContainer.
record(std::make_unique<MuonSimDataCollection>()));
292 ATH_MSG_DEBUG(
"Recorded MuonSimDataCollection called " << sdoContainer.
name() <<
" in store " << sdoContainer.
store());
297 if (StatusCode::FAILURE ==
status) {
306 for (
size_t coll_hash = 0; coll_hash < collections.size(); ++coll_hash) {
307 if (collections[coll_hash]) {
329 return StatusCode::FAILURE;
341 createDigits(ctx, collections, sdoContainer, rndmEngine);
349 return StatusCode::SUCCESS;
354 CLHEP::HepRandomEngine* toolRndmEngine) {
358 double globalHitTime(
hitTime(phit));
364 const int id = hit.
MDTid();
386 ATH_MSG_ERROR(
"MuonGeoManager does not return valid element for given id!");
400 double saggingSign =
result.sagSign;
401 double trackingSign =
result.trackingSign;
403 double localSag =
result.localSag;
416 <<
" " << projectiveSag <<
" " <<
driftRadius <<
" " << saggingSign);
425 double qgamma = -9999.;
443 double adc = digiOutput.
adc();
456 static constexpr std::array<double, 6> param{-4.47741E-3, 1.75541E-2, -1.32913E-2, 2.57938E-3, -4.55015E-5, -1.70821E-7};
461 for (
int i = 0;
i < 6; ++
i) { deltaT += param[
i] *
std::pow(dR,
i); }
464 double referenceSag = 0.1;
468 double cosTheta = std::abs(gpos.z()) / gpos.mag();
472 double projectiveSag = localSag * cosTheta;
474 deltaT *= (projectiveSag / referenceSag);
478 deltaT = -1 * saggingSign * deltaT;
486 <<
" " << cosTheta <<
" " << localSag <<
" " << projectiveSag <<
" " << deltaT <<
" "
487 << driftTimeOriginal <<
" " <<
driftTime);
496 if (distRO < 0.)
sign = 1.;
504 ATH_MSG_VERBOSE(
"Position along wire: " << position_along_wire <<
" propagation delay: " << propagation_delay
525 bool BOL4X13 =
false;
533 double twin_sign_driftTime = 0.;
535 constexpr
double HV_delay = 6.;
536 double twin_tubeLength{0.}, twin_geo_pos_along_wire{0.},
537 twin_sign_pos_along_wire{0.}, twin_sign{-1.};
541 twin_tube =
tube + 2;
542 else if (
tube % 4 == 0 ||
tube % 4 == 3)
543 twin_tube =
tube - 2;
547 twin_tubeLength = element->
tubeLength(twin_DigitId);
550 if (distRO < 0.) twin_sign = 1.;
553 twin_sign_pos_along_wire = twin_sign * twin_geo_pos_along_wire;
554 double twin_propagation_delay = twin_sign * (1. /
m_signalSpeed) * twin_geo_pos_along_wire;
558 twin_sign_driftTime =
driftTime + twin_tubeLength /
m_signalSpeed - 2 * twin_propagation_delay + HV_delay;
561 double rand = CLHEP::RandGaussZiggurat::shoot(twinRndmEngine, twin_sign_driftTime,
m_resTwin);
562 twin_sign_driftTime =
rand;
565 << multilayer <<
" layer " <<
layer <<
" tube " <<
tube
566 <<
" signed position along wire = " << twin_sign_pos_along_wire
567 <<
" propagation delay = " << twin_propagation_delay <<
" drifttime = " <<
driftTime
568 <<
" twin_driftTime = " << twin_sign_driftTime
569 <<
" TWIN time-difference = " << (twin_sign_driftTime -
driftTime));
587 const int id = hit.
MDTid();
603 if (!readCdo.isValid()) {
607 if (!readCdo->isGood(DigitId))
return false;
611 double tubeL{0.}, tubeR{0.};
615 ATH_MSG_ERROR(
"MuonGeoManager does not return valid element for given id!");
648 CLHEP::HepRandomEngine* rndmEngine) {
649 Identifier currentDigitId{0}, currentElementId{0};
651 double currentDeadTime = 0.;
658 double timeOffsetEvent = 0.0;
659 double timeOffsetTotal = 0.0;
663 int inum = CLHEP::RandFlat::shootInt(rndmEngine, 0, 10);
665 timeOffsetEvent = -25.0;
666 }
else if (inum == 9) {
667 timeOffsetEvent = 25.0;
669 ATH_MSG_DEBUG(
"Emulating timing spead of cosmics: +/- 1 BC. Adding " << timeOffsetEvent <<
" ns to time");
674 if (!mdtCalibConstants.isValid()) {
675 ATH_MSG_FATAL(
"Failed to retrieve set of calibration constants "<<mdtCalibConstants.fullKey());
684 if (elementId != currentElementId) {
685 currentElementId = elementId;
691 timeOffsetTotal = timeOffsetEvent + CLHEP::RandFlat::shoot(rndmEngine, -12.5, 12.5);
692 ATH_MSG_DEBUG(
"Emulating time jitter of cosmic ray muons w.r.t LVL1 accept. Adding " << timeOffsetTotal <<
" ns to time");
696 if (!digitCollection) {
708 if (idDigit != currentDigitId) {
709 currentDigitId = idDigit;
734 if (insideMask && insideMatch) {
735 ATH_MSG_WARNING(
" Digit in matching AND masking window, please check window definition: relative time " << relativeTime);
738 if (insideMatch || insideMask) {
745 if (singleTubeData) {
756 <<
" driftRadius " <<
driftRadius <<
" TDC " << tdc <<
" ADC " <<
adc <<
" mask bit "
772 std::vector<MuonSimData::Deposit> deposits;
773 deposits.push_back(deposit);
779 sdoContainer->insert(std::make_pair(idDigit, tempSDO));
784 <<
" --> hit ignored");
794 if (
m_idHelperSvc->mdtIdHelper().get_hash(elementId, coll_hash, &mdtContext)) {
795 ATH_MSG_ERROR(
"Unable to get MDT hash id from MDT Digit collection "
796 <<
"context begin_index = " << mdtContext.
begin_index() <<
" context end_index = " << mdtContext.
end_index()
797 <<
" the identifier is ");
801 if (coll_hash >= collections.size()) {
802 collections.resize (coll_hash+1);
805 auto& coll = collections[coll_hash];
807 coll = std::make_unique<MdtDigitCollection>(elementId, coll_hash);
815 tdcCount = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tmpCount,
m_resTDC);
816 if (tdcCount < 0 || tdcCount > 4096) {
ATH_MSG_DEBUG(
" Count outside TDC window: " << tdcCount); }
824 double distanceToVertex(0.);
828 ATH_MSG_ERROR(
"MuonGeoManager does not return valid element for given id!");
830 distanceToVertex = element->
tubePos(DigitId).mag();
833 ATH_MSG_DEBUG(
"minimumTof calculated " << distanceToVertex * s_inv_c_light);
834 return distanceToVertex * s_inv_c_light;
887 double pointingCheck = gpos.dot(gdir) < 0 ? -1. : 1.;
888 if (pointingCheck < 0) { gdir *= pointingCheck; }
890 double trackingSign = 1.;
891 double localSag = 0.0;
898 std::unique_ptr<const Trk::StraightLineSurface> wireSurface {surface.
correctedSurface(lp)};
909 localSag = lSaggedSpot.perp();
912 gToWireFrame = wireSurface->transform().inverse();
915 lpos = gToWireFrame * gpos;
916 ldir = gToWireFrame * gdir;
920 double alpha = -1 * lpos.dot(ldir);
921 lpos = lpos + alpha * ldir;
928 wireSurface->globalToLocal(saggedGPos, gdir, lpsag);
929 trackingSign = lpsag[
Trk::locR] < 0 ? -1. : 1.;
935 trackingSign = lpsag[
Trk::locR] < 0 ? -1. : 1.;
949 double sign = lpos.dot(lgravDir) < 0 ? -1. : 1.;
951 return {
sign, trackingSign, lpos, localSag};
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
int GetMultiLayer(const int &hid) const
float t0
< relative t0 in chamber (ns)
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
char data[hepevt_bytes_allocation_ATLAS]
constexpr uint8_t stationPhi
station Phi 1 to 8
std::pair< HepMcParticleLink, MuonMCData > Deposit
virtual StraightLineSurface * correctedSurface(const Amg::Vector2D &lp) const override final
Get the NEW corrected surface - this is a factory (the user has to delete the surface)
double tubeLength(const int tubeLayer, const int tube) const
const_pointer_type cptr()
Dereference the pointer.
const Amg::Vector3D & localPosition() const
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
double innerTubeRadius() const
Returns the inner tube radius excluding the aluminium walls.
void setDriftRadius(double radius)
double particleGamma(const EventContext &ctx, const MDTSimHit &hit, unsigned short eventId=0)
Eigen::Matrix< double, 2, 1 > Vector2D
const std::string & name() const
Return the StoreGate ID for the referenced object.
void setPosition(const Amg::Vector3D &pos)
std::vector< ALFA_RawData_p1 > t0
double chargeCalculator(const EventContext &ctx, const MDTSimHit &hit, unsigned short eventId=0)
AtlasHitsVector< MDTSimHit > MDTSimHitCollection
Amg::Transform3D nodeform_localToGlobalTransf(const Identifier &id) const
size_type end_index(void) const
bool barrel() const
Returns whether the chamber is in the barrel (Assement on first later in stationName)
index_type index() const
the index of the component event in PileUpEventInfo
int GetZSector(const int &hid) const
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
static const MdtHitIdHelper * GetHelper(unsigned int nTubes=78)
const Amg::Vector3D & center() const
Returns the center position of the Surface.
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
bool empty() const
Test if the key is blank.
void setTime(const float &time)
class which holds the full set of calibration constants for a given tube
std::list< value_t > type
type of the collection of timed data object
Amg::Transform3D globalToLocalTransf(const int tubeLayer, const int tube) const
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override final
Specified for StraightLineSurface: GlobalToLocal method without dynamic memory allocation This method...
int GetPhiSector(const int &hid) const
std::string GetStationName(const int &hid) const
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
::StatusCode StatusCode
StatusCode definition for legacy code.
pointer_type ptr()
Dereference the pointer.
std::string store() const
Return the name of the store holding the object we are proxying.
Eigen::Affine3d Transform3D
void setLocalPosition(Amg::Vector3D &localPosition)
int GetLayer(const int &hid) const
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const Amg::Transform3D & localToGlobalTransf(const Identifier &id) const
void show() const
Print out in hex form.
double globalTime() const
virtual bool isValid() override final
Can the handle be successfully dereferenced?
size_type begin_index(void) const
double driftRadius() const
A wrapper class for event-slot-local random engines.
time_type time() const
bunch xing time in ns
double charge(const T &p)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
static HepMcParticleLink getRedirectedLink(const HepMcParticleLink &particleLink, uint32_t eventIndex, const EventContext &ctx)
Return a HepMcParticleLink pointing at the same particle, but in a different GenEvent.
StatusCode initialize(bool used=true)
HitVector::iterator HitIt
Eigen::Matrix< double, 3, 1 > Vector3D
std::string print() const
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Amg::Vector3D tubeFrame_localROPos(const int tubelayer, const int tube) const
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
def time(flags, cells_name, *args, **kw)
unsigned short eventId() const
the index of the component event in PileUpEventInfo.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
#define ATH_MSG_WARNING(x)
virtual const Trk::Surface & surface() const override final
Return surface associated with this detector element.
int GetTube(const int &hid) const
void insert(const mdt_hit_info &hit)
float hitTime(const AFP_SIDSimHit &hit)
constexpr uint8_t stationEta
1 to 3
a struct encapsulating the identifier of a pile-up event
PileUpType type() const
the pileup type - minbias, cavern, beam halo, signal?