ATLAS Offline Software
PixelPrepDataToxAOD.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // PixelPrepDataToxAOD.cxx
7 // Implementation file for class PixelPrepDataToxAOD
9 
10 #include "PixelPrepDataToxAOD.h"
11 
13 
17 
18 #include "Identifier/Identifier.h"
21 #include "PixelConditionsData/ChargeCalibParameters.h" //for LegacyFitParameters
22 
23 
25 #include "AtlasHepMC/GenParticle.h"
26 #include "AtlasHepMC/GenVertex.h"
28 #include "InDetSimEvent/SiHit.h"
30 
31 
32 #include "TMath.h"
33 #include "CLHEP/Geometry/Point3D.h"
34 
35 #include <map>
36 
37 #define AUXDATA(OBJ, TYP, NAME) \
38  static const SG::AuxElement::Accessor<TYP> acc_##NAME (#NAME); acc_##NAME(*(OBJ))
39 
40 namespace {
41  unsigned int makeKey(short phi, char eta, char layer) {
42  return phi | (eta << 16) | (layer << 24);
43  }
44 }
45 
47 //
48 // Constructor with parameters:
49 //
51 PixelPrepDataToxAOD::PixelPrepDataToxAOD(const std::string &name, ISvcLocator *pSvcLocator) :
52  AthAlgorithm(name,pSvcLocator),
53  m_PixelHelper(nullptr),
54  m_useSiHitsGeometryMatching(true),
55  m_firstEventWarnings(true),
56  m_need_sihits{false}
57 {
58  // --- Steering and configuration flags
59 
60  declareProperty("UseTruthInfo", m_useTruthInfo=false);
61  declareProperty("UseSiHitsGeometryMatching", m_useSiHitsGeometryMatching=true);
62  declareProperty("WriteSDOs", m_writeSDOs = false);
63  declareProperty("WriteSiHits", m_writeSiHits = false);
64  declareProperty("WriteNNinformation", m_writeNNinformation = true);
65  declareProperty("WriteRDOinformation", m_writeRDOinformation = true);
66  declareProperty("WriteExtendedPRDinformation", m_writeExtendedPRDinformation = false);
67 
68  // --- Configuration keys
69  declareProperty("SiClusterContainer", m_clustercontainer_key = "PixelClusters");
70  declareProperty("MC_SDOs", m_SDOcontainer_key = "PixelSDO_Map");
71  declareProperty("MC_Hits", m_sihitContainer_key = "PixelHits");
72  declareProperty("PRD_MultiTruth", m_multiTruth_key = "PRD_MultiTruthPixel");
73  //Keep this the same as input for now, for consistency with downstream assumptions
74  declareProperty("OutputClusterContainer", m_write_xaod_key = "PixelClusters");
75 
76  // --- Services and Tools
77  declare(m_write_xaod_key);
78  declare(m_write_offsets);
79 
80 }
81 
83 //
84 // Initialize method:
85 //
88 {
89  ATH_CHECK( detStore()->retrieve(m_PixelHelper, "PixelID") );
90 
91  //make sure we don't write what we don't have
92  if (not m_useTruthInfo) {
93  m_writeSDOs = false;
94  m_writeSiHits = false;
95  }
96 
97  ATH_CHECK(m_pixelReadout.retrieve());
99 
104 
105  ATH_CHECK(m_pixelSummary.retrieve());
106 
107  ATH_CHECK(m_lorentzAngleTool.retrieve());
108 
115 
116  ATH_CHECK(m_write_xaod_key.initialize());
119 
121 
122  return StatusCode::SUCCESS;
123 }
124 
126 //
127 // Execute method:
128 //
131 {
132  const EventContext& ctx = Gaudi::Hive::currentContext();
133  //Mandatory. Require if the algorithm is scheduled.
135 
136  if ( !PixelClusterContainer.isValid() )
137  {
138  ATH_MSG_ERROR("Failed to retrieve PixelClusterContainer with key" << PixelClusterContainer.key() );
139  return StatusCode::FAILURE;
140  }
141 
142  const PRD_MultiTruthCollection* prdmtColl(nullptr);
143  const xAODTruthParticleLinkVector *truth_particle_links{nullptr};
144  if (m_useTruthInfo) {
146  if (prdmtCollHandle.isValid()) {
147  prdmtColl = &*prdmtCollHandle;
148  }
149  if (!m_truthParticleLinks.empty()) {
151  if (truthParticleLinksHandle.isValid()) {
152  truth_particle_links = truthParticleLinksHandle.cptr();
153  }
154  }
155  }
156 
157  const InDetSimDataCollection* sdoCollection(nullptr);
158  if (m_writeSDOs) {
160  if (sdoCollectionHandle.isValid()) {
161  sdoCollection = &*sdoCollectionHandle;
162  } else if (m_firstEventWarnings) {
163  ATH_MSG_WARNING("SDO information requested, but SDO collection not available!");
164  }
165  }
166 
168  bool foundSplitProbContainer = false;
169  if (!m_clusterSplitProbContainer.key().empty()) {
171  if (!splitProbContainer.isValid()) {
172  ATH_MSG_FATAL("Failed to get cluster splitting probability container " << m_clusterSplitProbContainer);
173  }
174  foundSplitProbContainer = true;
175  }
176 
177  std::vector<std::vector<const SiHit*>> siHits(m_PixelHelper->wafer_hash_max());
178  if (m_need_sihits) {
179  SG::ReadHandle<SiHitCollection> siHitCollectionHandle(m_sihitContainer_key, ctx);
180  if (siHitCollectionHandle.isValid()) {
181  for (const SiHit& siHit: *siHitCollectionHandle) {
182  // Check if it is a Pixel hit
183  if (!siHit.isPixel()) continue;
184 
185  Identifier wafer_id(m_PixelHelper->wafer_id(siHit.getBarrelEndcap(),
186  siHit.getLayerDisk(),
187  siHit.getPhiModule(),
188  siHit.getEtaModule()));
189  IdentifierHash wafer_hash(m_PixelHelper->wafer_hash(wafer_id));
190  if (wafer_hash>=m_PixelHelper->wafer_hash_max()) continue;
191  siHits[wafer_hash].push_back(&siHit);
192  }
193  } else if (m_firstEventWarnings) {
194  ATH_MSG_WARNING("SiHit information requested, but SiHit collection not available!");
195  }
196  }
197 
198  const PixelChargeCalibCondData *calibData=nullptr;
199  if (m_writeRDOinformation) {
201  if (!calibData_handle.isValid()) {
202  ATH_MSG_FATAL("Failed to get PixelChargeCalibCondData with key " << m_chargeDataKey);
203  }
204  calibData=calibData_handle.cptr();
205  }
206 
207  // Create the xAOD container and its auxiliary store:
209  ATH_CHECK(xaod.record(std::make_unique<xAOD::TrackMeasurementValidationContainer>(),
210  std::make_unique<xAOD::TrackMeasurementValidationAuxContainer>()));
211 
213  ATH_CHECK(offsets.record(std::make_unique<std::vector<unsigned int>>(m_PixelHelper->wafer_hash_max(), 0)));
214 
215  unsigned int have_truth_link=0u;
216  unsigned int missing_truth_particle=0u;
217  unsigned int missing_parent_particle=0u;
218  // Loop over the container
219  unsigned int counter(0);
220 
224 
225  std::unordered_map< unsigned int , std::vector<unsigned int> > cluster_map;
226  for( const auto clusterCollection : * PixelClusterContainer ){
227 
228  //Fill Offset container
229  (*offsets)[clusterCollection->identifyHash()] = counter;
230 
231  // skip empty collections
232  if( clusterCollection->empty() ) continue;
233 
234  // loop over collection and convert to xAOD
235  for( const InDet::PixelCluster* prd : *clusterCollection ){
236  ++counter;
237 
238  Identifier clusterId = prd->identify();
239  if ( !clusterId.is_valid() ) {
240  ATH_MSG_WARNING("Pixel cluster identifier is not valid");
241  }
242 
243  // create and add xAOD object
245  unsigned int cluster_idx = xaod->size();
246  xaod->push_back(xprd);
247 
248  //Set Identifier
249  xprd->setIdentifier( clusterId.get_compact() );
250 
251  //Set Global Position
252  Amg::Vector3D gpos = prd->globalPosition();
253  xprd->setGlobalPosition(gpos.x(),gpos.y(),gpos.z());
254 
255  //Set Local Position
256  const Amg::Vector2D& locpos = prd->localPosition();
257 
258  // Set local error matrix
259  xprd->setLocalPosition( locpos.x(), locpos.y() );
260 
261  const Amg::MatrixX& localCov = prd->localCovariance();
262  //std::cout << localCov << std::endl;
263  if(localCov.size() == 1){
264  //std::cout << "Size == 1" << std::endl;
265  xprd->setLocalPositionError( localCov(0,0), 0., 0. );
266  } else if(localCov.size() == 4){
267  //std::cout << "Size == 2" << std::endl;
268  xprd->setLocalPositionError( localCov(0,0), localCov(1,1), localCov(0,1) );
269  } else {
270  //std::cout << "Size == "<< localCov.size() << std::endl;
271  xprd->setLocalPositionError(0.,0.,0.);
272  }
273 
274  // Set vector of hit identifiers
275  std::vector< uint64_t > rdoIdentifierList;
276  rdoIdentifierList.reserve(prd->rdoList().size());
277  int rowmin=9999; int rowmax=-9999;
278  int colmin=9999; int colmax=-9999;
279  for( const auto &hitIdentifier : prd->rdoList() ){
280  rdoIdentifierList.push_back( hitIdentifier.get_compact() );
281  //May want to addinformation about the individual hits here
282  int row = m_PixelHelper->phi_index(hitIdentifier);
283  int col = m_PixelHelper->eta_index(hitIdentifier);
284  if(rowmin > row) rowmin = row;
285  if(rowmax < row) rowmax = row;
286  if(colmin > col) colmin = col;
287  if(colmax < col) colmax = col;
288  }
289  xprd->setRdoIdentifierList(rdoIdentifierList);
290 
291  //Add pixel cluster properties
292  AUXDATA(xprd,int,bec) = m_PixelHelper->barrel_ec(clusterId) ;
293  char the_layer = m_PixelHelper->layer_disk(clusterId) ;
294  char the_eta = m_PixelHelper->eta_module(clusterId) ;
295  short the_phi = m_PixelHelper->phi_module(clusterId) ;
296  AUXDATA(xprd,int,layer) = the_layer ;
297  AUXDATA(xprd,int,phi_module) = the_phi ;
298  AUXDATA(xprd,int,eta_module) = the_eta ;
299  AUXDATA(xprd,int,eta_pixel_index) = m_PixelHelper->eta_index(clusterId);
300  AUXDATA(xprd,int,phi_pixel_index) = m_PixelHelper->phi_index(clusterId);
301 
302  cluster_map[ makeKey(the_phi, the_eta, the_layer)].push_back(cluster_idx);
303 
304  const InDet::SiWidth cw = prd->width();
305  AUXDATA(xprd,int,sizePhi) = (int)cw.colRow()[0];
306  AUXDATA(xprd,int,sizeZ) = (int)cw.colRow()[1];
307  AUXDATA(xprd,int,nRDO) = (int)prd->rdoList().size();
308 
309  AUXDATA(xprd,float,charge) = prd->totalCharge();
310  AUXDATA(xprd,int,ToT) = prd->totalToT();
311  AUXDATA(xprd,int,LVL1A) = prd->LVL1A();
312 
313  AUXDATA(xprd,char,isFake) = (char)prd->isFake();
314  AUXDATA(xprd,char,gangedPixel) = (char)prd->gangedPixel();
316  splitProb = foundSplitProbContainer ? splitProbContainer->splitProbability(prd) : Trk::ClusterSplitProbabilityContainer::getNoSplitProbability();
317  AUXDATA(xprd,char,isSplit) = static_cast<char>(splitProb.isSplit());
318  AUXDATA(xprd,float,splitProbability1) = splitProb.splitProbability1();
319  AUXDATA(xprd,float,splitProbability2) = splitProb.splitProbability2();
320 
321  // Need to add something to Add the NN splitting information
322  if(m_writeNNinformation) addNNInformation( xprd, prd, 7, 7);
323 
324  // Add information for each contributing hit
326  IdentifierHash moduleHash = clusterCollection->identifyHash();
327  AUXDATA(xprd,int,hasBSError) = (int)m_pixelSummary->hasBSError(moduleHash, ctx);
328  AUXDATA(xprd,int,DCSState) = dcsState->getModuleStatus(moduleHash);
329 
330  float deplVoltage = 0.0;
331  AUXDATA(xprd,float,BiasVoltage) = dcsHV->getBiasVoltage(moduleHash);
332  AUXDATA(xprd,float,Temperature) = dcsTemp->getTemperature(moduleHash);
333  AUXDATA(xprd,float,DepletionVoltage) = deplVoltage;
334 
335  AUXDATA(xprd,float,LorentzShift) = (float)m_lorentzAngleTool->getLorentzShift(moduleHash,ctx);
336 
337  assert (calibData);
338  addRdoInformation(xprd, prd, calibData);
339  }
340 
341 
342  // Add the Detector element ID -- not sure if needed as we have the informations above
343  const InDetDD::SiDetectorElement* de = prd->detectorElement();
344  uint64_t detElementId(0);
345  if(de){
346  Identifier detId = de->identify();
347  if ( detId.is_valid() ) {
348  detElementId = detId.get_compact();
349  }
350  }
351  AUXDATA(xprd,uint64_t,detectorElementID) = detElementId;
352 
354  AUXDATA(xprd,int,waferID) = m_PixelHelper->wafer_hash(de->identify());
355 
356  const InDetDD::PixelModuleDesign* design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&de->design());
357  InDetDD::SiLocalPosition pos1 = design->positionFromColumnRow(colmin,rowmin);
358  InDetDD::SiLocalPosition pos2 = design->positionFromColumnRow(colmax,rowmin);
359  InDetDD::SiLocalPosition pos3 = design->positionFromColumnRow(colmin,rowmax);
360  InDetDD::SiLocalPosition pos4 = design->positionFromColumnRow(colmax,rowmax);
361  InDetDD::SiLocalPosition centroid = 0.25*(pos1+pos2+pos3+pos4);
362 
363  AUXDATA(xprd,float,centroid_xphi) = centroid.xPhi();
364  AUXDATA(xprd,float,centroid_xeta) = centroid.xEta();
365 
366  AUXDATA(xprd,float,omegax) = prd->omegax();
367  AUXDATA(xprd,float,omegay) = prd->omegay();
368  }
369 
370  // Use the MultiTruth Collection to get a list of all true particle contributing to the cluster
371  if (prdmtColl) {
372  auto range{prdmtColl->equal_range(clusterId)};
373  if (truth_particle_links) {
374  std::vector<unsigned int> tp_indices;
375  for (auto& i{range.first}; i!=range.second; ++i) {
376  ElementLink<xAOD::TruthParticleContainer> a_truth_particle_link = truth_particle_links->find(i->second);
377  if (a_truth_particle_link) {
378  const xAOD::TruthParticle *truth_particle = *a_truth_particle_link;
379  if (truth_particle) {
380  ++have_truth_link;
381  tp_indices.push_back(static_cast<int>(truth_particle->index()));
382  }
383  else {
384  ++missing_parent_particle;
385  }
386  }
387  else {
388  tp_indices.push_back(std::numeric_limits<unsigned int>::max());
389  ++missing_truth_particle;
390  }
391  }
392  // @TODO provide possibility to move tp_indices to its final destination
393  AUXDATA(xprd,std::vector<unsigned int>, truth_index) = tp_indices;
394  }
395  std::vector<int> barcodes; // FIXME barcode-based - requires xAOD::TrackMeasurementValidation to be migrated away from barcodes
396  for (auto i = range.first; i != range.second; ++i) {
397  barcodes.push_back( HepMC::barcode(i->second) );
398  }
399  // @TODO move vector
400  AUXDATA(xprd,std::vector<int>, truth_barcode) = barcodes;
401  }
402 
403  std::vector< std::vector< int > > sdo_tracks;
404  // Use the SDO Collection to get a list of all true particle contributing to the cluster per readout element
405  // Also get the energy deposited by each true particle per readout element
406  if (sdoCollection) {
407  sdo_tracks = addSDOInformation(xprd, prd, *sdoCollection);
408  }
409 
410  // Now Get the most detailed truth from the SiHits
411  // Note that this could get really slow if there are a lot of hits and clusters
412  if (m_need_sihits) {
413  const std::vector<SiHit> matched_hits = findAllHitsCompatibleWithCluster(prd, &siHits[prd->detectorElement()->identifyHash()], sdo_tracks);
414  if (m_writeSiHits) {
415  addSiHitInformation(xprd, prd, matched_hits);
416  }
417 
418  if (m_writeNNinformation) {
419  addNNTruthInfo(xprd, prd, matched_hits);
420  }
421  }
422  }
423  }
424 
425  for ( auto clusItr = xaod->begin(); clusItr != xaod->end(); ++clusItr ) {
426  AUXDATA(*clusItr,char,broken) = false;
427  }
428  m_haveTruthLink += have_truth_link;
429  m_missingTruthParticle += missing_truth_particle;
430  m_missingParentParticle += missing_parent_particle;
431 
432  static const SG::AuxElement::Accessor<int> acc_layer ("layer");
433  static const SG::AuxElement::Accessor<int> acc_phi_module ("phi_module");
434  static const SG::AuxElement::Accessor<int> acc_eta_module ("eta_module");
435  static const SG::AuxElement::Accessor<std::vector<int> > acc_sihit_barcode ("sihit_barcode");
436  for ( auto clusItr = xaod->begin(); clusItr != xaod->end(); ++clusItr)
437  {
438  auto pixelCluster = *clusItr;
439  int layer = acc_layer(*pixelCluster);
440  std::vector<int> barcodes = acc_sihit_barcode(*pixelCluster);
441 
442  const std::vector< unsigned int> &cluster_idx_list = cluster_map.at( makeKey(acc_phi_module(*pixelCluster), acc_eta_module(*pixelCluster), acc_layer(*pixelCluster) ));
443  for (unsigned int cluster_idx : cluster_idx_list) {
444  auto pixelCluster2 = xaod->at(cluster_idx);
445  if ( acc_layer(*pixelCluster2) != layer )
446  continue;
447  if ( acc_eta_module(*pixelCluster) != acc_eta_module(*pixelCluster2) )
448  continue;
449  if ( acc_phi_module(*pixelCluster) != acc_phi_module(*pixelCluster2) )
450  continue;
451 
452  std::vector<int> barcodes2 = acc_sihit_barcode(*pixelCluster2);
453 
454  for ( auto bc : barcodes ) {
455  if (std::find(barcodes2.begin(), barcodes2.end(), bc ) == barcodes2.end()) continue;
456  static const SG::AuxElement::Accessor<char> acc_broken ("broken");
457  acc_broken(*pixelCluster) = true;
458  acc_broken(*pixelCluster2) = true;
459  break;
460  }
461  }
462  }
463 
464  ATH_MSG_DEBUG( " recorded PixelPrepData objects: size " << xaod->size() );
465 
466  m_firstEventWarnings = false;
467 
468  return StatusCode::SUCCESS;
469 }
470 
471 
473  const InDet::PixelCluster* prd,
474  const InDetSimDataCollection& sdoCollection ) const
475 {
476  std::vector<int> sdo_word;
477  std::vector< std::vector< int > > sdo_depositsBarcode;
478  std::vector< std::vector< float > > sdo_depositsEnergy;
479  // find hit
480  for( const auto &hitIdentifier : prd->rdoList() ){
481  auto pos = sdoCollection.find(hitIdentifier);
482  if( pos == sdoCollection.end() ) continue;
483  sdo_word.push_back( pos->second.word() ) ;
484  std::vector<int> sdoDepBC(pos->second.getdeposits().size(), HepMC::INVALID_PARTICLE_ID);
485  std::vector<float> sdoDepEnergy(pos->second.getdeposits().size());
486  unsigned int nDepos{0};
487  for (auto& deposit: pos->second.getdeposits()) {
488  if (deposit.first) sdoDepBC[nDepos] = HepMC::barcode(deposit.first);
489  ATH_MSG_DEBUG(" SDO Energy Deposit " << deposit.second ) ;
490  sdoDepEnergy[nDepos] = deposit.second;
491  nDepos++;
492  }
493  sdo_depositsBarcode.push_back( sdoDepBC );
494  sdo_depositsEnergy.push_back( sdoDepEnergy );
495  }
496  AUXDATA(xprd,std::vector<int>,sdo_words) = sdo_word;
497  AUXDATA(xprd,std::vector< std::vector<int> >,sdo_depositsBarcode) = sdo_depositsBarcode;
498  AUXDATA(xprd,std::vector< std::vector<float> >,sdo_depositsEnergy) = sdo_depositsEnergy;
499 
500  return sdo_depositsBarcode;
501 }
502 
503 
504 
506  const InDet::PixelCluster* prd,
507  const std::vector<SiHit> & matchingHits ) const
508 {
509 
510  int numHits = matchingHits.size();
511 
512  std::vector<float> sihit_energyDeposit(numHits,0);
513  std::vector<float> sihit_meanTime(numHits,0);
514  std::vector<int> sihit_barcode(numHits,0);
515  std::vector<int> sihit_pdgid(numHits,0);
516 
517  std::vector<float> sihit_startPosX(numHits,0);
518  std::vector<float> sihit_startPosY(numHits,0);
519  std::vector<float> sihit_startPosZ(numHits,0);
520 
521  std::vector<float> sihit_endPosX(numHits,0);
522  std::vector<float> sihit_endPosY(numHits,0);
523  std::vector<float> sihit_endPosZ(numHits,0);
524 
525  int hitNumber(0);
526  const InDetDD::SiDetectorElement* de = prd->detectorElement();
527  if(de){
528  for ( const auto& sihit : matchingHits ) {
529  sihit_energyDeposit[hitNumber] = sihit.energyLoss() ;
530  sihit_meanTime[hitNumber] = sihit.meanTime() ;
531  const HepMcParticleLink& HMPL = sihit.particleLink();
532  sihit_barcode[hitNumber] = HepMC::barcode(HMPL) ;
533  if(HMPL.isValid()){
534  sihit_pdgid[hitNumber] = HMPL->pdg_id();
535  }
536 
537  // Convert Simulation frame into reco frame
538  const HepGeom::Point3D<double>& startPos=sihit.localStartPosition();
539 
540  Amg::Vector2D pos= de->hitLocalToLocal( startPos.z(), startPos.y() );
541  sihit_startPosX[hitNumber] = pos[0];
542  sihit_startPosY[hitNumber] = pos[1];
543  sihit_startPosZ[hitNumber] = startPos.x();
544 
545 
546  const HepGeom::Point3D<double>& endPos=sihit.localEndPosition();
547  pos= de->hitLocalToLocal( endPos.z(), endPos.y() );
548  sihit_endPosX[hitNumber] = pos[0];
549  sihit_endPosY[hitNumber] = pos[1];
550  sihit_endPosZ[hitNumber] = endPos.x();
551  ++hitNumber;
552  }
553  }
554 
555  AUXDATA(xprd,std::vector<float>,sihit_energyDeposit) = sihit_energyDeposit;
556  AUXDATA(xprd,std::vector<float>,sihit_meanTime) = sihit_meanTime;
557  AUXDATA(xprd,std::vector<int>,sihit_barcode) = sihit_barcode;
558  AUXDATA(xprd,std::vector<int>,sihit_pdgid) = sihit_pdgid;
559 
560  AUXDATA(xprd,std::vector<float>,sihit_startPosX) = sihit_startPosX;
561  AUXDATA(xprd,std::vector<float>,sihit_startPosY) = sihit_startPosY;
562  AUXDATA(xprd,std::vector<float>,sihit_startPosZ) = sihit_startPosZ;
563 
564  AUXDATA(xprd,std::vector<float>,sihit_endPosX) = sihit_endPosX;
565  AUXDATA(xprd,std::vector<float>,sihit_endPosY) = sihit_endPosY;
566  AUXDATA(xprd,std::vector<float>,sihit_endPosZ) = sihit_endPosZ;
567 
568 
569 }
570 
571 
572 
573 
574 
575 
577  const std::vector<const SiHit*>* sihits,
578  std::vector< std::vector< int > > & trkBCs ) const
579 {
580  ATH_MSG_VERBOSE( "Got " << sihits->size() << " SiHits to look through" );
581  std::vector<SiHit> matchingHits;
582 
583  // Check if we have detector element -- needed to find the local position of the SiHits
584  const InDetDD::SiDetectorElement* de = prd->detectorElement();
585  if(!de)
586  return matchingHits;
587 
588  std::vector<const SiHit* > multiMatchingHits;
589 
590  for ( const SiHit* siHit : *sihits) {
591  // Now we have all hits in the module that match lets check to see if they match the cluster
592  // Must be within +/- 1 hits of any hit in the cluster to be included
593 
595  {
596  HepGeom::Point3D<double> averagePosition = siHit->localStartPosition() + siHit->localEndPosition();
597  averagePosition *= 0.5;
598  Amg::Vector2D pos = de->hitLocalToLocal( averagePosition.z(), averagePosition.y() );
600 
601  for( const auto &hitIdentifier : prd->rdoList() ){
602  ATH_MSG_DEBUG("Truth Phi " << diode.phiIndex() << " Cluster Phi " << m_PixelHelper->phi_index( hitIdentifier ) );
603  ATH_MSG_DEBUG("Truth Eta " << diode.etaIndex() << " Cluster Eta " << m_PixelHelper->eta_index( hitIdentifier ) );
604  if( abs( int(diode.etaIndex()) - m_PixelHelper->eta_index( hitIdentifier ) ) <=1
605  && abs( int(diode.phiIndex()) - m_PixelHelper->phi_index( hitIdentifier ) ) <=1 )
606  {
607  multiMatchingHits.push_back(siHit);
608  break;
609  }
610  }
611  }
612  else
613  {
614  auto bc = HepMC::barcode(siHit->particleLink());
615  for ( const auto& barcodeSDOColl : trkBCs ) {
616  if (std::find(barcodeSDOColl.begin(),barcodeSDOColl.end(),bc) == barcodeSDOColl.end() ) continue;
617  multiMatchingHits.push_back(siHit);
618  break;
619  }
620  }
621  }
622  //Now we will now make 1 SiHit for each true particle if the SiHits "touch" other
623  std::vector<const SiHit* >::iterator siHitIter = multiMatchingHits.begin();
624  std::vector<const SiHit* >::iterator siHitIter2 = multiMatchingHits.begin();
625  ATH_MSG_DEBUG( "Found " << multiMatchingHits.size() << " SiHit " );
626  for ( ; siHitIter != multiMatchingHits.end(); ++siHitIter) {
627  const SiHit* lowestXPos = *siHitIter;
628  const SiHit* highestXPos = *siHitIter;
629 
630 
631  // We will merge these hits
632  std::vector<const SiHit* > ajoiningHits;
633  ajoiningHits.push_back( *siHitIter );
634 
635  siHitIter2 = siHitIter+1;
636  while ( siHitIter2 != multiMatchingHits.end() ) {
637  // Need to come from the same truth particle
638 
639  if( !HepMC::is_same_particle((*siHitIter)->particleLink(),(*siHitIter2)->particleLink()) ){
640  ++siHitIter2;
641  continue;
642  }
643 
644  // Check to see if the SiHits are compatible with each other.
645  if (std::abs((highestXPos->localEndPosition().x()-(*siHitIter2)->localStartPosition().x()))<0.00005 &&
646  std::abs((highestXPos->localEndPosition().y()-(*siHitIter2)->localStartPosition().y()))<0.00005 &&
647  std::abs((highestXPos->localEndPosition().z()-(*siHitIter2)->localStartPosition().z()))<0.00005 )
648  {
649  highestXPos = *siHitIter2;
650  ajoiningHits.push_back( *siHitIter2 );
651  // Dont use hit more than once
652  // @TODO could invalidate siHitIter
653  siHitIter2 = multiMatchingHits.erase( siHitIter2 );
654  }else if (std::abs((lowestXPos->localStartPosition().x()-(*siHitIter2)->localEndPosition().x()))<0.00005 &&
655  std::abs((lowestXPos->localStartPosition().y()-(*siHitIter2)->localEndPosition().y()))<0.00005 &&
656  std::abs((lowestXPos->localStartPosition().z()-(*siHitIter2)->localEndPosition().z()))<0.00005)
657  {
658  lowestXPos = *siHitIter2;
659  ajoiningHits.push_back( *siHitIter2 );
660  // Dont use hit more than once
661  // @TODO could invalidate siHitIter
662  siHitIter2 = multiMatchingHits.erase( siHitIter2 );
663  } else {
664  ++siHitIter2;
665  }
666  }
667 
668  if( ajoiningHits.size() == 0){
669  ATH_MSG_WARNING("This should really never happen");
670  continue;
671  }else if(ajoiningHits.size() == 1){
672  // Copy Si Hit ready to return
673  matchingHits.push_back( *ajoiningHits[0] );
674  continue;
675  } else {
676  // Build new SiHit and merge information together.
677  ATH_MSG_DEBUG("Merging " << ajoiningHits.size() << " SiHits together." );
678 
679 
680  float energyDep(0);
681  float time(0);
682  for( const auto& siHit : ajoiningHits){
683  energyDep += siHit->energyLoss();
684  time += siHit->meanTime();
685  }
686  time /= (float)ajoiningHits.size();
687 
688  matchingHits.emplace_back(lowestXPos->localStartPosition(),
689  highestXPos->localEndPosition(),
690  energyDep,
691  time,
692  HepMC::barcode((*siHitIter)->particleLink()),
693  0, // 0 for pixel 1 for Pixel
694  (*siHitIter)->getBarrelEndcap(),
695  (*siHitIter)->getLayerDisk(),
696  (*siHitIter)->getEtaModule(),
697  (*siHitIter)->getPhiModule(),
698  (*siHitIter)->getSide() );
699  ATH_MSG_DEBUG("Finished Merging " << ajoiningHits.size() << " SiHits together." );
700 
701  }
702  }
703 
704 
705  return matchingHits;
706 
707 }
708 
711  const PixelChargeCalibCondData *calibData) const
712 {
713  ATH_MSG_VERBOSE( " Starting creating input from cluster " );
714 
715 
716  const std::vector<Identifier>& rdos = pixelCluster->rdoList();
717 
718  const std::vector<float> &chList = pixelCluster->chargeList();
719  const std::vector<int> &totList = pixelCluster->totList();
720 
721  // std::vector<int> rowList;
722  // std::vector<int> colList;
723  std::vector<int> etaIndexList;
724  std::vector<int> phiIndexList;
725  std::vector<float> CTerm;
726  std::vector<float> ATerm;
727  std::vector<float> ETerm;
728 
729  ATH_MSG_VERBOSE( "Number of RDOs: " << rdos.size() );
730 
731  //Itererate over all elements hits in the cluster and fill the charge and tot matricies
732  std::vector<Identifier>::const_iterator rdosBegin = rdos.begin();
733  std::vector<Identifier>::const_iterator rdosEnd = rdos.end();
734 
735  ATH_MSG_VERBOSE(" Putting together the n. " << rdos.size() << " rdos into a matrix.");
736 
737  phiIndexList.reserve( rdos.size());
738  etaIndexList.reserve( rdos.size());
739  CTerm.reserve( rdos.size());
740  ATerm.reserve( rdos.size());
741  ETerm.reserve( rdos.size());
742  for (; rdosBegin!= rdosEnd; ++rdosBegin)
743  {
744  Identifier rId = *rdosBegin;
745  phiIndexList.push_back( m_PixelHelper->phi_index(rId) );
746  etaIndexList.push_back( m_PixelHelper->eta_index(rId) );
747 
748  // charge calibration parameters
749  Identifier moduleID = m_PixelHelper->wafer_id(rId);
750  IdentifierHash moduleHash = m_PixelHelper->wafer_hash(moduleID); // wafer hash
751  unsigned int FE = m_pixelReadout->getFE(rId, moduleID);
752  InDetDD::PixelDiodeType type = m_pixelReadout->getDiodeType(rId);
753  if (type == InDetDD::PixelDiodeType::NONE) continue;
754  const auto & parameters = calibData->getLegacyFitParameters(type, moduleHash, FE);
755  CTerm.emplace_back(parameters.C);
756  ATerm.emplace_back(parameters.A);
757  ETerm.emplace_back(parameters.E);
758 
759  }//end iteration on rdos
760 
761 
762  AUXDATA(xprd, std::vector<int>,rdo_phi_pixel_index) = phiIndexList;
763  AUXDATA(xprd, std::vector<int>,rdo_eta_pixel_index) = etaIndexList;
764  AUXDATA(xprd, std::vector<float>,rdo_charge) = chList;
765  AUXDATA(xprd, std::vector<int>,rdo_tot) = totList;
766 
767  AUXDATA(xprd, std::vector<float>,rdo_Cterm) = CTerm;
768  AUXDATA(xprd, std::vector<float>,rdo_Aterm) = ATerm;
769  AUXDATA(xprd, std::vector<float>,rdo_Eterm) = ETerm;
770 
771 }
772 
773 
776  const unsigned int sizeX, const unsigned int sizeY ) const
777 {
778  ATH_MSG_VERBOSE( " Starting creating input from cluster " );
779 
780  const InDetDD::SiDetectorElement* de = pixelCluster->detectorElement();
781  if (de==nullptr) {
782  ATH_MSG_ERROR("Could not get detector element");
783  return;
784  }
785 
786 
787  const InDetDD::PixelModuleDesign* design(dynamic_cast<const InDetDD::PixelModuleDesign*>(&de->design()));
788  if (not design) {
789  ATH_MSG_WARNING("PixelModuleDesign was not retrieved in function 'addNNInformation'");
790  return;
791  }
792  const std::vector<Identifier>& rdos = pixelCluster->rdoList();
793 
794  const std::vector<float>& chList = pixelCluster->chargeList();
795  const std::vector<int>& totList = pixelCluster->totList();
796 
797  ATH_MSG_VERBOSE( "Number of RDOs: " << rdos.size() );
798  ATH_MSG_VERBOSE( "Number of charges: " << chList.size() );
799  ATH_MSG_VERBOSE( "Number of TOT: " << totList.size() );
800 
801 
802  //Calculate the centre of the cluster
803  int phiPixelIndexMin, phiPixelIndexMax, etaPixelIndexMin, etaPixelIndexMax;
804  InDetDD::SiCellId cellIdWeightedPosition= getCellIdWeightedPosition( pixelCluster, &phiPixelIndexMin, &phiPixelIndexMax, &etaPixelIndexMin, &etaPixelIndexMax);
805 
806  if (!cellIdWeightedPosition.isValid())
807  {
808  ATH_MSG_WARNING( "Weighted position is on invalid CellID." );
809  }
810 
811  int etaPixelIndexWeightedPosition=cellIdWeightedPosition.etaIndex();
812  int phiPixelIndexWeightedPosition=cellIdWeightedPosition.phiIndex();
813 
814 
815  ATH_MSG_DEBUG(" weighted pos phiPixelIndex: " << phiPixelIndexWeightedPosition << " etaPixelIndex: " << etaPixelIndexWeightedPosition );
816 
817  // SiLocalPosition PixelModuleDesign::positionFromColumnRow(const int column, const int row) const;
818  //
819  // Given row and column index of diode, returns position of diode center
820  // ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId & cellId) or
821  // rawLocalPositionOfCell method in SiDetectorElement.
822  // DEPRECATED (but used in numerous places)
823  //
824  // Comment by Hide (referring the original comment in the code) : 2015-02-04
825  // I automatically replaced column to etaPixelIndex and row to phiPixelIndex here. It was bofore:
826  // InDetDD::SiLocalPosition siLocalPosition( design->positionFromColumnRow(columnWeightedPosition,rowWeightedPosition) );
827  //
828  // Then I assume the argument of column/row in this function is in offline manner, not the real hardware column/row.
829  //
830  InDetDD::SiLocalPosition w = design->positionFromColumnRow(etaPixelIndexWeightedPosition,phiPixelIndexWeightedPosition);
831 
832 
833  double localEtaPixelIndexWeightedPosition = w.xEta();
834  double localPhiPixelIndexWeightedPosition = w.xPhi();
835 
836  int centralIndexX=(sizeX-1)/2;
837  int centralIndexY=(sizeY-1)/2;
838 
839 
840 
841  // Check to see if the cluster is too big for the NN
842 
843  if (abs(phiPixelIndexWeightedPosition-phiPixelIndexMin)>centralIndexX ||
844  abs(phiPixelIndexWeightedPosition-phiPixelIndexMax)>centralIndexX)
845  {
846  ATH_MSG_DEBUG(" Cluster too large phiPixelIndexMin " << phiPixelIndexMin << " phiPixelIndexMax " << phiPixelIndexMax << " centralX " << centralIndexX);
847  //return;
848  }
849 
850  if (abs(etaPixelIndexWeightedPosition-etaPixelIndexMin)>centralIndexY ||
851  abs(etaPixelIndexWeightedPosition-etaPixelIndexMax)>centralIndexY)
852  {
853  ATH_MSG_DEBUG(" Cluster too large etaPixelIndexMin" << etaPixelIndexMin << " etaPixelIndexMax " << etaPixelIndexMax << " centralY " << centralIndexY);
854  //return;
855  }
856 
857  std::vector< std::vector<float> > matrixOfToT (sizeX, std::vector<float>(sizeY,0) );
858  std::vector< std::vector<float> > matrixOfCharge(sizeX, std::vector<float>(sizeY,0));
859  std::vector<float> vectorOfPitchesY(sizeY,0.4);
860 
861 
862  //Itererate over all elements hits in the cluster and fill the charge and tot matrices
863  std::vector<Identifier>::const_iterator rdosBegin = rdos.begin();
864  std::vector<Identifier>::const_iterator rdosEnd = rdos.end();
865  auto charge = chList.begin();
866  auto tot = totList.begin();
867 
868  ATH_MSG_VERBOSE(" Putting together the n. " << rdos.size() << " rdos into a matrix.");
869 
870  for (; rdosBegin!= rdosEnd; ++rdosBegin)
871  {
872 
873  Identifier rId = *rdosBegin;
874  int absphiPixelIndex = m_PixelHelper->phi_index(rId)-phiPixelIndexWeightedPosition + centralIndexX;
875  int absetaPixelIndex = m_PixelHelper->eta_index(rId)-etaPixelIndexWeightedPosition + centralIndexY;
876  if (charge != chList.end()){
877  ATH_MSG_VERBOSE( " Phi Index: " << m_PixelHelper->phi_index(rId) << " absphiPixelIndex: " << absphiPixelIndex << " eta Idx: " << m_PixelHelper->eta_index(rId) << " absetaPixelIndex: " << absetaPixelIndex << " charge " << *charge );
878  }
879  if (absphiPixelIndex <0 || absphiPixelIndex >= (int)sizeX)
880  {
881  ATH_MSG_DEBUG(" problem with index: " << absphiPixelIndex << " min: " << 0 << " max: " << sizeX);
882  continue;
883  }
884 
885  if (absetaPixelIndex <0 || absetaPixelIndex >= (int)sizeY)
886  {
887  ATH_MSG_DEBUG(" problem with index: " << absetaPixelIndex << " min: " << 0 << " max: " << sizeY);
888  continue;
889  }
890 
891  InDetDD::SiCellId cellId = de->cellIdFromIdentifier(*rdosBegin);
892  InDetDD::SiDiodesParameters diodeParameters = design->parameters(cellId);
893  float pitchY = diodeParameters.width().xEta();
894 
895  if ( (not totList.empty()) && tot != totList.end()) {
896  matrixOfToT[absphiPixelIndex][absetaPixelIndex] =*tot;
897  ++tot;
898  } else matrixOfToT[absphiPixelIndex][absetaPixelIndex] = -1;
899 
900  if ( (not chList.empty()) && charge != chList.end()){
901  matrixOfCharge[absphiPixelIndex][absetaPixelIndex]=*charge;
902  ++charge;
903  } else matrixOfCharge[absphiPixelIndex][absetaPixelIndex] = -1;
904 
905  if (pitchY > 0.1)
906  {
907  vectorOfPitchesY[absetaPixelIndex]=pitchY;
908  }
909  }//end iteration on rdos
910 
911 
912  ATH_MSG_VERBOSE( " End RDO LOOP " );
913 
914  // Using the centre of the module and beam spot calculate
915  // the incidence angles of the tracks
916  const Amg::Vector2D& prdLocPos = pixelCluster->localPosition();
918 
919  Amg::Vector3D globalPos = de->globalPosition(centroid);
920  Amg::Vector3D trackDir = globalPos; // - beamSpotPosition;
921  trackDir.normalize();
922 
923  Amg::Vector3D module_normal = de->normal();
924  Amg::Vector3D module_phiax = de->phiAxis();
925  Amg::Vector3D module_etaax = de->etaAxis();
926 
927  // Calculate the phi incidence angle
928  float trkphicomp = trackDir.dot(module_phiax);
929  float trketacomp = trackDir.dot(module_etaax);
930  float trknormcomp = trackDir.dot(module_normal);
931  double bowphi = atan2(trkphicomp,trknormcomp);
932  double boweta = atan2(trketacomp,trknormcomp);
933  double tanl = m_lorentzAngleTool->getTanLorentzAngle(de->identifyHash(),Gaudi::Hive::currentContext());
934  if(bowphi > TMath::Pi()/2) bowphi -= TMath::Pi();
935  if(bowphi < -TMath::Pi()/2) bowphi += TMath::Pi();
936  int readoutside = design->readoutSide();
937  double angle = atan(tan(bowphi)-readoutside*tanl);
938 
939 
940  // Calculate the theta incidence angle
941  ATH_MSG_VERBOSE( " Angle theta bef corr: " << boweta );
942  if (boweta>TMath::Pi()/2.) boweta-=TMath::Pi();
943  if (boweta<-TMath::Pi()/2.) boweta+=TMath::Pi();
944 
945 
946  ATH_MSG_VERBOSE(" Angle phi: " << angle << " theta: " << boweta );
947  ATH_MSG_VERBOSE(" PhiPixelIndexWeightedPosition: " << phiPixelIndexWeightedPosition << " EtaPixelIndexWeightedPosition: " << etaPixelIndexWeightedPosition );
948 
949  // store the matrixOfToT in a vector
950  std::vector<float> vectorOfCharge(sizeX*sizeY,0);
951  std::vector<float> vectorOfToT(sizeX*sizeY,0);
952  int counter(0);
953  for (unsigned int u=0;u<sizeX;u++)
954  {
955  for (unsigned int s=0;s<sizeY;s++)
956  {
957  vectorOfToT[counter] = matrixOfToT[u][s];
958  vectorOfCharge[counter] = matrixOfCharge[u][s];
959  ++counter;
960  }
961  }
962 
963  ATH_MSG_VERBOSE( "matrixOfToT converted in a std::vector<float> " );
964 
965  ATH_MSG_VERBOSE( "... and saved " );
966  // Add information to xAOD
967  AUXDATA(xprd, int, NN_sizeX) = sizeX;
968  AUXDATA(xprd, int, NN_sizeY) = sizeY;
969 
970  AUXDATA(xprd, float, NN_phiBS) = angle;
971  AUXDATA(xprd, float, NN_thetaBS) = boweta;
972 
973  AUXDATA(xprd, std::vector<float>, NN_matrixOfToT) = vectorOfToT;
974  AUXDATA(xprd, std::vector<float>, NN_matrixOfCharge) = vectorOfCharge;
975  AUXDATA(xprd, std::vector<float>, NN_vectorOfPitchesY) = vectorOfPitchesY;
976 
977 
978  AUXDATA(xprd, int, NN_etaPixelIndexWeightedPosition) = etaPixelIndexWeightedPosition;
979  AUXDATA(xprd, int, NN_phiPixelIndexWeightedPosition) = phiPixelIndexWeightedPosition;
980 
981  AUXDATA(xprd, float, NN_localEtaPixelIndexWeightedPosition) = localEtaPixelIndexWeightedPosition;
982  AUXDATA(xprd, float, NN_localPhiPixelIndexWeightedPosition) = localPhiPixelIndexWeightedPosition;
983 
984  ATH_MSG_VERBOSE( "NN training Written" );
985 }
986 
989  const std::vector<SiHit> & matchingHits ) const
990 {
991 
992 
993  unsigned int numberOfSiHits = matchingHits.size();
994 
995  std::vector<float> positionsX(numberOfSiHits,0);
996  std::vector<float> positionsY(numberOfSiHits,0);
997 
998  std::vector<float> positions_indexX(numberOfSiHits,0);
999  std::vector<float> positions_indexY(numberOfSiHits,0);
1000 
1001  std::vector<float> theta(numberOfSiHits,0);
1002  std::vector<float> phi(numberOfSiHits,0);
1003 
1004  std::vector<int> barcode(numberOfSiHits,0);
1005  std::vector<int> pdgid(numberOfSiHits,0);
1006  std::vector<float> chargeDep(numberOfSiHits,0);
1007  std::vector<float> truep(numberOfSiHits,0);
1008 
1009  std::vector<float> pathlengthX(numberOfSiHits,0);
1010  std::vector<float> pathlengthY(numberOfSiHits,0);
1011  std::vector<float> pathlengthZ(numberOfSiHits,0);
1012 
1013  std::vector<int> motherBarcode(numberOfSiHits,0);
1014  std::vector<int> motherPdgid(numberOfSiHits,0);
1015 
1016 
1017 
1018  // Check if we have detector element -- needed to find the local position of the SiHits
1019  const InDetDD::SiDetectorElement* de = pixelCluster->detectorElement();
1020  if(!de)
1021  return;
1022 
1023  InDetDD::SiCellId cellIdWeightedPosition = getCellIdWeightedPosition( pixelCluster );
1024 
1025  const InDetDD::PixelModuleDesign* design(dynamic_cast<const InDetDD::PixelModuleDesign*>(&de->design()));
1026  if (not design) {
1027  ATH_MSG_WARNING("PixelModuleDesign was not retrieved in function 'addNNTruthInfo'");
1028  return;
1029  }
1030  // lorentz shift correction
1031  double shift = m_lorentzAngleTool->getLorentzShift(de->identifyHash(),Gaudi::Hive::currentContext());
1032  unsigned hitNumber(0);
1033  for( const auto& siHit : matchingHits ){
1034 
1035  HepGeom::Point3D<double> averagePosition = (siHit.localStartPosition() + siHit.localEndPosition()) * 0.5;
1036 
1037  ATH_MSG_VERBOSE("Truth Part X: " << averagePosition.y() << " shift " << shift << " Y: " << averagePosition.z() );
1038 
1039  // position lorentz shift corrected
1040  float YposC = averagePosition.y()-shift;
1041 
1042  if (std::abs(YposC)>design->width()/2 &&
1043  std::abs(averagePosition.y())<design->width()/2)
1044  {
1045  if (YposC>design->width()/2)
1046  {
1047  YposC=design->width()/2-1e-6;
1048  } else if (YposC<-design->width()/2)
1049  {
1050  YposC=-design->width()/2+1e-6;
1051  }
1052  }
1053 
1054  positionsX[hitNumber] = YposC;
1055  positionsY[hitNumber] = averagePosition.z();
1056 
1057  HepGeom::Point3D<double> deltaPosition = siHit.localEndPosition() - siHit.localStartPosition();
1058 
1059  pathlengthX[hitNumber] = deltaPosition.y();
1060  pathlengthY[hitNumber] = deltaPosition.z();
1061  pathlengthZ[hitNumber] = deltaPosition.x();
1062 
1063 
1064  // Here we convert the hit position to the right frame
1065  Amg::Vector2D siLocalTruthPosition = de->hitLocalToLocal(averagePosition.z(), YposC);
1066  InDetDD::SiCellId cellIdOfTruthPosition = design->cellIdOfPosition(siLocalTruthPosition);
1067 
1068 
1069 // InDetDD::SiLocalPosition siLocalTruthPosition(averagePosition.z(),YposC ) ;
1070 // InDetDD::SiCellId cellIdOfTruthPosition =design->cellIdOfPosition(siLocalTruthPosition);
1071 
1072  int truthEtaIndex = cellIdOfTruthPosition.etaIndex();
1073  int truthPhiIndex = cellIdOfTruthPosition.phiIndex();
1074 
1075  InDetDD::SiDiodesParameters diodeParameters = design->parameters(cellIdOfTruthPosition);
1076  double pitchY = diodeParameters.width().xEta();
1077  double pitchX = diodeParameters.width().xPhi();
1078 
1079  // pixel center
1080  // SiLocalPosition PixelModuleDesign::positionFromColumnRow(const int column, const int row) const;
1081  //
1082  // Given row and column index of diode, returns position of diode center
1083  // ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId & cellId) or
1084  // rawLocalPositionOfCell method in SiDetectorElement.
1085  // DEPRECATED (but used in numerous places)
1086  //
1087  // Comment by Hide (referring the original comment in the code) : 2015-02-04
1088  // I automatically replaced column to etaPixelIndex and row to phiPixelIndex here. It was bofore:
1089  // InDetDD::SiLocalPosition siLocalPosition( design->positionFromColumnRow(truthColumn,truthRow) );
1090  //
1091  // Then I assume the argument of column/row in this function is in offline manner, not the real hardware column/row.
1092  //
1093  InDetDD::SiLocalPosition siLocalPositionCenter(design->positionFromColumnRow(truthEtaIndex,truthPhiIndex));
1094  double pixelCenterY = siLocalPositionCenter.xEta();
1095  double pixelCenterX = siLocalPositionCenter.xPhi();
1096 
1097 
1098  // truth index
1099 // double truthIndexY = truthEtaIndex + (averagePosition.z() - pixelCenterY)/pitchY;
1100 // double truthIndexX = truthPhiIndex + (YposC - pixelCenterX)/pitchX;
1101  double truthIndexY = truthEtaIndex + (siLocalTruthPosition[Trk::distEta] - pixelCenterY)/pitchY;
1102  double truthIndexX = truthPhiIndex + (siLocalTruthPosition[Trk::distPhi] - pixelCenterX)/pitchX;
1103 
1104 
1105  positions_indexX[hitNumber] = truthIndexX - cellIdWeightedPosition.phiIndex();
1106  positions_indexY[hitNumber] = truthIndexY - cellIdWeightedPosition.etaIndex();
1107 
1108  HepGeom::Point3D<double> diffPositions = (siHit.localEndPosition() - siHit.localStartPosition());
1109  double bowphi = std::atan2( diffPositions.y(), diffPositions.x() );
1110 
1111 
1112  //Truth Track incident angle theta
1113  theta[hitNumber] = std::atan2(diffPositions.z() ,diffPositions.x());
1114  //Truth track incident angle phi -- correct for lorentz angle
1115  float tanlorentz = m_lorentzAngleTool->getTanLorentzAngle(de->identifyHash(),Gaudi::Hive::currentContext());
1116 
1117  int readoutside = design->readoutSide();
1118  phi[hitNumber] = std::atan(std::tan(bowphi)-readoutside*tanlorentz);
1119  const HepMcParticleLink& HMPL = siHit.particleLink();
1120  if (HMPL.isValid()){
1121  barcode[hitNumber] = HepMC::barcode(HMPL);
1122  const auto particle = HMPL.cptr();
1123  pdgid[hitNumber] = particle->pdg_id();
1124  HepMC::FourVector mom=particle->momentum();
1125  truep[hitNumber] = std::sqrt(mom.x()*mom.x()+mom.y()*mom.y()+mom.z()*mom.z());
1126  const auto vertex = particle->production_vertex();
1127 //AV Please note that taking the first particle as a mother is ambiguous.
1128 #ifdef HEPMC3
1129  if ( vertex && !vertex->particles_in().empty()){
1130  const auto& mother_of_particle=vertex->particles_in().front();
1131  motherBarcode[hitNumber] = HepMC::barcode(mother_of_particle);
1132  motherPdgid[hitNumber] = mother_of_particle->pdg_id();
1133  }
1134 #else
1135  if ( vertex ){
1136  if( vertex->particles_in_const_begin() != vertex->particles_in_const_end() ){
1137  motherBarcode[hitNumber] = HepMC::barcode(*vertex->particles_in_const_begin());
1138  motherPdgid[hitNumber] = (*vertex->particles_in_const_begin())->pdg_id();
1139  }
1140  }
1141 #endif
1142  }
1143  chargeDep[hitNumber] = siHit.energyLoss() ;
1144 
1145  ++hitNumber;
1146  }
1147 
1148 
1149  AUXDATA(xprd, std::vector<float>, NN_positionsX) = positionsX;
1150  AUXDATA(xprd, std::vector<float>, NN_positionsY) = positionsY;
1151 
1152  AUXDATA(xprd, std::vector<float>, NN_positions_indexX) = positions_indexX;
1153  AUXDATA(xprd, std::vector<float>, NN_positions_indexY) = positions_indexY;
1154 
1155  AUXDATA(xprd, std::vector<float>, NN_theta) = theta;
1156  AUXDATA(xprd, std::vector<float>, NN_phi) = phi;
1157 
1158  AUXDATA(xprd, std::vector<int>, NN_barcode) = barcode;
1159  AUXDATA(xprd, std::vector<int>, NN_pdgid) = pdgid;
1160  AUXDATA(xprd, std::vector<float>, NN_energyDep) = chargeDep;
1161  AUXDATA(xprd, std::vector<float>, NN_trueP) = truep;
1162 
1163  AUXDATA(xprd, std::vector<int>, NN_motherBarcode) = motherBarcode;
1164  AUXDATA(xprd, std::vector<int>, NN_motherPdgid) = motherPdgid;
1165 
1166 
1167  AUXDATA(xprd, std::vector<float>, NN_pathlengthX) = pathlengthX;
1168  AUXDATA(xprd, std::vector<float>, NN_pathlengthY) = pathlengthY;
1169  AUXDATA(xprd, std::vector<float>, NN_pathlengthZ) = pathlengthZ;
1170 
1171 
1172 }
1173 
1174 
1175 
1176 
1178  int *rphiPixelIndexMin,
1179  int *rphiPixelIndexMax,
1180  int *retaPixelIndexMin,
1181  int *retaPixelIndexMax ) const
1182 {
1183 
1184  const InDetDD::SiDetectorElement* de = pixelCluster->detectorElement();
1185  if (de==nullptr) {
1186  ATH_MSG_ERROR("Could not get detector element");
1187  return {};
1188  }
1189 
1190  const InDetDD::PixelModuleDesign* design(dynamic_cast<const InDetDD::PixelModuleDesign*>(&de->design()));
1191  if (not design) {
1192  ATH_MSG_WARNING("PixelModuleDesign was not retrieved in function 'getCellIdWeightedPosition'");
1193  return {};
1194  }
1195  const std::vector<Identifier>& rdos = pixelCluster->rdoList();
1196 
1197  ATH_MSG_VERBOSE( "Number of RDOs: " << rdos.size() );
1198  const std::vector<float>& chList = pixelCluster->chargeList();
1199 
1200  ATH_MSG_VERBOSE( "Number of charges: " << chList.size() );
1201  std::vector<Identifier>::const_iterator rdosBegin = rdos.begin();
1202  std::vector<Identifier>::const_iterator rdosEnd = rdos.end();
1203 
1204  auto charge = chList.begin();
1205 
1206  InDetDD::SiLocalPosition sumOfWeightedPositions(0,0,0);
1207  double sumOfCharge=0;
1208 
1209  int phiPixelIndexMin = 99999;
1210  int phiPixelIndexMax = -99999;
1211  int etaPixelIndexMin = 99999;
1212  int etaPixelIndexMax = -99999;
1213 
1214  for (; rdosBegin!= rdosEnd; ++rdosBegin, ++charge)
1215  {
1216 
1217  Identifier rId = *rdosBegin;
1218  int phiPixelIndex = m_PixelHelper->phi_index(rId);
1219  int etaPixelIndex = m_PixelHelper->eta_index(rId);
1220 
1221  ATH_MSG_VERBOSE(" Adding pixel phiPixelIndex: " << phiPixelIndex << " etaPixelIndex: " << etaPixelIndex << " charge: " << *charge );
1222 
1223  // SiLocalPosition PixelModuleDesign::positionFromColumnRow(const int column, const int row) const;
1224  //
1225  // Given row and column index of diode, returns position of diode center
1226  // ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId & cellId) or
1227  // rawLocalPositionOfCell method in SiDetectorElement.
1228  // DEPRECATED (but used in numerous places)
1229  //
1230  // Comment by Hide (referring the original comment in the code): 2015-02-04
1231  // I automatically replaced column to etaPixelIndex and row to phiPixelIndex here. It was bofore:
1232  // InDetDD::SiLocalPosition siLocalPosition( design->positionFromColumnRow(column,row) );
1233  //
1234  // Then I assume the argument of column/row in this function is in offline manner, not the real hardware column/row.
1235  //
1236  InDetDD::SiLocalPosition siLocalPosition( design->positionFromColumnRow(etaPixelIndex,phiPixelIndex) );
1237  ATH_MSG_VERBOSE ( "Local Position: Row = " << siLocalPosition.xRow() << ", Col = " << siLocalPosition.xColumn() );
1238 
1239  sumOfWeightedPositions += (*charge)*siLocalPosition;
1240  sumOfCharge += (*charge);
1241 
1242  if (phiPixelIndex < phiPixelIndexMin)
1243  phiPixelIndexMin = phiPixelIndex;
1244 
1245  if (phiPixelIndex > phiPixelIndexMax)
1246  phiPixelIndexMax = phiPixelIndex;
1247 
1248  if (etaPixelIndex < etaPixelIndexMin)
1249  etaPixelIndexMin = etaPixelIndex;
1250 
1251  if (etaPixelIndex > etaPixelIndexMax)
1252  etaPixelIndexMax = etaPixelIndex;
1253 
1254  }
1255  sumOfWeightedPositions /= sumOfCharge;
1256 
1257  ATH_MSG_VERBOSE ( "Wighted position: Row = " << sumOfWeightedPositions.xRow() << ", Col = " << sumOfWeightedPositions.xColumn() );
1258 
1259  if(rphiPixelIndexMin) *rphiPixelIndexMin = phiPixelIndexMin;
1260  if(rphiPixelIndexMax) *rphiPixelIndexMax = phiPixelIndexMax;
1261  if(retaPixelIndexMin) *retaPixelIndexMin = etaPixelIndexMin;
1262  if(retaPixelIndexMax) *retaPixelIndexMax = etaPixelIndexMax;
1263 
1264  //what you want to know is simple:
1265  //just the phiPixelIndex and etaPixelIndex of this average position!
1266 
1267  InDetDD::SiCellId cellIdWeightedPosition=design->cellIdOfPosition(sumOfWeightedPositions);
1268 
1269 
1270  return cellIdWeightedPosition;
1271 
1272 }
1273 
1274 
1275 
1277 //
1278 // Finalize method:
1279 //
1282 {
1284  ATH_MSG_INFO("Missing truth particles " << m_missingTruthParticle << " missing parent: " << m_missingParentParticle
1285  << " have " << m_haveTruthLink);
1286  }
1287  return StatusCode::SUCCESS;
1288 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AUXDATA
#define AUXDATA(OBJ, TYP, NAME)
Definition: PixelPrepDataToxAOD.cxx:37
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
PixelChargeCalibCondData::getLegacyFitParameters
PixelChargeCalib::LegacyFitParameters getLegacyFitParameters(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
Definition: PixelChargeCalibCondData.cxx:120
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
query_example.row
row
Definition: query_example.py:24
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
PixelID::phi_index
int phi_index(const Identifier &id) const
Definition: PixelID.h:658
InDetDD::SolidStateDetectorElementBase::cellIdOfPosition
SiCellId cellIdOfPosition(const Amg::Vector2D &localPos) const
As in previous method but returns SiCellId.
Definition: SolidStateDetectorElementBase.cxx:224
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
SiHit::localEndPosition
HepGeom::Point3D< double > localEndPosition() const
Definition: SiHit.cxx:153
max
#define max(a, b)
Definition: cfImp.cxx:41
PixelPrepDataToxAOD::PixelPrepDataToxAOD
PixelPrepDataToxAOD(const std::string &name, ISvcLocator *pSvcLocator)
Definition: PixelPrepDataToxAOD.cxx:51
PixelPrepDataToxAOD::m_SDOcontainer_key
SG::ReadHandleKey< InDetSimDataCollection > m_SDOcontainer_key
Definition: PixelPrepDataToxAOD.h:158
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
InDetDD::PixelModuleDesign
Definition: PixelModuleDesign.h:48
Trk::ClusterSplitProbabilityContainer::ProbabilityInfo::isSplit
bool isSplit() const
Definition: ClusterSplitProbabilityContainer.h:27
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
PixelPrepDataToxAOD::addSiHitInformation
void addSiHitInformation(xAOD::TrackMeasurementValidation *xprd, const InDet::PixelCluster *prd, const std::vector< SiHit > &matchingHits) const
Definition: PixelPrepDataToxAOD.cxx:505
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
PixelPrepDataToxAOD::m_firstEventWarnings
bool m_firstEventWarnings
Definition: PixelPrepDataToxAOD.h:153
InDetSecVtxTruthMatchUtils::isFake
bool isFake(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:60
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
PixelPrepDataToxAOD::addSDOInformation
std::vector< std::vector< int > > addSDOInformation(xAOD::TrackMeasurementValidation *xprd, const InDet::PixelCluster *prd, const InDetSimDataCollection &sdoCollection) const
Definition: PixelPrepDataToxAOD.cxx:472
SiHit.h
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
PixelID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: PixelID.h:619
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TrackMeasurementValidationAuxContainer.h
PixelPrepDataToxAOD::m_clustercontainer_key
SG::ReadHandleKey< InDet::PixelClusterContainer > m_clustercontainer_key
Definition: PixelPrepDataToxAOD.h:156
xAOD::TrackMeasurementValidation
TrackMeasurementValidation_v1 TrackMeasurementValidation
Reference the current persistent version:
Definition: TrackMeasurementValidation.h:13
Trk::ClusterSplitProbabilityContainer::ProbabilityInfo
Definition: ClusterSplitProbabilityContainer.h:22
PRD_MultiTruthCollection
A PRD is mapped onto all contributing particles.
Definition: PRD_MultiTruthCollection.h:24
PixelPrepDataToxAOD::m_missingTruthParticle
std::atomic< unsigned int > m_missingTruthParticle
Definition: PixelPrepDataToxAOD.h:151
GenVertex.h
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
PixelPrepDataToxAOD::m_writeSDOs
bool m_writeSDOs
Definition: PixelPrepDataToxAOD.h:115
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
InDetDD::SolidStateDetectorElementBase::etaAxis
const Amg::Vector3D & etaAxis() const
Definition: SolidStateDetectorElementBase.cxx:88
PixelPrepDataToxAOD::m_need_sihits
bool m_need_sihits
Definition: PixelPrepDataToxAOD.h:154
PixelPrepDataToxAOD::m_PixelHelper
const PixelID * m_PixelHelper
Definition: PixelPrepDataToxAOD.h:112
HepMC::INVALID_PARTICLE_ID
constexpr int INVALID_PARTICLE_ID
Definition: MagicNumbers.h:56
InDetDD::SiCellId::isValid
bool isValid() const
Test if its in a valid state.
Definition: SiCellId.h:136
InDetDD::PixelDiodeType
PixelDiodeType
Definition: PixelReadoutDefinitions.h:25
PixelPrepDataToxAOD::m_condDCSStatusKey
SG::ReadCondHandleKey< PixelDCSStatusData > m_condDCSStatusKey
Definition: PixelPrepDataToxAOD.h:132
ChargeCalibParameters.h
Structs for holding charge calibration parameterisation and data.
PixelPrepDataToxAOD::findAllHitsCompatibleWithCluster
std::vector< SiHit > findAllHitsCompatibleWithCluster(const InDet::PixelCluster *prd, const std::vector< const SiHit * > *sihits, std::vector< std::vector< int > > &trkBCs) const
Definition: PixelPrepDataToxAOD.cxx:576
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:206
Trk::PrepRawData::rdoList
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
Identifier::get_compact
value_type get_compact() const
Get the compact id.
PixelPrepDataToxAOD.h
PixelPrepDataToxAOD::initialize
virtual StatusCode initialize()
Definition: PixelPrepDataToxAOD.cxx:87
InDetSimDataCollection
Definition: InDetSimDataCollection.h:25
PixelPrepDataToxAOD::m_pixelSummary
ToolHandle< IInDetConditionsTool > m_pixelSummary
Definition: PixelPrepDataToxAOD.h:141
InDetDD::SiCellId::phiIndex
int phiIndex() const
Get phi index. Equivalent to strip().
Definition: SiCellId.h:122
xAOD::TrackMeasurementValidation_v1::setRdoIdentifierList
void setRdoIdentifierList(const std::vector< uint64_t > &rdoIdentifierList)
Sets the list of RDO identifiers.
InDetSecVtxTruthMatchUtils::isSplit
bool isSplit(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:56
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
Identifier::is_valid
bool is_valid() const
Check if id is in a valid state.
HepMC::is_same_particle
bool is_same_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same particle.
Definition: MagicNumbers.h:354
PixelPrepDataToxAOD::getCellIdWeightedPosition
InDetDD::SiCellId getCellIdWeightedPosition(const InDet::PixelCluster *pixelCluster, int *rrowMin=0, int *rrowMax=0, int *rcolMin=0, int *rcolMax=0) const
Definition: PixelPrepDataToxAOD.cxx:1177
GenParticle.h
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
InDetDD::SolidStateDetectorElementBase::identifyHash
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
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
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
SiHit
Definition: SiHit.h:19
PixelPrepDataToxAOD::m_chargeDataKey
SG::ReadCondHandleKey< PixelChargeCalibCondData > m_chargeDataKey
Definition: PixelPrepDataToxAOD.h:126
InDetDD::SiLocalPosition::xColumn
double xColumn() const
positions for Pixel:
Definition: SiLocalPosition.h:143
InDetDD::SiLocalPosition
Definition: SiLocalPosition.h:31
InDetDD::PixelModuleDesign::positionFromColumnRow
SiLocalPosition positionFromColumnRow(const int column, const int row) const
Given row and column index of a diode, return position of diode center ALTERNATIVE/PREFERED way is to...
Definition: PixelModuleDesign.cxx:219
InDetDD::SiLocalPosition::xPhi
double xPhi() const
position along phi direction:
Definition: SiLocalPosition.h:123
PixelPrepDataToxAOD::m_writeExtendedPRDinformation
bool m_writeExtendedPRDinformation
Definition: PixelPrepDataToxAOD.h:119
xAOD::TrackMeasurementValidation_v1
Class describing a TrackMeasurementValidation.
Definition: TrackMeasurementValidation_v1.h:27
PixelPrepDataToxAOD::m_clusterSplitProbContainer
SG::ReadHandleKey< Trk::ClusterSplitProbabilityContainer > m_clusterSplitProbContainer
Definition: PixelPrepDataToxAOD.h:147
PixelPrepDataToxAOD::addNNTruthInfo
void addNNTruthInfo(xAOD::TrackMeasurementValidation *xprd, const InDet::PixelCluster *prd, const std::vector< SiHit > &matchingHits) const
Definition: PixelPrepDataToxAOD.cxx:987
InDetDD::SiDetectorElement::cellIdFromIdentifier
virtual SiCellId cellIdFromIdentifier(const Identifier &identifier) const override final
SiCellId from Identifier.
Definition: SiDetectorElement.cxx:120
InDetDD::SiCellId::etaIndex
int etaIndex() const
Get eta index.
Definition: SiCellId.h:114
PixelPrepDataToxAOD::addRdoInformation
void addRdoInformation(xAOD::TrackMeasurementValidation *xprd, const InDet::PixelCluster *pixelCluster, const PixelChargeCalibCondData *calibData) const
Definition: PixelPrepDataToxAOD.cxx:709
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
PixelID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: PixelID.h:387
SimpleVector.h
PixelPrepDataToxAOD::m_sihitContainer_key
SG::ReadHandleKey< SiHitCollection > m_sihitContainer_key
Definition: PixelPrepDataToxAOD.h:157
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::distEta
@ distEta
readout for silicon
Definition: ParamDefs.h:51
xAOD::TrackMeasurementValidation_v1::setLocalPosition
void setLocalPosition(float localX, float localY)
Sets the local position.
python.Dumpers.barcodes
def barcodes(beg, end, sz)
Definition: Dumpers.py:2800
lumiFormat.i
int i
Definition: lumiFormat.py:85
PixelPrepDataToxAOD::finalize
virtual StatusCode finalize()
Definition: PixelPrepDataToxAOD.cxx:1281
InDetDD::SiLocalPosition::xEta
double xEta() const
position along eta direction:
Definition: SiLocalPosition.h:118
PixelPrepDataToxAOD::m_writeRDOinformation
bool m_writeRDOinformation
Definition: PixelPrepDataToxAOD.h:118
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PixelPrepDataToxAOD::m_write_xaod_key
SG::WriteHandleKey< xAOD::TrackMeasurementValidationContainer > m_write_xaod_key
Definition: PixelPrepDataToxAOD.h:163
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
angle
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Definition: TRTDetectorFactory_Full.cxx:73
PixelPrepDataToxAOD::m_useTruthInfo
bool m_useTruthInfo
Definition: PixelPrepDataToxAOD.h:114
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
PixelChargeCalibCondData
Definition: PixelChargeCalibCondData.h:24
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
InDetDD::SiLocalPosition::xRow
double xRow() const
Definition: SiLocalPosition.h:148
PixelID::eta_index
int eta_index(const Identifier &id) const
Definition: PixelID.h:664
PixelPrepDataToxAOD::m_lorentzAngleTool
ToolHandle< ISiLorentzAngleTool > m_lorentzAngleTool
Definition: PixelPrepDataToxAOD.h:144
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
PixelPrepDataToxAOD::m_condDCSStateKey
SG::ReadCondHandleKey< PixelDCSStateData > m_condDCSStateKey
Definition: PixelPrepDataToxAOD.h:129
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
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
xAOD::TrackMeasurementValidation_v1::setIdentifier
void setIdentifier(uint64_t identifier)
Sets the identifier.
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
PixelPrepDataToxAOD::m_truthParticleLinks
SG::ReadHandleKey< xAODTruthParticleLinkVector > m_truthParticleLinks
Definition: PixelPrepDataToxAOD.h:161
InDetDD::SolidStateDetectorElementBase::normal
virtual const Amg::Vector3D & normal() const override final
Get reconstruction local normal axes in global frame.
InDet::SiCluster::detectorElement
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
LB_AnalMapSplitter.tot
tot
Definition: LB_AnalMapSplitter.py:46
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Trk::distPhi
@ distPhi
Definition: ParamDefs.h:50
InDetDD::SolidStateDetectorElementBase::hitLocalToLocal
Amg::Vector2D hitLocalToLocal(double xEta, double xPhi) const
Simulation/Hit local frame to reconstruction local frame.
Definition: SolidStateDetectorElementBase.cxx:95
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
xAOD::TrackMeasurementValidation_v1::setGlobalPosition
void setGlobalPosition(float globalX, float globalY, float globalZ)
Sets the global position.
Definition: TrackMeasurementValidation_v1.cxx:50
PixelPrepDataToxAOD::m_readKeyHV
SG::ReadCondHandleKey< PixelDCSHVData > m_readKeyHV
Definition: PixelPrepDataToxAOD.h:138
xAOD::PixelClusterContainer
PixelClusterContainer_v1 PixelClusterContainer
Define the version of the pixel cluster container.
Definition: Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/PixelClusterContainer.h:14
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
PixelClusterContainer.h
PixelDCSStateData::getModuleStatus
int getModuleStatus(const int chanNum) const
Definition: PixelDCSStateData.cxx:11
xAOD::TrackMeasurementValidation_v1::setLocalPositionError
void setLocalPositionError(float localXError, float localYError, float localXYCorrelation)
Sets the local position error.
Definition: TrackMeasurementValidation_v1.cxx:37
charge
double charge(const T &p)
Definition: AtlasPID.h:538
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)
PixelID::wafer_hash_max
size_type wafer_hash_max(void) const
Definition: PixelID.cxx:907
PixelPrepDataToxAOD::m_multiTruth_key
SG::ReadHandleKey< PRD_MultiTruthCollection > m_multiTruth_key
Definition: PixelPrepDataToxAOD.h:159
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
xAOD::EgammaHelpers::numberOfSiHits
std::size_t numberOfSiHits(const xAOD::TrackParticle *tp)
return the number of Si hits in the track particle
Definition: ElectronxAODHelpers.cxx:66
query_example.col
col
Definition: query_example.py:7
PixelPrepDataToxAOD::m_writeNNinformation
bool m_writeNNinformation
Definition: PixelPrepDataToxAOD.h:117
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
PixelPrepDataToxAOD::m_write_offsets
SG::WriteHandleKey< std::vector< unsigned int > > m_write_offsets
Definition: PixelPrepDataToxAOD.h:164
InDetDD::SiCellId
Definition: SiCellId.h:29
InDet::PixelCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:49
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
Trk::pixelCluster
@ pixelCluster
Definition: MeasurementType.h:22
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
PixelModuleDesign.h
PixelPrepDataToxAOD::m_useSiHitsGeometryMatching
bool m_useSiHitsGeometryMatching
Definition: PixelPrepDataToxAOD.h:120
InDetDD::SolidStateDetectorElementBase::globalPosition
HepGeom::Point3D< double > globalPosition(const HepGeom::Point3D< double > &localPos) const
transform a reconstruction local position into a global position (inline):
InDetDD::SolidStateDetectorElementBase::phiAxis
const Amg::Vector3D & phiAxis() const
Definition: SolidStateDetectorElementBase.cxx:74
InDetDD::PixelDiodeType::NONE
@ NONE
InDetSimDataCollection.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAODTruthParticleLinkVector
Definition: xAODTruthParticleLink.h:26
PixelDCSHVData::getBiasVoltage
float getBiasVoltage(const int chanNum) const
Definition: PixelDCSHVData.cxx:11
InDet::SiWidth
Definition: SiWidth.h:25
TrackMeasurementValidation.h
InDet::SiWidth::colRow
const Amg::Vector2D & colRow() const
Definition: SiWidth.h:115
InDetDD::SiDiodesParameters::width
const SiLocalPosition & width() const
width of the diodes:
Definition: SiDiodesParameters.h:96
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
PRD_MultiTruthCollection.h
TrackMeasurementValidationContainer.h
Trk::ClusterSplitProbabilityContainer::ProbabilityInfo::splitProbability1
float splitProbability1() const
Definition: ClusterSplitProbabilityContainer.h:24
Trk::ClusterSplitProbabilityContainer::splitProbability
const ProbabilityInfo & splitProbability(const PrepRawData *cluster) const
Definition: ClusterSplitProbabilityContainer.h:35
PixelPrepDataToxAOD::m_readKeyTemp
SG::ReadCondHandleKey< PixelDCSTempData > m_readKeyTemp
Definition: PixelPrepDataToxAOD.h:135
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
PixelPrepDataToxAOD::addNNInformation
void addNNInformation(xAOD::TrackMeasurementValidation *xprd, const InDet::PixelCluster *pixelCluster, const unsigned int SizeX, const unsigned int SizeY) const
Definition: PixelPrepDataToxAOD.cxx:774
PixelPrepDataToxAOD::execute
virtual StatusCode execute()
Definition: PixelPrepDataToxAOD.cxx:130
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
PixelPrepDataToxAOD::m_pixelReadout
ServiceHandle< InDetDD::IPixelReadoutManager > m_pixelReadout
Definition: PixelPrepDataToxAOD.h:123
InDetDD::SiDetectorElement::design
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
PixelID::phi_module
int phi_module(const Identifier &id) const
Definition: PixelID.h:644
test_pyathena.counter
counter
Definition: test_pyathena.py:15
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Trk::ClusterSplitProbabilityContainer::getNoSplitProbability
static const ProbabilityInfo & getNoSplitProbability()
Definition: ClusterSplitProbabilityContainer.h:33
run2time.chList
chList
Definition: run2time.py:26
readCCLHist.float
float
Definition: readCCLHist.py:83
InDetDD::SolidStateDetectorElementBase::identify
virtual Identifier identify() const override final
identifier of this detector element (inline)
Trk::ClusterSplitProbabilityContainer::ProbabilityInfo::splitProbability2
float splitProbability2() const
Definition: ClusterSplitProbabilityContainer.h:25
NSWL1::centroid
Vertex centroid(const Polygon &p)
Definition: GeoUtils.cxx:59
SiHit::localStartPosition
HepGeom::Point3D< double > localStartPosition() const
Definition: SiHit.cxx:146
PixelPrepDataToxAOD::m_missingParentParticle
std::atomic< unsigned int > m_missingParentParticle
Definition: PixelPrepDataToxAOD.h:152
PixelPrepDataToxAOD::m_writeSiHits
bool m_writeSiHits
Definition: PixelPrepDataToxAOD.h:116
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
PixelDCSTempData::getTemperature
float getTemperature(const int chanNum) const
Definition: PixelDCSTemp.cxx:11
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition: ReadCondHandle.h:67
InDetDD::SiDiodesParameters
Definition: SiDiodesParameters.h:25
PixelPrepDataToxAOD::m_haveTruthLink
std::atomic< unsigned int > m_haveTruthLink
Definition: PixelPrepDataToxAOD.h:150
Identifier
Definition: IdentifierFieldParser.cxx:14