CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
EBHitResponse Class Reference

#include <EBHitResponse.h>

Inheritance diagram for EBHitResponse:
EcalHitResponse

Public Types

enum  { kNOffsets = 2000 }
 
typedef CaloTSamples< float, 10 > EBSamples
 
typedef std::vector< double > VecD
 
- Public Types inherited from EcalHitResponse
enum  { BUNCHSPACE = 25 }
 
typedef std::unordered_map< uint32_t, double > CalibCache
 
typedef CaloTSamplesBase< float > EcalSamples
 
typedef std::vector< unsigned int > VecInd
 

Public Member Functions

virtual void add (const PCaloHit &hit, CLHEP::HepRandomEngine *) override
 
 EBHitResponse (const CaloVSimParameterMap *parameterMap, const CaloVShape *shape, bool apdOnly, const APDSimParameters *apdPars, const CaloVShape *apdShape)
 
virtual void finalizeHits () override
 
void initialize (CLHEP::HepRandomEngine *)
 
virtual void initializeHits () override
 
virtual bool keepBlank () const
 
virtual EcalSamplesoperator[] (unsigned int i) override
 
virtual const EcalSamplesoperator[] (unsigned int i) const override
 
virtual void run (MixCollection< PCaloHit > &hits, CLHEP::HepRandomEngine *) override
 
virtual unsigned int samplesSize () const override
 
void setIntercal (const EcalIntercalibConstantsMC *ical)
 
virtual ~EBHitResponse ()
 
- Public Member Functions inherited from EcalHitResponse
void add (const EcalSamples *pSam)
 
virtual void add (const CaloSamples &hit)
 
 EcalHitResponse (const CaloVSimParameterMap *parameterMap, const CaloVShape *shape)
 
const EcalSamplesfindDetId (const DetId &detId) const
 
void setBunchRange (int minBunch, int maxBunch)
 
void setEventTime (const edm::TimeValue_t &iTime)
 
void setGeometry (const CaloSubdetectorGeometry *geometry)
 
void setHitCorrection (const CaloVHitCorrection *hitCorrection)
 
void setHitFilter (const CaloVHitFilter *filter)
 
void setLaserConstants (const EcalLaserDbService *laser, bool &useLCcorrection)
 
void setPECorrection (const CaloVPECorrection *peCorrection)
 
void setPhaseShift (double phaseShift)
 
bool withinBunchRange (int bunchCrossing) const
 
virtual ~EcalHitResponse ()
 

Protected Member Functions

void putAPDSignal (const DetId &detId, double npe, double time)
 
virtual unsigned int samplesSizeAll () const override
 
virtual EcalSamplesvSam (unsigned int i) override
 
virtual EcalSamplesvSamAll (unsigned int i) override
 
virtual const EcalSamplesvSamAll (unsigned int i) const override
 
- Protected Member Functions inherited from EcalHitResponse
double analogSignalAmplitude (const DetId &id, double energy, CLHEP::HepRandomEngine *)
 
void blankOutUsedSamples ()
 
double findLaserConstant (const DetId &detId) const
 
EcalSamplesfindSignal (const DetId &detId)
 
const CaloSubdetectorGeometrygeometry () const
 
const CaloVHitFilterhitFilter () const
 
VecIndindex ()
 
const VecIndindex () const
 
int maxBunch () const
 
int minBunch () const
 
const CaloSimParametersparams (const DetId &detId) const
 
double phaseShift () const
 
virtual void putAnalogSignal (const PCaloHit &inputHit, CLHEP::HepRandomEngine *)
 
const CaloVShapeshape () const
 
double timeOfFlight (const DetId &detId) const
 

Private Member Functions

const APDSimParametersapdParameters () const
 
const CaloVShapeapdShape () const
 
double apdSignalAmplitude (const PCaloHit &hit, CLHEP::HepRandomEngine *) const
 
void findIntercalibConstant (const DetId &detId, double &icalconst) const
 
const double nonlFunc (double enr) const
 
const double nonlFunc1 (double energy) const
 
const VecDoffsets () const
 

