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

Creates electronics signals from hits. More...

#include <CaloHitResponse.h>

Inheritance diagram for CaloHitResponse:
HcalSiPMHitResponse

Public Types

enum  { BUNCHSPACE =25 }
 
typedef std::map< DetId,
CaloSamples
AnalogSignalMap
 

Public Member Functions

virtual void add (const PCaloHit &hit)
 process a single SimHit More...
 
void add (const CaloSamples &signal)
 add a signal, in units of pe More...
 
void addHit (const PCaloHit *hit, CaloSamples &frame) const
 adds the amplitude for a single hit to the frame More...
 
double analogSignalAmplitude (const DetId &id, float energy, const CaloSimParameters &parameters) const
 
 CaloHitResponse (const CaloVSimParameterMap *parameterMap, const CaloVShape *shape)
 
 CaloHitResponse (const CaloVSimParameterMap *parameterMap, const CaloShapes *shapes)
 
void clear ()
 frees up memory More...
 
virtual void finalizeHits ()
 Finalize hits. More...
 
CaloSamplesfindSignal (const DetId &detId)
 users can look for the signal for a given cell More...
 
void initHBHEScale ()
 
virtual void initializeHits ()
 Initialize hits. More...
 
virtual bool keepBlank () const
 
virtual CaloSamples makeAnalogSignal (const PCaloHit &inputHit) const
 creates the signal corresponding to this hit More...
 
CaloSamples makeBlankSignal (const DetId &detId) const
 creates an empty signal for this DetId More...
 
int nSignals () const
 number of signals in the current cache More...
 
virtual void run (MixCollection< PCaloHit > &hits)
 Complete cell digitization. More...
 
void setBunchRange (int minBunch, int maxBunch)
 tells it which pileup bunches to do More...
 
void setGeometry (const CaloGeometry *geometry)
 geometry needed for time-of-flight More...
 
void setHBHEScale (std::string &)
 
void setHitCorrection (const CaloVHitCorrection *hitCorrection)
 If you want to correct hits, for attenuation or delay, set this. More...
 
void setHitFilter (const CaloVHitFilter *filter)
 if you want to reject hits, for example, from a certain subdetector, set this More...
 
void setPECorrection (const CaloVPECorrection *peCorrection)
 if you want to correct the photoelectrons More...
 
void setPhaseShift (const double &thePhaseShift)
 setting the phase shift for asynchronous trigger (e.g. test beams) More...
 
virtual void setRandomEngine (CLHEP::HepRandomEngine &engine)
 
double timeOfFlight (const DetId &detId) const
 
bool withinBunchRange (int bunchCrossing) const
 check if crossing is within bunch range: More...
 
virtual ~CaloHitResponse ()
 doesn't delete the pointers passed in More...
 

Protected Attributes

bool changeScale
 
float hcal_en_scale [100][72][4]
 
AnalogSignalMap theAnalogSignalMap
 
const CaloGeometrytheGeometry
 
const CaloVHitCorrectiontheHitCorrection
 
const CaloVHitFiltertheHitFilter
 
int theMaxBunch
 
int theMinBunch
 
const CaloVSimParameterMaptheParameterMap
 
const CaloVPECorrectionthePECorrection
 
double thePhaseShift_
 
CLHEP::RandPoissonQ * theRandPoisson
 
const CaloVShapetheShape
 
const CaloShapestheShapes
 

Detailed Description

Creates electronics signals from hits.

Definition at line 31 of file CaloHitResponse.h.

Member Typedef Documentation

Definition at line 34 of file CaloHitResponse.h.

Member Enumeration Documentation

anonymous enum
Enumerator
BUNCHSPACE 

Definition at line 36 of file CaloHitResponse.h.

Constructor & Destructor Documentation

CaloHitResponse::CaloHitResponse ( const CaloVSimParameterMap parameterMap,
const CaloVShape shape 
)

Definition at line 25 of file CaloHitResponse.cc.

