82 int size = clustermap.size();
85 auto clusterIdx = std::make_unique<std::vector<int>>();
86 auto onTrkClusterIdx = std::make_unique<std::vector<int>>(
size, -1);
87 auto onTrkClustersBegin = std::make_unique<std::vector<int>>( tracks->size(), -1 );
88 auto onTrkClustersEnd = std::make_unique<std::vector<int>>( tracks->size(), -1 );
89 auto trackindex = std::make_unique<std::vector<int>>();
90 clusterIdx->reserve(size);
91 trackindex->reserve(size);
93 auto trackmulti = std::make_unique<std::vector<unsigned int>>(); trackmulti ->reserve(size);
94 auto localtheta = std::make_unique<std::vector<float>>(); localtheta ->reserve(size);
95 auto localphi = std::make_unique<std::vector<float>>(); localphi ->reserve(size);
96 auto localpitch = std::make_unique<std::vector<float>>(); localpitch ->reserve(size);
97 auto localx = std::make_unique<std::vector<float>>(); localx ->reserve(size);
98 auto localy = std::make_unique<std::vector<float>>(); localy ->reserve(size);
99 auto localz = std::make_unique<std::vector<float>>(); localz ->reserve(size);
100 auto strip = std::make_unique<std::vector<float>>();
strip ->reserve(size);
101 auto globaltheta = std::make_unique<std::vector<float>>(); globaltheta ->reserve(size);
102 auto globalphi = std::make_unique<std::vector<float>>(); globalphi ->reserve(size);
103 auto globalx = std::make_unique<std::vector<float>>(); globalx ->reserve(size);
104 auto globaly = std::make_unique<std::vector<float>>(); globaly ->reserve(size);
105 auto globalz = std::make_unique<std::vector<float>>(); globalz ->reserve(size);
106 auto insidistance = std::make_unique<std::vector<float>>(); insidistance->reserve(size);
107 auto projwidth = std::make_unique<std::vector<float>>(); projwidth ->reserve(size);
108 auto BdotY = std::make_unique<std::vector<float>>(); BdotY ->reserve(size);
109 auto covered = std::make_unique<std::vector<float>>(); covered ->reserve(size);
110 auto rhlocalx = std::make_unique<std::vector<float>>(); rhlocalx ->reserve(size);
111 auto rhlocaly = std::make_unique<std::vector<float>>(); rhlocaly ->reserve(size);
112 auto rhlocalxerr = std::make_unique<std::vector<float>>(); rhlocalxerr->reserve(size);
113 auto rhlocalyerr = std::make_unique<std::vector<float>>(); rhlocalyerr->reserve(size);
114 auto rhglobalx = std::make_unique<std::vector<float>>(); rhglobalx ->reserve(size);
115 auto rhglobaly = std::make_unique<std::vector<float>>(); rhglobaly ->reserve(size);
116 auto rhglobalz = std::make_unique<std::vector<float>>(); rhglobalz ->reserve(size);
117 auto rhstrip = std::make_unique<std::vector<float>>(); rhstrip ->reserve(size);
118 auto rhmerr = std::make_unique<std::vector<float>>(); rhmerr ->reserve(size);
119 auto ubstrip = std::make_unique<std::vector<float>>(); ubstrip ->reserve(size);
120 auto ubmerr = std::make_unique<std::vector<float>>(); ubmerr ->reserve(size);
121 auto driftx = std::make_unique<std::vector<float>>(); driftx ->reserve(size);
122 auto drifty = std::make_unique<std::vector<float>>(); drifty ->reserve(size);
123 auto driftz = std::make_unique<std::vector<float>>(); driftz ->reserve(size);
124 auto globalZofunitlocalY = std::make_unique<std::vector<float>>(); globalZofunitlocalY->reserve(size);
134 size_t ontrk_cluster_idx=0;
135 std::map<size_t, std::vector<size_t> >
mapping;
142 size_t trk_strt_idx = ontrk_cluster_idx;
153 for(
unsigned h=0;
h<2;
h++) {
155 if(!matchedhit &&
h==1)
continue;
156 else if( matchedhit &&
h==0) cluster_ptr = &matchedhit->
monoCluster();
157 else if( matchedhit &&
h==1) cluster_ptr = &matchedhit->
stereoCluster();
158 else if(hit2D) cluster_ptr = (hit2D->
cluster()).
get();
159 else if(hit1D) cluster_ptr = (hit1D->
cluster()).
get();
162 shallow::CLUSTERMAP::const_iterator cluster = clustermap.find( std::make_pair( hit->geographicalId().rawId(), cluster_ptr->
firstStrip() ));
163 if(cluster == clustermap.end() )
throw cms::Exception(
"Logic Error") <<
"Cluster not found: this could be a configuration error" << std::endl;
165 unsigned i = cluster->second;
168 auto already_visited = mapping.find(i);
169 int nassociations = 1;
170 if(already_visited != mapping.end()) {
171 nassociations += already_visited->second.size();
172 for(
size_t idx : already_visited->second) {
173 trackmulti->at(idx)++;
175 already_visited->second.push_back(ontrk_cluster_idx);
178 std::vector<size_t>
single = {ontrk_cluster_idx};
179 mapping.insert( std::make_pair(i, single) );
185 if(nassociations == 1) onTrkClusterIdx->at(i) = ontrk_cluster_idx;
186 clusterIdx->push_back( i );
187 trackmulti->push_back( nassociations );
188 trackindex->push_back( trk_idx );
201 insidistance->push_back(1./fabs(
cos(localtheta->at(ontrk_cluster_idx))) );
202 projwidth->push_back(
tan(localtheta->at(ontrk_cluster_idx))*
cos(localphi->at(ontrk_cluster_idx)) );
204 covered->push_back( drift.
z()/localpitch->at(ontrk_cluster_idx) * fabs(projwidth->at(ontrk_cluster_idx) - drift.
x()/drift.
z()) );
205 rhlocalx->push_back( hit->localPosition().x() );
206 rhlocaly->push_back( hit->localPosition().y() );
207 rhlocalxerr->push_back(
sqrt(hit->localPositionError().xx()) );
208 rhlocalyerr->push_back(
sqrt(hit->localPositionError().yy()) );
209 rhglobalx->push_back( theStripDet->
toGlobal(hit->localPosition()).
x() );
210 rhglobaly->push_back( theStripDet->
toGlobal(hit->localPosition()).
y() );
211 rhglobalz->push_back( theStripDet->
toGlobal(hit->localPosition()).
z() );
216 driftx->push_back( drift.
x() );
217 drifty->push_back( drift.
y() );
218 driftz->push_back( drift.
z() );
225 onTrkClustersBegin->at(trk_idx) = trk_strt_idx;
226 onTrkClustersEnd->at(trk_idx) = ontrk_cluster_idx;
ClusterRef cluster() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ConstRecHitPointer const & recHit() const
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_
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_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
TrajectoryStateOnSurface const & updatedState() const
const_iterator begin() const
first iterator over the map (read only)
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
const PositionType & position() const
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
GlobalVector globalDirection() const
const TrackerGeomDet * idToDet(DetId) const