48 buffer_->commonParams().numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
50 LogDebug(
"PixelCPEFastParamsHost") <<
"pitch & thickness " <<
buffer_->commonParams().thePitchX <<
' ' 51 <<
buffer_->commonParams().thePitchY <<
" " 52 <<
buffer_->commonParams().theThicknessB <<
' ' 53 <<
buffer_->commonParams().theThicknessE;
58 uint32_t oldLayer = 0;
59 uint32_t oldLadder = 0;
62 float miz = 500, mxz = 0;
71 g.nRowsRoc =
p.theDet->specificTopology().rowsperroc();
72 g.nColsRoc =
p.theDet->specificTopology().colsperroc();
73 g.nRows =
p.theDet->specificTopology().rocsX() *
g.nRowsRoc;
74 g.nCols =
p.theDet->specificTopology().rocsY() *
g.nColsRoc;
76 g.numPixsInModule =
g.nRows *
g.nCols;
83 g.isPosZ =
p.theDet->surface().position().z() > 0;
86 g.rawId =
p.theDet->geographicalId();
91 if (oldLayer !=
g.layer) {
93 LogDebug(
"PixelCPEFastParamsHost") <<
"new layer at " <<
i << (
g.isBarrel ?
" B " : (
g.isPosZ ?
" E+ " :
" E- "))
94 <<
g.layer <<
" starting at " <<
g.rawId <<
'\n' 95 <<
"old layer had " << nl <<
" ladders";
100 LogDebug(
"PixelCPEFastParamsHost") <<
"new ladder at " <<
i 101 << (
g.isBarrel ?
" B " : (
g.isPosZ ?
" E+ " :
" E- ")) <<
ladder 102 <<
" starting at " <<
g.rawId <<
'\n' 103 <<
"old ladder ave z,r,p mz " << zl / 8.f <<
" " << rl / 8.f <<
" " << pl / 8.f
104 <<
' ' << miz <<
' ' << mxz;
113 g.shiftX = 0.5f *
p.lorentzShiftInCmX;
114 g.shiftY = 0.5f *
p.lorentzShiftInCmY;
115 g.chargeWidthX =
p.lorentzShiftInCmX *
p.widthLAFractionX;
116 g.chargeWidthY =
p.lorentzShiftInCmY *
p.widthLAFractionY;
118 g.x0 =
p.theOrigin.x();
119 g.y0 =
p.theOrigin.y();
120 g.z0 =
p.theOrigin.z();
122 auto vv =
p.theDet->surface().position();
133 ClusterParamGeneric
cp;
135 cp.with_track_angle =
false;
137 auto lape =
p.theDet->localAlignmentError();
144 auto toMicron = [&](
float x) {
return std::min(511,
int(
x * 1.e4f + 0.5
f)); };
147 auto gvx =
p.theOrigin.x() + 40.f *
buffer_->commonParams().thePitchX;
148 auto gvy =
p.theOrigin.y();
149 auto gvz = 1.f /
p.theOrigin.z();
154 cp.cotalpha = gvx * gvz;
155 cp.cotbeta = gvy * gvz;
162 for (
float qclus = 15000; qclus < 35000; qclus += 15000) {
164 LogDebug(
"PixelCPEFastParamsHost") <<
i <<
' ' << qclus <<
' ' <<
cp.pixmx <<
' ' <<
m *
cp.sigmax <<
' ' 165 <<
m *
cp.sx1 <<
' ' <<
m *
cp.sx2 <<
' ' <<
m *
cp.sigmay <<
' ' <<
m *
cp.sy1
166 <<
' ' <<
m *
cp.sy2;
169 #endif // EDM_ML_DEBUG 172 g.sx2 = toMicron(
cp.sx2);
179 float moduleOffsetX = -(0.5f *
float(
g.nRows) + TrackerTraits::bigPixXCorrection);
180 auto const xoff = moduleOffsetX *
buffer_->commonParams().thePitchX;
183 auto x = xoff * (1.f - (0.5f +
float(
ix)) / 8.
f);
184 auto gvx =
p.theOrigin.x() -
x;
185 auto gvy =
p.theOrigin.y();
186 auto gvz = 1.f /
p.theOrigin.z();
187 cp.cotbeta = gvy * gvz;
188 cp.cotalpha = gvx * gvz;
190 g.sigmax[
ix] = toMicron(
cp.sigmax);
191 g.sigmax1[
ix] = toMicron(
cp.sx1);
192 LogDebug(
"PixelCPEFastParamsHost") <<
"sigmax vs x " <<
i <<
' ' <<
x <<
' ' <<
cp.cotalpha <<
' ' 193 <<
int(
g.sigmax[
ix]) <<
' ' <<
int(
g.sigmax1[
ix]) <<
' ' << 10000.f *
cp.sigmay
199 float moduleOffsetY = 0.5f *
float(
g.nCols) + TrackerTraits::bigPixYCorrection;
200 auto const yoff = -moduleOffsetY *
buffer_->commonParams().thePitchY;
203 auto y = yoff * (1.f - (0.5f +
float(
ix)) / 8.
f);
204 auto gvx =
p.theOrigin.x() + 40.f *
buffer_->commonParams().thePitchY;
205 auto gvy =
p.theOrigin.y() -
y;
206 auto gvz = 1.f /
p.theOrigin.z();
207 cp.cotbeta = gvy * gvz;
208 cp.cotalpha = gvx * gvz;
210 LogDebug(
"PixelCPEFastParamsHost") <<
"sigmay vs y " <<
i <<
' ' <<
y <<
' ' <<
cp.cotbeta <<
' ' 211 << 10000.f *
cp.sigmay << std::endl;
213 #endif // EDM_ML_DEBUG 216 cp.cotalpha = gvx * gvz;
217 cp.cotbeta = gvy * gvz;
218 auto aveCB =
cp.cotbeta;
223 int qClusIncrement = 100;
225 qclus += qClusIncrement) {
227 if (
cp.qBin_ == qbin)
235 qClusIncrement = 1000;
237 g.xfact[
k] =
cp.sigmax;
238 g.yfact[
k] =
cp.sigmay;
239 g.minCh[
k++] = qclus;
241 LogDebug(
"PixelCPEFastParamsHost") <<
i <<
' ' <<
g.rawId <<
' ' <<
cp.cotalpha <<
' ' << qclus <<
' ' <<
cp.qBin_
242 <<
' ' <<
cp.pixmx <<
' ' <<
m *
cp.sigmax <<
' ' <<
m *
cp.sx1 <<
' ' 243 <<
m *
cp.sx2 <<
' ' <<
m *
cp.sigmay <<
' ' <<
m *
cp.sy1 <<
' ' <<
m *
cp.sy2
245 #endif // EDM_ML_DEBUG 252 g.xfact[
kk] =
g.xfact[
k - 1];
253 g.yfact[
kk] =
g.yfact[
k - 1];
254 g.minCh[
kk] =
g.minCh[
k - 1];
256 auto detx = 1.f /
g.xfact[0];
257 auto dety = 1.f /
g.yfact[0];
263 float ys = 8.f - 4.f;
271 cp.cotbeta = std::copysign(ys * (
buffer_->commonParams().thePitchY / (8.f *
thickness)), aveCB);
273 g.sigmay[
iy] = toMicron(
cp.sigmay);
274 LogDebug(
"PixelCPEFastParamsHost") <<
"sigmax/sigmay " <<
i <<
' ' << (ys + 4.f) / 8.
f <<
' ' <<
cp.cotalpha
275 <<
'/' <<
cp.cotbeta <<
' ' << 10000.f *
cp.sigmax <<
'/' <<
int(
g.sigmay[
iy])
280 constexpr int numberOfModulesInLadder = TrackerTraits::numberOfModulesInLadder;
281 constexpr int numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
282 constexpr int numberOfModulesInBarrel = TrackerTraits::numberOfModulesInBarrel;
284 constexpr float ladderFactor = 1.f /
float(numberOfModulesInLadder);
286 constexpr int firstEndcapPos = TrackerTraits::firstEndcapPos;
287 constexpr int firstEndcapNeg = TrackerTraits::firstEndcapNeg;
291 auto& aveGeom =
buffer_->averageGeometry();
293 for (
int im = 0, nm = numberOfModulesInBarrel; im < nm; ++im) {
294 auto const&
g =
buffer_->detParams(im);
295 il = im / numberOfModulesInLadder;
296 assert(il <
int(numberOfLaddersInBarrel));
297 auto z =
g.frame.z();
298 aveGeom.ladderZ[il] += ladderFactor *
z;
299 aveGeom.ladderMinZ[il] =
std::min(aveGeom.ladderMinZ[il],
z);
300 aveGeom.ladderMaxZ[il] =
std::max(aveGeom.ladderMaxZ[il],
z);
301 aveGeom.ladderX[il] += ladderFactor *
g.frame.x();
302 aveGeom.ladderY[il] += ladderFactor *
g.frame.y();
303 aveGeom.ladderR[il] += ladderFactor *
sqrt(
g.frame.x() *
g.frame.x() +
g.frame.y() *
g.frame.y());
305 assert(il + 1 ==
int(numberOfLaddersInBarrel));
307 constexpr float moduleLength = TrackerTraits::moduleLength;
309 for (
int il = 0, nl = numberOfLaddersInBarrel; il < nl; ++il) {
310 aveGeom.ladderMinZ[il] -= (0.5f * moduleLength - module_tolerance);
311 aveGeom.ladderMaxZ[il] += (0.5f * moduleLength - module_tolerance);
316 auto const&
g =
buffer_->detParams(im);
317 aveGeom.endCapZ[0] =
std::max(aveGeom.endCapZ[0],
g.frame.z());
320 auto const&
g =
buffer_->detParams(im);
321 aveGeom.endCapZ[1] =
std::min(aveGeom.endCapZ[1],
g.frame.z());
324 aveGeom.endCapZ[0] -= TrackerTraits::endcapCorrection;
325 aveGeom.endCapZ[1] += TrackerTraits::endcapCorrection;
327 for (
int jl = 0, nl = numberOfLaddersInBarrel; jl < nl; ++jl) {
328 LogDebug(
"PixelCPEFastParamsHost") << jl <<
':' << aveGeom.ladderR[jl] <<
'/' 329 <<
std::sqrt(aveGeom.ladderX[jl] * aveGeom.ladderX[jl] +
330 aveGeom.ladderY[jl] * aveGeom.ladderY[jl])
331 <<
',' << aveGeom.ladderZ[jl] <<
',' << aveGeom.ladderMinZ[jl] <<
',' 332 << aveGeom.ladderMaxZ[jl] <<
'\n';
334 LogDebug(
"PixelCPEFastParamsHost") << aveGeom.endCapZ[0] <<
' ' << aveGeom.endCapZ[1];
335 #endif // EDM_ML_DEBUG 339 memcpy(
buffer_->layerGeometry().layerStart,
342 memcpy(
buffer_->layerGeometry().layer,
343 pixelTopology::layer<TrackerTraits>.data(),
344 pixelTopology::layer<TrackerTraits>.size());
345 buffer_->layerGeometry().maxModuleStride = pixelTopology::maxModuleStride<TrackerTraits>;
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