ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
FEI3SimTool Class Reference

#include <FEI3SimTool.h>

Inheritance diagram for FEI3SimTool:
Collaboration diagram for FEI3SimTool:

Public Member Functions

 FEI3SimTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual ~FEI3SimTool ()
 
virtual void process (SiChargedDiodeCollection &chargedDiodes, PixelRDO_Collection &rdoCollection, CLHEP::HepRandomEngine *rndmEngine)
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Protected Attributes

int m_numberOfBcid {1}
 
double m_timeOffset {5.0}
 
double m_timeJitter {0.0}
 
double m_thermalNoise {160.0}
 
ToolHandle< IInDetConditionsToolm_pixelConditionsTool
 
ServiceHandle< InDetDD::IPixelReadoutManagerm_pixelReadout
 
SG::ReadCondHandleKey< PixelChargeCalibCondDatam_chargeDataKey
 
Gaudi::Property< int > m_BarrelEC
 
Gaudi::Property< bool > m_doNoise
 
Gaudi::Property< bool > m_cosmics
 

Static Protected Attributes

static constexpr double m_bunchSpace {25.0}
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

int relativeBunch2009 (const double threshold, const double intimethreshold, const SiTotalCharge &totalCharge, CLHEP::HepRandomEngine *rndmEngine) const
 
double getProbability (const std::vector< float > &bounds, const std::vector< float > &probs, const double &val) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

SG::ReadCondHandleKey< PixelModuleDatam_moduleDataKey
 
Gaudi::Property< bool > m_duplication
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 26 of file FEI3SimTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ FEI3SimTool()

FEI3SimTool::FEI3SimTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 24 of file FEI3SimTool.cxx.

24  :
26 }

◆ ~FEI3SimTool()

FEI3SimTool::~FEI3SimTool ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode FEI3SimTool::finalize ( )
virtual

Reimplemented from FrontEndSimTool.

Definition at line 37 of file FEI3SimTool.cxx.

37  {
38  ATH_MSG_DEBUG("FEI3SimTool::finalize()");
39  return StatusCode::SUCCESS;
40 }

◆ getProbability()

double FEI3SimTool::getProbability ( const std::vector< float > &  bounds,
const std::vector< float > &  probs,
const double &  val 
) const
private

Definition at line 257 of file FEI3SimTool.cxx.

257  {
258  auto pCategory = std::upper_bound(bounds.begin(), bounds.end(),val);
259  if (pCategory == bounds.end()) return 0.0;
260  auto idx = std::distance(bounds.begin(), pCategory);
261  return probs[idx];
262 }

◆ initialize()

StatusCode FEI3SimTool::initialize ( )
virtual

Reimplemented from FrontEndSimTool.

Definition at line 30 of file FEI3SimTool.cxx.

