27 : tracks_token_(consumes<
edm::
View<
reco::Track> >(iConfig.getParameter<
edm::InputTag>(
"Tracks"))),
29 clusters_token_( consumes<
edmNew::DetSetVector<
SiStripCluster> >( iConfig.getParameter<
edm::InputTag>(
"Clusters") ) ),
30 Suffix ( iConfig.getParameter<
std::
string>(
"Suffix") ),
31 Prefix ( iConfig.getParameter<
std::
string>(
"Prefix") )
33 produces<std::vector<int> > (
Prefix +
"clusterIdx" +
Suffix );
34 produces<std::vector<int> > (
Prefix +
"onTrkClusterIdx" +
Suffix );
35 produces <std::vector<int> > (
Prefix +
"onTrkClustersBegin" +
Suffix );
36 produces <std::vector<int> > (
Prefix +
"onTrkClustersEnd" +
Suffix );
37 produces <std::vector<int> > (
Prefix +
"trackindex" +
Suffix );
39 produces <std::vector<unsigned int> > (
Prefix +
"trackmulti" +
Suffix );
40 produces <std::vector<float> > (
Prefix +
"localtheta" +
Suffix );
41 produces <std::vector<float> > (
Prefix +
"localphi" +
Suffix );
42 produces <std::vector<float> > (
Prefix +
"localpitch" +
Suffix );
43 produces <std::vector<float> > (
Prefix +
"localx" +
Suffix );
44 produces <std::vector<float> > (
Prefix +
"localy" +
Suffix );
45 produces <std::vector<float> > (
Prefix +
"localz" +
Suffix );
46 produces <std::vector<float> > (
Prefix +
"strip" +
Suffix );
47 produces <std::vector<float> > (
Prefix +
"globaltheta" +
Suffix );
48 produces <std::vector<float> > (
Prefix +
"globalphi" +
Suffix );
49 produces <std::vector<float> > (
Prefix +
"globalx" +
Suffix );
50 produces <std::vector<float> > (
Prefix +
"globaly" +
Suffix );
51 produces <std::vector<float> > (
Prefix +
"globalz" +
Suffix );
52 produces <std::vector<float> > (
Prefix +
"insidistance"+
Suffix );
53 produces <std::vector<float> > (
Prefix +
"covered" +
Suffix );
54 produces <std::vector<float> > (
Prefix +
"projwidth" +
Suffix );
55 produces <std::vector<float> > (
Prefix +
"BdotY" +
Suffix );
57 produces <std::vector<float> > (
Prefix +
"rhlocalx" +
Suffix );
58 produces <std::vector<float> > (
Prefix +
"rhlocaly" +
Suffix );
59 produces <std::vector<float> > (
Prefix +
"rhlocalxerr" +
Suffix );
60 produces <std::vector<float> > (
Prefix +
"rhlocalyerr" +
Suffix );
61 produces <std::vector<float> > (
Prefix +
"rhglobalx" +
Suffix );
62 produces <std::vector<float> > (
Prefix +
"rhglobaly" +
Suffix );
63 produces <std::vector<float> > (
Prefix +
"rhglobalz" +
Suffix );
64 produces <std::vector<float> > (
Prefix +
"rhstrip" +
Suffix );
65 produces <std::vector<float> > (
Prefix +
"rhmerr" +
Suffix );
67 produces <std::vector<float> > (
Prefix +
"ubstrip" +
Suffix );
68 produces <std::vector<float> > (
Prefix +
"ubmerr" +
Suffix );
70 produces <std::vector<float> > (
Prefix +
"driftx" +
Suffix );
71 produces <std::vector<float> > (
Prefix +
"drifty" +
Suffix );
72 produces <std::vector<float> > (
Prefix +
"driftz" +
Suffix );
73 produces <std::vector<float> > (
Prefix +
"globalZofunitlocalY" +
Suffix );
81 int size = clustermap.size();
84 auto clusterIdx = std::make_unique<std::vector<int>>();
85 auto onTrkClusterIdx = 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>>(); trackmulti ->reserve(size);
93 auto localtheta = std::make_unique<std::vector<float>>(); localtheta ->reserve(size);
94 auto localphi = std::make_unique<std::vector<float>>(); localphi ->reserve(size);
95 auto localpitch = std::make_unique<std::vector<float>>(); localpitch ->reserve(size);
96 auto localx = std::make_unique<std::vector<float>>(); localx ->reserve(size);
97 auto localy = std::make_unique<std::vector<float>>(); localy ->reserve(size);
98 auto localz = std::make_unique<std::vector<float>>(); localz ->reserve(size);
99 auto strip = std::make_unique<std::vector<float>>();
strip ->reserve(size);
100 auto globaltheta = std::make_unique<std::vector<float>>(); globaltheta ->reserve(size);
101 auto globalphi = std::make_unique<std::vector<float>>(); globalphi ->reserve(size);
102 auto globalx = std::make_unique<std::vector<float>>(); globalx ->reserve(size);
103 auto globaly = std::make_unique<std::vector<float>>(); globaly ->reserve(size);
104 auto globalz = std::make_unique<std::vector<float>>(); globalz ->reserve(size);
105 auto insidistance = std::make_unique<std::vector<float>>(); insidistance->reserve(size);
106 auto projwidth = std::make_unique<std::vector<float>>(); projwidth ->reserve(size);
107 auto BdotY = std::make_unique<std::vector<float>>(); BdotY ->reserve(size);
108 auto covered = std::make_unique<std::vector<float>>(); covered ->reserve(size);
109 auto rhlocalx = std::make_unique<std::vector<float>>(); rhlocalx ->reserve(size);
110 auto rhlocaly = std::make_unique<std::vector<float>>(); rhlocaly ->reserve(size);
111 auto rhlocalxerr = std::make_unique<std::vector<float>>(); rhlocalxerr->reserve(size);
112 auto rhlocalyerr = std::make_unique<std::vector<float>>(); rhlocalyerr->reserve(size);
113 auto rhglobalx = std::make_unique<std::vector<float>>(); rhglobalx ->reserve(size);
114 auto rhglobaly = std::make_unique<std::vector<float>>(); rhglobaly ->reserve(size);
115 auto rhglobalz = std::make_unique<std::vector<float>>(); rhglobalz ->reserve(size);
116 auto rhstrip = std::make_unique<std::vector<float>>(); rhstrip ->reserve(size);
117 auto rhmerr = std::make_unique<std::vector<float>>(); rhmerr ->reserve(size);
118 auto ubstrip = std::make_unique<std::vector<float>>(); ubstrip ->reserve(size);
119 auto ubmerr = std::make_unique<std::vector<float>>(); ubmerr ->reserve(size);
120 auto driftx = std::make_unique<std::vector<float>>(); driftx ->reserve(size);
121 auto drifty = std::make_unique<std::vector<float>>(); drifty ->reserve(size);
122 auto driftz = std::make_unique<std::vector<float>>(); driftz ->reserve(size);
123 auto globalZofunitlocalY = std::make_unique<std::vector<float>>(); globalZofunitlocalY->reserve(size);
133 size_t ontrk_cluster_idx=0;
134 std::map<size_t, std::vector<size_t> >
mapping;
141 size_t trk_strt_idx = ontrk_cluster_idx;
152 for(
unsigned h=0;
h<2;
h++) {
154 if(!matchedhit &&
h==1)
continue;
155 else if( matchedhit &&
h==0) cluster_ptr = &matchedhit->
monoCluster();
156 else if( matchedhit &&
h==1) cluster_ptr = &matchedhit->
stereoCluster();
157 else if(hit2D) cluster_ptr = (hit2D->
cluster()).
get();
158 else if(hit1D) cluster_ptr = (hit1D->
cluster()).
get();
161 shallow::CLUSTERMAP::const_iterator cluster = clustermap.find( std::make_pair( hit->geographicalId().rawId(), cluster_ptr->
firstStrip() ));
162 if(cluster == clustermap.end() )
throw cms::Exception(
"Logic Error") <<
"Cluster not found: this could be a configuration error" << std::endl;
164 unsigned i = cluster->second;
167 auto already_visited = mapping.find(i);
168 int nassociations = 1;
169 if(already_visited != mapping.end()) {
170 nassociations += already_visited->second.size();
171 for(
size_t idx : already_visited->second) {
172 trackmulti->at(idx)++;
174 already_visited->second.push_back(ontrk_cluster_idx);
177 std::vector<size_t>
single = {ontrk_cluster_idx};
178 mapping.insert( std::make_pair(i, single) );
184 if(nassociations == 1) onTrkClusterIdx->at(i) = ontrk_cluster_idx;
185 clusterIdx->push_back( i );
186 trackmulti->push_back( nassociations );
187 trackindex->push_back( trk_idx );
200 insidistance->push_back(1./fabs(
cos(localtheta->at(ontrk_cluster_idx))) );
201 projwidth->push_back(
tan(localtheta->at(ontrk_cluster_idx))*
cos(localphi->at(ontrk_cluster_idx)) );
203 covered->push_back( drift.
z()/localpitch->at(ontrk_cluster_idx) * fabs(projwidth->at(ontrk_cluster_idx) - drift.
x()/drift.
z()) );
204 rhlocalx->push_back( hit->localPosition().x() );
205 rhlocaly->push_back( hit->localPosition().y() );
206 rhlocalxerr->push_back(
sqrt(hit->localPositionError().xx()) );
207 rhlocalyerr->push_back(
sqrt(hit->localPositionError().yy()) );
208 rhglobalx->push_back( theStripDet->
toGlobal(hit->localPosition()).
x() );
209 rhglobaly->push_back( theStripDet->
toGlobal(hit->localPosition()).
y() );
210 rhglobalz->push_back( theStripDet->
toGlobal(hit->localPosition()).
z() );
215 driftx->push_back( drift.
x() );
216 drifty->push_back( drift.
y() );
217 driftz->push_back( drift.
z() );
224 onTrkClustersBegin->at(trk_idx) = trk_strt_idx;
225 onTrkClustersEnd->at(trk_idx) = ontrk_cluster_idx;
ClusterRef cluster() const
void produce(edm::Event &, const edm::EventSetup &) override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ShallowTrackClustersProducer(const edm::ParameterSet &)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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_
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
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