CMS 3D CMS Logo

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

EBHitResponse Class Reference

Creates electronics signals from EB hits , including APD. More...

#include <EBHitResponse.h>

Inheritance diagram for EBHitResponse:
CaloHitRespoNew

List of all members.

Public Types

enum  { kNOffsets = 2000 }
typedef CaloHitRespoNew CaloHitResponse
typedef std::vector< double > VecD

Public Member Functions

 EBHitResponse (const CaloVSimParameterMap *parameterMap, const CaloVShape *shape, bool apdOnly, const APDSimParameters *apdPars, const CaloVShape *apdShape)
virtual bool keepBlank () const
const VecDoffsets () const
void setIntercal (const EcalIntercalibConstantsMC *ical)
virtual ~EBHitResponse ()

Protected Member Functions

virtual void putAnalogSignal (const PCaloHit &inputHit)

Private Member Functions

const APDSimParametersapdParameters () const
const CaloVShapeapdShape () const
double apdSignalAmplitude (const PCaloHit &hit) const
void findIntercalibConstant (const DetId &detId, double &icalconst) const

Private Attributes

const bool m_apdOnly
const APDSimParametersm_apdPars
const CaloVShapem_apdShape
const EcalIntercalibConstantsMCm_intercal
std::vector< double > m_timeOffVec

Detailed Description

Creates electronics signals from EB hits , including APD.

Definition at line 17 of file EBHitResponse.h.


Member Typedef Documentation

Definition at line 21 of file EBHitResponse.h.

typedef std::vector<double> EBHitResponse::VecD

Definition at line 23 of file EBHitResponse.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
kNOffsets 

Definition at line 25 of file EBHitResponse.h.

{ kNOffsets = 2000 } ;

Constructor & Destructor Documentation

EBHitResponse::EBHitResponse ( const CaloVSimParameterMap parameterMap,
const CaloVShape shape,
bool  apdOnly,
const APDSimParameters apdPars = 0,
const CaloVShape apdShape = 0 
)

Definition at line 11 of file EBHitResponse.cc.

References apdParameters(), i, kNOffsets, m_timeOffVec, and CaloHitRespoNew::ranGauss().

                                                                           :

   CaloHitResponse( parameterMap,
                    shape         ),

   m_apdOnly  ( apdOnly  ) ,
   m_apdPars  ( apdPars  ) ,
   m_apdShape ( apdShape ) ,
   m_timeOffVec ( kNOffsets, apdParameters()->timeOffset() )
{
   for( unsigned int i ( 0 ) ; i != kNOffsets ; ++i )
   {
      m_timeOffVec[ i ] +=
         ranGauss()->fire( 0 , apdParameters()->timeOffWidth() ) ;
   }
}
EBHitResponse::~EBHitResponse ( ) [virtual]

Definition at line 32 of file EBHitResponse.cc.

{
}

Member Function Documentation

const APDSimParameters * EBHitResponse::apdParameters ( ) const [private]

Definition at line 38 of file EBHitResponse.cc.

References m_apdPars.

Referenced by apdSignalAmplitude(), EBHitResponse(), and putAnalogSignal().

{
   assert ( 0 != m_apdPars ) ;
   return m_apdPars ;
}
const CaloVShape * EBHitResponse::apdShape ( ) const [private]

Definition at line 45 of file EBHitResponse.cc.

References m_apdShape.

Referenced by putAnalogSignal().

{
   assert( 0 != m_apdShape ) ;
   return m_apdShape ;
}
double EBHitResponse::apdSignalAmplitude ( const PCaloHit hit) const [private]

Definition at line 98 of file EBHitResponse.cc.

References apdParameters(), PCaloHit::depth(), PCaloHit::energy(), findIntercalibConstant(), PCaloHit::id(), m_apdOnly, m_intercal, CaloHitRespoNew::ranPois(), APDSimParameters::simToPEHigh(), and APDSimParameters::simToPELow().

Referenced by putAnalogSignal().

{
   assert( 1 == hit.depth() ||
           2 == hit.depth()    ) ;

   double npe ( hit.energy()*( 2 == hit.depth() ?
                               apdParameters()->simToPELow() :
                               apdParameters()->simToPEHigh() ) ) ;
                               
   // do we need to doPoisson statistics for the photoelectrons?
   if( apdParameters()->doPEStats() &&
       !m_apdOnly                      ) npe = ranPois()->fire( npe ) ;

   assert( 0 != m_intercal ) ;
   double fac ( 1 ) ;
   findIntercalibConstant( hit.id(), fac ) ;

   npe *= fac ;
//   edm::LogError( "EBHitResponse" ) << "--- # photoelectrons for "
/*   std::cout << "--- # photoelectrons for "
             << EBDetId( hit.id() ) 
             <<" is " << npe //;
             <<std::endl ;*/

   return npe ;
}
void EBHitResponse::findIntercalibConstant ( const DetId detId,
double &  icalconst 
) const [private]

