45 buffer_->commonParams().numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
47 LogDebug(
"PixelCPEFastParamsHost") <<
"thickness " <<
buffer_->commonParams().theThicknessB <<
' ' 48 <<
buffer_->commonParams().theThicknessE;
56 uint32_t oldLayer = 0;
57 uint32_t oldLadder = 0;
60 float miz = 500, mxz = 0;
70 g.nRowsRoc =
p.theDet->specificTopology().rowsperroc();
71 g.nColsRoc =
p.theDet->specificTopology().colsperroc();
72 g.nRows =
p.theDet->specificTopology().rocsX() *
g.nRowsRoc;
73 g.nCols =
p.theDet->specificTopology().rocsY() *
g.nColsRoc;
75 g.numPixsInModule =
g.nRows *
g.nCols;
80 g.isPosZ =
p.theDet->surface().position().z() > 0;
83 g.rawId =
p.theDet->geographicalId();
88 if (oldLayer !=
g.layer) {
90 LogDebug(
"PixelCPEFastParamsHost") <<
"new layer at " <<
i << (
g.isBarrel ?
" B " : (
g.isPosZ ?
" E+ " :
" E- "))
91 <<
g.layer <<
" starting at " <<
g.rawId <<
'\n' 92 <<
"old layer had " << nl <<
" ladders";
101 LogDebug(
"PixelCPEFastParamsHost") <<
"new ladder at " <<
i 102 << (
g.isBarrel ?
" B " : (
g.isPosZ ?
" E+ " :
" E- ")) <<
ladder 103 <<
" starting at " <<
g.rawId <<
'\n' 104 <<
"old ladder ave z,r,p mz " << zl / 8.f <<
" " << rl / 8.f <<
" " << pl / 8.f
105 <<
' ' << miz <<
' ' << mxz;
114 g.shiftX = 0.5f *
p.lorentzShiftInCmX;
115 g.shiftY = 0.5f *
p.lorentzShiftInCmY;
116 g.chargeWidthX =
p.lorentzShiftInCmX *
p.widthLAFractionX;
117 g.chargeWidthY =
p.lorentzShiftInCmY *
p.widthLAFractionY;
119 g.x0 =
p.theOrigin.x();
120 g.y0 =
p.theOrigin.y();
121 g.z0 =
p.theOrigin.z();
123 g.thePitchX =
p.thePitchX;
124 g.thePitchY =
p.thePitchY;
126 auto vv =
p.theDet->surface().position();
137 ClusterParamGeneric
cp;
139 cp.with_track_angle =
false;
141 auto lape =
p.theDet->localAlignmentError();
148 auto toMicron = [&](
float x) {
return std::min(511,
int(
x * 1.e4f + 0.5
f)); };
151 auto gvx =
p.theOrigin.x() + 40.f *
p.thePitchX;
152 auto gvy =
p.theOrigin.y();
153 auto gvz = 1.f /
p.theOrigin.z();
158 cp.cotalpha = gvx * gvz;
159 cp.cotbeta = gvy * gvz;
166 for (
float qclus = 15000; qclus < 35000; qclus += 15000) {
168 LogDebug(
"PixelCPEFastParamsHost") <<
i <<
' ' << qclus <<
' ' <<
cp.pixmx <<
' ' <<
m *
cp.sigmax <<
' ' 169 <<
m *
cp.sx1 <<
' ' <<
m *
cp.sx2 <<
' ' <<
m *
cp.sigmay <<
' ' <<
m *
cp.sy1
170 <<
' ' <<
m *
cp.sy2;
173 #endif // EDM_ML_DEBUG 176 g.sx2 = toMicron(
cp.sx2);
183 float moduleOffsetX = -(0.5f *
float(
g.nRows) + TrackerTraits::bigPixXCorrection);
184 auto const xoff = moduleOffsetX *
g.thePitchX;
187 auto x = xoff * (1.f - (0.5f +
float(
ix)) / 8.
f);
188 auto gvx =
p.theOrigin.x() -
x;
189 auto gvy =
p.theOrigin.y();
190 auto gvz = 1.f /
p.theOrigin.z();
191 cp.cotbeta = gvy * gvz;
192 cp.cotalpha = gvx * gvz;
194 g.sigmax[
ix] = toMicron(
cp.sigmax);
195 g.sigmax1[
ix] = toMicron(
cp.sx1);
196 LogDebug(
"PixelCPEFastParamsHost") <<
"sigmax vs x " <<
i <<
' ' <<
x <<
' ' <<
cp.cotalpha <<
' ' 197 <<
int(
g.sigmax[
ix]) <<
' ' <<
int(
g.sigmax1[
ix]) <<
' ' << 10000.f *
cp.sigmay
203 float moduleOffsetY = 0.5f *
float(
g.nCols) + TrackerTraits::bigPixYCorrection;
204 auto const yoff = -moduleOffsetY *
p.thePitchY;
207 auto y = yoff * (1.f - (0.5f +
float(
ix)) / 8.
f);
208 auto gvx =
p.theOrigin.x() + 40.f *
p.thePitchY;
209 auto gvy =
p.theOrigin.y() -
y;
210 auto gvz = 1.f /
p.theOrigin.z();
211 cp.cotbeta = gvy * gvz;
212 cp.cotalpha = gvx * gvz;
214 LogDebug(
"PixelCPEFastParamsHost") <<
"sigmay vs y " <<
i <<
' ' <<
y <<
' ' <<
cp.cotbeta <<
' ' 215 << 10000.f *
cp.sigmay << std::endl;
217 #endif // EDM_ML_DEBUG 220 cp.cotalpha = gvx * gvz;
221 cp.cotbeta = gvy * gvz;
222 auto aveCB =
cp.cotbeta;
227 int qClusIncrement = 100;
230 if (
cp.qBin_ == qbin) {
235 if (
cp.qBin_ < qbin - 1) {
240 qclus -= qClusIncrement;
242 g.xfact[
k] =
cp.sigmax;
243 g.yfact[
k] =
cp.sigmay;
244 g.minCh[
k++] = qclus / 2;
252 qClusIncrement = 1000;
255 g.xfact[
k] =
cp.sigmax;
256 g.yfact[
k] =
cp.sigmay;
257 g.minCh[
k++] = qclus;
259 LogDebug(
"PixelCPEFastParamsHost") <<
i <<
' ' <<
g.rawId <<
' ' <<
cp.cotalpha <<
' ' << qclus <<
' ' <<
cp.qBin_
260 <<
' ' <<
cp.pixmx <<
' ' <<
m *
cp.sigmax <<
' ' <<
m *
cp.sx1 <<
' ' 261 <<
m *
cp.sx2 <<
' ' <<
m *
cp.sigmay <<
' ' <<
m *
cp.sy1 <<
' ' <<
m *
cp.sy2
263 #endif // EDM_ML_DEBUG 270 g.xfact[
kk] =
g.xfact[
k - 1];
271 g.yfact[
kk] =
g.yfact[
k - 1];
272 g.minCh[
kk] =
g.minCh[
k - 1];
274 auto detx = 1.f /
g.xfact[0];
275 auto dety = 1.f /
g.yfact[0];
281 float ys = 8.f - 4.f;
289 cp.cotbeta = std::copysign(ys * (
g.thePitchY / (8.f *
thickness)), aveCB);
291 g.sigmay[
iy] = toMicron(
cp.sigmay);
292 LogDebug(
"PixelCPEFastParamsHost") <<
"sigmax/sigmay " <<
i <<
' ' << (ys + 4.f) / 8.
f <<
' ' <<
cp.cotalpha
293 <<
'/' <<
cp.cotbeta <<
' ' << 10000.f *
cp.sigmax <<
'/' <<
int(
g.sigmay[
iy])
301 constexpr int numberOfModulesInLadder = TrackerTraits::numberOfModulesInLadder;
302 constexpr int numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
303 constexpr int numberOfModulesInBarrel = TrackerTraits::numberOfModulesInBarrel;
305 constexpr float ladderFactor = 1.f /
float(numberOfModulesInLadder);
307 constexpr int firstEndcapPos = TrackerTraits::firstEndcapPos;
308 constexpr int firstEndcapNeg = TrackerTraits::firstEndcapNeg;
312 auto& aveGeom =
buffer_->averageGeometry();
314 for (
int im = 0, nm = numberOfModulesInBarrel; im < nm; ++im) {
315 auto const&
g =
buffer_->detParams(im);
316 il = im / numberOfModulesInLadder;
317 assert(il <
int(numberOfLaddersInBarrel));
318 auto z =
g.frame.z();
319 aveGeom.ladderZ[il] += ladderFactor *
z;
320 aveGeom.ladderMinZ[il] =
std::min(aveGeom.ladderMinZ[il],
z);
321 aveGeom.ladderMaxZ[il] =
std::max(aveGeom.ladderMaxZ[il],
z);
322 aveGeom.ladderX[il] += ladderFactor *
g.frame.x();
323 aveGeom.ladderY[il] += ladderFactor *
g.frame.y();
324 aveGeom.ladderR[il] += ladderFactor *
sqrt(
g.frame.x() *
g.frame.x() +
g.frame.y() *
g.frame.y());
326 assert(il + 1 ==
int(numberOfLaddersInBarrel));
328 constexpr float moduleLength = TrackerTraits::moduleLength;
330 for (
int il = 0, nl = numberOfLaddersInBarrel; il < nl; ++il) {
331 aveGeom.ladderMinZ[il] -= (0.5f * moduleLength - module_tolerance);
332 aveGeom.ladderMaxZ[il] += (0.5f * moduleLength - module_tolerance);
337 auto const&
g =
buffer_->detParams(im);
338 aveGeom.endCapZ[0] =
std::max(aveGeom.endCapZ[0],
g.frame.z());
341 auto const&
g =
buffer_->detParams(im);
342 aveGeom.endCapZ[1] =
std::min(aveGeom.endCapZ[1],
g.frame.z());
345 aveGeom.endCapZ[0] -= TrackerTraits::endcapCorrection;
346 aveGeom.endCapZ[1] += TrackerTraits::endcapCorrection;
348 for (
int jl = 0, nl = numberOfLaddersInBarrel; jl < nl; ++jl) {
349 LogDebug(
"PixelCPEFastParamsHost") << jl <<
':' << aveGeom.ladderR[jl] <<
'/' 350 <<
std::sqrt(aveGeom.ladderX[jl] * aveGeom.ladderX[jl] +
351 aveGeom.ladderY[jl] * aveGeom.ladderY[jl])
352 <<
',' << aveGeom.ladderZ[jl] <<
',' << aveGeom.ladderMinZ[jl] <<
',' 353 << aveGeom.ladderMaxZ[jl] <<
'\n';
355 LogDebug(
"PixelCPEFastParamsHost") << aveGeom.endCapZ[0] <<
' ' << aveGeom.endCapZ[1];
356 #endif // EDM_ML_DEBUG 359 memcpy(
buffer_->layerGeometry().layer,
360 pixelTopology::layer<TrackerTraits>.data(),
361 pixelTopology::layer<TrackerTraits>.size());
362 buffer_->layerGeometry().maxModuleStride = pixelTopology::maxModuleStride<TrackerTraits>;
constexpr uint32_t numberOfLayers
bool isBarrel(GeomDetEnumerators::SubDetector m)
unsigned int pxbLadder(const DetId &id) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
constexpr uint16_t numberOfModules
unsigned int layer(const DetId &id) const
constexpr int kNumErrorBins
Abs< T >::type abs(const T &t)
void errorFromTemplates(DetParam const &theDetParam, ClusterParamGeneric &theClusterParam, float qclus) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
constexpr int kGenErrorQBins
const TrackerTopology & ttopo_
static constexpr uint32_t layerStart[numberOfLayers+1]
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
SOARotation< float > Rotation