48 theMinLayers = pset.
getParameter<
unsigned int>(
"minLayers");
51 cout <<
"[DTClusterer] Constructor called" << endl;
53 produces<DTRecClusterCollection>();
63 cout <<
"[DTClusterer] produce called" << endl;
70 event.getByToken(recHits1DToken_, allHits);
73 auto clusters = std::make_unique<DTRecClusterCollection>();
76 DTRecHitCollection::id_iterator dtLayerIt;
78 for (dtLayerIt = allHits->id_begin(); dtLayerIt != allHits->id_end(); ++dtLayerIt){
82 if (SLId==oldSlId)
continue;
85 if(
debug)
cout <<
"Reconstructing the clusters in "<< SLId << endl;
94 vector<DTRecHit1DPair> pairs(range.first,range.second);
95 if(
debug)
cout <<
"Number of 1D-RecHit pairs " << pairs.size() << endl;
96 vector<DTSLRecCluster> clus=buildClusters(sl, pairs);
97 if(
debug)
cout <<
"Number of clusters build " << clus.size() << endl;
99 clusters->put(sl->
id(), clus.begin(), clus.end());
105 vector<DTRecHit1DPair>& pairs) {
107 vector<pair<float, DTRecHit1DPair> >
hits = initHits(sl, pairs);
109 vector<DTSLRecCluster>
result;
111 vector<DTRecHit1DPair> adiacentPairs;
112 float lastPos=hits.front().first;
113 const float cellWidth=4.2;
117 for (vector<pair<float, DTRecHit1DPair> >::const_iterator
hit=hits.begin();
hit!=hits.end();
119 if(
debug)
cout <<
"Hit: " << (*hit).first <<
" lastPos: " << lastPos << endl;
122 if(
abs((*hit).first-lastPos)>cellWidth ) {
123 if (adiacentPairs.size() >= theMinHits && differentLayers(adiacentPairs)>=theMinLayers) {
125 float mean=sum/adiacentPairs.size();
126 float err2=sum2/adiacentPairs.size()-mean*
mean;
131 if(
debug)
cout <<
"Cluster " << cluster << endl;
132 result.push_back(cluster);
135 adiacentPairs.clear();
140 adiacentPairs.push_back((*hit).second);
141 if(
debug)
cout <<
"adiacentPairs " << adiacentPairs.size() << endl;
143 sum2+=(*hit).first*(*hit).first;
145 lastPos=(*hit).first;
148 if (adiacentPairs.size() >= theMinHits && differentLayers(adiacentPairs)>=theMinLayers) {
149 float mean=sum/adiacentPairs.size();
150 float err2=sum2/adiacentPairs.size()-mean*
mean;
155 if(
debug)
cout <<
"Cluster " << cluster << endl;
156 result.push_back(cluster);
163 vector<DTRecHit1DPair>& pairs) {
164 vector<pair<float, DTRecHit1DPair> >
result;
165 for (vector<DTRecHit1DPair>::const_iterator pair=pairs.begin();
166 pair!=pairs.end(); ++pair ) {
177 result.push_back(make_pair(posInSL.
x(), *pair));
189 for (vector<DTRecHit1DPair>::const_iterator
hit=hits.begin();
hit!=hits.end();
191 int pos = (1 << ((*hit).wireId().layer() -1 ));
192 if (! (pos & layers)) {
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
unsigned int differentLayers(std::vector< DTRecHit1DPair > &hits)
std::pair< const_iterator, const_iterator > range
iterator range
Point3DBase< Scalar, LocalTag > LocalPoint
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
static std::pair< DTLayerId, DTSuperLayerIdComparator > layersBySuperLayer(DTSuperLayerId slId)
Access by SL objects written into a RangeMap by layer.
void produce(edm::Event &event, const edm::EventSetup &setup) override
const DTLayer * layer(const DTLayerId &id) const
Return the layer corresponding to the given id.
def setup(process, global_tag, zero_tesla=False)
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
int layer() const
Return the layer number.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
DTSuperLayerId id() const
Return the DetId of this SL.
const DTTopology & specificTopology() const
Abs< T >::type abs(const T &t)
std::vector< DTSLRecCluster > buildClusters(const DTSuperLayer *sl, std::vector< DTRecHit1DPair > &pairs)
int wire() const
Return the wire number.
DTClusterer(const edm::ParameterSet &)
std::vector< std::pair< float, DTRecHit1DPair > > initHits(const DTSuperLayer *sl, std::vector< DTRecHit1DPair > &pairs)
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.