CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes

HcalSiPMHitResponse Class Reference

#include <HcalSiPMHitResponse.h>

Inheritance diagram for HcalSiPMHitResponse:
CaloHitResponse

List of all members.

Public Member Functions

 HcalSiPMHitResponse (const CaloVSimParameterMap *parameterMap, const CaloVShape *shape)
virtual void run (MixCollection< PCaloHit > &hits)
 Complete cell digitization.
virtual void setRandomEngine (CLHEP::HepRandomEngine &engine)
virtual ~HcalSiPMHitResponse ()

Protected Member Functions

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

Protected Attributes

double theRecoveryTime
HcalSiPMtheSiPM

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.

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

Definition at line 30 of file HcalSiPMHitResponse.cc.

References theSiPM.

                                          {
  if (theSiPM)
    delete theSiPM;
}

Member Function Documentation

CaloSamples HcalSiPMHitResponse::makeSiPMSignal ( const PCaloHit inHit,
int &  integral 
) const [protected, virtual]

Definition at line 77 of file HcalSiPMHitResponse.cc.

References CaloHitResponse::analogSignalAmplitude(), newFWLiteAna::bin, CaloHitResponse::BUNCHSPACE, CaloVHitCorrection::correct(), HcalSiPM::hitCells(), PCaloHit::id(), CaloHitResponse::makeBlankSignal(), interactiveExample::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().

                                                                       {
  PCaloHit hit = inHit;
  if (theHitCorrection != 0)
    theHitCorrection->correct(hit);

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

  double signal = analogSignalAmplitude(hit, 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)
  {
    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] += (*theShape)(binTime)*signal;
      binTime += BUNCHSPACE;
    }
  }

  return result;
}
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, edm::detail::isnan(), makeSiPMSignal(), 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)) &&
        !(isnan(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);
  const PCaloHit * hit;
  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) {
      hit = *itr;
      pixelIntegral = pixelHistory.getIntegral(hit->time());
      oldIntegral = pixelIntegral;
      CaloSamples signal(makeSiPMSignal(*hit, pixelIntegral));
      pixelHistory.addToHistory(hit->time(), pixelIntegral-oldIntegral);
      add(signal);
    }
  }
}
void HcalSiPMHitResponse::setRandomEngine ( CLHEP::HepRandomEngine &  engine) [virtual]

Reimplemented from CaloHitResponse.

Definition at line 70 of file HcalSiPMHitResponse.cc.

References HcalSiPM::initRandomEngine(), and theSiPM.


Member Data Documentation

Definition at line 26 of file HcalSiPMHitResponse.h.

Referenced by run().