Skip to content

Commit

Permalink
Update the PixelCPEFast code following the reorganisation in cms-sw#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
fwyzard committed Jul 8, 2018
1 parent f98cc08 commit ba03473
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 46 deletions.
22 changes: 11 additions & 11 deletions RecoLocalTracker/SiPixelRecHits/interface/PixelCPEFast.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

#include <utility>

#include <cuda/api_wrappers.h>

#include "CalibTracker/SiPixelESProducers/interface/SiPixelCPEGenericDBErrorParametrization.h"
#include "CondFormats/SiPixelTransient/interface/SiPixelGenError.h"
#include "CondFormats/SiPixelTransient/interface/SiPixelTemplate.h"
#include "HeterogeneousCore/CUDACore/interface/CUDAESProduct.h"
#include "HeterogeneousCore/CUDAUtilities/interface/CUDAHostAllocator.h"
#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h"
#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h"
#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h"
#include "RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h"

#include <cuda/api_wrappers.h>

class MagneticField;
class PixelCPEFast final : public PixelCPEBase
{
Expand All @@ -29,10 +29,10 @@ class PixelCPEFast final : public PixelCPEBase
// These are errors predicted by PIXELAV
float sigmay; // CPE Generic y-error for multi-pixel cluster
float sigmax; // CPE Generic x-error for multi-pixel cluster
float sy1 ; // CPE Generic y-error for single single-pixel
float sy2 ; // CPE Generic y-error for single double-pixel cluster
float sx1 ; // CPE Generic x-error for single single-pixel cluster
float sx2 ; // CPE Generic x-error for single double-pixel cluster
float sy1; // CPE Generic y-error for single single-pixel
float sy2; // CPE Generic y-error for single double-pixel cluster
float sx1; // CPE Generic x-error for single single-pixel cluster
float sx2; // CPE Generic x-error for single double-pixel cluster

};

Expand Down Expand Up @@ -69,9 +69,9 @@ class PixelCPEFast final : public PixelCPEBase
float EdgeClusterErrorX_;
float EdgeClusterErrorY_;

std::vector<float> xerr_barrel_l1_,yerr_barrel_l1_,xerr_barrel_ln_;
std::vector<float> yerr_barrel_ln_,xerr_endcap_,yerr_endcap_;
float xerr_barrel_l1_def_, yerr_barrel_l1_def_,xerr_barrel_ln_def_;
std::vector<float> xerr_barrel_l1_, yerr_barrel_l1_, xerr_barrel_ln_;
std::vector<float> yerr_barrel_ln_, xerr_endcap_, yerr_endcap_;
float xerr_barrel_l1_def_, yerr_barrel_l1_def_, xerr_barrel_ln_def_;
float yerr_barrel_ln_def_, xerr_endcap_def_, yerr_endcap_def_;

//--- DB Error Parametrization object, new light templates
Expand Down
66 changes: 31 additions & 35 deletions RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEFast.h"

#include "Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h"
#include <iostream>

#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h"
#include <cuda.h>
#include <cuda_runtime.h>

// this is needed to get errors from templates
#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h"
#include "CondFormats/SiPixelTransient/interface/SiPixelTemplate.h"
#include "DataFormats/DetId/interface/DetId.h"


// Services
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h"
#include "Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h"
#include "HeterogeneousCore/CUDAServices/interface/numberOfCUDADevices.h"
#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h"
#include "MagneticField/Engine/interface/MagneticField.h"

#include <cuda.h>
#include <cuda_runtime.h>

#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h"
#include "HeterogeneousCore/CUDAServices/interface/numberOfCUDADevices.h"
#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEFast.h"

#include <iostream>
// Services
// this is needed to get errors from templates