Private Attributes

std::vector< double > m_apdNpeVec
 
const bool m_apdOnly
 
const APDSimParametersm_apdPars
 
const CaloVShapem_apdShape
 
std::vector< double > m_apdTimeVec
 
const EcalIntercalibConstantsMCm_intercal
 
bool m_isInitialized
 
std::vector< double > m_timeOffVec
 
std::vector< EBSamplesm_vSam
 
const double pasy
 
const double pcon
 
const double pcub
 
const double pehi
 
const double pelo
 
const double pext
 
const double pfac
 
const double plin
 
const double poff
 
const double pqua
 

Detailed Description

Definition at line 14 of file EBHitResponse.h.

Member Typedef Documentation

Definition at line 18 of file EBHitResponse.h.

typedef std::vector<double> EBHitResponse::VecD

Definition at line 20 of file EBHitResponse.h.

Member Enumeration Documentation

anonymous enum
Enumerator
kNOffsets 

Definition at line 22 of file EBHitResponse.h.

Constructor & Destructor Documentation

EBHitResponse::EBHitResponse ( const CaloVSimParameterMap parameterMap,
const CaloVShape shape,
bool  apdOnly,
const APDSimParameters apdPars = 0,
const CaloVShape apdShape = 0 
)

Definition at line 16 of file EBHitResponse.cc.

References DetId::det(), EBDetId::detIdFromDenseIndex(), mps_fire::i, EBDetId::kSizeForDenseIndexing, m_vSam, metProducer_cfi::parameters, CaloVSimParameterMap::simParameters(), findQualityFiles::size, and DetId::subdetId().

20  :
21 
22  EcalHitResponse( parameterMap, shape ) ,
23 
24  m_apdOnly ( apdOnly ) ,
25  m_apdPars ( apdPars ) ,
26  m_apdShape ( apdShape ) ,
27  m_timeOffVec ( kNOffsets, apdParameters()->timeOffset() ) ,
28  pcub ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[0] ) ,
29  pqua ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[1] ) ,
30  plin ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[2] ) ,
31  pcon ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[3] ) ,
32  pelo ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[4] ) ,
33  pehi ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[5] ) ,
34  pasy ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[6] ) ,
35  pext ( 0 == apdPars ? 0 : nonlFunc1( pelo ) ) ,
36  poff ( 0 == apdPars ? 0 : nonlFunc1( pehi ) ) ,
37  pfac ( 0 == apdPars ? 0 : ( pasy - poff )*2./M_PI ),
38  m_isInitialized(false)
39 {
40  const EBDetId detId ( EBDetId::detIdFromDenseIndex( 0 ) ) ;
41  const CaloSimParameters& parameters ( parameterMap->simParameters( detId ) ) ;
42 
43  const unsigned int rSize ( parameters.readoutFrameSize() ) ;
44  const unsigned int nPre ( parameters.binOfMaximum() - 1 ) ;
45 
46  const unsigned int size ( EBDetId::kSizeForDenseIndexing ) ;
47 
48  m_vSam.reserve( size ) ;
49 
50  for( unsigned int i ( 0 ) ; i != size ; ++i )
51  {
52  m_vSam.emplace_back(CaloGenericDetId( detId.det(), detId.subdetId(), i ) ,
53  rSize, nPre );
54  }
55 }
size
Write out results.
const double pfac
Definition: EBHitResponse.h:98
std::vector< EBSamples > m_vSam
const CaloVShape * m_apdShape
Definition: EBHitResponse.h:90
const APDSimParameters * apdParameters() const
const APDSimParameters * m_apdPars
Definition: EBHitResponse.h:89
Main class for Parameters in different subdetectors.
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:111
EcalHitResponse(const CaloVSimParameterMap *parameterMap, const CaloVShape *shape)
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
const double pelo
Definition: EBHitResponse.h:98
const double plin
Definition: EBHitResponse.h:98
std::vector< double > m_timeOffVec
Definition: EBHitResponse.h:93
const double nonlFunc1(double energy) const
Definition: EBHitResponse.h:74
const double pasy
Definition: EBHitResponse.h:98
#define M_PI
const double pehi
Definition: EBHitResponse.h:98
const double poff
Definition: EBHitResponse.h:98
const double pcub
Definition: EBHitResponse.h:98
const double pcon
Definition: EBHitResponse.h:98
const bool m_apdOnly
Definition: EBHitResponse.h:88
const double pext
Definition: EBHitResponse.h:98
const double pqua
Definition: EBHitResponse.h:98
EBHitResponse::~EBHitResponse ( )
virtual

