38 debug =
pset.getUntrackedParameter<
bool>(
"debug");
41 string theHitAlgoName =
pset.getParameter<
string>(
"recAlgo");
42 usePairs = !(theHitAlgoName ==
"DTNoDriftAlgo");
53 const std::vector<DTRecHit1DPair>& pairs) {
55 vector<std::shared_ptr<DTHitPairForFit>> hitsForFit =
initHits(sl, pairs);
68 cout <<
"Reconstructed 2D segments " <<
result.back() << endl;
84 const std::vector<DTRecHit1DPair>&
hits) {
85 vector<std::shared_ptr<DTHitPairForFit>>
result;
86 for (vector<DTRecHit1DPair>::const_iterator
hit =
hits.begin();
hit !=
hits.end(); ++
hit) {
100 typedef vector<std::shared_ptr<DTHitPairForFit>>
hitCont;
101 typedef hitCont::const_iterator
hitIter;
102 vector<DTSegmentCand*>
result;
105 cout <<
"buildSegments: " << sl->
id() <<
" nHits " <<
hits.size() << endl;
115 cout <<
"Warning: this SuperLayer " << sl->
id() <<
" has too many hits : " <<
hits.size() <<
" max allowed is "
117 cout <<
"Skipping segment reconstruction... " << endl;
124 for (hitCont::const_iterator firstHit =
hits.begin(); firstHit !=
hits.end(); ++firstHit) {
125 for (hitCont::const_reverse_iterator lastHit =
hits.rbegin(); (*lastHit) != (*firstHit); ++lastHit) {
128 if (fabs((*lastHit)->id().layerId() - (*firstHit)->id().layerId()) <= 1)
131 cout <<
"Selected these two hits pair " << endl;
132 cout <<
"First " << *(*firstHit) <<
" Layer Id: " << (*firstHit)->id().layerId() << endl;
133 cout <<
"Last " << *(*lastHit) <<
" Layer Id: " << (*lastHit)->id().layerId() << endl;
138 if ((sl->
id()).superlayer() == 2)
144 for (
int firstLR = 0; firstLR < 2; ++firstLR) {
145 for (
int lastLR = 0; lastLR < 2; ++lastLR) {
155 float DAlpha = fabs(gvec.
theta() - gvecIP.
theta());
158 if (DAlpha < DAlphaMax) {
161 LocalPoint posIni = (*firstHit)->localPosition(codes[firstLR]);
162 LocalVector dirIni = ((*lastHit)->localPosition(codes[lastLR]) - posIni).
unit();
167 cout <<
"compatible hits " << assHits.size() << endl;
175 cout <<
"segment " << *seg << endl;
187 cout <<
"result is now " <<
result.size() << endl;
191 cout <<
"already existing" << endl;
201 for (vector<DTSegmentCand*>::const_iterator seg =
result.begin(); seg !=
result.end(); ++seg)
202 cout << *(*seg) << endl;
208 cout <<
"result no ghost " <<
result.size() << endl;
209 for (vector<DTSegmentCand*>::const_iterator seg =
result.begin(); seg !=
result.end(); ++seg)
210 cout << *(*seg) << endl;
219 cout <<
"Pos: " << posIni <<
" Dir: " << dirIni << endl;
220 vector<DTSegmentCand::AssPoint>
result;
224 int nCompatibleHits = 0;
226 typedef vector<std::shared_ptr<DTHitPairForFit>>
hitCont;
227 typedef hitCont::const_iterator
hitIter;
229 pair<bool, bool> isCompatible = (*hit)->isCompatible(posIni, dirIni);
231 cout <<
"isCompatible " << isCompatible.first <<
" " << isCompatible.second << endl;
237 if (isCompatible.first && isCompatible.second) {
241 }
else if (isCompatible.first) {
245 }
else if (isCompatible.second) {
259 if (nCompatibleHits < 3) {
261 cout <<
"Less than 3 hits ";
272 cout <<
"NOT Already tried ";
278 cout <<
"Already tried ";
291 if (
hits.size() < 3) {
297 vector<DTSegmentCand::AssPoint>
points;
301 deque<std::shared_ptr<DTHitPairForFit>> pointsNoLR;
304 for (vector<DTSegmentCand::AssPoint>::const_iterator
hit =
hits.begin();
hit !=
hits.end(); ++
hit) {
308 pointsNoLR.push_back((*hit).first);
314 cout <<
"pointsNoLR " << pointsNoLR.size() << endl;
327 vector<DTSegmentCand*>::const_iterator bestCandIter =
candidates.end();
329 unsigned int maxNumHits = 0;
330 for (vector<DTSegmentCand*>::const_iterator iter =
candidates.begin(); iter !=
candidates.end(); ++iter) {
331 if ((*iter)->nHits() == maxNumHits && (*iter)->chi2() <
minChi2) {
334 }
else if ((*iter)->nHits() > maxNumHits) {
335 maxNumHits = (*iter)->nHits();
342 for (vector<DTSegmentCand*>::iterator iter =
candidates.begin(); iter !=
candidates.end(); ++iter)
343 if (iter != bestCandIter)
348 return (*bestCandIter);
354 deque<std::shared_ptr<DTHitPairForFit>>& pointsNoLR,
358 cout <<
"buildPointsCollection " << endl;
359 cout <<
"points: " <<
points.size() <<
" NOLR: " << pointsNoLR.size() << endl;
361 if (!pointsNoLR.empty()) {
362 std::shared_ptr<DTHitPairForFit> unassHit = pointsNoLR.front();
365 cout <<
"Right hit" << endl;
367 pointsNoLR.pop_front();
369 pointsNoLR.push_front((unassHit));
374 cout <<
"Left hit" << endl;
376 pointsNoLR.pop_front();
378 pointsNoLR.push_front((unassHit));
383 cout <<
"The Hits were" << endl;
385 cout <<
"----" << endl;
386 cout <<
"All associated " << endl;
395 cout <<
"The Hits are" << endl;
396 copy(pointsSet.begin(), pointsSet.end(), ostream_iterator<DTSegmentCand::AssPoint>(
std::cout));
397 cout <<
"----" << endl;
410 if (*(*
cand) == *seg)