80 int size = clustermap.size();
83 auto clusterIdx = std::make_unique<std::vector<int>>();
84 auto onTrkClusterIdx =
85 std::make_unique<std::vector<int>>(
size, -1);
86 auto onTrkClustersBegin = std::make_unique<std::vector<int>>(tracks->size(), -1);
87 auto onTrkClustersEnd = std::make_unique<std::vector<int>>(tracks->size(), -1);
88 auto trackindex = std::make_unique<std::vector<int>>();
89 clusterIdx->reserve(size);
90 trackindex->reserve(size);
92 auto trackmulti = std::make_unique<std::vector<unsigned int>>();
93 trackmulti->reserve(size);
94 auto localtheta = std::make_unique<std::vector<float>>();
95 localtheta->reserve(size);
96 auto localphi = std::make_unique<std::vector<float>>();
97 localphi->reserve(size);
98 auto localpitch = std::make_unique<std::vector<float>>();
99 localpitch->reserve(size);
100 auto localx = std::make_unique<std::vector<float>>();
101 localx->reserve(size);
102 auto localy = std::make_unique<std::vector<float>>();
103 localy->reserve(size);
104 auto localz = std::make_unique<std::vector<float>>();
105 localz->reserve(size);
106 auto strip = std::make_unique<std::vector<float>>();
107 strip->reserve(size);
108 auto globaltheta = std::make_unique<std::vector<float>>();
109 globaltheta->reserve(size);
110 auto globalphi = std::make_unique<std::vector<float>>();
111 globalphi->reserve(size);
112 auto globalx = std::make_unique<std::vector<float>>();
113 globalx->reserve(size);
114 auto globaly = std::make_unique<std::vector<float>>();
115 globaly->reserve(size);
116 auto globalz = std::make_unique<std::vector<float>>();
117 globalz->reserve(size);
118 auto insidistance = std::make_unique<std::vector<float>>();
119 insidistance->reserve(size);
120 auto projwidth = std::make_unique<std::vector<float>>();
121 projwidth->reserve(size);
122 auto BdotY = std::make_unique<std::vector<float>>();
123 BdotY->reserve(size);
124 auto covered = std::make_unique<std::vector<float>>();
125 covered->reserve(size);
126 auto rhlocalx = std::make_unique<std::vector<float>>();
127 rhlocalx->reserve(size);
128 auto rhlocaly = std::make_unique<std::vector<float>>();
129 rhlocaly->reserve(size);
130 auto rhlocalxerr = std::make_unique<std::vector<float>>();
131 rhlocalxerr->reserve(size);
132 auto rhlocalyerr = std::make_unique<std::vector<float>>();
133 rhlocalyerr->reserve(size);
134 auto rhglobalx = std::make_unique<std::vector<float>>();
135 rhglobalx->reserve(size);
136 auto rhglobaly = std::make_unique<std::vector<float>>();
137 rhglobaly->reserve(size);
138 auto rhglobalz = std::make_unique<std::vector<float>>();
139 rhglobalz->reserve(size);
140 auto rhstrip = std::make_unique<std::vector<float>>();
141 rhstrip->reserve(size);
142 auto rhmerr = std::make_unique<std::vector<float>>();
143 rhmerr->reserve(size);
144 auto ubstrip = std::make_unique<std::vector<float>>();
145 ubstrip->reserve(size);
146 auto ubmerr = std::make_unique<std::vector<float>>();
147 ubmerr->reserve(size);
148 auto driftx = std::make_unique<std::vector<float>>();
149 driftx->reserve(size);
150 auto drifty = std::make_unique<std::vector<float>>();
151 drifty->reserve(size);
152 auto driftz = std::make_unique<std::vector<float>>();
153 driftz->reserve(size);
154 auto globalZofunitlocalY = std::make_unique<std::vector<float>>();
155 globalZofunitlocalY->reserve(size);
169 size_t ontrk_cluster_idx = 0;
170 std::map<size_t, std::vector<size_t>>
mapping;
178 size_t trk_strt_idx = ontrk_cluster_idx;
183 combiner(measurement.forwardPredictedState(), measurement.backwardPredictedState());
190 for (
unsigned h = 0;
h < 2;
h++) {
192 if (!matchedhit &&
h == 1)
194 else if (matchedhit &&
h == 0)
196 else if (matchedhit &&
h == 1)
199 cluster_ptr = (hit2D->
cluster()).
get();
201 cluster_ptr = (hit1D->
cluster()).
get();
205 shallow::CLUSTERMAP::const_iterator cluster =
206 clustermap.find(std::make_pair(hit->geographicalId().rawId(), cluster_ptr->
firstStrip()));
207 if (cluster == clustermap.end())
208 throw cms::Exception(
"Logic Error") <<
"Cluster not found: this could be a configuration error" << std::endl;
210 unsigned i = cluster->second;
213 auto already_visited = mapping.find(i);
214 int nassociations = 1;
215 if (already_visited != mapping.end()) {
216 nassociations += already_visited->second.size();
217 for (
size_t idx : already_visited->second) {
218 trackmulti->at(idx)++;
220 already_visited->second.push_back(ontrk_cluster_idx);
222 std::vector<size_t>
single = {ontrk_cluster_idx};
223 mapping.insert(std::make_pair(i, single));
230 if (nassociations == 1)
231 onTrkClusterIdx->at(i) = ontrk_cluster_idx;
232 clusterIdx->push_back(i);
233 trackmulti->push_back(nassociations);
234 trackindex->push_back(trk_idx);
237 localpitch->push_back(
248 insidistance->push_back(1. / fabs(
cos(localtheta->at(ontrk_cluster_idx))));
249 projwidth->push_back(
tan(localtheta->at(ontrk_cluster_idx)) *
cos(localphi->at(ontrk_cluster_idx)));
251 covered->push_back(drift.
z() / localpitch->at(ontrk_cluster_idx) *
252 fabs(projwidth->at(ontrk_cluster_idx) - drift.
x() / drift.
z()));
253 rhlocalx->push_back(hit->localPosition().x());
254 rhlocaly->push_back(hit->localPosition().y());
255 rhlocalxerr->push_back(
sqrt(hit->localPositionError().xx()));
256 rhlocalyerr->push_back(
sqrt(hit->localPositionError().yy()));
257 rhglobalx->push_back(theStripDet->
toGlobal(hit->localPosition()).
x());
258 rhglobaly->push_back(theStripDet->
toGlobal(hit->localPosition()).
y());
259 rhglobalz->push_back(theStripDet->
toGlobal(hit->localPosition()).
z());
261 rhmerr->push_back(
sqrt(
267 driftx->push_back(drift.
x());
268 drifty->push_back(drift.
y());
269 driftz->push_back(drift.
z());
276 onTrkClustersBegin->at(trk_idx) = trk_strt_idx;
277 onTrkClustersEnd->at(trk_idx) = ontrk_cluster_idx;
ClusterRef cluster() const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
friend struct const_iterator
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int findTrackIndex(const edm::Handle< edm::View< reco::Track > > &h, const reco::Track *t)
SiStripCluster const & monoCluster() const
LocalPoint localPosition() const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Geom::Phi< T > phi() const
virtual float strip(const LocalPoint &) const =0
GlobalPoint globalPosition() const
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
uint16_t firstStrip() const
const edm::EDGetTokenT< edm::View< reco::Track > > tracks_token_
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
LocalError positionError() const
Geom::Theta< T > theta() const
DataContainer const & measurements() const
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
ClusterRef cluster() const
const LocalTrajectoryError & localError() const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
const edm::EDGetTokenT< TrajTrackAssociationCollection > association_token_
CLUSTERMAP make_cluster_map(const edm::Event &, const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > &)
SiStripCluster const & stereoCluster() const
std::map< std::pair< uint32_t, uint16_t >, unsigned int > CLUSTERMAP
const TrackerGeomDet * idToDet(DetId) const override
const_iterator begin() const
first iterator over the map (read only)
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
const PositionType & position() const
GlobalVector globalDirection() const