22 #include "boost/foreach.hpp"
28 : tracks_token_(consumes<edm::
View<
reco::Track> >(iConfig.getParameter<edm::
InputTag>(
"Tracks"))),
30 clusters_token_( consumes< edmNew::DetSetVector<
SiStripCluster> >( iConfig.getParameter<edm::
InputTag>(
"Clusters") ) ),
31 Suffix ( iConfig.getParameter<std::
string>(
"Suffix") ),
34 produces<std::vector<int> > (
Prefix +
"clusterIdx" +
Suffix );
35 produces<std::vector<int> > (
Prefix +
"onTrkClusterIdx" +
Suffix );
36 produces <std::vector<int> > (
Prefix +
"onTrkClustersBegin" +
Suffix );
37 produces <std::vector<int> > (
Prefix +
"onTrkClustersEnd" +
Suffix );
38 produces <std::vector<int> > (
Prefix +
"trackindex" +
Suffix );
40 produces <std::vector<unsigned int> > (
Prefix +
"trackmulti" +
Suffix );
41 produces <std::vector<float> > (
Prefix +
"localtheta" +
Suffix );
42 produces <std::vector<float> > (
Prefix +
"localphi" +
Suffix );
43 produces <std::vector<float> > (
Prefix +
"localpitch" +
Suffix );
44 produces <std::vector<float> > (
Prefix +
"localx" +
Suffix );
45 produces <std::vector<float> > (
Prefix +
"localy" +
Suffix );
46 produces <std::vector<float> > (
Prefix +
"localz" +
Suffix );
47 produces <std::vector<float> > (
Prefix +
"strip" +
Suffix );
48 produces <std::vector<float> > (
Prefix +
"globaltheta" +
Suffix );
49 produces <std::vector<float> > (
Prefix +
"globalphi" +
Suffix );
50 produces <std::vector<float> > (
Prefix +
"globalx" +
Suffix );
51 produces <std::vector<float> > (
Prefix +
"globaly" +
Suffix );
52 produces <std::vector<float> > (
Prefix +
"globalz" +
Suffix );
53 produces <std::vector<float> > (
Prefix +
"insidistance"+
Suffix );
54 produces <std::vector<float> > (
Prefix +
"covered" +
Suffix );
55 produces <std::vector<float> > (
Prefix +
"projwidth" +
Suffix );
56 produces <std::vector<float> > (
Prefix +
"BdotY" +
Suffix );
58 produces <std::vector<float> > (
Prefix +
"rhlocalx" +
Suffix );
59 produces <std::vector<float> > (
Prefix +
"rhlocaly" +
Suffix );
60 produces <std::vector<float> > (
Prefix +
"rhlocalxerr" +
Suffix );
61 produces <std::vector<float> > (
Prefix +
"rhlocalyerr" +
Suffix );
62 produces <std::vector<float> > (
Prefix +
"rhglobalx" +
Suffix );
63 produces <std::vector<float> > (
Prefix +
"rhglobaly" +
Suffix );
64 produces <std::vector<float> > (
Prefix +
"rhglobalz" +
Suffix );
65 produces <std::vector<float> > (
Prefix +
"rhstrip" +
Suffix );
66 produces <std::vector<float> > (
Prefix +
"rhmerr" +
Suffix );
68 produces <std::vector<float> > (
Prefix +
"ubstrip" +
Suffix );
69 produces <std::vector<float> > (
Prefix +
"ubmerr" +
Suffix );
71 produces <std::vector<float> > (
Prefix +
"driftx" +
Suffix );
72 produces <std::vector<float> > (
Prefix +
"drifty" +
Suffix );
73 produces <std::vector<float> > (
Prefix +
"driftz" +
Suffix );
74 produces <std::vector<float> > (
Prefix +
"globalZofunitlocalY" +
Suffix );
82 int size = clustermap.size();
85 std::auto_ptr<std::vector<int> > clusterIdx (
new std::vector<int>() );
86 std::auto_ptr<std::vector<int> > onTrkClusterIdx (
new std::vector<int>(size, -1) );
87 std::auto_ptr<std::vector<int> > onTrkClustersBegin (
new std::vector<int>( tracks->size(), -1 ) );
88 std::auto_ptr<std::vector<int> > onTrkClustersEnd (
new std::vector<int>( tracks->size(), -1 ) );
89 std::auto_ptr<std::vector<int> > trackindex (
new std::vector<int>() );
90 clusterIdx->reserve(size);
91 trackindex->reserve(size);
93 std::auto_ptr<std::vector<unsigned int> > trackmulti (
new std::vector<unsigned int>()); trackmulti ->reserve(size);
94 std::auto_ptr<std::vector<float> > localtheta (
new std::vector<float> ()); localtheta ->reserve(size);
95 std::auto_ptr<std::vector<float> > localphi (
new std::vector<float> ()); localphi ->reserve(size);
96 std::auto_ptr<std::vector<float> > localpitch (
new std::vector<float> ()); localpitch ->reserve(size);
97 std::auto_ptr<std::vector<float> > localx (
new std::vector<float> ()); localx ->reserve(size);
98 std::auto_ptr<std::vector<float> > localy (
new std::vector<float> ()); localy ->reserve(size);
99 std::auto_ptr<std::vector<float> > localz (
new std::vector<float> ()); localz ->reserve(size);
100 std::auto_ptr<std::vector<float> > strip (
new std::vector<float> ()); strip ->reserve(size);
101 std::auto_ptr<std::vector<float> > globaltheta (
new std::vector<float> ()); globaltheta ->reserve(size);
102 std::auto_ptr<std::vector<float> > globalphi (
new std::vector<float> ()); globalphi ->reserve(size);
103 std::auto_ptr<std::vector<float> > globalx (
new std::vector<float> ()); globalx ->reserve(size);
104 std::auto_ptr<std::vector<float> > globaly (
new std::vector<float> ()); globaly ->reserve(size);
105 std::auto_ptr<std::vector<float> > globalz (
new std::vector<float> ()); globalz ->reserve(size);
106 std::auto_ptr<std::vector<float> > insidistance (
new std::vector<float> ()); insidistance->reserve(size);
107 std::auto_ptr<std::vector<float> > projwidth (
new std::vector<float> ()); projwidth ->reserve(size);
108 std::auto_ptr<std::vector<float> > BdotY (
new std::vector<float> ()); BdotY ->reserve(size);
109 std::auto_ptr<std::vector<float> > covered (
new std::vector<float> ()); covered ->reserve(size);
110 std::auto_ptr<std::vector<float> > rhlocalx (
new std::vector<float>()); rhlocalx ->reserve(size);
111 std::auto_ptr<std::vector<float> > rhlocaly (
new std::vector<float>()); rhlocaly ->reserve(size);
112 std::auto_ptr<std::vector<float> > rhlocalxerr(
new std::vector<float>()); rhlocalxerr->reserve(size);
113 std::auto_ptr<std::vector<float> > rhlocalyerr(
new std::vector<float>()); rhlocalyerr->reserve(size);
114 std::auto_ptr<std::vector<float> > rhglobalx (
new std::vector<float>()); rhglobalx ->reserve(size);
115 std::auto_ptr<std::vector<float> > rhglobaly (
new std::vector<float>()); rhglobaly ->reserve(size);
116 std::auto_ptr<std::vector<float> > rhglobalz (
new std::vector<float>()); rhglobalz ->reserve(size);
117 std::auto_ptr<std::vector<float> > rhstrip (
new std::vector<float>()); rhstrip ->reserve(size);
118 std::auto_ptr<std::vector<float> > rhmerr (
new std::vector<float>()); rhmerr ->reserve(size);
119 std::auto_ptr<std::vector<float> > ubstrip (
new std::vector<float>()); ubstrip ->reserve(size);
120 std::auto_ptr<std::vector<float> > ubmerr (
new std::vector<float>()); ubmerr ->reserve(size);
121 std::auto_ptr<std::vector<float> > driftx (
new std::vector<float>()); driftx ->reserve(size);
122 std::auto_ptr<std::vector<float> > drifty (
new std::vector<float>()); drifty ->reserve(size);
123 std::auto_ptr<std::vector<float> > driftz (
new std::vector<float>()); driftz ->reserve(size);
124 std::auto_ptr<std::vector<float> > globalZofunitlocalY (
new std::vector<float>()); globalZofunitlocalY->reserve(size);
134 size_t ontrk_cluster_idx=0;
135 std::map<size_t, std::vector<size_t> > mapping;
138 association != associations->end(); association++) {
139 const Trajectory* traj = association->key.get();
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;
232 iEvent.
put(onTrkClustersBegin,
Prefix +
"onTrkClustersBegin" +
Suffix );
267 iEvent.
put( globalZofunitlocalY,
Prefix +
"globalZofunitlocalY" +
Suffix );
ClusterRef cluster() const
tuple SiStripLorentzAngle
ConstRecHitPointer const & recHit() const
ShallowTrackClustersProducer(const edm::ParameterSet &)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
friend struct const_iterator
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
void produce(edm::Event &, const edm::EventSetup &)
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
virtual float strip(const LocalPoint &) const =0
Geom::Theta< T > theta() const
DataContainer const & measurements() const
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
ClusterRef cluster() const
const LocalTrajectoryError & localError() const
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_
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
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 PositionType & position() const
tuple size
Write out results.
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
GlobalVector globalDirection() const