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 for (
int qclus = 1000; qclus < 200000; qclus += 1000) {
225 if (
cp.qBin_ == qbin)
228 g.xfact[
k] =
cp.sigmax;
229 g.yfact[
k] =
cp.sigmay;
230 g.minCh[
k++] = qclus;
232 LogDebug(
"PixelCPEFastParamsHost") <<
i <<
' ' <<
g.rawId <<
' ' <<
cp.cotalpha <<
' ' << qclus <<
' ' <<
cp.qBin_
233 <<
' ' <<
cp.pixmx <<
' ' <<
m *
cp.sigmax <<
' ' <<
m *
cp.sx1 <<
' ' 234 <<
m *
cp.sx2 <<
' ' <<
m *
cp.sigmay <<
' ' <<
m *
cp.sy1 <<
' ' <<
m *
cp.sy2
236 #endif // EDM_ML_DEBUG 243 g.xfact[
kk] =
g.xfact[
k - 1];
244 g.yfact[
kk] =
g.yfact[
k - 1];
245 g.minCh[
kk] =
g.minCh[
k - 1];
247 auto detx = 1.f /
g.xfact[0];
248 auto dety = 1.f /
g.yfact[0];
254 float ys = 8.f - 4.f;
262 cp.cotbeta = std::copysign(ys * (
buffer_->commonParams().thePitchY / (8.f *
thickness)), aveCB);
264 g.sigmay[
iy] = toMicron(
cp.sigmay);
265 LogDebug(
"PixelCPEFastParamsHost") <<
"sigmax/sigmay " <<
i <<
' ' << (ys + 4.f) / 8.
f <<
' ' <<
cp.cotalpha
266 <<
'/' <<
cp.cotbeta <<
' ' << 10000.f *
cp.sigmax <<
'/' <<
int(
g.sigmay[
iy])
271 constexpr int numberOfModulesInLadder = TrackerTraits::numberOfModulesInLadder;
272 constexpr int numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
273 constexpr int numberOfModulesInBarrel = TrackerTraits::numberOfModulesInBarrel;
275 constexpr float ladderFactor = 1.f /
float(numberOfModulesInLadder);
277 constexpr int firstEndcapPos = TrackerTraits::firstEndcapPos;
278 constexpr int firstEndcapNeg = TrackerTraits::firstEndcapNeg;
282 auto& aveGeom =
buffer_->averageGeometry();
284 for (
int im = 0, nm = numberOfModulesInBarrel; im < nm; ++im) {
285 auto const&
g =
buffer_->detParams(im);
286 il = im / numberOfModulesInLadder;
287 assert(il <
int(numberOfLaddersInBarrel));
288 auto z =
g.frame.z();
289 aveGeom.ladderZ[il] += ladderFactor *
z;
290 aveGeom.ladderMinZ[il] =
std::min(aveGeom.ladderMinZ[il],
z);
291 aveGeom.ladderMaxZ[il] =
std::max(aveGeom.ladderMaxZ[il],
z);
292 aveGeom.ladderX[il] += ladderFactor *
g.frame.x();
293 aveGeom.ladderY[il] += ladderFactor *
g.frame.y();
294 aveGeom.ladderR[il] += ladderFactor *
sqrt(
g.frame.x() *
g.frame.x() +
g.frame.y() *
g.frame.y());
296 assert(il + 1 ==
int(numberOfLaddersInBarrel));
298 constexpr float moduleLength = TrackerTraits::moduleLength;
300 for (
int il = 0, nl = numberOfLaddersInBarrel; il < nl; ++il) {
301 aveGeom.ladderMinZ[il] -= (0.5f * moduleLength - module_tolerance);
302 aveGeom.ladderMaxZ[il] += (0.5f * moduleLength - module_tolerance);
307 auto const&
g =
buffer_->detParams(im);
308 aveGeom.endCapZ[0] =
std::max(aveGeom.endCapZ[0],
g.frame.z());
311 auto const&
g =
buffer_->detParams(im);
312 aveGeom.endCapZ[1] =
std::min(aveGeom.endCapZ[1],
g.frame.z());
315 aveGeom.endCapZ[0] -= TrackerTraits::endcapCorrection;
316 aveGeom.endCapZ[1] += TrackerTraits::endcapCorrection;
318 for (
int jl = 0, nl = numberOfLaddersInBarrel; jl < nl; ++jl) {
319 LogDebug(
"PixelCPEFastParamsHost") << jl <<
':' << aveGeom.ladderR[jl] <<
'/' 320 <<
std::sqrt(aveGeom.ladderX[jl] * aveGeom.ladderX[jl] +
321 aveGeom.ladderY[jl] * aveGeom.ladderY[jl])
322 <<
',' << aveGeom.ladderZ[jl] <<
',' << aveGeom.ladderMinZ[jl] <<
',' 323 << aveGeom.ladderMaxZ[jl] <<
'\n';
325 LogDebug(
"PixelCPEFastParamsHost") << aveGeom.endCapZ[0] <<
' ' << aveGeom.endCapZ[1];
326 #endif // EDM_ML_DEBUG 330 memcpy(
buffer_->layerGeometry().layerStart,
333 memcpy(
buffer_->layerGeometry().layer,
334 pixelTopology::layer<TrackerTraits>.data(),
335 pixelTopology::layer<TrackerTraits>.size());
336 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