ATLAS Offline Software
SiSmearedDigitizationTool.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 // SiSmearedDigitizationTool.cxx
7 // Implementation file for class SiSmearedDigitizationTool
9 
10 // Pixel digitization includes
12 
13 // Det Descr
14 #include "Identifier/Identifier.h"
15 #include "InDetIdentifier/SCT_ID.h"
17 
23 
24 // Random numbers
26 #include "CLHEP/Random/RandGaussZiggurat.h"
27 #include "CLHEP/Random/RandFlat.h"
28 #include "CLHEP/Random/RandGauss.h"
29 #include "CLHEP/Random/RandLandau.h"
30 #include "CLHEP/Vector/ThreeVector.h"
31 
32 // DataHandle
33 #include "StoreGate/DataHandle.h"
34 
35 // Pile-up
37 
42 
43 // Fatras
54 
56 
57 // Root
58 #include "TTree.h"
59 #include "TFile.h"
60 
61 #include <cmath>
62 
63 using namespace InDetDD;
64 
65 // Constructor with parameters:
66 SiSmearedDigitizationTool::SiSmearedDigitizationTool(const std::string &type, const std::string &name,
67  const IInterface* parent):
69  m_pixel_ID(nullptr),
70  m_sct_ID(nullptr),
71  m_randomEngineName("SiSmearedDigitization"),
72  m_pitch_X(0),
73  m_pitch_Y(0),
74  m_merge(false),
75  m_nSigma(0.),
76  m_useDiscSurface(false),
77  m_pixelClusterContainer(nullptr),
78  m_sctClusterContainer(nullptr),
79  m_mergeSvc("PileUpMergeSvc",name),
80  m_HardScatterSplittingMode(0),
81  m_HardScatterSplittingSkipper(false),
82  m_prdTruthNamePixel("PRD_MultiTruthPixel"),
83  m_prdTruthNameSCT("PRD_MultiTruthSCT"),
84  m_SmearPixel(true), //true: smear pixel --- false: smear SCT
85  m_emulateAtlas(true), // error rotation for endcap SCT
86  m_checkSmear(false),
87  m_thistSvc(nullptr),
88  m_outputFile(nullptr),
89  m_currentTree(nullptr),
90  m_x_pixel(0),
91  m_y_pixel(0),
92  m_x_exit_pixel(0),
93  m_y_exit_pixel(0),
94  m_z_exit_pixel(0),
95  m_x_entry_pixel(0),
96  m_y_entry_pixel(0),
97  m_z_entry_pixel(0),
98  m_x_pixel_global(0),
99  m_y_pixel_global(0),
100  m_z_pixel_global(0),
101  m_x_SCT(0),
102  m_x_exit_SCT(0),
103  m_y_exit_SCT(0),
104  m_z_exit_SCT(0),
105  m_x_entry_SCT(0),
106  m_y_entry_SCT(0),
107  m_z_entry_SCT(0),
108  m_x_SCT_global(0),
109  m_y_SCT_global(0),
110  m_z_SCT_global(0),
111  m_x_pixel_smeared(0),
112  m_y_pixel_smeared(0),
113  m_x_SCT_smeared(0),
114  m_Err_x_pixel(0),
115  m_Err_y_pixel(0),
116  m_Err_x_SCT(0),
117  m_Err_y_SCT(0)
118 {
119  declareProperty("RndmEngine", m_randomEngineName, "Random engine name");
120  declareProperty("InputObjectName", m_inputObjectName="PixelHits", "Input Object name" );
121  declareProperty("pitch_X", m_pitch_X);
122  declareProperty("pitch_Y", m_pitch_Y);
123  declareProperty("MergeClusters", m_merge);
124  declareProperty("Nsigma", m_nSigma);
125  declareProperty("SmearPixel", m_SmearPixel, "Enable Pixel or SCT Smearing");
126  declareProperty("PixelClusterContainerName", m_pixel_SiClustersName="PixelClusters");
127  declareProperty("SCT_ClusterContainerName", m_Sct_SiClustersName="SCT_Clusters");
128  declareProperty("CheckSmear", m_checkSmear);
129 
130  declareProperty("HardScatterSplittingMode" , m_HardScatterSplittingMode, "Control pileup & signal splitting" );
131 
132 }
133 
134 
135 // Initialize method:
137 {
138 
139  ATH_MSG_DEBUG ( "SiSmearedDigitizationTool::initialize()" );
140 
141  //locate the AtRndmGenSvc and initialize our local ptr
142  if (!m_rndmSvc.retrieve().isSuccess())
143  {
144  ATH_MSG_ERROR ( "Could not find given RndmSvc" );
145  return StatusCode::FAILURE;
146  }
147 
148  if (detStore()->retrieve(m_pixel_ID, "PixelID").isFailure()) {
149  ATH_MSG_ERROR ( "Could not get Pixel ID helper" );
150  return StatusCode::FAILURE;
151  }
152 
153  if (not m_SmearPixel){ // Smear SCT
154  if (detStore()->retrieve(m_sct_ID, "SCT_ID").isFailure()) {
155  ATH_MSG_ERROR ( "Could not get SCT ID helper" );
156  return StatusCode::FAILURE;
157  }
158 
159  m_inputObjectName="SCT_Hits"; // Set the input object name
160  }
161 
162  // Initialize ReadCondHandleKeys
165 
166  if (m_inputObjectName.empty())
167  {
168  ATH_MSG_FATAL ( "Property InputObjectName not set !" );
169  return StatusCode::FAILURE;
170  }
171  else
172  {
173  ATH_MSG_DEBUG ( "Input objects: '" << m_inputObjectName << "'" );
174  }
175 
176  //locate the PileUpMergeSvc and initialize our local ptr
177  if (!m_mergeSvc.retrieve().isSuccess()) {
178  ATH_MSG_ERROR ( "Could not find PileUpMergeSvc" );
179  return StatusCode::FAILURE;
180  }
181 
182  if (m_checkSmear){
183 
184  // get THistSvc
185  if (service("THistSvc",m_thistSvc).isFailure()) {
186  ATH_MSG_ERROR("Cannot find THistSvc ");
187  return StatusCode::FAILURE;
188  }
189 
190  if (m_SmearPixel){
191  m_outputFile = new TFile("CheckSmearing_Pixel.root","RECREATE");
192  m_currentTree = new TTree("PixelTree","Check smearing Pixel");
193  m_currentTree->Branch("pixel_X" , &m_x_pixel , "m_x_pixel/D");
194  m_currentTree->Branch("pixel_Y" , &m_y_pixel , "m_y_pixel/D");
195  m_currentTree->Branch("pixel_X_exit" , &m_x_exit_pixel , "m_x_exit_pixel/D");
196  m_currentTree->Branch("pixel_Y_exit" , &m_y_exit_pixel , "m_y_exit_pixel/D");
197  m_currentTree->Branch("pixel_Z_exit" , &m_z_exit_pixel , "m_z_exit_pixel/D");
198  m_currentTree->Branch("pixel_X_entry" , &m_x_entry_pixel , "m_x_entry_pixel/D");
199  m_currentTree->Branch("pixel_Y_entry" , &m_y_entry_pixel , "m_y_entry_pixel/D");
200  m_currentTree->Branch("pixel_Z_entry" , &m_z_entry_pixel , "m_z_entry_pixel/D");
201  m_currentTree->Branch("pixel_X_global" , &m_x_pixel_global , "m_x_pixel_global/D");
202  m_currentTree->Branch("pixel_Y_global" , &m_y_pixel_global , "m_y_pixel_global/D");
203  m_currentTree->Branch("pixel_Z_global" , &m_z_pixel_global , "m_z_pixel_global/D");
204  m_currentTree->Branch("pixel_X_smear" , &m_x_pixel_smeared , "m_x_pixel_smeared/D");
205  m_currentTree->Branch("pixel_Y_smear" , &m_y_pixel_smeared , "m_y_pixel_smeared/D");
206  m_currentTree->Branch("pixel_Err_X" , &m_Err_x_pixel , "m_Err_x_pixel/D");
207  m_currentTree->Branch("pixel_Err_Y" , &m_Err_y_pixel , "m_Err_y_pixel/D");
208 
209  if( m_thistSvc->regTree("PixelTree",m_currentTree).isFailure()) {
210  ATH_MSG_ERROR("Cannot register Ttree");
211  return StatusCode::FAILURE;
212  }else{
213  ATH_MSG_DEBUG ( "Ttree registered" );
214  }
215  }
216  else{
217  m_outputFile = new TFile("CheckSmearing_SCT.root","RECREATE");
218  m_currentTree = new TTree("SCT_Tree","Check smearing SCT");
219  m_currentTree->Branch("SCT_X" , &m_x_SCT , "m_x_SCT/D");
220  m_currentTree->Branch("SCT_exit_X" , &m_x_exit_SCT , "m_x_exit_SCT/D");
221  m_currentTree->Branch("SCT_exit_Y" , &m_y_exit_SCT , "m_y_exit_SCT/D");
222  m_currentTree->Branch("SCT_exit_Z" , &m_z_exit_SCT , "m_z_exit_SCT/D");
223  m_currentTree->Branch("SCT_entry_X" , &m_x_entry_SCT , "m_x_entry_SCT/D");
224  m_currentTree->Branch("SCT_entry_Y" , &m_y_entry_SCT , "m_y_entry_SCT/D");
225  m_currentTree->Branch("SCT_entry_Z" , &m_z_entry_SCT , "m_z_entry_SCT/D");
226  m_currentTree->Branch("SCT_X_global" , &m_x_SCT_global , "m_x_SCT_global/D");
227  m_currentTree->Branch("SCT_Y_global" , &m_y_SCT_global , "m_y_SCT_global/D");
228  m_currentTree->Branch("SCT_Z_global" , &m_z_SCT_global , "m_z_SCT_global/D");
229  m_currentTree->Branch("SCT_X_smear" , &m_x_SCT_smeared , "m_x_SCT_smeared/D");
230  m_currentTree->Branch("SCT_Err_X" , &m_Err_x_SCT , "m_Err_x_SCT/D");
231 
232  if( m_thistSvc->regTree("SCT_Tree",m_currentTree).isFailure()) {
233  ATH_MSG_ERROR("Cannot register Ttree");
234  return StatusCode::FAILURE;
235  }else{
236  ATH_MSG_DEBUG ( "Ttree registered" );
237  }
238  }
239 
240 
241  }
242 
243  return StatusCode::SUCCESS;
244 }
245 
246 // Finalize method:
248 {
249 
250  if (m_checkSmear){
251  m_outputFile->cd();
252  m_currentTree->Write();
253  m_outputFile->Close();
254  ATH_MSG_DEBUG ( "SiSmearedDigitizationTool : Writing Tree" );
255 
256  }
257 
258  ATH_MSG_DEBUG ( "SiSmearedDigitizationTool : finalize()" );
259 
260 
261  return StatusCode::SUCCESS;
262 
263 }
264 
265 StatusCode SiSmearedDigitizationTool::prepareEvent(const EventContext& /*ctx*/, unsigned int)
266 {
267 
268  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: in pixel prepareEvent() ---" );
269 
270  m_siHitCollList.clear();
272 
273  return StatusCode::SUCCESS;
274 }
275 
276 
278  SubEventIterator bSubEvents,
279  SubEventIterator eSubEvents)
280 {
281  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: in pixel processBunchXing() ---" );
282  //decide if this event will be processed depending on HardScatterSplittingMode & bunchXing
283  if (m_HardScatterSplittingMode == 2 && !m_HardScatterSplittingSkipper ) { m_HardScatterSplittingSkipper = true; return StatusCode::SUCCESS; }
284  if (m_HardScatterSplittingMode == 1 && m_HardScatterSplittingSkipper ) { return StatusCode::SUCCESS; }
286 
287  using TimedHitCollList = PileUpMergeSvc::TimedList<SiHitCollection>::type;
288  TimedHitCollList hitCollList;
289 
290  if (!(m_mergeSvc->retrieveSubSetEvtData(m_inputObjectName, hitCollList, bunchXing,
291  bSubEvents, eSubEvents).isSuccess()) &&
292  hitCollList.empty()) {
293  ATH_MSG_ERROR("Could not fill TimedHitCollList");
294  return StatusCode::FAILURE;
295  } else {
296  ATH_MSG_VERBOSE(hitCollList.size() << " SiHitCollections with key " <<
297  m_inputObjectName << " found");
298  }
299 
300  TimedHitCollList::iterator iColl(hitCollList.begin());
301  TimedHitCollList::iterator endColl(hitCollList.end());
302 
303  for( ; iColl != endColl; ++iColl) {
304  SiHitCollection *siHitColl = new SiHitCollection(*iColl->second);
305  PileUpTimeEventIndex timeIndex(iColl->first);
306  ATH_MSG_DEBUG("SiHitCollection found with " << siHitColl->size() <<
307  " hits");
308  ATH_MSG_VERBOSE("time index info. time: " << timeIndex.time()
309  << " index: " << timeIndex.index()
310  << " type: " << timeIndex.type());
311  m_siHitCollList.push_back(siHitColl);
312  }
313 
314  return StatusCode::SUCCESS;
315 }
316 
317 
319 
320  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: in pixel processAllSubEvents() ---" );
321 
322  InDet::SiClusterContainer* symSiContainer=nullptr;
323 
324  if(m_SmearPixel){ // Smear Pixel
326 
328  ATH_MSG_FATAL( "[ --- ] Could not create PixelClusterContainer");
329  return StatusCode::FAILURE;
330  }
331 
332  // --------------------------------------
333  // PixelCluster container registration
334 
335  m_pixelClusterContainer->cleanup();
336  if ((evtStore()->record(m_pixelClusterContainer, m_pixel_SiClustersName)).isFailure()) {
337  if ((evtStore()->retrieve(m_pixelClusterContainer, m_pixel_SiClustersName)).isFailure()) {
338  ATH_MSG_FATAL("[ hitproc ] Error while registering PixelCluster container");
339  return StatusCode::FAILURE;
340  }
341  }
342 
343  // symlink the Pixel Container
344  // Pixel
345 
346  if ((evtStore()->symLink(m_pixelClusterContainer,symSiContainer)).isFailure()) {
347  ATH_MSG_FATAL( "[ --- ] PixelClusterContainer could not be symlinked to SiClusterContainter in StoreGate !" );
348  return StatusCode::FAILURE;
349  } else {
350  ATH_MSG_INFO( "[ hitproc ] PixelClusterContainer symlinked to SiClusterContainer in StoreGate" );
351  }
352 
353  }else{ // Smear SCT
355 
356  if(!m_sctClusterContainer) {
357  ATH_MSG_FATAL( "[ --- ] Could not create SCT_ClusterContainer");
358  return StatusCode::FAILURE;
359  }
360 
361  // --------------------------------------
362  // SCT_Cluster container registration
363  m_sctClusterContainer->cleanup();
364  if ((evtStore()->record(m_sctClusterContainer, m_Sct_SiClustersName)).isFailure()) {
365  ATH_MSG_FATAL("[ hitproc ] Error while registering SCT_Cluster container");
366  return StatusCode::FAILURE;
367  }
368  // symlink the SCT Container
369  // SCT
370 
371  if ((evtStore()->symLink(m_sctClusterContainer,symSiContainer)).isFailure()) {
372  ATH_MSG_FATAL( "[ --- ] SCT_ClusterContainer could not be symlinked to SiClusterContainter in StoreGate !" );
373  return StatusCode::FAILURE;
374  } else {
375  ATH_MSG_DEBUG( "[ hitproc ] SCT_ClusterContainer symlinked to SiClusterContainer in StoreGate" );
376  }
377 
378  }
379 
380  if (retrieveTruth().isFailure()) {
381  ATH_MSG_FATAL ( "retrieveTruth() failed!" );
382  return StatusCode::FAILURE;
383  }
384 
385  // get the container(s)
386  using TimedHitCollList = PileUpMergeSvc::TimedList<SiHitCollection>::type;
387 
389 
390  //this is a list<pair<time_t, DataLink<SCTUncompressedHitCollection> > >
391  TimedHitCollList hitCollList;
392  unsigned int numberOfSimHits(0);
393  if ( !(m_mergeSvc->retrieveSubEvtsData(m_inputObjectName, hitCollList, numberOfSimHits).isSuccess()) && hitCollList.empty() ) {
394  ATH_MSG_ERROR ( "Could not fill TimedHitCollList" );
395  return StatusCode::FAILURE;
396  } else {
397  ATH_MSG_DEBUG ( hitCollList.size() << " SiHitCollections with key " << m_inputObjectName << " found" );
398  }
399 
400  // Define Hit Collection
401  TimedHitCollection<SiHit> thpcsi(numberOfSimHits);
402 
403  //now merge all collections into one
404  TimedHitCollList::iterator iColl(hitCollList.begin());
405  TimedHitCollList::iterator endColl(hitCollList.end() );
406 
408  // loop on the hit collections
409  while ( iColl != endColl ) {
411  if (m_HardScatterSplittingMode == 1 && m_HardScatterSplittingSkipper ) { ++iColl; continue; }
413  const SiHitCollection* p_collection(iColl->second);
414  thpcsi.insert(iColl->first, p_collection);
415  ATH_MSG_DEBUG ( "SiHitCollection found with " << p_collection->size() << " hits" );
416  ++iColl;
417  }
418 
419  // Process the Hits straw by straw: get the iterator pairs for given straw
420  if(this->digitize(ctx, thpcsi).isFailure()) {
421  ATH_MSG_FATAL ( "digitize method failed!" );
422  return StatusCode::FAILURE;
423  }
424 
425  if (m_merge)
426  if(this->mergeEvent(ctx).isFailure()) {
427  ATH_MSG_FATAL ( "merge method failed!" );
428  return StatusCode::FAILURE;
429  }
430 
431  if (createAndStoreRIOs(ctx).isFailure()) {
432  ATH_MSG_FATAL ( "createAndStoreRIOs() failed!" );
433  return StatusCode::FAILURE;
434  }
435  else {
436  ATH_MSG_DEBUG ( "createAndStoreRIOs() succeeded" );
437  }
438 
439  return StatusCode::SUCCESS;
440 
441 }
442 
444 
445 
446  if(m_SmearPixel){ // Smear Pixel
447 
449 
450  if ((evtStore()->contains<PRD_MultiTruthCollection>(m_prdTruthNamePixel))){
451  if((evtStore()->retrieve(m_pixelPrdTruth, m_prdTruthNamePixel)).isFailure()){
452  ATH_MSG_FATAL("Could not retrieve collection " << m_prdTruthNamePixel);
453  return StatusCode::FAILURE;
454  }
455  }else{
456  if((evtStore()->record(m_pixelPrdTruth, m_prdTruthNamePixel)).isFailure()){
457  ATH_MSG_FATAL("Could not record collection " << m_prdTruthNamePixel);
458  return StatusCode::FAILURE;
459  }
460  }
461  }else{ // Smear SCT
463 
464  if ((evtStore()->contains<PRD_MultiTruthCollection>(m_prdTruthNameSCT))){
465  if((evtStore()->retrieve(m_SCTPrdTruth, m_prdTruthNameSCT)).isFailure()){
466  ATH_MSG_FATAL("Could not retrieve collection " << m_prdTruthNameSCT);
467  return StatusCode::FAILURE;
468  }
469  }else{
470  if((evtStore()->record(m_SCTPrdTruth, m_prdTruthNameSCT)).isFailure()){
471  ATH_MSG_FATAL("Could not record collection " << m_prdTruthNameSCT);
472  return StatusCode::FAILURE;
473  }
474  }
475  }
476 
477 
478  return StatusCode::SUCCESS;
479 
480 }
481 
482 template<typename CLUSTER>
484 
485  ATH_MSG_DEBUG("Truth map filling with cluster " << *cluster << " and link = " << hit->particleLink());
486  if (hit->particleLink().isValid()){
487  if (!HepMC::ignoreTruthLink(hit->particleLink(), m_vetoPileUpTruthLinks)) {
488  map->insert(std::make_pair(cluster->identify(), hit->particleLink()));
489  ATH_MSG_DEBUG("Truth map filled with cluster " << *cluster << " and link = " << hit->particleLink());
490  }
491  }else{
492  ATH_MSG_DEBUG("Particle link NOT valid!! Truth map NOT filled with cluster" << cluster << " and link = " << hit->particleLink());
493  }
494 
495  return StatusCode::SUCCESS;
496 }
497 
499 
500  if (m_SmearPixel)
502  else
504 }
505 
506 template<typename CLUSTER>
508 
509  // take needed information on the first clusters
510  Amg::Vector2D intersection_a = clusterA->localPosition();
511 
512  // take needed information on the second clusters
513  Amg::Vector2D intersection_b = clusterB->localPosition();
514 
515  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: intersection_a = " << intersection_a);
516  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: intersection_b = " << intersection_b);
517 
518  double distX = intersection_a.x() - intersection_b.x();
519  double distY = intersection_a.y() - intersection_b.y();
520 
521  return sqrt(distX*distX + distY*distY);
522 }
523 
524 template<typename CLUSTER>
526  // take needed information on the first cluster
527  const Amg::MatrixX& clusterErr_a = clusterA->localCovariance();
528 
529  // take needed information on the second clusters
530  const Amg::MatrixX& clusterErr_b = clusterB->localCovariance();
531 
532  double sigmaX = sqrt(Amg::error(clusterErr_a,Trk::locX) * Amg::error(clusterErr_a,Trk::locX) +
533  Amg::error(clusterErr_b,Trk::locX) * Amg::error(clusterErr_b,Trk::locX));
534 
535  double sigmaY = sqrt(Amg::error(clusterErr_a,Trk::locY) * Amg::error(clusterErr_a,Trk::locY) +
536  Amg::error(clusterErr_b,Trk::locY) * Amg::error(clusterErr_b,Trk::locY));
537 
538  return sqrt(sigmaX*sigmaX + sigmaY*sigmaY);
539 }
540 
541 template<typename CLUSTER>
543  // take needed information on the first clusters
544  Amg::Vector2D intersection_a = clusterA->localPosition();
545  const Amg::MatrixX& clusterErr_a = clusterA->localCovariance();
546 
547  // take needed information on the second clusters
548  Amg::Vector2D intersection_b = clusterB->localPosition();
549  const Amg::MatrixX& clusterErr_b = clusterB->localCovariance();
550 
551  double sigmaX = sqrt(Amg::error(clusterErr_a,Trk::locX) * Amg::error(clusterErr_a,Trk::locX) +
552  Amg::error(clusterErr_b,Trk::locX) * Amg::error(clusterErr_b,Trk::locX));
553 
554  double sigmaY = sqrt(Amg::error(clusterErr_a,Trk::locY) * Amg::error(clusterErr_a,Trk::locY) +
555  Amg::error(clusterErr_b,Trk::locY) * Amg::error(clusterErr_b,Trk::locY));
556 
557  double interX = 0.5*(intersection_a.x()+intersection_b.x());
558  double interY = 0.5*(intersection_a.y()+intersection_b.y());
559 
560  Amg::Vector2D intersection(interX, interY);
561 
562  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: intersection = " << intersection);
563 
564  const InDet::SiWidth& siWidth_a = clusterA->width();
565  const InDet::SiWidth& siWidth_b = clusterB->width();
566 
567  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: siWidth_a = " << siWidth_a);
568  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: siWidth_b = " << siWidth_b);
569 
570  Amg::Vector2D colRow = siWidth_a.colRow() + siWidth_b.colRow();
571  Amg::Vector2D phiRz = siWidth_a.widthPhiRZ() + siWidth_b.widthPhiRZ();
572 
573  InDet::SiWidth siWidth(colRow, phiRz);
574 
575  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: siWidth = " << siWidth);
576 
577  AmgSymMatrix(2) covariance;
578  covariance.setIdentity();
579  covariance(Trk::locX,Trk::locX) = sigmaX*sigmaX;
580  covariance(Trk::locY,Trk::locY) = sigmaY*sigmaY;
581  Amg::MatrixX clusterErr = covariance;
582 
583  return ClusterInfo( intersection, siWidth, clusterErr );
584 
585 }
586 
588 {
589  // The idea is first to check how many cluster we have to merge and then merge them.
590  // The loop is done until there aren't any clusters to merge
591 
592  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: in mergeClusters() using PixelClusters --- ");
593 
594  Pixel_detElement_RIO_map::iterator i = cluster_map->begin();
595  Pixel_detElement_RIO_map::iterator e = cluster_map->end();
596 
597  for (; i != e; i = cluster_map->upper_bound(i->first)){
598  IdentifierHash current_id = i->first;
599  // Check if clusters with current_id have been already considered
600 
601  bool NewMerge = true;
602 
603  while (NewMerge) {
604  NewMerge = false;
605  std::pair <Pixel_detElement_RIO_map::iterator, Pixel_detElement_RIO_map::iterator> range = cluster_map->equal_range(current_id);
606 
607  for ( Pixel_detElement_RIO_map::iterator iter = range.first; iter != range.second; ++iter){
608  for (Pixel_detElement_RIO_map::iterator inner_iter = std::next(iter); inner_iter != range.second; ++inner_iter){
609 
610  double dist = calculateDistance((*iter).second,(*inner_iter).second);
611  double sigma = calculateSigma((*iter).second,(*inner_iter).second);
612 
613  if( dist <= m_nSigma * sigma) {
614 
615  std::vector<Identifier> rdoList;
616 
618  InDet::SiWidth siWidth;
619  Amg::MatrixX clusterErr;
620  std::tie( intersection, siWidth, clusterErr ) = calculateNewCluster( iter->second, inner_iter->second );
621 
622  const InDetDD::SiDetectorElement* hitSiDetElement = (((*inner_iter).second)->detectorElement());
623  Identifier intersectionId = hitSiDetElement->identifierOfPosition(intersection);
624 
625  rdoList.push_back(intersectionId);
626 
627  InDetDD::SiCellId currentCellId = hitSiDetElement->cellIdFromIdentifier(intersectionId);
628 
629  if ( !currentCellId.isValid() ) {
630  continue;
631  }
632 
634  intersection,
635  std::move(rdoList),
636  siWidth,
637  hitSiDetElement,
638  std::move(clusterErr));
639  ((*inner_iter).second) = pixelCluster;
640 
641  cluster_map->erase(iter);
642  NewMerge = true;
643  goto REPEAT_LOOP;
644  }
645  }
646  }
647  REPEAT_LOOP: ;
648  }
649  }
650 
651  return StatusCode::SUCCESS;
652 }
653 
654 StatusCode SiSmearedDigitizationTool::mergeClusters(SCT_detElement_RIO_map * cluster_map)
655 {
656  // The idea is first to check how many cluster we have to merge and then merge them.
657  // The loop is done until there aren't any clusters to merge
658 
659  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: in mergeClusters() using SCT_Clusters --- ");
660 
661  SCT_detElement_RIO_map::iterator i = cluster_map->begin();
662  SCT_detElement_RIO_map::iterator e = cluster_map->end();
663 
664  for (; i != e; i = cluster_map->upper_bound(i->first)){
665  IdentifierHash current_id = i->first;
666  // Check if clusters with current_id have been already considered
667  bool NewMerge = true;
668 
669  while (NewMerge) {
670  NewMerge = false;
671 
672  std::pair <SCT_detElement_RIO_map::iterator, SCT_detElement_RIO_map::iterator> range = cluster_map->equal_range(current_id);
673  for ( SCT_detElement_RIO_map::iterator iter = range.first; iter != range.second; ++iter){
674  for ( SCT_detElement_RIO_map::iterator inner_iter = std::next(iter); inner_iter != range.second; ++inner_iter){
675 
676  double dist = calculateDistance((*iter).second,(*inner_iter).second);
677 
678  double sigma = calculateSigma((*iter).second,(*inner_iter).second);
679 
680  if( dist <= m_nSigma * sigma) {
681 
682  std::vector<Identifier> rdoList;
683 
685  InDet::SiWidth siWidth;
686  Amg::MatrixX clusterErr;
687  std::tie( intersection, siWidth, clusterErr ) = calculateNewCluster( iter->second, inner_iter->second );
688 
689  const InDetDD::SiDetectorElement* hitSiDetElement = (((*inner_iter).second)->detectorElement());
690  Identifier intersectionId = hitSiDetElement->identifierOfPosition(intersection);
691 
692  rdoList.push_back(intersectionId);
693 
694  InDetDD::SiCellId currentCellId = hitSiDetElement->cellIdFromIdentifier(intersectionId);
695 
696  if ( !currentCellId.isValid() ) {
697  continue;
698  }
699 
700  InDet::SCT_Cluster* sctCluster = new InDet::SCT_Cluster(intersectionId,
701  intersection,
702  std::vector<Identifier>(rdoList),
703  siWidth,
704  hitSiDetElement,
705  Amg::MatrixX(clusterErr));
706  ((*inner_iter).second) = sctCluster;
707 
708  cluster_map->erase(iter);
709  NewMerge = true;
710  goto REPEAT_LOOP;
711  }
712  }
713  }
714  REPEAT_LOOP: ;
715  }
716  }
717 
718  return StatusCode::SUCCESS;
719 }
720 
723 {
724  // Set the RNG to use for this event.
725  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, m_randomEngineName);
726  const std::string rngName = name()+m_randomEngineName;
727  rngWrapper->setSeed( rngName, ctx );
728  CLHEP::HepRandomEngine *rndmEngine = rngWrapper->getEngine(ctx);
729 
730  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: in SiSmearedDigizationTool::digitize() ---" );
731 
732  // Get PixelDetectorElementCollection
733  const InDetDD::SiDetectorElementCollection* elementsPixel = nullptr;
734  if (m_SmearPixel) {
736  elementsPixel = pixelDetEle.retrieve();
737  if (elementsPixel==nullptr) {
738  ATH_MSG_FATAL(m_pixelDetEleCollKey.fullKey() << " could not be retrieved");
739  return StatusCode::FAILURE;
740  }
741  }
742  // Get SCT_DetectorElementCollection
743  const InDetDD::SiDetectorElementCollection* elementsSCT = nullptr;
744  if (not m_SmearPixel) {
746  elementsSCT = sctDetEle.retrieve();
747  if (elementsSCT==nullptr) {
748  ATH_MSG_FATAL(m_SCTDetEleCollKey.fullKey() << " could not be retrieved");
749  return StatusCode::FAILURE;
750  }
751  }
752 
754 
755  if(m_SmearPixel) { // Smear Pixel
757  } else {// Smear SCT
759  }
760 
761  while (thpcsi.nextDetectorElement(i, e)) {
762 
763  while (i != e) {
764  m_useDiscSurface = false;
765 
766  const TimedHitPtr<SiHit>& hit(*i++);
767  int barrelEC = hit->getBarrelEndcap();
768  int layerDisk = hit->getLayerDisk();
769  int phiModule = hit->getPhiModule();
770  int etaModule = hit->getEtaModule();
771  int side = 0;
772 
773  const InDetDD::SiDetectorElement* hitSiDetElement = nullptr;
774 
775  if(m_SmearPixel) { // Smear Pixel
776  Identifier wafer_id = m_pixel_ID->wafer_id(barrelEC,layerDisk,phiModule,etaModule);
777  IdentifierHash wafer_hash = m_pixel_ID->wafer_hash(wafer_id);
778  const InDetDD::SiDetectorElement* hitSiDetElement_temp = elementsPixel->getDetectorElement(wafer_hash);
779  ATH_MSG_DEBUG("Pixel SiDetectorElement --> barrel_ec " << barrelEC << ", layer_disk " << layerDisk << ", phi_module " << phiModule << ", eta_module " << etaModule );
780  hitSiDetElement = hitSiDetElement_temp;
781  } else { // Smear SCT
782  side = hit->getSide();
783  Identifier idwafer = m_sct_ID->wafer_id(barrelEC,layerDisk,phiModule,etaModule,side);
784  IdentifierHash idhash = m_sct_ID->wafer_hash(m_sct_ID->wafer_id(idwafer));
785  const InDetDD::SiDetectorElement* hitSiDetElement_temp = elementsSCT->getDetectorElement(idhash);
786  ATH_MSG_DEBUG("SCT SiDetectorElement --> barrel_ec " << barrelEC << ", layer_disk " << layerDisk << ", phi_module " << phiModule << ", eta_module " << etaModule << ", side " << side);
787  hitSiDetElement = hitSiDetElement_temp;
788  }
789 
790  // untangling the logic: if not using custom geometry, hitSiDetElement
791  // gets dereferenced (and should be checked)
792  //
793  // if using custom geometry, hitPlanarDetElement gets dereferenced
794  // (and should be checked)
795  if (not hitSiDetElement) {
796  ATH_MSG_FATAL("hitSiDetElement is null in SiSmearedDigitizationTool:"<<__LINE__);
797  throw std::runtime_error(std::string("hitSiDetElement is null in SiSmearedDigitizationTool::digitize() "));
798  }
799 
800  if (m_SmearPixel && !(hitSiDetElement->isPixel())) continue;
801  if (!m_SmearPixel && !(hitSiDetElement->isSCT())) continue;
802 
803  IdentifierHash waferID;
804 
805  if(m_SmearPixel) { // Smear Pixel
806  waferID = m_pixel_ID->wafer_hash(hitSiDetElement->identify());
807  } else { // Smear SCT
808  waferID = m_sct_ID->wafer_hash(hitSiDetElement->identify());
809  }
810 
811  HepGeom::Point3D<double> pix_localStartPosition = hit->localStartPosition();
812  HepGeom::Point3D<double> pix_localEndPosition = hit->localEndPosition();
813 
814  pix_localStartPosition = hitSiDetElement->hitLocalToLocal3D(pix_localStartPosition);
815  pix_localEndPosition = hitSiDetElement->hitLocalToLocal3D(pix_localEndPosition);
816 
817  double localEntryX = pix_localStartPosition.x();
818  double localEntryY = pix_localStartPosition.y();
819  double localEntryZ = pix_localStartPosition.z();
820  double localExitX = pix_localEndPosition.x();
821  double localExitY = pix_localEndPosition.y();
822  double localExitZ = pix_localEndPosition.z();
823 
824  double thickness = 0.0;
825  thickness = hitSiDetElement->thickness();
826 
827  // Transform to reconstruction local coordinates (different x,y,z ordering and sign conventions compared to simulation coords)
828  if (!m_SmearPixel) { // Smear SCT
829  HepGeom::Point3D<double> sct_localStartPosition = hit->localStartPosition();
830  HepGeom::Point3D<double> sct_localEndPosition = hit->localEndPosition();
831 
832  sct_localStartPosition = hitSiDetElement->hitLocalToLocal3D(sct_localStartPosition);
833  sct_localEndPosition = hitSiDetElement->hitLocalToLocal3D(sct_localEndPosition);
834 
835  localEntryX = sct_localStartPosition.x();
836  localEntryY = sct_localStartPosition.y();
837  localEntryZ = sct_localStartPosition.z();
838  localExitX = sct_localEndPosition.x();
839  localExitY = sct_localEndPosition.y();
840  localExitZ = sct_localEndPosition.z();
841  }
842 
843  double distX = std::abs(std::abs(localExitX)-std::abs(localEntryX));
844  double distY = std::abs(std::abs(localExitY)-std::abs(localEntryY));
845 
846  if(m_SmearPixel) { // Smear Pixel
847  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: pixel start position --- " << localEntryX << ", " << localEntryY << ", " << localEntryZ );
848  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: pixel exit position --- " << localExitX << ", " << localExitY << ", " << localExitZ );
849  m_x_entry_pixel = localEntryX;
850  m_y_entry_pixel = localEntryY;
851  m_z_entry_pixel = localEntryZ;
852  m_x_exit_pixel = localExitX;
853  m_y_exit_pixel = localExitY;
854  m_z_exit_pixel = localExitZ;
855  } else { // Smear SCT
856  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: SCT start position --- " << localEntryX << ", " << localEntryY << ", " << localEntryZ );
857  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: SCT exit position --- " << localExitX << ", " << localExitY << ", " << localExitZ );
858  m_x_entry_SCT = localEntryX;
859  m_y_entry_SCT = localEntryY;
860  m_z_entry_SCT = localEntryZ;
861  m_x_exit_SCT = localExitX;
862  m_y_exit_SCT = localExitY;
863  m_z_exit_SCT = localExitZ;
864  }
865 
866  Amg::Vector2D localEntry(localEntryX,localEntryY);
867  Amg::Vector2D localExit(localExitX,localExitY);
868 
869  // the pixel positions and other needed stuff for the geometrical clustering
870  std::vector<Identifier> rdoList;
871 
872  Amg::Vector3D localDirection(localExitX-localEntryX, localExitY-localEntryY, localExitZ-localEntryZ);
873 
874  InDetDD::SiCellId entryCellId;
875  InDetDD::SiCellId exitCellId;
876 
877  // get the identifier of the entry and the exit
878  Identifier entryId = hitSiDetElement->identifierOfPosition(localEntry);
879  Identifier exitId = hitSiDetElement->identifierOfPosition(localExit);
880 
881  // now get the cellIds and check whether they're valid
882  entryCellId = hitSiDetElement->cellIdFromIdentifier(entryId);
883  exitCellId = hitSiDetElement->cellIdFromIdentifier(exitId);
884 
885  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: entryId " << entryId << " --- exitId " << exitId );
886  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: entryCellId " << entryCellId << " --- exitCellId " << exitCellId );
887 
888  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: surface " << hitSiDetElement->surface());
889 
890  // entry / exit validity
891  bool entryValid = entryCellId.isValid();
892  bool exitValid = exitCellId.isValid();
893 
894  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: entryValid? " << entryValid << " --- exitValid? " << exitValid );
895 
896  if (!entryValid && !exitValid) continue;
897 
898  // the intersecetion id and cellId of it
899  double interX = 0.5*(localEntryX+localExitX);
900  double interY = 0.5*(localEntryY+localExitY);
901 
902  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: " << (m_SmearPixel ? "pixel" : "SCT") << " inter X --- " << interX );
903  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: " << (m_SmearPixel ? "pixel" : "SCT") << " inter Y --- " << interY );
904  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: " << (m_SmearPixel ? "pixel" : "SCT") << " dist X --- " << distX );
905  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: " << (m_SmearPixel ? "pixel" : "SCT") << " dist Y --- " << distY );
906 
907  //the particle crosses at least n pixels (in x direction you have timesX, in y direction you have timesY)
908  double timesX = (m_pitch_X) ? floor(distX/m_pitch_X) : 0;
909  double timesY = (m_pitch_Y) ? floor(distY/m_pitch_Y) : 0;
910 
911  double newdistX = distX - (timesX*m_pitch_X);
912  double newdistY = distY - (timesY*m_pitch_Y);
913 
914  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: times X --- " << timesX );
915  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: times Y --- " << timesY );
916  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: new dist X --- " << newdistX );
917  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: new dist Y --- " << newdistY );
918  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: thickness --- " << thickness );
919 
920  //Probability
921 
922  double ProbY = 2*newdistY/(m_pitch_Y+newdistY);
923  double ProbX = 2*newdistX/(m_pitch_X+newdistX);
924 
925  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: ProbX --- " << ProbX );
926  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: ProbY --- " << ProbY );
927 
928  // create the errors
929  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: pitch X --- " << m_pitch_X );
930  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: pitch Y --- " << m_pitch_Y );
931 
932  double sigmaX = m_pitch_X/sqrt(12.);
933  double sigmaY = m_pitch_Y/sqrt(12.);
934 
935  int elementX = timesX+1;
936  int elementY = timesY+1;
937 
938  if(m_SmearPixel) {
939  if (CLHEP::RandFlat::shoot(rndmEngine, 0.0, 1.0) < ProbY) { // number of crossed pixel is (timesY+1)+1
940  sigmaY = (double)(timesY+2)*m_pitch_Y/sqrt(12.);
941  elementY++;
942  } else // number of crossed pixel is (timesY+1)
943  sigmaY = (double)(timesY+1)*m_pitch_Y/sqrt(12.);
944 
945  if (CLHEP::RandFlat::shoot(rndmEngine, 0.0, 1.0) < ProbX) { // number of crossed pixel is (timesY+1)+1
946  sigmaX = (double)(timesX+2)*m_pitch_X/sqrt(12.);
947  elementX++;
948  } else // number of crossed pixel is (timesY+1)
949  sigmaX = (double)(timesX+1)*m_pitch_X/sqrt(12.);
950  }
951 
952  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool " << (m_SmearPixel ? "pixel" : "SCT") << " sigma X --- " << sigmaX);
953  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool " << (m_SmearPixel ? "pixel" : "SCT") << " sigma Y --- " << sigmaY);
954 
955 
956  double temp_X = interX;
957  double temp_Y = interY;
958 
959  Amg::Vector2D intersection(interX, interY);
960 
961  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: Intersection after smearing: " << intersection);
962 
963  Identifier intersectionId;
964  intersectionId = hitSiDetElement->identifierOfPosition(intersection);
965 
966  rdoList.push_back(intersectionId);
967  InDetDD::SiCellId currentCellId = hitSiDetElement->cellIdFromIdentifier(intersectionId);
968 
969  if (!currentCellId.isValid()) continue;
970 
971  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: Intersection Id = " << intersectionId << " --- currentCellId = " << currentCellId );
972 
973  if(m_SmearPixel) { // Smear Pixel --> Create Pixel Cluster
974 
975  double lengthX = (m_pitch_X) ? elementX*m_pitch_X : 1.;
976  double lengthY = (m_pitch_Y) ? elementY*m_pitch_Y : 1.;
977 
978  if (m_pitch_X == 0. || m_pitch_Y == 0.)
979  ATH_MSG_WARNING( "--- SiSmearedDigitizationTool: pitchX and/or pitchY are 0. Cluster length is forced to be 1. mm");
980 
981  InDet::SiWidth siWidth(Amg::Vector2D(elementX,elementY), Amg::Vector2D(lengthX, lengthY));
982 
984 
985  AmgSymMatrix(2) covariance;
986  covariance.setIdentity();
987  covariance(Trk::locX,Trk::locX) = sigmaX*sigmaX;
988  covariance(Trk::locY,Trk::locY) = sigmaY*sigmaY;
989 
990  // create the cluster
991  pixelCluster = new InDet::PixelCluster(intersectionId,
992  intersection,
993  std::vector<Identifier>(rdoList),
994  siWidth,
995  hitSiDetElement,
996  Amg::MatrixX(covariance));
997  m_pixelClusterMap->insert(std::pair<IdentifierHash, InDet::PixelCluster* >(waferID, pixelCluster));
998 
999  if (FillTruthMap(m_pixelPrdTruth, pixelCluster, hit).isFailure()) {
1000  ATH_MSG_FATAL ( "FillTruthMap() for pixel failed!" );
1001  return StatusCode::FAILURE;
1002  }
1003 
1004  if (m_checkSmear) {
1005 
1006  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: pixelCluster --> " << *pixelCluster);
1007  //Take info to store in the tree
1008  m_x_pixel = temp_X;
1009  m_y_pixel = temp_Y;
1010 
1011  m_x_pixel_smeared = (pixelCluster->localPosition()).x();
1012  m_y_pixel_smeared = (pixelCluster->localPosition()).y();
1013 
1014  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: BEFORE SMEARING LocalPosition --> X = " << m_x_pixel << " Y = " << m_y_pixel);
1015  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: LocalPosition --> X = " << m_x_pixel_smeared << " Y = " << m_y_pixel_smeared);
1016 
1017  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: GlobalPosition --> X = " << (pixelCluster->globalPosition()).x() << " Y = " << (pixelCluster->globalPosition()).y());
1018  m_x_pixel_global = (pixelCluster->globalPosition()).x();
1019  m_y_pixel_global = (pixelCluster->globalPosition()).y();
1020  m_z_pixel_global = (pixelCluster->globalPosition()).z();
1021 
1022  m_Err_x_pixel = Amg::error(pixelCluster->localCovariance(), Trk::locX);
1023  m_Err_y_pixel = Amg::error(pixelCluster->localCovariance(), Trk::locY);
1024 
1025  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: Error --> X = " << m_Err_x_pixel << " Y = " << m_Err_y_pixel);
1026 
1027  m_currentTree -> Fill();
1028  } // End of Pix smear check
1029 
1030  } else { // Smear SCT --> Create SCT Cluster
1031 
1032  // prepare the clusters
1033  InDet::SCT_Cluster * sctCluster = nullptr;
1034 
1035  // Pixel Design needed -------------------------------------------------------------
1036  const InDetDD::SCT_ModuleSideDesign* design_sct;
1037 
1038  design_sct = dynamic_cast<const InDetDD::SCT_ModuleSideDesign*>(&hitSiDetElement->design());
1039 
1040  if (!design_sct) {
1041  ATH_MSG_INFO ( "Could not get design"<< design_sct) ;
1042  continue;
1043  }
1044 
1045  // Find length of strip at centre
1046  double clusterWidth = rdoList.size()*hitSiDetElement->phiPitch(intersection);
1047  const std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends(design_sct->endsOfStrip(intersection));
1048  double stripLength = std::abs(ends.first.xEta()-ends.second.xEta());
1049 
1050  InDet::SiWidth siWidth(Amg::Vector2D(int(rdoList.size()),1),
1051  Amg::Vector2D(clusterWidth,stripLength) );
1052 
1053  const Amg::Vector2D& colRow = siWidth.colRow();
1054 
1055  AmgSymMatrix(2) mat;
1056  mat.setIdentity();
1058  mat(Trk::locY,Trk::locY) = hitSiDetElement->length()*hitSiDetElement->length()/12.;
1059 
1060  // single strip - resolution close to pitch/sqrt(12)
1061  // two-strip hits: better resolution, approx. 40% lower
1062 
1063  InDetDD::DetectorShape elShape = hitSiDetElement->design().shape();
1064  if(m_emulateAtlas && elShape == InDetDD::Trapezoid)
1065  { // rotation for endcap SCT
1066 
1067  if(colRow.x() == 1) {
1068  mat(Trk::locX,Trk::locX) = pow(siWidth.phiR(),2)/12;
1069  }
1070  else if(colRow.x() == 2) {
1071  mat(Trk::locX,Trk::locX) = pow(0.27*siWidth.phiR(),2)/12;
1072  }
1073  else {
1074  mat(Trk::locX,Trk::locX) = pow(siWidth.phiR(),2)/12;
1075  }
1076 
1077  mat(Trk::locY,Trk::locY) = pow(siWidth.z()/colRow.y(),2)/12;
1078  double sn = hitSiDetElement->sinStereoLocal(intersection);
1079  double sn2 = sn*sn;
1080  double cs2 = 1.-sn2;
1081  double w = hitSiDetElement->phiPitch(intersection)/hitSiDetElement->phiPitch();
1082  double v0 = mat(Trk::locX, Trk::locX)*w*w;
1083  double v1 = mat(Trk::locY, Trk::locY);
1084  mat(Trk::locX, Trk::locX) = (cs2*v0+sn2*v1);
1085  mat(Trk::locY, Trk::locX) = (sn*sqrt(cs2)*(v0-v1));
1086  mat(Trk::locY, Trk::locY) = (sn2*v0+cs2*v1);
1087  } // End of rotation endcap SCT
1088 
1089 
1090  sctCluster = new InDet::SCT_Cluster(intersectionId,
1091  intersection,
1092  std::vector<Identifier>(rdoList),
1093  siWidth,
1094  hitSiDetElement,
1095  Amg::MatrixX(mat));
1096 
1097  m_sctClusterMap->insert(std::pair<IdentifierHash, InDet::SCT_Cluster* >(waferID, sctCluster));
1098 
1099  if (FillTruthMap(m_SCTPrdTruth, sctCluster, hit).isFailure()) {
1100  ATH_MSG_FATAL ( "FillTruthMap() for SCT failed!" );
1101  return StatusCode::FAILURE;
1102  }
1103 
1104  if (m_checkSmear) {
1105 
1106  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: SCT_Cluster --> " << *sctCluster);
1107 
1108  //Take info to store in the tree
1109  m_x_SCT = m_useDiscSurface ? temp_Y : temp_X;
1110  m_x_SCT_smeared = (sctCluster->localPosition()).x();
1111 
1112  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: BEFORE SMEARING LocalPosition --> X = " << m_x_SCT );
1113  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: LocalPosition --> X = " << m_x_SCT_smeared );
1114 
1115  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: GlobalPosition --> X = " << (sctCluster->globalPosition()).x() << " Y = " << (sctCluster->globalPosition()).y());
1116  m_x_SCT_global = (sctCluster->globalPosition()).x();
1117  m_y_SCT_global = (sctCluster->globalPosition()).y();
1118  m_z_SCT_global = (sctCluster->globalPosition()).z();
1119 
1120  m_currentTree -> Fill();
1121  } // End smear checking
1122  } // End SCT
1123  } // while
1124  } //while
1125  return StatusCode::SUCCESS;
1126 }
1127 
1128 
1130 {
1131  // Get PixelDetectorElementCollection
1132  const InDetDD::SiDetectorElementCollection* elementsPixel = nullptr;
1133  if (m_SmearPixel) {
1135  elementsPixel = pixelDetEle.retrieve();
1136  if (elementsPixel==nullptr) {
1137  ATH_MSG_FATAL(m_pixelDetEleCollKey.fullKey() << " could not be retrieved");
1138  return StatusCode::FAILURE;
1139  }
1140  }
1141  // Get SCT_DetectorElementCollection
1142  const InDetDD::SiDetectorElementCollection* elementsSCT = nullptr;
1143  if (not m_SmearPixel) {
1145  elementsSCT = sctDetEle.retrieve();
1146  if (elementsSCT==nullptr) {
1147  ATH_MSG_FATAL(m_SCTDetEleCollKey.fullKey() << " could not be retrieved");
1148  return StatusCode::FAILURE;
1149  }
1150  }
1151 
1152  if ( m_SmearPixel ) { // Store Pixel RIOs
1153 
1154  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: in pixel createAndStoreRIOs() ---" );
1155 
1158 
1159  for ( ; i != e; i = m_pixelClusterMap->upper_bound(i->first) ) {
1160 
1161  std::pair <Pixel_detElement_RIO_map::iterator, Pixel_detElement_RIO_map::iterator> range;
1162  range = m_pixelClusterMap->equal_range(i->first);
1163 
1165  firstDetElem = range.first;
1166 
1167  IdentifierHash waferID;
1168  waferID = firstDetElem->first;
1169 
1170  const InDetDD::SiDetectorElement* detElement = elementsPixel->getDetectorElement(waferID);
1171 
1172  InDet::PixelClusterCollection *clusterCollection = new InDet::PixelClusterCollection(waferID);
1173  clusterCollection->setIdentifier(detElement->identify());
1174 
1175  for ( Pixel_detElement_RIO_map::iterator iter = range.first; iter != range.second; ++iter ) {
1176 
1177  InDet::PixelCluster* pixelCluster = (*iter).second;
1178  pixelCluster->setHashAndIndex(clusterCollection->identifyHash(),clusterCollection->size());
1179  clusterCollection->push_back(pixelCluster);
1180  }
1181 
1182  if ( m_pixelClusterContainer->addCollection( clusterCollection, waferID ).isFailure() ) {
1183  ATH_MSG_WARNING( "Could not add collection to Identifyable container !" );
1184  }
1185  } // end for
1186 
1187  m_pixelClusterMap->clear();
1188 
1189  }
1190  else { // Store SCT RIOs
1191 
1192  ATH_MSG_DEBUG( "--- SiSmearedDigitizationTool: in SCT createAndStoreRIOs() ---" );
1193 
1196 
1197  for ( ; i != e; i = m_sctClusterMap->upper_bound(i->first) ) {
1198  std::pair <SCT_detElement_RIO_map::iterator, SCT_detElement_RIO_map::iterator> range;
1199  range = m_sctClusterMap->equal_range(i->first);
1200 
1201  SCT_detElement_RIO_map::iterator firstDetElem;
1202  firstDetElem = range.first;
1203 
1204  IdentifierHash waferID;
1205  waferID = firstDetElem->first;
1206  const InDetDD::SiDetectorElement* detElement = elementsSCT->getDetectorElement(waferID);
1207 
1208  InDet::SCT_ClusterCollection *clusterCollection = new InDet::SCT_ClusterCollection(waferID);
1209  clusterCollection->setIdentifier(detElement->identify());
1210 
1211 
1212  for ( SCT_detElement_RIO_map::iterator iter = range.first; iter != range.second; ++iter ) {
1213  InDet::SCT_Cluster* sctCluster = (*iter).second;
1214  sctCluster->setHashAndIndex(clusterCollection->identifyHash(),clusterCollection->size());
1215  clusterCollection->push_back(sctCluster);
1216  }
1217 
1218  if ( m_sctClusterContainer->addCollection( clusterCollection, clusterCollection->identifyHash() ).isFailure() ) {
1219  ATH_MSG_WARNING( "Could not add collection to Identifyable container !" );
1220  }
1221 
1222  } // end for
1223 
1224  m_sctClusterMap->clear();
1225  }
1226 
1227  return StatusCode::SUCCESS;
1228 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
InDetDD::SolidStateDetectorElementBase::identifierOfPosition
Identifier identifierOfPosition(const Amg::Vector2D &localPos) const
Full identifier of the cell for a given position: assumes a raw local position (no Lorentz shift)
Definition: SolidStateDetectorElementBase.cxx:217
SiSmearedDigitizationTool::m_y_entry_pixel
double m_y_entry_pixel
Definition: SiSmearedDigitizationTool.h:167
ATHRNG::RNGWrapper::setSeed
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition: RNGWrapper.h:169
SiSmearedDigitizationTool::m_z_exit_SCT
double m_z_exit_SCT
Definition: SiSmearedDigitizationTool.h:176
SiSmearedDigitizationTool::m_pitch_Y
float m_pitch_Y
Definition: SiSmearedDigitizationTool.h:118
SiSmearedDigitizationTool::m_x_pixel_global
double m_x_pixel_global
Definition: SiSmearedDigitizationTool.h:169
SiSmearedDigitizationTool::m_HardScatterSplittingSkipper
bool m_HardScatterSplittingSkipper
Definition: SiSmearedDigitizationTool.h:131
SiWidth.h
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
SiSmearedDigitizationTool::m_pitch_X
float m_pitch_X
Definition: SiSmearedDigitizationTool.h:117
InDetDD::SiDetectorElementCollection
Definition: SiDetectorElementCollection.h:30
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::locX
@ locX
Definition: ParamDefs.h:43
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:44
SiSmearedDigitizationTool::retrieveTruth
StatusCode retrieveTruth()
Definition: SiSmearedDigitizationTool.cxx:443
SiSmearedDigitizationTool::m_x_exit_SCT
double m_x_exit_SCT
Definition: SiSmearedDigitizationTool.h:174
SiSmearedDigitizationTool::m_checkSmear
bool m_checkSmear
Definition: SiSmearedDigitizationTool.h:155
SiSmearedDigitizationTool::m_SmearPixel
bool m_SmearPixel
Definition: SiSmearedDigitizationTool.h:148
SiSmearedDigitizationTool::m_z_exit_pixel
double m_z_exit_pixel
Definition: SiSmearedDigitizationTool.h:165
SiSmearedDigitizationTool::FillTruthMap
StatusCode FillTruthMap(PRD_MultiTruthCollection *, CLUSTER *, const TimedHitPtr< SiHit > &)
Definition: SiSmearedDigitizationTool.cxx:483
PixelCluster.h
SCT_ModuleSideDesign.h
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SiSmearedDigitizationTool::m_pixelClusterContainer
InDet::PixelClusterContainer * m_pixelClusterContainer
the PixelClusterContainer
Definition: SiSmearedDigitizationTool.h:125
SiSmearedDigitizationTool::m_merge
bool m_merge
Definition: SiSmearedDigitizationTool.h:120
InDetDD::SCT_ModuleSideDesign
Definition: SCT_ModuleSideDesign.h:40
InDet::SiWidth::widthPhiRZ
const Amg::Vector2D & widthPhiRZ() const
Definition: SiWidth.h:121
PRD_MultiTruthCollection
A PRD is mapped onto all contributing particles.
Definition: PRD_MultiTruthCollection.h:24
SiSmearedDigitizationTool::m_pixelClusterMap
Pixel_detElement_RIO_map * m_pixelClusterMap
Definition: SiSmearedDigitizationTool.h:144
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:53
EventPrimitivesHelpers.h
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
LineIntersection2D.h
AtlasHitsVector
Definition: AtlasHitsVector.h:33
InDetDD::SiCellId::isValid
bool isValid() const
Test if its in a valid state.
Definition: SiCellId.h:136
SiSmearedDigitizationTool::calculateSigma
double calculateSigma(CLUSTER *clusterA, CLUSTER *clusterB)
Definition: SiSmearedDigitizationTool.cxx:525
SiSmearedDigitizationTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
PileUp Merge service.
Definition: SiSmearedDigitizationTool.h:129
SiSmearedDigitizationTool::m_z_SCT_global
double m_z_SCT_global
Definition: SiSmearedDigitizationTool.h:182
InDet::SCT_ClusterContainer
Trk::PrepRawDataContainer< SCT_ClusterCollection > SCT_ClusterContainer
Definition: SCT_ClusterContainer.h:27
SiSmearedDigitizationTool::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition: SiSmearedDigitizationTool.h:109
SCT_ForwardModuleSideDesign.h
SiSmearedDigitizationTool::calculateDistance
double calculateDistance(CLUSTER *clusterA, CLUSTER *clusterB)
Definition: SiSmearedDigitizationTool.cxx:507
SiSmearedDigitizationTool::calculateNewCluster
ClusterInfo calculateNewCluster(CLUSTER *clusterA, CLUSTER *clusterB)
Definition: SiSmearedDigitizationTool.cxx:542
PileUpTimeEventIndex::index
index_type index() const
the index of the component event in PileUpEventInfo
Definition: PileUpTimeEventIndex.cxx:76
SiSmearedDigitizationTool::m_y_SCT_global
double m_y_SCT_global
Definition: SiSmearedDigitizationTool.h:181
TimedHitPtr< SiHit >
InDet::PixelClusterContainer
Trk::PrepRawDataContainer< PixelClusterCollection > PixelClusterContainer
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelClusterContainer.h:28
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SiSmearedDigitizationTool::SiSmearedDigitizationTool
SiSmearedDigitizationTool()
beamspotman.sigmaX
sigmaX
Definition: beamspotman.py:1625
HepMC::ignoreTruthLink
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
Definition: MagicNumbers.h:296
beamspotman.sigmaY
sigmaY
Definition: beamspotman.py:1625
x
#define x
TimedHitCollection::nextDetectorElement
bool nextDetectorElement(const_iterator &b, const_iterator &e)
sets an iterator range with the hits of current detector element returns a bool when done
SCT_Cluster.h
intersection
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
Definition: compareFlatTrees.cxx:25
DataHandle.h
SiSmearedDigitizationTool::mergeClusters
StatusCode mergeClusters(Pixel_detElement_RIO_map *cluster_map)
Definition: SiSmearedDigitizationTool.cxx:587
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:52
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
IPixelClusteringTool.h
SiSmearedDigitizationTool::m_sctClusterContainer
InDet::SCT_ClusterContainer * m_sctClusterContainer
the SCT_ClusterContainer
Definition: SiSmearedDigitizationTool.h:127
PileUpToolBase::m_vetoPileUpTruthLinks
Gaudi::Property< int > m_vetoPileUpTruthLinks
Definition: PileUpToolBase.h:58
SiSmearedDigitizationTool::processBunchXing
StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents)
Definition: SiSmearedDigitizationTool.cxx:277
PileUpMergeSvc::TimedList::type
std::list< value_t > type
type of the collection of timed data object
Definition: PileUpMergeSvc.h:75
TRT::Hit::side
@ side
Definition: HitInfo.h:83
SiSmearedDigitizationTool::m_Err_y_pixel
double m_Err_y_pixel
Definition: SiSmearedDigitizationTool.h:189
SiSmearedDigitizationTool::m_x_pixel
double m_x_pixel
Definition: SiSmearedDigitizationTool.h:161
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
InDetDD::SiDetectorElement::cellIdFromIdentifier
virtual SiCellId cellIdFromIdentifier(const Identifier &identifier) const override final
SiCellId from Identifier.
Definition: SiDetectorElement.cxx:120
SiReadoutCellId.h
PixelID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: PixelID.h:387
SiSmearedDigitizationTool::m_randomEngineName
std::string m_randomEngineName
Name of the random number stream.
Definition: SiSmearedDigitizationTool.h:115
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::ReadCondHandle::retrieve
const_pointer_type retrieve()
Definition: ReadCondHandle.h:161
TimedHitCollection::insert
void insert(const PileUpTimeEventIndex &timeEventIndex, const AtlasHitsVector< HIT > *inputCollection)
SiSmearedDigitizationTool::m_x_SCT_smeared
double m_x_SCT_smeared
Definition: SiSmearedDigitizationTool.h:186
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
ClusterMakerTool.h
SiSmearedDigitizationTool::m_useDiscSurface
bool m_useDiscSurface
Definition: SiSmearedDigitizationTool.h:123
parseMapping.v0
def v0
Definition: parseMapping.py:149
SiSmearedDigitizationTool::initialize
StatusCode initialize()
Definition: SiSmearedDigitizationTool.cxx:136
lumiFormat.i
int i
Definition: lumiFormat.py:92
SiSmearedDigitizationTool::m_sctClusterMap
SCT_detElement_RIO_map * m_sctClusterMap
Definition: SiSmearedDigitizationTool.h:146
SiSmearedDigitizationTool::m_z_entry_SCT
double m_z_entry_SCT
Definition: SiSmearedDigitizationTool.h:179
z
#define z
SiSmearedDigitizationTool::digitize
StatusCode digitize(const EventContext &ctx, TimedHitCollection< SiHit > &thpcsi)
Definition: SiSmearedDigitizationTool.cxx:721
Trk::PrepRawData::setHashAndIndex
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
TEMP for testing: might make some classes friends later ...
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
test_pyathena.parent
parent
Definition: test_pyathena.py:15
SiSmearedDigitizationTool::m_thistSvc
ITHistSvc * m_thistSvc
Definition: SiSmearedDigitizationTool.h:157
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SiSmearedDigitizationTool::finalize
StatusCode finalize()
Definition: SiSmearedDigitizationTool.cxx:247
SiSmearedDigitizationTool::m_y_pixel_smeared
double m_y_pixel_smeared
Definition: SiSmearedDigitizationTool.h:185
SiSmearedDigitizationTool::processAllSubEvents
StatusCode processAllSubEvents(const EventContext &ctx)
Definition: SiSmearedDigitizationTool.cxx:318
SCT_ID::wafer_hash
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
Definition: SCT_ID.h:492
SiSmearedDigitizationTool::SCT_detElement_RIO_map
std::multimap< IdentifierHash, InDet::SCT_Cluster * > SCT_detElement_RIO_map
Definition: SiSmearedDigitizationTool.h:83
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
InDet::SCT_Cluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SCT_Cluster.h:34
SiSmearedDigitizationTool.h
SiSmearedDigitizationTool::m_z_entry_pixel
double m_z_entry_pixel
Definition: SiSmearedDigitizationTool.h:168
PileUpToolBase
Definition: PileUpToolBase.h:18
SiSmearedDigitizationTool::m_x_entry_SCT
double m_x_entry_SCT
Definition: SiSmearedDigitizationTool.h:177
SiSmearedDigitizationTool::m_y_pixel_global
double m_y_pixel_global
Definition: SiSmearedDigitizationTool.h:170
SiSmearedDigitizationTool::m_y_exit_pixel
double m_y_exit_pixel
Definition: SiSmearedDigitizationTool.h:164
SiSmearedDigitizationTool::m_SCTDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
Definition: SiSmearedDigitizationTool.h:110
SiSmearedDigitizationTool::createAndStoreRIOs
StatusCode createAndStoreRIOs(const EventContext &ctx)
Definition: SiSmearedDigitizationTool.cxx:1129
SiSmearedDigitizationTool::m_prdTruthNamePixel
std::string m_prdTruthNamePixel
Definition: SiSmearedDigitizationTool.h:134
SiSmearedDigitizationTool::m_pixelPrdTruth
PRD_MultiTruthCollection * m_pixelPrdTruth
Definition: SiSmearedDigitizationTool.h:133
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
SiSmearedDigitizationTool::m_simHitColl
SiHitCollection * m_simHitColl
Definition: SiSmearedDigitizationTool.h:139
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SCT_ID::wafer_hash_max
size_type wafer_hash_max(void) const
Definition: SCT_ID.cxx:639
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
PileUpTimeEventIndex::time
time_type time() const
bunch xing time in ns
Definition: PileUpTimeEventIndex.cxx:71
Amg::error
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Definition: EventPrimitivesHelpers.h:40
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
SiSmearedDigitizationTool::m_Err_x_pixel
double m_Err_x_pixel
Definition: SiSmearedDigitizationTool.h:188
SiCluster.h
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
SiSmearedDigitizationTool::m_HardScatterSplittingMode
int m_HardScatterSplittingMode
Process all SiHit or just those from signal or background events.
Definition: SiSmearedDigitizationTool.h:130
PixelID::wafer_hash_max
size_type wafer_hash_max(void) const
Definition: PixelID.cxx:912
SiSmearedDigitizationTool::m_siHitCollList
std::vector< SiHitCollection * > m_siHitCollList
name of the sub event hit collections.
Definition: SiSmearedDigitizationTool.h:142
InDet::SiClusterContainer
Trk::PrepRawDataContainer< SiClusterCollection > SiClusterContainer
Definition: SiClusterContainer.h:26
SiSmearedDigitizationTool::m_emulateAtlas
bool m_emulateAtlas
Definition: SiSmearedDigitizationTool.h:150
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
InDetDD::DetectorShape
DetectorShape
Definition: DetectorDesign.h:41
SiSmearedDigitizationTool::m_z_pixel_global
double m_z_pixel_global
Definition: SiSmearedDigitizationTool.h:171
SiDetectorElement.h
ATHRNG::RNGWrapper::getEngine
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition: RNGWrapper.h:134
RNGWrapper.h
SiSmearedDigitizationTool::m_currentTree
TTree * m_currentTree
the tree to store information from pixel and SCT (before and after smearing)
Definition: SiSmearedDigitizationTool.h:159
SiSmearedDigitizationTool::m_inputObjectName
std::string m_inputObjectName
Definition: SiSmearedDigitizationTool.h:140
InDetDD::SiCellId
Definition: SiCellId.h:29
InDet::PixelCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:49
Trk::pixelCluster
@ pixelCluster
Definition: MeasurementType.h:22
SiSmearedDigitizationTool::m_pixel_SiClustersName
std::string m_pixel_SiClustersName
Definition: SiSmearedDigitizationTool.h:152
SiHitCollection
AtlasHitsVector< SiHit > SiHitCollection
Definition: SiHitCollection.h:14
InDet::SiCluster::globalPosition
const Amg::Vector3D & globalPosition() const
return global position reference
SiClusterContainer.h
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
SCT_BarrelModuleSideDesign.h
y
#define y
TRT::Hit::phiModule
@ phiModule
Definition: HitInfo.h:80
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
SiSmearedDigitizationTool::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service.
Definition: SiSmearedDigitizationTool.h:107
PixelModuleDesign.h
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
SiSmearedDigitizationTool::m_y_exit_SCT
double m_y_exit_SCT
Definition: SiSmearedDigitizationTool.h:175
InDetSimDataCollection.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SiSmearedDigitizationTool::m_Err_x_SCT
double m_Err_x_SCT
Definition: SiSmearedDigitizationTool.h:190
SiSmearedDigitizationTool::m_x_SCT
double m_x_SCT
Definition: SiSmearedDigitizationTool.h:173
InDet::SiWidth
Definition: SiWidth.h:25
InDet::SiWidth::colRow
const Amg::Vector2D & colRow() const
Definition: SiWidth.h:115
DiscSurface.h
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
AtlasHitsVector::size
size_type size() const
Definition: AtlasHitsVector.h:143
SiSmearedDigitizationTool::m_Sct_SiClustersName
std::string m_Sct_SiClustersName
Definition: SiSmearedDigitizationTool.h:153
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
SiSmearedDigitizationTool::m_x_SCT_global
double m_x_SCT_global
Definition: SiSmearedDigitizationTool.h:180
SiSmearedDigitizationTool::m_x_entry_pixel
double m_x_entry_pixel
Definition: SiSmearedDigitizationTool.h:166
SiSmearedDigitizationTool::prepareEvent
StatusCode prepareEvent(const EventContext &ctx, unsigned int)
Definition: SiSmearedDigitizationTool.cxx:265
InDet::SiWidth::phiR
double phiR() const
Definition: SiWidth.h:126
SiSmearedDigitizationTool::m_pixel_ID
const PixelID * m_pixel_ID
Handle to the ID helper.
Definition: SiSmearedDigitizationTool.h:112
SiSmearedDigitizationTool::m_y_pixel
double m_y_pixel
Definition: SiSmearedDigitizationTool.h:162
SiSmearedDigitizationTool::m_x_pixel_smeared
double m_x_pixel_smeared
Definition: SiSmearedDigitizationTool.h:184
SiSmearedDigitizationTool::m_sct_ID
const SCT_ID * m_sct_ID
Handle to the ID helper.
Definition: SiSmearedDigitizationTool.h:113
SCT_ID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
Definition: SCT_ID.h:464
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
SiCellId.h
InDet::SCT_ClusterCollection
Trk::PrepRawDataCollection< SCT_Cluster > SCT_ClusterCollection
Definition: SCT_ClusterCollection.h:26
PileUpTimeEventIndex
a struct encapsulating the identifier of a pile-up event
Definition: PileUpTimeEventIndex.h:12
SiSmearedDigitizationTool::mergeEvent
StatusCode mergeEvent(const EventContext &ctx)
Definition: SiSmearedDigitizationTool.cxx:498
SiSmearedDigitizationTool::m_nSigma
double m_nSigma
Definition: SiSmearedDigitizationTool.h:121
PileUpTimeEventIndex::type
PileUpType type() const
the pileup type - minbias, cavern, beam halo, signal?
Definition: PileUpTimeEventIndex.cxx:81
InDetDD::SCT_ModuleSideDesign::endsOfStrip
virtual std::pair< SiLocalPosition, SiLocalPosition > endsOfStrip(const SiLocalPosition &position) const override=0
give the ends of strips
SiSmearedDigitizationTool::Pixel_detElement_RIO_map
std::multimap< IdentifierHash, InDet::PixelCluster * > Pixel_detElement_RIO_map
Definition: SiSmearedDigitizationTool.h:82
SiSmearedDigitizationTool::m_y_entry_SCT
double m_y_entry_SCT
Definition: SiSmearedDigitizationTool.h:178
InDetDD::SiDetectorElementCollection::getDetectorElement
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Definition: SiDetectorElementCollection.cxx:15
TimedHitCollection< SiHit >
InDet::SiWidth::z
double z() const
Definition: SiWidth.h:131
SiDetectorDesign.h
InDetDD::SolidStateDetectorElementBase::identify
virtual Identifier identify() const override final
identifier of this detector element (inline)
SiSmearedDigitizationTool::m_outputFile
TFile * m_outputFile
the root file
Definition: SiSmearedDigitizationTool.h:158
InDet::PixelClusterCollection
Trk::PrepRawDataCollection< PixelCluster > PixelClusterCollection
Definition: PixelClusterCollection.h:26
SiSmearedDigitizationTool::m_SCTPrdTruth
PRD_MultiTruthCollection * m_SCTPrdTruth
Definition: SiSmearedDigitizationTool.h:136
InDetDD::Trapezoid
@ Trapezoid
Definition: DetectorDesign.h:42
ClusterInfo
std::tuple< Amg::Vector2D, InDet::SiWidth, Amg::MatrixX > ClusterInfo
Definition: SiSmearedDigitizationTool.h:44
SiSmearedDigitizationTool::m_prdTruthNameSCT
std::string m_prdTruthNameSCT
Definition: SiSmearedDigitizationTool.h:137
SiSmearedDigitizationTool::m_x_exit_pixel
double m_x_exit_pixel
Definition: SiSmearedDigitizationTool.h:163
SiHitCollection.h