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 Attributes
CaloHitRespoNew Class Reference

Creates electronics signals from hits. More...

#include <CaloHitRespoNew.h>

Public Types

enum  { BUNCHSPACE =25 }
 
typedef std::vector< unsigned int > VecInd
 
typedef std::vector< CaloSamplesVecSam
 

Public Member Functions

virtual void add (const PCaloHit &hit, CLHEP::HepRandomEngine *)
 
 CaloHitRespoNew (const CaloVSimParameterMap *parameterMap, const CaloVShape *shape, const DetId detId)
 
virtual void finalizeHits ()
 
virtual void initializeHits ()
 
const CaloSamplesoperator[] (unsigned int i) const
 
virtual void run (MixCollection< PCaloHit > &hits, CLHEP::HepRandomEngine *)
 
unsigned int samplesSize () const
 
void setBunchRange (int minBunch, int maxBunch)
 
void setGeometry (const CaloSubdetectorGeometry *geometry)
 
void setHitCorrection (const CaloVHitCorrection *hitCorrection)
 
void setHitFilter (const CaloVHitFilter *filter)
 
void setPECorrection (const CaloVPECorrection *peCorrection)
 
void setPhaseShift (double phaseShift)
 
bool withinBunchRange (int bunchCrossing) const
 
virtual ~CaloHitRespoNew ()
 

Protected Member Functions

double analogSignalAmplitude (const DetId &id, float energy, CLHEP::HepRandomEngine *) const
 
void blankOutUsedSamples ()
 
CaloSamplesfindSignal (const DetId &detId)
 
const CaloSubdetectorGeometrygeometry () const
 
const CaloVHitFilterhitFilter () const
 
VecIndindex ()
 
int maxBunch () const
 
int minBunch () const
 
const CaloSimParametersparams (const DetId &detId) const
 
double phaseShift () const
 
virtual void putAnalogSignal (const PCaloHit &inputHit, CLHEP::HepRandomEngine *)
 
void setupSamples (const DetId &detId)
 
const CaloVShapeshape () const
 
double timeOfFlight (const DetId &detId) const
 

Private Attributes

const CaloSubdetectorGeometrym_geometry
 
const CaloVHitCorrectionm_hitCorrection
 
const CaloVHitFilterm_hitFilter
 
VecInd m_index
 
int m_maxBunch
 
int m_minBunch
 
const CaloVSimParameterMapm_parameterMap
 
const CaloVPECorrectionm_PECorrection
 
double m_phaseShift
 
const CaloVShapem_shape
 
VecSam m_vSamp
 

Detailed Description

Creates electronics signals from hits.

Definition at line 32 of file CaloHitRespoNew.h.

Member Typedef Documentation

typedef std::vector< unsigned int > CaloHitRespoNew::VecInd

Definition at line 37 of file CaloHitRespoNew.h.

typedef std::vector< CaloSamples > CaloHitRespoNew::VecSam

Definition at line 36 of file CaloHitRespoNew.h.

Member Enumeration Documentation

anonymous enum
Enumerator
BUNCHSPACE 

Definition at line 39 of file CaloHitRespoNew.h.

Constructor & Destructor Documentation

CaloHitRespoNew::CaloHitRespoNew ( const CaloVSimParameterMap parameterMap,
const CaloVShape shape,
const DetId  detId 
)

Definition at line 20 of file CaloHitRespoNew.cc.

References setupSamples().

22  :
23  m_parameterMap ( parameterMap ) ,
24  m_shape ( shape ) ,
25  m_hitCorrection ( 0 ) ,
26  m_PECorrection ( 0 ) ,
27  m_hitFilter ( 0 ) ,
28  m_geometry ( 0 ) ,
29  m_minBunch ( -10 ) ,
30  m_maxBunch ( 10 ) ,
31  m_phaseShift ( 1 )
32 {
33  setupSamples( detId ) ;
34 }
void setupSamples(const DetId &detId)
const CaloVPECorrection * m_PECorrection
const CaloVSimParameterMap * m_parameterMap
const CaloSubdetectorGeometry * m_geometry
const CaloVShape * m_shape
const CaloVHitCorrection * m_hitCorrection
const CaloVHitFilter * m_hitFilter
CaloHitRespoNew::~CaloHitRespoNew ( )
virtual