Definition at line 57 of file EBHitResponse.cc.

58 {
59 }

Member Function Documentation

void EBHitResponse::add ( const PCaloHit hit,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Reimplemented from EcalHitResponse.

Definition at line 229 of file EBHitResponse.cc.

References CaloVHitFilter::accepts(), apdParameters(), apdSignalAmplitude(), PCaloHit::depth(), EcalHitResponse::hitFilter(), PCaloHit::id(), edm::isNotFinite(), PCaloHit::kEcalDepthIdMask, m_apdNpeVec, m_apdOnly, m_apdTimeVec, EcalHitResponse::putAnalogSignal(), and PCaloHit::time().

Referenced by counter.Counter::register().

230 {
231  if (!edm::isNotFinite( hit.time() ) && ( 0 == hitFilter() || hitFilter()->accepts( hit ) ) ) {
232  int iddepth = (hit.depth() & PCaloHit::kEcalDepthIdMask);
233  if ( 0 == iddepth ) // for now take only nonAPD hits
234  {
235  if( !m_apdOnly ) putAnalogSignal( hit, engine ) ;
236  }
237  else // APD hits here
238  {
239  if( apdParameters()->addToBarrel() ||
240  m_apdOnly )
241  {
242  const unsigned int icell ( EBDetId( hit.id() ).denseIndex() ) ;
243  m_apdNpeVec[ icell ] += apdSignalAmplitude( hit, engine ) ;
244  if( 0 == m_apdTimeVec[ icell ] ) m_apdTimeVec[ icell ] = hit.time() ;
245  }
246  }
247  }
248 }
double time() const
Definition: PCaloHit.h:36
virtual void putAnalogSignal(const PCaloHit &inputHit, CLHEP::HepRandomEngine *)
uint16_t depth() const
Definition: PCaloHit.h:49
const APDSimParameters * apdParameters() const
virtual bool accepts(const PCaloHit &hit) const =0
bool isNotFinite(T x)
Definition: isFinite.h:10
const CaloVHitFilter * hitFilter() const
double apdSignalAmplitude(const PCaloHit &hit, CLHEP::HepRandomEngine *) const
unsigned int id() const
Definition: PCaloHit.h:43
const bool m_apdOnly
Definition: EBHitResponse.h:88
std::vector< double > m_apdTimeVec
Definition: EBHitResponse.h:96
std::vector< double > m_apdNpeVec
Definition: EBHitResponse.h:95
static const int kEcalDepthIdMask
Definition: PCaloHit.h:67
const APDSimParameters * EBHitResponse::apdParameters ( ) const
private

Definition at line 73 of file EBHitResponse.cc.

References m_apdPars.

Referenced by add(), apdSignalAmplitude(), finalizeHits(), initialize(), and run().

74 {
75  assert ( 0 != m_apdPars ) ;
76  return m_apdPars ;
77 }
const APDSimParameters * m_apdPars
Definition: EBHitResponse.h:89
const CaloVShape * EBHitResponse::apdShape ( ) const
private

Definition at line 80 of file EBHitResponse.cc.

References m_apdShape.

Referenced by putAPDSignal().

81 {
82  assert( 0 != m_apdShape ) ;
83  return m_apdShape ;
84 }
const CaloVShape * m_apdShape
Definition: EBHitResponse.h:90
double EBHitResponse::apdSignalAmplitude ( const PCaloHit hit,
CLHEP::HepRandomEngine *  engine 
) const
private

Definition at line 126 of file EBHitResponse.cc.

References apdParameters(), PCaloHit::depth(), PCaloHit::energy(), findIntercalibConstant(), PCaloHit::id(), PCaloHit::kEcalDepthIdMask, m_apdOnly, m_intercal, APDSimParameters::simToPEHigh(), and APDSimParameters::simToPELow().

Referenced by add(), and run().

127 {
128  int iddepth = (hit.depth() & PCaloHit::kEcalDepthIdMask);
129  assert( 1 == iddepth || 2 == iddepth ) ;
130 
131  double npe ( hit.energy()*( 2 == iddepth ?
133  apdParameters()->simToPEHigh() ) ) ;
134 
135  // do we need to do Poisson statistics for the photoelectrons?
136  if( apdParameters()->doPEStats() &&
137  !m_apdOnly ) {
138 
139  CLHEP::RandPoissonQ randPoissonQ(*engine, npe);
140  npe = randPoissonQ.fire();
141  }
142  assert( 0 != m_intercal ) ;
143  double fac ( 1 ) ;
144  findIntercalibConstant( hit.id(), fac ) ;
145 
146  npe *= fac ;
147 
148 // edm::LogError( "EBHitResponse" ) << "--- # photoelectrons for "
149 /* std::cout << "--- # photoelectrons for "
150  << EBDetId( hit.id() )
151  <<" is " << npe //;
152  <<std::endl ;*/
153 
154  return npe ;
155 }
double simToPEHigh() const
double energy() const
Definition: PCaloHit.h:29
uint16_t depth() const
Definition: PCaloHit.h:49
const APDSimParameters * apdParameters() const
void findIntercalibConstant(const DetId &detId, double &icalconst) const
unsigned int id() const
Definition: PCaloHit.h:43
const EcalIntercalibConstantsMC * m_intercal
Definition: EBHitResponse.h:91
const bool m_apdOnly
Definition: EBHitResponse.h:88
double simToPELow() const
static const int kEcalDepthIdMask
Definition: PCaloHit.h:67
void EBHitResponse::finalizeHits ( )
overridevirtual

Reimplemented from EcalHitResponse.

Definition at line 207 of file EBHitResponse.cc.

References apdParameters(), EBDetId::detIdFromDenseIndex(), mps_fire::i, EBDetId::kSizeForDenseIndexing, m_apdNpeVec, m_apdOnly, m_apdTimeVec, and putAPDSignal().

207  {
208  const unsigned int bSize ( EBDetId::kSizeForDenseIndexing ) ;
209  if( apdParameters()->addToBarrel() ||
210  m_apdOnly )
211  {
212  for( unsigned int i ( 0 ) ; i != bSize ; ++i )
213  {
214  if( 0 < m_apdNpeVec[i] )
215  {
217  m_apdNpeVec[i] ,
218  m_apdTimeVec[i] ) ;
219 
220  // now zero out for next time
221  m_apdNpeVec[i] = 0. ;
222  m_apdTimeVec[i] = 0. ;
223  }
224  }
225  }
226 }
void putAPDSignal(const DetId &detId, double npe, double time)
const APDSimParameters * apdParameters() const
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:111
const bool m_apdOnly
Definition: EBHitResponse.h:88
std::vector< double > m_apdTimeVec
Definition: EBHitResponse.h:96
std::vector< double > m_apdNpeVec
Definition: EBHitResponse.h:95
void EBHitResponse::findIntercalibConstant ( const DetId detId,
double &  icalconst 
) const
private