namespace {
constexpr float micronsToCm = 1.0e-4;
Expand Down Expand Up @@ -54,18 +50,18 @@ PixelCPEFast::PixelCPEFast(edm::ParameterSet const & conf,

// Rechit errors in case other, more correct, errors are not vailable
// This are constants. Maybe there is a more efficienct way to store them.
xerr_barrel_l1_= {0.00115, 0.00120, 0.00088};
xerr_barrel_l1_def_=0.01030;
yerr_barrel_l1_= {0.00375,0.00230,0.00250,0.00250,0.00230,0.00230,0.00210,0.00210,0.00240};
yerr_barrel_l1_def_=0.00210;
xerr_barrel_ln_= {0.00115, 0.00120, 0.00088};
xerr_barrel_ln_def_=0.01030;
yerr_barrel_ln_= {0.00375,0.00230,0.00250,0.00250,0.00230,0.00230,0.00210,0.00210,0.00240};
yerr_barrel_ln_def_=0.00210;
xerr_endcap_= {0.0020, 0.0020};
xerr_endcap_def_=0.0020;
yerr_endcap_= {0.00210};
yerr_endcap_def_=0.00075;
xerr_barrel_l1_ = { 0.00115, 0.00120, 0.00088 };
xerr_barrel_l1_def_ = 0.01030;
yerr_barrel_l1_ = { 0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240 };
yerr_barrel_l1_def_ = 0.00210;
xerr_barrel_ln_ = { 0.00115, 0.00120, 0.00088};
xerr_barrel_ln_def_ = 0.01030;
yerr_barrel_ln_ = { 0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240 };
yerr_barrel_ln_def_ = 0.00210;
xerr_endcap_ = { 0.0020, 0.0020 };
xerr_endcap_def_ = 0.0020;
yerr_endcap_ = { 0.00210 };
yerr_endcap_def_ = 0.00075;

fillParamsForGpu();
}
Expand All @@ -90,7 +86,7 @@ void PixelCPEFast::fillParamsForGpu() {
m_commonParamsGPU.thePitchX = m_DetParams[0].thePitchX;
m_commonParamsGPU.thePitchY = m_DetParams[0].thePitchY;

uint32_t oldLayer = 0;
//uint32_t oldLayer = 0;
m_detParamsGPU.resize(m_DetParams.size());
for (auto i=0U; i<m_DetParams.size(); ++i) {
auto & p=m_DetParams[i];
Expand All @@ -99,7 +95,7 @@ void PixelCPEFast::fillParamsForGpu() {
assert(p.theDet->index()==int(i));
assert(m_commonParamsGPU.thePitchY==p.thePitchY);
assert(m_commonParamsGPU.thePitchX==p.thePitchX);
// assert(m_commonParamsGPU.theThickness==p.theThickness);
//assert(m_commonParamsGPU.theThickness==p.theThickness);

g.isBarrel = GeomDetEnumerators::isBarrel(p.thePart);
g.isPosZ = p.theDet->surface().position().z()>0;
Expand All @@ -109,13 +105,13 @@ void PixelCPEFast::fillParamsForGpu() {

assert( (g.isBarrel ?m_commonParamsGPU.theThicknessB : m_commonParamsGPU.theThicknessE) ==p.theThickness );

// if (m_commonParamsGPU.theThickness!=p.theThickness)
//if (m_commonParamsGPU.theThickness!=p.theThickness)
// std::cout << i << (g.isBarrel ? "B " : "E ") << m_commonParamsGPU.theThickness<<"!="<<p.theThickness << std::endl;

if (oldLayer != g.layer) {
oldLayer = g.layer;
std::cout << "new layer at " << i << (g.isBarrel ? " B " : (g.isPosZ ? " E+ " : " E- ")) << g.layer << " starting at " << g.rawId << std::endl;
}
//if (oldLayer != g.layer) {
// oldLayer = g.layer;
// std::cout << "new layer at " << i << (g.isBarrel ? " B " : (g.isPosZ ? " E+ " : " E- ")) << g.layer << " starting at " << g.rawId << std::endl;
//}

g.shiftX = 0.5f*p.lorentzShiftInCmX;
g.shiftY = 0.5f*p.lorentzShiftInCmY;
Expand Down

0 comments on commit ba03473

Please sign in to comment.