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 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 ()
 
void initialize (CLHEP::HepRandomEngine *)
 
virtual void initializeHits ()
 
virtual bool keepBlank () const
 
virtual EcalSamplesoperator[] (unsigned int i)
 
virtual const EcalSamplesoperator[] (unsigned int i) const
 
virtual void run (MixCollection< PCaloHit > &hits, CLHEP::HepRandomEngine *) override
 
virtual unsigned int samplesSize () const
 
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
 
virtual EcalSamplesvSam (unsigned int i)
 
virtual EcalSamplesvSamAll (unsigned int i)
 
virtual const EcalSamplesvSamAll (unsigned int i) const
 
- Protected Member Functions inherited from EcalHitResponse
double analogSignalAmplitude (const DetId &id, float energy, CLHEP::HepRandomEngine *) const
 
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, Parameters::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
dictionary parameters
Definition: Parameters.py:2
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
#define M_PI
const double pasy
Definition: EBHitResponse.h:98
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 228 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().

229 {
230  if (!edm::isNotFinite( hit.time() ) && ( 0 == hitFilter() || hitFilter()->accepts( hit ) ) ) {
231  if( 0 == hit.depth() ) // for now take only nonAPD hits
232  {
233  if( !m_apdOnly ) putAnalogSignal( hit, engine ) ;
234  }
235  else // APD hits here
236  {
237  if( apdParameters()->addToBarrel() ||
238  m_apdOnly )
239  {
240  const unsigned int icell ( EBDetId( hit.id() ).denseIndex() ) ;
241  m_apdNpeVec[ icell ] += apdSignalAmplitude( hit, engine ) ;
242  if( 0 == m_apdTimeVec[ icell ] ) m_apdTimeVec[ icell ] = hit.time() ;
243  }
244  }
245  }
246 }
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 m_apdPars.

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

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

Definition at line 79 of file EBHitResponse.cc.

References m_apdShape.

Referenced by putAPDSignal().

80 {
81  assert( 0 != m_apdShape ) ;
82  return m_apdShape ;
83 }
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(), PCaloHit::depth(), PCaloHit::energy(), findIntercalibConstant(), PCaloHit::id(), m_apdOnly, m_intercal, APDSimParameters::simToPEHigh(), and APDSimParameters::simToPELow().

Referenced by add(), and run().

126 {
127  assert( 1 == hit.depth() ||
128  2 == hit.depth() ) ;
129 
130  double npe ( hit.energy()*( 2 == hit.depth() ?
132  apdParameters()->simToPEHigh() ) ) ;
133 
134  // do we need to do Poisson statistics for the photoelectrons?
135  if( apdParameters()->doPEStats() &&
136  !m_apdOnly ) {
137 
138  CLHEP::RandPoissonQ randPoissonQ(*engine, npe);
139  npe = randPoissonQ.fire();
140  }
141  assert( 0 != m_intercal ) ;
142  double fac ( 1 ) ;
143  findIntercalibConstant( hit.id(), fac ) ;
144 
145  npe *= fac ;
146 
147 // edm::LogError( "EBHitResponse" ) << "--- # photoelectrons for "
148 /* std::cout << "--- # photoelectrons for "
149  << EBDetId( hit.id() )
150  <<" is " << npe //;
151  <<std::endl ;*/
152 
153  return npe ;
154 }
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
void EBHitResponse::finalizeHits ( )
virtual

Reimplemented from EcalHitResponse.

Definition at line 206 of file EBHitResponse.cc.

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

206  {
207  const unsigned int bSize ( EBDetId::kSizeForDenseIndexing ) ;
208  if( apdParameters()->addToBarrel() ||
209  m_apdOnly )
210  {
211  for( unsigned int i ( 0 ) ; i != bSize ; ++i )
212  {
213  if( 0 < m_apdNpeVec[i] )
214  {
216  m_apdNpeVec[i] ,
217  m_apdTimeVec[i] ) ;
218 
219  // now zero out for next time
220  m_apdNpeVec[i] = 0. ;
221  m_apdTimeVec[i] = 0. ;
222  }
223  }
224  }
225 }
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 163 of file EBHitResponse.cc.

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

Referenced by apdSignalAmplitude().

165 {
166  EcalIntercalibConstantMC thisconst ( 1. ) ;
167 
168  if( 0 == m_intercal )
169  {
170  edm::LogError( "EBHitResponse" ) <<
171  "No intercal constant defined for EBHitResponse" ;
172  }
173  else
174  {
175  const EcalIntercalibConstantMCMap& icalMap ( m_intercal->getMap() ) ;
176  EcalIntercalibConstantMCMap::const_iterator icalit ( icalMap.find( detId ) ) ;
177  if( icalit != icalMap.end() )
178  {
179  thisconst = *icalit ;
180  if ( thisconst == 0. ) thisconst = 1. ;
181  }
182  else
183  {
184  edm::LogError("EBHitResponse") << "No intercalib const found for xtal "
185  << detId.rawId()
186  << "! something wrong with EcalIntercalibConstants in your DB? ";
187  }
188  }
189  icalconst = thisconst ;
190 }
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.

Referenced by EcalDigiProducer::beginLuminosityBlock().

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 ( )
virtual

Reimplemented from EcalHitResponse.

Definition at line 193 of file EBHitResponse.cc.

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

193  {
194  if( 0 != index().size() ) blankOutUsedSamples() ;
195 
196  const unsigned int bSize ( EBDetId::kSizeForDenseIndexing ) ;
197 
198  if( 0 == m_apdNpeVec.size() )
199  {
200  m_apdNpeVec = std::vector<double>( bSize, (double)0.0 ) ;
201  m_apdTimeVec = std::vector<double>( bSize, (double)0.0 ) ;
202  }
203 }
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)
virtual

Implements EcalHitResponse.

Definition at line 327 of file EBHitResponse.cc.

References i, and m_vSam.

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

Implements EcalHitResponse.

Definition at line 321 of file EBHitResponse.cc.

References i, and m_vSam.

322 {
323  return &m_vSam[ i ] ;
324 }
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, edm::hlt::Exception, EcalHitResponse::findSignal(), kNOffsets, m_isInitialized, nonlFunc(), offsets(), Parameters::parameters, EcalHitResponse::params(), EcalHitResponse::phaseShift(), query::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 }
dictionary parameters
Definition: Parameters.py:2
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
tuple result
Definition: query.py:137
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 249 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().

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

Implements EcalHitResponse.

Definition at line 309 of file EBHitResponse.cc.

References m_vSam.

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

Implements EcalHitResponse.

Definition at line 315 of file EBHitResponse.cc.

References m_vSam.

316 {
317  return m_vSam.size() ;
318 }
std::vector< EBSamples > m_vSam
void EBHitResponse::setIntercal ( const EcalIntercalibConstantsMC ical)

Definition at line 157 of file EBHitResponse.cc.

References m_intercal.

Referenced by EcalDigiProducer::checkCalibrations().

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

Implements EcalHitResponse.

Definition at line 333 of file EBHitResponse.cc.

References i, and m_vSam.

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

Implements EcalHitResponse.

Definition at line 339 of file EBHitResponse.cc.

References i, and m_vSam.

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

Implements EcalHitResponse.

Definition at line 345 of file EBHitResponse.cc.

References i, and m_vSam.

346 {
347  return &m_vSam[ i ] ;
348 }
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().