34 typedef std::vector<std::shared_ptr<DTHitPairForFit>>
hitCont;
44 debug =
pset.getUntrackedParameter<
bool>(
"debug");
58 const std::vector<DTRecHit1DPair>& pairs) {
60 std::vector<std::shared_ptr<DTHitPairForFit>> hitsForFit =
initHits(sl, pairs);
70 cout <<
"Reconstructed 2D segments " << *segment << endl;
86 const std::vector<DTRecHit1DPair>&
hits) {
88 for (vector<DTRecHit1DPair>::const_iterator
hit =
hits.begin();
hit !=
hits.end(); ++
hit) {
96 vector<DTSegmentCand*>
result;
100 cout <<
"buildSegments: " << sl->
id() <<
" nHits " <<
hits.size() << endl;
102 cout << **
hit <<
" wire: " << (*hit)->
id() <<
" DigiTime: " << (*hit)->digiTime() << endl;
107 cout <<
"Warning: this SuperLayer " << sl->
id() <<
" has too many hits : " <<
hits.size() <<
" max allowed is "
109 cout <<
"Skipping segment reconstruction... " << endl;
116 if ((sl->
id()).superlayer() == 2)
123 for (hitCont::const_iterator firstHit =
hits.begin(); firstHit !=
hits.end(); ++firstHit) {
124 for (hitCont::const_reverse_iterator lastHit =
hits.rbegin(); (*lastHit) != (*firstHit); ++lastHit) {
131 for (hitCont::const_iterator tmpHit = firstHit + 1; (*tmpHit) != (*lastHit); tmpHit++)
133 hitsForFit.push_back(*tmpHit);
135 for (
int firstLR = 0; firstLR < 2; ++firstLR) {
136 for (
int lastLR = 0; lastLR < 2; ++lastLR) {
145 float DAlpha = fabs(gvec.
theta() - gvecIP.
theta());
146 if (DAlpha > DAlphaMax)
156 auto segCand = std::make_unique<DTSegmentCand>(pointSet, sl);
157 segCand->add(*firstHit, codes[firstLR]);
158 segCand->add(*lastHit, codes[lastLR]);
170 cout <<
"Result (before cleaning): " <<
result.size() << endl;
171 for (vector<DTSegmentCand*>::const_iterator seg =
result.begin(); seg !=
result.end(); ++seg)
172 cout << *(*seg) << endl;
178 cout <<
"Result (after cleaning): " <<
result.size() << endl;
179 for (vector<DTSegmentCand*>::const_iterator seg =
result.begin(); seg !=
result.end(); ++seg)
180 cout << *(*seg) << endl;
187 const vector<std::shared_ptr<DTHitPairForFit>>&
hits,
188 vector<DTSegmentCand*>&
result) {
189 double chi2l, chi2r, t0l, t0r;
190 bool foundSomething =
false;
193 cout <<
" DTMeantimerPatternReco::addHit " << endl
194 <<
" Picked " << segCand->
nHits() <<
" hits, " <<
hits.size() <<
" left." << endl;
211 chi2l = segCand->
chi2();
217 chi2r = segCand->
chi2();
223 cout <<
" Left: t0= " << t0l <<
" chi2/nHits= " << chi2l <<
"/" <<
nHits <<
" ok: " << left_ok << endl;
224 cout <<
" Right: t0= " << t0r <<
" chi2/nHits= " << chi2r <<
"/" <<
nHits <<
" ok: " << right_ok << endl;
227 if (!left_ok && !right_ok)
230 foundSomething =
true;
234 for (hitCont::const_iterator tmpHit =
hit + 1; tmpHit !=
hits.end(); tmpHit++)
236 hitsForFit.push_back(*tmpHit);
238 reverse(hitsForFit.begin(), hitsForFit.end());
241 if (segCand->
nHits() > 3 && left_ok && right_ok) {
242 if (chi2l < chi2r - 0.1)
244 else if (chi2r < chi2l - 0.1)
274 if (!segCand->
good()) {
282 cout << endl <<
" Seg t0= " << segCand->
t0() << endl << *segCand << endl;
287 cout <<
" Result is now " <<
result.size() << endl;
290 cout <<
" Exists - skipping" << endl;
297 const int layerLowerCut[4] = {0, -1, -2, -2};
298 const int layerUpperCut[4] = {0, 2, 2, 3};
303 if (
first.layerId().superlayerId().superLayer() !=
second.layerId().superlayerId().superLayer())
306 int deltaLayer =
abs(
first.layerId().layer() -
second.layerId().layer());
313 if (deltaLayer > 3) {
314 cout <<
"*** WARNING! DT Layer numbers differ by more than 3! for hits: " << endl;
322 if (
second.layerId().layer() % 2 == 0)
323 deltaWire = -deltaWire;
324 if ((deltaWire <= layerLowerCut[deltaLayer]) || (deltaWire >= layerUpperCut[deltaLayer]))
342 if (seg->
nHits() == 3)
346 if (seg->
t0() == 0) {
362 if (*(*
cand) == *seg)
364 if (((*cand)->nHits() >= seg->
nHits()) && ((*cand)->chi2ndof() < seg->
chi2ndof()))
365 if ((*cand)->nSharedHitPairs(*seg) >
int(seg->
nHits() - 2))
372 char mark[26] = {
". . . . . . . . . . . . "};
373 int wire[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
375 for (vector<DTSegmentCand::AssPoint>::const_iterator assHit = assHits.begin(); assHit != assHits.end(); ++assHit) {
377 (((*assHit).first)->
id().superlayerId().superLayer() - 1) * 4 + ((*assHit).first)->id().layerId().layer() - 1;
378 wire[lay] = ((*assHit).first)->
id().wire();
385 int lay = ((*hit).id().superlayerId().superLayer() - 1) * 4 + (*hit).id().layerId().layer() - 1;
386 wire[lay] = (*hit).id().wire();
390 for (
int i = 0;
i < 12;
i++)
392 cout << setw(2) << wire[
i];