Definition at line 36 of file CaloHitRespoNew.cc.

37 {
38 }

Member Function Documentation

void CaloHitRespoNew::add ( const PCaloHit hit,
CLHEP::HepRandomEngine *  engine 
)
virtual

Definition at line 167 of file CaloHitRespoNew.cc.

References CaloVHitFilter::accepts(), edm::isNotFinite(), m_hitFilter, putAnalogSignal(), and PCaloHit::time().

Referenced by counter.Counter::register(), and run().

168 {
169  if( !edm::isNotFinite( hit.time() ) &&
170  ( 0 == m_hitFilter ||
171  m_hitFilter->accepts( hit ) ) ) putAnalogSignal( hit, engine ) ;
172 }
double time() const
Definition: PCaloHit.h:36
bool isNotFinite(T x)
Definition: isFinite.h:10
virtual bool accepts(const PCaloHit &hit) const =0
virtual void putAnalogSignal(const PCaloHit &inputHit, CLHEP::HepRandomEngine *)
const CaloVHitFilter * m_hitFilter
double CaloHitRespoNew::analogSignalAmplitude ( const DetId id,
float  energy,
CLHEP::HepRandomEngine *  engine 
) const
protected

Definition at line 218 of file CaloHitRespoNew.cc.

References CaloVPECorrection::correctPE(), CaloSimParameters::doPhotostatistics(), m_PECorrection, Parameters::parameters, params(), and CaloSimParameters::simHitToPhotoelectrons().

Referenced by putAnalogSignal().

219 {
220  const CaloSimParameters& parameters ( *params( detId ) ) ;
221 
222  // OK, the "energy" in the hit could be a real energy, deposited energy,
223  // or pe count. This factor converts to photoelectrons
224 
225  double npe ( energy*parameters.simHitToPhotoelectrons( detId ) ) ;
226 
227  // do we need to doPoisson statistics for the photoelectrons?
228  if( parameters.doPhotostatistics() ) {
229  CLHEP::RandPoissonQ randPoissonQ(*engine, npe);
230  npe = randPoissonQ.fire();
231  }
232 
233  if( 0 != m_PECorrection ) npe = m_PECorrection->correctPE( detId, npe, engine ) ;
234 
235  return npe ;
236 }
dictionary parameters
Definition: Parameters.py:2
const CaloVPECorrection * m_PECorrection
Main class for Parameters in different subdetectors.
virtual double correctPE(const DetId &detId, double npe, CLHEP::HepRandomEngine *) const =0
const CaloSimParameters * params(const DetId &detId) const
void CaloHitRespoNew::blankOutUsedSamples ( )
protected

Definition at line 139 of file CaloHitRespoNew.cc.

References i, m_index, m_vSamp, and findQualityFiles::size.

Referenced by run().

140 {
141  const unsigned int size ( m_index.size() ) ;
142 
143  for( unsigned int i ( 0 ) ; i != size ; ++i )
144  {
145  m_vSamp[ m_index[i] ].setBlank() ;
146  }
147  m_index.erase( m_index.begin() , // done and make ready to start over
148  m_index.end() ) ;
149 }
int i
Definition: DBlmapReader.cc:9
tuple size
Write out results.
virtual void CaloHitRespoNew::finalizeHits ( )
inlinevirtual

Definition at line 70 of file CaloHitRespoNew.h.

70 {}
CaloSamples * CaloHitRespoNew::findSignal ( const DetId detId)
protected

Definition at line 210 of file CaloHitRespoNew.cc.

References CaloSamples::isBlank(), m_index, m_vSamp, and query::result.

Referenced by putAnalogSignal().

211 {
212  CaloSamples& result ( m_vSamp[ CaloGenericDetId( detId ).denseIndex() ] ) ;
213  if( result.isBlank() ) m_index.push_back( &result - &m_vSamp.front() ) ;
214  return &result ;
215 }
tuple result
Definition: query.py:137
const CaloSubdetectorGeometry * CaloHitRespoNew::geometry ( ) const
protected

Definition at line 55 of file CaloHitRespoNew.cc.

References assert(), and m_geometry.

