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;
229 qclus += qClusIncrement) {
231 if (
cp.qBin_ == qbin)
239 qClusIncrement = 1000;
241 g.xfact[
k] =
cp.sigmax;
242 g.yfact[
k] =
cp.sigmay;
243 g.minCh[
k++] = qclus;
245 LogDebug(
"PixelCPEFastParamsHost") <<
i <<
' ' <<
g.rawId <<
' ' <<
cp.cotalpha <<
' ' << qclus <<
' ' <<
cp.qBin_
246 <<
' ' <<
cp.pixmx <<
' ' <<
m *
cp.sigmax <<
' ' <<
m *
cp.sx1 <<
' ' 247 <<
m *
cp.sx2 <<
' ' <<
m *
cp.sigmay <<
' ' <<
m *
cp.sy1 <<
' ' <<
m *
cp.sy2
249 #endif // EDM_ML_DEBUG 256 g.xfact[
kk] =
g.xfact[
k - 1];
257 g.yfact[
kk] =
g.yfact[
k - 1];
258 g.minCh[
kk] =
g.minCh[
k - 1];
260 auto detx = 1.f /
g.xfact[0];
261 auto dety = 1.f /
g.yfact[0];
267 float ys = 8.f - 4.f;
275 cp.cotbeta = std::copysign(ys * (
g.thePitchY / (8.f *
thickness)), aveCB);
277 g.sigmay[
iy] = toMicron(
cp.sigmay);
278 LogDebug(
"PixelCPEFastParamsHost") <<
"sigmax/sigmay " <<
i <<
' ' << (ys + 4.f) / 8.
f <<
' ' <<
cp.cotalpha
279 <<
'/' <<
cp.cotbeta <<
' ' << 10000.f *
cp.sigmax <<
'/' <<
int(
g.sigmay[
iy])
287 constexpr int numberOfModulesInLadder = TrackerTraits::numberOfModulesInLadder;
288 constexpr int numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
289 constexpr int numberOfModulesInBarrel = TrackerTraits::numberOfModulesInBarrel;
291 constexpr float ladderFactor = 1.f /
float(numberOfModulesInLadder);
293 constexpr int firstEndcapPos = TrackerTraits::firstEndcapPos;
294 constexpr int firstEndcapNeg = TrackerTraits::firstEndcapNeg;
298 auto& aveGeom =
buffer_->averageGeometry();
300 for (
int im = 0, nm = numberOfModulesInBarrel; im < nm; ++im) {
301 auto const&
g =
buffer_->detParams(im);
302 il = im / numberOfModulesInLadder;
303 assert(il <
int(numberOfLaddersInBarrel));
304 auto z =
g.frame.z();
305 aveGeom.ladderZ[il] += ladderFactor *
z;
306 aveGeom.ladderMinZ[il] =
std::min(aveGeom.ladderMinZ[il],
z);
307 aveGeom.ladderMaxZ[il] =
std::max(aveGeom.ladderMaxZ[il],
z);
308 aveGeom.ladderX[il] += ladderFactor *
g.frame.x();
309 aveGeom.ladderY[il] += ladderFactor *
g.frame.y();
310 aveGeom.ladderR[il] += ladderFactor *
sqrt(
g.frame.x() *
g.frame.x() +
g.frame.y() *
g.frame.y());
312 assert(il + 1 ==
int(numberOfLaddersInBarrel));
314 constexpr float moduleLength = TrackerTraits::moduleLength;
316 for (
int il = 0, nl = numberOfLaddersInBarrel; il < nl; ++il) {
317 aveGeom.ladderMinZ[il] -= (0.5f * moduleLength - module_tolerance);
318 aveGeom.ladderMaxZ[il] += (0.5f * moduleLength - module_tolerance);
323 auto const&
g =
buffer_->detParams(im);
324 aveGeom.endCapZ[0] =
std::max(aveGeom.endCapZ[0],
g.frame.z());
327 auto const&
g =
buffer_->detParams(im);
328 aveGeom.endCapZ[1] =
std::min(aveGeom.endCapZ[1],
g.frame.z());
331 aveGeom.endCapZ[0] -= TrackerTraits::endcapCorrection;
332 aveGeom.endCapZ[1] += TrackerTraits::endcapCorrection;
334 for (
int jl = 0, nl = numberOfLaddersInBarrel; jl < nl; ++jl) {
335 LogDebug(
"PixelCPEFastParamsHost") << jl <<
':' << aveGeom.ladderR[jl] <<
'/' 336 <<
std::sqrt(aveGeom.ladderX[jl] * aveGeom.ladderX[jl] +
337 aveGeom.ladderY[jl] * aveGeom.ladderY[jl])
338 <<
',' << aveGeom.ladderZ[jl] <<
',' << aveGeom.ladderMinZ[jl] <<
',' 339 << aveGeom.ladderMaxZ[jl] <<
'\n';
341 LogDebug(
"PixelCPEFastParamsHost") << aveGeom.endCapZ[0] <<
' ' << aveGeom.endCapZ[1];
342 #endif // EDM_ML_DEBUG 345 memcpy(
buffer_->layerGeometry().layer,
346 pixelTopology::layer<TrackerTraits>.data(),
347 pixelTopology::layer<TrackerTraits>.size());
348 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