All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
VTXDigitizer.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 #include "VTXDigitizer.h"
3 #include <iostream>
4 #include <EVENT/LCCollection.h>
5 #include <IMPL/LCRelationImpl.h>
6 #include <EVENT/SimTrackerHit.h>
7 #include <EVENT/MCParticle.h>
8 #include <IMPL/LCFlagImpl.h>
9 #include "random.h"
10 #include "gsl/gsl_sf_erf.h"
11 #include "CLHEP/Random/RandGauss.h"
12 #include "CLHEP/Random/RandPoisson.h"
13 #include "CLHEP/Random/RandFlat.h"
14 
15 
16 // STUFF needed for GEAR
17 #include <marlin/Global.h>
18 #include <gear/GEAR.h>
19 #include <gear/VXDParameters.h>
20 #include <gear/VXDLayerLayout.h>
21 
22 namespace CLHEP{} // declare namespace CLHEP for backward compatibility
23 using namespace CLHEP ;
24 
25 using namespace lcio ;
26 using namespace marlin ;
27 using namespace std ;
28 
29 typedef std::vector<SimTrackerHit*> SimTrackerHitVec;
30 
32 
33 
34 VTXDigitizer::VTXDigitizer() : Processor("VTXDigitizer") {
35 
36  // modify processor description
37  _description = "VTXDigitizer should create VTX TrackerHits from SimTrackerHits" ;
38 
39 
40  // register steering parameters: name, description, class-variable, default value
41 
42  registerInputCollection( LCIO::SIMTRACKERHIT,
43  "CollectionName" ,
44  "Name of the SimTrackerHit collection" ,
45  _colName ,
46  std::string("VXDCollection") ) ;
47 
48  registerOutputCollection( LCIO::TRACKERHIT,
49  "OutputCollectionName" ,
50  "Name of the output TrackerHit collection" ,
52  std::string("VTXTrackerHits") ) ;
53 
54  registerOutputCollection( LCIO::LCRELATION,
55  "RelationColName" ,
56  "Name of the output VTX trackerhit relation collection" ,
58  std::string("VTXRelation") ) ;
59 
60  registerProcessorParameter("TanLorentz",
61  "Tangent of Lorentz Angle",
63  (double)0.8);
64 
65  registerProcessorParameter("CutOnDeltaRays",
66  "Cut on delta-ray energy (MeV)",
68  (double)0.030);
69 
70  registerProcessorParameter("Diffusion",
71  "Diffusion coefficient (in mm) for layer thickness",
73  (double)0.002);
74 
75 
76 
77  registerProcessorParameter("PixelSizeX",
78  "Pixel Size X",
80  (double)0.025);
81 
82 
83  registerProcessorParameter("PixelSizeY",
84  "Pixel Size Y",
86  (double)0.025);
87 
88  registerProcessorParameter("Debug",
89  "Debug option",
90  _debug,
91  int(0));
92 
93 
94 
95  registerProcessorParameter("ElectronsPerKeV",
96  "Electrons per keV",
98  (double)270.3);
99 
100 
101 
102 
103 
104  std::vector<float> bkgdHitsInLayer;
105  bkgdHitsInLayer.push_back(34400.);
106  bkgdHitsInLayer.push_back(23900.);
107  bkgdHitsInLayer.push_back(9600.);
108  bkgdHitsInLayer.push_back(5500.);
109  bkgdHitsInLayer.push_back(3100.);
110  registerProcessorParameter("BackgroundHitsPerLayer",
111  "Background Hits per Layer",
113  bkgdHitsInLayer);
114 
115  registerProcessorParameter("SegmentLength",
116  "Segment Length",
118  double(0.005));
119 
120  registerProcessorParameter("WidthOfCluster",
121  "Width of cluster",
123  double(3.0));
124 
125 
126  registerProcessorParameter("Threshold",
127  "Cell Threshold in electrons",
128  _threshold,
129  200.);
130 
131  registerProcessorParameter("PoissonSmearing",
132  "Apply Poisson smearing of electrons collected on pixels",
134  1);
135 
136  registerProcessorParameter("ElectronicEffects",
137  "Apply Electronic Effects",
139  int(1));
140 
141  registerProcessorParameter("ElectronicNoise",
142  "electronic noise in electrons",
144  100.);
145 
146  registerProcessorParameter("StoreFiredPixels",
147  "Store fired pixels",
149  int(0));
150 
151  registerProcessorParameter("UseMCPMomentum",
152  "Use Particle Momentum",
154  int(1));
155 
156  registerProcessorParameter("EnergyLoss",
157  "Energy Loss keV/mm",
158  _energyLoss,
159  double(280.0));
160 
161  registerProcessorParameter("RemoveDRayPixels",
162  "Remove D-Ray Pixels",
163  _removeDrays,
164  int(1));
165 
166  registerProcessorParameter("GenerateBackground",
167  "Generate Background",
169  int(0));
170 
171 }
172 
173 
174 
175 
177 
178  // usually a good idea to
179  printParameters();
180  // internal parameters
181  PI = (double)acos((double)(-1.0));
182  TWOPI = (double)(2.0)*PI;
183  PI2 = 0.5*PI;
184  _nRun = 0 ;
185  _nEvt = 0 ;
186  _totEntries = 0;
188 }
189 
190 void VTXDigitizer::processRunHeader( LCRunHeader* /*run*/) {
191 
192  _nRun++ ;
193 
194  //------Get the geometry from the gear file-----//
195 
196  const gear::VXDParameters& gearVXD = Global::GEAR->getVXDParameters() ;
197  const gear::VXDLayerLayout& layerVXD = gearVXD.getVXDLayerLayout();
198 
199  //number of layers
200  _numberOfLayers = layerVXD.getNLayers();
201 
202  //the number of ladders within layers
204 
205  //Azimuthal offset of the whole structure of each layer.
207 
208  //layer thickness and half-thickness
211 
212  //Distance from the middle of the Si sensor to IP in each layer.
214 
215  //The length of the Si sensor in each layer
217 
218  //The width and half-width of the Si sensor in each layer
221 
222  //The offset of the sensitive area in ladder in each layer
224 
225  // The gaps in z between two subladders within each layer
226  const gear::GearParameters& gearVXDInfra = Global::GEAR->getGearParameters("VXDInfra") ;
227  const std::vector<double> laddergaps = gearVXDInfra.getDoubleVals("LadderGaps");
228  std::cout<<"laddergaps size "<<laddergaps.size()<<std::endl;
229  _layerLadderGap.resize(laddergaps.size());
230 
231  //ladder offset in phi
233 
234  for(int layer = 0; layer < _numberOfLayers; layer++)
235  {
236  _laddersInLayer[layer] = layerVXD.getNLadders(layer);
237  _layerHalfPhi[layer] = layerVXD.getPhi0(layer);
238 
239  //should half phi be replaced by this from Alexei's original code?
240  _layerHalfPhi[layer] = PI/((double)_laddersInLayer[layer]);
241 
242  _layerThickness[layer] =layerVXD.getSensitiveThickness(layer);
243  _layerHalfThickness[layer] = 0.5*_layerThickness[layer];
244  _layerRadius[layer] =layerVXD.getSensitiveDistance(layer) + 0.5 * _layerThickness[layer];
245  _layerLadderLength[layer] = 2*layerVXD.getSensitiveLength(layer);
246  _layerLadderWidth[layer] = layerVXD.getSensitiveWidth(layer);
247  _layerLadderHalfWidth[layer] = _layerLadderWidth[layer]/2.;
248  _layerActiveSiOffset[layer] = - (layerVXD.getSensitiveOffset(layer));
249  _layerLadderGap[layer] = laddergaps[layer];
250  _layerPhiOffset[layer] = layerVXD.getPhi0(layer);
251  }
252 
253 
254 
255  cout<<" _numberOfLayers "<<_numberOfLayers<<endl;
256  cout<<" _pixelSizeX "<<_pixelSizeX<<endl;
257  cout<<" _pixelSizeY "<<_pixelSizeY<<endl;
258  cout<<" _electronsPerKeV "<<_electronsPerKeV<<endl;
259  cout<<" _segmentDepth "<<_segmentDepth<<endl;
260  cout<<" _currentTotalCharge "<<_currentTotalCharge<<endl;
261  for (int i=0; i<_numberOfLayers; ++i)
262  {
263  cout<<"layer "<<i<<endl;
264  cout<<" _laddersInLayer "<<_laddersInLayer[i]<<endl;
265  cout<<" _layerRadius "<<_layerRadius[i]<<endl;
266  cout<<" _layerLadderLength "<<_layerLadderLength[i]<<endl;
267  cout<<" _layerLadderHalfWidth "<<_layerLadderHalfWidth[i]<<endl;
268  cout<<" _layerPhiOffset "<<_layerPhiOffset[i]<<endl;
269  cout<<" _layerActiveSiOffset "<< _layerActiveSiOffset[i]<<endl;
270  cout<<" _layerHalfPhi "<<_layerHalfPhi[i]<<endl;
271  cout<<" _layerLadderGap "<<_layerLadderGap[i]<<endl;
272  cout<<" _bkgdHitsInLayer "<<_bkgdHitsInLayer[i]<<endl;
273  cout<<" _layerLadderWidth "<<_layerLadderWidth[i]<<endl;
274  cout<<" _layerThickness "<<_layerThickness[i]<<endl;
275 
276  cout<<" _layerHalfThickness "<<_layerHalfThickness[i]<<endl;
277 
278 
279  }
280 
281 
282  SCALING = 25000.;
283 }
284 
285 void VTXDigitizer::processEvent( LCEvent * evt ) {
286 
287  try{
288  LCCollection * STHcol = evt->getCollection( _colName ) ;
289  // LCFlagImpl flag;
290  // flag.setBit(LCIO::THBIT_MOMENTUM);
291  // STHcol->setFlag(flag.getFlag());
292  LCCollectionVec * THcol = new LCCollectionVec(LCIO::TRACKERHIT);
293  // LCCollectionVec * RelCol = new LCCollectionVec(LCIO::LCRELATION);
294  LCCollectionVec * STHLocCol = NULL;
295  // LCCollectionVec * THLocCol = NULL;
296  // LCCollectionVec * RelLocCol = NULL;
297  if (_produceFullPattern != 0) {
298  STHLocCol = new LCCollectionVec(LCIO::SIMTRACKERHIT);
299  // THLocCol = new LCCollectionVec(LCIO::TRACKERHIT);
300  // RelLocCol = new LCCollectionVec(LCIO::LCRELATION);
301  }
302 
303 
304 
305 
306  int nSTH = STHcol->getNumberOfElements();
307  // Loop over sim tracker hits;
308  for (int i=0; i<nSTH; ++i) {
309  // std::cout << "Hit number : " << i << std::endl;
310  SimTrackerHit * simTrkHit =
311  dynamic_cast<SimTrackerHit*>(STHcol->getElementAt(i));
312  // _momX = simTrkHit->getMomentum()[0];
313  // _momY = simTrkHit->getMomentum()[1];
314  // _momZ = simTrkHit->getMomentum()[2];
315  // _eDep = simTrkHit->getEDep();
316  // float totPartMomentum = sqrt(_momX*_momX+_momY*_momY+_momZ*_momZ);
317 
318  // do digitization for one SimTrackerHit
319  // Produce ionisation points along track
320  // std::cout << "Beginning of Cycle " << std::endl;
321  ProduceIonisationPoints( simTrkHit );
322  // std::cout << "End of ProduceIonisationPoints( ) " << std::endl;
323  // std::cout << "Current layer = " << _currentLayer << std::endl;
324  // std::cout << "Total particle momentum = " << totPartMomentum << std::endl;
325  bool accept = _currentLayer >= 0 && _currentLayer < int(_layerRadius.size());
326  // if (_removeDrays == 1)
327  // accept = accept && totPartMomentum > 10;
328  if ( accept ) {
329  // Produce signal points on collection plane
331  // std::cout << "End of ProduceSignalPoints( ) " << std::endl;
332  SimTrackerHitImplVec simTrkHitVec;
333  // Produce fired pixels
334  ProduceHits( simTrkHitVec );
335 
336  // for (int iHit=0; iHit<int(simTrkHitVec.size()); ++iHit) {
337 // SimTrackerHit * hit = simTrkHitVec[iHit];
338 // //cout<<"hit 1"<<iHit <<" "<<hit->getEDep()<<endl;
339 // }
340 
341  // std::cout << "End of ProduceHits( ) " << std::endl;
342  // Apply Poisson Smearing to deposited charges
343  if (_PoissonSmearing != 0) PoissonSmearer( simTrkHitVec );
344  if (_electronicEffects != 0) GainSmearer( simTrkHitVec );
345  //std::cout << "Amplitude 6 = " << _ampl << std::endl;
346  TrackerHitImpl * recoHit = ReconstructTrackerHit( simTrkHitVec );
347  //std::cout << "Amplitude 7 = " << _ampl << std::endl;
348  // std::cout << "End of ReconstructTrackerHit( ) " << std::endl;
349  if (recoHit != NULL) {
350  TrackerHitToLab( recoHit );
351  }
352  if (_debug != 0) {
353  if (recoHit == NULL)
354  std::cout << "Number of pixels above threshold = 0 " << std::endl;
355  else
356  PrintInfo( simTrkHit, recoHit );
357  }
358 
359  if ( recoHit != NULL) {
360 
361 
362  recoHit->rawHits().push_back(simTrkHit);
363  if (_produceFullPattern == 0) {
364  recoHit->rawHits().push_back(simTrkHit);
365  }
366  else {
367  int nSimHits = int( simTrkHitVec.size() );
368  for (int iS=0;iS<nSimHits;++iS) {
369  SimTrackerHitImpl * sth = simTrkHitVec[iS];
370  float charge = sth->getEDep();
371  if ( charge >_threshold) {
372  SimTrackerHitImpl * newsth = new SimTrackerHitImpl();
373  double spos[3];
374  double sLab[3];
375  for (int iC=0;iC<3;++iC)
376  spos[iC] = sth->getPosition()[iC];
377  TransformToLab(spos,sLab);
378  newsth->setPosition(sLab);
379  newsth->setEDep(charge);
380  STHLocCol->addElement(newsth);
381  recoHit->rawHits().push_back( newsth );
382  }
383  }
384  }
385 
386  float pointResoRPhi=0.004;
387  float pointResoZ=0.004;
388  float covMat[TRKHITNCOVMATRIX]={0.,0.,pointResoRPhi*pointResoRPhi,0.,0.,pointResoZ*pointResoZ};
389  recoHit->setCovMatrix(covMat);
390 
391 
392  recoHit->setType(100+simTrkHit->getCellID0());
393  THcol->addElement( recoHit );
394  // std::cout << "Hit is added to collection " << _nEvt << std::endl;
395  // LCRelationImpl * rel = new LCRelationImpl(recoHit,simTrkHit,float(1.0));
396  // RelCol->addElement(rel);
397  // Clean Up
398  for (int i=0; i < int(simTrkHitVec.size()); ++i) {
399  SimTrackerHit * hit = simTrkHitVec[i];
400  delete hit;
401  }
402  }
403  }
404  }
405  if (_generateBackground == 1)
406  generateBackground( THcol );
407 
408  evt->addCollection(THcol,_outputCollectionName.c_str());
409  // evt->addCollection(RelCol, _colVTXRelation );
410  if (_produceFullPattern != 0) {
411  evt->addCollection(STHLocCol,"VTXPixels");
412  // evt->addCollection(THLocCol,"VTXLocalTrackerHits");
413  // evt->addCollection(RelLocCol,"VTXLocalRelation");
414  }
415  }
416  catch(DataNotAvailableException &e){}
417 
418 
419  _nEvt ++ ;
420 
421  if (_nEvt % 100 == 0)
422  std::cout << "Processed " << _nEvt << "events " << std::endl;
423 
424 }
425 
426 
427 
428 void VTXDigitizer::check( LCEvent * /*evt*/ ) {
429 
430 }
431 
432 
434 
435  std::cout << "VTXDigitizer::end() " << name()
436  << " processed " << _nEvt << " events in " << _nRun << " runs "
437  << std::endl ;
438 
439  delete _fluctuate;
440 
441 }
442 
443 void VTXDigitizer::FindLocalPosition(SimTrackerHit * hit,
444  double * localPosition,
445  double * localDirection) {
446  /** Function calculates local coordinates of the sim hit
447  * in the given ladder and local momentum of particle.
448  * Also returns module number and ladder
449  * number.
450  * Local coordinate system within the ladder
451  * is defined as following : <br>
452  * - x axis lies in the ladder plane and orthogonal to the beam axis <br>
453  * - y axis is perpendicular to the ladder plane <br>
454  * - z axis lies in the ladder plane and parallel to the beam axis <br>
455  *
456  * Encoding of modules: <br>
457  * ====================== <br>
458  * - 0 = left endcap <br>
459  * - 1 = left ladder in the barrel <br>
460  * - 2 = right ladder in the barrel <br>
461  * - 3 = right endcap <br>
462  *
463  */
464 
465 
466  double xLab[3] = { hit->getPosition()[0],
467  hit->getPosition()[1],
468  hit->getPosition()[2]};
469 
470  int layer = -1;
471 
472 // FIXME : Assume for the moment only barrel in VDX
473 
474 // Find layer number by coordinates
475 
476  double RXY = sqrt(xLab[0]*xLab[0]+
477  xLab[1]*xLab[1]);
478 /*
479  for (int i=0; i<_numberOfLayers; ++i) {
480  double xmin = _layerRadius[i] - _layerThickness;
481  double xmax;
482  if (i<_numberOfLayers-1)
483  xmax = _layerRadius[i+1] - _layerThickness;
484  else
485  xmax = 2.0*_layerRadius[i];
486  // LADDERED STRUCTURE IMPLIES NUMBER OF LADDERS > 2 !!!!!
487  if (_laddersInLayer[i] > 2) {
488  xmax = xmax/(double)cos(_layerHalfPhi[i]);
489  }
490  if (RXY > xmin && RXY < xmax) {
491  layer = i;
492  break;
493  }
494  }
495 */
496 
497 
498 // layer is encoded in CellID;
499  layer = hit->getCellID0() - 1;
500 
501  _currentLayer = layer;
502 
503 // Check boundary of layers
504  if (layer < 0 || layer > _numberOfLayers)
505  return;
506 
507 // Find module by z coordinate
508 // -z : module 1
509 // +z : module 2
510  int module;
511  if (xLab[2] < 0.0 ) {
512  module = 1;
513  }
514  else {
515  module = 2;
516  }
517  _currentModule = module;
518 
519  double Momentum[3];
520  if (hit->getMCParticle()) {
521  for (int j=0; j<3; ++j)
522  Momentum[j] = hit->getMCParticle()->getMomentum()[j];
523  }
524  else {
525  for (int j=0; j<3; ++j) {
526  Momentum[j] = hit->getMomentum()[j];
527 
528  }
529  }
530 
532  if (hit->getMCParticle())
533  _currentParticleMass = hit->getMCParticle()->getMass();
534  if (_currentParticleMass < 0.510e-3)
535  _currentParticleMass = 0.510e-3;
537  for (int i=0; i<3; ++i)
538  _currentParticleMomentum += Momentum[i]*Momentum[i];
540 
541 
542 
543  double PXY = sqrt(Momentum[0]*Momentum[0]+
544  Momentum[1]*Momentum[1]);
545 
546  double PhiInLab = (double)atan2(xLab[1],xLab[0]);
547  if (PhiInLab < 0.0) PhiInLab += TWOPI;
548  double PhiInLabMom = atan2(Momentum[1],Momentum[0]);
549  if (PhiInLabMom < 0.0) PhiInLabMom += TWOPI;
550  double Radius = _layerRadius[layer];
551  // << " Radius = " << Radius << std::endl;
552 
553  double Phi0 = _layerPhiOffset[layer];
554 
555  int nLadders = _laddersInLayer[layer];
556 
557  double dPhi = 2.0*_layerHalfPhi[layer];
558  // And now compute local coordinates
559  // and local momentum of particle
560 
561  double PhiLadder=0;
562  double PhiInLocal=0;
563  //cout<<"nLadders "<<nLadders<<" "<<dPhi<<" "<<Phi0<<" "<<endl;
564 
565  if (nLadders > 2) { // laddered structure
566  //std::cout<<"laddered structure "<<std::endl;
567  int iLadder=0;
568  for (int ic=0; ic<nLadders; ++ic) {
569  // PhiLadder = - PI2 + double(ic)*dPhi + Phi0;
570  PhiLadder = double(ic)*dPhi + Phi0;
571  PhiInLocal = PhiInLab - PhiLadder;
572  //cout<<"Phi "<<PhiLadder<<" "<<PhiInLocal<<" "<<PhiInLab<<" "<<_layerThickness[layer]<<" "<<Radius<<endl;
573  if (RXY*cos(PhiInLocal)-Radius > -_layerThickness[layer] &&
574  RXY*cos(PhiInLocal)-Radius < _layerThickness[layer]) {
575  iLadder = ic;
576  break;
577  }
578  //cout<<"phi ladder "<<PhiLadder<<endl;
579  }
580  double PhiLocalMom = PhiInLabMom - PhiLadder;
581  localPosition[0] = RXY*sin(PhiInLocal);
582  localPosition[1] = xLab[2];
583  localPosition[2] = RXY*cos(PhiInLocal)-Radius;
584  localDirection[0]=PXY*sin(PhiLocalMom);
585  localDirection[1]=Momentum[2];
586  localDirection[2]=PXY*cos(PhiLocalMom);
587  _currentPhi = PhiLadder;
588  //cout<<"local direction "<<localDirection[0]<<" "<<localDirection[1]<<" "<<localDirection[2]<<endl;
589  //cout<<"phi local mom "<<PhiLocalMom<<" "<<PhiInLabMom<<" "<<PhiLadder<<endl;
590  }
591  else { // cyllindrical structure
592  //std::cout<<"cyllindrical structure "<<std::endl;
593  localPosition[0]=0.0;
594  localPosition[1]=xLab[2];
595  localPosition[2]=RXY-Radius;
596  double PhiLocalMom = PhiInLabMom - PhiInLab;
597  localDirection[0]=PXY*sin(PhiLocalMom);
598  localDirection[1]=Momentum[2];
599  localDirection[2]=PXY*cos(PhiLocalMom);
600  _currentPhi = PhiInLab;
601  }
602 
603 
604 }
605 
606 void VTXDigitizer::TransformToLab(double * xLoc, double * xLab) {
607  /** Function transforms local coordinates in the ladder
608  * into global coordinates
609  */
610 
611  int layer = _currentLayer;
612  int nLadders = _laddersInLayer[layer];
613  double Phi = _currentPhi;
614  double Radius = _layerRadius[layer];
615 
616  if (nLadders > 2 ) { // laddered structure
617  double baseLine = Radius + xLoc[2];
618  double PhiInLab = Phi + atan2(xLoc[0],baseLine);
619  double RXY = sqrt(baseLine*baseLine+xLoc[0]*xLoc[0]);
620  xLab[2] = xLoc[1];
621  xLab[0] = RXY*cos(PhiInLab);
622  xLab[1] = RXY*sin(PhiInLab);
623  }
624  else { // cyllindrical structure
625  double baseLine = Radius + xLoc[2];
626  double PhiInLab = Phi + xLoc[0]/baseLine;
627  xLab[0] = baseLine*cos(PhiInLab);
628  xLab[1] = baseLine*sin(PhiInLab);
629  xLab[2] = xLoc[1];
630  }
631 
632 }
633 
634 void VTXDigitizer::ProduceIonisationPoints( SimTrackerHit * hit) {
635  /** Produces ionisation points along track segment within active Silicon layer.
636  */
637  //std::cout << "Amplitude 1 = " << _ampl << std::endl;
638  // Position of hit in the Lab frame
639  double pos[3];
640  double dir[3];
641  double entry[3];
642  double exit[3];
643 
644  // Find local position in the ladder frame
645  FindLocalPosition( hit, pos, dir);
646  // std::cout << "End of FindLocalPosition" << std::endl;
647 
648  // check layer boundaries
649  if (_currentLayer < 0 || _currentLayer > _numberOfLayers)
650  return;
651 
652 
653  // find entry and exit points of track
654  // x = pos[0] + dir[0]*time
655  // y = pos[1] + dir[1]*time
656  // z = pos[2] + dir[2]*time
657 
658  entry[2] = -_layerHalfThickness[_currentLayer];
660 
661  for (int i=0; i<2; ++i) {
662  entry[i]=pos[i]+dir[i]*(entry[2]-pos[2])/dir[2];
663  exit[i]=pos[i]+dir[i]*(exit[2]-pos[2])/dir[2];
664  }
665 
666  for (int i=0; i<3; ++i) {
667  _currentLocalPosition[i] = pos[i];
668  _currentEntryPoint[i] = entry[i];
669  _currentExitPoint[i] = exit[i];
670  }
671 
672 
673  double tanx = dir[0]/dir[2];
674  double tany = dir[1]/dir[2];
675  double trackLength = min(1.0e+3,_layerThickness[_currentLayer]*sqrt(1.0+tanx*tanx+tany*tany));
676  //std::cout << "HERE WE ARE " << trackLength << " " << _segmentLength << " "<<_layerThickness[_currentLayer]<<" "<<tanx<<" "<<tany<<std::endl;
677 
678  double dEmean = 1e-6*_energyLoss * trackLength;
679 // _ampl = _fluctuate->SampleFluctuations(double(1000.*_currentParticleMomentum),
680 // double(1000.*_currentParticleMass),
681 // _cutOnDeltaRays,segmentLength,
682 // double(1000.*dEmean))/1000.;
683 
684 
685  // dEmean = hit->getEDep()/((double)_numberOfSegments);
686  _numberOfSegments = int(trackLength/_segmentLength) + 1;
687  //std::cout << "number of segments = " << _numberOfSegments << std::endl;
688  dEmean = dEmean/((double)_numberOfSegments);
690 
691  _eSum = 0.0;
692 
693  double segmentLength = trackLength/((double)_numberOfSegments);
695 
696  for (int i=0; i<_numberOfSegments; ++i) {
697  double z = -_layerHalfThickness[_currentLayer] + ((double)(i)+0.5)*_segmentDepth;
698  double x = pos[0]+dir[0]*(z-pos[2])/dir[2];
699  double y = pos[1]+dir[1]*(z-pos[2])/dir[2];
700  IonisationPoint ipoint;
701  double de = _fluctuate->SampleFluctuations(double(1000.*_currentParticleMomentum),
702  double(1000.*_currentParticleMass),
703  _cutOnDeltaRays,segmentLength,
704  double(1000.*dEmean))/1000.;
705  //std::cout << "segment " << i << " dE = " << de << std::endl;
706  _eSum = _eSum + de;
707  ipoint.eloss = de;
708  ipoint.x = x;
709  ipoint.y = y;
710  ipoint.z = z;
711  _ionisationPoints[i] = ipoint;
712  }
713 
714  //std::cout << "Amplitude = " << _ampl << std::endl;
715 
716 }
717 
718 
720  /** Produces signal points on the collection plane.
721  */
722 
723  double TanLorentzX = 0;
724  double TanLorentzY = 0;
725 
726  if (_currentModule == 1 || _currentModule == 2) {
727  TanLorentzX = _tanLorentzAngle;
728  }
729 
730  double inverseCosLorentzX = sqrt(1.0+TanLorentzX*TanLorentzX);
731  double inverseCosLorentzY = sqrt(1.0+TanLorentzY*TanLorentzY);
732 
734 
735  // run over ionisation points
736  for (int i=0; i<_numberOfSegments; ++i) {
738  double z = ipoint.z;
739  double x = ipoint.x;
740  double y = ipoint.y;
741  double de = ipoint.eloss;
742  double DistanceToPlane = _layerHalfThickness[_currentLayer] - z;
743  double xOnPlane = x + TanLorentzX*DistanceToPlane;
744  double yOnPlane = y + TanLorentzY*DistanceToPlane;
745  double DriftLength = DistanceToPlane*sqrt(1.0+TanLorentzX*TanLorentzX+TanLorentzY*TanLorentzY);
746  double SigmaDiff = sqrt(DriftLength/_layerThickness[_currentLayer])*_diffusionCoefficient;
747  double SigmaX = SigmaDiff*inverseCosLorentzX;
748  double SigmaY = SigmaDiff*inverseCosLorentzY;
749  double charge = 1.0e+6*de*_electronsPerKeV;
750  SignalPoint spoint;
751  spoint.x = xOnPlane;
752  spoint.y = yOnPlane;
753  spoint.sigmaX = SigmaX;
754  spoint.sigmaY = SigmaY;
755  spoint.charge = charge;
756  _signalPoints[i] = spoint;
757  }
758 
759 
760 }
761 
762 
763 
764 
766  /** Simulation of fired pixels. Each fired pixel is considered
767  * as SimTrackerHit
768  */
769 
770  vectorOfHits.clear();
771 
772  _currentTotalCharge = 0.0;
773 
774  //cout<<"width "<<_widthOfCluster<<" "<<_numberOfSegments<<endl;
775 
776  for (int i=0; i<_numberOfSegments; ++i) {
777  SignalPoint spoint = _signalPoints[i];
778  double xCentre = spoint.x;
779  double yCentre = spoint.y;
780  double sigmaX = spoint.sigmaX;
781  double sigmaY = spoint.sigmaY;
782  double xLo = spoint.x - _widthOfCluster*spoint.sigmaX;
783  double xUp = spoint.x + _widthOfCluster*spoint.sigmaX;
784  double yLo = spoint.y - _widthOfCluster*spoint.sigmaY;
785  double yUp = spoint.y + _widthOfCluster*spoint.sigmaY;
786 
787 
788 
789  _currentTotalCharge += spoint.charge;
790 
791  //cout<<"spoint "<<xCentre<<" "<<yCentre<<" "<<sigmaX<<" "<<sigmaY<<" "<<xLo<<" "<<xUp<<" "<<yLo<<" "<<yUp<<endl;
792  // cout<<"charge "<<_currentTotalCharge<<endl;
793  int ixLo, ixUp, iyLo, iyUp;
794 
795  TransformXYToCellID(xLo,yLo,ixLo,iyLo);
796  TransformXYToCellID(xUp,yUp,ixUp,iyUp);
797 
798  // std::cout << i << std::endl;
799 // std::cout << xLo << " " << xUp << std::endl;
800 // std::cout << yLo << " " << yUp << std::endl;
801 // std::cout << ixLo << " " << ixUp << std::endl;
802 // std::cout << iyLo << " " << iyUp << std::endl;
803 
804  // Loop over all fired pads
805  // and calculate deposited charges
806  for (int ix = ixLo; ix<ixUp+1; ++ix) {
807  if (ix >= 0) {
808  for (int iy = iyLo; iy<iyUp+1; ++iy) {
809  if (iy >=0) {
810  double xCurrent,yCurrent;
811  TransformCellIDToXY(ix,iy,xCurrent,yCurrent);
812  gsl_sf_result result;
813  int status = gsl_sf_erf_Q_e(float((xCurrent - 0.5*_pixelSizeX - xCentre)/sigmaX), &result);
814  float LowerBound = 1 - result.val;
815  status = gsl_sf_erf_Q_e(float((xCurrent + 0.5*_pixelSizeX - xCentre)/sigmaX), &result);
816  float UpperBound = 1 - result.val;
817  float integralX = UpperBound - LowerBound;
818  status = gsl_sf_erf_Q_e(float((yCurrent - 0.5*_pixelSizeY - yCentre)/sigmaY), &result);
819  LowerBound = 1 - result.val;
820  status = gsl_sf_erf_Q_e(float((yCurrent + 0.5*_pixelSizeY - yCentre)/sigmaY), &result);
821  UpperBound = 1 - result.val;
822  float integralY = UpperBound - LowerBound;
823  float totCharge = float(spoint.charge)*integralX*integralY;
824  int iexist = 0;
825  int cellID = 100000*ix + iy;
826  SimTrackerHitImpl * existingHit = 0;
827  for (int iHits=0; iHits<int(vectorOfHits.size()); ++iHits) {
828  existingHit = vectorOfHits[iHits];
829  int cellid = existingHit->getCellID0();
830  if (cellid == cellID) {
831  iexist = 1;
832  break;
833  }
834  }
835  if (iexist == 1) {
836  float edep = existingHit->getEDep();
837  edep += totCharge;
838  existingHit->setEDep( edep );
839  }
840  else {
841  SimTrackerHitImpl * hit = new SimTrackerHitImpl();
842  double pos[3] = {xCurrent, yCurrent, _layerHalfThickness[_currentLayer]};
843  hit->setPosition( pos );
844  hit->setCellID0( cellID );
845  hit->setEDep( totCharge );
846  vectorOfHits.push_back( hit );
847  }
848  }
849  }
850  }
851  }
852 
853 
854  }
855 
856 }
857 
858 
859 void VTXDigitizer::TransformXYToCellID(double x, double y,
860  int & ix,
861  int & iy) {
862  /**
863  * Function calculates position in pixel matrix based on the
864  * local coordinates of point in the ladder.
865  */
866 
867  int layer = _currentLayer;
868  int nladders = _laddersInLayer[layer];
869  double ladderGap = _layerLadderGap[layer];
870  double Phi = _currentPhi;
871  double ladderLength = _layerLadderLength[layer];
872 
873  double yInLadder = 0.0;
874  if (y < 0.0) {
875  yInLadder = y + ladderLength;
876  }
877  else {
878  yInLadder = y - ladderGap;
879  }
880 
881  if (yInLadder < 0.0) {
882  iy = -1;
883  // std::cout << "warning " << std::endl;
884  }
885  else {
886  iy = int(yInLadder/_pixelSizeY);
887  }
888 
889  double xInLadder = 0.0;
890  if (nladders > 2) { // laddered structure
891  xInLadder = x + _layerLadderHalfWidth[layer] + _layerActiveSiOffset[layer];
892  }
893  else { // cyllindrical structure
894  xInLadder = x + (_layerRadius[layer]+_layerHalfThickness[layer])*Phi;
895  }
896 
897  if (xInLadder < 0.0) {
898  ix = -1;
899  }
900  else {
901  ix = int(xInLadder/_pixelSizeX);
902  }
903 
904 
905 }
906 
907 void VTXDigitizer::PositionWithinCell(double x, double y,
908  int & ix, int & iy,
909  double & xCell, double & yCell) {
910 
911  int layer = _currentLayer;
912  int nladders = _laddersInLayer[layer];
913  double ladderGap = _layerLadderGap[layer];
914  double Phi = _currentPhi;
915 
916  double yInLadder = 0.0;
917  if (y < 0.0) {
918  yInLadder = -y - ladderGap;
919  }
920  else {
921  yInLadder = y - ladderGap;
922  }
923 
924  if (yInLadder < 0.0) {
925  iy = -1;
926  }
927  else {
928  iy = int(yInLadder/_pixelSizeY);
929  }
930  yCell = yInLadder - iy*_pixelSizeY - 0.5*_pixelSizeY;
931 
932 
933  double xInLadder = 0.0;
934  if (nladders > 2) { // laddered structure
935  xInLadder = x + _layerLadderHalfWidth[layer] + _layerActiveSiOffset[layer];
936  }
937  else { // cyllindrical structure
938  xInLadder = x + (_layerRadius[layer]+_layerHalfThickness[layer])*Phi;
939  }
940 
941  if (xInLadder < 0.0) {
942  ix = -1;
943  }
944  else {
945  ix = int(xInLadder/_pixelSizeX);
946  }
947  xCell = xInLadder - ix*_pixelSizeX - 0.5*_pixelSizeX;
948 
949 
950 }
951 
953  double & x, double & y) {
954 
955  /**
956  Function calculates position in the local frame
957  based on the index of pixel in the ladder.
958  */
959 
960  int layer = _currentLayer;
961  int module = _currentModule;
962  int nladders = _laddersInLayer[layer];
963  double ladderGap = _layerLadderGap[layer];
964  double ladderLength = _layerLadderLength[layer];
965  double Phi = _currentPhi;
966 
967  y = (0.5+double(iy))*_pixelSizeY;
968 
969  if (module == 1)
970  y = -ladderLength + y;
971  else
972  y = ladderGap + y;
973 
974  x = (0.5+double(ix))*_pixelSizeX;
975  if (nladders > 2) { // laddered structure
976  x = x - _layerLadderHalfWidth[layer] - _layerActiveSiOffset[layer];
977  }
978  else { // cyllindrical structure
979  x = x - (_layerRadius[layer]+_layerHalfThickness[layer])*Phi;
980  }
981 
982 
983 }
984 
985 
987 /**
988  * Function that fluctuates charge (in units of electrons)
989  * deposited on the fired pixels according to the Poisson
990  * distribution...
991  */
992 
993  for (int ihit=0; ihit<int(simTrkVec.size()); ++ihit) {
994  SimTrackerHitImpl * hit = simTrkVec[ihit];
995  double charge = hit->getEDep();
996  double rng;
997  if (charge > 1000.) { // assume Gaussian
998  double sigma = sqrt(charge);
999  rng = double(RandGauss::shoot(charge,sigma));
1000  hit->setEDep(rng);
1001  }
1002  else { // assume Poisson
1003  rng = double(RandPoisson::shoot(charge));
1004  }
1005  hit->setEDep(float(rng));
1006  }
1007 }
1008 
1010 /**
1011  * Simulation of electronic noise.
1012  */
1013 
1014  int nPixels = int( simTrkVec.size() );
1015  // std::cout << "Gain smearer applied" << std::endl;
1016 
1017  for (int i=0;i<nPixels;++i) {
1018  double Noise = RandGauss::shoot(0.,_electronicNoise);
1019  SimTrackerHitImpl * hit = simTrkVec[i];
1020  double charge = hit->getEDep() + Noise ;
1021  hit->setEDep( charge );
1022  }
1023 
1024 }
1025 
1026 
1028  /**
1029  * Emulates reconstruction of Tracker Hit
1030  * Tracker hit position is reconstructed as center-of-gravity
1031  * of cluster of fired cells. Position is corrected for Lorentz shift.
1032  */
1033 
1034  // new Tracker Hit
1035  double pos[3] = {0,0,0};
1036  double charge = 0;
1037  int nPixels = 0;
1038  int ixmin = 1000000;
1039  int ixmax = -1000000;
1040  int iymin = 1000000;
1041  int iymax = -1000000;
1042  int ixSeed = 0;
1043  int iySeed = 0;
1044  _amplMax = 0.0;
1045 //cout<<"size "<<simTrkVec.size()<<endl;
1046 //cout<<"threshold "<<_threshold<<endl;
1047  for (int iHit=0; iHit<int(simTrkVec.size()); ++iHit) {
1048  SimTrackerHit * hit = simTrkVec[iHit];
1049  //cout<<"hit "<<iHit <<" "<<hit->getEDep()<<endl;
1050  if (hit->getEDep() > _threshold) {
1051  if (nPixels < 100)
1052  _amplC[nPixels] = hit->getEDep();
1053  nPixels++;
1054  charge += hit->getEDep();
1055  int cellID = hit->getCellID0();
1056  int ix = cellID / 100000 ;
1057  int iy = cellID - 100000 * ix;
1058  if (hit->getEDep() > _amplMax) {
1059  _amplMax = hit->getEDep();
1060  ixSeed = ix;
1061  iySeed = iy;
1062  }
1063 
1064  if (ix > ixmax)
1065  ixmax = ix;
1066  if (ix < ixmin)
1067  ixmin = ix;
1068  if (iy > iymax)
1069  iymax = iy;
1070  if (iy < iymin)
1071  iymin = iy;
1072  for (int j=0; j<2; ++j)
1073  pos[j] += hit->getEDep()*hit->getPosition()[j];
1074  }
1075  }
1076 
1077  //cout<<"charge "<<charge<<endl;
1078  if (charge > 0.) {
1079  for (int j=0; j<2; ++j)
1080  pos[j] /= charge;
1081  }
1082 
1083  _nCells = nPixels;
1084  _ampl = charge;
1085  _nCoveredX = ixmax - ixmin + 1;
1086  _nCoveredY = iymax - iymin + 1;
1087 
1088  //cout<<"ampl "<<_ampl<<endl;
1089 
1090  double tanXLorentz = _tanLorentzAngle;
1091  double tanYLorentz = 0;
1092 
1093  pos[0] = pos[0] - _layerHalfThickness[_currentLayer]*tanXLorentz;
1094  pos[1] = pos[1] - _layerHalfThickness[_currentLayer]*tanYLorentz;
1095 
1096  // cout<<"pos "<<pos[0]<<" "<<pos[1]<<endl;
1097 
1098 
1099  _clusterWidthX = 0.;
1100  _clusterWidthY = 0.;
1101  _ampl33 = 0.;
1102  _ampl55 = 0.;
1103  _ampl77 = 0.;
1104  _ncell33 = 0;
1105  _ncell55 = 0;
1106  _ncell77 = 0;
1107 
1108  if (charge > 0. && nPixels > 0) {
1109  TrackerHitImpl * recoHit = new TrackerHitImpl();
1110  recoHit->setEDep( charge );
1111  for (int iY=0;iY<20;++iY) {
1112  _amplY[iY] = 0.0;
1113  _amplX[iY] = 0.0;
1114  }
1115  for (int iHit=0; iHit<int(simTrkVec.size()); ++iHit) {
1116  SimTrackerHit * hit = simTrkVec[iHit];
1117  if (hit->getEDep() > _threshold) {
1118  float deltaX = hit->getPosition()[0]-pos[0];
1119  _clusterWidthX += deltaX*deltaX*hit->getEDep();
1120  deltaX = hit->getPosition()[1]-pos[1];
1121  _clusterWidthY += deltaX*deltaX*hit->getEDep();
1122  int cellID = hit->getCellID0();
1123  int ix = cellID / 100000 ;
1124  int iy = cellID - 100000 * ix;
1125  if ((iy - iymin) < 20)
1126  _amplY[iy-iymin] = _amplY[iy-iymin] + hit->getEDep();
1127  if ((ix - ixmin) < 20)
1128  _amplX[ix-ixmin] = _amplX[ix-ixmin] + hit->getEDep();
1129  bool frame = abs(ix-ixSeed) < 2;
1130  frame = frame && abs(iy-iySeed) < 2;
1131  if (frame) {
1132  _ncell33++;
1133  _ampl33 += hit->getEDep();
1134  }
1135  frame = abs(ix-ixSeed) < 3;
1136  frame = frame && abs(iy-iySeed) < 3;
1137  if (frame) {
1138  _ncell55++;
1139  _ampl55 += hit->getEDep();
1140  }
1141  frame = abs(ix-ixSeed) < 4;
1142  frame = frame && abs(iy-iySeed) < 4;
1143  if (frame) {
1144  _ncell77++;
1145  _ampl77 += hit->getEDep();
1146  }
1147  }
1148  }
1149  _clusterWidthX = sqrt( _clusterWidthX / charge);
1150  _clusterWidthY = sqrt( _clusterWidthY / charge);
1151  double aXCentre = 0;
1152  double aYCentre = 0;
1153  for (int i=ixmin+1;i<ixmax;++i) {
1154  aXCentre += _amplX[i-ixmin];
1155  }
1156  for (int i=iymin+1;i<iymax;++i) {
1157  aYCentre += _amplY[i-iymin];
1158  }
1159  aXCentre = aXCentre/max(1,ixmax-ixmin-1);
1160  aYCentre = aYCentre/max(1,iymax-iymin-1);
1161  double _xRecoS = 0;
1162  double _yRecoS = 0;
1163  double aTot = 0;
1164  for (int i=ixmin;i<ixmax+1;++i) {
1165  double xx,yy;
1166  aTot += _amplX[i-ixmin];
1167  TransformCellIDToXY(i,2,xx,yy);
1168  if (i != ixmin && i != ixmax) {
1169  _xRecoS += xx*aXCentre;
1170  }
1171  else {
1172  _xRecoS += xx*_amplX[i-ixmin];
1173  }
1174  }
1175  _xRecoS = _xRecoS / aTot;
1176  _xRecoS = _xRecoS - _layerHalfThickness[_currentLayer]*tanXLorentz;
1177  aTot = 0;
1178  for (int i=iymin;i<iymax+1;++i) {
1179  double xx,yy;
1180  TransformCellIDToXY(i,i,xx,yy);
1181  aTot += _amplY[i-iymin];
1182  if (i != iymin && i != iymax) {
1183  _yRecoS += yy*aYCentre;
1184  }
1185  else {
1186  _yRecoS += yy*_amplY[i-iymin];
1187  }
1188  }
1189  _yRecoS = _yRecoS / aTot;
1190  _xLocalRecoCOG = pos[0];
1191  _yLocalRecoCOG = pos[1];
1192  _xLocalRecoEdge = _xRecoS;
1193  _yLocalRecoEdge = _yRecoS;
1194  pos[0] = _xRecoS;
1195  pos[1] = _yRecoS;
1198  recoHit->setPosition( pos );
1199  return recoHit;
1200  }
1201  else
1202  return NULL;
1203 
1204 
1205 }
1206 
1207 void VTXDigitizer::TrackerHitToLab( TrackerHitImpl * recoHit) {
1208 
1209  double pos[3];
1210  for (int i=0; i<3; ++i)
1211  pos[i] = recoHit->getPosition()[i];
1212 
1213  double xLab[3];
1214  TransformToLab( pos, xLab);
1215 
1216  recoHit->setPosition( xLab );
1217 
1218 
1219 }
1220 
1221 void VTXDigitizer::PrintInfo( SimTrackerHit * simHit, TrackerHitImpl * recoHit) {
1222 
1223  std::cout << std::endl;
1224 
1225  std::cout << "Simulated hit position = "
1226  << " " << simHit->getPosition()[0]
1227  << " " << simHit->getPosition()[1]
1228  << " " << simHit->getPosition()[2] << std::endl;
1229 
1230  std::cout << "Reconstructed hit position = "
1231  << " " << recoHit->getPosition()[0]
1232  << " " << recoHit->getPosition()[1]
1233  << " " << recoHit->getPosition()[2] << std::endl;
1234 
1235 
1236  std::cout << std::endl;
1237  std::cout << "Type Q to exit display mode" << std::endl;
1238  char q = getchar();
1239  if (q=='q' || q=='Q')
1240  _debug = 0;
1241 }
1242 
1243 
1245 
1246  for (int ilayer=0;ilayer<_numberOfLayers;++ilayer) {
1247  double mean = _bkgdHitsInLayer[ilayer];
1248  int nHits = int(RandPoisson::shoot(mean));
1249  for (int ihit=0;ihit<nHits;++ihit) {
1250  double pos[3];
1251  pos[0] = RandFlat::shoot(_layerLadderWidth[ilayer]);
1252  pos[1] = _layerLadderGap[ilayer] + RandFlat::shoot(_layerLadderLength[ilayer]);
1253  pos[2] = 0.0;
1254  if (RandFlat::shoot(double(1.)) > 0.5) {
1255  pos[1] = -pos[1];
1256  }
1257  pos[0] = pos[0] - _layerLadderHalfWidth[ilayer] - _layerActiveSiOffset[ilayer];
1258  _currentLayer = ilayer;
1259  double xLadders = _laddersInLayer[ilayer];
1260  double Phi0 = _layerPhiOffset[ilayer];
1261  double dPhi = 2.0*_layerHalfPhi[ilayer];
1262  int nPhi = int(RandFlat::shoot(xLadders));
1263  _currentPhi = double(nPhi)*dPhi + Phi0;
1264  double xLab[3];
1265  TransformToLab(pos,xLab);
1266  TrackerHitImpl * trkHit = new TrackerHitImpl();
1267  trkHit->setPosition( xLab );
1268  trkHit->setEDep(1000.);
1269  trkHit->setType(ilayer+1);
1270  col->addElement( trkHit );
1271  }
1272 
1273  }
1274 
1275 }
double _diffusionCoefficient
Diffusion coefficient in mm for nominla layer thickness.
Definition: VTXDigitizer.h:188
void ProduceHits(SimTrackerHitImplVec &simTrkVec)
int _PoissonSmearing
Definition: VTXDigitizer.h:232
std::string _colVTXRelation
Definition: VTXDigitizer.h:170
std::string _outputCollectionName
Definition: VTXDigitizer.h:169
double _currentParticleMass
Definition: VTXDigitizer.h:222
double _amplX[20]
Definition: VTXDigitizer.h:286
void TransformToLab(double *xLoc, double *xLab)
double _ampl33
Definition: VTXDigitizer.h:294
double _electronicNoise
Definition: VTXDigitizer.h:241
double sigmaY
Definition: VTXDigitizer.h:35
std::vector< int > _laddersInLayer
Definition: VTXDigitizer.h:204
void TransformXYToCellID(double x, double y, int &ix, int &iy)
double charge
Definition: VTXDigitizer.h:36
virtual void init()
Initialisation member function.
void GainSmearer(SimTrackerHitImplVec &simTrkVec)
double _amplMax
Definition: VTXDigitizer.h:290
double _electronsPerKeV
Definition: VTXDigitizer.h:200
void ProduceSignalPoints()
int _produceFullPattern
Definition: VTXDigitizer.h:229
double _currentLocalPosition[3]
Definition: VTXDigitizer.h:238
std::vector< float > _layerHalfThickness
Definition: VTXDigitizer.h:207
std::vector< float > _layerThickness
Definition: VTXDigitizer.h:206
double _yLocalRecoCOG
Definition: VTXDigitizer.h:297
std::vector< float > _bkgdHitsInLayer
Definition: VTXDigitizer.h:214
std::vector< float > _layerLadderHalfWidth
Definition: VTXDigitizer.h:209
MyG4UniversalFluctuationForSi * _fluctuate
Definition: VTXDigitizer.h:247
virtual void processRunHeader(LCRunHeader *run)
Processing of run header.
std::vector< float > _layerPhiOffset
Definition: VTXDigitizer.h:210
double _cutOnDeltaRays
cut in MeV on delta electrons used in simulation of charge for each ionisation point ...
Definition: VTXDigitizer.h:185
double _currentTotalCharge
Definition: VTXDigitizer.h:202
double _amplY[20]
Definition: VTXDigitizer.h:287
void PositionWithinCell(double x, double y, int &ix, int &iy, double &xCell, double &yCell)
int _numberOfLayers
layer thickness
Definition: VTXDigitizer.h:197
double _xLocalSim
Definition: VTXDigitizer.h:299
void ProduceIonisationPoints(SimTrackerHit *hit)
void TransformCellIDToXY(int ix, int iy, double &x, double &y)
double _energyLoss
Definition: VTXDigitizer.h:292
std::vector< float > _layerLadderWidth
Definition: VTXDigitizer.h:215
int _nRun
Run number.
Definition: VTXDigitizer.h:174
double _currentPhi
Definition: VTXDigitizer.h:223
void PrintInfo(SimTrackerHit *simTrkHit, TrackerHitImpl *recoHit)
double _currentExitPoint[3]
Definition: VTXDigitizer.h:240
double _segmentDepth
Definition: VTXDigitizer.h:201
std::vector< float > _layerActiveSiOffset
Definition: VTXDigitizer.h:211
double _ampl55
Definition: VTXDigitizer.h:294
SignalPointVec _signalPoints
Definition: VTXDigitizer.h:245
double _ampl77
Definition: VTXDigitizer.h:294
void TrackerHitToLab(TrackerHitImpl *recoHit)
void generateBackground(LCCollectionVec *col)
double _pixelSizeX
Definition: VTXDigitizer.h:198
std::string _colName
Input collection name.
Definition: VTXDigitizer.h:168
double _threshold
Definition: VTXDigitizer.h:237
double _currentParticleMomentum
Definition: VTXDigitizer.h:220
double _pixelSizeY
Definition: VTXDigitizer.h:199
double _amplC[100]
Definition: VTXDigitizer.h:288
void PoissonSmearer(SimTrackerHitImplVec &simTrkVec)
double _xLocalRecoEdge
Definition: VTXDigitizer.h:298
int _generateBackground
Definition: VTXDigitizer.h:219
double _clusterWidthX
Definition: VTXDigitizer.h:293
double _xLocalRecoCOG
Definition: VTXDigitizer.h:297
std::vector< float > _layerLadderGap
Definition: VTXDigitizer.h:213
int _electronicEffects
Definition: VTXDigitizer.h:233
std::vector< SimTrackerHitImpl * > SimTrackerHitImplVec
Definition: CCDDigitizer.h:73
static const float e
double _tanLorentzAngle
tangent of Lorentz angle
Definition: VTXDigitizer.h:181
std::vector< EVENT::SimTrackerHit * > SimTrackerHitVec
Definition: SiStripDigi.h:139
IonisationPointVec _ionisationPoints
Definition: VTXDigitizer.h:244
void FindLocalPosition(SimTrackerHit *hit, double *localPosition, double *localDirection)
Finds coordinates.
TrackerHitImpl * ReconstructTrackerHit(SimTrackerHitImplVec &simTrkVec)
double _clusterWidthY
Definition: VTXDigitizer.h:293
std::vector< LCCollection * > LCCollectionVec
Definition: SiStripClus.h:55
double _segmentLength
Definition: VTXDigitizer.h:242
double sigmaX
Definition: VTXDigitizer.h:34
int _nEvt
Event number.
Definition: VTXDigitizer.h:178
std::vector< float > _layerHalfPhi
Definition: VTXDigitizer.h:212
double SampleFluctuations(const double momentum, const double mass, double &tmax, const double length, const double meanLoss)
std::vector< float > _layerRadius
Definition: VTXDigitizer.h:205
virtual void check(LCEvent *evt)
Produces check plots.
double _widthOfCluster
Definition: VTXDigitizer.h:224
virtual void end()
Termination member function.
double _yLocalRecoEdge
Definition: VTXDigitizer.h:298
int _numberOfSegments
Definition: VTXDigitizer.h:230
VTXDigitizer aVTXDigitizer
Definition: VTXDigitizer.cc:31
std::vector< float > _layerLadderLength
Definition: VTXDigitizer.h:208
double _currentEntryPoint[3]
Definition: VTXDigitizer.h:239
double _yLocalSim
Definition: VTXDigitizer.h:299
virtual void processEvent(LCEvent *evt)
Processing of one event.
double SCALING
Definition: VTXDigitizer.h:227