|
ATLAS Offline Software
|
Go to the documentation of this file.
14 #include "CLHEP/Random/RandGauss.h"
15 #include "CLHEP/Random/RandomEngine.h"
27 const std::string&
type,
const std::string&
name,
const IInterface*
parent) :
48 m_output_file = std::make_unique<TFile>(
"HGTD_SmearedDigiOutput.root",
"RECREATE");
49 m_tree = std::make_unique<TTree>(
"SmearedDigiTree",
"SmearedDigiTree");
71 return StatusCode::SUCCESS;
85 return StatusCode::SUCCESS;
90 ATH_MSG_DEBUG(
"[HGTD_SmearedDigitizationTool::processAllSubEvents]");
92 auto cluster_container =
95 cluster_container->cleanup();
102 timed_hit_collection,
103 det_element_rio_map));
107 *cluster_container));
109 return StatusCode::SUCCESS;
122 return StatusCode::SUCCESS;
134 TimedHitCollList_t hit_coll_list;
135 unsigned int num_si_hits(0);
140 hit_coll_list.empty()) {
142 return timed_hit_coll;
145 ATH_MSG_DEBUG(hit_coll_list.size() <<
" SiHitCollections with key "
148 timed_hit_coll.
reserve(num_si_hits);
151 for(
auto hit_coll : hit_coll_list) {
153 timed_hit_coll.
insert(hit_coll.first, si_collection);
157 return timed_hit_coll;
165 ATH_MSG_DEBUG(
"--- HGTD_SmearedDigitizationTool: in digitize() ---");
170 CLHEP::HepRandomEngine* rndmEngine = rngWrapper->
getEngine(ctx);
185 int endcap = hit->getBarrelEndcap();
186 int layer = hit->getLayerDisk();
187 int phi_module = hit->getPhiModule();
188 int eta_module = hit->getEtaModule();
191 << endcap <<
", layer_disk " <<
layer <<
", phi_module "
192 << phi_module <<
", eta_module " << eta_module);
198 if (!curr_det_element) {
199 ATH_MSG_ERROR(
"could not get detector element for SolidStateDetector");
206 HepGeom::Point3D<double> hit_loc_start_pos = hit->localStartPosition();
207 HepGeom::Point3D<double> hit_loc_end_pos = hit->localEndPosition();
209 HepGeom::Point3D<double> hit_glob_start_pos =
211 HepGeom::Point3D<double> hit_glob_end_pos =
214 double globa_entry_x = hit_glob_start_pos.x();
215 double globa_entry_y = hit_glob_start_pos.y();
220 double globa_exit_x = hit_glob_end_pos.x();
221 double globa_exit_y = hit_glob_end_pos.y();
226 double dist_x = std::abs(std::abs(globa_exit_x) - std::abs(globa_entry_x));
227 double dist_y = std::abs(std::abs(globa_exit_y) - std::abs(globa_entry_y));
243 << entry_id <<
" --- exitId " << exit_id);
244 ATH_MSG_DEBUG(
"--- HGTD_SmearedDigitizationTool: entryCellId "
245 << entry_cell_id <<
" --- exitCellId " << exit_cell_id);
252 double intersection_x = 0.5 * (globa_entry_x + globa_exit_x);
253 double intersection_y = 0.5 * (globa_entry_y + globa_exit_y);
258 double times_x = floor(dist_x /
m_pitch_x);
259 double times_y = floor(dist_y /
m_pitch_y);
261 double sigma_x =
m_pitch_x / std::sqrt(12);
262 double sigma_y =
m_pitch_y / std::sqrt(12);
264 int element_x = times_x + 1;
265 int element_y = times_y + 1;
271 curr_det_element->
width() / 2.,
274 curr_det_element->
length() / 2.,
286 std::vector<Identifier> rdo_list = {intersection_id};
291 if (!current_cell_id.
isValid()) {
302 covariance.setIdentity();
307 float hit_time = hit->meanTime();
314 std::vector<int> tot_vec = {0};
317 si_width, curr_det_element, std::move(cluster_err),
330 det_element_rio_map.insert(
331 std::pair<IdentifierHash, const Cluster_t*>(wafer_id, cluster));
336 return StatusCode::SUCCESS;
340 float boundary, CLHEP::HepRandomEngine * rndmEngine) {
341 ATH_MSG_DEBUG(
"[HGTD_SmearedDigitizationTool::smearPosition] pos: "
342 <<
pos <<
" sig: " <<
sig <<
" boundary: " << boundary);
343 float smeared_pos =
pos;
344 float smear_para = 0.;
347 smear_para = CLHEP::RandGauss::shoot(rndmEngine, 0.,
sig);
349 }
while (std::abs(smeared_pos + smear_para) > boundary);
350 smeared_pos += smear_para;
356 return time + CLHEP::RandGauss::shoot(rndmEngine, 0., time_res);
364 << *cluster <<
" and link = " << trk_link);
368 map->insert(std::make_pair(cluster->
identify(), trk_link));
372 return StatusCode::SUCCESS;
378 "--- HGTD_SmearedDigitizationTool: in fillClusterContainer() ---");
384 for (;
i !=
e;
i = det_element_rio_map.upper_bound(
i->first)) {
386 std::pair<RIO_map_t::iterator, RIO_map_t::iterator>
range;
387 range = det_element_rio_map.equal_range(
i->first);
403 cluster_coll->
size());
409 ATH_MSG_WARNING(
"Could not add collection to Identifiable container!");
413 return StatusCode::SUCCESS;
HepGeom::Point3D< double > hitLocalToLocal3D(const HepGeom::Point3D< double > &hitPosition) const
Same as previuos method but 3D.
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
Identifier identifierOfPosition(const Amg::Vector2D &localPos) const
Full identifier of the cell for a given position: assumes a raw local position (no Lorentz shift)
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
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,...
Eigen::Matrix< double, 2, 1 > Vector2D
A PRD is mapped onto all contributing particles.
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
bool isValid() const
Test if its in a valid state.
virtual const Amg::Vector3D & globalPosition() const
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
bool nextDetectorElement(const_iterator &b, const_iterator &e)
sets an iterator range with the hits of current detector element returns a bool when done
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
#define AmgSymMatrix(dim)
std::list< value_t > type
type of the collection of timed data object
a link optimized in size for a GenParticle in a McEventCollection
void insert(const PileUpTimeEventIndex &timeEventIndex, const AtlasHitsVector< HIT > *inputCollection)
void reserve(unsigned int numberOfHits)
reserve a timed vector numberOfHits in size.
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
TEMP for testing: might make some classes friends later ...
::StatusCode StatusCode
StatusCode definition for legacy code.
virtual IdentifierHash identifyHash() const override final
double width() const
Methods from design (inline)
bool isValid() const
Validity check.
Identifier identify() const
return the identifier
size_type wafer_hash_max(void) const
A wrapper class for event-slot-local random engines.
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
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.
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
InDetDD::HGTD_DetectorElement * getDetectorElement(const Identifier &id) const
access to individual elements : via Identifier
def time(flags, cells_name, *args, **kw)
unsigned short eventId() const
the index of the component event in PileUpEventInfo.
#define ATH_MSG_WARNING(x)
double length() const
Length in eta direction (z - barrel, r - endcap)
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
size_type size() const noexcept
Returns the number of elements in the collection.
virtual SiCellId cellIdFromIdentifier(const Identifier &identifier) const =0
SiCellId from Identifier.
virtual Identifier identify() const override final
identifier of this detector element (inline)
void setIdentifier(Identifier id)