CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
HcalSiPMHitResponse Class Reference

#include <HcalSiPMHitResponse.h>

Inheritance diagram for HcalSiPMHitResponse:
CaloHitResponse

Public Member Functions

 HcalSiPMHitResponse (const CaloVSimParameterMap *parameterMap, const CaloVShape *shape)
 
virtual void run (MixCollection< PCaloHit > &hits)
 Complete cell digitization. More...
 
virtual void setRandomEngine (CLHEP::HepRandomEngine &engine)
 
virtual ~HcalSiPMHitResponse ()
 
- Public Member Functions inherited from CaloHitResponse
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 PCaloHit &hit, const CaloSimParameters &parameters) const
 
 CaloHitResponse (const CaloVSimParameterMap *parameterMap, const CaloVShape *shape)
 
void clear ()
 frees up memory More...
 
CaloSamplesfindSignal (const DetId &detId)
 users can look for the signal for a given cell 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...
 
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 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...
 
double timeOfFlight (const DetId &detId) const
 
virtual ~CaloHitResponse ()
 doesn't delete the pointers passed in More...
 

Protected Member Functions

virtual CaloSamples makeSiPMSignal (const PCaloHit &inHit, int &integral) const
 

Protected Attributes

double theRecoveryTime
 
HcalSiPMtheSiPM
 
- Protected Attributes inherited from CaloHitResponse
AnalogSignalMap theAnalogSignalMap
 
const CaloGeometrytheGeometry
 
const CaloVHitCorrectiontheHitCorrection
 
const CaloVHitFiltertheHitFilter
 
int theMaxBunch
 
int theMinBunch
 
const CaloVSimParameterMaptheParameterMap
 
const CaloVPECorrectionthePECorrection
 
double thePhaseShift_
 
CLHEP::RandPoissonQ * theRandPoisson
 
const CaloVShapetheShape
 

Additional Inherited Members

- Public Types inherited from CaloHitResponse
enum  { BUNCHSPACE =25 }
 
typedef std::map< DetId,
CaloSamples
AnalogSignalMap
 

Detailed Description

Definition at line 9 of file HcalSiPMHitResponse.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file HcalSiPMHitResponse.cc.

References theSiPM.

25  :
26  CaloHitResponse(parameterMap, shape), theSiPM(0), theRecoveryTime(250.) {
27  theSiPM = new HcalSiPM(14000);
28 }
A general implementation for the response of a SiPM.
Definition: HcalSiPM.h:17
CaloHitResponse(const CaloVSimParameterMap *parameterMap, const CaloVShape *shape)
HcalSiPMHitResponse::~HcalSiPMHitResponse ( )
virtual

Definition at line 30 of file HcalSiPMHitResponse.cc.

References theSiPM.

30  {
31  if (theSiPM)
32  delete theSiPM;
33 }

Member Function Documentation

CaloSamples HcalSiPMHitResponse::makeSiPMSignal ( const PCaloHit inHit,
int &  integral 
) const
protectedvirtual

Definition at line 77 of file HcalSiPMHitResponse.cc.

References CaloHitResponse::analogSignalAmplitude(), newFWLiteAna::bin, CaloHitResponse::BUNCHSPACE, CaloVHitCorrection::correct(), HcalSiPM::hitCells(), PCaloHit::id(), ExpressReco_HICollisions_FallBack::id, CaloHitResponse::makeBlankSignal(), ExpressReco_HICollisions_FallBack::photons, query::result, HcalSiPM::setNCells(), CaloVSimParameterMap::simParameters(), CaloSamples::size(), CaloHitResponse::theHitCorrection, CaloHitResponse::theParameterMap, CaloHitResponse::thePhaseShift_, theSiPM, PCaloHit::time(), CaloHitResponse::timeOfFlight(), and tzero.

Referenced by run().