Definition at line 132 of file EBHitResponse.cc.

References EcalCondObjectContainer< T >::getMap(), m_intercal, and DetId::rawId().

Referenced by apdSignalAmplitude().

{
   EcalIntercalibConstantMC thisconst ( 1. ) ;

   if( 0 == m_intercal )
   {
      edm::LogError( "EBHitResponse" ) << 
         "No intercal constant defined for EBHitResponse" ;
   }
   else
   {
      const EcalIntercalibConstantMCMap&          icalMap ( m_intercal->getMap()  ) ;
      EcalIntercalibConstantMCMap::const_iterator icalit  ( icalMap.find( detId ) ) ;
      if( icalit != icalMap.end() )
      {
         thisconst = *icalit ;
         if ( thisconst == 0. ) thisconst = 1. ; 
      } 
      else
      {
         edm::LogError("EBHitResponse") << "No intercalib const found for xtal " 
                                        << detId.rawId() 
                                        << "! something wrong with EcalIntercalibConstants in your DB? ";
      }
   }
   icalconst = thisconst ;
}
virtual bool EBHitResponse::keepBlank ( ) const [inline, virtual]

Definition at line 35 of file EBHitResponse.h.

References funct::false.

{ return false ; }
const VecD& EBHitResponse::offsets ( ) const [inline]

Definition at line 39 of file EBHitResponse.h.

References m_timeOffVec.

Referenced by putAnalogSignal().

{ return m_timeOffVec ; }
void EBHitResponse::putAnalogSignal ( const PCaloHit inputHit) [protected, virtual]

Reimplemented from CaloHitRespoNew.

Definition at line 52 of file EBHitResponse.cc.

References apdParameters(), apdShape(), apdSignalAmplitude(), newFWLiteAna::bin, CaloSimParameters::binOfMaximum(), CaloHitRespoNew::BUNCHSPACE, PCaloHit::depth(), CaloHitRespoNew::findSignal(), PCaloHit::id(), kNOffsets, m_apdOnly, offsets(), Parameters::parameters, CaloHitRespoNew::params(), CaloHitRespoNew::phaseShift(), CaloHitRespoNew::putAnalogSignal(), query::result, PCaloHit::time(), CaloHitRespoNew::timeOfFlight(), and tzero.

{
   const unsigned int depth ( hit.depth() ) ;
   if( !m_apdOnly &&
       0 == depth    )
   {
      CaloHitResponse::putAnalogSignal( hit ) ;
   }
   else
   {
      if( 0 != depth                           &&
          ( apdParameters()->addToBarrel() ||
            m_apdOnly                        )    ) // can digitize apd
      {
         const DetId detId  ( hit.id() ) ;
         CaloSamples& result ( *findSignal( detId ) );

//       edm::LogError( "EBHitResponse" )<<"---APD SimHit found for "
/*       std::cout<<"---APD SimHit found for "
                  << EBDetId( detId ) 
                  <<", depth="<< depth 
                  <<std::endl ;*/

         const double signal ( apdSignalAmplitude( hit ) ) ;
            
         const CaloSimParameters& parameters ( *params( detId ) ) ;

         const double jitter ( hit.time() - timeOfFlight( detId ) ) ;

         const double tzero ( apdShape()->timeToRise()
                              - jitter
                              - offsets()[ EBDetId( detId ).denseIndex()%kNOffsets ]
                              - BUNCHSPACE*( parameters.binOfMaximum()
                                             - phaseShift()            ) ) ;
         double binTime ( tzero ) ;

         for( int bin ( 0 ) ; bin != result.size(); ++bin )
         {
            result[bin] += (*apdShape())(binTime)*signal;
            binTime += BUNCHSPACE;
         }
      }
   } 
}
void EBHitResponse::setIntercal ( const EcalIntercalibConstantsMC ical)

Definition at line 126 of file EBHitResponse.cc.

References m_intercal.

Referenced by EcalDigiProducer::checkCalibrations().

{
   m_intercal = ical ;
}

Member Data Documentation

const bool EBHitResponse::m_apdOnly [private]

Definition at line 55 of file EBHitResponse.h.

Referenced by apdSignalAmplitude(), and putAnalogSignal().

Definition at line 56 of file EBHitResponse.h.

Referenced by apdParameters().

Definition at line 57 of file EBHitResponse.h.

Referenced by apdShape().

Definition at line 58 of file EBHitResponse.h.

Referenced by apdSignalAmplitude(), findIntercalibConstant(), and setIntercal().

std::vector<double> EBHitResponse::m_timeOffVec [private]

Definition at line 60 of file EBHitResponse.h.

Referenced by EBHitResponse(), and offsets().