CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
DTDigitizer Class Reference

#include <DTDigitizer.h>

Inheritance diagram for DTDigitizer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Classes

struct  hitLessT
 

Public Member Functions

 DTDigitizer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~DTDigitizer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Types

typedef std::map< DTWireId,
std::vector< const PSimHit * > > 
DTWireIdMap
 
typedef DTWireIdMap::const_iterator DTWireIdMapConstIter
 
typedef DTWireIdMap::iterator DTWireIdMapIter
 
typedef std::pair< const
PSimHit *, float > 
hitAndT
 
typedef std::vector< hitAndTTDContainer
 

Private Member Functions

float asymGausSmear (double mean, double sigmaLeft, double sigmaRight) const
 
std::pair< float, bool > computeTime (const DTLayer *layer, const DTWireId &wireId, const PSimHit *hit, const LocalVector &BLoc)
 
std::pair< float, bool > driftTimeFromParametrization (float x, float alpha, float By, float Bz) const
 
std::pair< float, bool > driftTimeFromTimeMap () const
 
void dumpHit (const PSimHit *hit, float xEntry, float xExit, const DTTopology &topo)
 
float externalDelays (const DTLayer *layer, const DTWireId &wireId, const PSimHit *hit) const
 
void storeDigis (DTWireId &wireId, TDContainer &hits, DTDigiCollection &output, DTDigiSimLinkCollection &outputLinks)
 

Private Attributes

std::string collection_for_XF
 
float deadTime
 
bool debug
 
std::string geometryType
 
bool IdealModel
 
bool interpolate
 
float LinksTimeWindow
 
bool MultipleLinks
 
bool onlyMuHits
 
float smearing
 
std::string syncName
 
float theConstVDrift
 
CLHEP::RandFlat * theFlatDistribution
 
CLHEP::RandGaussQ * theGaussianDistribution
 
DTDigiSyncBasetheSync
 
double vPropWire
 

Friends

class DTDigitizerAnalysis
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Digitize the muon drift tubes. The parametrisation function in DTDriftTimeParametrization from P.G.Abia, J.Puerta is used in all cases where it is applicable.

Date:
2008/07/01 07:41:35
Revision:
1.12
Authors
: G. Bevilacqua, N. Amapane, G. Cerminara, R. Bellan

Definition at line 39 of file DTDigitizer.h.

Member Typedef Documentation

typedef std::map<DTWireId, std::vector<const PSimHit*> > DTDigitizer::DTWireIdMap
private

Definition at line 51 of file DTDigitizer.h.

typedef DTWireIdMap::const_iterator DTDigitizer::DTWireIdMapConstIter
private

Definition at line 53 of file DTDigitizer.h.

typedef DTWireIdMap::iterator DTDigitizer::DTWireIdMapIter
private

Definition at line 52 of file DTDigitizer.h.

typedef std::pair<const PSimHit*,float> DTDigitizer::hitAndT
private

Definition at line 48 of file DTDigitizer.h.

typedef std::vector<hitAndT> DTDigitizer::TDContainer
private

Definition at line 49 of file DTDigitizer.h.

Constructor & Destructor Documentation

DTDigitizer::DTDigitizer ( const edm::ParameterSet conf_)
explicit

Definition at line 63 of file DTDigitizer.cc.