78  {
79  PCaloHit hit = inHit;
80  if (theHitCorrection != 0)
82 
83  DetId id(hit.id());
84  const HcalSimParameters& pars = dynamic_cast<const HcalSimParameters&>(theParameterMap->simParameters(id));
85  theSiPM->setNCells(pars.pixels());
86 
87  double signal = analogSignalAmplitude(hit, pars);
88  int photons = static_cast<int>(signal + 0.5);
89  int pixels = theSiPM->hitCells(photons, integral);
90  integral += pixels;
91  signal = double(pixels);
92 
94 
95  if(pixels > 0)
96  {
97  double jitter = hit.time() - timeOfFlight(id);
98 
99  const double tzero = pars.timePhase() - jitter -
100  BUNCHSPACE*(pars.binOfMaximum() - thePhaseShift_);
101  double binTime = tzero;
102 
103  for (int bin = 0; bin < result.size(); bin++) {
104  result[bin] += (*theShape)(binTime)*signal;
105  binTime += BUNCHSPACE;
106  }
107  }
108 
109  return result;
110 }
CaloSamples makeBlankSignal(const DetId &detId) const
creates an empty signal for this DetId
double time() const
Definition: PCaloHit.h:34
virtual void correct(PCaloHit &hit) const =0
void setNCells(int nCells)
Definition: HcalSiPM.cc:65
tuple result
Definition: query.py:137
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
unsigned int id() const
Definition: PCaloHit.h:40
double timeOfFlight(const DetId &detId) const
const CaloVHitCorrection * theHitCorrection
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:69
Definition: DetId.h:20
double analogSignalAmplitude(const PCaloHit &hit, const CaloSimParameters &parameters) const
virtual int hitCells(int photons, int integral=0) const
Definition: HcalSiPM.cc:21
const CaloVSimParameterMap * theParameterMap
static const double tzero[3]
void HcalSiPMHitResponse::run ( MixCollection< PCaloHit > &  hits)
virtual

Complete cell digitization.

Reimplemented from CaloHitResponse.

Definition at line 35 of file HcalSiPMHitResponse.cc.

References CaloVHitFilter::accepts(), CaloHitResponse::add(), HcalSiPMRecovery::addToHistory(), MixCollection< T >::begin(), HcalSiPMRecovery::clearHistory(), MixCollection< T >::end(), HcalSiPMRecovery::getIntegral(), i, ExpressReco_HICollisions_FallBack::id, edm::detail::isnan(), makeSiPMSignal(), CaloHitResponse::theHitFilter, CaloHitResponse::theMaxBunch, CaloHitResponse::theMinBunch, theRecoveryTime, and PCaloHit::time().

35  {
36 
37  typedef std::multiset <const PCaloHit *, PCaloHitCompareTimes> SortedHitSet;
38 
39  std::map< DetId, SortedHitSet > sortedhits;
40  for (MixCollection<PCaloHit>::MixItr hitItr = hits.begin();
41  hitItr != hits.end(); ++hitItr) {
42  if (!((hitItr.bunch() < theMinBunch) || (hitItr.bunch() > theMaxBunch)) &&
43  !(isnan(hitItr->time())) &&
44  ((theHitFilter == 0) || (theHitFilter->accepts(*hitItr)))) {
45  DetId id(hitItr->id());
46  if (sortedhits.find(id)==sortedhits.end())
47  sortedhits.insert(std::pair<DetId, SortedHitSet>(id, SortedHitSet()));
48  sortedhits[id].insert(&(*hitItr));
49  }
50  }
51  int pixelIntegral, oldIntegral;
52  HcalSiPMRecovery pixelHistory(theRecoveryTime);
53  const PCaloHit * hit;
54  for (std::map<DetId, SortedHitSet>::iterator i = sortedhits.begin();
55  i!=sortedhits.end(); ++i) {
56  pixelHistory.clearHistory();
57  for (SortedHitSet::iterator itr = i->second.begin();
58  itr != i->second.end(); ++itr) {
59  hit = *itr;
60  pixelIntegral = pixelHistory.getIntegral(hit->time());
61  oldIntegral = pixelIntegral;
62  CaloSamples signal(makeSiPMSignal(*hit, pixelIntegral));
63  pixelHistory.addToHistory(hit->time(), pixelIntegral-oldIntegral);
64  add(signal);
65  }
66  }
67 }
int i
Definition: DBlmapReader.cc:9
double time() const
Definition: PCaloHit.h:34
iterator end()
virtual CaloSamples makeSiPMSignal(const PCaloHit &inHit, int &integral) const
bool isnan(float x)
Definition: math.h:13
virtual void add(const PCaloHit &hit)
process a single SimHit
virtual bool accepts(const PCaloHit &hit) const =0
Definition: DetId.h:20
iterator begin()
const CaloVHitFilter * theHitFilter
void HcalSiPMHitResponse::setRandomEngine ( CLHEP::HepRandomEngine &  engine)
virtual

Reimplemented from CaloHitResponse.

Definition at line 70 of file HcalSiPMHitResponse.cc.

References HcalSiPM::initRandomEngine(), CaloHitResponse::setRandomEngine(), and theSiPM.

71 {
72  theSiPM->initRandomEngine(engine);
74 }
void initRandomEngine(CLHEP::HepRandomEngine &engine)
Definition: HcalSiPM.cc:70
virtual void setRandomEngine(CLHEP::HepRandomEngine &engine)

Member Data Documentation

double HcalSiPMHitResponse::theRecoveryTime
protected

Definition at line 26 of file HcalSiPMHitResponse.h.

Referenced by run().

HcalSiPM* HcalSiPMHitResponse::theSiPM
protected