Referenced by Vispa.Gui.ConnectableWidget.ConnectableWidget::leaveEvent(), setGeometry(), and timeOfFlight().

56 {
57  assert( 0 != m_geometry ) ;
58  return m_geometry ;
59 }
assert(m_qm.get())
const CaloSubdetectorGeometry * m_geometry
const CaloVHitFilter* CaloHitRespoNew::hitFilter ( ) const
inlineprotected

Definition at line 105 of file CaloHitRespoNew.h.

References m_hitFilter.

105 { return m_hitFilter ; }
const CaloVHitFilter * m_hitFilter
VecInd& CaloHitRespoNew::index ( )
inlineprotected

Definition at line 103 of file CaloHitRespoNew.h.

References m_index.

Referenced by BeautifulSoup.PageElement::_invert().

103 { return m_index ; }
virtual void CaloHitRespoNew::initializeHits ( )
inlinevirtual

Definition at line 68 of file CaloHitRespoNew.h.

68 {}
int CaloHitRespoNew::maxBunch ( ) const
inlineprotected

Definition at line 101 of file CaloHitRespoNew.h.

References m_maxBunch.

Referenced by setBunchRange().

101 { return m_maxBunch ; }
int CaloHitRespoNew::minBunch ( ) const
inlineprotected

Definition at line 99 of file CaloHitRespoNew.h.

References m_minBunch.

Referenced by setBunchRange().

99 { return m_minBunch ; }
const CaloSamples & CaloHitRespoNew::operator[] ( unsigned int  i) const

Definition at line 106 of file CaloHitRespoNew.cc.

References assert(), i, and m_vSamp.

