67 produces<edm::DetSetVector<SiStripRawDigi> >(
"FineDelaySelection");
111 const int substructure,
113 uint32_t rootDetId = 0;
114 uint32_t maskDetId = 0;
118 rootDetId = tkrTopo->
tibDetId(substructure, 0, 0, 0, 0, 0).
rawId();
123 rootDetId = tkrTopo->
tidDetId(substructure > 0 ? 2 : 1,
abs(substructure), 0, 0, 0, 0).
rawId();
128 rootDetId = tkrTopo->
tobDetId(substructure, 0, 0, 0, 0).
rawId();
133 rootDetId = tkrTopo->
tecDetId(substructure > 0 ? 2 : 1,
abs(substructure), 0, 0, 0, 0, 0).
rawId();
140 return std::make_pair(maskDetId, rootDetId);
147 const std::vector<Trajectory>& trajVec,
149 const int substructure) {
150 if (substructure == 0xff)
162 const std::vector<Trajectory>& trajVec,
163 const uint32_t& maskDetId,
164 const uint32_t& rootDetId) {
165 bool onDisk = ((maskDetId == tkrTopo->
tidDetId(3, 15, 0, 0, 0, 0).
rawId()) ||
166 (maskDetId == tkrTopo->
tecDetId(3, 15, 0, 0, 0, 0, 0).
rawId()));
167 std::vector<std::pair<uint32_t, std::pair<double, double> > >
result;
168 std::vector<uint32_t> usedDetids;
170 std::vector<std::pair<std::pair<DetId, LocalPoint>,
float> > hitangle;
174 for (std::vector<Trajectory>::const_iterator traj = trajVec.begin(); traj < trajVec.end(); ++traj) {
175 if (((traj->lastMeasurement().recHit()->geographicalId().rawId() ==
176 (*(tk->
recHitsEnd() - 1))->geographicalId().rawId()) &&
177 (traj->lastMeasurement().recHit()->localPosition().x() == (*(tk->
recHitsEnd() - 1))->localPosition().x())) ||
178 ((traj->firstMeasurement().recHit()->geographicalId().rawId() ==
179 (*(tk->
recHitsEnd() - 1))->geographicalId().rawId()) &&
180 (traj->firstMeasurement().recHit()->localPosition().x() == (*(tk->
recHitsEnd() - 1))->localPosition().x()))) {
192 LogDebug(
"DetId") <<
"number of hits for the track: " << hitangle.size();
193 std::vector<std::pair<std::pair<DetId, LocalPoint>,
float> >::iterator iter;
195 for (iter = hitangle.begin(); iter != hitangle.end(); iter++) {
200 LogDebug(
"DetId") <<
"check the detid: " << std::hex << (iter->first.first.rawId()) <<
" vs " << rootDetId
201 <<
" with a mask of " << maskDetId <<
std::dec << std::endl;
203 if (((iter->first.first.rawId() & maskDetId) != rootDetId))
205 if (
std::find(usedDetids.begin(), usedDetids.end(), iter->first.first.rawId()) != usedDetids.end())
208 LogDebug(
"DetId") <<
"check the angle: " << fabs((iter->second));
212 std::pair<uint32_t, std::pair<double, double> > el;
213 std::pair<double, double> subel;
214 el.first = iter->first.first.rawId();
219 double trackParameters[5];
220 for (
int i = 0;
i < 5;
i++)
235 subel.second = iter->second;
239 usedDetids.push_back(el.first);
246 if ((*it)->geographicalId().rawId() == det_id) {
247 return (*it)->isValid();
258 const uint32_t& det_id,
261 std::pair<const SiStripCluster*, double>
result(
nullptr, 0.);
262 double hitStrip = -1;
266 LogDebug(
"closestCluster") <<
"(*it)->geographicalId().rawId() vs det_id" << (*it)->geographicalId().rawId() <<
" " 269 if ((*it)->geographicalId().rawId() == det_id) {
270 if (!(*it)->isValid())
272 LogDebug(
"closestCluster") <<
" using the single mono hit";
315 LogDebug(
"closestCluster") <<
" hit strip = " << hitStrip;
321 if (DSViter->id == det_id) {
324 minStrip = minStrip < 0 ? 0 : minStrip;
326 maxStrip = maxStrip >= nstrips ? nstrips - 1 : maxStrip;
330 if (digiIt->strip() >= minStrip && rangeStart == DSViter->
end())
332 if (digiIt->strip() <= maxStrip)
335 if (rangeStart != DSViter->
end()) {
336 if (rangeStop != DSViter->
end())
339 LogDebug(
"closestCluster") <<
"build a fake cluster ";
342 result.first = newCluster;
352 if (DSViter->id() == det_id) {
353 LogDebug(
"closestCluster") <<
" detset with the right detid. ";
359 double dist = fabs(iter->barycenter() - hitStrip);
360 if (dist <
result.second) {
393 std::vector<edm::DetSet<SiStripRawDigi> >
output;
410 hitSet =
hits.product();
418 std::vector<Trajectory> trajVec;
426 for (reco::TrackCollection::const_iterator itrack =
tracks->begin(); itrack <
tracks->end(); itrack++) {
428 if ((itrack->px() * itrack->px() + itrack->py() * itrack->py() + itrack->pz() * itrack->pz()) <
minTrackP2_)
431 std::vector<std::pair<uint32_t, std::pair<double, double> > > intersections;
439 if (((layerCode >> 6) & 0x3) == 0)
441 else if (((layerCode >> 6) & 0x3) == 1)
443 else if (((layerCode >> 6) & 0x3) == 2)
445 else if (((layerCode >> 6) & 0x3) == 3)
447 int32_t layerIdx = (layerCode & 0xF) * (((layerCode >> 4) & 0x3) ? -1 : 1);
448 intersections =
detId(
tracker, tTopo, &(*itrack), trajVec, subdet, layerIdx);
451 intersections =
detId(
tracker, tTopo, &(*itrack), trajVec);
453 LogDebug(
"produce") <<
" Found " << intersections.size() <<
" interesting intersections." << std::endl;
454 for (
std::vector<std::pair<uint32_t, std::pair<double, double> > >::iterator
it = intersections.begin();
455 it < intersections.end();
457 std::pair<const SiStripCluster*, double> candidateCluster =
459 if (candidateCluster.first) {
460 LogDebug(
"produce") <<
" Found a cluster." << std::endl;
464 LogDebug(
"produce") <<
" The cluster is close enough." << std::endl;
467 const auto& amplitudes = candidateCluster.first->amplitudes();
468 uint8_t leadingCharge = 0;
469 uint8_t leadingStrip = candidateCluster.first->firstStrip();
470 uint8_t leadingPosition = 0;
471 for (
auto amplit = amplitudes.begin(); amplit < amplitudes.end(); amplit++, leadingStrip++) {
472 if (leadingCharge < *amplit) {
473 leadingCharge = *amplit;
474 leadingPosition = leadingStrip;
479 std::vector<edm::DetSet<SiStripRawDigi> >::iterator newdsit =
output.begin();
483 if (newdsit ==
output.end()) {
486 newdsit =
output.end() - 1;
489 LogDebug(
"produce") <<
" New Hit... TOF:" <<
it->second.first <<
", charge: " <<
int(leadingCharge)
490 <<
" at " <<
int(leadingPosition) <<
"." << std::endl
491 <<
"Angular correction: " <<
it->second.second <<
" giving a final value of " 492 <<
int(leadingCharge * fabs(
it->second.second))
495 if (leadingCharge < 255) {
497 leadingCharge = uint8_t(leadingCharge * fabs(
it->second.second));
499 if ((((
it->first >> 25) & 0x7f) == 0xd) ||
500 ((((
it->first >> 25) & 0x7f) == 0xe) && (((
it->first >> 5) & 0x7) > 4)))
501 leadingCharge = uint8_t((leadingCharge * 0.64));
504 unsigned int tof =
abs(
int(round(
it->second.first * 10)));
505 tof = tof > 255 ? 255 : tof;
507 newdsit->push_back(newSiStrip);
508 LogDebug(
"produce") <<
"New edm::DetSet<SiStripRawDigi> added.";
511 delete candidateCluster.first;
516 LogDebug(
"produce") <<
"Putting " <<
output.size() <<
" new hits in the event.";
527 std::vector<edm::DetSet<SiStripRawDigi> >
output;
535 if (((layerCode >> 6) & 0x3) == 0)
537 else if (((layerCode >> 6) & 0x3) == 1)
539 else if (((layerCode >> 6) & 0x3) == 2)
541 else if (((layerCode >> 6) & 0x3) == 3)
543 int32_t layerIdx = (layerCode & 0xF) * (((layerCode >> 4) & 0x3) ? -1 : 1);
552 if (
mode_ == 1 && ((DSViter->id() &
mask.first) !=
mask.second))
561 auto const& amplitudes = iter->amplitudes();
562 uint8_t leadingCharge = 0;
563 uint8_t leadingStrip = iter->firstStrip();
564 uint8_t leadingPosition = 0;
565 for (
auto amplit = amplitudes.begin(); amplit < amplitudes.end(); amplit++, leadingStrip++) {
566 if (leadingCharge < *amplit) {
567 leadingCharge = *amplit;
568 leadingPosition = leadingStrip;
577 float noise =
noises.getNoise(leadingPosition, detNoiseRange);
580 if (leadingCharge >= 250 ||
noise >= 8 || leadingCharge /
noise > 50 || leadingCharge /
noise < 10)
583 if (leadingCharge < 255) {
585 if ((((((DSViter->id()) >> 25) & 0x7f) == 0xd) || ((((DSViter->id()) >> 25) & 0x7f) == 0xe)) &&
586 ((((DSViter->id()) >> 5) & 0x7) > 4))
587 leadingCharge = uint8_t((leadingCharge * 0.64));
591 newds.push_back(newSiStrip);
595 LogDebug(
"produce") <<
"New edm::DetSet<SiStripRawDigi> added with fedkey = " << std::hex << std::setfill(
'0')
599 LogDebug(
"produce") <<
"Putting " <<
output.size() <<
" new hits in the event.";
608 auto feds = cabling.fedIds();
static constexpr auto TEC
virtual void produceNoTracking(edm::Event &, const edm::EventSetup &)
T getParameter(std::string const &) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
DetId tibDetId(uint32_t layer, uint32_t str_fw_bw, uint32_t str_int_ext, uint32_t str, uint32_t module, uint32_t ster) const
virtual const Topology & topology() const
std::pair< SiStripDigiIter, SiStripDigiIter > SiStripDigiRange
edm::EDGetTokenT< SiStripEventSummary > inputModuleToken_
std::vector< Track > TrackCollection
collection of Tracks
void init(const edm::Event &e, const edm::EventSetup &c)
const sistrip::RunType & runType() const
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
DetId tobDetId(uint32_t layer, uint32_t rod_fw_bw, uint32_t rod, uint32_t module, uint32_t ster) const
Constants and enumerated type for sistrip::RunType.
data_type const * const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< std::pair< uint32_t, std::pair< double, double > > > detId(const TrackerGeometry &tracker, const TrackerTopology *tkrTopo, const reco::Track *tk, const std::vector< Trajectory > &trajVec, const StripSubdetector::SubDetector subdet=StripSubdetector::TIB, const int substructure=0xff)
DetId tidDetId(uint32_t side, uint32_t wheel, uint32_t ring, uint32_t module_fw_bw, uint32_t module, uint32_t ster) const
std::vector< std::pair< std::pair< DetId, LocalPoint >, float > > findtrackangle(const std::vector< Trajectory > &traj)
SiStripFineDelayHit(const edm::ParameterSet &)
std::pair< const SiStripCluster *, double > closestCluster(const TrackerGeometry &tracker, const reco::Track *tk, const uint32_t &detId, const edmNew::DetSetVector< SiStripCluster > &clusters, const edm::DetSetVector< SiStripDigi > &hits)
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
~SiStripFineDelayHit() override
static double timeOfFlight(bool cosmics, bool field, double *trackParameters, double *hit, double *phit, bool onDisk)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
SiStripFineDelayTLA * anglefinder_
Cos< T >::type cos(const T &t)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clustersToken_
Abs< T >::type abs(const T &t)
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
static void trackParameters(const reco::Track &tk, double *trackParameters)
static constexpr auto TOB
DeviceMask deviceMask(const StripSubdetector::SubDetector subdet, const int substructure, const TrackerTopology *tkrTopo)
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
edm::EDGetTokenT< TrajectorySeedCollection > seedcollToken_
static constexpr auto TIB
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > digiToken_
constexpr uint32_t rawId() const
get the raw id
std::pair< uint32_t, uint32_t > DeviceMask
static const uint16_t invalid_
bool rechit(reco::Track *tk, uint32_t detId)
std::map< uint32_t, uint32_t > connectionMap_
const Vector & momentum() const
track momentum vector
void beginRun(const edm::Run &, const edm::EventSetup &) override
const edm::Event * event_
void produce(edm::Event &, const edm::EventSetup &) override
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
std::vector< Trajectory > TrajectoryCollection
edm::EDGetTokenT< std::vector< Trajectory > > trackToken_
ParameterVector parameters() const
Track parameters with one-to-one correspondence to the covariance matrix.
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
std::pair< ContainerIterator, ContainerIterator > Range
collection_type::const_iterator const_iterator
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
collection_type::const_iterator const_iterator
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
static constexpr auto TID
DetId tecDetId(uint32_t side, uint32_t wheel, uint32_t petal_fw_bw, uint32_t petal, uint32_t ring, uint32_t module, uint32_t ster) const
double maxClusterDistance_