CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 15 of file EBHitResponse.cc.

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

19  :
20 
21  EcalHitResponse( parameterMap, shape ) ,
22 
23  m_apdOnly ( apdOnly ) ,
24  m_apdPars ( apdPars ) ,
25  m_apdShape ( apdShape ) ,
26  m_timeOffVec ( kNOffsets, apdParameters()->timeOffset() ) ,
27  pcub ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[0] ) ,
28  pqua ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[1] ) ,
29  plin ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[2] ) ,
30  pcon ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[3] ) ,
31  pelo ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[4] ) ,
32  pehi ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[5] ) ,
33  pasy ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[6] ) ,
34  pext ( 0 == apdPars ? 0 : nonlFunc1( pelo ) ) ,
35  poff ( 0 == apdPars ? 0 : nonlFunc1( pehi ) ) ,
36  pfac ( 0 == apdPars ? 0 : ( pasy - poff )*2./M_PI ),
37  m_isInitialized(false)
38 {
39  const EBDetId detId ( EBDetId::detIdFromDenseIndex( 0 ) ) ;
40  const CaloSimParameters& parameters ( parameterMap->simParameters( detId ) ) ;
41 
42  const unsigned int rSize ( parameters.readoutFrameSize() ) ;
43  const unsigned int nPre ( parameters.binOfMaximum() - 1 ) ;
44 
45  const unsigned int size ( EBDetId::kSizeForDenseIndexing ) ;
46 
47  m_vSam.reserve( size ) ;
48 
49  for( unsigned int i ( 0 ) ; i != size ; ++i )
50  {
51  m_vSam.emplace_back(CaloGenericDetId( detId.det(), detId.subdetId(), i ) ,
52  rSize, nPre );
53  }
54 }
int i
Definition: DBlmapReader.cc:9
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)
const double pelo
Definition: EBHitResponse.h:98
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
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
tuple size
Write out results.
const double pext
Definition: EBHitResponse.h:98
const double pqua
Definition: EBHitResponse.h:98
EBHitResponse::~EBHitResponse ( )
virtual

Definition at line 56 of file EBHitResponse.cc.

57 {
58 }

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(), 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  if( 0 == hit.depth() || hit.depth() >=100 ) // for now take only nonAPD hits
233  {
234  if( !m_apdOnly ) putAnalogSignal( hit, engine ) ;
235  }
236  else // APD hits here
237  {
238  if( apdParameters()->addToBarrel() ||
239  m_apdOnly )
240  {
241  const unsigned int icell ( EBDetId( hit.id() ).denseIndex() ) ;
242  m_apdNpeVec[ icell ] += apdSignalAmplitude( hit, engine ) ;
243  if( 0 == m_apdTimeVec[ icell ] ) m_apdTimeVec[ icell ] = hit.time() ;
244  }
245  }
246  }
247 }
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
bool isNotFinite(T x)
Definition: isFinite.h:10
const CaloVHitFilter * hitFilter() const
double apdSignalAmplitude(const PCaloHit &hit, CLHEP::HepRandomEngine *) const
virtual bool accepts(const PCaloHit &hit) const =0
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
const APDSimParameters * EBHitResponse::apdParameters ( ) const
private

Definition at line 72 of file EBHitResponse.cc.

References assert(), and m_apdPars.

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

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

Definition at line 79 of file EBHitResponse.cc.

References assert(), and m_apdShape.

Referenced by putAPDSignal().

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

Definition at line 125 of file EBHitResponse.cc.

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

Referenced by add(), and run().