107 {
108  assert( i < m_vSamp.size() ) ;
109  return m_vSamp[ i ] ;
110 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
const CaloSimParameters * CaloHitRespoNew::params ( const DetId detId) const
protected

Definition at line 41 of file CaloHitRespoNew.cc.

References assert(), m_parameterMap, and CaloVSimParameterMap::simParameters().

Referenced by analogSignalAmplitude(), putAnalogSignal(), and setupSamples().

42 {
43  assert( 0 != m_parameterMap ) ;
44  return &m_parameterMap->simParameters( detId ) ;
45 }
assert(m_qm.get())
const CaloVSimParameterMap * m_parameterMap
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
double CaloHitRespoNew::phaseShift ( ) const
protected

Definition at line 82 of file CaloHitRespoNew.cc.

References m_phaseShift.

Referenced by setPhaseShift().

83 {
84  return m_phaseShift ;
85 }
void CaloHitRespoNew::putAnalogSignal ( const PCaloHit inputHit,
CLHEP::HepRandomEngine *  engine 
)
protectedvirtual

Definition at line 175 of file CaloHitRespoNew.cc.

References analogSignalAmplitude(), newFWLiteAna::bin, BUNCHSPACE, CaloVHitCorrection::delay(), PCaloHit::energy(), findSignal(), PCaloHit::id(), m_hitCorrection, m_phaseShift, Parameters::parameters, params(), query::result, shape(), CaloSamples::size(), PCaloHit::time(), cond::rpcobgas::time, timeOfFlight(), CaloVShape::timeToRise(), and tzero.

Referenced by add().

176 {
177  const DetId detId ( hit.id() ) ;
178 
179  const CaloSimParameters* parameters ( params( detId ) ) ;
180 
181  const double signal ( analogSignalAmplitude( detId, hit.energy(), engine ) ) ;
182 
183  double time = hit.time();
184 
185  if( m_hitCorrection ) {
186  time += m_hitCorrection->delay( hit, engine ) ;
187  }
188 
189  const double jitter ( time - timeOfFlight( detId ) ) ;
190 
191  const double tzero = ( shape()->timeToRise()
192  + parameters->timePhase()
193  - jitter
194  - BUNCHSPACE*( parameters->binOfMaximum()
195  - m_phaseShift ) ) ;
196  double binTime ( tzero ) ;
197 
198  CaloSamples& result ( *findSignal( detId ) ) ;
199 
200  const unsigned int rsize ( result.size() ) ;
201 
202  for( unsigned int bin ( 0 ) ; bin != rsize ; ++bin )
203  {
204  result[ bin ] += (*shape())( binTime )*signal ;
205  binTime += BUNCHSPACE;
206  }
207 }
dictionary parameters
Definition: Parameters.py:2
double analogSignalAmplitude(const DetId &id, float energy, CLHEP::HepRandomEngine *) const
double timeOfFlight(const DetId &detId) const
const CaloVShape * shape() const
Main class for Parameters in different subdetectors.
CaloSamples * findSignal(const DetId &detId)
tuple result
Definition: query.py:137
virtual double timeToRise() const =0
virtual double delay(const PCaloHit &hit, CLHEP::HepRandomEngine *) const =0
unsigned int id
Definition: DetId.h:18
const CaloSimParameters * params(const DetId &detId) const
static const double tzero[3]
const CaloVHitCorrection * m_hitCorrection
void CaloHitRespoNew::run ( MixCollection< PCaloHit > &  hits,
CLHEP::HepRandomEngine *  engine 
)
virtual

Definition at line 152 of file CaloHitRespoNew.cc.

References add(), MixCollection< T >::begin(), blankOutUsedSamples(), MixCollection< T >::end(), m_index, and withinBunchRange().

153 {
154  if( 0 != m_index.size() ) blankOutUsedSamples() ;
155 
156  for( MixCollection<PCaloHit>::MixItr hitItr ( hits.begin() ) ;
157  hitItr != hits.end() ; ++hitItr )
158  {
159  if(withinBunchRange(hitItr.bunch())) {
160  add(*hitItr, engine);
161  }
162 
163  }
164 }
virtual void add(const PCaloHit &hit, CLHEP::HepRandomEngine *)
bool withinBunchRange(int bunchCrossing) const
iterator end()
iterator begin()
unsigned int CaloHitRespoNew::samplesSize ( ) const

Definition at line 113 of file CaloHitRespoNew.cc.

References m_vSamp.

114 {
115  return m_vSamp.size() ;
116 }
void CaloHitRespoNew::setBunchRange ( int  minBunch,
int  maxBunch 
)

Definition at line 62 of file CaloHitRespoNew.cc.

References m_maxBunch, m_minBunch, maxBunch(), and minBunch().

64 {
67 }
int maxBunch() const
int minBunch() const
void CaloHitRespoNew::setGeometry ( const CaloSubdetectorGeometry geometry)

Definition at line 70 of file CaloHitRespoNew.cc.

References geometry(), and m_geometry.

71 {
73 }
const CaloSubdetectorGeometry * geometry() const
const CaloSubdetectorGeometry * m_geometry
void CaloHitRespoNew::setHitCorrection ( const CaloVHitCorrection hitCorrection)

Definition at line 94 of file CaloHitRespoNew.cc.

References m_hitCorrection.

95 {
96  m_hitCorrection = hitCorrection ;
97 }
const CaloVHitCorrection * m_hitCorrection
void CaloHitRespoNew::setHitFilter ( const CaloVHitFilter filter)

Definition at line 88 of file CaloHitRespoNew.cc.

References alcazmumu_cfi::filter, and m_hitFilter.

89 {
91 }
const CaloVHitFilter * m_hitFilter
void CaloHitRespoNew::setPECorrection ( const CaloVPECorrection peCorrection)

Definition at line 100 of file CaloHitRespoNew.cc.

References m_PECorrection.

101 {
102  m_PECorrection = peCorrection ;
103 }
const CaloVPECorrection * m_PECorrection
void CaloHitRespoNew::setPhaseShift ( double  phaseShift)

Definition at line 76 of file CaloHitRespoNew.cc.

References m_phaseShift, and phaseShift().

77 {
79 }
double phaseShift() const
void CaloHitRespoNew::setupSamples ( const DetId detId)
protected

Definition at line 119 of file CaloHitRespoNew.cc.

References CaloSimParameters::binOfMaximum(), DetId::det(), i, m_vSamp, Parameters::parameters, params(), CaloSimParameters::readoutFrameSize(), findQualityFiles::size, and DetId::subdetId().

Referenced by CaloHitRespoNew().

120 {
121  const CaloSimParameters& parameters ( *params( detId ) ) ;
122 
123  const unsigned int rSize ( parameters.readoutFrameSize() ) ;
124  const unsigned int nPre ( parameters.binOfMaximum() - 1 ) ;
125 
126  m_vSamp = VecSam( CaloGenericDetId( detId ).sizeForDenseIndexing() ) ;
127 
128  const unsigned int size ( m_vSamp.size() ) ;
129 
130  for( unsigned int i ( 0 ) ; i != size ; ++i )
131  {
132  m_vSamp[ i ].setDetId( CaloGenericDetId( detId.det(), detId.subdetId(), i ) ) ;
133  m_vSamp[ i ].setSize( rSize ) ;
134  m_vSamp[ i ].setPresamples( nPre ) ;
135  }
136 }
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
Main class for Parameters in different subdetectors.
std::vector< CaloSamples > VecSam
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
const CaloSimParameters * params(const DetId &detId) const
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
tuple size
Write out results.
const CaloVShape * CaloHitRespoNew::shape ( void  ) const
protected

Definition at line 48 of file CaloHitRespoNew.cc.

References assert(), and m_shape.

Referenced by putAnalogSignal().

49 {
50  assert( 0 != m_shape ) ;
51  return m_shape ;
52 }
assert(m_qm.get())
const CaloVShape * m_shape
double CaloHitRespoNew::timeOfFlight ( const DetId detId) const
protected

Definition at line 239 of file CaloHitRespoNew.cc.

References assert(), geometry(), ecaldqm::getGeometry(), CaloCellGeometry::getPosition(), and PV3DBase< T, PVType, FrameType >::mag().

Referenced by putAnalogSignal().

240 {
241  const CaloCellGeometry* cellGeometry ( geometry()->getGeometry( detId ) ) ;
242  assert( 0 != cellGeometry ) ;
243  return cellGeometry->getPosition().mag()*cm/c_light ; // Units of c_light: mm/ns
244 }
assert(m_qm.get())
CaloGeometry const * getGeometry()
const CaloSubdetectorGeometry * geometry() const
bool CaloHitRespoNew::withinBunchRange ( int  bunchCrossing) const
inline

Definition at line 72 of file CaloHitRespoNew.h.

References m_maxBunch, and m_minBunch.

Referenced by run().

72  {
73  return(bunchCrossing >= m_minBunch && bunchCrossing <= m_maxBunch);
74  }

Member Data Documentation

const CaloSubdetectorGeometry* CaloHitRespoNew::m_geometry
private

Definition at line 114 of file CaloHitRespoNew.h.

Referenced by geometry(), and setGeometry().

const CaloVHitCorrection* CaloHitRespoNew::m_hitCorrection
private

Definition at line 111 of file CaloHitRespoNew.h.

Referenced by putAnalogSignal(), and setHitCorrection().

const CaloVHitFilter* CaloHitRespoNew::m_hitFilter
private

Definition at line 113 of file CaloHitRespoNew.h.

Referenced by add(), hitFilter(), and setHitFilter().

VecInd CaloHitRespoNew::m_index
private

Definition at line 121 of file CaloHitRespoNew.h.

Referenced by blankOutUsedSamples(), findSignal(), index(), and run().

int CaloHitRespoNew::m_maxBunch
private

Definition at line 117 of file CaloHitRespoNew.h.

Referenced by maxBunch(), setBunchRange(), and withinBunchRange().

int CaloHitRespoNew::m_minBunch
private

Definition at line 116 of file CaloHitRespoNew.h.

Referenced by minBunch(), setBunchRange(), and withinBunchRange().

const CaloVSimParameterMap* CaloHitRespoNew::m_parameterMap
private

Definition at line 109 of file CaloHitRespoNew.h.

Referenced by params().

const CaloVPECorrection* CaloHitRespoNew::m_PECorrection
private

Definition at line 112 of file CaloHitRespoNew.h.

Referenced by analogSignalAmplitude(), and setPECorrection().

double CaloHitRespoNew::m_phaseShift
private

Definition at line 118 of file CaloHitRespoNew.h.

Referenced by phaseShift(), putAnalogSignal(), and setPhaseShift().

const CaloVShape* CaloHitRespoNew::m_shape
private

Definition at line 110 of file CaloHitRespoNew.h.

Referenced by shape().

VecSam CaloHitRespoNew::m_vSamp
private