|
|
Go to the documentation of this file. 1 #include <cuda_runtime.h>
17 constexpr
float micronsToCm = 1.0e-4;
35 <<
"ERROR: GenErrors not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
36 << (*genErrorDBObject_).version();
61 cudaCheck(cudaMemcpyAsync((
void*)
data.paramsOnGPU_h.m_commonParams,
62 &this->commonParamsGPU_,
66 cudaCheck(cudaMemcpyAsync((
void*)
data.paramsOnGPU_h.m_averageGeometry,
67 &this->averageGeometry_,
71 cudaCheck(cudaMemcpyAsync((
void*)
data.paramsOnGPU_h.m_layerGeometry,
72 &this->layerGeometry_,
76 cudaCheck(cudaMemcpyAsync((
void*)
data.paramsOnGPU_h.m_detParams,
77 this->detParamsGPU_.data(),
82 return data.paramsOnGPU_d;
102 uint32_t oldLayer = 0;
103 uint32_t oldLadder = 0;
106 float miz = 90, mxz = 0;
119 g.isPosZ =
p.theDet->surface().position().z() > 0;
122 g.rawId =
p.theDet->geographicalId();
127 if (oldLayer !=
g.layer) {
129 LogDebug(
"PixelCPEFast") <<
"new layer at " <<
i << (
g.isBarrel ?
" B " : (
g.isPosZ ?
" E+ " :
" E- "))
130 <<
g.layer <<
" starting at " <<
g.rawId <<
'\n'
131 <<
"old layer had " << nl <<
" ladders";
134 if (oldLadder !=
ladder) {
136 LogDebug(
"PixelCPEFast") <<
"new ladder at " <<
i << (
g.isBarrel ?
" B " : (
g.isPosZ ?
" E+ " :
" E- "))
137 <<
ladder <<
" starting at " <<
g.rawId <<
'\n'
138 <<
"old ladder ave z,r,p mz " << zl / 8.f <<
" " << rl / 8.f <<
" " << pl / 8.f <<
' '
139 << miz <<
' ' << mxz;
148 g.shiftX = 0.5f *
p.lorentzShiftInCmX;
149 g.shiftY = 0.5f *
p.lorentzShiftInCmY;
150 g.chargeWidthX =
p.lorentzShiftInCmX *
p.widthLAFractionX;
151 g.chargeWidthY =
p.lorentzShiftInCmY *
p.widthLAFractionY;
153 g.x0 =
p.theOrigin.x();
154 g.y0 =
p.theOrigin.y();
155 g.z0 =
p.theOrigin.z();
157 auto vv =
p.theDet->surface().position();
170 cp.with_track_angle =
false;
172 auto lape =
p.theDet->localAlignmentError();
179 auto toMicron = [&](
float x) {
return std::min(511,
int(
x * 1.e4f + 0.5
f)); };
184 auto gvy =
p.theOrigin.y();
185 auto gvz = 1.f /
p.theOrigin.z();
186 cp.cotalpha = gvx * gvz;
187 cp.cotbeta = gvy * gvz;
193 for (
float qclus = 15000; qclus < 35000; qclus += 15000) {
195 LogDebug(
"PixelCPEFast") <<
i <<
' ' << qclus <<
' ' <<
cp.pixmx <<
' ' <<
m *
cp.sigmax <<
' ' <<
m *
cp.sx1
196 <<
' ' <<
m *
cp.sx2 <<
' ' <<
m *
cp.sigmay <<
' ' <<
m *
cp.sy1 <<
' ' <<
m *
cp.sy2;
199 #endif // EDM_ML_DEBUG
202 g.sx2 = toMicron(
cp.sx2);
209 for (
int ix = 0; ix < 16; ++ix) {
210 auto x = xoff * (1.f - (0.5f +
float(ix)) / 8.
f);
211 auto gvx =
p.theOrigin.x() -
x;
212 auto gvy =
p.theOrigin.y();
213 auto gvz = 1.f /
p.theOrigin.z();
214 cp.cotbeta = gvy * gvz;
215 cp.cotalpha = gvx * gvz;
217 g.sigmax[ix] = toMicron(
cp.sigmax);
218 g.sigmax1[ix] = toMicron(
cp.sx1);
219 LogDebug(
"PixelCPEFast") <<
"sigmax vs x " <<
i <<
' ' <<
x <<
' ' <<
cp.cotalpha <<
' ' <<
int(
g.sigmax[ix])
220 <<
' ' <<
int(
g.sigmax1[ix]) <<
' ' << 10000.f *
cp.sigmay << std::endl;
225 for (
int ix = 0; ix < 16; ++ix) {
226 auto y = yoff * (1.f - (0.5f +
float(ix)) / 8.
f);
228 auto gvy =
p.theOrigin.y() -
y;
229 auto gvz = 1.f /
p.theOrigin.z();
230 cp.cotbeta = gvy * gvz;
231 cp.cotalpha = gvx * gvz;
233 LogDebug(
"PixelCPEFast") <<
"sigmay vs y " <<
i <<
' ' <<
y <<
' ' <<
cp.cotbeta <<
' ' << 10000.f *
cp.sigmay
236 #endif // EDM_ML_DEBUG
240 auto gvy =
p.theOrigin.y();
241 auto gvz = 1.f /
p.theOrigin.z();
245 cp.cotalpha = gvx * gvz;
246 cp.cotbeta = gvy * gvz;
247 auto aveCB =
cp.cotbeta;
252 for (
int qclus = 1000; qclus < 200000; qclus += 1000) {
254 if (
cp.qBin_ == qbin)
257 g.xfact[
k] =
cp.sigmax;
258 g.yfact[
k] =
cp.sigmay;
259 g.minCh[
k++] = qclus;
261 LogDebug(
"PixelCPEFast") <<
i <<
' ' <<
g.rawId <<
' ' <<
cp.cotalpha <<
' ' << qclus <<
' ' <<
cp.qBin_ <<
' '
262 <<
cp.pixmx <<
' ' <<
m *
cp.sigmax <<
' ' <<
m *
cp.sx1 <<
' ' <<
m *
cp.sx2 <<
' '
263 <<
m *
cp.sigmay <<
' ' <<
m *
cp.sy1 <<
' ' <<
m *
cp.sy2 << std::endl;
264 #endif // EDM_ML_DEBUG
268 for (
int kk =
k;
kk < 5; ++
kk) {
269 g.xfact[
kk] =
g.xfact[
k - 1];
270 g.yfact[
kk] =
g.yfact[
k - 1];
271 g.minCh[
kk] =
g.minCh[
k - 1];
273 auto detx = 1.f /
g.xfact[0];
274 auto dety = 1.f /
g.yfact[0];
275 for (
int kk = 0;
kk < 5; ++
kk) {
280 float ys = 8.f - 4.f;
282 for (
int iy = 0; iy < 16; ++iy) {
289 g.sigmay[iy] = toMicron(
cp.sigmay);
290 LogDebug(
"PixelCPEFast") <<
"sigmax/sigmay " <<
i <<
' ' << (ys + 4.f) / 8.
f <<
' ' <<
cp.cotalpha <<
'/'
291 <<
cp.cotbeta <<
' ' << 10000.f *
cp.sigmax <<
'/' <<
int(
g.sigmay[iy]) << std::endl;
304 auto z =
g.frame.z();
305 aveGeom.ladderZ[il] += 0.125f *
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] += 0.125f *
g.frame.x();
309 aveGeom.ladderY[il] += 0.125f *
g.frame.y();
310 aveGeom.ladderR[il] += 0.125f *
sqrt(
g.frame.x() *
g.frame.x() +
g.frame.y() *
g.frame.y());
314 constexpr
float module_length = 6.7f;
315 constexpr
float module_tolerance = 0.2f;
317 aveGeom.ladderMinZ[il] -= (0.5f * module_length - module_tolerance);
318 aveGeom.ladderMaxZ[il] += (0.5f * module_length - module_tolerance);
324 aveGeom.endCapZ[0] =
std::max(aveGeom.endCapZ[0],
g.frame.z());
328 aveGeom.endCapZ[1] =
std::min(aveGeom.endCapZ[1],
g.frame.z());
331 aveGeom.endCapZ[0] -= 1.5f;
332 aveGeom.endCapZ[1] += 1.5f;
335 LogDebug(
"PixelCPEFast") << 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(
"PixelCPEFast") << aveGeom.endCapZ[0] <<
' ' << aveGeom.endCapZ[1];
361 float locBz = theDetParam.
bz;
362 float locBx = theDetParam.
bx;
363 LogDebug(
"PixelCPEFast") <<
"PixelCPEFast::localPosition(...) : locBz = " << locBz;
367 theClusterParam.
sigmay = -999.9;
368 theClusterParam.
sigmax = -999.9;
369 theClusterParam.
sy1 = -999.9;
370 theClusterParam.
sy2 = -999.9;
371 theClusterParam.
sx1 = -999.9;
372 theClusterParam.
sx2 = -999.9;
379 theClusterParam.
qBin_ = gtempl.
qbin(gtemplID,
386 theClusterParam.
pixmx,
400 theClusterParam.
sigmax = theClusterParam.
sigmax * micronsToCm;
401 theClusterParam.
sx1 = theClusterParam.
sx1 * micronsToCm;
402 theClusterParam.
sx2 = theClusterParam.
sx2 * micronsToCm;
404 theClusterParam.
sigmay = theClusterParam.
sigmay * micronsToCm;
405 theClusterParam.
sy1 = theClusterParam.
sy1 * micronsToCm;
406 theClusterParam.
sy2 = theClusterParam.
sy2 * micronsToCm;
415 ClusterParamGeneric& theClusterParam = static_cast<ClusterParamGeneric&>(theClusterParamBase);
422 theClusterParam.
qBin_ = 0;
448 auto xPos =
cp.xpos[0];
449 auto yPos =
cp.ypos[0];
453 theClusterParam.
sigmax =
cp.xerr[0];
454 theClusterParam.
sigmay =
cp.yerr[0];
456 LogDebug(
"PixelCPEFast") <<
" in PixelCPEFast:localPosition - pos = " << xPos <<
" " << yPos <<
" size "
457 <<
cp.maxRow[0] -
cp.minRow[0] <<
' ' <<
cp.maxCol[0] -
cp.minCol[0];
470 ClusterParamGeneric& theClusterParam = static_cast<ClusterParamGeneric&>(theClusterParamBase);
472 auto xerr = theClusterParam.
sigmax;
473 auto yerr = theClusterParam.
sigmay;
475 LogDebug(
"PixelCPEFast") <<
" errors " << xerr <<
" " << yerr;
477 auto xerr_sq = xerr * xerr;
478 auto yerr_sq = yerr * yerr;
bool useErrorsFromTemplates_
SOARotation< float > Rotation
uint8_t layer[phase1PixelTopology::layerIndexSize]
pixelCPEforGPU::ParamsOnGPU cpuData_
LocalError localError(DetParam const &theDetParam, ClusterParam &theClusterParam) const override
const SiPixelGenErrorDBObject * genErrorDBObject_
unsigned int pxbLadder(const DetId &id) const
const TrackerTopology & ttopo_
static void fillPSetDescription(edm::ParameterSetDescription &desc)
constexpr uint32_t numberOfModulesInBarrel
uint32_t const T *__restrict__ const uint32_t *__restrict__ int32_t int Histo::index_type cudaStream_t stream
static void fillPSetDescription(edm::ParameterSetDescription &desc)
int qbin(int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, bool irradiationCorrections, int &pixmx, float &sigmay, float &deltay, float &sigmax, float &deltax, float &sy1, float &dy1, float &sy2, float &dy2, float &sx1, float &dx1, float &sx2, float &dx2)
unsigned int layer(const DetId &id) const
CommonParams const * m_commonParams
const PixelGeomDetUnit * theDet
const SiPixelCluster * theCluster
pixelCPEforGPU::ParamsOnGPU * paramsOnGPU_d
static void collect_edge_charges(ClusterParam &theClusterParam, int &q_f_X, int &q_l_X, int &q_f_Y, int &q_l_Y, bool truncate)
std::vector< SiPixelGenErrorStore > thePixelGenError_
uint32_t layerStart[phase1PixelTopology::numberOfLayers+1]
constexpr std::array< uint8_t, layerIndexSize > layer
void errorFromTemplates(DetParam const &theDetParam, ClusterParamGeneric &theClusterParam, float qclus) const
constexpr uint32_t numberOfLaddersInBarrel
const bool truncatePixelCharge_
bool isBarrel(GeomDetEnumerators::SubDetector m)
AverageGeometry const * m_averageGeometry
constexpr void position(CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
static bool pushfile(int filenum, std::vector< SiPixelGenErrorStore > &pixelTemp, std::string dir="")
pixelCPEforGPU::ParamsOnGPU paramsOnGPU_h
pixelCPEforGPU::LayerGeometry layerGeometry_
std::vector< pixelCPEforGPU::DetParams > detParamsGPU_
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
pixelCPEforGPU::AverageGeometry averageGeometry_
#define cudaCheck(ARG,...)
LayerGeometry const * m_layerGeometry
cms::cuda::ESProduct< GPUData > gpuData_
constexpr void errorFromDB(CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
DetParams const * m_detParams
constexpr uint32_t layerStart[numberOfLayers+1]
char data[epos_bytes_allocation]
const pixelCPEforGPU::ParamsOnGPU * getGPUProductAsync(cudaStream_t cudaStream) const
Abs< T >::type abs(const T &t)
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
LocalPoint localPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const override
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
PixelCPEFast(edm::ParameterSet const &conf, const MagneticField *, const TrackerGeometry &, const TrackerTopology &, const SiPixelLorentzAngle *, const SiPixelGenErrorDBObject *, const SiPixelLorentzAngle *)
The constructor.
pixelCPEforGPU::CommonParams commonParamsGPU_