|
ATLAS Offline Software
|
Go to the documentation of this file.
102 if (
detStore()->contains<MuonGM::MuonDetectorManager>(
"Muon")) {
104 ATH_MSG_DEBUG(
"Retrieved MuonGeoModelDetectorManager from StoreGate");
115 return StatusCode::FAILURE;
140 return StatusCode::SUCCESS;
144 ATH_MSG_DEBUG(
"MdtDigitizationTool::prepareEvent() called for " << nInputEvents <<
" input events");
147 m_thpcMDT = std::make_unique<TimedHitCollection<MDTSimHit>>();
149 return StatusCode::SUCCESS;
153 ATH_MSG_DEBUG(
"MdtDigitizationTool::processBunchXing() " << bunchXing);
156 TimedHitCollList hitCollList;
159 hitCollList.empty()) {
161 return StatusCode::FAILURE;
170 for (; iColl != endColl; ++iColl) {
174 ATH_MSG_DEBUG(
"MDTSimHitCollection found with " << hitCollPtr->
size() <<
" hits");
177 m_thpcMDT->insert(timeIndex, hitCollPtr);
181 return StatusCode::SUCCESS;
193 if (!hitCollection.
isValid()) {
194 ATH_MSG_ERROR(
"Could not get MDTSimHitCollection container " << hitCollection.
name() <<
" from store "
195 << hitCollection.
store());
196 return StatusCode::FAILURE;
200 m_thpcMDT = std::make_unique<TimedHitCollection<MDTSimHit>>(1);
202 ATH_MSG_DEBUG(
"MDTSimHitCollection found with " << hitCollection->
size() <<
" hits");
204 return StatusCode::SUCCESS;
208 TimedHitCollList hitCollList;
212 return StatusCode::FAILURE;
214 if (hitCollList.empty()) {
216 return StatusCode::FAILURE;
222 m_thpcMDT = std::make_unique<TimedHitCollection<MDTSimHit>>();
227 while (iColl != endColl) {
229 m_thpcMDT->insert(iColl->first, p_collection);
230 ATH_MSG_DEBUG(
"MDTSimHitCollection found with " << p_collection->
size() <<
" hits");
233 return StatusCode::SUCCESS;
239 rngWrapper->
setSeed(rngName, ctx);
249 ATH_MSG_DEBUG(
"Recorded MdtDigitContainer called " << digitContainer.
name() <<
" in store " << digitContainer.
store());
253 ATH_CHECK(sdoContainer.
record(std::make_unique<MuonSimDataCollection>()));
254 ATH_MSG_DEBUG(
"Recorded MuonSimDataCollection called " << sdoContainer.
name() <<
" in store " << sdoContainer.
store());
260 for (
size_t coll_hash = 0; coll_hash < collections.size(); ++coll_hash) {
261 if (collections[coll_hash]) {
269 while (MDTHitColl != MDTHitCollEnd) {
270 delete (*MDTHitColl);
284 ATH_MSG_DEBUG(
"Recorded MdtDigitContainer called " << digitContainer.
name() <<
" in store " << digitContainer.
store());
288 ATH_CHECK(sdoContainer.
record(std::make_unique<MuonSimDataCollection>()));
289 ATH_MSG_DEBUG(
"Recorded MuonSimDataCollection called " << sdoContainer.
name() <<
" in store " << sdoContainer.
store());
294 if (StatusCode::FAILURE ==
status) {
303 for (
size_t coll_hash = 0; coll_hash < collections.size(); ++coll_hash) {
304 if (collections[coll_hash]) {
326 return StatusCode::FAILURE;
338 createDigits(ctx, collections, sdoContainer, rndmEngine);
346 return StatusCode::SUCCESS;
351 CLHEP::HepRandomEngine* toolRndmEngine) {
355 double globalHitTime(
hitTime(phit));
361 const int id = hit.
MDTid();
383 ATH_MSG_ERROR(
"MuonGeoManager does not return valid element for given id!");
404 double qgamma = -9999.;
413 const double QE = genParticle->momentum().e();
414 const double QM2 = genParticle->momentum().m2();
416 qgamma = QE / std::sqrt(QM2);
431 double adc = digiOutput.
adc();
441 if (distRO < 0.)
sign = 1.;
449 ATH_MSG_VERBOSE(
"Position along wire: " << position_along_wire <<
" propagation delay: " << propagation_delay
470 bool BOL4X13 =
false;
478 double twin_sign_driftTime = 0.;
480 constexpr
double HV_delay = 6.;
481 double twin_tubeLength{0.}, twin_geo_pos_along_wire{0.},
482 twin_sign_pos_along_wire{0.}, twin_sign{-1.};
486 twin_tube =
tube + 2;
487 else if (
tube % 4 == 0 ||
tube % 4 == 3)
488 twin_tube =
tube - 2;
492 twin_tubeLength = element->
tubeLength(twin_DigitId);
495 if (distRO < 0.) twin_sign = 1.;
498 twin_sign_pos_along_wire = twin_sign * twin_geo_pos_along_wire;
499 double twin_propagation_delay = twin_sign * (1. /
m_signalSpeed) * twin_geo_pos_along_wire;
503 twin_sign_driftTime =
driftTime + twin_tubeLength /
m_signalSpeed - 2 * twin_propagation_delay + HV_delay;
506 double rand = CLHEP::RandGaussZiggurat::shoot(twinRndmEngine, twin_sign_driftTime,
m_resTwin);
507 twin_sign_driftTime =
rand;
510 << multilayer <<
" layer " <<
layer <<
" tube " <<
tube
511 <<
" signed position along wire = " << twin_sign_pos_along_wire
512 <<
" propagation delay = " << twin_propagation_delay <<
" drifttime = " <<
driftTime
513 <<
" twin_driftTime = " << twin_sign_driftTime
514 <<
" TWIN time-difference = " << (twin_sign_driftTime -
driftTime));
532 const int id = hit.
MDTid();
548 if (!readCdo.isValid()) {
552 if (!readCdo->isGood(DigitId))
return false;
556 double tubeL{0.}, tubeR{0.};
560 ATH_MSG_ERROR(
"MuonGeoManager does not return valid element for given id!");
593 CLHEP::HepRandomEngine* rndmEngine) {
594 Identifier currentDigitId{0}, currentElementId{0};
596 double currentDeadTime = 0.;
603 double timeOffsetEvent = 0.0;
604 double timeOffsetTotal = 0.0;
608 int inum = CLHEP::RandFlat::shootInt(rndmEngine, 0, 10);
610 timeOffsetEvent = -25.0;
611 }
else if (inum == 9) {
612 timeOffsetEvent = 25.0;
614 ATH_MSG_DEBUG(
"Emulating timing spead of cosmics: +/- 1 BC. Adding " << timeOffsetEvent <<
" ns to time");
619 if (!mdtCalibConstants.isValid()) {
620 ATH_MSG_FATAL(
"Failed to retrieve set of calibration constants "<<mdtCalibConstants.fullKey());
629 if (elementId != currentElementId) {
630 currentElementId = elementId;
636 timeOffsetTotal = timeOffsetEvent + CLHEP::RandFlat::shoot(rndmEngine, -12.5, 12.5);
637 ATH_MSG_DEBUG(
"Emulating time jitter of cosmic ray muons w.r.t LVL1 accept. Adding " << timeOffsetTotal <<
" ns to time");
641 if (!digitCollection) {
653 if (idDigit != currentDigitId) {
654 currentDigitId = idDigit;
679 if (insideMask && insideMatch) {
680 ATH_MSG_WARNING(
" Digit in matching AND masking window, please check window definition: relative time " << relativeTime);
683 if (insideMatch || insideMask) {
690 if (singleTubeData) {
701 <<
" driftRadius " <<
driftRadius <<
" TDC " << tdc <<
" ADC " <<
adc <<
" mask bit "
717 std::vector<MuonSimData::Deposit> deposits;
718 deposits.push_back(deposit);
724 sdoContainer->insert(std::make_pair(idDigit, tempSDO));
729 <<
" --> hit ignored");
739 if (
m_idHelperSvc->mdtIdHelper().get_hash(elementId, coll_hash, &mdtContext)) {
740 ATH_MSG_ERROR(
"Unable to get MDT hash id from MDT Digit collection "
741 <<
"context begin_index = " << mdtContext.
begin_index() <<
" context end_index = " << mdtContext.
end_index()
742 <<
" the identifier is ");
746 if (coll_hash >= collections.size()) {
747 collections.resize (coll_hash+1);
750 auto& coll = collections[coll_hash];
752 coll = std::make_unique<MdtDigitCollection>(elementId, coll_hash);
760 tdcCount = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tmpCount,
m_resTDC);
761 if (tdcCount < 0 || tdcCount > 4096) {
ATH_MSG_DEBUG(
" Count outside TDC window: " << tdcCount); }
769 double distanceToVertex(0.);
773 ATH_MSG_ERROR(
"MuonGeoManager does not return valid element for given id!");
775 distanceToVertex = element->
tubePos(DigitId).mag();
778 ATH_MSG_DEBUG(
"minimumTof calculated " << distanceToVertex * s_inv_c_light);
779 return distanceToVertex * s_inv_c_light;
832 double pointingCheck = gpos.dot(gdir) < 0 ? -1. : 1.;
833 if (pointingCheck < 0) { gdir *= pointingCheck; }
835 double trackingSign = 1.;
836 double localSag = 0.0;
841 trackingSign = lpsag[
Trk::locR] < 0 ? -1. : 1.;
855 double sign = lpos.dot(lgravDir) < 0 ? -1. : 1.;
857 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
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)
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)
size_type end_index() const
std::vector< ALFA_RawData_p1 > t0
AtlasHitsVector< MDTSimHit > MDTSimHitCollection
Amg::Transform3D nodeform_localToGlobalTransf(const Identifier &id) const
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)
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
bool isGenericMultichargedParticle(const T &p)
In addition, there is a need to identify ”Q-ball” and similar very exotic (multi-charged) particles w...
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...
HepMC::ConstGenParticlePtr cptr() const
Dereference.
double fractionalCharge(const T &p)
int GetPhiSector(const int &hid) const
a link optimized in size for a GenParticle in a McEventCollection
std::string GetStationName(const int &hid) const
size_type begin_index() const
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?
const GenParticle * ConstGenParticlePtr
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
const HepMcParticleLink & particleLink() 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
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
a struct encapsulating the identifier of a pile-up event
PileUpType type() const
the pileup type - minbias, cavern, beam halo, signal?
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...