ATLAS Offline Software
PadTdsOfflineTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "GaudiKernel/ConcurrencyFlags.h"
6 
8 
9 namespace NSWL1 {
10 
11  class PadHits {
12  public:
14  std::shared_ptr<PadOfflineData> t_pad;
16 
17  PadHits(Identifier id, std::shared_ptr<PadOfflineData> p, int c)
18  : t_id (id),
19  t_pad (std::move(p)),
21  { }
22  };
23 
24 
25  bool order_padHits_with_increasing_time(const PadHits& i, const PadHits& j) { return i.t_pad->time() < j.t_pad->time(); }
26 
27  using PAD_MAP=std::map < Identifier,std::vector<PadHits> >;
28  using PAD_MAP_IT=std::map < Identifier,std::vector<PadHits> >::iterator;
29  using PAD_MAP_ITEM=std::pair< Identifier,std::vector<PadHits> >;
30 
31  //------------------------------------------------------------------------------
32  PadTdsOfflineTool::PadTdsOfflineTool( const std::string& type, const std::string& name, const IInterface* parent) :
34  m_detManager(0)
35  {
36  declareInterface<NSWL1::IPadTdsTool>(this);
37  }
38  //------------------------------------------------------------------------------
40  ATH_MSG_DEBUG( "initializing " << name() );
41 
42  ATH_MSG_DEBUG( name() << " configuration:");
43  ATH_MSG_DEBUG(" " << std::setw(32) << std::setfill('.') << std::setiosflags(std::ios::left) << m_rndmEngineName.name() << m_rndmEngineName.value());
44  ATH_MSG_DEBUG(" " << std::setw(32) << std::setfill('.') << std::setiosflags(std::ios::left) << m_triggerCaptureWindow.name() << m_triggerCaptureWindow.value());
45  ATH_MSG_DEBUG(" " << std::setw(32) << std::setfill('.') << std::setiosflags(std::ios::left) << m_timeJitter.name() << m_timeJitter.value());
46  ATH_MSG_DEBUG(" " << std::setw(32) << std::setfill('.') << std::setiosflags(std::ios::left) << m_vmmTimeOverThreshold.name() << m_vmmTimeOverThreshold.value());
47  ATH_MSG_DEBUG(" " << std::setw(32) << std::setfill('.') << std::setiosflags(std::ios::left) << m_vmmShapingTime.name() << m_vmmShapingTime.value());
48  ATH_MSG_DEBUG(" " << std::setw(32) << std::setfill('.') << std::setiosflags(std::ios::left) << m_vmmDeadTime.name() << m_vmmDeadTime.value());
49  ATH_MSG_DEBUG(" " << std::setw(32) << std::setfill('.') << std::setiosflags(std::ios::left) << m_doNtuple.name() << ((m_doNtuple)? "[True]":"[False]")<< std::setfill(' ') << std::setiosflags(std::ios::right) );
50 
53 
54  const IInterface* parent = this->parent();
55  const INamedInterface* pnamed = dynamic_cast<const INamedInterface*>(parent);
56  const std::string& algo_name = pnamed->name();
57 
58  if ( m_doNtuple ) {
59  if (Gaudi::Concurrency::ConcurrencyFlags::numConcurrentEvents() > 1) {
60  ATH_MSG_ERROR("DoNtuple is not possible in multi-threaded mode");
61  return StatusCode::FAILURE;
62  }
63  m_validation_tree = std::make_unique<PadTdsValidationTree>();
64 
65  ATH_CHECK( m_incidentSvc.retrieve() );
66  m_incidentSvc->addListener(this,IncidentType::BeginEvent);
67 
68  if ( algo_name=="NSWL1Simulation" ) {
69  ITHistSvc* tHistSvc=nullptr;
70  ATH_CHECK(service("THistSvc", tHistSvc));
71 
72  TTree *tree = nullptr;
73  std::string treename = algo_name+"Tree";
74  ATH_CHECK(tHistSvc->getTree(treename, tree));
75  m_validation_tree->init_tree(tree);
76  }
77  }
78 
79  // retrieve the MuonDetectormanager
81 
82  // retrieve the Random Service
83  ATH_CHECK( m_rndmSvc.retrieve() );
84 
85  // retrieve the idHelper Service
86  ATH_CHECK(m_idHelperSvc.retrieve());
87 
88  return StatusCode::SUCCESS;
89  }
90  //------------------------------------------------------------------------------
91  void PadTdsOfflineTool::handle(const Incident& inc) {
92  if( inc.type()==IncidentType::BeginEvent ) {
93  if( m_doNtuple ) {
94  // Ntuple can only be enabled in single-threaded mode (see initialize)
95  [[maybe_unused]] bool success ATLAS_THREAD_SAFE = m_validation_tree->reset_ntuple_variables();
96  }
97  }
98  }
99  //------------------------------------------------------------------------------
101 
106  {
107  double localPosX(d.second.firstEntry()), localPosY(d.second.secondEntry());
108  Amg::Vector2D localPos(localPosX, localPosY);
109  Amg::Vector3D globalPos{Amg::Vector3D::Zero()};
110  s.localToGlobal(localPos, globalPos, globalPos);
111  return globalPos;
112  }
113  //------------------------------------------------------------------------------
114  StatusCode PadTdsOfflineTool::fill_pad_validation_id ATLAS_NOT_THREAD_SAFE (std::vector< std::vector<std::shared_ptr<PadData>> > &pad_cache) const {
115  float bin_offset = +0.; // used to center the bin on the value of the Pad Id
116  for (const std::vector<std::shared_ptr<PadData>>& pad : pad_cache) {
117  m_validation_tree->fill_num_pad_hits(pad.size());
118  for (const std::shared_ptr<PadData> &pd : pad) {
119  Identifier Id( pd->id() );
120  const MuonGM::sTgcReadoutElement* rdoEl = m_detManager->getsTgcReadoutElement(Id);
121  const Trk::PlaneSurface &surface = rdoEl->surface(Id);
122  // gathers the readout element associated to this PAD + the PAD Local/Global psoition
125  rdoEl->stripPosition(Id,pad_lpos); // shouldn't this be padPosition? DG 2014-01-17
126  surface.localToGlobal(pad_lpos, pad_gpos, pad_gpos);
127  ATH_MSG_DEBUG("Pad at GposX " << pad_gpos.x() << " GposY " << pad_gpos.y() << " GposZ " << pad_gpos.z()
128  <<" from multiplet "<< pd->multipletId()<<" and gasGapId "<<pd->gasGapId() );
129 
130  std::vector<MuonSimData::Deposit> deposits;
131  if(get_truth_hits_this_pad(Id, deposits)){
132  for(const auto& d : deposits) {
133  m_validation_tree->fill_truth_hit_global_pos(local_position_to_global_position(d, surface));
134  }
135  }
136 
137  // Fill Pad Corners
138  std::array<Amg::Vector2D, 4> local_pad_corners{make_array<Amg::Vector2D, 4>(Amg::Vector2D::Zero())};
139  rdoEl->padCorners(Id,local_pad_corners);
140  std::vector<Amg::Vector3D> global_pad_corners;
141  for(const auto& local_corner : local_pad_corners) {
142  Amg::Vector3D global_corner{Amg::Vector3D::Zero()};
143  surface.localToGlobal(local_corner, global_corner, global_corner);
144  global_pad_corners.push_back(global_corner);
145  }
146  m_validation_tree->fill_hit_global_corner_pos(global_pad_corners);
147 
148  // gathers the Offline PAD EDM from the interface
149  PadOfflineData* pad_offline = dynamic_cast<PadOfflineData*>( pd.get() );
150  m_validation_tree->fill_hit_global_pos(pad_gpos);
151  m_validation_tree->fill_offlineid_info(*pad_offline, bin_offset);
152  }
153  }
154  return StatusCode::SUCCESS;
155  }
156  //------------------------------------------------------------------------------
157  StatusCode PadTdsOfflineTool::gather_pad_data(std::vector<std::shared_ptr<PadData>>& pads, int side, int sector) const {
158  ATH_MSG_DEBUG( "gather_pad_data: start gathering the PAD hits for side " << side << ", sector " << sector );
159  // check side and sector parameters
160  if ( side <-1 || side >1 ) {
161  ATH_MSG_ERROR( "requested side " << side << " is out of range: [-1==All, 0==side C, 1==side A]");
162  return StatusCode::FAILURE;
163  }
164 
165  if ( sector <-1 || sector >15 ) {
166  ATH_MSG_ERROR( "requested sector " << sector << " is out of range: [-1==All, 0 - 15]");
167  return StatusCode::FAILURE;
168  }
169 
170  std::vector< std::vector<std::shared_ptr<PadData>> > pad_cache(PadTdsOfflineTool::numberOfSectors());
171  ATH_CHECK(fill_pad_cache(pad_cache));
172  if(m_doNtuple) {
173  // Ntuple can only be enabled in single-threaded mode (see initialize)
174  StatusCode sc ATLAS_THREAD_SAFE = this->fill_pad_validation_id(pad_cache);
175  ATH_CHECK( sc );
176  }
177 
178  // delivering the required collection
179  const bool anySide = (side==-1);
180  const bool anySector = (sector==-1);
181  if (anySide && anySector) {
182  //return the full set
183  ATH_MSG_DEBUG( "copying the full PAD hit set" );
185  std::vector<std::shared_ptr<PadData>>& pad_sec = pad_cache.at(i);
186  pads.insert( pads.end(), std::make_move_iterator(pad_sec.begin()), std::make_move_iterator(pad_sec.end()));
187  }
188  }
189  else if (anySector and not anySide) {
190  //return all the trigger sectors for the given side
191  ATH_MSG_DEBUG( "copying the PAD hit set of all trigger sector in side " << PadTdsOfflineTool::sideLabel(side) );
192  unsigned int start = PadTdsOfflineTool::firstSector(side);
193  unsigned int stop = PadTdsOfflineTool::lastSector(side);
194  for (size_t i=start; i<stop; i++) {
195  std::vector<std::shared_ptr<PadData>>& pad_sec = pad_cache.at(i);
196  pads.insert( pads.end(), std::make_move_iterator(pad_sec.begin()), std::make_move_iterator(pad_sec.end()));
197  }
198  }
199  else if (anySide and not anySector) {
200  // return the required trigger sectors
201  ATH_MSG_DEBUG( "copying the PAD hit set of all trigger sector " << sector << " in both side" );
202  size_t sectorA = sector+PadTdsOfflineTool::firstSectorAside();
203  std::vector<std::shared_ptr<PadData>>& pad_secA = pad_cache.at(sectorA);
204  pads.insert( pads.end(), std::make_move_iterator(pad_secA.begin()), std::make_move_iterator(pad_secA.end()));
205 
206  size_t sectorC = sector+PadTdsOfflineTool::firstSectorCside();
207  std::vector<std::shared_ptr<PadData>>& pad_secC = pad_cache.at(sectorC);
208  pads.insert( pads.end(), std::make_move_iterator(pad_secC.begin()), std::make_move_iterator(pad_secC.end()));
209  }
210  else {
211  // return the required trigger sector
212  ATH_MSG_DEBUG("copying the PAD hit set of all trigger sector "<<sector
213  <<" in side "<<PadTdsOfflineTool::sideLabel(side));
214  size_t sectorAorC = PadTdsOfflineTool::sectorIndex(side, sector);
215  std::vector<std::shared_ptr<PadData>>& pad_secAorC = pad_cache.at(sectorAorC);
216  pads.insert( pads.end(), std::make_move_iterator(pad_secAorC.begin()), std::make_move_iterator(pad_secAorC.end()));
217  }
218  ATH_MSG_DEBUG( "delivered n. " << pads.size() << " PAD hits." );
219  pad_cache.clear();
220  return StatusCode::SUCCESS;
221  }
222  //------------------------------------------------------------------------------
223  StatusCode PadTdsOfflineTool::fill_pad_cache(std::vector< std::vector<std::shared_ptr<PadData>> > &pad_cache) const {
225  if(!digit_container.isValid()){
226  ATH_MSG_ERROR("could not retrieve the sTGC Digit container: cannot return the STRIP hits");
227  return StatusCode::FAILURE;
228  }
229 
230  sTgcDigitContainer::const_iterator it = digit_container->begin();
231  sTgcDigitContainer::const_iterator it_e = digit_container->end();
232  ATH_MSG_DEBUG("retrieved sTGC Digit Container with size "<<digit_container->digit_size());
233 
234  //int pad_hit_number = 0;
235  std::vector<PadHits> pad_hits;
236  uint16_t BC0 = 0, BCP1 = 1, BCP2 = 2, BCP3 = 3, BCP4 = 4, BCM1 = ~BCP1, BCM2 = ~BCP2, BCM3 = ~BCP3;
237  std::vector<uint16_t> bcWindow={BC0, BCP1, BCP2, BCP3, BCP4, BCM1, BCM2, BCM3};
238 
239  for(; it!=it_e; ++it) {
240  const sTgcDigitCollection* coll = *it;
241  ATH_MSG_DEBUG( "processing collection with size " << coll->size() );
242  for (unsigned int item=0; item<coll->size(); item++) {
243  const sTgcDigit* digit = coll->at(item);
244  if(digit) {
245  if(is_pad_digit(digit)) {
246  Identifier Id = digit->identify();
247  if (std::find(bcWindow.begin(), bcWindow.end(), digit->bcTag()) != bcWindow.end()){
249  //PadOfflineData* pad = new PadOfflineData(Id, digit->time(), digit->bcTag(), m_sTgcIdHelper);
250  //S.I
251  //std::shared_ptr<PadOfflineData> pad(new PadOfflineData(Id, digit->time(), digit->bcTag(), m_sTgcIdHelper));
252  auto pad=std::make_shared<PadOfflineData>(Id, digit->time(), digit->bcTag(), m_detManager);
253  //pad_hits.push_back(PadHits(Id, pad, cache_index(digit)));
254  pad_hits.emplace_back(Id, pad, cache_index(digit));//avoids extra copy
255  //S.I
256  }
257  }
258  }
259  } //for(item)
260  } // for(it)
261 
262  store_pads(pad_hits, pad_cache);
263  print_pad_cache(pad_cache);
264  ATH_MSG_DEBUG( "fill_pad_cache: end of processing" );
265  return StatusCode::SUCCESS;
266  }
267  //------------------------------------------------------------------------------
269  Identifier Id = digit->identify();
271  Amg::Vector2D pad_lpos;
272  rdoEl->stripPosition(Id,pad_lpos);
273  Amg::Vector3D pad_gpos;
274  rdoEl->surface(Id).localToGlobal(pad_lpos, pad_gpos, pad_gpos);
275 
276  double distance = std::sqrt( pad_gpos.x()*pad_gpos.x() +
277  pad_gpos.y()*pad_gpos.y() +
278  pad_gpos.z()*pad_gpos.z() );
279  return distance * c_inverse;
280  }
281  //------------------------------------------------------------------------------
283  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, m_rndmEngineName);
284  CLHEP::HepRandomEngine * engine = rngWrapper->getEngine(Gaudi::Hive::currentContext());
285  return CLHEP::RandGauss::shoot(engine, 0, m_timeJitter);
286  }
287  //------------------------------------------------------------------------------
288  void PadTdsOfflineTool::simulateDeadTime(std::vector<PadHits>& h) const {
289 
290  // create a channel map and fill it
291  PAD_MAP channel_map;
292  for (unsigned int i=0; i<h.size(); i++) {
293  Identifier pad_id = h[i].t_id;
294  PAD_MAP_IT it = channel_map.find( pad_id );
295  if ( it!=channel_map.end() ) {
296  (*it).second.push_back(h[i]);
297  } else {
298  std::vector<PadHits> tmp;
299  tmp.push_back(h[i]);
300  channel_map.insert( PAD_MAP_ITEM(pad_id,tmp) );
301  }
302  }
303 
304  // vector are already ordered in time so check for dead time overlap.
305  PAD_MAP_IT it = channel_map.begin();
306  while ( it!=channel_map.end() ) {
307  std::vector<PadHits>& hits = (*it).second;
308  std::vector<PadHits>::iterator p_next = hits.begin();
310  while ( p_next!=hits.end() ) {
311  if (std::fabs((*p_next).t_pad->time()-(*p).t_pad->time())<=m_vmmDeadTime){
312  p_next = hits.erase(p_next);
313  }else{
314  p=p_next++;
315  }
316  }
317  }
318  //once cleared the overlapping PAD hits, refill the PAD hit vector
319  h.clear();
320  it = channel_map.begin();
321  while ( it!=channel_map.end() ) {
322  std::vector<PadHits> hits = (*it).second;
323  h.insert(h.end(),hits.begin(),hits.end());
324  ++it;
325  }
326  }
327  //------------------------------------------------------------------------------
329  {
330  return (digit && m_idHelperSvc->stgcIdHelper().channelType(digit->identify())==0);
331  }
332  //------------------------------------------------------------------------------
334  {
335  Identifier Id = digit->identify();
336  int stationEta = m_idHelperSvc->stgcIdHelper().stationEta(Id);
337  int stationPhi = m_idHelperSvc->stgcIdHelper().stationPhi(Id);
338  std::string stName = m_idHelperSvc->stgcIdHelper().stationNameString(m_idHelperSvc->stgcIdHelper().stationName(Id));
339  int isSmall = stName[2] == 'S';
340  int trigger_sector = (isSmall)? stationPhi*2-1 : stationPhi*2-2;
341  return (stationEta>0)? trigger_sector + 16 : trigger_sector;
342  }
343 
344  // FIXME: method not used anywhere, drop it?
345  //------------------------------------------------------------------------------
346  bool PadTdsOfflineTool::determine_delay_and_bc(const sTgcDigit* digit, const int pad_hit_number,
347  double &delayed_time, uint16_t &BCtag) const
348  {
349  bool success = false;
350  if(!digit) return success;
351  if(!is_pad_digit(digit)) return success;
352  double arrival_time = digit->time();
353  delayed_time = arrival_time;
354  if(m_applyTDS_TofSubtraction) delayed_time -= computeTof(digit);
356  double capture_time = delayed_time + m_triggerCaptureWindow;
357  if((delayed_time>200 || delayed_time<-200) ||
358  (capture_time>200 || capture_time<-200) ){
359  ATH_MSG_WARNING("sTGC Pad hit "<<pad_hit_number<<" time outside of the range -200 ns / +200 ns,"
360  " skipping it!");
361  ATH_MSG_WARNING("sTGC Pad hit "<<pad_hit_number<<": delayed time ["<<delayed_time<<" ns]"
362  " capture time ["<<capture_time<<" ns]");
363  return success;
364  }
365  for (unsigned int i=0; i<16; i++) {
366  double bunch_start = i*25;
367  double bunch_stop = (i+1)*25;
368  double signal_start = delayed_time + 200;
369  double signal_stop = capture_time + 200;
370  if ((signal_start>=bunch_start && signal_start<bunch_stop) ||
371  (signal_stop>=bunch_start && signal_stop<bunch_stop) ){
372  BCtag = BCtag | (0x1<<i);
373  continue;
374  }
375  if(bunch_start>=signal_start && bunch_stop<signal_stop){
376  BCtag = BCtag | (0x1<<i);
377  }
378  }
379  std::string bctag = "";
380  uint16_t last_bit = 0x8000;
381  for(unsigned int i=0; i<16; i++) {
382  if(BCtag & (last_bit>>i)) bctag += "1";
383  else bctag += "0";
384  }
385  ATH_MSG_DEBUG("sTGC Pad hit " << pad_hit_number << ": arrival time [" << arrival_time << " ns]"
386  << " delayed time [" << delayed_time << " ns]"
387  << " capture time [" << capture_time << " ns]"
388  << " BC tag [" << bctag << "]" );
389  success = true;
390  return success;
391  }
392  //------------------------------------------------------------------------------
393  bool PadTdsOfflineTool::get_truth_hits_this_pad(const Identifier &pad_id, std::vector<MuonSimData::Deposit> &deposits) const
394  {
395  bool success=false;
396  const MuonSimDataCollection* ptrMuonSimDataCollection = nullptr;
397  if(m_isMC) {
399  if(!sdo_container.isValid()) {
400  ATH_MSG_WARNING("could not retrieve the sTGC SDO container: it will not be possible to associate the MC truth");
401  return success;
402  }
403  ptrMuonSimDataCollection = sdo_container.cptr();
404  const MuonSimData pad_sdo = (ptrMuonSimDataCollection->find(pad_id))->second;
405  pad_sdo.deposits(deposits);
406  success = true;
407  }
408  return success;
409  }
410  //------------------------------------------------------------------------------
411  void PadTdsOfflineTool::store_pads(const std::vector<PadHits> &pad_hits, std::vector< std::vector<std::shared_ptr<PadData>> > &pad_cache) const
412  {
413  for (unsigned int i=0; i<pad_hits.size(); i++) {
414  const std::vector<std::shared_ptr<PadData>>& pads = pad_cache.at(pad_hits[i].t_cache_index);
415  bool fill = pads.empty();
416  for(unsigned int p=0; p<pads.size(); p++) {
417  Identifier Id(pads.at(p)->id());
418  if(Id==pad_hits[i].t_id) {
419  fill = false;
420  ATH_MSG_WARNING( "Pad Hits entered multiple times Discarding!!! Id:" << Id );
421  } else fill = true;
422  }
423  if( fill ) pad_cache.at(pad_hits[i].t_cache_index).push_back(pad_hits[i].t_pad);
424  }
425  }
426  //------------------------------------------------------------------------------
428  {
429  if(!is_pad_digit(digit)) return;
430  Identifier Id = digit->identify();
431  std::string stName = m_idHelperSvc->stgcIdHelper().stationNameString(m_idHelperSvc->stgcIdHelper().stationName(Id));
432  int stationEta = m_idHelperSvc->stgcIdHelper().stationEta(Id);
433  int stationPhi = m_idHelperSvc->stgcIdHelper().stationPhi(Id);
434  int multiplet = m_idHelperSvc->stgcIdHelper().multilayer(Id);
435  int gas_gap = m_idHelperSvc->stgcIdHelper().gasGap(Id);
436  int channel_type = m_idHelperSvc->stgcIdHelper().channelType(Id);
437  int channel = m_idHelperSvc->stgcIdHelper().channel(Id);
438  int pad_eta = m_idHelperSvc->stgcIdHelper().padEta(Id);
439  int pad_phi = m_idHelperSvc->stgcIdHelper().padPhi(Id);
440 
441  ATH_MSG_DEBUG("sTGC Pad hit:"
442  <<" cache index ["<<cache_index(digit)<<"]"
443  <<" Station Name [" <<stName <<"]"
444  <<" Station Eta [" <<stationEta <<"]"
445  <<" Station Phi [" <<stationPhi <<"]"
446  <<" Multiplet [" <<multiplet <<"]"
447  <<" GasGap [" <<gas_gap <<"]"
448  <<" Type [" <<channel_type <<"]"
449  <<" ChNr [" <<channel <<"]"
450  <<" Pad Eta [" <<pad_eta <<"]"
451  <<" Pad Phi [" <<pad_phi <<"]"
452  <<" BCTag [" <<digit->bcTag() <<"]"
453  <<" Id Hash [" <<Id <<"]");
454  }
455  //------------------------------------------------------------------------------
456  void PadTdsOfflineTool::print_pad_time(const std::vector<PadHits> &pad_hits) const
457  {
458  for (const auto &hit : pad_hits) ATH_MSG_DEBUG("pad hit has time "<< hit.t_pad->time());
459  }
460 
461  void PadTdsOfflineTool::print_pad_cache(std::vector< std::vector<std::shared_ptr<PadData>> > &pad_cache) const
462  {
463  for (const std::vector<std::shared_ptr<PadData>>& pad : pad_cache) {
464  for (const auto &padhit : pad)
465  ATH_MSG_DEBUG("PAD hit cache: hit at side " << ( (padhit->sideId())? "A":"C")
466  << ", trigger sector " << padhit->sectorId()
467  << ", module " << padhit->moduleId()
468  << ", multiplet " << padhit->multipletId()
469  << ", gas gap " << padhit->gasGapId()
470  << ", pad eta " << padhit->padEtaId()
471  << ", pad phi " << padhit->padPhiId());
472  }
473  }
474 
475 } // NSWL1
NSWL1::PadTdsOfflineTool::sideLabel
static char sideLabel(const int &side)
Definition: PadTdsOfflineTool.h:115
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
MuonGM::sTgcReadoutElement::padCorners
bool padCorners(const Identifier &id, std::array< Amg::Vector2D, 4 > &corners) const
pad corners
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:360
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
NSWL1::PadTdsOfflineTool::m_applyTDS_TimeJitterSubtraction
Gaudi::Property< bool > m_applyTDS_TimeJitterSubtraction
Definition: PadTdsOfflineTool.h:162
MuonSimData::Deposit
std::pair< HepMcParticleLink, MuonMCData > Deposit
Definition: MuonSimData.h:66
NSWL1::PadTdsOfflineTool::print_pad_time
void print_pad_time(const std::vector< PadHits > &pad_hits) const
Print time for each pad.
Definition: PadTdsOfflineTool.cxx:456
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
NSWL1::PadTdsOfflineTool::numberOfSectors
static size_t numberOfSectors()
Definition: PadTdsOfflineTool.h:105
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
NSWL1::PadTdsOfflineTool::m_validation_tree
std::unique_ptr< PadTdsValidationTree > m_validation_tree
Definition: PadTdsOfflineTool.h:167
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
NSWL1::PadTdsOfflineTool::computeTimeJitter
double computeTimeJitter() const
extract the time jitter t subtract from the PAD hit time
Definition: PadTdsOfflineTool.cxx:282
NSWL1::PadTdsOfflineTool::m_doNtuple
Gaudi::Property< bool > m_doNtuple
Definition: PadTdsOfflineTool.h:154
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
hist_file_dump.d
d
Definition: hist_file_dump.py:137
NSWL1::PadHits::PadHits
PadHits(Identifier id, std::shared_ptr< PadOfflineData > p, int c)
Definition: PadTdsOfflineTool.cxx:17
initialize
void initialize()
Definition: run_EoverP.cxx:894
NSWL1::PadTdsOfflineTool::determine_delay_and_bc
bool determine_delay_and_bc(const sTgcDigit *digit, const int pad_hit_number, double &delayed_time, uint16_t &BCtag) const
Definition: PadTdsOfflineTool.cxx:346
NSWL1::PadTdsOfflineTool::lastSector
static size_t lastSector()
Definition: PadTdsOfflineTool.h:104
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
NSWL1::PAD_MAP
std::map< Identifier, std::vector< PadHits > > PAD_MAP
Definition: PadTdsOfflineTool.cxx:27
tree
TChain * tree
Definition: tile_monitor.h:30
skel.it
it
Definition: skel.GENtoEVGEN.py:423
NSWL1::PadTdsOfflineTool::m_triggerCaptureWindow
Gaudi::Property< float > m_triggerCaptureWindow
Definition: PadTdsOfflineTool.h:158
NSWL1::PadTdsOfflineTool::firstSectorAside
static size_t firstSectorAside()
Definition: PadTdsOfflineTool.h:107
NSWL1::PadTdsOfflineTool::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Athena/Gaudi incident Service.
Definition: PadTdsOfflineTool.h:146
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
NSWL1::PadHits
Definition: PadTdsOfflineTool.cxx:11
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
NSWL1::order_padHits_with_increasing_time
bool order_padHits_with_increasing_time(const PadHits &i, const PadHits &j)
Definition: PadTdsOfflineTool.cxx:25
NSWL1::ATLAS_NOT_THREAD_SAFE
StatusCode PadTdsOfflineTool::fill_pad_validation_id ATLAS_NOT_THREAD_SAFE(std::vector< std::vector< std::shared_ptr< PadData >> > &pad_cache) const
Definition: PadTdsOfflineTool.cxx:114
NSWL1::PadTdsOfflineTool::get_truth_hits_this_pad
bool get_truth_hits_this_pad(const Identifier &pad_id, std::vector< MuonSimData::Deposit > &deposits) const
Definition: PadTdsOfflineTool.cxx:393
MuonGM::MuonClusterReadoutElement::surface
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
Definition: MuonClusterReadoutElement.h:123
NSWL1::PadTdsOfflineTool::cache_index
int cache_index(const sTgcDigit *digit) const
Definition: PadTdsOfflineTool.cxx:333
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
NSWL1::PadHits::t_id
Identifier t_id
Definition: PadTdsOfflineTool.cxx:13
NSWL1::PadTdsOfflineTool::m_vmmShapingTime
Gaudi::Property< float > m_vmmShapingTime
Definition: PadTdsOfflineTool.h:156
MuonGM::sTgcReadoutElement::stripPosition
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position - should be renamed to channel position If the strip number is outside the range of va...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:323
NSWL1::PadTdsOfflineTool::handle
virtual void handle(const Incident &inc) override
Definition: PadTdsOfflineTool.cxx:91
NSWL1::PadTdsOfflineTool::fill_pad_cache
StatusCode fill_pad_cache(std::vector< std::vector< std::shared_ptr< PadData >> > &pad_cache) const
Apply the additional processing then fill the cache, locally.
Definition: PadTdsOfflineTool.cxx:223
TRT::Hit::side
@ side
Definition: HitInfo.h:83
NSWL1::PadTdsOfflineTool::computeTof
double computeTof(const sTgcDigit *digit) const
compute the time of flight of particle giving the PAD hit
Definition: PadTdsOfflineTool.cxx:268
NSWL1::PadTdsOfflineTool::m_sTgcSdoContainer
SG::ReadHandleKey< MuonSimDataCollection > m_sTgcSdoContainer
Definition: PadTdsOfflineTool.h:169
sTgcDigit
Definition: sTgcDigit.h:20
NSWL1::PadTdsOfflineTool::gather_pad_data
virtual StatusCode gather_pad_data(std::vector< std::shared_ptr< PadData >> &pads, int side=-1, int sector=-1) const override
Definition: PadTdsOfflineTool.cxx:157
NSWL1::PadTdsOfflineTool::m_vmmDeadTime
Gaudi::Property< float > m_vmmDeadTime
Definition: PadTdsOfflineTool.h:157
MuonSimData::deposits
void deposits(std::vector< Deposit > &deposits) const
Definition: MuonSimData.h:99
NSWL1::PadTdsOfflineTool::firstSector
static size_t firstSector()
Definition: PadTdsOfflineTool.h:103
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
lumiFormat.i
int i
Definition: lumiFormat.py:92
sTgcDigitCollection
Definition: sTgcDigitCollection.h:18
NSWL1::PadOfflineData
class modeling the pad hit fragment for the NSW L1 offline simulation
Definition: PadOfflineData.h:36
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
NSWL1::PadTdsOfflineTool::m_sTgcDigitContainer
SG::ReadHandleKey< sTgcDigitContainer > m_sTgcDigitContainer
Definition: PadTdsOfflineTool.h:168
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
NSWL1::PadTdsOfflineTool::m_isMC
Gaudi::Property< bool > m_isMC
Definition: PadTdsOfflineTool.h:152
MuonGM::sTgcReadoutElement
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:28
MuonSimDataCollection
Definition: MuonSimDataCollection.h:21
NSWL1::PadHits::t_pad
std::shared_ptr< PadOfflineData > t_pad
Definition: PadTdsOfflineTool.cxx:14
NSWL1::PadTdsOfflineTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: PadTdsOfflineTool.h:148
NSWL1::PadTdsOfflineTool::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number generator engine to use.
Definition: PadTdsOfflineTool.h:147
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:242
NSWL1::PadTdsOfflineTool::sectorIndex
static size_t sectorIndex(const int &side, const int &sector)
internal index.
Definition: PadTdsOfflineTool.h:118
NSWL1::PAD_MAP_ITEM
std::pair< Identifier, std::vector< PadHits > > PAD_MAP_ITEM
Definition: PadTdsOfflineTool.cxx:29
NSWL1::PadTdsOfflineTool::m_detManager
const MuonGM::MuonDetectorManager * m_detManager
MuonDetectorManager.
Definition: PadTdsOfflineTool.h:149
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
sTgcDigitContainer::digit_size
size_type digit_size() const
Definition: sTgcDigitContainer.cxx:55
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:236
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
NSWL1::PadTdsOfflineTool::PadTdsOfflineTool
PadTdsOfflineTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: PadTdsOfflineTool.cxx:32
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
PadTdsOfflineTool.h
NSWL1::PadTdsOfflineTool::m_applyTDS_TofSubtraction
Gaudi::Property< bool > m_applyTDS_TofSubtraction
Definition: PadTdsOfflineTool.h:161
padhit
Definition: MuonFeatureDetails_p2.h:16
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
NSWL1::PadTdsOfflineTool::m_timeJitter
Gaudi::Property< float > m_timeJitter
Definition: PadTdsOfflineTool.h:159
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
NSWL1::PadTdsOfflineTool::print_pad_cache
void print_pad_cache(std::vector< std::vector< std::shared_ptr< PadData >> > &pad_cache) const
Print all info stored in the pad cache.
Definition: PadTdsOfflineTool.cxx:461
MuonSimData
Definition: MuonSimData.h:62
item
Definition: ItemListSvc.h:43
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
ATHRNG::RNGWrapper::getEngine
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition: RNGWrapper.h:134
Muon::nsw::channel_type
channel_type
Definition: NSWDecodeHelper.h:18
NSWL1::PAD_MAP_IT
std::map< Identifier, std::vector< PadHits > >::iterator PAD_MAP_IT
Definition: PadTdsOfflineTool.cxx:28
h
NSWL1::local_position_to_global_position
Amg::Vector3D local_position_to_global_position(const MuonSimData::Deposit &d, const Trk::PlaneSurface &s)
convert the local position of a simhit to a global position
Definition: PadTdsOfflineTool.cxx:105
lumiFormat.fill
fill
Definition: lumiFormat.py:111
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::PlaneSurface
Definition: PlaneSurface.h:64
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
NSWL1::PadHits::t_cache_index
int t_cache_index
Definition: PadTdsOfflineTool.cxx:15
NSWL1::c_inverse
const double c_inverse
Definition: tdr_compat_enum.h:13
NSWL1::PadTdsOfflineTool::m_vmmTimeOverThreshold
Gaudi::Property< float > m_vmmTimeOverThreshold
Definition: PadTdsOfflineTool.h:155
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
MuonGM::MuonDetectorManager::getsTgcReadoutElement
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:259
AthAlgTool
Definition: AthAlgTool.h:26
Trk::PlaneSurface::localToGlobal
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override final
Specified for PlaneSurface: LocalToGlobal method without dynamic memory allocation.
Definition: PlaneSurface.cxx:204
NSWL1::PadTdsOfflineTool::m_rndmEngineName
Gaudi::Property< std::string > m_rndmEngineName
Definition: PadTdsOfflineTool.h:153
NSWL1::PadTdsOfflineTool::store_pads
void store_pads(const std::vector< PadHits > &pad_hits, std::vector< std::vector< std::shared_ptr< PadData >> > &pad_cache) const
Store pad data in the cache.
Definition: PadTdsOfflineTool.cxx:411
NSWL1::PadTdsOfflineTool::is_pad_digit
bool is_pad_digit(const sTgcDigit *digit) const
Definition: PadTdsOfflineTool.cxx:328
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
NSWL1
A trigger trigger candidate for a stgc sector.
Definition: NSWL1Simulation.cxx:9
python.compressB64.c
def c
Definition: compressB64.py:93
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
NSWL1::PadTdsOfflineTool::firstSectorCside
static size_t firstSectorCside()
Definition: PadTdsOfflineTool.h:109
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
NSWL1::PadTdsOfflineTool::print_digit
void print_digit(const sTgcDigit *digit) const
Definition: PadTdsOfflineTool.cxx:427
NSWL1::PadTdsOfflineTool::simulateDeadTime
void simulateDeadTime(std::vector< PadHits > &h) const
simulate the dead time of the VMM
Definition: PadTdsOfflineTool.cxx:288