77 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;
416 hitSet =
hits.product();
424 std::vector<Trajectory> trajVec;
433 for (reco::TrackCollection::const_iterator itrack =
tracks->begin(); itrack <
tracks->end(); itrack++) {
435 if ((itrack->px() * itrack->px() + itrack->py() * itrack->py() + itrack->pz() * itrack->pz()) <
minTrackP2_)
438 std::vector<std::pair<uint32_t, std::pair<double, double> > > intersections;
444 uint32_t layerCode = (const_cast<SiStripEventSummary*>(
summary.product())->layerScanned()) >> 16;
446 if (((layerCode >> 6) & 0x3) == 0)
448 else if (((layerCode >> 6) & 0x3) == 1)
450 else if (((layerCode >> 6) & 0x3) == 2)
452 else if (((layerCode >> 6) & 0x3) == 3)
454 int32_t layerIdx = (layerCode & 0xF) * (((layerCode >> 4) & 0x3) ? -1 : 1);
460 LogDebug(
"produce") <<
" Found " << intersections.size() <<
" interesting intersections." << std::endl;
461 for (std::vector<std::pair<uint32_t, std::pair<double, double> > >::iterator it = intersections.begin();
462 it < intersections.end();
464 std::pair<const SiStripCluster*, double> candidateCluster =
466 if (candidateCluster.first) {
467 LogDebug(
"produce") <<
" Found a cluster." << std::endl;
471 LogDebug(
"produce") <<
" The cluster is close enough." << std::endl;
474 const auto& amplitudes = candidateCluster.first->amplitudes();
475 uint8_t leadingCharge = 0;
476 uint8_t leadingStrip = candidateCluster.first->firstStrip();
477 uint8_t leadingPosition = 0;
478 for (
auto amplit = amplitudes.begin(); amplit < amplitudes.end(); amplit++, leadingStrip++) {
479 if (leadingCharge < *amplit) {
480 leadingCharge = *amplit;
481 leadingPosition = leadingStrip;
486 std::vector<edm::DetSet<SiStripRawDigi> >::iterator newdsit =
output.begin();
490 if (newdsit ==
output.end()) {
493 newdsit =
output.end() - 1;
496 LogDebug(
"produce") <<
" New Hit... TOF:" << it->second.first <<
", charge: " <<
int(leadingCharge)
497 <<
" at " <<
int(leadingPosition) <<
"." << std::endl
498 <<
"Angular correction: " << it->second.second <<
" giving a final value of "
499 <<
int(leadingCharge * fabs(it->second.second))
500 <<
" for fed key = " <<
connectionMap_[it->first] <<
" (detid=" << it->first <<
")";
502 if (leadingCharge < 255) {
504 leadingCharge = uint8_t(leadingCharge * fabs(it->second.second));
506 if ((((it->first >> 25) & 0x7f) == 0xd) ||
507 ((((it->first >> 25) & 0x7f) == 0xe) && (((it->first >> 5) & 0x7) > 4)))
508 leadingCharge = uint8_t((leadingCharge * 0.64));
511 unsigned int tof =
abs(
int(round(it->second.first * 10)));
512 tof = tof > 255 ? 255 : tof;
514 newdsit->push_back(newSiStrip);
515 LogDebug(
"produce") <<
"New edm::DetSet<SiStripRawDigi> added.";
518 delete candidateCluster.first;
523 LogDebug(
"produce") <<
"Putting " <<
output.size() <<
" new hits in the event.";
535 std::vector<edm::DetSet<SiStripRawDigi> >
output;
541 uint32_t layerCode = (const_cast<SiStripEventSummary*>(
summary.product())->layerScanned()) >> 16;
543 if (((layerCode >> 6) & 0x3) == 0)
545 else if (((layerCode >> 6) & 0x3) == 1)
547 else if (((layerCode >> 6) & 0x3) == 2)
549 else if (((layerCode >> 6) & 0x3) == 3)
551 int32_t layerIdx = (layerCode & 0xF) * (((layerCode >> 4) & 0x3) ? -1 : 1);
560 if (
mode_ == 1 && ((DSViter->id() & mask.first) != mask.second))
569 auto const& amplitudes = iter->amplitudes();
570 uint8_t leadingCharge = 0;
571 uint8_t leadingStrip = iter->firstStrip();
572 uint8_t leadingPosition = 0;
573 for (
auto amplit = amplitudes.begin(); amplit < amplitudes.end(); amplit++, leadingStrip++) {
574 if (leadingCharge < *amplit) {
575 leadingCharge = *amplit;
576 leadingPosition = leadingStrip;
586 float noise = noiseHandle_->
getNoise(leadingPosition, detNoiseRange);
589 if (leadingCharge >= 250 ||
noise >= 8 || leadingCharge /
noise > 50 || leadingCharge /
noise < 10)
592 if (leadingCharge < 255) {
594 if ((((((DSViter->id()) >> 25) & 0x7f) == 0xd) || ((((DSViter->id()) >> 25) & 0x7f) == 0xe)) &&
595 ((((DSViter->id()) >> 5) & 0x7) > 4))
596 leadingCharge = uint8_t((leadingCharge * 0.64));
600 newds.push_back(newSiStrip);
604 LogDebug(
"produce") <<
"New edm::DetSet<SiStripRawDigi> added with fedkey = " << std::hex << std::setfill(
'0')
608 LogDebug(
"produce") <<
"Putting " <<
output.size() <<
" new hits in the event.";
621 for (std::vector<FedChannelConnection>::const_iterator
conn = connections.begin();
conn < connections.end();