28  theParameterMap(parametersMap),
29  theShapes(0),
30  theShape(shape),
32  thePECorrection(0),
33  theHitFilter(0),
34  theGeometry(0),
35  theRandPoisson(0),
36  theMinBunch(-10),
37  theMaxBunch(10),
38  thePhaseShift_(1.),
39  changeScale(false) {}
CLHEP::RandPoissonQ * theRandPoisson
const CaloGeometry * theGeometry
const CaloVPECorrection * thePECorrection
const CaloVHitCorrection * theHitCorrection
AnalogSignalMap theAnalogSignalMap
const CaloShapes * theShapes
const CaloVSimParameterMap * theParameterMap
const CaloVHitFilter * theHitFilter
const CaloVShape * theShape
CaloHitResponse::CaloHitResponse ( const CaloVSimParameterMap parameterMap,
const CaloShapes shapes 
)

Definition at line 41 of file CaloHitResponse.cc.

44  theParameterMap(parametersMap),
45  theShapes(shapes),
46  theShape(0),
48  thePECorrection(0),
49  theHitFilter(0),
50  theGeometry(0),
51  theRandPoisson(0),
52  theMinBunch(-10),
53  theMaxBunch(10),
54  thePhaseShift_(1.),
55  changeScale(false) {}
CLHEP::RandPoissonQ * theRandPoisson
const CaloGeometry * theGeometry
const CaloVPECorrection * thePECorrection
const CaloVHitCorrection * theHitCorrection
AnalogSignalMap theAnalogSignalMap
const CaloShapes * theShapes
const CaloVSimParameterMap * theParameterMap
const CaloVHitFilter * theHitFilter
const CaloVShape * theShape
CaloHitResponse::~CaloHitResponse ( )
virtual

doesn't delete the pointers passed in

Definition at line 57 of file CaloHitResponse.cc.

References theRandPoisson.

57  {
58  delete theRandPoisson;
59 }
CLHEP::RandPoissonQ * theRandPoisson

Member Function Documentation

void CaloHitResponse::add ( const PCaloHit hit)
virtual

process a single SimHit

Reimplemented in HcalSiPMHitResponse.

Definition at line 116 of file CaloHitResponse.cc.

References CaloVHitFilter::accepts(), i, edm::isNotFinite(), keep, keepBlank(), LogDebug, makeAnalogSignal(), CaloSamples::size(), findQualityFiles::size, theHitFilter, and PCaloHit::time().

Referenced by CaloTDigitizer< Traits >::add(), CaloTDigitizer< Traits >::addNoiseHits(), CaloTDigitizer< Traits >::addNoiseSignals(), and run().

