 |
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);
432 double adc = digiOutput.
adc();
442 if (distRO < 0.)
sign = 1.;
450 ATH_MSG_VERBOSE(
"Position along wire: " << position_along_wire <<
" propagation delay: " << propagation_delay
471 bool BOL4X13 =
false;
479 double twin_sign_driftTime = 0.;
481 constexpr
double HV_delay = 6.;
482 double twin_tubeLength{0.}, twin_geo_pos_along_wire{0.},
483 twin_sign_pos_along_wire{0.}, twin_sign{-1.};
487 twin_tube =
tube + 2;
488 else if (
tube % 4 == 0 ||
tube % 4 == 3)
489 twin_tube =
tube - 2;
493 twin_tubeLength = element->
tubeLength(twin_DigitId);
496 if (distRO < 0.) twin_sign = 1.;
499 twin_sign_pos_along_wire = twin_sign * twin_geo_pos_along_wire;
500 double twin_propagation_delay = twin_sign * (1. /
m_signalSpeed) * twin_geo_pos_along_wire;
504 twin_sign_driftTime =
driftTime + twin_tubeLength /
m_signalSpeed - 2 * twin_propagation_delay + HV_delay;
507 double rand = CLHEP::RandGaussZiggurat::shoot(twinRndmEngine, twin_sign_driftTime,
m_resTwin);
508 twin_sign_driftTime =
rand;
511 << multilayer <<
" layer " <<
layer <<
" tube " <<
tube
512 <<
" signed position along wire = " << twin_sign_pos_along_wire
513 <<
" propagation delay = " << twin_propagation_delay <<
" drifttime = " <<
driftTime
514 <<
" twin_driftTime = " << twin_sign_driftTime
515 <<
" TWIN time-difference = " << (twin_sign_driftTime -
driftTime));
533 const int id = hit.
MDTid();
549 if (!readCdo.isValid()) {
553 if (!readCdo->isGood(DigitId))
return false;
557 double tubeL{0.}, tubeR{0.};
561 ATH_MSG_ERROR(
"MuonGeoManager does not return valid element for given id!");
594 CLHEP::HepRandomEngine* rndmEngine) {
595 Identifier currentDigitId{0}, currentElementId{0};
597 double currentDeadTime = 0.;
604 double timeOffsetEvent = 0.0;
605 double timeOffsetTotal = 0.0;
609 int inum = CLHEP::RandFlat::shootInt(rndmEngine, 0, 10);
611 timeOffsetEvent = -25.0;
612 }
else if (inum == 9) {
613 timeOffsetEvent = 25.0;
615 ATH_MSG_DEBUG(
"Emulating timing spead of cosmics: +/- 1 BC. Adding " << timeOffsetEvent <<
" ns to time");
620 if (!mdtCalibConstants.isValid()) {
621 ATH_MSG_FATAL(
"Failed to retrieve set of calibration constants "<<mdtCalibConstants.fullKey());
630 if (elementId != currentElementId) {
631 currentElementId = elementId;
637 timeOffsetTotal = timeOffsetEvent + CLHEP::RandFlat::shoot(rndmEngine, -12.5, 12.5);
638 ATH_MSG_DEBUG(
"Emulating time jitter of cosmic ray muons w.r.t LVL1 accept. Adding " << timeOffsetTotal <<
" ns to time");
642 if (!digitCollection) {
654 if (idDigit != currentDigitId) {
655 currentDigitId = idDigit;
680 if (insideMask && insideMatch) {
681 ATH_MSG_WARNING(
" Digit in matching AND masking window, please check window definition: relative time " << relativeTime);
684 if (insideMatch || insideMask) {
691 if (singleTubeData) {
702 <<
" driftRadius " <<
driftRadius <<
" TDC " << tdc <<
" ADC " <<
adc <<
" mask bit "
718 std::vector<MuonSimData::Deposit> deposits;
719 deposits.push_back(deposit);
725 sdoContainer->insert(std::make_pair(idDigit, tempSDO));
730 <<
" --> hit ignored");
740 if (
m_idHelperSvc->mdtIdHelper().get_hash(elementId, coll_hash, &mdtContext)) {
741 ATH_MSG_ERROR(
"Unable to get MDT hash id from MDT Digit collection "
742 <<
"context begin_index = " << mdtContext.
begin_index() <<
" context end_index = " << mdtContext.
end_index()
743 <<
" the identifier is ");
747 if (coll_hash >= collections.size()) {
748 collections.resize (coll_hash+1);
751 auto& coll = collections[coll_hash];
753 coll = std::make_unique<MdtDigitCollection>(elementId, coll_hash);
761 tdcCount = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tmpCount,
m_resTDC);
762 if (tdcCount < 0 || tdcCount > 4096) {
ATH_MSG_DEBUG(
" Count outside TDC window: " << tdcCount); }
770 double distanceToVertex(0.);
774 ATH_MSG_ERROR(
"MuonGeoManager does not return valid element for given id!");
776 distanceToVertex = element->
tubePos(DigitId).mag();
779 ATH_MSG_DEBUG(
"minimumTof calculated " << distanceToVertex * s_inv_c_light);
780 return distanceToVertex * s_inv_c_light;
833 double pointingCheck = gpos.dot(gdir) < 0 ? -1. : 1.;
834 if (pointingCheck < 0) { gdir *= pointingCheck; }
836 double trackingSign = 1.;
837 double localSag = 0.0;
842 trackingSign = lpsag[
Trk::locR] < 0 ? -1. : 1.;
856 double sign = lpos.dot(lgravDir) < 0 ? -1. : 1.;
858 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)
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.
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
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...