Definition at line 164 of file EBHitResponse.cc.

References EcalCondObjectContainer< T >::getMap(), m_intercal, and DetId::rawId().

Referenced by apdSignalAmplitude().

166 {
167  EcalIntercalibConstantMC thisconst ( 1. ) ;
168 
169  if( 0 == m_intercal )
170  {
171  edm::LogError( "EBHitResponse" ) <<
172  "No intercal constant defined for EBHitResponse" ;
173  }
174  else
175  {
176  const EcalIntercalibConstantMCMap& icalMap ( m_intercal->getMap() ) ;
177  EcalIntercalibConstantMCMap::const_iterator icalit ( icalMap.find( detId ) ) ;
178  if( icalit != icalMap.end() )
179  {
180  thisconst = *icalit ;
181  if ( thisconst == 0. ) thisconst = 1. ;
182  }
183  else
184  {
185  edm::LogError("EBHitResponse") << "No intercalib const found for xtal "
186  << detId.rawId()
187  << "! something wrong with EcalIntercalibConstants in your DB? ";
188  }
189  }
190  icalconst = thisconst ;
191 }
const self & getMap() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const EcalIntercalibConstantsMC * m_intercal
Definition: EBHitResponse.h:91
std::vector< Item >::const_iterator const_iterator
float EcalIntercalibConstantMC
void EBHitResponse::initialize ( CLHEP::HepRandomEngine *  engine)