116  {
117  // check the hit time makes sense
118  if ( edm::isNotFinite(hit.time()) ) { return; }
119 
120  // maybe it's not from this subdetector
121  if(theHitFilter == 0 || theHitFilter->accepts(hit)) {
122  LogDebug("CaloHitResponse") << hit;
123  CaloSamples signal( makeAnalogSignal( hit ) ) ;
124 
125  bool keep ( keepBlank() ) ; // here we check for blank signal if not keeping them
126  if( !keep )
127  {
128  const unsigned int size ( signal.size() ) ;
129  if( 0 != size )
130  {
131  for( unsigned int i ( 0 ) ; i != size ; ++i )
132  {
133  keep = keep || signal[i] > 1.e-7 ;
134  }
135  }
136  }
137 
138 
139  // std::cout << "CaloHitResponse " << signal << std::endl;
140  if( keep ) add(signal);
141  }
142 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
double time() const
Definition: PCaloHit.h:36
virtual CaloSamples makeAnalogSignal(const PCaloHit &inputHit) const
creates the signal corresponding to this hit
virtual bool keepBlank() const
const int keep
bool isNotFinite(T x)
Definition: isFinite.h:10
virtual void add(const PCaloHit &hit)
process a single SimHit
virtual bool accepts(const PCaloHit &hit) const =0
const CaloVHitFilter * theHitFilter
tuple size
Write out results.
void CaloHitResponse::add ( const CaloSamples signal)

add a signal, in units of pe

Definition at line 145 of file CaloHitResponse.cc.

References findSignal(), i, CaloSamples::id(), CaloSamples::presamples(), CaloSamples::size(), and theAnalogSignalMap.

146 {
147  DetId id(signal.id());
148  CaloSamples * oldSignal = findSignal(id);
149  if (oldSignal == 0) {
150  theAnalogSignalMap[id] = signal;
151  //std::cout << "CaloHitResponseAdd " << signal << std::endl;
152 
153  } else {
154  // need a "+=" to CaloSamples
155  int sampleSize = oldSignal->size();
156  assert(sampleSize == signal.size());
157  assert(signal.presamples() == oldSignal->presamples());
158 
159  for(int i = 0; i < sampleSize; ++i) {
160  (*oldSignal)[i] += signal[i];
161  }
162  //std::cout << "CaloHitResponseAdd " << (*oldSignal) << std::endl;
163  }
164 }
int i
Definition: DBlmapReader.cc:9
int presamples() const
access presample information
Definition: CaloSamples.h:36
AnalogSignalMap theAnalogSignalMap
Definition: DetId.h:18
int size() const
get the size
Definition: CaloSamples.h:24
CaloSamples * findSignal(const DetId &detId)
users can look for the signal for a given cell
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
void CaloHitResponse::addHit ( const PCaloHit hit,
CaloSamples frame 
) const

adds the amplitude for a single hit to the frame

double CaloHitResponse::analogSignalAmplitude ( const DetId id,
float  energy,
const CaloSimParameters parameters 
) const

finds the amplitude contribution from this hit, applying photostatistics, if needed. Results are in photoelectrons

Definition at line 202 of file CaloHitResponse.cc.

References changeScale, CaloVPECorrection::correctPE(), HcalDetId::depth(), DetId::det(), CaloSimParameters::doPhotostatistics(), edm::hlt::Exception, edm::RandomNumberGenerator::getEngine(), DetId::Hcal, hcal_en_scale, HcalBarrel, HcalEndcap, HcalDetId::ieta(), HcalDetId::iphi(), edm::Service< T >::isAvailable(), LogDebug, CaloSimParameters::simHitToPhotoelectrons(), HcalDetId::subdet(), thePECorrection, and theRandPoisson.

Referenced by HcalSiPMHitResponse::add(), makeAnalogSignal(), and HcalSiPMHitResponse::makeSiPMSignal().

202  {
203 
204  if(!theRandPoisson)
205  {
207  if ( ! rng.isAvailable()) {
208  throw cms::Exception("Configuration")
209  << "CaloHitResponse requires the RandomNumberGeneratorService\n"
210  "which is not present in the configuration file. You must add the service\n"
211  "in the configuration file or remove the modules that require it.";
212  }
213  theRandPoisson = new CLHEP::RandPoissonQ(rng->getEngine());
214  }
215 
216  // OK, the "energy" in the hit could be a real energy, deposited energy,
217  // or pe count. This factor converts to photoelectrons
218  //GMA Smeared in photon production it self
219  double scl =1.0;
220 #ifdef ChangeHcalEnergyScale
221  if (changeScale) {
222  if (detId.det()==DetId::Hcal ) {
223  HcalDetId dId = HcalDetId(detId);
224  if (dId.subdet()==HcalBarrel || dId.subdet()==HcalEndcap) {
225  int ieta = dId.ieta()+50;
226  int iphi = dId.iphi()-1;
227  int idep = dId.depth()-1;
228  scl = hcal_en_scale[ieta][iphi][idep];
229  LogDebug("CaloHitResponse") << " ID " << dId << " Scale " << scl;
230  }
231  }
232  }
233 #endif
234  double npe = scl * energy * parameters.simHitToPhotoelectrons(detId);
235  // do we need to doPoisson statistics for the photoelectrons?
236  if(parameters.doPhotostatistics()) {
237  npe = theRandPoisson->fire(npe);
238  }
239  if(thePECorrection) npe = thePECorrection->correctPE(detId, npe);
240  return npe;
241 }
#define LogDebug(id)
float hcal_en_scale[100][72][4]
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:30
CLHEP::RandPoissonQ * theRandPoisson
bool doPhotostatistics() const
whether or not to apply Poisson statistics to photoelectrons
const CaloVPECorrection * thePECorrection
int depth() const
get the tower depth
Definition: HcalDetId.h:40
int ieta() const
get the cell ieta
Definition: HcalDetId.h:36
bool isAvailable() const
Definition: Service.h:46
double simHitToPhotoelectrons() const
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
int iphi() const
get the cell iphi
Definition: HcalDetId.h:38
virtual double correctPE(const DetId &detId, double npe) const =0
void CaloHitResponse::clear ( void  )
inline

frees up memory

Definition at line 89 of file CaloHitResponse.h.

References theAnalogSignalMap.

Referenced by EcalMixingModuleValidation::computeSDBunchDigi(), and CaloTDigitizer< Traits >::run().

89 {theAnalogSignalMap.clear();}
AnalogSignalMap theAnalogSignalMap
virtual void CaloHitResponse::finalizeHits ( )
inlinevirtual

Finalize hits.

Reimplemented in HcalSiPMHitResponse.

Definition at line 60 of file CaloHitResponse.h.

Referenced by CaloTDigitizer< Traits >::run().

60 {}
CaloSamples * CaloHitResponse::findSignal ( const DetId detId)

users can look for the signal for a given cell

Definition at line 244 of file CaloHitResponse.cc.

References query::result, and theAnalogSignalMap.

Referenced by HcalSiPMHitResponse::add(), add(), EcalMixingModuleValidation::computeSDBunchDigi(), and CaloTDigitizer< Traits >::run().

244  {
245  CaloSamples * result = 0;
246  AnalogSignalMap::iterator signalItr = theAnalogSignalMap.find(detId);
247  if(signalItr == theAnalogSignalMap.end()) {
248  result = 0;
249  } else {
250  result = &(signalItr->second);
251  }
252  return result;
253 }
tuple result
Definition: query.py:137
AnalogSignalMap theAnalogSignalMap
void CaloHitResponse::initHBHEScale ( )

Definition at line 61 of file CaloHitResponse.cc.

References hcal_en_scale.

Referenced by HcalDigitizer::HcalDigitizer().

61  {
62 #ifdef ChangeHcalEnergyScale
63  for (int ij=0; ij<100; ij++) {
64  for (int jk=0; jk<72; jk++) {
65  for (int kl=0; kl<4; kl++) {
66  hcal_en_scale[ij][jk][kl] = 1.0;
67  }
68  }
69  }
70 #endif
71 }
float hcal_en_scale[100][72][4]
virtual void CaloHitResponse::initializeHits ( )
inlinevirtual

Initialize hits.

Reimplemented in HcalSiPMHitResponse.

Definition at line 57 of file CaloHitResponse.h.

Referenced by CaloTDigitizer< Traits >::initializeHits().

57 {}
virtual bool CaloHitResponse::keepBlank ( ) const
inlinevirtual

Definition at line 54 of file CaloHitResponse.h.

References funct::true.

Referenced by add(), and HcalSiPMHitResponse::finalizeHits().

54 { return true ; }
CaloSamples CaloHitResponse::makeAnalogSignal ( const PCaloHit inputHit) const
virtual

creates the signal corresponding to this hit

Definition at line 167 of file CaloHitResponse.cc.

References analogSignalAmplitude(), newFWLiteAna::bin, BUNCHSPACE, CaloVHitCorrection::delay(), PCaloHit::energy(), PCaloHit::id(), makeBlankSignal(), Parameters::parameters, query::result, CaloShapes::shape(), CaloVSimParameterMap::simParameters(), CaloSamples::size(), theHitCorrection, theParameterMap, thePhaseShift_, theShape, theShapes, PCaloHit::time(), cond::rpcobgas::time, timeOfFlight(), CaloVShape::timeToRise(), and tzero.

Referenced by add().

167  {
168 
169  DetId detId(hit.id());
171 
172  double signal = analogSignalAmplitude(detId, hit.energy(), parameters);
173 
174  double time = hit.time();
175  if(theHitCorrection != 0) {
176  time += theHitCorrection->delay(hit);
177  }
178  double jitter = hit.time() - timeOfFlight(detId);
179 
180  const CaloVShape * shape = theShape;
181  if(!shape) {
182  shape = theShapes->shape(detId);
183  }
184  // assume bins count from zero, go for center of bin
185  const double tzero = ( shape->timeToRise()
186  + parameters.timePhase()
187  - jitter
188  - BUNCHSPACE*( parameters.binOfMaximum()
189  - thePhaseShift_ ) ) ;
190  double binTime = tzero;
191 
193 
194  for(int bin = 0; bin < result.size(); bin++) {
195  result[bin] += (*shape)(binTime)* signal;
196  binTime += BUNCHSPACE;
197  }
198  return result;
199 }
dictionary parameters
Definition: Parameters.py:2
CaloSamples makeBlankSignal(const DetId &detId) const
creates an empty signal for this DetId
Electronic response of the preamp.
Definition: CaloVShape.h:11
Main class for Parameters in different subdetectors.
virtual double delay(const PCaloHit &hit) const =0
tuple result
Definition: query.py:137
virtual double timeToRise() const =0
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
double timeOfFlight(const DetId &detId) const
double analogSignalAmplitude(const DetId &id, float energy, const CaloSimParameters &parameters) const
const CaloVHitCorrection * theHitCorrection
unsigned int id
Definition: DetId.h:18
const CaloShapes * theShapes
const CaloVSimParameterMap * theParameterMap
static const double tzero[3]
const CaloVShape * theShape
virtual const CaloVShape * shape(const DetId &detId) const
Definition: CaloShapes.h:15
CaloSamples CaloHitResponse::makeBlankSignal ( const DetId detId) const

creates an empty signal for this DetId

Definition at line 256 of file CaloHitResponse.cc.

References CaloSimParameters::binOfMaximum(), Parameters::parameters, CaloSimParameters::readoutFrameSize(), query::result, CaloVSimParameterMap::simParameters(), and theParameterMap.

Referenced by makeAnalogSignal(), and CaloTDigitizer< Traits >::run().

256  {
258  CaloSamples result(detId, parameters.readoutFrameSize());
259  result.setPresamples(parameters.binOfMaximum()-1);
260  return result;
261 }
dictionary parameters
Definition: Parameters.py:2
Main class for Parameters in different subdetectors.
tuple result
Definition: query.py:137
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
int readoutFrameSize() const
for now, the LinearFrames and trhe digis will be one-to-one.
const CaloVSimParameterMap * theParameterMap
int binOfMaximum() const
int CaloHitResponse::nSignals ( ) const
inline

number of signals in the current cache

Definition at line 105 of file CaloHitResponse.h.

References theAnalogSignalMap.

Referenced by CaloTDigitizer< Traits >::run().

105 {return theAnalogSignalMap.size();}
AnalogSignalMap theAnalogSignalMap
void CaloHitResponse::run ( MixCollection< PCaloHit > &  hits)
virtual

Complete cell digitization.

Reimplemented in HcalSiPMHitResponse.

Definition at line 106 of file CaloHitResponse.cc.

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

Referenced by EcalMixingModuleValidation::computeSDBunchDigi().

106  {
107 
108  for(MixCollection<PCaloHit>::MixItr hitItr = hits.begin();
109  hitItr != hits.end(); ++hitItr) {
110  if(withinBunchRange(hitItr.bunch())) {
111  add(*hitItr);
112  } // loop over hits
113  }
114 }
bool withinBunchRange(int bunchCrossing) const
check if crossing is within bunch range:
iterator end()
virtual void add(const PCaloHit &hit)
process a single SimHit
iterator begin()
void CaloHitResponse::setBunchRange ( int  minBunch,
int  maxBunch 
)

tells it which pileup bunches to do

Definition at line 95 of file CaloHitResponse.cc.

References theMaxBunch, and theMinBunch.

Referenced by EcalMixingModuleValidation::computeSDBunchDigi().

95  {
96  theMinBunch = minBunch;
97  theMaxBunch = maxBunch;
98 }
void CaloHitResponse::setGeometry ( const CaloGeometry geometry)
inline

geometry needed for time-of-flight

Definition at line 52 of file CaloHitResponse.h.

References geometry, and theGeometry.

Referenced by CastorDigiProducer::checkGeometry(), EcalMixingModuleValidation::computeSDBunchDigi(), HcalTBDigiProducer::updateGeometry(), HcalDigitizer::updateGeometry(), and EcalDigiProducer::updateGeometry().

52 { theGeometry = geometry; }
const CaloGeometry * theGeometry
ESHandle< TrackerGeometry > geometry
void CaloHitResponse::setHBHEScale ( std::string &  fileIn)

Definition at line 73 of file CaloHitResponse.cc.

References changeScale, eta(), hcal_en_scale, EdgesToViz::infile, LogDebug, and phi.

Referenced by HcalDigitizer::HcalDigitizer().

73  {
74 
75  std::ifstream infile(fileIn.c_str());
76  LogDebug("CaloHitResponse") << "Reading from " << fileIn;
77 #ifdef ChangeHcalEnergyScale
78  if (!infile.is_open()) {
79  edm::LogError("CaloHitResponse") << "** ERROR: Can't open '" << fileIn << "' for the input file";
80  } else {
81  int eta, phi, depth;
82  double cFactor;
83  while(1) {
84  infile >> eta >> phi >> depth >> cFactor;
85  if (!infile.good()) break;
86  hcal_en_scale[eta][phi][depth] = cFactor;
87  // LogDebug("CaloHitResponse") << "hcal_en_scale[" << eta << "][" << phi << "][" << depth << "] = " << hcal_en_scale[eta][phi][depth];
88  }
89  infile.close();
90  }
91  changeScale = true;
92 #endif
93 }
#define LogDebug(id)
float hcal_en_scale[100][72][4]
T eta() const
list infile
Definition: EdgesToViz.py:90
Definition: DDAxes.h:10
void CaloHitResponse::setHitCorrection ( const CaloVHitCorrection hitCorrection)
inline

If you want to correct hits, for attenuation or delay, set this.

Definition at line 77 of file CaloHitResponse.h.

References theHitCorrection.

Referenced by CastorDigiProducer::CastorDigiProducer(), and HcalTBDigiProducer::HcalTBDigiProducer().

77  {
78  theHitCorrection = hitCorrection;
79  }
const CaloVHitCorrection * theHitCorrection
void CaloHitResponse::setHitFilter ( const CaloVHitFilter filter)
inline

if you want to reject hits, for example, from a certain subdetector, set this

Definition at line 72 of file CaloHitResponse.h.

References alcazmumu_cfi::filter, and theHitFilter.

Referenced by CastorDigiProducer::CastorDigiProducer(), HcalDigitizer::HcalDigitizer(), and HcalTBDigiProducer::HcalTBDigiProducer().

72  {
74  }
const CaloVHitFilter * theHitFilter
void CaloHitResponse::setPECorrection ( const CaloVPECorrection peCorrection)
inline

if you want to correct the photoelectrons

Definition at line 82 of file CaloHitResponse.h.

References thePECorrection.

Referenced by HcalDigitizer::HcalDigitizer().

82  {
83  thePECorrection = peCorrection;
84  }
const CaloVPECorrection * thePECorrection
void CaloHitResponse::setPhaseShift ( const double &  thePhaseShift)
inline

setting the phase shift for asynchronous trigger (e.g. test beams)

Definition at line 116 of file CaloHitResponse.h.

References thePhaseShift_.

Referenced by HcalTBDigiProducer::setPhaseShift().

116 { thePhaseShift_ = thePhaseShift; }
void CaloHitResponse::setRandomEngine ( CLHEP::HepRandomEngine &  engine)
virtual

Reimplemented in HcalSiPMHitResponse.

Definition at line 101 of file CaloHitResponse.cc.

References theRandPoisson.

Referenced by HcalSiPMHitResponse::setRandomEngine(), and CaloTDigitizer< Traits >::setRandomEngine().

101  {
102  theRandPoisson = new CLHEP::RandPoissonQ(engine);
103 }
CLHEP::RandPoissonQ * theRandPoisson
double CaloHitResponse::timeOfFlight ( const DetId detId) const

time-of-flight, in ns, to get to this cell returns 0 if no geometry has been set

Definition at line 264 of file CaloHitResponse.cc.

References CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), PV3DBase< T, PVType, FrameType >::mag(), DetId::rawId(), query::result, and theGeometry.

