28 theHitThreshold(conf.getParameter<double>(
"HitThreshold")),
29 theSeedThreshold(conf.getParameter<double>(
"SeedThreshold")),
30 theClusterThreshold(conf.getParameter<double>(
"ClusterThreshold")),
31 theTimeThreshold(conf.getParameter<double>(
"TimeThreshold")),
32 thePositionThreshold(conf.getParameter<double>(
"PositionThreshold")),
36 theBuffer(theNumOfRows, theNumOfCols),
37 bufferAlreadySet(
false) {}
43 desc.add<
double>(
"HitThreshold", 0.);
44 desc.add<
double>(
"SeedThreshold", 0.);
45 desc.add<
double>(
"ClusterThreshold", 0.);
46 desc.add<
double>(
"TimeThreshold", 10.);
47 desc.add<
double>(
"PositionThreshold", -1.0);
57 const auto& thedet =
geom->idToDet(
id);
58 if (thedet ==
nullptr) {
60 <<
"GeographicalID: " << std::hex <<
id.rawId() <<
" is invalid!" <<
std::dec << std::endl;
67 unsigned int nrows = topol.
nrows();
99 edm::LogInfo(
"MTDThresholdClusterizer") <<
"No hits to clusterize";
103 LogDebug(
"MTDThresholdClusterizer") <<
"Input collection " <<
input.size();
106 std::set<unsigned> geoIds;
107 std::multimap<unsigned, unsigned> geoIdToIdx;
114 <<
"MTDDetId: " << std::hex << mtdId.
rawId() <<
" is invalid!" <<
std::dec << std::endl;
122 geoIds.emplace(
geoId);
128 geoIds.emplace(
geoId);
132 <<
"MTDDetId: " << std::hex << mtdId.
rawId() <<
" is invalid!" <<
std::dec << std::endl;
137 for (
unsigned id : geoIds) {
142 auto range = geoIdToIdx.equal_range(
id);
143 LogDebug(
"MTDThresholdClusterizer") <<
"Matching Ids for " << std::hex <<
id <<
std::dec <<
" [" 144 <<
range.first->second <<
"," <<
range.second->second <<
"]";
148 for (
auto itr =
range.first; itr !=
range.second; ++itr) {
149 const unsigned hitidx = itr->second;
155 for (
unsigned int i = 0;
i <
theSeeds.size();
i++) {
163 <<
"putting in this cluster " <<
i <<
" #hits:" << cluster.
size() <<
" E:" << cluster.
energy()
164 <<
" T +/- DT:" << cluster.
time() <<
" +/- " << cluster.
timeError() <<
" X:" << cluster.
x()
165 <<
" Y:" << cluster.
y() <<
" xpos +/- err " << cluster.
getClusterPosX() <<
" +/- " 175 for (
auto itr =
range.first; itr !=
range.second; ++itr) {
176 const unsigned hitidx = itr->second;
196 int row = itr->row();
197 int col = itr->column();
199 float energy = itr->energy();
200 float time = itr->time();
201 float timeError = itr->timeError();
219 xpos = local_point.
x();
233 << row <<
" / " <<
col <<
" energy " <<
energy <<
" time " <<
time 234 <<
" time error " << timeError <<
" local_point " << local_point.
x() <<
" " 235 << local_point.
y() <<
" " << local_point.
z() <<
" local error " 263 acluster.
add(
hit, seed_energy, seed_time, seed_time_error);
266 std::array<float, AccretionCluster::MAXSIZE> pixel_x{{-99999.}};
267 std::array<float, AccretionCluster::MAXSIZE> pixel_errx2{{-99999.}};
269 pixel_x[acluster.
top()] = seed_xpos;
270 pixel_errx2[acluster.
top()] = seed_error_xx;
273 bool stopClus =
false;
275 while (!acluster.
empty() && !stopClus) {
277 auto curInd = acluster.
top();
279 for (
auto c =
std::max(0,
int(acluster.
y[curInd] - 1));
282 for (
auto r =
std::max(0,
int(acluster.
x[curInd] - 1));
286 <<
"Clustering subdet " << seed_subdet <<
" around " << curInd <<
" X,Y = " << acluster.
x[curInd] <<
"," 287 << acluster.
y[curInd] <<
" r,c = " <<
r <<
"," <<
c <<
" energy,time = " <<
theBuffer.
energy(
r,
c) <<
" " 300 (hit_error_xx + seed_error_xx + hit_error_yy + seed_error_yy))
321 acluster.
time.data(),
331 float sumW(0.
f), sumXW(0.
f), sumXW2(0.
f);
337 cluster.setClusterPosX(sumXW / sumW);
338 cluster.setClusterErrorX(
std::sqrt(sumXW2) / sumW);
uint8_t geoId(const VFATFrame &frame)
retrieve the GEO information for this channel
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...
int getMTDTopologyMode() const
void push_back(data_type const &d)
void set(uint row, uint col, GeomDetEnumerators::Location subDet, float energy, float time, float time_error, const LocalError &local_error, const LocalPoint &local_point, float xpos)
float energy(uint row, uint col) const
float time(uint row, uint col) const
LocalError local_error(uint row, uint col) const
static void fillPSetDescription(edm::ParameterSetDescription &desc)
~MTDThresholdClusterizer() override
virtual const PixelTopology & specificTopology() const
FTLRecHitCollection::const_iterator RecHitIterator
std::vector< T >::const_iterator const_iterator
const float thePositionThreshold
const float theClusterThreshold
int mtdSubDetector() const
const float theHitThreshold
Clustering-related quantities:
int theNumOfRows
Geometry-related information.
MTDThresholdClusterizer(edm::ParameterSet const &conf)
Constructor:
GeomDetEnumerators::Location subDet(uint row, uint col) const
Use subDet to identify whether the Hit is in BTL or ETL.
bool add(FTLCluster::FTLHitPos const &p, float const ienergy, float const itime, float const itimeError)
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
Detector identifier base class for the MIP Timing Layer.
static std::string const input
float time_error(uint row, uint col) const
void copy_to_buffer(RecHitIterator itr, const MTDGeometry *geom, const MTDTopology *topo)
Copy FTLRecHit into the buffer, identify seeds.
float getClusterErrorX() const
bool setup(const MTDGeometry *geometry, const MTDTopology *topo, const DetId &id)
LocalError localError() const
std::array< float, MAXSIZE > timeError
int ncolumns() const override
Abs< T >::type abs(const T &t)
int nrows() const override
std::vector< FTLCluster::FTLHitPos > theSeeds
float getClusterPosX() const
std::array< UShort, MAXSIZE > x
std::array< float, MAXSIZE > time
Log< level::Info, false > LogInfo
const float theTimeThreshold
float xpos(uint row, uint col) const
constexpr uint32_t rawId() const
get the raw id
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
MTDArrayBuffer theBuffer
Data storage.
FTLCluster make_cluster(const FTLCluster::FTLHitPos &hit)
The actual clustering algorithm: group the neighboring hits around the seed.
Detector identifier class for the Endcap Timing Layer.
SubDetector subDetector() const
static int position[264][3]
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
void clear_buffer(RecHitIterator itr)
Clear the internal buffer array.
BTLDetId::CrysLayout crysLayoutFromTopoMode(const int &topoMode)
std::array< UShort, MAXSIZE > y
void clear(uint row, uint col)
LocalPoint local_point(uint row, uint col) const
std::array< float, MAXSIZE > energy
void setSize(uint rows, uint cols)
const float theSeedThreshold