1 |
econte |
1.1 |
#include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
|
2 |
|
|
//
|
3 |
|
|
// include all the concrete ones
|
4 |
|
|
//
|
5 |
|
|
#include "FWCore/Utilities/interface/Exception.h"
|
6 |
|
|
|
7 |
|
|
#include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit2DLocalPos.h"
|
8 |
|
|
#include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit1D.h"
|
9 |
|
|
#include "RecoTracker/TransientTrackingRecHit/interface/TSiStripMatchedRecHit.h"
|
10 |
|
|
#include "RecoTracker/TransientTrackingRecHit/interface/TSiPixelRecHit.h"
|
11 |
|
|
#include "TrackingTools/TransientTrackingRecHit/interface/InvalidTransientRecHit.h"
|
12 |
|
|
#include "DataFormats/TrackingRecHit/interface/InvalidTrackingRecHit.h"
|
13 |
|
|
#include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h"
|
14 |
|
|
#include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h"
|
15 |
|
|
#include "RecoTracker/TransientTrackingRecHit/interface/ProjectedRecHit2D.h"
|
16 |
|
|
//
|
17 |
|
|
// For FAMOS
|
18 |
|
|
//
|
19 |
|
|
#include "TrackingTools/TransientTrackingRecHit/interface/GenericTransientTrackingRecHit.h"
|
20 |
|
|
#include "DataFormats/TrackerRecHit2D/interface/SiTrackerGSRecHit2D.h"
|
21 |
|
|
#include "DataFormats/TrackerRecHit2D/interface/SiTrackerGSMatchedRecHit2D.h"
|
22 |
|
|
|
23 |
|
|
#include "Utilities/General/interface/ClassName.h"
|
24 |
|
|
#include <typeinfo>
|
25 |
|
|
|
26 |
|
|
TkTransientTrackingRecHitBuilder::TkTransientTrackingRecHitBuilder( const TrackingGeometry* trackingGeometry,
|
27 |
|
|
const PixelClusterParameterEstimator * pCPE,
|
28 |
|
|
const StripClusterParameterEstimator * sCPE,
|
29 |
|
|
const SiStripRecHitMatcher * matcher,
|
30 |
|
|
bool computeCoarseLocalPositionFromDisk):
|
31 |
|
|
tGeometry_(trackingGeometry),
|
32 |
|
|
pixelCPE(pCPE),
|
33 |
|
|
stripCPE(sCPE),
|
34 |
|
|
theMatcher(matcher),
|
35 |
|
|
theComputeCoarseLocalPosition(computeCoarseLocalPositionFromDisk){}
|
36 |
|
|
|
37 |
|
|
TransientTrackingRecHit::RecHitPointer
|
38 |
|
|
TkTransientTrackingRecHitBuilder::build (const TrackingRecHit * p) const
|
39 |
|
|
{
|
40 |
|
|
std::type_info const & tp = typeid(*p);
|
41 |
|
|
|
42 |
|
|
if (tp == typeid(SiPixelRecHit))
|
43 |
|
|
{
|
44 |
|
|
const SiPixelRecHit* ph = reinterpret_cast<const SiPixelRecHit*>(p);
|
45 |
|
|
return ( TSiPixelRecHit::build( tGeometry_->idToDet(p->geographicalId()), ph, pixelCPE, 1.,1.,theComputeCoarseLocalPosition) );
|
46 |
|
|
}
|
47 |
|
|
else if (tp == typeid(SiStripRecHit2D))
|
48 |
|
|
{
|
49 |
|
|
const SiStripRecHit2D* sh = reinterpret_cast<const SiStripRecHit2D*>(p);
|
50 |
|
|
return ( TSiStripRecHit2DLocalPos::build(tGeometry_->idToDet(p->geographicalId()), sh, stripCPE, 1.,1., theComputeCoarseLocalPosition ) );
|
51 |
|
|
}
|
52 |
|
|
else if (tp == typeid(SiStripRecHit1D))
|
53 |
|
|
{
|
54 |
|
|
const SiStripRecHit1D* sh = reinterpret_cast<const SiStripRecHit1D*>(p);
|
55 |
|
|
return ( TSiStripRecHit1D::build(tGeometry_->idToDet(p->geographicalId()), sh, stripCPE, 1.,1., theComputeCoarseLocalPosition ) );
|
56 |
|
|
}
|
57 |
|
|
else if (tp == typeid(SiStripMatchedRecHit2D))
|
58 |
|
|
{
|
59 |
|
|
const SiStripMatchedRecHit2D* mh = reinterpret_cast<const SiStripMatchedRecHit2D*>(p);
|
60 |
|
|
return ( TSiStripMatchedRecHit::build(tGeometry_->idToDet(p->geographicalId()), mh, theMatcher, stripCPE, 1.,1., theComputeCoarseLocalPosition));
|
61 |
|
|
}
|
62 |
|
|
else if (tp == typeid(InvalidTrackingRecHit))
|
63 |
|
|
{
|
64 |
|
|
return ( InvalidTransientRecHit::build((p->geographicalId().rawId() == 0 ? 0 :
|
65 |
|
|
tGeometry_->idToDet(p->geographicalId())),
|
66 |
|
|
p->getType()
|
67 |
|
|
) );
|
68 |
|
|
}
|
69 |
|
|
else if (tp == typeid(ProjectedSiStripRecHit2D))
|
70 |
|
|
{
|
71 |
|
|
const ProjectedSiStripRecHit2D* ph = reinterpret_cast<const ProjectedSiStripRecHit2D*>(p);
|
72 |
|
|
return ProjectedRecHit2D::build(tGeometry_->idToDet(p->geographicalId()),
|
73 |
|
|
tGeometry_->idToDet(ph->originalHit().geographicalId()),
|
74 |
|
|
ph,stripCPE,
|
75 |
|
|
1.,1.,
|
76 |
|
|
theComputeCoarseLocalPosition);
|
77 |
|
|
}
|
78 |
|
|
else if (tp == typeid(SiTrackerGSRecHit2D))
|
79 |
|
|
{
|
80 |
|
|
const SiTrackerGSRecHit2D* gh = reinterpret_cast<const SiTrackerGSRecHit2D*>(p);
|
81 |
|
|
return ( GenericTransientTrackingRecHit::build(tGeometry_->idToDet(p->geographicalId()), gh ));
|
82 |
|
|
}
|
83 |
|
|
else if (tp == typeid(SiTrackerGSMatchedRecHit2D))
|
84 |
|
|
{
|
85 |
|
|
const SiTrackerGSMatchedRecHit2D* gh = reinterpret_cast<const SiTrackerGSMatchedRecHit2D*>(p);
|
86 |
|
|
return ( GenericTransientTrackingRecHit::build(tGeometry_->idToDet(p->geographicalId()), gh ));
|
87 |
|
|
}
|
88 |
|
|
return oldbuild(p);
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
TransientTrackingRecHit::RecHitPointer
|
92 |
|
|
TkTransientTrackingRecHitBuilder::oldbuild (const TrackingRecHit * p) const
|
93 |
|
|
{
|
94 |
|
|
if ( const SiPixelRecHit* ph = dynamic_cast<const SiPixelRecHit*>(p)) {
|
95 |
|
|
return ( TSiPixelRecHit::build( tGeometry_->idToDet(p->geographicalId()), ph, pixelCPE, 1.,1.,theComputeCoarseLocalPosition) );
|
96 |
|
|
} else if ( const SiStripRecHit2D* sh = dynamic_cast<const SiStripRecHit2D*>(p)) {
|
97 |
|
|
return ( TSiStripRecHit2DLocalPos::build(tGeometry_->idToDet(p->geographicalId()), sh, stripCPE, 1.,1., theComputeCoarseLocalPosition ) );
|
98 |
|
|
} else if ( const SiStripRecHit1D* sh = dynamic_cast<const SiStripRecHit1D*>(p)) {
|
99 |
|
|
return ( TSiStripRecHit1D::build(tGeometry_->idToDet(p->geographicalId()), sh, stripCPE, 1.,1., theComputeCoarseLocalPosition ) );
|
100 |
|
|
} else if ( const SiStripMatchedRecHit2D* mh = dynamic_cast<const SiStripMatchedRecHit2D*>(p)) {
|
101 |
|
|
return ( TSiStripMatchedRecHit::build(tGeometry_->idToDet(p->geographicalId()), mh, theMatcher, stripCPE, 1.,1., theComputeCoarseLocalPosition));
|
102 |
|
|
} else if (dynamic_cast<const InvalidTrackingRecHit*>(p)){
|
103 |
|
|
return ( InvalidTransientRecHit::build((p->geographicalId().rawId() == 0 ? 0 :
|
104 |
|
|
tGeometry_->idToDet(p->geographicalId())),
|
105 |
|
|
p->getType()
|
106 |
|
|
) );
|
107 |
|
|
|
108 |
|
|
}else if (const ProjectedSiStripRecHit2D* ph = dynamic_cast<const ProjectedSiStripRecHit2D*>(p)) {
|
109 |
|
|
return ProjectedRecHit2D::build(tGeometry_->idToDet(p->geographicalId()),
|
110 |
|
|
tGeometry_->idToDet(ph->originalHit().geographicalId()),
|
111 |
|
|
ph,stripCPE,
|
112 |
|
|
1.,1.,
|
113 |
|
|
theComputeCoarseLocalPosition);
|
114 |
|
|
} else if ( const SiTrackerGSRecHit2D* gh = dynamic_cast<const SiTrackerGSRecHit2D*>(p)) {
|
115 |
|
|
return ( GenericTransientTrackingRecHit::build(tGeometry_->idToDet(p->geographicalId()), gh ));
|
116 |
|
|
|
117 |
|
|
} else if ( const SiTrackerGSMatchedRecHit2D* gh = dynamic_cast<const SiTrackerGSMatchedRecHit2D*>(p)) {
|
118 |
|
|
return ( GenericTransientTrackingRecHit::build(tGeometry_->idToDet(p->geographicalId()), gh ));
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
throw cms::Exception("LogicError") << "TrackingRecHit* cannot be casted to a known concrete type. hit type is: "<< className(*p);
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
TransientTrackingRecHit::RecHitPointer
|
126 |
|
|
TkTransientTrackingRecHitBuilder::build (const TrackingRecHit * p,
|
127 |
|
|
const TrajectoryStateOnSurface & tsos) const
|
128 |
|
|
{
|
129 |
|
|
TransientTrackingRecHit::RecHitPointer noRefit = build(p);
|
130 |
|
|
return noRefit->clone(tsos);
|
131 |
|
|
}
|