30  {
32  ATH_MSG_DEBUG("FEI3SimTool::initialize()");
34  return StatusCode::SUCCESS;
35 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

static const InterfaceID& FrontEndSimTool::interfaceID ( )
inlinestaticinherited

Definition at line 35 of file FrontEndSimTool.h.

35 {return IID_IFrontEndSimTool;}

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ process()

void FEI3SimTool::process ( SiChargedDiodeCollection chargedDiodes,
PixelRDO_Collection rdoCollection,
CLHEP::HepRandomEngine *  rndmEngine 
)
virtual

Implements FrontEndSimTool.

Definition at line 42 of file FEI3SimTool.cxx.

43  {
44  const InDetDD::PixelModuleDesign* p_design =
45  static_cast<const InDetDD::PixelModuleDesign*>(&(chargedDiodes.element())->design());
46 
48  return;
49  }
50 
51  const PixelID* pixelId = static_cast<const PixelID*>(chargedDiodes.element()->getIdHelper());
52  const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash
53  Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify());
54 
55  int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify());
56  int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify());
57  int moduleIndex = pixelId->eta_module(chargedDiodes.element()->identify());
58 
59  if (std::abs(barrel_ec) != m_BarrelEC) {
60  return;
61  }
62 
63  const EventContext& ctx{Gaudi::Hive::currentContext()};
65  const PixelModuleData *moduleData = *moduleDataHandle;
67  const PixelChargeCalibCondData *calibData = *calibDataHandle;
68  const auto selectedTuneYear = moduleData->getFEI3TimingSimTune(barrel_ec, layerIndex);
69  // Add cross-talk
70  crossTalk(moduleData->getCrossTalk(barrel_ec, layerIndex), chargedDiodes);
71 
72  if (m_doNoise) {
73  // Add thermal noise
74  thermalNoise(m_thermalNoise, chargedDiodes, rndmEngine);
75 
76  // Add random noise
77  randomNoise(chargedDiodes, moduleData, m_numberOfBcid, calibData, rndmEngine, m_pixelReadout.get());
78  }
79 
80  // Add random diabled pixels
81  randomDisable(chargedDiodes, moduleData, rndmEngine); // FIXME How should we handle disabling pixels in Overlay jobs?
82  const InDetDD::SiDetectorElement * siDetEl = static_cast<const InDetDD::SiDetectorElement *>(chargedDiodes.element());
83  for (auto &[mapId,mapDiode]:chargedDiodes) {
84  // Merge ganged pixel
85  InDetDD::SiCellId cellID = chargedDiodes.element()->cellIdFromIdentifier(chargedDiodes.getId( mapId));
86  InDetDD::SiCellId gangedCell = siDetEl->gangedCell(cellID);
87  Identifier gangedID = chargedDiodes.element()->identifierFromCellId(gangedCell);
88  if (gangedCell.isValid()) {
89  SiChargedDiode* gangedChargeDiode = chargedDiodes.find(gangedID);
90  int phiGanged = pixelId->phi_index(gangedID);
91  int phiThis = pixelId->phi_index(chargedDiodes.getId( mapId));
92 
93  if (gangedChargeDiode) { // merge charges
94  bool maskGanged = ((phiGanged > 159) && (phiGanged < 168));
95  bool maskThis = ((phiThis > 159) && (phiThis < 168));
96  // mask the one ganged pixel that does not correspond to the readout electronics.
97  // not really sure this is needed
98  if (maskGanged && maskThis) {
99  ATH_MSG_ERROR("FEI3SimTool: both ganged pixels are in the mask out region -> BUG!");
100  }
101  if (maskGanged) {
102  mapDiode.add(gangedChargeDiode->totalCharge()); // merged org pixel
103  SiHelper::maskOut(*gangedChargeDiode, true);
104  } else {
105  gangedChargeDiode->add(mapDiode.totalCharge()); // merged org pixel
106  SiHelper::maskOut(mapDiode, true);
107  }
108  }
109  }
110  }
111 
112  for (SiChargedDiodeOrderedIterator i_chargedDiode = chargedDiodes.orderedBegin();
113  i_chargedDiode != chargedDiodes.orderedEnd(); ++i_chargedDiode) {
114  SiChargedDiode& diode = **i_chargedDiode;
115 
116  Identifier diodeID = chargedDiodes.getId(diode.diode());
117  double charge = diode.charge();
118 
119  unsigned int FE = m_pixelReadout->getFE(diodeID, moduleID);
120  InDetDD::PixelDiodeType type = m_pixelReadout->getDiodeType(diodeID);
121  if ((FE == InDetDD::invalidFrontEnd) or (type == InDetDD::PixelDiodeType::NONE)) continue;//invalid frontend
122 
123  // charge to ToT conversion
124  double tot = calibData->getToT(type, moduleHash, FE, charge);
125  const auto thresholds = calibData->getThresholds(type, moduleHash, FE);
126  // Apply analog threshold, timing simulation
127  double th0 = thresholds.value;
128  double ith0 = thresholds.inTimeValue;
129  double threshold = PixelDigitization::randomThreshold(thresholds, rndmEngine);
130  // This noise check is unaffected by digitizationFlags.doInDetNoise in
131  // 21.0 - see PixelCellDiscriminator.cxx in that branch
132 
133  if (charge > threshold) {
134  int bunchSim = 0;
135  if (diode.totalCharge().fromTrack()) {
136  const std::vector<float> & totCharges = moduleData->getTimingIndex(barrel_ec, layerIndex);
137  const std::vector<float> & probArray = moduleData->getTimingProbability(barrel_ec, layerIndex, moduleIndex);
138 
139  double prob = 0.0;
140  if (selectedTuneYear==2023) { prob = getProbability(totCharges, probArray, tot); }
141  if (selectedTuneYear==2022) { prob = getProbability(totCharges, probArray, tot); }
142  if (selectedTuneYear==2018) { prob = getProbability(totCharges, probArray, diode.totalCharge().charge()); }
143  if (selectedTuneYear==2015) { prob = getProbability(totCharges, probArray, diode.totalCharge().charge()); }
144 
145  double G4Time = getG4Time(diode.totalCharge());
146  double rnd = CLHEP::RandFlat::shoot(rndmEngine, 0.0, 1.0);
147 
148  double timeWalk = 0.0;
149  if (rnd<prob) { timeWalk = 25.0; }
150  bunchSim = static_cast<int>(std::floor((G4Time+m_timeOffset+timeWalk)/m_bunchSpace));
151 
152  if (selectedTuneYear == 2009) { // RUN1 procedure (based on 2007 cosmic data)
153  double intimethreshold = (ith0 / th0) * threshold;
154  bunchSim = relativeBunch2009(threshold, intimethreshold, diode.totalCharge(), rndmEngine);
155  }
156  }
157  else {
158  if (moduleData->getFEI3TimingSimTune(barrel_ec, layerIndex) > 0) {
159  bunchSim = CLHEP::RandFlat::shootInt(rndmEngine, m_numberOfBcid);
160  }
161  }
162 
163  if (bunchSim < 0 || bunchSim > m_numberOfBcid) {
164  SiHelper::belowThreshold(diode, true, true);
165  } else {
166  SiHelper::SetBunch(diode, bunchSim);
167  }
168  } else {
169  SiHelper::belowThreshold(diode, true, true);
170  }
171 
172  double totsig = calibData->getTotRes(moduleHash, FE, tot);
173  int nToT = static_cast<int>(CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot, totsig));
174 
175  if (nToT < 1) {
176  nToT = 1;
177  }
178 
179  if (nToT <= moduleData->getToTThreshold(barrel_ec, layerIndex)) {
180  SiHelper::belowThreshold(diode, true, true);
181  }
182 
183  if (nToT >= moduleData->getFEI3Latency(barrel_ec, layerIndex)) {
184  SiHelper::belowThreshold(diode, true, true);
185  }
186 
187  // Filter events
188  if (SiHelper::isMaskOut(diode)) {
189  continue;
190  }
191  if (SiHelper::isDisabled(diode)) {
192  continue;
193  }
194 
195  if (!m_pixelConditionsTool->isActive(moduleHash, diodeID, ctx)) {
196  SiHelper::disabled(diode, true, true);
197  continue;
198  }
199 
200  int flag = diode.flag();
201  int bunch = (flag >> 8) & 0xff;
202 
203  InDetDD::SiReadoutCellId cellId = diode.getReadoutCell();
204  const Identifier id_readout = chargedDiodes.element()->identifierFromCellId(cellId);
205 
206  // Front-End simulation
207  if (bunch >= 0 && bunch < m_numberOfBcid) {
208  rdoCollection.push_back(new Pixel1RawData(id_readout, nToT, bunch, 0, bunch));
209  }
210 
211  // Duplication mechanism for FEI3 small hits :
212  if (m_duplication) {//is true for run1 only
213  static constexpr int smallHitThreshold{7}; //constant for both barrel and endcap, never changes
214  bool smallHitChk = false;
215  if (nToT <= smallHitThreshold) {
216  smallHitChk = true;
217  }
218  if (smallHitChk && bunch > 0 && bunch <= m_numberOfBcid) {
219  rdoCollection.push_back(new Pixel1RawData(id_readout, nToT, bunch - 1, 0, bunch - 1));
220  }
221  }
222  }
223  }