Definition at line 62 of file EBHitResponse.cc.

References apdParameters(), mps_fire::i, kNOffsets, m_isInitialized, and m_timeOffVec.

63 {
64  m_isInitialized = true;
65  for( unsigned int i ( 0 ) ; i != kNOffsets ; ++i )
66  {
67  m_timeOffVec[ i ] +=
68  CLHEP::RandGaussQ::shoot(engine, 0, apdParameters()->timeOffWidth() ) ;
69  }
70 }
const APDSimParameters * apdParameters() const
std::vector< double > m_timeOffVec
Definition: EBHitResponse.h:93
void EBHitResponse::initializeHits ( )
overridevirtual

Reimplemented from EcalHitResponse.

Definition at line 194 of file EBHitResponse.cc.

References EcalHitResponse::blankOutUsedSamples(), EcalHitResponse::index(), EBDetId::kSizeForDenseIndexing, m_apdNpeVec, m_apdTimeVec, and findQualityFiles::size.

194  {
195  if( 0 != index().size() ) blankOutUsedSamples() ;
196 
197  const unsigned int bSize ( EBDetId::kSizeForDenseIndexing ) ;
198 
199  if( 0 == m_apdNpeVec.size() )
200  {
201  m_apdNpeVec = std::vector<double>( bSize, (double)0.0 ) ;
202  m_apdTimeVec = std::vector<double>( bSize, (double)0.0 ) ;
203  }
204 }
size
Write out results.
std::vector< double > m_apdTimeVec
Definition: EBHitResponse.h:96
std::vector< double > m_apdNpeVec
Definition: EBHitResponse.h:95
virtual bool EBHitResponse::keepBlank ( ) const
inlinevirtual
const double EBHitResponse::nonlFunc ( double  enr) const
inlineprivate

Definition at line 69 of file EBHitResponse.h.

Referenced by putAPDSignal().

69  {
70  return ( pelo > enr ? pext :
71  ( pehi > enr ? nonlFunc1( enr ) :
72  pfac*atan( log10( enr - pehi + 0.00001 ) ) + poff ) ) ; }
const double pfac
Definition: EBHitResponse.h:98
const double pelo
Definition: EBHitResponse.h:98
const double nonlFunc1(double energy) const
Definition: EBHitResponse.h:74
const double pehi
Definition: EBHitResponse.h:98
const double poff
Definition: EBHitResponse.h:98
const double pext
Definition: EBHitResponse.h:98
const double EBHitResponse::nonlFunc1 ( double  energy) const
inlineprivate

Definition at line 74 of file EBHitResponse.h.

74  {
75  const double enr ( log10(energy) ) ;
76  const double enr2 ( enr*enr ) ;
77  const double enr3 ( enr2*enr ) ;
78  return ( pcub*enr3 + pqua*enr2 + plin*enr + pcon ) ; }
const double plin
Definition: EBHitResponse.h:98
const double pcub
Definition: EBHitResponse.h:98
const double pcon
Definition: EBHitResponse.h:98
const double pqua
Definition: EBHitResponse.h:98
const VecD& EBHitResponse::offsets ( ) const
inlineprivate

Definition at line 67 of file EBHitResponse.h.

Referenced by putAPDSignal().

