Skip to content

Commit

Permalink
Apply code formatting fixes from upstream integration (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild authored and fwyzard committed Dec 25, 2020
1 parent 8ffdaf4 commit b6b865a
Show file tree
Hide file tree
Showing 11 changed files with 252 additions and 264 deletions.
32 changes: 15 additions & 17 deletions CUDADataFormats/EcalDigi/interface/DigisCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@

namespace ecal {

//
// this is basically a view
// it does not own the actual memory -> does not reclaim
//
struct DigisCollection {
//
// this is basically a view
// it does not own the actual memory -> does not reclaim
//
struct DigisCollection {
DigisCollection() = default;
DigisCollection(uint32_t *ids, uint16_t *data, uint32_t ndigis)
: ids{ids}, data{data}, ndigis{ndigis}
{}
DigisCollection(DigisCollection const&) = default;
DigisCollection& operator=(DigisCollection const&) = default;
DigisCollection(uint32_t *ids, uint16_t *data, uint32_t ndigis) : ids{ids}, data{data}, ndigis{ndigis} {}
DigisCollection(DigisCollection const &) = default;
DigisCollection &operator=(DigisCollection const &) = default;

DigisCollection(DigisCollection&&) = default;
DigisCollection& operator=(DigisCollection&&) = default;
DigisCollection(DigisCollection &&) = default;
DigisCollection &operator=(DigisCollection &&) = default;

// stride is statically known
uint32_t *ids=nullptr;
uint16_t *data=nullptr;
uint32_t *ids = nullptr;
uint16_t *data = nullptr;
uint32_t ndigis;
};
};

}
} // namespace ecal

#endif // CUDADataFormats_EcalDigi_interface_DigisCollection_h
#endif // CUDADataFormats_EcalDigi_interface_DigisCollection_h
10 changes: 6 additions & 4 deletions CUDADataFormats/EcalRecHitSoA/interface/RecoTypes.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#ifndef CUDADataFormats_EcalRecHitSoA_interface_RecoTypes
#define CUDADataFormats_EcalRecHitSoA_interface_RecoTypes

namespace ecal { namespace reco {
namespace ecal {
namespace reco {

using ComputationScalarType = float;
using StorageScalarType = float;
using ComputationScalarType = float;
using StorageScalarType = float;

}}
} // namespace reco
} // namespace ecal

#endif
152 changes: 75 additions & 77 deletions EventFilter/EcalRawToDigi/interface/ElectronicsIdGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"