◆ relativeBunch2009()

int FEI3SimTool::relativeBunch2009 ( const double  threshold,
const double  intimethreshold,
const SiTotalCharge totalCharge,
CLHEP::HepRandomEngine *  rndmEngine 
) const
private

Definition at line 225 of file FEI3SimTool.cxx.

227  {
228  int BCID = 0;
229  double myTimeWalkEff = 0.;
230  double overdrive = intimethreshold - threshold;
231 
232  //my TimeWalk computation through PARAMETRIZATION (by Francesco De Lorenzi - Milan)
233  //double curvature = 7.6e7*overdrive-2.64e10;
234  //double divergence = -1.6*overdrive+942 ;
235  //double myTimeWalk = curvature/(pow((totalCharge.charge()-divergence),2.5));
236 
237  //my TimeWalk computation through PARAMETRIZATION from 2009 cosmic data (by I. Ibragimov and D. Miller)
238  double p1 = 20. / std::log(intimethreshold / overdrive);
239  double p0 = p1 * std::log(1. - threshold / 100000.);
240 
241  double myTimeWalk = -p0 - p1 * std::log(1. - threshold / totalCharge.charge());
242 
243  myTimeWalkEff = myTimeWalk + myTimeWalk * 0.2 * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
244  const double limit = m_timeJitter * 0.5;
245  double randomJitter = CLHEP::RandFlat::shoot(rndmEngine, - limit, limit);
246 
247  //double G4Time = totalCharge.time();
248 
249  double G4Time = getG4Time(totalCharge);
250  double timing = m_timeOffset + myTimeWalkEff + randomJitter + G4Time;
251  BCID = static_cast<int>(std::floor(timing / m_bunchSpace));
252  //ATH_MSG_DEBUG ( CTW << " , " << myTimeWalkEff << " , " << G4Time << " , " << timing << " , " << BCID );
253 
254  return BCID;
255 }

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_BarrelEC

