Skip to content

Commit

Permalink
code working version prior ESProduct usage for Geometry and Topology
Browse files Browse the repository at this point in the history
  • Loading branch information
bfontana committed Aug 28, 2020
1 parent e434847 commit 77728ed
Show file tree
Hide file tree
Showing 22 changed files with 883 additions and 772 deletions.
20 changes: 10 additions & 10 deletions CUDADataFormats/HGCal/interface/HGCRecHitSoA.h
@@ -1,15 +1,15 @@
#ifndef CUDADATAFORMATS_HGCRECHITSOA_H
#define CUDADATAFORMATS_HGCRECHITSOA_H 1
#ifndef CudaDataFormats_HGCal_HGCRecHitSoA_h
#define CudaDataFormats_HGCal_HGCRecHitSoA_h

class HGCRecHitSoA {
public:
float *energy;
float *time;
float *timeError;
uint32_t *id;
uint32_t *flagBits;
uint8_t *son;
int nbytes;
float *energy_; //calibrated energy of the rechit
float *time_; //time jitter of the UncalibRecHit
float *timeError_; //time resolution
uint32_t *id_; //rechit detId
uint32_t *flagBits_; //rechit flags describing its status (DataFormats/HGCRecHit/interface/HGCRecHit.h)
uint8_t *son_; //signal over noise
int nbytes_; //number of bytes of the SoA
};

#endif //CUDADATAFORMATS_HGCRECHITSOA_H
#endif
28 changes: 15 additions & 13 deletions CUDADataFormats/HGCal/interface/HGCUncalibratedRecHitSoA.h
@@ -1,18 +1,20 @@
#ifndef CUDADATAFORMATS_HGCUNCALIBRATEDRECHITSOA_H
#define CUDADATAFORMATS_HGCUNCALIBRATEDRECHITSOA_H 1
#ifndef CudaDataFormats_HGCal_HGCUncalibratedRecHitSoA_h
#define CudaDataFormats_HGCal_HGCUncalibratedRecHitSoA_h

class HGCUncalibratedRecHitSoA {
public:
float *amplitude;
float *pedestal;
float *jitter;
float *chi2;
float *OOTamplitude;
float *OOTchi2;
uint32_t *flags;
uint32_t *aux;
uint32_t *id;
int nbytes;
float *amplitude_; //uncalib rechit amplitude, i.e., the average number of MIPs
float *pedestal_; //reconstructed pedestal
float *jitter_; //reconstructed time jitter
float *chi2_; //chi2 of the pulse
float *OOTamplitude_; //out-of-time reconstructed amplitude
float *OOTchi2_; //out-of-time chi2
uint32_t *flags_; //uncalibrechit flags describing its status (DataFormats/HGCRecHit/interface/HGCUncalibratedRecHit.h); to be propagated to the rechits
uint32_t *aux_; //aux word; first 8 bits contain time (jitter) error
uint32_t *id_; //uncalibrechit detector id
uint32_t *wafer_; //uncalibrechit wafer id
uint32_t *layer_; //uncalibrechit layer nuber
int nbytes_; //number of bytes of the SoA
};

#endif //CUDADATAFORMATS_HGCUNCAIBRATEDRECHITSOA_H
#endif
@@ -0,0 +1,85 @@
#ifndef CudaDataFormats_HGCal_HGCUncalibratedRecHitsToRecHitsConstants_h
#define CudaDataFormats_HGCal_HGCUncalibratedRecHitsToRecHitsConstants_h

#include <vector>

class HGCConstantVectorData {
public:
std::vector<double> fCPerMIP_;
std::vector<double> cce_;
std::vector<double> noise_fC_;
std::vector<double> rcorr_;
std::vector<double> weights_;
std::vector<int> waferTypeL_;
};

class HGCeeUncalibratedRecHitConstantData {
public:
double hgcEE_keV2DIGI_; //energy to femto coloumb conversion: 1000 eV/3.62 (eV per e) / 6.24150934e3 (e per fC)
double hgceeUncalib2GeV_; //sets the ADC; obtained by dividing 1e-6 by hgcEE_keV2DIGI_
double *hgcEE_fCPerMIP_; //femto coloumb to MIP conversion; one value per sensor thickness
double *hgcEE_cce_; //charge collection efficiency, one value per sensor thickness
double *hgcEE_noise_fC_; //noise, one value per sensor thickness
double *rcorr_; //thickness correction
double *weights_; //energy weights to recover rechit energy deposited in the absorber
int *waferTypeL_; //wafer longitudinal thickness classification (1 = 100um, 2 = 200um, 3=300um)
float xmin_; //used for computing the time resolution error
float xmax_; //used for computing the time resolution error
float aterm_; //used for computing the time resolution error
float cterm_; //used for computing the time resolution error
int nbytes_; //number of bytes allocated by this class
int ndelem_; //number of doubles pointed by this class
int nfelem_; //number of floats pointed by this class
int nielem_; //number of ints pointed by this class
int s_hgcEE_fCPerMIP_; //number of elements pointed by hgcEE_fCPerMIP_
int s_hgcEE_cce_; //number of elements pointed by hgcEE_cce_
int s_hgcEE_noise_fC_; //number of elements pointed by hgcEE_noise_fC_
int s_rcorr_; //number of elements pointed by rcorr_
int s_weights_; //number of elements pointed by weights_
int s_waferTypeL_; //number of elements pointed by waferTypeL_
};

