72 produces<edm::DetSetVector<SiStripRawDigi> >(
"FineDelaySelection");
116 const int substructure,
118 uint32_t rootDetId = 0;
119 uint32_t maskDetId = 0;
123 rootDetId = tkrTopo->
tibDetId(substructure, 0, 0, 0, 0, 0).
rawId();
128 rootDetId = tkrTopo->
tidDetId(substructure > 0 ? 2 : 1,
abs(substructure), 0, 0, 0, 0).
rawId();
133 rootDetId = tkrTopo->
tobDetId(substructure, 0, 0, 0, 0).
rawId();
138 rootDetId = tkrTopo->
tecDetId(substructure > 0 ? 2 : 1,
abs(substructure), 0, 0, 0, 0, 0).
rawId();
145 return std::make_pair(maskDetId, rootDetId);
152 const std::vector<Trajectory>& trajVec,
154 const int substructure) {
155 if (substructure == 0xff)
160 return detId(
tracker, tkrTopo, tk, trajVec, mask.first, mask.second);
167 const std::vector<Trajectory>& trajVec,
168 const uint32_t& maskDetId,
169 const uint32_t& rootDetId) {
170 bool onDisk = ((maskDetId == tkrTopo->
tidDetId(3, 15, 0, 0, 0, 0).
rawId()) ||
171 (maskDetId == tkrTopo->
tecDetId(3, 15, 0, 0, 0, 0, 0).
rawId()));
172 std::vector<std::pair<uint32_t, std::pair<double, double> > >
result;
173 std::vector<uint32_t> usedDetids;
175 std::vector<std::pair<std::pair<DetId, LocalPoint>,
float> > hitangle;
179 for (std::vector<Trajectory>::const_iterator traj = trajVec.begin(); traj < trajVec.end(); ++traj) {
180 if (((traj->lastMeasurement().recHit()->geographicalId().rawId() ==
181 (*(tk->
recHitsEnd() - 1))->geographicalId().rawId()) &&
182 (traj->lastMeasurement().recHit()->localPosition().x() == (*(tk->
recHitsEnd() - 1))->localPosition().x())) ||
183 ((traj->firstMeasurement().recHit()->geographicalId().rawId() ==
184 (*(tk->
recHitsEnd() - 1))->geographicalId().rawId()) &&
185 (traj->firstMeasurement().recHit()->localPosition().x() == (*(tk->
recHitsEnd() - 1))->localPosition().x()))) {
197 LogDebug(
"DetId") <<
"number of hits for the track: " << hitangle.size();
198 std::vector<std::pair<std::pair<DetId, LocalPoint>,
float> >::iterator iter;
200 for (iter = hitangle.begin(); iter != hitangle.end(); iter++) {
205 LogDebug(
"DetId") <<
"check the detid: " << std::hex << (iter->first.first.rawId()) <<
" vs " << rootDetId
206 <<
" with a mask of " << maskDetId <<
std::dec << std::endl;
208 if (((iter->first.first.rawId() & maskDetId) != rootDetId))
210 if (
std::find(usedDetids.begin(), usedDetids.end(), iter->first.first.rawId()) != usedDetids.end())
213 LogDebug(
"DetId") <<
"check the angle: " << fabs((iter->second));
217 std::pair<uint32_t, std::pair<double, double> > el;
218 std::pair<double, double> subel;
219 el.first = iter->first.first.rawId();
224 double trackParameters[5];
225 for (
int i = 0;
i < 5;
i++)
240 subel.second = iter->second;
244 usedDetids.push_back(el.first);
251 if ((*it)->geographicalId().rawId() == det_id) {
252 return (*it)->isValid();
263 const uint32_t& det_id,
266 std::pair<const SiStripCluster*, double>
result(
nullptr, 0.);
267 double hitStrip = -1;
271 LogDebug(
"closestCluster") <<
"(*it)->geographicalId().rawId() vs det_id" << (*it)->geographicalId().rawId() <<
" "
274 if ((*it)->geographicalId().rawId() == det_id) {
275 if (!(*it)->isValid())
277 LogDebug(
"closestCluster") <<
" using the single mono hit";
279 const GeomDetUnit* gdu = static_cast<const GeomDetUnit*>(
tracker.idToDet((*it)->geographicalId()));
282 nstrips = (dynamic_cast<const StripTopology*>(&(gdu->
topology())))->nstrips();
320 LogDebug(
"closestCluster") <<
" hit strip = " << hitStrip;
326 if (DSViter->id == det_id) {
329 minStrip = minStrip < 0 ? 0 : minStrip;
331 maxStrip = maxStrip >= nstrips ? nstrips - 1 : maxStrip;
335 if (digiIt->strip() >= minStrip && rangeStart == DSViter->
end())
337 if (digiIt->strip() <= maxStrip)
340 if (rangeStart != DSViter->
end()) {
341 if (rangeStop != DSViter->
end())
344 LogDebug(
"closestCluster") <<
"build a fake cluster ";
347 result.first = newCluster;
357 if (DSViter->id() == det_id) {
358 LogDebug(
"closestCluster") <<
" detset with the right detid. ";
364 double dist = fabs(iter->barycenter() - hitStrip);
365 if (dist <
result.second) {
398 std::vector<edm::DetSet<SiStripRawDigi> >
output;
415 hitSet =
hits.product();
423 std::vector<Trajectory> trajVec;
431 for (reco::TrackCollection::const_iterator itrack =
tracks->begin(); itrack <
tracks->end(); itrack++) {
433 if ((itrack->px() * itrack->px() + itrack->py() * itrack->py() + itrack->pz() * itrack->pz()) <
minTrackP2_)
436 std::vector<std::pair<uint32_t, std::pair<double, double> > > intersections;
442 uint32_t layerCode = (const_cast<SiStripEventSummary*>(
summary.product())->layerScanned()) >> 16;
444 if (((layerCode >> 6) & 0x3) == 0)
446 else if (((layerCode >> 6) & 0x3) == 1)
448 else if (((layerCode >> 6) & 0x3) == 2)
450 else if (((layerCode >> 6) & 0x3) == 3)
452 int32_t layerIdx = (layerCode & 0xF) * (((layerCode >> 4) & 0x3) ? -1 : 1);
453 intersections =
detId(
tracker, tTopo, &(*itrack), trajVec, subdet, layerIdx);
456 intersections =
detId(
tracker, tTopo, &(*itrack), trajVec);
458 LogDebug(
"produce") <<
" Found " << intersections.size() <<
" interesting intersections." << std::endl;
459 for (
std::vector<std::pair<uint32_t, std::pair<double, double> > >::iterator it = intersections.begin();
460 it < intersections.end();
462 std::pair<const SiStripCluster*, double> candidateCluster =
464 if (candidateCluster.first) {
465 LogDebug(
"produce") <<
" Found a cluster." << std::endl;
469 LogDebug(
"produce") <<
" The cluster is close enough." << std::endl;
472 const auto& amplitudes = candidateCluster.first->amplitudes();
473 uint8_t leadingCharge = 0;
474 uint8_t leadingStrip = candidateCluster.first->firstStrip();
475 uint8_t leadingPosition = 0;
476 for (
auto amplit = amplitudes.begin(); amplit < amplitudes.end(); amplit++, leadingStrip++) {
477 if (leadingCharge < *amplit) {
478 leadingCharge = *amplit;
479 leadingPosition = leadingStrip;
484 std::vector<edm::DetSet<SiStripRawDigi> >::iterator newdsit =
output.begin();
488 if (newdsit ==
output.end()) {
491 newdsit =
output.end() - 1;
494 LogDebug(
"produce") <<
" New Hit... TOF:" << it->second.first <<
", charge: " <<
int(leadingCharge)
495 <<
" at " <<
int(leadingPosition) <<
"." << std::endl
496 <<
"Angular correction: " << it->second.second <<
" giving a final value of "
497 <<
int(leadingCharge * fabs(it->second.second))
498 <<
" for fed key = " <<
connectionMap_[it->first] <<
" (detid=" << it->first <<
")";
500 if (leadingCharge < 255) {
502 leadingCharge = uint8_t(leadingCharge * fabs(it->second.second));
504 if ((((it->first >> 25) & 0x7f) == 0xd) ||
505 ((((it->first >> 25) & 0x7f) == 0xe) && (((it->first >> 5) & 0x7) > 4)))
506 leadingCharge = uint8_t((leadingCharge * 0.64));
509 unsigned int tof =
abs(
int(round(it->second.first * 10)));
510 tof = tof > 255 ? 255 : tof;
512 newdsit->push_back(newSiStrip);
513 LogDebug(
"produce") <<
"New edm::DetSet<SiStripRawDigi> added.";
516 delete candidateCluster.first;
521 LogDebug(
"produce") <<
"Putting " <<
output.size() <<
" new hits in the event.";
532 std::vector<edm::DetSet<SiStripRawDigi> >
output;
538 uint32_t layerCode = (const_cast<SiStripEventSummary*>(
summary.product())->layerScanned()) >> 16;
540 if (((layerCode >> 6) & 0x3) == 0)
542 else if (((layerCode >> 6) & 0x3) == 1)
544 else if (((layerCode >> 6) & 0x3) == 2)
546 else if (((layerCode >> 6) & 0x3) == 3)
548 int32_t layerIdx = (layerCode & 0xF) * (((layerCode >> 4) & 0x3) ? -1 : 1);
557 if (
mode_ == 1 && ((DSViter->id() & mask.first) != mask.second))
566 auto const& amplitudes = iter->amplitudes();
567 uint8_t leadingCharge = 0;
568 uint8_t leadingStrip = iter->firstStrip();
569 uint8_t leadingPosition = 0;
570 for (
auto amplit = amplitudes.begin(); amplit < amplitudes.end(); amplit++, leadingStrip++) {
571 if (leadingCharge < *amplit) {
572 leadingCharge = *amplit;
573 leadingPosition = leadingStrip;
582 float noise =
noises.getNoise(leadingPosition, detNoiseRange);
585 if (leadingCharge >= 250 ||
noise >= 8 || leadingCharge /
noise > 50 || leadingCharge /
noise < 10)
588 if (leadingCharge < 255) {
590 if ((((((DSViter->id()) >> 25) & 0x7f) == 0xd) || ((((DSViter->id()) >> 25) & 0x7f) == 0xe)) &&
591 ((((DSViter->id()) >> 5) & 0x7) > 4))
592 leadingCharge = uint8_t((leadingCharge * 0.64));
596 newds.push_back(newSiStrip);
600 LogDebug(
"produce") <<
"New edm::DetSet<SiStripRawDigi> added with fedkey = " << std::hex << std::setfill(
'0')
604 LogDebug(
"produce") <<
"Putting " <<
output.size() <<
" new hits in the event.";
613 auto feds = cabling.fedIds();
615 auto connections = cabling.fedConnections(*
fedid);
616 for (std::vector<FedChannelConnection>::const_iterator
conn = connections.begin();
conn < connections.end();