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  if (!m_clusterSplitProbContainer.key().empty()) {
170  if (!splitProbContainer.isValid()) {
171  ATH_MSG_FATAL("Failed to get cluster splitting probability container " << m_clusterSplitProbContainer);
172  }
173  }
174 
175  std::vector<std::vector<const SiHit*>> siHits(m_PixelHelper->wafer_hash_max());
176  if (m_need_sihits) {
177  SG::ReadHandle<SiHitCollection> siHitCollectionHandle(m_sihitContainer_key, ctx);
178  if (siHitCollectionHandle.isValid()) {
179  for (const SiHit& siHit: *siHitCollectionHandle) {
180  // Check if it is a Pixel hit
181  if (!siHit.isPixel()) continue;
182 
183  Identifier wafer_id(m_PixelHelper->wafer_id(siHit.getBarrelEndcap(),
184  siHit.getLayerDisk(),
185  siHit.getPhiModule(),
186  siHit.getEtaModule()));
187  IdentifierHash wafer_hash(m_PixelHelper->wafer_hash(wafer_id));
188  if (wafer_hash>=m_PixelHelper->wafer_hash_max()) continue;
189  siHits[wafer_hash].push_back(&siHit);
190  }
191  } else if (m_firstEventWarnings) {
192  ATH_MSG_WARNING("SiHit information requested, but SiHit collection not available!");
193  }
194  }
195 
196  const PixelChargeCalibCondData *calibData=nullptr;
197  if (m_writeRDOinformation) {
199  if (!calibData_handle.isValid()) {
200  ATH_MSG_FATAL("Failed to get PixelChargeCalibCondData with key " << m_chargeDataKey);
201  }
202  calibData=calibData_handle.cptr();
203  }
204 
205  // Create the xAOD container and its auxiliary store:
207  ATH_CHECK(xaod.record(std::make_unique<xAOD::TrackMeasurementValidationContainer>(),
208  std::make_unique<xAOD::TrackMeasurementValidationAuxContainer>()));
209 
211  ATH_CHECK(offsets.record(std::make_unique<std::vector<unsigned int>>(m_PixelHelper->wafer_hash_max(), 0)));
212 
213  unsigned int have_truth_link=0u;
214  unsigned int missing_truth_particle=0u;
215  unsigned int missing_parent_particle=0u;
216  // Loop over the container
217  unsigned int counter(0);
218 
222 
223  std::unordered_map< unsigned int , std::vector<unsigned int> > cluster_map;
224  for( const auto clusterCollection : * PixelClusterContainer ){
225 
226  //Fill Offset container
227  (*offsets)[clusterCollection->identifyHash()] = counter;
228 
229  // skip empty collections
230  if( clusterCollection->empty() ) continue;
231 
232  // loop over collection and convert to xAOD
233  for( const InDet::PixelCluster* prd : *clusterCollection ){
234  ++counter;
235 
236  Identifier clusterId = prd->identify();
237  if ( !clusterId.is_valid() ) {
238  ATH_MSG_WARNING("Pixel cluster identifier is not valid");
239  }
240 
241  // create and add xAOD object
243  unsigned int cluster_idx = xaod->size();
244  xaod->push_back(xprd);
245 
246  //Set Identifier
247  xprd->setIdentifier( clusterId.get_compact() );
248 
249  //Set Global Position
250  Amg::Vector3D gpos = prd->globalPosition();
251  xprd->setGlobalPosition(gpos.x(),gpos.y(),gpos.z());
252 
253  //Set Local Position
254  const Amg::Vector2D& locpos = prd->localPosition();
255 
256  // Set local error matrix
257  xprd->setLocalPosition( locpos.x(), locpos.y() );
258 
259  const Amg::MatrixX& localCov = prd->localCovariance();
260  //std::cout << localCov << std::endl;
261  if(localCov.size() == 1){
262  //std::cout << "Size == 1" << std::endl;
263  xprd->setLocalPositionError( localCov(0,0), 0., 0. );
264  } else if(localCov.size() == 4){
265  //std::cout << "Size == 2" << std::endl;
266  xprd->setLocalPositionError( localCov(0,0), localCov(1,1), localCov(0,1) );
267  } else {
268  //std::cout << "Size == "<< localCov.size() << std::endl;
269  xprd->setLocalPositionError(0.,0.,0.);
270  }
271 
272  // Set vector of hit identifiers
273  std::vector< uint64_t > rdoIdentifierList;
274  rdoIdentifierList.reserve(prd->rdoList().size());
275  int rowmin=9999; int rowmax=-9999;
276  int colmin=9999; int colmax=-9999;
277  for( const auto &hitIdentifier : prd->rdoList() ){
278  rdoIdentifierList.push_back( hitIdentifier.get_compact() );
279  //May want to addinformation about the individual hits here
280  int row = m_PixelHelper->phi_index(hitIdentifier);
281  int col = m_PixelHelper->eta_index(hitIdentifier);
282  if(rowmin > row) rowmin = row;
283  if(rowmax < row) rowmax = row;
284  if(colmin > col) colmin = col;
285  if(colmax < col) colmax = col;
286  }
287  xprd->setRdoIdentifierList(rdoIdentifierList);
288 
289  //Add pixel cluster properties
290  AUXDATA(xprd,int,bec) = m_PixelHelper->barrel_ec(clusterId) ;
291  char the_layer = m_PixelHelper->layer_disk(clusterId) ;
292  char the_eta = m_PixelHelper->eta_module(clusterId) ;
293  short the_phi = m_PixelHelper->phi_module(clusterId) ;
294  AUXDATA(xprd,int,layer) = the_layer ;
295  AUXDATA(xprd,int,phi_module) = the_phi ;
296  AUXDATA(xprd,int,eta_module) = the_eta ;
297  AUXDATA(xprd,int,eta_pixel_index) = m_PixelHelper->eta_index(clusterId);
298  AUXDATA(xprd,int,phi_pixel_index) = m_PixelHelper->phi_index(clusterId);
299 
300  cluster_map[ makeKey(the_phi, the_eta, the_layer)].push_back(cluster_idx);
301 
302  const InDet::SiWidth cw = prd->width();
303  AUXDATA(xprd,int,sizePhi) = (int)cw.colRow()[0];
304  AUXDATA(xprd,int,sizeZ) = (int)cw.colRow()[1];
305  AUXDATA(xprd,int,nRDO) = (int)prd->rdoList().size();
306 
307  AUXDATA(xprd,float,charge) = prd->totalCharge();
308  AUXDATA(xprd,int,ToT) = prd->totalToT();
309  AUXDATA(xprd,int,LVL1A) = prd->LVL1A();
310 
311  AUXDATA(xprd,char,isFake) = (char)prd->isFake();
312  AUXDATA(xprd,char,gangedPixel) = (char)prd->gangedPixel();
314  splitProb = splitProbContainer.isValid() ? splitProbContainer->splitProbability(prd) : Trk::ClusterSplitProbabilityContainer::getNoSplitProbability();
315  AUXDATA(xprd,char,isSplit) = static_cast<char>(splitProb.isSplit());
316  AUXDATA(xprd,float,splitProbability1) = splitProb.splitProbability1();
317  AUXDATA(xprd,float,splitProbability2) = splitProb.splitProbability2();
318 
319  // Need to add something to Add the NN splitting information
320  if(m_writeNNinformation) addNNInformation( xprd, prd, 7, 7);
321 
322  // Add information for each contributing hit
324  IdentifierHash moduleHash = clusterCollection->identifyHash();
325  AUXDATA(xprd,int,hasBSError) = (int)m_pixelSummary->hasBSError(moduleHash, ctx);
326  AUXDATA(xprd,int,DCSState) = dcsState->getModuleStatus(moduleHash);
327 
328  float deplVoltage = 0.0;
329  AUXDATA(xprd,float,BiasVoltage) = dcsHV->getBiasVoltage(moduleHash);
330  AUXDATA(xprd,float,Temperature) = dcsTemp->getTemperature(moduleHash);
331  AUXDATA(xprd,float,DepletionVoltage) = deplVoltage;
332 
333  AUXDATA(xprd,float,LorentzShift) = (float)m_lorentzAngleTool->getLorentzShift(moduleHash);
334 
335  assert (calibData);
336  addRdoInformation(xprd, prd, calibData);
337  }
338 
339 
340  // Add the Detector element ID -- not sure if needed as we have the informations above
341  const InDetDD::SiDetectorElement* de = prd->detectorElement();
342  uint64_t detElementId(0);
343  if(de){
344  Identifier detId = de->identify();
345  if ( detId.is_valid() ) {
346  detElementId = detId.get_compact();
347  }
348  }
349  AUXDATA(xprd,uint64_t,detectorElementID) = detElementId;
350 
352  AUXDATA(xprd,int,waferID) = m_PixelHelper->wafer_hash(de->identify());
353 
354  const InDetDD::PixelModuleDesign* design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&de->design());
355  InDetDD::SiLocalPosition pos1 = design->positionFromColumnRow(colmin,rowmin);
356  InDetDD::SiLocalPosition pos2 = design->positionFromColumnRow(colmax,rowmin);
357  InDetDD::SiLocalPosition pos3 = design->positionFromColumnRow(colmin,rowmax);
358  InDetDD::SiLocalPosition pos4 = design->positionFromColumnRow(colmax,rowmax);
359  InDetDD::SiLocalPosition centroid = 0.25*(pos1+pos2+pos3+pos4);
360 
361  AUXDATA(xprd,float,centroid_xphi) = centroid.xPhi();
362  AUXDATA(xprd,float,centroid_xeta) = centroid.xEta();
363 
364  AUXDATA(xprd,float,omegax) = prd->omegax();
365  AUXDATA(xprd,float,omegay) = prd->omegay();
366  }
367 
368  // Use the MultiTruth Collection to get a list of all true particle contributing to the cluster
369  if (prdmtColl) {
370  auto range{prdmtColl->equal_range(clusterId)};
371  if (truth_particle_links) {
372  std::vector<unsigned int> tp_indices;
373  for (auto& i{range.first}; i!=range.second; ++i) {
374  ElementLink<xAOD::TruthParticleContainer> a_truth_particle_link = truth_particle_links->find(i->second);
375  if (a_truth_particle_link) {
376  const xAOD::TruthParticle *truth_particle = *a_truth_particle_link;
377  if (truth_particle) {
378  ++have_truth_link;
379  tp_indices.push_back(static_cast<int>(truth_particle->index()));
380  }
381  else {
382  ++missing_parent_particle;
383  }
384  }
385  else {
386  tp_indices.push_back(std::numeric_limits<unsigned int>::max());
387  ++missing_truth_particle;
388  }
389  }
390  // @TODO provide possibility to move tp_indices to its final destination
391  AUXDATA(xprd,std::vector<unsigned int>, truth_index) = tp_indices;
392  }
393  std::vector<int> barcodes; // FIXME barcode-based - requires xAOD::TrackMeasurementValidation to be migrated away from barcodes
394  for (auto i = range.first; i != range.second; ++i) {
395  barcodes.push_back( HepMC::barcode(i->second) );
396  }
397  // @TODO move vector
398  AUXDATA(xprd,std::vector<int>, truth_barcode) = barcodes;
399  }
400 
401  std::vector< std::vector< int > > sdo_tracks;
402  // Use the SDO Collection to get a list of all true particle contributing to the cluster per readout element
403  // Also get the energy deposited by each true particle per readout element
404  if (sdoCollection) {
405  sdo_tracks = addSDOInformation(xprd, prd, *sdoCollection);
406  }
407 
408  // Now Get the most detailed truth from the SiHits
409  // Note that this could get really slow if there are a lot of hits and clusters
410  if (m_need_sihits) {
411  const std::vector<SiHit> matched_hits = findAllHitsCompatibleWithCluster(prd, &siHits[prd->detectorElement()->identifyHash()], sdo_tracks);
412  if (m_writeSiHits) {
413  addSiHitInformation(xprd, prd, matched_hits);
414  }
415 
416  if (m_writeNNinformation) {
417  addNNTruthInfo(xprd, prd, matched_hits);
418  }
419  }
420  }
421  }
422 
423  for ( auto clusItr = xaod->begin(); clusItr != xaod->end(); ++clusItr ) {
424  AUXDATA(*clusItr,char,broken) = false;
425  }
426  m_haveTruthLink += have_truth_link;
427  m_missingTruthParticle += missing_truth_particle;
428  m_missingParentParticle += missing_parent_particle;
429 
430  static const SG::AuxElement::Accessor<int> acc_layer ("layer");
431  static const SG::AuxElement::Accessor<int> acc_phi_module ("phi_module");
432  static const SG::AuxElement::Accessor<int> acc_eta_module ("eta_module");
433  static const SG::AuxElement::Accessor<std::vector<int> > acc_sihit_barcode ("sihit_barcode");
434  for ( auto clusItr = xaod->begin(); clusItr != xaod->end(); ++clusItr)
435  {
436  auto pixelCluster = *clusItr;
437  int layer = acc_layer(*pixelCluster);
438  std::vector<int> barcodes = acc_sihit_barcode(*pixelCluster);
439 
440  const std::vector< unsigned int> &cluster_idx_list = cluster_map.at( makeKey(acc_phi_module(*pixelCluster), acc_eta_module(*pixelCluster), acc_layer(*pixelCluster) ));
441  for (unsigned int cluster_idx : cluster_idx_list) {
442  auto pixelCluster2 = xaod->at(cluster_idx);
443  if ( acc_layer(*pixelCluster2) != layer )
444  continue;
445  if ( acc_eta_module(*pixelCluster) != acc_eta_module(*pixelCluster2) )
446  continue;
447  if ( acc_phi_module(*pixelCluster) != acc_phi_module(*pixelCluster2) )
448  continue;
449 
450  std::vector<int> barcodes2 = acc_sihit_barcode(*pixelCluster2);
451 
452  for ( auto bc : barcodes ) {
453  if (std::find(barcodes2.begin(), barcodes2.end(), bc ) == barcodes2.end()) continue;
454  static const SG::AuxElement::Accessor<char> acc_broken ("broken");
455  acc_broken(*pixelCluster) = true;
456  acc_broken(*pixelCluster2) = true;
457  break;
458  }
459  }
460  }
461 
462  ATH_MSG_DEBUG( " recorded PixelPrepData objects: size " << xaod->size() );
463 
464  m_firstEventWarnings = false;
465 
466  return StatusCode::SUCCESS;
467 }
468 
469 
471  const InDet::PixelCluster* prd,
472  const InDetSimDataCollection& sdoCollection ) const
473 {
474  std::vector<int> sdo_word;
475  std::vector< std::vector< int > > sdo_depositsBarcode;
476  std::vector< std::vector< float > > sdo_depositsEnergy;
477  // find hit
478  for( const auto &hitIdentifier : prd->rdoList() ){
479  auto pos = sdoCollection.find(hitIdentifier);
480  if( pos == sdoCollection.end() ) continue;
481  sdo_word.push_back( pos->second.word() ) ;
482  std::vector<int> sdoDepBC(pos->second.getdeposits().size(), -1);
483  std::vector<float> sdoDepEnergy(pos->second.getdeposits().size());
484  unsigned int nDepos{0};
485  for (auto& deposit: pos->second.getdeposits()) {
486  if (deposit.first) sdoDepBC[nDepos] = HepMC::barcode(deposit.first);
487  ATH_MSG_DEBUG(" SDO Energy Deposit " << deposit.second ) ;
488  sdoDepEnergy[nDepos] = deposit.second;
489  nDepos++;
490  }
491  sdo_depositsBarcode.push_back( sdoDepBC );
492  sdo_depositsEnergy.push_back( sdoDepEnergy );
493  }
494  AUXDATA(xprd,std::vector<int>,sdo_words) = sdo_word;
495  AUXDATA(xprd,std::vector< std::vector<int> >,sdo_depositsBarcode) = sdo_depositsBarcode;
496  AUXDATA(xprd,std::vector< std::vector<float> >,sdo_depositsEnergy) = sdo_depositsEnergy;
497 
498  return sdo_depositsBarcode;
499 }
500 
501 
502 
504  const InDet::PixelCluster* prd,
505  const std::vector<SiHit> & matchingHits ) const
506 {
507 
508  int numHits = matchingHits.size();
509 
510  std::vector<float> sihit_energyDeposit(numHits,0);
511  std::vector<float> sihit_meanTime(numHits,0);
512  std::vector<int> sihit_barcode(numHits,0);
513  std::vector<int> sihit_pdgid(numHits,0);
514 
515  std::vector<float> sihit_startPosX(numHits,0);
516  std::vector<float> sihit_startPosY(numHits,0);
517  std::vector<float> sihit_startPosZ(numHits,0);
518 
519  std::vector<float> sihit_endPosX(numHits,0);
520  std::vector<float> sihit_endPosY(numHits,0);
521  std::vector<float> sihit_endPosZ(numHits,0);
522 
523  int hitNumber(0);
524  const InDetDD::SiDetectorElement* de = prd->detectorElement();
525  if(de){
526  for ( const auto& sihit : matchingHits ) {
527  sihit_energyDeposit[hitNumber] = sihit.energyLoss() ;
528  sihit_meanTime[hitNumber] = sihit.meanTime() ;
529  const HepMcParticleLink& HMPL = sihit.particleLink();
530  sihit_barcode[hitNumber] = HepMC::barcode(HMPL) ;
531  if(HMPL.isValid()){
532  sihit_pdgid[hitNumber] = HMPL->pdg_id();
533  }
534 
535  // Convert Simulation frame into reco frame
536  const HepGeom::Point3D<double>& startPos=sihit.localStartPosition();
537 
538  Amg::Vector2D pos= de->hitLocalToLocal( startPos.z(), startPos.y() );
539  sihit_startPosX[hitNumber] = pos[0];
540  sihit_startPosY[hitNumber] = pos[1];
541  sihit_startPosZ[hitNumber] = startPos.x();
542 
543 
544  const HepGeom::Point3D<double>& endPos=sihit.localEndPosition();
545  pos= de->hitLocalToLocal( endPos.z(), endPos.y() );
546  sihit_endPosX[hitNumber] = pos[0];
547  sihit_endPosY[hitNumber] = pos[1];
548  sihit_endPosZ[hitNumber] = endPos.x();
549  ++hitNumber;
550  }
551  }
552 
553  AUXDATA(xprd,std::vector<float>,sihit_energyDeposit) = sihit_energyDeposit;
554  AUXDATA(xprd,std::vector<float>,sihit_meanTime) = sihit_meanTime;
555  AUXDATA(xprd,std::vector<int>,sihit_barcode) = sihit_barcode;
556  AUXDATA(xprd,std::vector<int>,sihit_pdgid) = sihit_pdgid;
557 
558  AUXDATA(xprd,std::vector<float>,sihit_startPosX) = sihit_startPosX;
559  AUXDATA(xprd,std::vector<float>,sihit_startPosY) = sihit_startPosY;
560  AUXDATA(xprd,std::vector<float>,sihit_startPosZ) = sihit_startPosZ;
561 
562  AUXDATA(xprd,std::vector<float>,sihit_endPosX) = sihit_endPosX;
563  AUXDATA(xprd,std::vector<float>,sihit_endPosY) = sihit_endPosY;
564  AUXDATA(xprd,std::vector<float>,sihit_endPosZ) = sihit_endPosZ;
565 
566 
567 }
568 
569 
570 
571 
572 
573 
575  const std::vector<const SiHit*>* sihits,
576  std::vector< std::vector< int > > & trkBCs ) const
577 {
578  ATH_MSG_VERBOSE( "Got " << sihits->size() << " SiHits to look through" );
579  std::vector<SiHit> matchingHits;
580 
581  // Check if we have detector element -- needed to find the local position of the SiHits
582  const InDetDD::SiDetectorElement* de = prd->detectorElement();
583  if(!de)
584  return matchingHits;
585 
586  std::vector<const SiHit* > multiMatchingHits;
587 
588  for ( const SiHit* siHit : *sihits) {
589  // Now we have all hits in the module that match lets check to see if they match the cluster
590  // Must be within +/- 1 hits of any hit in the cluster to be included
591 
593  {
594  HepGeom::Point3D<double> averagePosition = siHit->localStartPosition() + siHit->localEndPosition();
595  averagePosition *= 0.5;
596  Amg::Vector2D pos = de->hitLocalToLocal( averagePosition.z(), averagePosition.y() );
598 
599  for( const auto &hitIdentifier : prd->rdoList() ){
600  ATH_MSG_DEBUG("Truth Phi " << diode.phiIndex() << " Cluster Phi " << m_PixelHelper->phi_index( hitIdentifier ) );
601  ATH_MSG_DEBUG("Truth Eta " << diode.etaIndex() << " Cluster Eta " << m_PixelHelper->eta_index( hitIdentifier ) );
602  if( abs( int(diode.etaIndex()) - m_PixelHelper->eta_index( hitIdentifier ) ) <=1
603  && abs( int(diode.phiIndex()) - m_PixelHelper->phi_index( hitIdentifier ) ) <=1 )
604  {
605  multiMatchingHits.push_back(siHit);
606  break;
607  }
608  }
609  }
610  else
611  {
612  auto bc = HepMC::barcode(siHit->particleLink());
613  for ( const auto& barcodeSDOColl : trkBCs ) {
614  if (std::find(barcodeSDOColl.begin(),barcodeSDOColl.end(),bc) == barcodeSDOColl.end() ) continue;
615  multiMatchingHits.push_back(siHit);
616  break;
617  }
618  }
619  }
620  //Now we will now make 1 SiHit for each true particle if the SiHits "touch" other
621  std::vector<const SiHit* >::iterator siHitIter = multiMatchingHits.begin();
622  std::vector<const SiHit* >::iterator siHitIter2 = multiMatchingHits.begin();
623  ATH_MSG_DEBUG( "Found " << multiMatchingHits.size() << " SiHit " );
624  for ( ; siHitIter != multiMatchingHits.end(); ++siHitIter) {
625  const SiHit* lowestXPos = *siHitIter;
626  const SiHit* highestXPos = *siHitIter;
627 
628 
629  // We will merge these hits
630  std::vector<const SiHit* > ajoiningHits;
631  ajoiningHits.push_back( *siHitIter );
632 
633  siHitIter2 = siHitIter+1;
634  auto bc = HepMC::barcode((*siHitIter)->particleLink());
635  while ( siHitIter2 != multiMatchingHits.end() ) {
636  // Need to come from the same truth particle
637 
638  if( bc != HepMC::barcode((*siHitIter2)->particleLink()) ){
639  ++siHitIter2;
640  continue;
641  }
642 
643  // Check to see if the SiHits are compatible with each other.
644  if (std::abs((highestXPos->localEndPosition().x()-(*siHitIter2)->localStartPosition().x()))<0.00005 &&
645  std::abs((highestXPos->localEndPosition().y()-(*siHitIter2)->localStartPosition().y()))<0.00005 &&
646  std::abs((highestXPos->localEndPosition().z()-(*siHitIter2)->localStartPosition().z()))<0.00005 )
647  {
648  highestXPos = *siHitIter2;
649  ajoiningHits.push_back( *siHitIter2 );
650  // Dont use hit more than once
651  // @TODO could invalidate siHitIter
652  siHitIter2 = multiMatchingHits.erase( siHitIter2 );
653  }else if (std::abs((lowestXPos->localStartPosition().x()-(*siHitIter2)->localEndPosition().x()))<0.00005 &&
654  std::abs((lowestXPos->localStartPosition().y()-(*siHitIter2)->localEndPosition().y()))<0.00005 &&
655  std::abs((lowestXPos->localStartPosition().z()-(*siHitIter2)->localEndPosition().z()))<0.00005)
656  {
657  lowestXPos = *siHitIter2;
658  ajoiningHits.push_back( *siHitIter2 );
659  // Dont use hit more than once
660  // @TODO could invalidate siHitIter
661  siHitIter2 = multiMatchingHits.erase( siHitIter2 );
662  } else {
663  ++siHitIter2;
664  }
665  }
666 
667  if( ajoiningHits.size() == 0){
668  ATH_MSG_WARNING("This should really never happen");
669  continue;
670  }else if(ajoiningHits.size() == 1){
671  // Copy Si Hit ready to return
672  matchingHits.push_back( *ajoiningHits[0] );
673  continue;
674  } else {
675  // Build new SiHit and merge information together.
676  ATH_MSG_DEBUG("Merging " << ajoiningHits.size() << " SiHits together." );
677 
678 
679  float energyDep(0);
680  float time(0);
681  for( const auto& siHit : ajoiningHits){
682  energyDep += siHit->energyLoss();
683  time += siHit->meanTime();
684  }
685  time /= (float)ajoiningHits.size();
686 
687  matchingHits.emplace_back(lowestXPos->localStartPosition(),
688  highestXPos->localEndPosition(),
689  energyDep,
690  time,
691  HepMC::barcode((*siHitIter)->particleLink()),
692  0, // 0 for pixel 1 for Pixel
693  (*siHitIter)->getBarrelEndcap(),
694  (*siHitIter)->getLayerDisk(),
695  (*siHitIter)->getEtaModule(),
696  (*siHitIter)->getPhiModule(),
697  (*siHitIter)->getSide() );
698  ATH_MSG_DEBUG("Finished Merging " << ajoiningHits.size() << " SiHits together." );
699 
700  }
701  }
702 
703 
704  return matchingHits;
705 
706 }
707 
710  const PixelChargeCalibCondData *calibData) const
711 {
712  ATH_MSG_VERBOSE( " Starting creating input from cluster " );
713 
714 
715  const std::vector<Identifier>& rdos = pixelCluster->rdoList();
716 
717  const std::vector<float> &chList = pixelCluster->chargeList();
718  const std::vector<int> &totList = pixelCluster->totList();
719 
720  // std::vector<int> rowList;
721  // std::vector<int> colList;
722  std::vector<int> etaIndexList;
723  std::vector<int> phiIndexList;
724  std::vector<float> CTerm;
725  std::vector<float> ATerm;
726  std::vector<float> ETerm;
727 
728  ATH_MSG_VERBOSE( "Number of RDOs: " << rdos.size() );
729 
730  //Itererate over all elements hits in the cluster and fill the charge and tot matricies
731  std::vector<Identifier>::const_iterator rdosBegin = rdos.begin();
732  std::vector<Identifier>::const_iterator rdosEnd = rdos.end();
733 
734  ATH_MSG_VERBOSE(" Putting together the n. " << rdos.size() << " rdos into a matrix.");
735 
736  phiIndexList.reserve( rdos.size());
737  etaIndexList.reserve( rdos.size());
738  CTerm.reserve( rdos.size());
739  ATerm.reserve( rdos.size());
740  ETerm.reserve( rdos.size());
741  for (; rdosBegin!= rdosEnd; ++rdosBegin)
742  {
743  Identifier rId = *rdosBegin;
744  phiIndexList.push_back( m_PixelHelper->phi_index(rId) );
745  etaIndexList.push_back( m_PixelHelper->eta_index(rId) );
746 
747  // charge calibration parameters
748  Identifier moduleID = m_PixelHelper->wafer_id(rId);
749  IdentifierHash moduleHash = m_PixelHelper->wafer_hash(moduleID); // wafer hash
750  unsigned int FE = m_pixelReadout->getFE(rId, moduleID);
751  InDetDD::PixelDiodeType type = m_pixelReadout->getDiodeType(rId);
752  const auto & parameters = calibData->getLegacyFitParameters(type, moduleHash, FE);
753  CTerm.emplace_back(parameters.C);
754  ATerm.emplace_back(parameters.A);
755  ETerm.emplace_back(parameters.E);
756 
757  }//end iteration on rdos
758 
759 
760  AUXDATA(xprd, std::vector<int>,rdo_phi_pixel_index) = phiIndexList;
761  AUXDATA(xprd, std::vector<int>,rdo_eta_pixel_index) = etaIndexList;
762  AUXDATA(xprd, std::vector<float>,rdo_charge) = chList;
763  AUXDATA(xprd, std::vector<int>,rdo_tot) = totList;
764 
765  AUXDATA(xprd, std::vector<float>,rdo_Cterm) = CTerm;
766  AUXDATA(xprd, std::vector<float>,rdo_Aterm) = ATerm;
767  AUXDATA(xprd, std::vector<float>,rdo_Eterm) = ETerm;
768 
769 }
770 
771 
774  const unsigned int sizeX, const unsigned int sizeY ) const
775 {
776  ATH_MSG_VERBOSE( " Starting creating input from cluster " );
777 
778  const InDetDD::SiDetectorElement* de = pixelCluster->detectorElement();
779  if (de==nullptr) {
780  ATH_MSG_ERROR("Could not get detector element");
781  return;
782  }
783 
784 
785  const InDetDD::PixelModuleDesign* design(dynamic_cast<const InDetDD::PixelModuleDesign*>(&de->design()));
786  if (not design) {
787  ATH_MSG_WARNING("PixelModuleDesign was not retrieved in function 'addNNInformation'");
788  return;
789  }
790  const std::vector<Identifier>& rdos = pixelCluster->rdoList();
791 
792  const std::vector<float>& chList = pixelCluster->chargeList();
793  const std::vector<int>& totList = pixelCluster->totList();
794 
795  ATH_MSG_VERBOSE( "Number of RDOs: " << rdos.size() );
796  ATH_MSG_VERBOSE( "Number of charges: " << chList.size() );
797  ATH_MSG_VERBOSE( "Number of TOT: " << totList.size() );
798 
799 
800  //Calculate the centre of the cluster
801  int phiPixelIndexMin, phiPixelIndexMax, etaPixelIndexMin, etaPixelIndexMax;
802  InDetDD::SiCellId cellIdWeightedPosition= getCellIdWeightedPosition( pixelCluster, &phiPixelIndexMin, &phiPixelIndexMax, &etaPixelIndexMin, &etaPixelIndexMax);
803 
804  if (!cellIdWeightedPosition.isValid())
805  {
806  ATH_MSG_WARNING( "Weighted position is on invalid CellID." );
807  }
808 
809  int etaPixelIndexWeightedPosition=cellIdWeightedPosition.etaIndex();
810  int phiPixelIndexWeightedPosition=cellIdWeightedPosition.phiIndex();
811 
812 
813  ATH_MSG_DEBUG(" weighted pos phiPixelIndex: " << phiPixelIndexWeightedPosition << " etaPixelIndex: " << etaPixelIndexWeightedPosition );
814 
815  // SiLocalPosition PixelModuleDesign::positionFromColumnRow(const int column, const int row) const;
816  //
817  // Given row and column index of diode, returns position of diode center
818  // ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId & cellId) or
819  // rawLocalPositionOfCell method in SiDetectorElement.
820  // DEPRECATED (but used in numerous places)
821  //
822  // Comment by Hide (referring the original comment in the code) : 2015-02-04
823  // I automatically replaced column to etaPixelIndex and row to phiPixelIndex here. It was bofore:
824  // InDetDD::SiLocalPosition siLocalPosition( design->positionFromColumnRow(columnWeightedPosition,rowWeightedPosition) );
825  //
826  // Then I assume the argument of column/row in this function is in offline manner, not the real hardware column/row.
827  //
828  InDetDD::SiLocalPosition w = design->positionFromColumnRow(etaPixelIndexWeightedPosition,phiPixelIndexWeightedPosition);
829 
830 
831  double localEtaPixelIndexWeightedPosition = w.xEta();
832  double localPhiPixelIndexWeightedPosition = w.xPhi();
833 
834  int centralIndexX=(sizeX-1)/2;
835  int centralIndexY=(sizeY-1)/2;
836 
837 
838 
839  // Check to see if the cluster is too big for the NN
840 
841  if (abs(phiPixelIndexWeightedPosition-phiPixelIndexMin)>centralIndexX ||
842  abs(phiPixelIndexWeightedPosition-phiPixelIndexMax)>centralIndexX)
843  {
844  ATH_MSG_DEBUG(" Cluster too large phiPixelIndexMin " << phiPixelIndexMin << " phiPixelIndexMax " << phiPixelIndexMax << " centralX " << centralIndexX);
845  //return;
846  }
847 
848  if (abs(etaPixelIndexWeightedPosition-etaPixelIndexMin)>centralIndexY ||
849  abs(etaPixelIndexWeightedPosition-etaPixelIndexMax)>centralIndexY)
850  {
851  ATH_MSG_DEBUG(" Cluster too large etaPixelIndexMin" << etaPixelIndexMin << " etaPixelIndexMax " << etaPixelIndexMax << " centralY " << centralIndexY);
852  //return;
853  }
854 
855  std::vector< std::vector<float> > matrixOfToT (sizeX, std::vector<float>(sizeY,0) );
856  std::vector< std::vector<float> > matrixOfCharge(sizeX, std::vector<float>(sizeY,0));
857  std::vector<float> vectorOfPitchesY(sizeY,0.4);
858 
859 
860  //Itererate over all elements hits in the cluster and fill the charge and tot matrices
861  std::vector<Identifier>::const_iterator rdosBegin = rdos.begin();
862  std::vector<Identifier>::const_iterator rdosEnd = rdos.end();
863  auto charge = chList.begin();
864  auto tot = totList.begin();
865 
866  ATH_MSG_VERBOSE(" Putting together the n. " << rdos.size() << " rdos into a matrix.");
867 
868  for (; rdosBegin!= rdosEnd; ++rdosBegin)
869  {
870 
871  Identifier rId = *rdosBegin;
872  int absphiPixelIndex = m_PixelHelper->phi_index(rId)-phiPixelIndexWeightedPosition + centralIndexX;
873  int absetaPixelIndex = m_PixelHelper->eta_index(rId)-etaPixelIndexWeightedPosition + centralIndexY;
874  if (charge != chList.end()){
875  ATH_MSG_VERBOSE( " Phi Index: " << m_PixelHelper->phi_index(rId) << " absphiPixelIndex: " << absphiPixelIndex << " eta Idx: " << m_PixelHelper->eta_index(rId) << " absetaPixelIndex: " << absetaPixelIndex << " charge " << *charge );
876  }
877  if (absphiPixelIndex <0 || absphiPixelIndex >= (int)sizeX)
878  {
879  ATH_MSG_DEBUG(" problem with index: " << absphiPixelIndex << " min: " << 0 << " max: " << sizeX);
880  continue;
881  }
882 
883  if (absetaPixelIndex <0 || absetaPixelIndex >= (int)sizeY)
884  {
885  ATH_MSG_DEBUG(" problem with index: " << absetaPixelIndex << " min: " << 0 << " max: " << sizeY);
886  continue;
887  }
888 
889  InDetDD::SiCellId cellId = de->cellIdFromIdentifier(*rdosBegin);
890  InDetDD::SiDiodesParameters diodeParameters = design->parameters(cellId);
891  float pitchY = diodeParameters.width().xEta();
892 
893  if ( (not totList.empty()) && tot != totList.end()) {
894  matrixOfToT[absphiPixelIndex][absetaPixelIndex] =*tot;
895  ++tot;
896  } else matrixOfToT[absphiPixelIndex][absetaPixelIndex] = -1;
897 
898  if ( (not chList.empty()) && charge != chList.end()){
899  matrixOfCharge[absphiPixelIndex][absetaPixelIndex]=*charge;
900  ++charge;
901  } else matrixOfCharge[absphiPixelIndex][absetaPixelIndex] = -1;
902 
903  if (pitchY > 0.1)
904  {
905  vectorOfPitchesY[absetaPixelIndex]=pitchY;
906  }
907  }//end iteration on rdos
908 
909 
910  ATH_MSG_VERBOSE( " End RDO LOOP " );
911 
912  // Using the centre of the module and beam spot calculate
913  // the incidence angles of the tracks
914  const Amg::Vector2D& prdLocPos = pixelCluster->localPosition();
916 
917  Amg::Vector3D globalPos = de->globalPosition(centroid);
918  Amg::Vector3D trackDir = globalPos; // - beamSpotPosition;
919  trackDir.normalize();
920 
921  Amg::Vector3D module_normal = de->normal();
922  Amg::Vector3D module_phiax = de->phiAxis();
923  Amg::Vector3D module_etaax = de->etaAxis();
924 
925  // Calculate the phi incidence angle
926  float trkphicomp = trackDir.dot(module_phiax);
927  float trketacomp = trackDir.dot(module_etaax);
928  float trknormcomp = trackDir.dot(module_normal);
929  double bowphi = atan2(trkphicomp,trknormcomp);
930  double boweta = atan2(trketacomp,trknormcomp);
931  double tanl = m_lorentzAngleTool->getTanLorentzAngle(de->identifyHash());
932  if(bowphi > TMath::Pi()/2) bowphi -= TMath::Pi();
933  if(bowphi < -TMath::Pi()/2) bowphi += TMath::Pi();
934  int readoutside = design->readoutSide();
935  double angle = atan(tan(bowphi)-readoutside*tanl);
936 
937 
938  // Calculate the theta incidence angle
939  ATH_MSG_VERBOSE( " Angle theta bef corr: " << boweta );
940  if (boweta>TMath::Pi()/2.) boweta-=TMath::Pi();
941  if (boweta<-TMath::Pi()/2.) boweta+=TMath::Pi();
942 
943 
944  ATH_MSG_VERBOSE(" Angle phi: " << angle << " theta: " << boweta );
945  ATH_MSG_VERBOSE(" PhiPixelIndexWeightedPosition: " << phiPixelIndexWeightedPosition << " EtaPixelIndexWeightedPosition: " << etaPixelIndexWeightedPosition );
946 
947  // store the matrixOfToT in a vector
948  std::vector<float> vectorOfCharge(sizeX*sizeY,0);
949  std::vector<float> vectorOfToT(sizeX*sizeY,0);
950  int counter(0);
951  for (unsigned int u=0;u<sizeX;u++)
952  {
953  for (unsigned int s=0;s<sizeY;s++)
954  {
955  vectorOfToT[counter] = matrixOfToT[u][s];
956  vectorOfCharge[counter] = matrixOfCharge[u][s];
957  ++counter;
958  }
959  }
960 
961  ATH_MSG_VERBOSE( "matrixOfToT converted in a std::vector<float> " );
962 
963  ATH_MSG_VERBOSE( "... and saved " );
964  // Add information to xAOD
965  AUXDATA(xprd, int, NN_sizeX) = sizeX;
966  AUXDATA(xprd, int, NN_sizeY) = sizeY;
967 
968  AUXDATA(xprd, float, NN_phiBS) = angle;
969  AUXDATA(xprd, float, NN_thetaBS) = boweta;
970 
971  AUXDATA(xprd, std::vector<float>, NN_matrixOfToT) = vectorOfToT;
972  AUXDATA(xprd, std::vector<float>, NN_matrixOfCharge) = vectorOfCharge;
973  AUXDATA(xprd, std::vector<float>, NN_vectorOfPitchesY) = vectorOfPitchesY;
974 
975 
976  AUXDATA(xprd, int, NN_etaPixelIndexWeightedPosition) = etaPixelIndexWeightedPosition;
977  AUXDATA(xprd, int, NN_phiPixelIndexWeightedPosition) = phiPixelIndexWeightedPosition;
978 
979  AUXDATA(xprd, float, NN_localEtaPixelIndexWeightedPosition) = localEtaPixelIndexWeightedPosition;
980  AUXDATA(xprd, float, NN_localPhiPixelIndexWeightedPosition) = localPhiPixelIndexWeightedPosition;
981 
982  ATH_MSG_VERBOSE( "NN training Written" );
983 }
984 
987  const std::vector<SiHit> & matchingHits ) const
988 {
989 
990 
991  unsigned int numberOfSiHits = matchingHits.size();
992 
993  std::vector<float> positionsX(numberOfSiHits,0);
994  std::vector<float> positionsY(numberOfSiHits,0);
995 
996  std::vector<float> positions_indexX(numberOfSiHits,0);
997  std::vector<float> positions_indexY(numberOfSiHits,0);
998 
999  std::vector<float> theta(numberOfSiHits,0);
1000  std::vector<float> phi(numberOfSiHits,0);
1001 
1002  std::vector<int> barcode(numberOfSiHits,0);
1003  std::vector<int> pdgid(numberOfSiHits,0);
1004  std::vector<float> chargeDep(numberOfSiHits,0);
1005  std::vector<float> truep(numberOfSiHits,0);
1006 
1007  std::vector<float> pathlengthX(numberOfSiHits,0);
1008  std::vector<float> pathlengthY(numberOfSiHits,0);
1009  std::vector<float> pathlengthZ(numberOfSiHits,0);
1010 
1011  std::vector<int> motherBarcode(numberOfSiHits,0);
1012  std::vector<int> motherPdgid(numberOfSiHits,0);
1013 
1014 
1015 
1016  // Check if we have detector element -- needed to find the local position of the SiHits
1017  const InDetDD::SiDetectorElement* de = pixelCluster->detectorElement();
1018  if(!de)
1019  return;
1020 
1021  InDetDD::SiCellId cellIdWeightedPosition = getCellIdWeightedPosition( pixelCluster );
1022 
1023  const InDetDD::PixelModuleDesign* design(dynamic_cast<const InDetDD::PixelModuleDesign*>(&de->design()));
1024  if (not design) {
1025  ATH_MSG_WARNING("PixelModuleDesign was not retrieved in function 'addNNTruthInfo'");
1026  return;
1027  }
1028  // lorentz shift correction
1029  double shift = m_lorentzAngleTool->getLorentzShift(de->identifyHash());
1030  unsigned hitNumber(0);
1031  for( const auto& siHit : matchingHits ){
1032 
1033  HepGeom::Point3D<double> averagePosition = (siHit.localStartPosition() + siHit.localEndPosition()) * 0.5;
1034 
1035  ATH_MSG_VERBOSE("Truth Part X: " << averagePosition.y() << " shift " << shift << " Y: " << averagePosition.z() );
1036 
1037  // position lorentz shift corrected
1038  float YposC = averagePosition.y()-shift;
1039 
1040  if (std::abs(YposC)>design->width()/2 &&
1041  std::abs(averagePosition.y())<design->width()/2)
1042  {
1043  if (YposC>design->width()/2)
1044  {
1045  YposC=design->width()/2-1e-6;
1046  } else if (YposC<-design->width()/2)
1047  {
1048  YposC=-design->width()/2+1e-6;
1049  }
1050  }
1051 
1052  positionsX[hitNumber] = YposC;
1053  positionsY[hitNumber] = averagePosition.z();
1054 
1055  HepGeom::Point3D<double> deltaPosition = siHit.localEndPosition() - siHit.localStartPosition();
1056 
1057  pathlengthX[hitNumber] = deltaPosition.y();
1058  pathlengthY[hitNumber] = deltaPosition.z();
1059  pathlengthZ[hitNumber] = deltaPosition.x();
1060 
1061 
1062  // Here we convert the hit position to the right frame
1063  Amg::Vector2D siLocalTruthPosition = de->hitLocalToLocal(averagePosition.z(), YposC);
1064  InDetDD::SiCellId cellIdOfTruthPosition = design->cellIdOfPosition(siLocalTruthPosition);
1065 
1066 
1067 // InDetDD::SiLocalPosition siLocalTruthPosition(averagePosition.z(),YposC ) ;
1068 // InDetDD::SiCellId cellIdOfTruthPosition =design->cellIdOfPosition(siLocalTruthPosition);
1069 
1070  int truthEtaIndex = cellIdOfTruthPosition.etaIndex();
1071  int truthPhiIndex = cellIdOfTruthPosition.phiIndex();
1072 
1073  InDetDD::SiDiodesParameters diodeParameters = design->parameters(cellIdOfTruthPosition);
1074  double pitchY = diodeParameters.width().xEta();
1075  double pitchX = diodeParameters.width().xPhi();
1076 
1077  // pixel center
1078  // SiLocalPosition PixelModuleDesign::positionFromColumnRow(const int column, const int row) const;
1079  //
1080  // Given row and column index of diode, returns position of diode center
1081  // ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId & cellId) or
1082  // rawLocalPositionOfCell method in SiDetectorElement.
1083  // DEPRECATED (but used in numerous places)
1084  //
1085  // Comment by Hide (referring the original comment in the code) : 2015-02-04
1086  // I automatically replaced column to etaPixelIndex and row to phiPixelIndex here. It was bofore:
1087  // InDetDD::SiLocalPosition siLocalPosition( design->positionFromColumnRow(truthColumn,truthRow) );
1088  //
1089  // Then I assume the argument of column/row in this function is in offline manner, not the real hardware column/row.
1090  //
1091  InDetDD::SiLocalPosition siLocalPositionCenter(design->positionFromColumnRow(truthEtaIndex,truthPhiIndex));
1092  double pixelCenterY = siLocalPositionCenter.xEta();
1093  double pixelCenterX = siLocalPositionCenter.xPhi();
1094 
1095 
1096  // truth index
1097 // double truthIndexY = truthEtaIndex + (averagePosition.z() - pixelCenterY)/pitchY;
1098 // double truthIndexX = truthPhiIndex + (YposC - pixelCenterX)/pitchX;
1099  double truthIndexY = truthEtaIndex + (siLocalTruthPosition[Trk::distEta] - pixelCenterY)/pitchY;
1100  double truthIndexX = truthPhiIndex + (siLocalTruthPosition[Trk::distPhi] - pixelCenterX)/pitchX;
1101 
1102 
1103  positions_indexX[hitNumber] = truthIndexX - cellIdWeightedPosition.phiIndex();
1104  positions_indexY[hitNumber] = truthIndexY - cellIdWeightedPosition.etaIndex();
1105 
1106  HepGeom::Point3D<double> diffPositions = (siHit.localEndPosition() - siHit.localStartPosition());
1107  double bowphi = std::atan2( diffPositions.y(), diffPositions.x() );
1108 
1109 
1110  //Truth Track incident angle theta
1111  theta[hitNumber] = std::atan2(diffPositions.z() ,diffPositions.x());
1112  //Truth track incident angle phi -- correct for lorentz angle
1113  float tanlorentz = m_lorentzAngleTool->getTanLorentzAngle(de->identifyHash());
1114 
1115  int readoutside = design->readoutSide();
1116  phi[hitNumber] = std::atan(std::tan(bowphi)-readoutside*tanlorentz);
1117  const HepMcParticleLink& HMPL = siHit.particleLink();
1118  if (HMPL.isValid()){
1119  barcode[hitNumber] = HepMC::barcode(HMPL);
1120  const auto particle = HMPL.cptr();
1121  pdgid[hitNumber] = particle->pdg_id();
1122  HepMC::FourVector mom=particle->momentum();
1123  truep[hitNumber] = std::sqrt(mom.x()*mom.x()+mom.y()*mom.y()+mom.z()*mom.z());
1124  const auto vertex = particle->production_vertex();
1125 //AV Please note that taking the first particle as a mother is ambiguous.
1126 #ifdef HEPMC3
1127  if ( vertex && !vertex->particles_in().empty()){
1128  const auto& mother_of_particle=vertex->particles_in().front();
1129  motherBarcode[hitNumber] = HepMC::barcode(mother_of_particle);
1130  motherPdgid[hitNumber] = mother_of_particle->pdg_id();
1131  }
1132 #else
1133  if ( vertex ){
1134  if( vertex->particles_in_const_begin() != vertex->particles_in_const_end() ){
1135  motherBarcode[hitNumber] = HepMC::barcode(*vertex->particles_in_const_begin());
1136  motherPdgid[hitNumber] = (*vertex->particles_in_const_begin())->pdg_id();
1137  }
1138  }
1139 #endif
1140  }
1141  chargeDep[hitNumber] = siHit.energyLoss() ;
1142 
1143  ++hitNumber;
1144  }
1145 
1146 
1147  AUXDATA(xprd, std::vector<float>, NN_positionsX) = positionsX;
1148  AUXDATA(xprd, std::vector<float>, NN_positionsY) = positionsY;
1149 
1150  AUXDATA(xprd, std::vector<float>, NN_positions_indexX) = positions_indexX;
1151  AUXDATA(xprd, std::vector<float>, NN_positions_indexY) = positions_indexY;
1152 
1153  AUXDATA(xprd, std::vector<float>, NN_theta) = theta;
1154  AUXDATA(xprd, std::vector<float>, NN_phi) = phi;
1155 
1156  AUXDATA(xprd, std::vector<int>, NN_barcode) = barcode;
1157  AUXDATA(xprd, std::vector<int>, NN_pdgid) = pdgid;
1158  AUXDATA(xprd, std::vector<float>, NN_energyDep) = chargeDep;
1159  AUXDATA(xprd, std::vector<float>, NN_trueP) = truep;
1160 
1161  AUXDATA(xprd, std::vector<int>, NN_motherBarcode) = motherBarcode;
1162  AUXDATA(xprd, std::vector<int>, NN_motherPdgid) = motherPdgid;
1163 
1164 
1165  AUXDATA(xprd, std::vector<float>, NN_pathlengthX) = pathlengthX;
1166  AUXDATA(xprd, std::vector<float>, NN_pathlengthY) = pathlengthY;
1167  AUXDATA(xprd, std::vector<float>, NN_pathlengthZ) = pathlengthZ;
1168 
1169 
1170 }
1171 
1172 
1173 
1174 
1176  int *rphiPixelIndexMin,
1177  int *rphiPixelIndexMax,
1178  int *retaPixelIndexMin,
1179  int *retaPixelIndexMax ) const
1180 {
1181 
1182  const InDetDD::SiDetectorElement* de = pixelCluster->detectorElement();
1183  if (de==nullptr) {
1184  ATH_MSG_ERROR("Could not get detector element");
1185  return {};
1186  }
1187 
1188  const InDetDD::PixelModuleDesign* design(dynamic_cast<const InDetDD::PixelModuleDesign*>(&de->design()));
1189  if (not design) {
1190  ATH_MSG_WARNING("PixelModuleDesign was not retrieved in function 'getCellIdWeightedPosition'");
1191  return {};
1192  }
1193  const std::vector<Identifier>& rdos = pixelCluster->rdoList();
1194 
1195  ATH_MSG_VERBOSE( "Number of RDOs: " << rdos.size() );
1196  const std::vector<float>& chList = pixelCluster->chargeList();
1197 
1198  ATH_MSG_VERBOSE( "Number of charges: " << chList.size() );
1199  std::vector<Identifier>::const_iterator rdosBegin = rdos.begin();
1200  std::vector<Identifier>::const_iterator rdosEnd = rdos.end();
1201 
1202  auto charge = chList.begin();
1203 
1204  InDetDD::SiLocalPosition sumOfWeightedPositions(0,0,0);
1205  double sumOfCharge=0;
1206 
1207  int phiPixelIndexMin = 99999;
1208  int phiPixelIndexMax = -99999;
1209  int etaPixelIndexMin = 99999;
1210  int etaPixelIndexMax = -99999;
1211 
1212  for (; rdosBegin!= rdosEnd; ++rdosBegin, ++charge)
1213  {
1214 
1215  Identifier rId = *rdosBegin;
1216  int phiPixelIndex = m_PixelHelper->phi_index(rId);
1217  int etaPixelIndex = m_PixelHelper->eta_index(rId);
1218 
1219  ATH_MSG_VERBOSE(" Adding pixel phiPixelIndex: " << phiPixelIndex << " etaPixelIndex: " << etaPixelIndex << " charge: " << *charge );
1220 
1221  // SiLocalPosition PixelModuleDesign::positionFromColumnRow(const int column, const int row) const;
1222  //
1223  // Given row and column index of diode, returns position of diode center
1224  // ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId & cellId) or
1225  // rawLocalPositionOfCell method in SiDetectorElement.
1226  // DEPRECATED (but used in numerous places)
1227  //
1228  // Comment by Hide (referring the original comment in the code): 2015-02-04
1229  // I automatically replaced column to etaPixelIndex and row to phiPixelIndex here. It was bofore:
1230  // InDetDD::SiLocalPosition siLocalPosition( design->positionFromColumnRow(column,row) );
1231  //
1232  // Then I assume the argument of column/row in this function is in offline manner, not the real hardware column/row.
1233  //
1234  InDetDD::SiLocalPosition siLocalPosition( design->positionFromColumnRow(etaPixelIndex,phiPixelIndex) );
1235  ATH_MSG_VERBOSE ( "Local Position: Row = " << siLocalPosition.xRow() << ", Col = " << siLocalPosition.xColumn() );
1236 
1237  sumOfWeightedPositions += (*charge)*siLocalPosition;
1238  sumOfCharge += (*charge);
1239 
1240  if (phiPixelIndex < phiPixelIndexMin)
1241  phiPixelIndexMin = phiPixelIndex;
1242 
1243  if (phiPixelIndex > phiPixelIndexMax)
1244  phiPixelIndexMax = phiPixelIndex;
1245 
1246  if (etaPixelIndex < etaPixelIndexMin)
1247  etaPixelIndexMin = etaPixelIndex;
1248 
1249  if (etaPixelIndex > etaPixelIndexMax)
1250  etaPixelIndexMax = etaPixelIndex;
1251 
1252  }
1253  sumOfWeightedPositions /= sumOfCharge;
1254 
1255  ATH_MSG_VERBOSE ( "Wighted position: Row = " << sumOfWeightedPositions.xRow() << ", Col = " << sumOfWeightedPositions.xColumn() );
1256 
1257  if(rphiPixelIndexMin) *rphiPixelIndexMin = phiPixelIndexMin;
1258  if(rphiPixelIndexMax) *rphiPixelIndexMax = phiPixelIndexMax;
1259  if(retaPixelIndexMin) *retaPixelIndexMin = etaPixelIndexMin;
1260  if(retaPixelIndexMax) *retaPixelIndexMax = etaPixelIndexMax;
1261 
1262  //what you want to know is simple:
1263  //just the phiPixelIndex and etaPixelIndex of this average position!
1264 
1265  InDetDD::SiCellId cellIdWeightedPosition=design->cellIdOfPosition(sumOfWeightedPositions);
1266 
1267 
1268  return cellIdWeightedPosition;
1269 
1270 }
1271 
1272 
1273 
1275 //
1276 // Finalize method:
1277 //
1280 {
1282  ATH_MSG_INFO("Missing truth particles " << m_missingTruthParticle << " missing parent: " << m_missingParentParticle
1283  << " have " << m_haveTruthLink);
1284  }
1285  return StatusCode::SUCCESS;
1286 }
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
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:29
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:64
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:503
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
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:470
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:79
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:71
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
InDetDD::SiCellId::isValid
bool isValid() const
Test if its in a valid state.
Definition: SiCellId.h:136
InDetDD::PixelDiodeType
PixelDiodeType
Definition: PixelReadoutDefinitions.h:20
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:574
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)
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.
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:1175
GenParticle.h
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
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:985
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:708
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:57
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:92
PixelPrepDataToxAOD::finalize
virtual StatusCode finalize()
Definition: PixelPrepDataToxAOD.cxx:1279
InDetDD::SiLocalPosition::xEta
double xEta() const
position along eta direction:
Definition: SiLocalPosition.h:118
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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:41
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:56
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:195
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:494
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:912
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
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
Identifier::get_compact
value_type get_compact(void) const
Get the compact id.
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
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
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
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:772
PixelPrepDataToxAOD::execute
virtual StatusCode execute()
Definition: PixelPrepDataToxAOD.cxx:130
IdentifierHash
Definition: IdentifierHash.h:38
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
InDetDD::SiDiodesParameters::width
SiLocalPosition width() const
width of the diodes:
Definition: SiDiodesParameters.h:96
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