67 { return m_timeOffVec ; }
std::vector< double > m_timeOffVec
Definition: EBHitResponse.h:93
EcalHitResponse::EcalSamples * EBHitResponse::operator[] ( unsigned int  i)
overridevirtual

Implements EcalHitResponse.

Definition at line 330 of file EBHitResponse.cc.

References mps_fire::i, and m_vSam.

331 {
332  return &m_vSam[ i ] ;
333 }
std::vector< EBSamples > m_vSam
const EcalHitResponse::EcalSamples * EBHitResponse::operator[] ( unsigned int  i) const
overridevirtual

Implements EcalHitResponse.

Definition at line 324 of file EBHitResponse.cc.

References mps_fire::i, and m_vSam.

325 {
326  return &m_vSam[ i ] ;
327 }
std::vector< EBSamples > m_vSam
void EBHitResponse::putAPDSignal ( const DetId detId,
double  npe,
double  time 
)
protected

Definition at line 87 of file EBHitResponse.cc.

References apdShape(), stringResolutionProvider_cfi::bin, CaloSimParameters::binOfMaximum(), EcalHitResponse::BUNCHSPACE, Exception, EcalHitResponse::findSignal(), kNOffsets, m_isInitialized, nonlFunc(), offsets(), metProducer_cfi::parameters, EcalHitResponse::params(), EcalHitResponse::phaseShift(), mps_fire::result, CaloSimParameters::simHitToPhotoelectrons(), CaloTSamplesBase< Ttype >::size(), EcalHitResponse::timeOfFlight(), and tzero.

Referenced by finalizeHits(), and run().

