25 std::cout << x << std::endl; \
36 theHitThreshold(conf.getParameter<double>(
"HitThreshold")),
37 theSeedThreshold(conf.getParameter<double>(
"SeedThreshold")),
38 theClusterThreshold(conf.getParameter<double>(
"ClusterThreshold")),
39 theTimeThreshold(conf.getParameter<double>(
"TimeThreshold")),
40 thePositionThreshold(conf.getParameter<double>(
"PositionThreshold")),
44 theBuffer(theNumOfRows, theNumOfCols),
45 bufferAlreadySet(
false) {}
51 desc.
add<
double>(
"HitThreshold", 0.);
52 desc.
add<
double>(
"SeedThreshold", 0.);
53 desc.
add<
double>(
"ClusterThreshold", 0.);
54 desc.
add<
double>(
"TimeThreshold", 10.);
55 desc.
add<
double>(
"PositionThreshold", -1.0);
65 const auto& thedet = geom->
idToDet(
id);
66 if (thedet ==
nullptr) {
68 <<
"GeographicalID: " << std::hex <<
id.rawId() <<
" is invalid!" <<
std::dec << std::endl;
75 unsigned int nrows = topol.
nrows();
76 unsigned int ncols = topol.
ncolumns();
107 edm::LogInfo(
"MTDThresholdClusterizer") <<
"No hits to clusterize";
111 DEBUG(
"Input collection " << input.
size());
114 std::set<unsigned> geoIds;
115 std::multimap<unsigned, unsigned> geoIdToIdx;
118 for (
const auto&
hit : input) {
122 <<
"MTDDetId: " << std::hex << mtdId.
rawId() <<
" is invalid!" <<
std::dec << std::endl;
129 geoIdToIdx.emplace(geoId, index);
130 geoIds.emplace(geoId);
134 DetId geoId = hitId.geographicalId();
135 geoIdToIdx.emplace(geoId, index);
136 geoIds.emplace(geoId);
140 <<
"MTDDetId: " << std::hex << mtdId.
rawId() <<
" is invalid!" <<
std::dec << std::endl;
145 for (
unsigned id : geoIds) {
150 auto range = geoIdToIdx.equal_range(
id);
151 DEBUG(
"Matching Ids for " << std::hex <<
id <<
std::dec <<
" [" <<
range.first->second <<
","
152 <<
range.second->second <<
"]");
156 for (
auto itr =
range.first; itr !=
range.second; ++itr) {
157 const unsigned hitidx = itr->second;
163 for (
unsigned int i = 0;
i <
theSeeds.size();
i++) {
170 DEBUG(
"putting in this cluster " << i <<
" #hits:" << cluster.
size() <<
" E:" << cluster.
energy()
171 <<
" T:" << cluster.
time() <<
" X:" << cluster.
x() <<
" Y:" << cluster.
y());
180 for (
auto itr =
range.first; itr !=
range.second; ++itr) {
181 const unsigned hitidx = itr->second;
201 int row = itr->row();
202 int col = itr->column();
204 float energy = itr->energy();
205 float time = itr->time();
206 float timeError = itr->timeError();
215 const auto& det = geom->
idToDet(geoId);
220 LocalPoint lp(lp_ctr.
x() + position + topol.
pitch().first * 0.5f, lp_ctr.
y(), lp_ctr.
z());
223 global_point = det->toGlobal(lp);
229 DetId geoId =
id.geographicalId();
230 const auto& det = geom->
idToDet(geoId);
236 global_point = det->toGlobal(lp);
239 DEBUG(
"ROW " << row <<
" COL " << col <<
" ENERGY " << energy <<
" TIME " << time);
241 theBuffer.
set(row, col, subDet, energy, time, timeError, local_error, global_point);
264 acluster.
add(hit, seed_energy, seed_time, seed_time_error);
266 bool stopClus =
false;
268 while (!acluster.
empty() && !stopClus) {
270 auto curInd = acluster.
top();
272 for (
auto c =
std::max(0,
int(acluster.
y[curInd] - 1));
275 for (
auto r =
std::max(0,
int(acluster.
x[curInd] - 1));
289 (hit_error_xx + seed_error_xx + hit_error_yy + seed_error_yy))
307 acluster.
time.data(),
float time_error(uint row, uint col) const
void clusterize(const FTLRecHitCollection &input, const MTDGeometry *geom, const MTDTopology *topo, FTLClusterCollection &output) override
Cluster hits. This method operates on a matrix of hits and finds the largest contiguous cluster aroun...
GeomDetEnumerators::Location subDet(uint row, uint col) const
Use subDet to identify whether the Hit is in BTL or ETL.
void push_back(data_type const &d)
const edm::EventSetup & c
uint16_t *__restrict__ id
static void fillPSetDescription(edm::ParameterSetDescription &desc)
~MTDThresholdClusterizer() override
FTLRecHitCollection::const_iterator RecHitIterator
int getMTDTopologyMode() const
constexpr uint32_t rawId() const
get the raw id
std::vector< T >::const_iterator const_iterator
const float thePositionThreshold
const float theClusterThreshold
const float theHitThreshold
Clustering-related quantities:
int theNumOfRows
Geometry-related information.
MTDThresholdClusterizer(edm::ParameterSet const &conf)
Constructor:
bool add(FTLCluster::FTLHitPos const &p, float const ienergy, float const itime, float const itimeError)
LocalError local_error(uint row, uint col) const
Detector identifier base class for the MIP Timing Layer.
static std::string const input
const uint16_t range(const Frame &aFrame)
void copy_to_buffer(RecHitIterator itr, const MTDGeometry *geom, const MTDTopology *topo)
Copy FTLRecHit into the buffer, identify seeds.
float time(uint row, uint col) const
bool setup(const MTDGeometry *geometry, const MTDTopology *topo, const DetId &id)
std::array< float, MAXSIZE > timeError
int ncolumns() const override
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
virtual const PixelTopology & specificTopology() const
constexpr int row() const
float energy(uint row, uint col) const
const MTDGeomDet * idToDet(DetId) const override
LocalError localError() const
Abs< T >::type abs(const T &t)
int nrows() const override
std::vector< FTLCluster::FTLHitPos > theSeeds
ParameterDescriptionBase * add(U const &iLabel, T const &value)
GlobalPoint global_point(uint row, uint col) const
std::array< UShort, MAXSIZE > x
std::array< float, MAXSIZE > time
const_iterator end() const
Log< level::Info, false > LogInfo
const float theTimeThreshold
std::pair< float, float > pitch() const override
MTDArrayBuffer theBuffer
Data storage.
SubDetector subDetector() const
FTLCluster make_cluster(const FTLCluster::FTLHitPos &hit)
The actual clustering algorithm: group the neighboring hits around the seed.
void set(uint row, uint col, GeomDetEnumerators::Location subDet, float energy, float time, float time_error, const LocalError &local_error, const GlobalPoint &global_point)
Detector identifier class for the Endcap Timing Layer.
static int position[264][3]
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
int mtdSubDetector() const
void clear_buffer(RecHitIterator itr)
Clear the internal buffer array.
BTLDetId::CrysLayout crysLayoutFromTopoMode(const int &topoMode)
std::array< UShort, MAXSIZE > y
constexpr int col() const
LocalPoint localPosition(const MeasurementPoint &mp) const override
void clear(uint row, uint col)
std::array< float, MAXSIZE > energy
void setSize(uint rows, uint cols)
const_iterator begin() const
const float theSeedThreshold