Gaudi::Property<int> FrontEndSimTool::m_BarrelEC
protectedinherited
Initial value:
{
this, "BarrelEC", 0, "Index of barrel or endcap"
}

Definition at line 68 of file FrontEndSimTool.h.

◆ m_bunchSpace

constexpr double FrontEndSimTool::m_bunchSpace {25.0}
staticconstexprprotectedinherited

Definition at line 50 of file FrontEndSimTool.h.

◆ m_chargeDataKey

SG::ReadCondHandleKey<PixelChargeCalibCondData> FrontEndSimTool::m_chargeDataKey
protectedinherited
Initial value:
{
this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"
}

Definition at line 64 of file FrontEndSimTool.h.

◆ m_cosmics

Gaudi::Property<bool> FrontEndSimTool::m_cosmics
protectedinherited
Initial value:
{
this, "Cosmics", false, "Is this for Cosmics simulation?"
}

Definition at line 76 of file FrontEndSimTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doNoise

Gaudi::Property<bool> FrontEndSimTool::m_doNoise
protectedinherited
Initial value:
{
this, "DoNoise", true, "Flag of noise simulation"
}

Definition at line 72 of file FrontEndSimTool.h.

◆ m_duplication

Gaudi::Property<bool> FEI3SimTool::m_duplication
private
Initial value:
{
this, "HitDuplication", false, "Turn on Hit Duplication in subsequent timebin for small hits"
}

Definition at line 41 of file FEI3SimTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_moduleDataKey

SG::ReadCondHandleKey<PixelModuleData> FEI3SimTool::m_moduleDataKey
private
Initial value:
{
this, "PixelModuleData", "PixelModuleData", "Pixel module data"
}