126 {
127  // std::cout << "*** " << hit.depth() << std::endl;
128  assert( 1 == hit.depth() ||
129  2 == hit.depth() ) ;
130 
131  double npe ( hit.energy()*( 2 == hit.depth() ?
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
assert(m_qm.get())
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
void EBHitResponse::finalizeHits ( )
overridevirtual

Reimplemented from EcalHitResponse.

Definition at line 207 of file EBHitResponse.cc.

References apdParameters(), EBDetId::detIdFromDenseIndex(), 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 }
int i
Definition: DBlmapReader.cc:9
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 61 of file EBHitResponse.cc.

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

62 {
63  m_isInitialized = true;
64  for( unsigned int i ( 0 ) ; i != kNOffsets ; ++i )
65  {
66  m_timeOffVec[ i ] +=
67  CLHEP::RandGaussQ::shoot(engine, 0, apdParameters()->timeOffWidth() ) ;
68  }
69 }
int i
Definition: DBlmapReader.cc:9
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 }
tuple 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

Definition at line 34 of file EBHitResponse.h.

References edm::false.

34 { return false ; }
volatile std::atomic< bool > shutdown_flag false
const double EBHitResponse::nonlFunc ( double  enr) const
inlineprivate

Definition at line 69 of file EBHitResponse.h.

References nonlFunc1(), pehi, pelo, pext, pfac, and poff.

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.

References pcon, pcub, plin, and pqua.

Referenced by nonlFunc().

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.

References m_timeOffVec.

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 328 of file EBHitResponse.cc.

References i, and m_vSam.

329 {
330  return &m_vSam[ i ] ;
331 }
int i
Definition: DBlmapReader.cc:9
std::vector< EBSamples > m_vSam
const EcalHitResponse::EcalSamples * EBHitResponse::operator[] ( unsigned int  i) const
overridevirtual

Implements EcalHitResponse.

Definition at line 322 of file EBHitResponse.cc.

References i, and m_vSam.

323 {
324  return &m_vSam[ i ] ;
325 }
int i
Definition: DBlmapReader.cc:9
std::vector< EBSamples > m_vSam
void EBHitResponse::putAPDSignal ( const DetId detId,
double  npe,
double  time 
)
protected

Definition at line 86 of file EBHitResponse.cc.

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

Referenced by finalizeHits(), and run().

89 {
90  const CaloSimParameters& parameters ( *params( detId ) ) ;
91 
92  const double energyFac ( 1./parameters.simHitToPhotoelectrons( detId ) ) ;
93 
94 // std::cout<<"******** Input APD Npe="<<npe<<", Efactor="<<energyFac
95 // <<", Energy="<<npe*energyFac
96 // <<", nonlFunc="<<nonlFunc( npe*energyFac )<<std::endl ;
97 
98  const double signal ( npe*nonlFunc( npe*energyFac ) ) ;
99 
100  const double jitter ( time - timeOfFlight( detId ) ) ;
101 
102  if(!m_isInitialized) {
103  throw cms::Exception("LogicError")
104  << "EBHitResponse::putAPDSignal called without initializing\n";
105  }
106 
107  const double tzero ( apdShape()->timeToRise()
108  - jitter
109  - offsets()[ EBDetId( detId ).denseIndex()%kNOffsets ]
110  - BUNCHSPACE*( parameters.binOfMaximum()
111  - phaseShift() ) ) ;
112 
113  double binTime ( tzero ) ;
114 
115  EcalSamples& result ( *findSignal( detId ) );
116 
117  for( unsigned int bin ( 0 ) ; bin != result.size(); ++bin )
118  {
119  result[bin] += (*apdShape())(binTime)*signal ;
120  binTime += BUNCHSPACE ;
121  }
122 }
double timeOfFlight(const DetId &detId) const
Main class for Parameters in different subdetectors.
const CaloSimParameters * params(const DetId &detId) const
tuple result
Definition: mps_fire.py:84
double phaseShift() const
const VecD & offsets() const
Definition: EBHitResponse.h:67
CaloTSamplesBase< float > EcalSamples
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 250 of file EBHitResponse.cc.

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

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

Implements EcalHitResponse.

Definition at line 310 of file EBHitResponse.cc.

References m_vSam.

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

Implements EcalHitResponse.

Definition at line 316 of file EBHitResponse.cc.

References m_vSam.

317 {
318  return m_vSam.size() ;
319 }
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 334 of file EBHitResponse.cc.

References i, and m_vSam.

335 {
336  return &m_vSam[ i ] ;
337 }
int i
Definition: DBlmapReader.cc:9
std::vector< EBSamples > m_vSam
EcalHitResponse::EcalSamples * EBHitResponse::vSamAll ( unsigned int  i)
overrideprotectedvirtual

Implements EcalHitResponse.

Definition at line 340 of file EBHitResponse.cc.

References i, and m_vSam.

341 {
342  return &m_vSam[ i ] ;
343 }
int i
Definition: DBlmapReader.cc:9
std::vector< EBSamples > m_vSam
const EcalHitResponse::EcalSamples * EBHitResponse::vSamAll ( unsigned int  i) const
overrideprotectedvirtual

Implements EcalHitResponse.

Definition at line 346 of file EBHitResponse.cc.

References i, and m_vSam.

347 {
348  return &m_vSam[ i ] ;
349 }
int i
Definition: DBlmapReader.cc:9
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(), and offsets().

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.

Referenced by nonlFunc1().

const double EBHitResponse::pcub
private

Definition at line 98 of file EBHitResponse.h.

Referenced by nonlFunc1().

const double EBHitResponse::pehi
private

Definition at line 98 of file EBHitResponse.h.

Referenced by nonlFunc().

const double EBHitResponse::pelo
private

Definition at line 98 of file EBHitResponse.h.

Referenced by nonlFunc().

const double EBHitResponse::pext
private

Definition at line 98 of file EBHitResponse.h.

Referenced by nonlFunc().

const double EBHitResponse::pfac
private

Definition at line 98 of file EBHitResponse.h.

Referenced by nonlFunc().

const double EBHitResponse::plin
private

Definition at line 98 of file EBHitResponse.h.

Referenced by nonlFunc1().

const double EBHitResponse::poff
private

Definition at line 98 of file EBHitResponse.h.

Referenced by nonlFunc().

const double EBHitResponse::pqua
private

Definition at line 98 of file EBHitResponse.h.

Referenced by nonlFunc1().