Referenced by HcalSiPMHitResponse::add(), makeAnalogSignal(), and HcalSiPMHitResponse::makeSiPMSignal().

264  {
265  // not going to assume there's one of these per subdetector.
266  // Take the whole CaloGeometry and find the right subdet
267  double result = 0.;
268  if(theGeometry == 0) {
269  edm::LogWarning("CaloHitResponse") << "No Calo Geometry set, so no time of flight correction";
270  }
271  else {
272  const CaloCellGeometry* cellGeometry = theGeometry->getSubdetectorGeometry(detId)->getGeometry(detId);
273  if(cellGeometry == 0) {
274  edm::LogWarning("CaloHitResponse") << "No Calo cell found for ID"
275  << detId.rawId() << " so no time-of-flight subtraction will be done";
276  }
277  else {
278  double distance = cellGeometry->getPosition().mag();
279  result = distance * cm / c_light; // Units of c_light: mm/ns
280  }
281  }
282  return result;
283 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
const CaloGeometry * theGeometry
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
T mag() const
Definition: PV3DBase.h:67
tuple result
Definition: query.py:137
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
bool CaloHitResponse::withinBunchRange ( int  bunchCrossing) const
inline

check if crossing is within bunch range:

Definition at line 120 of file CaloHitResponse.h.

References theMaxBunch, and theMinBunch.

Referenced by CaloTDigitizer< Traits >::add(), and run().

120  {
121  return(bunchCrossing >= theMinBunch && bunchCrossing <= theMaxBunch);
122  }

Member Data Documentation

bool CaloHitResponse::changeScale
protected

Definition at line 145 of file CaloHitResponse.h.

Referenced by analogSignalAmplitude(), and setHBHEScale().

float CaloHitResponse::hcal_en_scale[100][72][4]
protected

Definition at line 147 of file CaloHitResponse.h.

Referenced by analogSignalAmplitude(), initHBHEScale(), and setHBHEScale().

AnalogSignalMap CaloHitResponse::theAnalogSignalMap
protected

Definition at line 126 of file CaloHitResponse.h.

Referenced by HcalSiPMHitResponse::add(), add(), clear(), findSignal(), and nSignals().

const CaloGeometry* CaloHitResponse::theGeometry
protected

Definition at line 135 of file CaloHitResponse.h.

Referenced by setGeometry(), and timeOfFlight().

const CaloVHitCorrection* CaloHitResponse::theHitCorrection
protected
const CaloVHitFilter* CaloHitResponse::theHitFilter
protected
int CaloHitResponse::theMaxBunch
protected

Definition at line 140 of file CaloHitResponse.h.

Referenced by HcalSiPMHitResponse::run(), setBunchRange(), and withinBunchRange().

int CaloHitResponse::theMinBunch
protected

Definition at line 139 of file CaloHitResponse.h.

Referenced by HcalSiPMHitResponse::run(), setBunchRange(), and withinBunchRange().

const CaloVSimParameterMap* CaloHitResponse::theParameterMap
protected
const CaloVPECorrection* CaloHitResponse::thePECorrection
protected

Definition at line 132 of file CaloHitResponse.h.

Referenced by analogSignalAmplitude(), and setPECorrection().

double CaloHitResponse::thePhaseShift_
protected
CLHEP::RandPoissonQ* CaloHitResponse::theRandPoisson
mutableprotected

Definition at line 137 of file CaloHitResponse.h.

Referenced by analogSignalAmplitude(), setRandomEngine(), and ~CaloHitResponse().

const CaloVShape* CaloHitResponse::theShape
protected

Definition at line 130 of file CaloHitResponse.h.

Referenced by makeAnalogSignal().

const CaloShapes* CaloHitResponse::theShapes
protected

Definition at line 129 of file CaloHitResponse.h.

Referenced by makeAnalogSignal(), and HcalSiPMHitResponse::makeSiPMSignal().