90 {
91  const CaloSimParameters& parameters ( *params( detId ) ) ;
92 
93  const double energyFac ( 1./parameters.simHitToPhotoelectrons( detId ) ) ;
94 
95 // std::cout<<"******** Input APD Npe="<<npe<<", Efactor="<<energyFac
96 // <<", Energy="<<npe*energyFac
97 // <<", nonlFunc="<<nonlFunc( npe*energyFac )<<std::endl ;
98 
99  const double signal ( npe*nonlFunc( npe*energyFac ) ) ;
100 
101  const double jitter ( time - timeOfFlight( detId ) ) ;
102 
103  if(!m_isInitialized) {
104  throw cms::Exception("LogicError")
105  << "EBHitResponse::putAPDSignal called without initializing\n";
106  }
107 
108  const double tzero ( apdShape()->timeToRise()
109  - jitter
110  - offsets()[ EBDetId( detId ).denseIndex()%kNOffsets ]
111  - BUNCHSPACE*( parameters.binOfMaximum()
112  - phaseShift() ) ) ;
113 
114  double binTime ( tzero ) ;
115 
116  EcalSamples& result ( *findSignal( detId ) );
117 
118  for( unsigned int bin ( 0 ) ; bin != result.size(); ++bin )
119  {
120  result[bin] += (*apdShape())(binTime)*signal ;
121  binTime += BUNCHSPACE ;
122  }
123 }
double timeOfFlight(const DetId &detId) const
Main class for Parameters in different subdetectors.
const CaloSimParameters * params(const DetId &detId) const
double phaseShift() const
const VecD & offsets() const
Definition: EBHitResponse.h:67
CaloTSamplesBase< float > EcalSamples
bin
set the eta bin as selection string.
const double nonlFunc(double enr) const
Definition: EBHitResponse.h:69
static const double tzero[3]
EcalSamples * findSignal(const DetId &detId)
const CaloVShape * apdShape() const
void EBHitResponse::run ( MixCollection< PCaloHit > &  hits,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Reimplemented from EcalHitResponse.

Definition at line 251 of file EBHitResponse.cc.

References CaloVHitFilter::accepts(), apdParameters(), apdSignalAmplitude(), MixCollection< T >::begin(), EcalHitResponse::blankOutUsedSamples(), PCaloHit::depth(), EBDetId::detIdFromDenseIndex(), MixCollection< T >::end(), EcalHitResponse::hitFilter(), mps_fire::i, PCaloHit::id(), EcalHitResponse::index(), edm::isNotFinite(), PCaloHit::kEcalDepthIdMask, EBDetId::kSizeForDenseIndexing, m_apdNpeVec, m_apdOnly, m_apdTimeVec, EcalHitResponse::maxBunch(), EcalHitResponse::minBunch(), EcalHitResponse::putAnalogSignal(), putAPDSignal(), findQualityFiles::size, and PCaloHit::time().

252 {
253  if( 0 != index().size() ) blankOutUsedSamples() ;
254 
255  const unsigned int bSize ( EBDetId::kSizeForDenseIndexing ) ;
256 
257  if( 0 == m_apdNpeVec.size() )
258  {
259  m_apdNpeVec = std::vector<double>( bSize, (double)0.0 ) ;
260  m_apdTimeVec = std::vector<double>( bSize, (double)0.0 ) ;
261  }
262 
263  for( MixCollection<PCaloHit>::MixItr hitItr ( hits.begin() ) ;
264  hitItr != hits.end() ; ++hitItr )
265  {
266  const PCaloHit& hit ( *hitItr ) ;
267  const int bunch ( hitItr.bunch() ) ;
268  if( minBunch() <= bunch &&
269  maxBunch() >= bunch &&
270  !edm::isNotFinite( hit.time() ) &&
271  ( 0 == hitFilter() ||
272  hitFilter()->accepts( hit ) ) )
273  {
274  int iddepth = (hit.depth() & PCaloHit::kEcalDepthIdMask);
275  if( 0 == iddepth ) // for now take only nonAPD hits
276  {
277  if( !m_apdOnly ) putAnalogSignal( hit, engine ) ;
278  }
279  else // APD hits here
280  {
281  if( apdParameters()->addToBarrel() ||
282  m_apdOnly )
283  {
284  const unsigned int icell ( EBDetId( hit.id() ).denseIndex() ) ;
285  m_apdNpeVec[ icell ] += apdSignalAmplitude( hit, engine ) ;
286  if( 0 == m_apdTimeVec[ icell ] ) m_apdTimeVec[ icell ] = hit.time() ;
287  }
288  }
289  }
290  }
291 
292  if( apdParameters()->addToBarrel() ||
293  m_apdOnly )
294  {
295  for( unsigned int i ( 0 ) ; i != bSize ; ++i )
296  {
297  if( 0 < m_apdNpeVec[i] )
298  {
300  m_apdNpeVec[i] ,
301  m_apdTimeVec[i] ) ;
302 
303  // now zero out for next time
304  m_apdNpeVec[i] = 0. ;
305  m_apdTimeVec[i] = 0. ;
306  }
307  }
308  }
309 }
size
Write out results.
void putAPDSignal(const DetId &detId, double npe, double time)
virtual void putAnalogSignal(const PCaloHit &inputHit, CLHEP::HepRandomEngine *)
const APDSimParameters * apdParameters() const
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:111
virtual bool accepts(const PCaloHit &hit) const =0
bool isNotFinite(T x)
Definition: isFinite.h:10
const CaloVHitFilter * hitFilter() const
int maxBunch() const
double apdSignalAmplitude(const PCaloHit &hit, CLHEP::HepRandomEngine *) const
iterator end() const
int minBunch() const
unsigned int id
iterator begin() const
const bool m_apdOnly
Definition: EBHitResponse.h:88
std::vector< double > m_apdTimeVec
Definition: EBHitResponse.h:96
std::vector< double > m_apdNpeVec
Definition: EBHitResponse.h:95
static const int kEcalDepthIdMask
Definition: PCaloHit.h:67
unsigned int EBHitResponse::samplesSize ( ) const
overridevirtual

Implements EcalHitResponse.

Definition at line 312 of file EBHitResponse.cc.

References m_vSam.

313 {
314  return m_vSam.size() ;
315 }
std::vector< EBSamples > m_vSam
unsigned int EBHitResponse::samplesSizeAll ( ) const
overrideprotectedvirtual

Implements EcalHitResponse.

Definition at line 318 of file EBHitResponse.cc.

References m_vSam.

