CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

HcalSiPMHitResponse Class Reference

#include <HcalSiPMHitResponse.h>

Inheritance diagram for HcalSiPMHitResponse:
CaloHitResponse

List of all members.

Public Member Functions

virtual void add (const PCaloHit &hit)
 process a single SimHit
virtual void finalizeHits ()
 Finalize hits.
 HcalSiPMHitResponse (const CaloVSimParameterMap *parameterMap, const CaloShapes *shapes)
virtual void initializeHits ()
 Initialize hits.
virtual void run (MixCollection< PCaloHit > &hits)
 Complete cell digitization.
virtual void setRandomEngine (CLHEP::HepRandomEngine &engine)
virtual ~HcalSiPMHitResponse ()

Private Types

typedef std::multiset
< PCaloHit,
PCaloHitCompareTimes
SortedHitSet

Private Member Functions

virtual CaloSamples makeSiPMSignal (const DetId &id, const PCaloHit &hit, int &integral) const

Private Attributes

std::map< DetId, HcalSiPMRecoverypixelHistory
double theRecoveryTime
HcalSiPMtheSiPM

Detailed Description

Definition at line 21 of file HcalSiPMHitResponse.h.


Member Typedef Documentation

Definition at line 42 of file HcalSiPMHitResponse.h.


Constructor & Destructor Documentation

HcalSiPMHitResponse::HcalSiPMHitResponse ( const CaloVSimParameterMap parameterMap,
const CaloShapes shapes 
)

Definition at line 14 of file HcalSiPMHitResponse.cc.

References theSiPM.

                                                                    :
  CaloHitResponse(parameterMap, shapes), theSiPM(0), theRecoveryTime(250.) {
  theSiPM = new HcalSiPM(14000);
}
HcalSiPMHitResponse::~HcalSiPMHitResponse ( ) [virtual]

Definition at line 20 of file HcalSiPMHitResponse.cc.

References theSiPM.

                                          {
  if (theSiPM)
    delete theSiPM;
}

Member Function Documentation

void HcalSiPMHitResponse::add ( const PCaloHit hit) [virtual]

process a single SimHit

Reimplemented from CaloHitResponse.

Definition at line 32 of file HcalSiPMHitResponse.cc.

References CaloVHitFilter::accepts(), PCaloHit::id(), edm::isNotFinite(), makeSiPMSignal(), pixelHistory, CaloHitResponse::theHitFilter, theRecoveryTime, and PCaloHit::time().

Referenced by run().

                                                 {
    if (!edm::isNotFinite(hit.time()) &&
        ((theHitFilter == 0) || (theHitFilter->accepts(hit)))) {
      DetId id(hit.id());
      if (pixelHistory.find(id)==pixelHistory.end()) {
        pixelHistory.insert(std::pair<DetId, HcalSiPMRecovery>(id, HcalSiPMRecovery(theRecoveryTime)));
      }
      int pixelIntegral = pixelHistory[id].getIntegral(hit.time());
      int oldIntegral = pixelIntegral;
      CaloSamples signal(makeSiPMSignal(id, hit, pixelIntegral));
      pixelHistory[id].addToHistory(hit.time(), pixelIntegral-oldIntegral);
      add(signal);
    }
}
void HcalSiPMHitResponse::finalizeHits ( ) [virtual]

Finalize hits.

Reimplemented from CaloHitResponse.

Definition at line 28 of file HcalSiPMHitResponse.cc.

                                       {
}
void HcalSiPMHitResponse::initializeHits ( ) [virtual]

Initialize hits.

Reimplemented from CaloHitResponse.

Definition at line 25 of file HcalSiPMHitResponse.cc.

                                         {
}
CaloSamples HcalSiPMHitResponse::makeSiPMSignal ( const DetId id,
const PCaloHit hit,
int &  integral 
) const [private, virtual]

Definition at line 87 of file HcalSiPMHitResponse.cc.