References gather_cfg::cout, debug, edm::hlt::Exception, reco::get(), edm::RandomNumberGenerator::getEngine(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and edm::Service< T >::isAvailable().

63  {
64 
65  // Set verbose output
66  debug=conf_.getUntrackedParameter<bool>("debug");
67 
68  if (debug) cout<<"Creating a DTDigitizer"<<endl;
69 
70  //register the Producer with a label
71  //produces<DTDigiCollection>("MuonDTDigis"); // FIXME: Do I pass it by ParameterSet?
72  produces<DTDigiCollection>(); // FIXME: Do I pass it by ParameterSet?
73  // produces<DTDigiSimLinkCollection>("MuonDTDigiSimLinks");
74  produces<DTDigiSimLinkCollection>();
75 
76  //Parameters:
77 
78  // build digis only for mu hits (for debug purposes)
79  onlyMuHits=conf_.getParameter<bool>("onlyMuHits");
80 
81  // interpolate parametrization function
82  interpolate=conf_.getParameter<bool>("interpolate");
83 
84  // Velocity of signal propagation along the wire (cm/ns)
85  // For the default value
86  // cfr. CMS-IN 2000-021: (2.56+-0.17)x1e8 m/s
87  // CMS NOTE 2003-17: (0.244) m/ns
88  vPropWire=conf_.getParameter<double>("vPropWire"); //24.4
89 
90  // Dead time for signals on the same wire (number from M. Pegoraro)
91  deadTime=conf_.getParameter<double>("deadTime"); //150
92 
93  // further configurable smearing
94  smearing=conf_.getParameter<double>("Smearing"); // 3.
95 
96  // Sync Algo
97  syncName = conf_.getParameter<string>("SyncName");
98  theSync = DTDigiSyncFactory::get()->create(syncName,conf_.getParameter<ParameterSet>("pset"));
99 
100  // Debug flag to switch to the Ideal model
101  // it uses a constant drift velocity and doesn't set any external delay
102  IdealModel = conf_.getParameter<bool>("IdealModel");
103 
104  // Constant drift velocity needed by the above flag
105  if(IdealModel)
106  theConstVDrift = conf_.getParameter<double>("IdealModelConstantDriftVelocity"); // 55 um/ns
107  else theConstVDrift = 55.;
108 
109  // get random engine
111  if ( ! rng.isAvailable()) {
112  throw cms::Exception("Configuration")
113  << "RandomNumberGeneratorService for DTDigitizer missing in cfg file";
114  }
115  theGaussianDistribution = new CLHEP::RandGaussQ(rng->getEngine());
116  theFlatDistribution = new CLHEP::RandFlat(rng->getEngine(), 0, 1);
117 
118  // MultipleLinks=false ==> one-to-one correspondence between digis and SimHits
119  MultipleLinks = conf_.getParameter<bool>("MultipleLinks");
120  // MultipleLinks=true ==> association of SimHits within a time window LinksTimeWindow
121  // (of the order of the resolution)
122  LinksTimeWindow = conf_.getParameter<double>("LinksTimeWindow"); // (10 ns)
123 
124  //Name of Collection used for create the XF
125  collection_for_XF = conf_.getParameter<std::string>("InputCollection");
126 
127  //String to choice between ideal (the deafult) and (mis)aligned geometry for the digitization step
128  geometryType = conf_.getParameter<std::string>("GeometryType");
129 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool onlyMuHits
Definition: DTDigitizer.h:106
float theConstVDrift
Definition: DTDigitizer.h:115
CLHEP::RandGaussQ * theGaussianDistribution
Definition: DTDigitizer.h:118
float LinksTimeWindow
Definition: DTDigitizer.h:123
DTDigiSyncBase * theSync
Definition: DTDigitizer.h:109
bool isAvailable() const
Definition: Service.h:47
float smearing
Definition: DTDigitizer.h:103
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
bool interpolate
Definition: DTDigitizer.h:105
bool IdealModel
Definition: DTDigitizer.h:114
std::string geometryType
Definition: DTDigitizer.h:111
std::string syncName
Definition: DTDigitizer.h:108
double vPropWire
Definition: DTDigitizer.h:101
tuple cout
Definition: gather_cfg.py:121
float deadTime
Definition: DTDigitizer.h:102
CLHEP::RandFlat * theFlatDistribution
Definition: DTDigitizer.h:119
T get(const Candidate &c)
Definition: component.h:56
bool MultipleLinks
Definition: DTDigitizer.h:122
std::string collection_for_XF
Definition: DTDigitizer.h:126
DTDigitizer::~DTDigitizer ( )

Definition at line 132 of file DTDigitizer.cc.

132  {
134  delete theFlatDistribution;
135 }
CLHEP::RandGaussQ * theGaussianDistribution
Definition: DTDigitizer.h:118
CLHEP::RandFlat * theFlatDistribution
Definition: DTDigitizer.h:119

Member Function Documentation

float DTDigitizer::asymGausSmear ( double  mean,
double  sigmaLeft,
double  sigmaRight 
) const
private

Definition at line 447 of file DTDigitizer.cc.

References f, and lumiQTWidget::t.

447  {
448 
449  double f = sigmaLeft/(sigmaLeft+sigmaRight);
450  double t;
451 
452  if (theFlatDistribution->fire() <= f) {
453  t = theGaussianDistribution->fire(mean,sigmaLeft);
454  t = mean - fabs(t - mean);
455  } else {
456  t = theGaussianDistribution->fire(mean,sigmaRight);
457  t = mean + fabs(t - mean);
458  }
459  return static_cast<float>(t);
460 }
CLHEP::RandGaussQ * theGaussianDistribution
Definition: DTDigitizer.h:118
double f[11][100]
CLHEP::RandFlat * theFlatDistribution
Definition: DTDigitizer.h:119
pair< float, bool > DTDigitizer::computeTime ( const DTLayer layer,
const DTWireId wireId,
const PSimHit hit,
const LocalVector BLoc 
)
private

Definition at line 236 of file DTDigitizer.cc.

References gather_cfg::cout, Vector3DBase< T, FrameTag >::cross(), debug, delta, dir, Vector3DBase< T, FrameTag >::dot(), PSimHit::entryPoint(), PSimHit::exitPoint(), PSimHit::localDirection(), PSimHit::localPosition(), M_PI, PV3DBase< T, PVType, FrameType >::mag(), PSimHit::momentumAtEntry(), DTTopology::none, DTTopology::onWhichBorder(), PSimHit::pabs(), PSimHit::particleType(), DTLayer::specificTopology(), mathSSE::sqrt(), theta(), Vector3DBase< T, FrameTag >::unit(), DTWireId::wire(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), vdt::x, DTTopology::xMax, DTTopology::xMin, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

237  {
238 
239  LocalPoint entryP = hit->entryPoint();
240  LocalPoint exitP = hit->exitPoint();
241  int partType = hit->particleType();
242 
243  const DTTopology &topo = layer->specificTopology();
244 
245  // Pay attention: in CMSSW the rf of the SimHit is in the layer's rf
246 
247  if(debug) cout<<"Hit local entry point: "<<entryP<<endl
248  <<"Hit local exit point: "<<exitP<<endl;
249 
250  float xwire = topo.wirePosition(wireId.wire());
251  float xEntry = entryP.x() - xwire;
252  float xExit = exitP.x() - xwire;
253 
254  if(debug) cout<<"wire position: "<<xwire
255  <<" x entry in cell rf: "<<xEntry
256  <<" x exit in cell rf: "<<xExit<<endl;
257 
258  DTTopology::Side entrySide = topo.onWhichBorder(xEntry,entryP.y(),entryP.z());
259  DTTopology::Side exitSide = topo.onWhichBorder(xExit,exitP.y(),exitP.z());
260 
261  if (debug) dumpHit(hit, xEntry, xExit,topo);
262 
263  // The bolean is used to flag the drift time computation
264  pair<float,bool> driftTime(0.,false);
265 
266  // if delta in gas->ignore, since it is included in the parametrisation.
267  // FIXME: should check that it is actually a delta ray produced by a nearby
268  // muon hit.
269 
270  if (partType == 11 && entrySide == DTTopology::none) {
271  if (debug) cout << " e- hit in gas; discarding " << endl;
272  return driftTime;
273  }
274 
275  float By = BLoc.y();
276  float Bz = BLoc.z();
277 
278  // Radius and sagitta according to direction of momentum
279  // (just for printing)
280  // NOTE: in cmsim, d is always taken // pHat!
281  LocalVector d = (exitP-entryP);
282  LocalVector pHat = hit->localDirection().unit();
283  LocalVector hHat = (d.cross(pHat.cross(d))).unit();
284  float cosAlpha = hHat.dot(pHat);
285  float sinAlpha = sqrt(1.-cosAlpha*cosAlpha);
286  float radius_P = (d.mag())/(2.*cosAlpha);
287  float sagitta_P = radius_P*(1.-sinAlpha);
288 
289  // Radius, sagitta according to field bending
290  // (just for printing)
291  float halfd = d.mag()/2.;
292  float BMag = BLoc.mag();
293  LocalVector pT = (pHat - (BLoc.unit()*pHat.dot(BLoc.unit())))*(hit->pabs());
294  float radius_B = (pT.mag()/(0.3*BMag))*100.;
295  float sagitta_B;
296  if (radius_B > halfd) {
297  sagitta_B = radius_B - sqrt(radius_B*radius_B - halfd*halfd);
298  } else {
299  sagitta_B = radius_B;
300  }
301 
302  // cos(delta), delta= angle between direction at entry and hit segment
303  // (just for printing)
304  float delta = pHat.dot(d.unit());
305  if (debug) cout << " delta = " << delta << endl
306  << " cosAlpha = " << cosAlpha << endl
307  << " sinAlpha = " << sinAlpha << endl
308  << " pMag = " << pT.mag() << endl
309  << " bMag = " << BMag << endl
310  << " pT = " << pT << endl
311  << " halfd = " << halfd << endl
312  << " radius_P (cm) = " << radius_P << endl
313  << " sagitta_P (um) = " << sagitta_P*10000. << endl
314  << " radius_B (cm) = " << radius_B << endl
315  << " sagitta_B (um) = " << sagitta_B*10000. << endl;
316 
317  // Select cases where parametrization can not be used.
318  bool noParametrisation =
319  ( ( entrySide == DTTopology::none || exitSide == DTTopology::none ) // case # 2,3,8,9 or 11
320  || (entrySide == exitSide) // case # 4 or 10
321  || ((entrySide == DTTopology::xMin && exitSide == DTTopology::xMax) ||
322  (entrySide == DTTopology::xMax && exitSide == DTTopology::xMin)) // Hit is case # 7
323  );
324 
325  // FIXME: now, debug warning only; consider treating those
326  // with TM algo.
327  if ( delta < 0.99996 // Track is not straight. FIXME: use sagitta?
328  && (noParametrisation == false)) {
329  if (debug) cout << "*** WARNING: hit is not straight, type = " << partType << endl;
330  }
331 
332  //************ 5A ***************
333 
334  if (!noParametrisation) {
335 
336  LocalVector dir = hit->momentumAtEntry(); // ex Measurement3DVector dir = hit->measurementDirection(); //FIXME?
337  float theta = atan(dir.x()/-dir.z())*180/M_PI;
338 
339  // FIXME: use dir if M.S. is included as GARFIELD option...
340  // otherwise use hit segment dirction.
341  // LocalVector dir0 = (exitP-entryP).unit();
342  // float theta = atan(dir0.x()/-dir0.z())*180/M_PI;
343  float x;
344 
345  Local3DPoint pt = hit->localPosition(); //ex Measurement3DPoint pt = hit->measurementPosition(); // FIXME?
346 
347  if(fabs(pt.z()) < 0.002) {
348  // hit center within 20 um from z=0, no need to extrapolate.
349  x = pt.x() - xwire;
350  } else {
351  x = xEntry - (entryP.z()*(xExit-xEntry))/(exitP.z()-entryP.z());
352  }
353 
354  if(IdealModel) return make_pair(fabs(x)/theConstVDrift,true);
355  else driftTime = driftTimeFromParametrization(x, theta, By, Bz);
356 
357  }
358 
359 
360  if ((driftTime.second)==false) {
361  // Parametrisation not applicable, or failed. Use time map.
362  driftTime = driftTimeFromTimeMap();
363  }
364 
365  //************ 5B ***************
366 
367  // Signal propagation, TOF etc.
368  if (driftTime.second) {
369  driftTime.first += externalDelays(layer,wireId,hit);
370  }
371  return driftTime;
372 }
dbl * delta
Definition: mlp_gen.cc:36
void dumpHit(const PSimHit *hit, float xEntry, float xExit, const DTTopology &topo)
Definition: DTDigitizer.cc:577
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:88
Side onWhichBorder(float x, float y, float z) const
Definition: DTTopology.cc:111
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
Definition: PSimHit.h:47
float theConstVDrift
Definition: DTDigitizer.h:115
Geom::Theta< T > theta() const
T y() const
Definition: PV3DBase.h:62
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
std::pair< float, bool > driftTimeFromParametrization(float x, float alpha, float By, float Bz) const
Definition: DTDigitizer.cc:376
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
T mag() const
Definition: PV3DBase.h:66
Local3DPoint localPosition() const
Definition: PSimHit.h:44
T sqrt(T t)
Definition: SSEVec.h:46
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:119
T z() const
Definition: PV3DBase.h:63
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:63
Side
Sides of the cell.
Definition: DTTopology.h:90
bool IdealModel
Definition: DTDigitizer.h:114
LocalVector localDirection() const
Obsolete. Same as momentumAtEntry().unit(), for backward compatibility.
Definition: PSimHit.h:52
int wire() const
Return the wire number.
Definition: DTWireId.h:58
Vector3DBase unit() const
Definition: Vector3DBase.h:57
#define M_PI
Definition: BFit3D.cc:3
int particleType() const
Definition: PSimHit.h:85
float externalDelays(const DTLayer *layer, const DTWireId &wireId, const PSimHit *hit) const
Definition: DTDigitizer.cc:470
tuple cout
Definition: gather_cfg.py:121
dbl *** dir
Definition: mlp_gen.cc:35
x
Definition: VDTMath.h:216
T x() const
Definition: PV3DBase.h:61
std::pair< float, bool > driftTimeFromTimeMap() const
Definition: DTDigitizer.cc:462
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
pair< float, bool > DTDigitizer::driftTimeFromParametrization ( float  x,
float  alpha,
float  By,
float  Bz 
) const
private

Definition at line 376 of file DTDigitizer.cc.

References gather_cfg::cout, debug, GeomDetEnumerators::DT, f, edm::max(), DTDriftTimeParametrization::MB_DT_drift_time(), DTDriftTimeParametrization::drift_time::t_drift, DTDriftTimeParametrization::drift_time::t_width_m, DTDriftTimeParametrization::drift_time::t_width_p, theta(), and cond::rpcobgas::time.

376  {
377 
378  // Convert from CMSSW frame/units r.f. to parametrization ones.
379  x *= 10.; //cm -> mm
380 
381  // FIXME: Current parametrisation can extrapolate above 21 mm,
382  // however a detailed study is needed before using this.
383  if (fabs(x) > 21.) {
384  if (debug) cout << "*** WARNING: parametrisation: x out of range = "
385  << x << ", skipping" << endl;
386  return pair<float,bool>(0.f,false);
387  }
388 
389  // Different r.f. of the parametrization:
390  // X_par = X_ORCA; Y_par=Z_ORCA; Z_par = -Y_ORCA
391 
392  float By_par = Bz; // Bnorm
393  float Bz_par = -By; // Bwire
394  float theta_par = theta;
395 
396  // Parametrisation uses interpolation up to |theta|=45 deg,
397  // |Bwire|=0.4, |Bnorm|=0.75; extrapolation above.
398  if (fabs(theta_par)>45.) {
399  if (debug) cout << "*** WARNING: extrapolating theta > 45: "
400  << theta << endl;
401  // theta_par = min(fabs(theta_par),45.f)*((theta_par<0.)?-1.:1.);
402  }
403  if (fabs(By_par)>0.75) {
404  if (debug) cout << "*** WARNING: extrapolating Bnorm > 0.75: "
405  << By_par << endl;
406  // By_par = min(fabs(By_par),0.75f)*((By_par<0.)?-1.:1.);
407  }
408  if (fabs(Bz_par)>0.4) {
409  if (debug) cout << "*** WARNING: extrapolating Bwire >0.4: "
410  << Bz_par << endl;
411  // Bz_par = min(fabs(Bz_par),0.4)*((Bz_par<0.)?-1.:1.);
412  }
413 
415  static DTDriftTimeParametrization par;
416  unsigned short flag = par.MB_DT_drift_time (x, theta_par, By_par, Bz_par, 0, &DT, interpolate);
417 
418  if (debug) {
419  cout << " Parametrisation: x, theta, Bnorm, Bwire = "
420  << x << " " << theta_par << " " << By_par << " " << Bz_par << endl
421  << " time=" << DT.t_drift
422  << " sigma_m=" << DT.t_width_m
423  << " sigma_p=" << DT.t_width_p << endl;
424  if (flag!=1) {
425  cout << "*** WARNING: call to parametrisation failed" << endl;
426  return pair<float,bool>(0.f,false);
427  }
428  }
429 
430  // Double half-gaussian smearing
431  float time = asymGausSmear(DT.t_drift, DT.t_width_m, DT.t_width_p);
432 
433  // Do not allow the smearing to lead to negative values
434  time = max(time,0.f);
435 
436  // Apply a Gaussian smearing to account for electronic effects (cf. 2004 TB analysis)
437  // The width of the Gaussian can be configured with the "Smearing" parameter
438 
439  double u = theGaussianDistribution->fire(0.,smearing);
440  time += u;
441 
442  if (debug) cout << " drift time = " << time << endl;
443 
444  return pair<float,bool>(time,true);
445 }
long int flag
Definition: mlp_lapack.h:47
float asymGausSmear(double mean, double sigmaLeft, double sigmaRight) const
Definition: DTDigitizer.cc:447
CLHEP::RandGaussQ * theGaussianDistribution
Definition: DTDigitizer.h:118
Geom::Theta< T > theta() const
const T & max(const T &a, const T &b)
double f[11][100]
float smearing
Definition: DTDigitizer.h:103
bool interpolate
Definition: DTDigitizer.h:105
unsigned short MB_DT_drift_time(double x, double alpha, double by, double bz, short ifl, drift_time *DT, short interpolate) const
Calculate drift time and spread.
Structure used to return output values.
tuple cout
Definition: gather_cfg.py:121
x
Definition: VDTMath.h:216
pair< float, bool > DTDigitizer::driftTimeFromTimeMap ( ) const
private

Definition at line 462 of file DTDigitizer.cc.

References gather_cfg::cout, and debug.

462  {
463  // FIXME: not yet implemented.
464  if (debug) cout << " TimeMap " << endl;
465  return pair<float,bool>(0.,false);
466 }
tuple cout
Definition: gather_cfg.py:121
void DTDigitizer::dumpHit ( const PSimHit hit,
float  xEntry,
float  xExit,
const DTTopology topo 
)
private

Definition at line 577 of file DTDigitizer.cc.

References DTTopology::cellHeight(), DTTopology::cellLenght(), DTTopology::cellWidth(), gather_cfg::cout, PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), mag(), PSimHit::momentumAtEntry(), DTTopology::onWhichBorder(), PSimHit::pabs(), PSimHit::particleType(), PSimHit::processType(), PSimHit::trackId(), Vector3DBase< T, FrameTag >::unit(), vdt::x, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

579  {
580 
581  LocalPoint entryP = hit->entryPoint();
582  LocalPoint exitP = hit->exitPoint();
583 
584  DTTopology::Side entrySide = topo.onWhichBorder(xEntry,entryP.y(),entryP.z());
585  DTTopology::Side exitSide = topo.onWhichBorder(xExit,exitP.y(),exitP.z());
586  // ProcessTypeEnumerator pTypes;
587 
588  cout << endl
589  << "------- SimHit: " << endl
590  << " Particle type = " << hit->particleType() << endl
591  << " process type = " << hit->processType() << endl
592  << " process type = " << hit->processType() << endl
593  // << " packedTrackId = " << hit->packedTrackId() << endl
594  << " trackId = " << hit->trackId() << endl // new,is the same as the
595  // previous?? FIXME-Check
596  << " |p| = " << hit->pabs() << endl
597  << " Energy loss = " << hit->energyLoss() << endl
598  // << " timeOffset = " << hit->timeOffset() << endl
599  // << " measurementPosition = " << hit->measurementPosition() << endl
600  // << " measurementDirection = " << hit->measurementDirection() << endl //FIXME
601  << " localDirection = " << hit->momentumAtEntry().unit() << endl //FIXME is it a versor?
602  << " Entry point = " << entryP << " cell x = " << xEntry << endl
603  << " Exit point = " << exitP << " cell x = " << xExit << endl
604  << " DR = = " << (exitP-entryP).mag() << endl
605  << " Dx = = " << (exitP-entryP).x() << endl
606  << " Cell w,h,l = (" << topo.cellWidth()
607  << " , " << topo.cellHeight()
608  << " , " << topo.cellLenght() << ") cm" << endl
609  << " DY entry from edge = " << topo.cellLenght()/2.-fabs(entryP.y())
610  << " DY exit from edge = " << topo.cellLenght()/2.-fabs(exitP.y())
611  << " entrySide = " << (int)entrySide
612  << " ; exitSide = " << (int)exitSide << endl;
613 
614 }
Side onWhichBorder(float x, float y, float z) const
Definition: DTTopology.cc:111
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
Definition: PSimHit.h:47
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
T y() const
Definition: PV3DBase.h:62
float cellWidth() const
Returns the cell width.
Definition: DTTopology.h:70
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
T z() const
Definition: PV3DBase.h:63
float cellHeight() const
Returns the cell height.
Definition: DTTopology.h:72
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:63
Side
Sides of the cell.
Definition: DTTopology.h:90
Vector3DBase unit() const
Definition: Vector3DBase.h:57
unsigned short processType() const
Definition: PSimHit.h:118
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
int particleType() const
Definition: PSimHit.h:85
unsigned int trackId() const
Definition: PSimHit.h:102
tuple cout
Definition: gather_cfg.py:121
x
Definition: VDTMath.h:216
float cellLenght() const
Definition: DTTopology.h:75
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
float DTDigitizer::externalDelays ( const DTLayer layer,
const DTWireId wireId,
const PSimHit hit 
) const
private

Definition at line 470 of file DTDigitizer.cc.

References DTTopology::cellLenght(), gather_cfg::cout, debug, PSimHit::localPosition(), DTLayer::specificTopology(), PSimHit::tof(), and PV3DBase< T, PVType, FrameType >::y().

472  {
473 
474  // Time of signal propagation along wire.
475 
476  float wireCoord = hit->localPosition().y();
477  float halfL = (layer->specificTopology().cellLenght())/2.;
478  float propgL = halfL - wireCoord; // the FE is always located at the pos coord.
479 
480  float propDelay = propgL/vPropWire;
481 
482  // Real TOF.
483  float tof = hit->tof();
484 
485  // Delays and t0 according to theSync
486 
487  double sync= theSync->digitizerOffset(&wireId,layer);
488 
489 
490  if (debug) {
491  cout << " propDelay =" << propDelay
492  << "; TOF=" << tof
493  << "; sync= " << sync
494  << endl;
495  }
496 
497  return propDelay + tof + sync;
498 }
float tof() const
deprecated name for timeOfFlight()
Definition: PSimHit.h:72
T y() const
Definition: PV3DBase.h:62
DTDigiSyncBase * theSync
Definition: DTDigitizer.h:109
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
Local3DPoint localPosition() const
Definition: PSimHit.h:44
virtual double digitizerOffset(const DTWireId *id, const DTLayer *layer) const =0
Delays to be added to digi times during digitization, in ns.
double vPropWire
Definition: DTDigitizer.h:101
tuple cout
Definition: gather_cfg.py:121
float cellLenght() const
Definition: DTTopology.h:75
void DTDigitizer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 138 of file DTDigitizer.cc.

References MixCollection< T >::begin(), gather_cfg::cout, debug, edm::EventID::event(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::EventBase::id(), DTWireId::layerId(), convertSQLitetoXML_cfg::output, edm::Handle< T >::product(), edm::Event::put(), edm::EventID::run(), trackerHits::simHits, GeomDet::surface(), cond::rpcobgas::time, Surface::toGlobal(), and GloballyPositioned< T >::toLocal().

138  {
139  if(debug)
140  cout << "--- Run: " << iEvent.id().run()
141  << " Event: " << iEvent.id().event() << endl;
142 
143  //************ 1 ***************
144  // create the container for the SimHits
145  // Handle<PSimHitContainer> simHits;
146  // iEvent.getByLabel("g4SimHits","MuonDTHits",simHits);
147 
148  // use MixCollection instead of the previous
150  iEvent.getByLabel("mix",collection_for_XF,xFrame);
151 
152  auto_ptr<MixCollection<PSimHit> >
153  simHits( new MixCollection<PSimHit>(xFrame.product()) );
154 
155  // create the pointer to the Digi container
156  auto_ptr<DTDigiCollection> output(new DTDigiCollection());
157  // pointer to the DigiSimLink container
158  auto_ptr<DTDigiSimLinkCollection> outputLinks(new DTDigiSimLinkCollection());
159 
160  // Muon Geometry
161  ESHandle<DTGeometry> muonGeom;
162  iSetup.get<MuonGeometryRecord>().get(geometryType,muonGeom);
163 
164  // Magnetic Field
165  ESHandle<MagneticField> magnField;
166  iSetup.get<IdealMagneticFieldRecord>().get(magnField);
167 
168  //************ 2 ***************
169 
170  // These are sorted by DetId, i.e. by layer and then by wire #
171  // map<DTDetId, vector<const PSimHit*> > wireMap;
172  DTWireIdMap wireMap;
173 
174  for(MixCollection<PSimHit>::MixItr simHit = simHits->begin();
175  simHit != simHits->end(); simHit++){
176 
177  // Create the id of the wire, the simHits in the DT known also the wireId
178 
179  DTWireId wireId( (*simHit).detUnitId() );
180  // Fill the map
181  wireMap[wireId].push_back(&(*simHit));
182  }
183 
184  pair<float,bool> time(0.,false);
185 
186  //************ 3 ***************
187  // Loop over the wires
188  for(DTWireIdMapConstIter wire = wireMap.begin(); wire!=wireMap.end(); wire++){
189  // SimHit Container associated to the wire
190  const vector<const PSimHit*> & vhit = (*wire).second;
191  if(vhit.size()!=0) {
192  TDContainer tdCont; // It is a vector<pair<const PSimHit*,float> >;
193 
194  //************ 4 ***************
195  DTWireId wireId = (*wire).first;
196 
197  //const DTLayer* layer = dynamic_cast< const DTLayer* > (muonGeom->idToDet(wireId.layerId()));
198  const DTLayer* layer = muonGeom->layer(wireId.layerId());
199 
200  // Loop on the hits of this wire
201  for (vector<const PSimHit*>::const_iterator hit=vhit.begin();
202  hit != vhit.end(); hit++){
203  //************ 5 ***************
204  LocalPoint locPos = (*hit)->localPosition();
205 
206  const LocalVector BLoc=layer->surface().toLocal(magnField->inTesla(layer->surface().toGlobal(locPos)));
207 
208  time = computeTime(layer, wireId, *hit, BLoc);
209 
210  //************ 6 ***************
211  if (time.second) {
212  tdCont.push_back(make_pair((*hit),time.first));
213  } else {
214  if (debug) cout << "hit discarded" << endl;
215  }
216  }
217 
218  //************ 7 ***************
219 
220  // the loading must be done by layer but
221  // the digitization must be done by wire (in order to take into account the dead time)
222 
223  storeDigis(wireId,tdCont,*output,*outputLinks);
224  }
225 
226  }
227 
228  //************ 8 ***************
229  // Load the Digi Container in the Event
230  //iEvent.put(output,"MuonDTDigis");
231  iEvent.put(output);
232  iEvent.put(outputLinks);
233 
234 }
RunNumber_t run() const
Definition: EventID.h:42
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
EventNumber_t event() const
Definition: EventID.h:44
std::pair< float, bool > computeTime(const DTLayer *layer, const DTWireId &wireId, const PSimHit *hit, const LocalVector &BLoc)
Definition: DTDigitizer.cc:236
void storeDigis(DTWireId &wireId, TDContainer &hits, DTDigiCollection &output, DTDigiSimLinkCollection &outputLinks)
Definition: DTDigitizer.cc:503
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
LocalPoint toLocal(const GlobalPoint &gp) const
DTWireIdMap::const_iterator DTWireIdMapConstIter
Definition: DTDigitizer.h:53
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::string geometryType
Definition: DTDigitizer.h:111
const T & get() const
Definition: EventSetup.h:55
tuple simHits
Definition: trackerHits.py:16
T const * product() const
Definition: Handle.h:74
std::vector< hitAndT > TDContainer
Definition: DTDigitizer.h:49
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:64
edm::EventID id() const
Definition: EventBase.h:56
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
MuonDigiCollection< DTLayerId, DTDigi > DTDigiCollection
tuple cout
Definition: gather_cfg.py:121
MuonDigiCollection< DTLayerId, DTDigiSimLink > DTDigiSimLinkCollection
std::map< DTWireId, std::vector< const PSimHit * > > DTWireIdMap
Definition: DTDigitizer.h:51
std::string collection_for_XF
Definition: DTDigitizer.h:126
void DTDigitizer::storeDigis ( DTWireId wireId,
TDContainer hits,
DTDigiCollection output,
DTDigiSimLinkCollection outputLinks 
)
private

Definition at line 503 of file DTDigitizer.cc.

References abs, DTDigi::countsTDC(), gather_cfg::cout, debug, MuonDigiCollection< IndexType, DigiType >::insertDigi(), DTWireId::layerId(), DTDigi::number(), funct::pow(), python.multivaluedict::sort(), DTDigi::time(), cond::rpcobgas::time, and DTWireId::wire().

505  {
506 
507  //************ 7A ***************
508 
509  // sort signal times
510  sort(hits.begin(),hits.end(),hitLessT());
511 
512  //************ 7B ***************
513 
514  float wakeTime = -999999.0;
515  float resolTime = -999999.0;
516  int digiN = -1; // Digi identifier within the cell (for multiple digis)
517  DTDigi digi;
518 
519  // loop over signal times and drop signals inside dead time
520  for ( TDContainer::const_iterator hit = hits.begin() ; hit != hits.end() ;
521  hit++ ) {
522 
523  if (onlyMuHits && abs((*hit).first->particleType())!=13) continue;
524 
525  //************ 7C ***************
526 
527  float time = (*hit).second;
528  if ( time > wakeTime ) {
529  // Note that digi is constructed with a float value (in ns)
530  int wireN = wireId.wire();
531  digiN++;
532  digi = DTDigi(wireN, time, digiN);
533 
534  // Add association between THIS digi and the corresponding SimTrack
535  unsigned int SimTrackId = (*hit).first->trackId();
536  EncodedEventId evId = (*hit).first->eventId();
537  DTDigiSimLink digisimLink(wireN, digiN, time, SimTrackId, evId);
538 
539  if(debug) {
540  cout<<endl<<"---- DTDigitizer ----"<<endl;
541  cout<<"wireId: "<<wireId<<endl;
542  cout<<"sim. time = "<<time<<endl;
543  cout<<"digi number = "<< digi.number()<<", digi time = "<<digi.time()
544  <<", linked to SimTrack Id = "<<SimTrackId<<endl;
545  }
546 
547  //************ 7D ***************
548  if(digi.countsTDC() < pow(2.,16)){
549  DTLayerId layerID = wireId.layerId(); //taking the layer in which reside the wire
550  output.insertDigi(layerID, digi); // ordering Digis by layer
551  outputLinks.insertDigi(layerID, digisimLink);
552  wakeTime = time + deadTime;
553  resolTime = time + LinksTimeWindow;
554  }
555  else {
556  digiN--;
557  }
558  }
559  else if (MultipleLinks && time < resolTime){
560  int wireN = wireId.wire();
561  unsigned int SimTrackId = (*hit).first->trackId();
562  EncodedEventId evId = (*hit).first->eventId();
563  DTDigiSimLink digisimLink(wireN, digiN, time, SimTrackId, evId);
564  DTLayerId layerID = wireId.layerId();
565  outputLinks.insertDigi(layerID, digisimLink);
566 
567  if(debug) {
568  cout<<"\nAdded multiple link: \n"
569  <<"digi number = "<<digi.number()<<", digi time = "<<digi.time()<<" (sim. time = "<<time<<")"
570  <<", linked to SimTrack Id = "<<SimTrackId<<endl;
571  }
572  }
573  }
574 
575 }
bool onlyMuHits
Definition: DTDigitizer.h:106
#define abs(x)
Definition: mlp_lapack.h:159
float LinksTimeWindow
Definition: DTDigitizer.h:123
void insertDigi(const IndexType &index, const DigiType &digi)
insert a digi for a given DetUnit
double time() const
Get time in ns.
Definition: DTDigi.cc:65
Definition: DTDigi.h:19
uint32_t countsTDC() const
Get raw TDC count.
Definition: DTDigi.cc:67
int wire() const
Return the wire number.
Definition: DTWireId.h:58
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:64
int number() const
Identifies different digis within the same.
Definition: DTDigi.cc:71
tuple cout
Definition: gather_cfg.py:121
float deadTime
Definition: DTDigitizer.h:102
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
bool MultipleLinks
Definition: DTDigitizer.h:122

Friends And Related Function Documentation

friend class DTDigitizerAnalysis
friend

Definition at line 98 of file DTDigitizer.h.

Member Data Documentation

std::string DTDigitizer::collection_for_XF
private

Definition at line 126 of file DTDigitizer.h.

float DTDigitizer::deadTime
private

Definition at line 102 of file DTDigitizer.h.

bool DTDigitizer::debug
private

Definition at line 104 of file DTDigitizer.h.

std::string DTDigitizer::geometryType
private

Definition at line 111 of file DTDigitizer.h.

bool DTDigitizer::IdealModel
private

Definition at line 114 of file DTDigitizer.h.

bool DTDigitizer::interpolate
private

Definition at line 105 of file DTDigitizer.h.

float DTDigitizer::LinksTimeWindow
private

Definition at line 123 of file DTDigitizer.h.

bool DTDigitizer::MultipleLinks
private

Definition at line 122 of file DTDigitizer.h.

bool DTDigitizer::onlyMuHits
private

Definition at line 106 of file DTDigitizer.h.

float DTDigitizer::smearing
private

Definition at line 103 of file DTDigitizer.h.

std::string DTDigitizer::syncName
private

Definition at line 108 of file DTDigitizer.h.

float DTDigitizer::theConstVDrift
private

Definition at line 115 of file DTDigitizer.h.

CLHEP::RandFlat* DTDigitizer::theFlatDistribution
private

Definition at line 119 of file DTDigitizer.h.

CLHEP::RandGaussQ* DTDigitizer::theGaussianDistribution
private

Definition at line 118 of file DTDigitizer.h.

DTDigiSyncBase* DTDigitizer::theSync
private

Definition at line 109 of file DTDigitizer.h.

double DTDigitizer::vPropWire
private

Definition at line 101 of file DTDigitizer.h.