namespace ecal { namespace raw {
namespace ecal {
namespace raw {

/** \brief Ecal readout channel identification
/** \brief Ecal readout channel identification
[32:20] Unused (so far)
[19:13] DCC id
[12:6] tower
Expand All @@ -16,78 +17,75 @@ namespace ecal { namespace raw {
Index starts from 1
*/

class ElectronicsIdGPU {
public:
/** Default constructor -- invalid value */
constexpr ElectronicsIdGPU() : id_{0xFFFFFFFFu} {}
/** from raw */
constexpr ElectronicsIdGPU(uint32_t id) : id_{id} {}
/** Constructor from dcc,tower,channel **/
constexpr ElectronicsIdGPU(
uint8_t const dccid, uint8_t const towerid,
uint8_t const stripid, uint8_t const xtalid)
: id_{static_cast<uint32_t>(
(xtalid & 0x7) | ((stripid & 0x7) << 3) |
((towerid & 0x7F) << 6) | ((dccid & 0x7F) << 13))}
{}

constexpr uint32_t operator()() { return id_; }
constexpr uint32_t rawId() const { return id_; }

/// get the DCC (Ecal Local DCC value not global one) id
constexpr uint8_t dccId() const { return (id_ >> 13) & 0x7F; }
/// get the tower id
constexpr uint8_t towerId() const { return (id_ >> 6) & 0x7F; }
/// get the tower id
constexpr uint8_t stripId() const { return (id_ >> 3) & 0x7; }
/// get the channel id
constexpr uint8_t xtalId() const { return (id_ & 0x7); }

/// get the subdet
//EcalSubdetector subdet() const;

/// get a fast, compact, unique index for linear lookups (maximum value = 4194303)
constexpr uint32_t linearIndex() const { return id_ & 0x3FFFFF; }

/// so far for EndCap only :
//int channelId() const; // xtal id between 1 and 25

static constexpr int kTowersInPhi = 4; // see EBDetId
static constexpr int kCrystalsInPhi = 20; // see EBDetId

static constexpr uint8_t MAX_DCCID = 54; //To be updated with correct and final number
static constexpr uint8_t MIN_DCCID = 1;
static constexpr uint8_t MAX_TOWERID = 70;
static constexpr uint8_t MIN_TOWERID = 1;
static constexpr uint8_t MAX_STRIPID = 5;
static constexpr uint8_t MIN_STRIPID = 1;
static constexpr uint8_t MAX_CHANNELID = 25;
static constexpr uint8_t MIN_CHANNELID = 1;
static constexpr uint8_t MAX_XTALID = 5;
static constexpr uint8_t MIN_XTALID = 1;

static constexpr int MIN_DCCID_EEM = 1;
static constexpr int MAX_DCCID_EEM = 9;
static constexpr int MIN_DCCID_EBM = 10;
static constexpr int MAX_DCCID_EBM = 27;
static constexpr int MIN_DCCID_EBP = 28;
static constexpr int MAX_DCCID_EBP = 45;
static constexpr int MIN_DCCID_EEP = 46;
static constexpr int MAX_DCCID_EEP = 54;

static constexpr int DCCID_PHI0_EBM = 10;
static constexpr int DCCID_PHI0_EBP = 28;

static constexpr int kDCCChannelBoundary = 17;
static constexpr int DCC_EBM = 10; // id of the DCC in EB- which contains phi=0 deg.
static constexpr int DCC_EBP = 28; // id of the DCC in EB+ which contains phi=0 deg.
static constexpr int DCC_EEM = 1; // id of the DCC in EE- which contains phi=0 deg.
static constexpr int DCC_EEP = 46; // id of the DCC in EE+ which contains phi=0 deg.

private:
uint32_t id_;
};

}}

#endif // EventFilter_EcalRawToDigi_interface_id_h
class ElectronicsIdGPU {
public:
/** Default constructor -- invalid value */
constexpr ElectronicsIdGPU() : id_{0xFFFFFFFFu} {}
/** from raw */
constexpr ElectronicsIdGPU(uint32_t id) : id_{id} {}
/** Constructor from dcc,tower,channel **/
constexpr ElectronicsIdGPU(uint8_t const dccid, uint8_t const towerid, uint8_t const stripid, uint8_t const xtalid)
: id_{static_cast<uint32_t>((xtalid & 0x7) | ((stripid & 0x7) << 3) | ((towerid & 0x7F) << 6) |
((dccid & 0x7F) << 13))} {}

constexpr uint32_t operator()() { return id_; }
constexpr uint32_t rawId() const { return id_; }

/// get the DCC (Ecal Local DCC value not global one) id
constexpr uint8_t dccId() const { return (id_ >> 13) & 0x7F; }
/// get the tower id
constexpr uint8_t towerId() const { return (id_ >> 6) & 0x7F; }
/// get the tower id
constexpr uint8_t stripId() const { return (id_ >> 3) & 0x7; }
/// get the channel id
constexpr uint8_t xtalId() const { return (id_ & 0x7); }

/// get the subdet
//EcalSubdetector subdet() const;

/// get a fast, compact, unique index for linear lookups (maximum value = 4194303)
constexpr uint32_t linearIndex() const { return id_ & 0x3FFFFF; }

/// so far for EndCap only :
//int channelId() const; // xtal id between 1 and 25

static constexpr int kTowersInPhi = 4; // see EBDetId
static constexpr int kCrystalsInPhi = 20; // see EBDetId

static constexpr uint8_t MAX_DCCID = 54; //To be updated with correct and final number
static constexpr uint8_t MIN_DCCID = 1;
static constexpr uint8_t MAX_TOWERID = 70;
static constexpr uint8_t MIN_TOWERID = 1;
static constexpr uint8_t MAX_STRIPID = 5;
static constexpr uint8_t MIN_STRIPID = 1;
static constexpr uint8_t MAX_CHANNELID = 25;
static constexpr uint8_t MIN_CHANNELID = 1;
static constexpr uint8_t MAX_XTALID = 5;
static constexpr uint8_t MIN_XTALID = 1;

static constexpr int MIN_DCCID_EEM = 1;
static constexpr int MAX_DCCID_EEM = 9;
static constexpr int MIN_DCCID_EBM = 10;
static constexpr int MAX_DCCID_EBM = 27;
static constexpr int MIN_DCCID_EBP = 28;
static constexpr int MAX_DCCID_EBP = 45;
static constexpr int MIN_DCCID_EEP = 46;
static constexpr int MAX_DCCID_EEP = 54;

static constexpr int DCCID_PHI0_EBM = 10;
static constexpr int DCCID_PHI0_EBP = 28;

static constexpr int kDCCChannelBoundary = 17;
static constexpr int DCC_EBM = 10; // id of the DCC in EB- which contains phi=0 deg.
static constexpr int DCC_EBP = 28; // id of the DCC in EB+ which contains phi=0 deg.
static constexpr int DCC_EEM = 1; // id of the DCC in EE- which contains phi=0 deg.
static constexpr int DCC_EEP = 46; // id of the DCC in EE+ which contains phi=0 deg.

private:
uint32_t id_;
};

} // namespace raw
} // namespace ecal