References CaloHitResponse::analogSignalAmplitude(), newFWLiteAna::bin, CaloSimParameters::binOfMaximum(), CaloHitResponse::BUNCHSPACE, CaloVHitCorrection::delay(), PCaloHit::energy(), HcalSiPM::hitCells(), CaloHitResponse::makeBlankSignal(), interactiveExample::photons, HcalSimParameters::pixels(), query::result, HcalSiPM::setNCells(), PCaloHit::setTime(), CaloShapes::shape(), CaloVSimParameterMap::simParameters(), CaloSamples::size(), CaloHitResponse::theHitCorrection, CaloHitResponse::theParameterMap, CaloHitResponse::thePhaseShift_, CaloHitResponse::theShapes, theSiPM, PCaloHit::time(), CaloHitResponse::timeOfFlight(), CaloSimParameters::timePhase(), and tzero.

Referenced by add(), and run().

                                                                       {
  
  PCaloHit hit = inHit;
  if (theHitCorrection != 0) {
    hit.setTime(hit.time() + theHitCorrection->delay(hit));
  }

  const HcalSimParameters& pars = dynamic_cast<const HcalSimParameters&>(theParameterMap->simParameters(id));
  theSiPM->setNCells(pars.pixels());

  double signal = analogSignalAmplitude(id, hit.energy(), pars);
  int photons = static_cast<int>(signal + 0.5);
  int pixels = theSiPM->hitCells(photons, integral);
  integral += pixels;
  signal = double(pixels);

  CaloSamples result(makeBlankSignal(id));

  if(pixels > 0)
  {
    const CaloVShape * shape = theShapes->shape(id);
    double jitter = hit.time() - timeOfFlight(id);

    const double tzero = pars.timePhase() - jitter -
      BUNCHSPACE*(pars.binOfMaximum() - thePhaseShift_);
    double binTime = tzero;

    for (int bin = 0; bin < result.size(); bin++) {
      result[bin] += (*shape)(binTime)*signal;
      binTime += BUNCHSPACE;
    }
  }

  return result;
}
void HcalSiPMHitResponse::run ( MixCollection< PCaloHit > &  hits) [virtual]

Complete cell digitization.

Reimplemented from CaloHitResponse.

Definition at line 47 of file HcalSiPMHitResponse.cc.

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

                                                            {
  typedef std::multiset <const PCaloHit *, PCaloHitCompareTimes> SortedHitSet;

  std::map< DetId, SortedHitSet > sortedhits;
  for (MixCollection<PCaloHit>::MixItr hitItr = hits.begin();
       hitItr != hits.end(); ++hitItr) {
    if (!((hitItr.bunch() < theMinBunch) || (hitItr.bunch() > theMaxBunch)) &&
        !(edm::isNotFinite(hitItr->time())) &&
        ((theHitFilter == 0) || (theHitFilter->accepts(*hitItr)))) {
      DetId id(hitItr->id());
      if (sortedhits.find(id)==sortedhits.end())
        sortedhits.insert(std::pair<DetId, SortedHitSet>(id, SortedHitSet()));
      sortedhits[id].insert(&(*hitItr));
    }
  }
  int pixelIntegral, oldIntegral;
  HcalSiPMRecovery pixelHistory(theRecoveryTime);
  for (std::map<DetId, SortedHitSet>::iterator i = sortedhits.begin(); 
       i!=sortedhits.end(); ++i) {
    pixelHistory.clearHistory();
    for (SortedHitSet::iterator itr = i->second.begin(); 
         itr != i->second.end(); ++itr) {
      const PCaloHit& hit = **itr;
      pixelIntegral = pixelHistory.getIntegral(hit.time());
      oldIntegral = pixelIntegral;
      CaloSamples signal(makeSiPMSignal(i->first, hit, pixelIntegral));
      pixelHistory.addToHistory(hit.time(), pixelIntegral-oldIntegral);
      add(signal);
    }
  }
}
void HcalSiPMHitResponse::setRandomEngine ( CLHEP::HepRandomEngine &  engine) [virtual]

Reimplemented from CaloHitResponse.

Definition at line 80 of file HcalSiPMHitResponse.cc.

References HcalSiPM::initRandomEngine(), and theSiPM.


Member Data Documentation

Definition at line 49 of file HcalSiPMHitResponse.h.

Referenced by add(), and run().

Definition at line 47 of file HcalSiPMHitResponse.h.

Referenced by add(), and run().