18 #include "CLHEP/Units/GlobalPhysicalConstants.h" 19 #include "CLHEP/Units/GlobalSystemOfUnits.h" 30 : m_subDet(myDet), m_ComponentShapes(componentShapes), m_geometry(nullptr) {
42 unsigned int size = 0;
50 edm::LogError(
"TimeDigiError") <<
"[EcalTimeMapDigitizer]::ERROR::This subdetector " << myDet
51 <<
" is not implemented";
59 for (
unsigned int i(0);
i !=
size; ++
i) {
69 edm::LogInfo(
"TimeDigiInfo") <<
"[EcalTimeDigitizer]::Subdetector " <<
m_subDet <<
"::Reserved size for time digis " 72 #ifdef ecal_time_debug 73 std::cout <<
"[EcalTimeDigitizer]::Subdetector " <<
m_subDet <<
"::Reserved size for time digis " <<
m_vSam.size()
82 for (std::vector<PCaloHit>::const_iterator it =
hits.begin(), itEnd =
hits.end(); it != itEnd; ++it) {
97 double time = (*it).time();
110 (*(
shapes()->
at((*it).depth())))(binTime - jitter - 25 * (bunchCrossing -
m_minBunch)) * (*it).energy();
112 #ifdef waveform_debug 117 binTime +=
result.waveform_granularity;
130 #ifdef ecal_time_debug 131 std::cout << (*it).id() <<
"\t" << (*it).depth() <<
"\t" << jitter <<
"\t" << (*it).energy() <<
"\t" 153 for (
unsigned int i(0);
i !=
size; ++
i) {
154 #ifdef ecal_time_debug 168 for (
unsigned int i(0);
i !=
size; ++
i) {
169 #ifdef ecal_time_debug 173 #ifdef ecal_time_debug 184 #ifdef ecal_time_debug 185 std::cout <<
"[EcalTimeMapDigitizer]::Zeroing the used samples" << std::endl;
195 "[EcalTimeMapDigitizer] setEventSetup was called, but this should only be called when componentWaveform is " 196 "activated by cfg parameter");
202 #ifdef ecal_time_debug 203 std::cout <<
"[EcalTimeMapDigitizer]::Finalizing hits and fill output collection" << std::endl;
210 const unsigned int ssize(
m_index.size());
214 for (
unsigned int i(0);
i != ssize; ++
i) {
215 #ifdef ecal_time_debug 216 std::cout <<
"----- in digi loop " <<
i << std::endl;
223 unsigned int nTimeHits = 0;
225 float timeHits[nTimeHitsMax];
226 unsigned int timeBX[nTimeHitsMax];
228 for (
unsigned int j(0);
j != nTimeHitsMax; ++
j)
237 output.back().setSize(nTimeHits);
239 for (
unsigned int j(0);
j != nTimeHits; ++
j)
241 output.back().setSample(
j, timeHits[
j]);
242 if (timeBX[
j] == 0) {
243 #ifdef ecal_time_debug 244 std::cout <<
"setting interesting sample " <<
j << std::endl;
246 output.back().setSampleOfInterest(
j);
250 #ifdef ecal_time_debug 252 if (
output.back().sampleOfInterest() > 0)
255 std::cout <<
"\tNo in time hits" << std::endl;
258 #ifdef ecal_time_debug 259 std::cout <<
"[EcalTimeMapDigitizer]::Output collection size " <<
output.size() << std::endl;
266 assert(
nullptr != cellGeometry);
267 GlobalPoint layerPos = (cellGeometry)->getPosition();
269 return layerPos.
mag() * cm / c_light;
static EEDetId detIdFromDenseIndex(uint32_t din)
EcalTimeMapDigitizer(EcalSubdetector myDet, ComponentShapeCollection *componentShapes)
unsigned int samplesSizeAll() const
void run(EcalTimeDigiCollection &output)
static const int m_maxBunch
constexpr bool isNotFinite(T x)
const CaloSubdetectorGeometry * m_geometry
unsigned int samplesSize() const
Log< level::Error, false > LogError
unsigned int nhits[time_average_capacity]
std::vector< TimeSamples > m_vSam
void setGeometry(const CaloSubdetectorGeometry *geometry)
const ComponentShapeCollection * shapes() const
double timeOfFlight(const DetId &detId, int layer) const
static EBDetId detIdFromDenseIndex(uint32_t di)
ComponentShapeCollection * m_ComponentShapes
const TimeSamples * operator[](unsigned int i) const
std::vector< unsigned int > VecInd
TimeSamples * vSamAll(unsigned int i)
void setEventSetup(const edm::EventSetup &evtSetup)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static const unsigned short time_average_capacity
Log< level::Info, false > LogInfo
static const int m_minBunch
void setEventSetup(const edm::EventSetup &eventSetup)
void blankOutUsedSamples()
static int toDepthBin(int index)
TimeSamples * findSignal(const DetId &detId)
void add(const std::vector< PCaloHit > &hits, int bunchCrossing)
float average_time[time_average_capacity]
virtual ~EcalTimeMapDigitizer()
float tot_energy[time_average_capacity]
const std::shared_ptr< ComponentShape > at(int depthIndex) const
static const float MIN_ENERGY_THRESHOLD
TimeSamples * vSam(unsigned int i)