319 {
320  return m_vSam.size() ;
321 }
std::vector< EBSamples > m_vSam
void EBHitResponse::setIntercal ( const EcalIntercalibConstantsMC ical)

Definition at line 158 of file EBHitResponse.cc.

References m_intercal.

159 {
160  m_intercal = ical ;
161 }
const EcalIntercalibConstantsMC * m_intercal
Definition: EBHitResponse.h:91
EcalHitResponse::EcalSamples * EBHitResponse::vSam ( unsigned int  i)
overrideprotectedvirtual

Implements EcalHitResponse.

Definition at line 336 of file EBHitResponse.cc.

References mps_fire::i, and m_vSam.

337 {
338  return &m_vSam[ i ] ;
339 }
std::vector< EBSamples > m_vSam
EcalHitResponse::EcalSamples * EBHitResponse::vSamAll ( unsigned int  i)
overrideprotectedvirtual

Implements EcalHitResponse.

Definition at line 342 of file EBHitResponse.cc.

References mps_fire::i, and m_vSam.

343 {
344  return &m_vSam[ i ] ;
345 }
std::vector< EBSamples > m_vSam
const EcalHitResponse::EcalSamples * EBHitResponse::vSamAll ( unsigned int  i) const
overrideprotectedvirtual

Implements EcalHitResponse.

Definition at line 348 of file EBHitResponse.cc.

References mps_fire::i, and m_vSam.

349 {
350  return &m_vSam[ i ] ;
351 }
std::vector< EBSamples > m_vSam

Member Data Documentation

std::vector<double> EBHitResponse::m_apdNpeVec
private

Definition at line 95 of file EBHitResponse.h.

Referenced by add(), finalizeHits(), initializeHits(), and run().

const bool EBHitResponse::m_apdOnly
private

Definition at line 88 of file EBHitResponse.h.

Referenced by add(), apdSignalAmplitude(), finalizeHits(), and run().

const APDSimParameters* EBHitResponse::m_apdPars
private

Definition at line 89 of file EBHitResponse.h.

Referenced by apdParameters().

const CaloVShape* EBHitResponse::m_apdShape
private

Definition at line 90 of file EBHitResponse.h.

Referenced by apdShape().

std::vector<double> EBHitResponse::m_apdTimeVec
private

Definition at line 96 of file EBHitResponse.h.

Referenced by add(), finalizeHits(), initializeHits(), and run().

const EcalIntercalibConstantsMC* EBHitResponse::m_intercal
private

Definition at line 91 of file EBHitResponse.h.

Referenced by apdSignalAmplitude(), findIntercalibConstant(), and setIntercal().

bool EBHitResponse::m_isInitialized
private

Definition at line 102 of file EBHitResponse.h.

Referenced by initialize(), and putAPDSignal().

std::vector<double> EBHitResponse::m_timeOffVec
private

Definition at line 93 of file EBHitResponse.h.

Referenced by initialize().

std::vector<EBSamples> EBHitResponse::m_vSam
private

Definition at line 100 of file EBHitResponse.h.

Referenced by EBHitResponse(), operator[](), samplesSize(), samplesSizeAll(), vSam(), and vSamAll().

const double EBHitResponse::pasy
private

Definition at line 98 of file EBHitResponse.h.

const double EBHitResponse::pcon
private

Definition at line 98 of file EBHitResponse.h.

const double EBHitResponse::pcub
private

Definition at line 98 of file EBHitResponse.h.

const double EBHitResponse::pehi
private

Definition at line 98 of file EBHitResponse.h.

const double EBHitResponse::pelo
private

Definition at line 98 of file EBHitResponse.h.

const double EBHitResponse::pext
private

Definition at line 98 of file EBHitResponse.h.

const double EBHitResponse::pfac
private

Definition at line 98 of file EBHitResponse.h.

const double EBHitResponse::plin
private

Definition at line 98 of file EBHitResponse.h.

const double EBHitResponse::poff
private

Definition at line 98 of file EBHitResponse.h.

const double EBHitResponse::pqua
private

Definition at line 98 of file EBHitResponse.h.