class HGChefUncalibratedRecHitConstantData {
public:
double hgcHEF_keV2DIGI_; //energy to femto coloumb conversion: 1000 eV/3.62 (eV per e) / 6.24150934e3 (e per fC)
double hgchefUncalib2GeV_; //sets the ADC; obtained by dividing 1e-6 by hgcHEF_keV2DIGI_
double *hgcHEF_fCPerMIP_; //femto coloumb to MIP conversion; one value per sensor thickness
double *hgcHEF_cce_; //charge collection efficiency, one value per sensor thickness
double *hgcHEF_noise_fC_; //noise, one value per sensor thickness
double *rcorr_; //thickness correction
double *weights_; //energy weights to recover rechit energy deposited in the absorber
int *waferTypeL_; //wafer longitudinal thickness classification (1 = 100um, 2 = 200um, 3=300um)
float xmin_; //used for computing the time resolution error
float xmax_; //used for computing the time resolution error
float aterm_; //used for computing the time resolution error
float cterm_; //used for computing the time resolution error
uint32_t fhOffset_; //layer offset
int nbytes_; //number of bytes allocated by this class
int ndelem_; //number of doubles allocated by this class
int nfelem_; //number of floats allocated by this class
int nuelem_; //number of unsigned ints allocated by this class
int nielem_; //number of ints allocated by this class
int s_hgcHEF_fCPerMIP_; //number of elements pointed by hgcEE_fCPerMIP_
int s_hgcHEF_cce_; //number of elements pointed by hgcEE_cce_
int s_hgcHEF_noise_fC_; //number of elements pointed by hgcEE_noise_fC_
int s_rcorr_; //number of elements pointed by rcorr_
int s_weights_; //number of elements pointed by weights_
int s_waferTypeL_; //number of elements pointed by waferTypeL_
};

class HGChebUncalibratedRecHitConstantData {
public:
double hgcHEB_keV2DIGI_; //energy to femto coloumb conversion: 1000 eV/3.62 (eV per e) / 6.24150934e3 (e per fC)
double hgchebUncalib2GeV_; //sets the ADC; obtained by dividing 1e-6 by hgcHEB_keV2DIGI_
double hgcHEB_noise_MIP_; //noise
double *weights_; //energy weights to recover rechit energy deposited in the absorber
uint32_t bhOffset_; //layer offset
int nbytes_; //number of bytes allocated by this class
int ndelem_; //number of doubles allocated by this class
int nfelem_; //number of floats allocated by this class
int nuelem_; //number of unsigned ints allocated by this class
int nielem_; //number of ints allocated by this class
int s_weights_; //number of elements pointed by weights_
};

#endif
8 changes: 3 additions & 5 deletions UserCode/CodeGPU/plugins/BuildFile.xml
@@ -1,16 +1,14 @@
<library name="HeterogeneousUncalibRecHits" file="HeterogeneousHGCalEERecHitProducer.cc HeterogeneousHGCalHEFRecHitProducer.cc HeterogeneousHGCalHEBRecHitProducer.cc HeterogeneousHGCalProducerMemoryWrapper.cc KernelManager.cu HGCalRecHitKernelImpl.cu">
<library name="HeterogeneousUncalibRecHits" file="HeterogeneousHGCalEERecHitProducer.cc HeterogeneousHGCalHEFRecHitProducer.cc HeterogeneousHGCalHEBRecHitProducer.cc TEST_HeterogeneousESProduct.cc HeterogeneousHGCalProducerMemoryWrapper.cc KernelManagerHGCalRecHit.cu HGCalRecHitKernelImpl.cu">
<use name="cuda"/>
<use name="HeterogeneousCore/CUDACore"/>
<use name="HeterogeneousCore/CUDAUtilities"/>
<use name="DataFormats/HGCRecHit"/>
<use name="DataFormats/HcalDetId"/>
<use name="DataFormats/DetId"/>
<use name="FWCore/Framework"/>
<use name="FWCore/Utilities"/>
<use name="RecoLocalCalo/HGCalRecAlgos"/>
<use name="RecoLocalCalo/HGCalRecProducers"/>
<use name="Geometry/HGCalGeometry"/>
<use name="Geometry/HGCalCommonData"/>
<use name="HeterogeneousCore/CUDAUtilities"/>
<use name="HeterogeneousCore/CUDACore"/>
<use name="HeterogeneousCore/CUDAServices"/>
<flags EDM_PLUGIN="1"/>
</library>
28 changes: 28 additions & 0 deletions UserCode/CodeGPU/plugins/HGCalDetIdTools.h
@@ -0,0 +1,28 @@
namespace detid_tools {
static constexpr int kHGCalCellOffset = 0;
static constexpr int kHGCalCellMask = 0xFF;
static constexpr int kHGCalWaferOffset = 8;
static constexpr int kHGCalWaferMask = 0x3FF;
static constexpr int kHGCalWaferTypeOffset = 18;
static constexpr int kHGCalWaferTypeMask = 0x1;
static constexpr int kHGCalLayerOffset = 19;
static constexpr int kHGCalLayerMask = 0x1F;
static constexpr int kHGCalZsideOffset = 24;
static constexpr int kHGCalZsideMask = 0x1;
static constexpr int kHGCalMaskCell = 0xFFFBFF00;

/// get the absolute value of the cell #'s in x and y
constexpr int cell(uint32_t id) { return id & kHGCalCellMask; }

/// get the wafer #
constexpr int wafer(uint32_t id) { return (id >> kHGCalWaferOffset) & kHGCalWaferMask; }

/// get the wafer type
constexpr int waferType(uint32_t id) { return ((id >> kHGCalWaferTypeOffset) & kHGCalWaferTypeMask ? 1 : -1); }

/// get the layer #
constexpr int layer(uint32_t id) { return (id >> kHGCalLayerOffset) & kHGCalLayerMask; }

/// get the z-side of the cell (1/-1)
constexpr int zside(uint32_t id) { return ((id >> kHGCalZsideOffset) & kHGCalZsideMask ? 1 : -1); }
}

0 comments on commit 77728ed

Please sign in to comment.