Definition at line 36 of file FEI3SimTool.h.

◆ m_numberOfBcid

int FrontEndSimTool::m_numberOfBcid {1}
protectedinherited

Definition at line 51 of file FrontEndSimTool.h.

◆ m_pixelConditionsTool

ToolHandle<IInDetConditionsTool> FrontEndSimTool::m_pixelConditionsTool
protectedinherited
Initial value:
{
this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"
}

Definition at line 55 of file FrontEndSimTool.h.

◆ m_pixelReadout

ServiceHandle<InDetDD::IPixelReadoutManager> FrontEndSimTool::m_pixelReadout
protectedinherited
Initial value:
{
this, "PixelReadoutManager", "PixelReadoutManager", "Pixel readout manager"
}

Definition at line 59 of file FrontEndSimTool.h.

◆ m_thermalNoise

double FrontEndSimTool::m_thermalNoise {160.0}
protectedinherited

Definition at line 54 of file FrontEndSimTool.h.

◆ m_timeJitter

double FrontEndSimTool::m_timeJitter {0.0}
protectedinherited

Definition at line 53 of file FrontEndSimTool.h.

◆ m_timeOffset

double FrontEndSimTool::m_timeOffset {5.0}
protectedinherited

Definition at line 52 of file FrontEndSimTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
InDetDD::SiDetectorElement::gangedCell
SiCellId gangedCell(const SiCellId &cellId) const
If cell is ganged return the id of the other cell which shares the readout for this cell,...
FEI3SimTool::getProbability
double getProbability(const std::vector< float > &bounds, const std::vector< float > &probs, const double &val) const
Definition: FEI3SimTool.cxx:257
PixelChargeCalibCondData::getToT
float getToT(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE, float Q) const
Definition: PixelChargeCalibCondData.cxx:174
PixelID::phi_index
int phi_index(const Identifier &id) const
Definition: PixelID.h:658
PixelModuleData::getTimingIndex
std::vector< float > getTimingIndex(int barrel_ec, int layer) const
Definition: PixelModuleData.cxx:283
SiChargedDiode
Definition: SiChargedDiode.h:30
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
SiChargedDiodeCollection::element
const InDetDD::SolidStateDetectorElementBase * element() const
Definition: SiChargedDiodeCollection.h:218
InDetDD::PixelModuleDesign
Definition: PixelModuleDesign.h:48
SiHelper::isDisabled
static bool isDisabled(SiChargedDiode &chDiode)
Definition: SiHelper.h:179
PixelID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: PixelID.h:619
PixelModuleData::getCrossTalk
double getCrossTalk(int barrel_ec, int layer) const
Definition: PixelModuleData.cxx:129
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
PixelChargeCalibCondData::getThresholds
PixelChargeCalib::Thresholds getThresholds(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
Definition: PixelChargeCalibCondData.cxx:99
PixelModuleData
Definition: PixelModuleData.h:22
FrontEndSimTool::m_thermalNoise
double m_thermalNoise
Definition: FrontEndSimTool.h:54
InDetDD::invalidFrontEnd
constexpr uint32_t invalidFrontEnd
Definition: PixelReadoutDefinitions.h:44
SiChargedDiode::getReadoutCell
const InDetDD::SiReadoutCellId & getReadoutCell() const
Definition: SiChargedDiode.h:111
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
InDetDD::SiCellId::isValid
bool isValid() const
Test if its in a valid state.
Definition: SiCellId.h:136
InDetDD::PixelDiodeType
PixelDiodeType
Definition: PixelReadoutDefinitions.h:25
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
InDetDD::PixelReadoutTechnology::FEI3
@ FEI3
SiTotalCharge::charge
double charge() const
Definition: SiTotalCharge.h:118
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
PixelChargeCalibCondData::getTotRes
float getTotRes(unsigned int moduleHash, unsigned int FE, float Q) const
Definition: PixelChargeCalibCondData.cxx:163
FrontEndSimTool::FrontEndSimTool
FrontEndSimTool()
covarianceTool.prob
prob
Definition: covarianceTool.py:678
SiHelper::maskOut
static void maskOut(SiChargedDiode &chDiode, bool flag)
Definition: SiHelper.h:67
SiHelper::disabled
static void disabled(SiChargedDiode &chDiode, bool flag, bool mask=false)
Definition: SiHelper.h:93
PixelID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: PixelID.h:364
InDetDD::SolidStateDetectorElementBase::getIdHelper
const AtlasDetectorID * getIdHelper() const
Returns the id helper (inline)
PixelDigitization::getG4Time
double getG4Time(const SiTotalCharge &totalCharge)
Definition: PixelNoiseFunctions.cxx:169
SiChargedDiode::add
void add(const SiCharge &charge)
Definition: SiChargedDiode.cxx:29
SiChargedDiode::charge
double charge() const
Definition: SiChargedDiode.h:115
PixelDigitization::randomThreshold
double randomThreshold(const PixelChargeCalib::Thresholds &t, CLHEP::HepRandomEngine *pEngine)
Definition: PixelDigitizationUtilities.cxx:105
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
SiTotalCharge::fromTrack
bool fromTrack() const
Definition: SiTotalCharge.cxx:49
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
PixelByteStreamErrors::BCID
@ BCID
Definition: PixelByteStreamErrors.h:13
FrontEndSimTool::initialize
virtual StatusCode initialize() override
Definition: FrontEndSimTool.cxx:13
SiChargedDiode::diode
const InDetDD::SiCellId & diode() const
Definition: SiChargedDiode.h:97
FrontEndSimTool::m_doNoise
Gaudi::Property< bool > m_doNoise
Definition: FrontEndSimTool.h:72
SiChargedDiode::totalCharge
const SiTotalCharge & totalCharge() const
Definition: SiChargedDiode.h:107
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
PixelID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: PixelID.h:387
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
trigDumpTimers.timing
def timing(hist)
Definition: trigDumpTimers.py:13
FrontEndSimTool::m_bunchSpace
static constexpr double m_bunchSpace
Definition: FrontEndSimTool.h:50
FrontEndSimTool::m_timeJitter
double m_timeJitter
Definition: FrontEndSimTool.h:53
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
PixelChargeCalibCondData
Definition: PixelChargeCalibCondData.h:24
SiHelper::belowThreshold
static void belowThreshold(SiChargedDiode &chDiode, bool flag, bool mask=false)
Definition: SiHelper.h:84
FrontEndSimTool::m_numberOfBcid
int m_numberOfBcid
Definition: FrontEndSimTool.h:51
master.flag
bool flag
Definition: master.py:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
FrontEndSimTool::m_pixelReadout
ServiceHandle< InDetDD::IPixelReadoutManager > m_pixelReadout
Definition: FrontEndSimTool.h:59
Pixel1RawData
Definition: Pixel1RawData.h:23
SiHelper::SetBunch
static void SetBunch(SiChargedDiode &chDiode, int bunch, MsgStream *log=nullptr)
Definition: SiHelper.h:129
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
PixelChargeCalib::Thresholds::value
int value
Definition: ChargeCalibParameters.h:74
FEI3SimTool::m_moduleDataKey
SG::ReadCondHandleKey< PixelModuleData > m_moduleDataKey
Definition: FEI3SimTool.h:36
FrontEndSimTool::m_BarrelEC
Gaudi::Property< int > m_BarrelEC
Definition: FrontEndSimTool.h:68
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
PixelModuleData::getFEI3Latency
int getFEI3Latency(int barrel_ec, int layer) const
Definition: PixelModuleData.cxx:238
SiChargedDiode::flag
int flag() const
Definition: SiChargedDiode.h:102
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
PixelID::layer_disk
int layer_disk(const Identifier &id) const
Definition: PixelID.h:626
PixelID::eta_module
int eta_module(const Identifier &id) const
Definition: PixelID.h:651
SiHelper::isMaskOut
static bool isMaskOut(SiChargedDiode &chDiode)
Definition: SiHelper.h:171
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
threshold
Definition: chainparser.cxx:74
charge
double charge(const T &p)
Definition: AtlasPID.h:756
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
InDetDD::PixelModuleDesign::getReadoutTechnology
PixelReadoutTechnology getReadoutTechnology() const
Definition: PixelModuleDesign.h:386
PixelDigitization::crossTalk
void crossTalk(double crossTalk, SiChargedDiodeCollection &chargedDiodes)
Definition: PixelNoiseFunctions.cxx:25
FEI3SimTool::relativeBunch2009
int relativeBunch2009(const double threshold, const double intimethreshold, const SiTotalCharge &totalCharge, CLHEP::HepRandomEngine *rndmEngine) const
Definition: FEI3SimTool.cxx:225
InDetDD::SiCellId
Definition: SiCellId.h:29
PixelModuleData::getTimingProbability
std::vector< float > getTimingProbability(int barrel_ec, int layer, int eta) const
Definition: PixelModuleData.cxx:297
a
TList * a
Definition: liststreamerinfos.cxx:10
h
PixelModuleData::getFEI3TimingSimTune
int getFEI3TimingSimTune(int barrel_ec, int layer) const
Definition: PixelModuleData.cxx:254
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
InDetDD::PixelDiodeType::NONE
@ NONE
FrontEndSimTool::m_timeOffset
double m_timeOffset
Definition: FrontEndSimTool.h:52
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
SiChargedDiodeOrderedIterator
SiChargedDiodeOrderedSet::iterator SiChargedDiodeOrderedIterator
Definition: SiChargedDiodeCollection.h:107
FrontEndSimTool::m_chargeDataKey
SG::ReadCondHandleKey< PixelChargeCalibCondData > m_chargeDataKey
Definition: FrontEndSimTool.h:64
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
InDetDD::SiReadoutCellId
Definition: SiReadoutCellId.h:42
PixelDigitization::randomNoise
void randomNoise(SiChargedDiodeCollection &chargedDiodes, const PixelModuleData *moduleData, int nBcid, const PixelChargeCalibCondData *chargeCalibData, CLHEP::HepRandomEngine *rndmEngine, InDetDD::IPixelReadoutManager *pixelReadout)
Definition: PixelNoiseFunctions.cxx:73
PixelID
Definition: PixelID.h:67
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
updateCoolNtuple.limit
int limit
Definition: updateCoolNtuple.py:45
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
FrontEndSimTool::m_pixelConditionsTool
ToolHandle< IInDetConditionsTool > m_pixelConditionsTool
Definition: FrontEndSimTool.h:55
dumpTgcDigiThreshold.threshold
list threshold
Definition: dumpTgcDigiThreshold.py:34
PixelDigitization::randomDisable
void randomDisable(SiChargedDiodeCollection &chargedDiodes, const PixelModuleData *moduleData, CLHEP::HepRandomEngine *rndmEngine)
Definition: PixelNoiseFunctions.cxx:147
InDetDD::SolidStateDetectorElementBase::identify
virtual Identifier identify() const override final
identifier of this detector element (inline)
PixelDigitization::thermalNoise
void thermalNoise(double thermalNoise, SiChargedDiodeCollection &chargedDiodes, CLHEP::HepRandomEngine *rndmEngine)
Definition: PixelNoiseFunctions.cxx:61
TRTCalib_cfilter.p0
p0
Definition: TRTCalib_cfilter.py:129
fitman.k
k
Definition: fitman.py:528
SiChargedDiodeCollection::identify
virtual Identifier identify() const override final
Definition: SiChargedDiodeCollection.h:230
FEI3SimTool::m_duplication
Gaudi::Property< bool > m_duplication
Definition: FEI3SimTool.h:41
Identifier
Definition: IdentifierFieldParser.cxx:14