#endif // EventFilter_EcalRawToDigi_interface_id_h
46 changes: 24 additions & 22 deletions EventFilter/EcalRawToDigi/interface/ElectronicsMappingGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,40 @@
#include "HeterogeneousCore/CUDACore/interface/ESProduct.h"
#endif

namespace ecal { namespace raw {
namespace ecal {
namespace raw {

class ElectronicsMappingGPU {
public:
struct Product {
class ElectronicsMappingGPU {
public:
struct Product {
~Product();
uint32_t *eid2did;
};
uint32_t* eid2did;
};

#ifndef __CUDACC__

// rearrange pedestals
ElectronicsMappingGPU(EcalMappingElectronics const&);
// rearrange pedestals
ElectronicsMappingGPU(EcalMappingElectronics const&);

// will call dealloation for Product thru ~Product
~ElectronicsMappingGPU() = default;
// will call dealloation for Product thru ~Product
~ElectronicsMappingGPU() = default;

// get device pointers
Product const& getProduct(cudaStream_t) const;
// get device pointers
Product const& getProduct(cudaStream_t) const;

//
static std::string name() { return std::string{"ecalElectronicsMappingGPU"}; }
//
static std::string name() { return std::string{"ecalElectronicsMappingGPU"}; }

private:
// in the future, we need to arrange so to avoid this copy on the host
// store eb first then ee
std::vector<uint32_t, CUDAHostAllocator<uint32_t>> eid2did_;
private:
// in the future, we need to arrange so to avoid this copy on the host
// store eb first then ee
std::vector<uint32_t, CUDAHostAllocator<uint32_t>> eid2did_;

cms::cuda::ESProduct<Product> product_;
cms::cuda::ESProduct<Product> product_;
#endif
};
};

}}
} // namespace raw
} // namespace ecal

#endif // EventFilter_EcalRawToDigi_interface_ElectronicsMappingGPU_h
#endif // EventFilter_EcalRawToDigi_interface_ElectronicsMappingGPU_h
35 changes: 17 additions & 18 deletions RecoLocalCalo/EcalRecAlgos/interface/EcalGainRatiosGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,34 @@

class EcalGainRatiosGPU {
public:
struct Product {
~Product();
float *gain12Over6=nullptr, *gain6Over1=nullptr;
};
struct Product {
~Product();
float *gain12Over6 = nullptr, *gain6Over1 = nullptr;
};

#ifndef __CUDACC__

// rearrange pedestals
EcalGainRatiosGPU(EcalGainRatios const&);
// rearrange pedestals
EcalGainRatiosGPU(EcalGainRatios const&);

// will call dealloation for Product thru ~Product
~EcalGainRatiosGPU() = default;
// will call dealloation for Product thru ~Product
~EcalGainRatiosGPU() = default;

// get device pointers
Product const& getProduct(cudaStream_t) const;
// get device pointers
Product const& getProduct(cudaStream_t) const;

//
static std::string name() { return std::string{"ecalGainRatiosGPU"}; }
//
static std::string name() { return std::string{"ecalGainRatiosGPU"}; }

private:
// in the future, we need to arrange so to avoid this copy on the host
// store eb first then ee
std::vector<float, CUDAHostAllocator<float>> gain12Over6_;
std::vector<float, CUDAHostAllocator<float>> gain6Over1_;
// in the future, we need to arrange so to avoid this copy on the host
// store eb first then ee
std::vector<float, CUDAHostAllocator<float>> gain12Over6_;
std::vector<float, CUDAHostAllocator<float>> gain6Over1_;

cms::cuda::ESProduct<Product> product_;
cms::cuda::ESProduct<Product> product_;

#endif
};


#endif
Loading

0 comments on commit b6b865a

Please sign in to comment.