CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EcalTBH4BeamSD Class Reference

#include <EcalTBH4BeamSD.h>

Inheritance diagram for EcalTBH4BeamSD:
CaloSD SensitiveCaloDetector Observer< const BeginOfRun * > Observer< const BeginOfEvent * > Observer< const BeginOfTrack * > Observer< const EndOfTrack * > Observer< const EndOfEvent * > SensitiveDetector

List of all members.

Public Member Functions

 EcalTBH4BeamSD (G4String, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
virtual double getEnergyDeposit (G4Step *)
virtual uint32_t setDetUnitId (G4Step *step)
void setNumberingScheme (EcalNumberingScheme *scheme)
virtual ~EcalTBH4BeamSD ()

Private Member Functions

void getBaseNumber (const G4Step *aStep)

Private Attributes

double birk1
double birk2
double birk3
EcalNumberingSchemenumberingScheme
EcalBaseNumber theBaseNumber
bool useBirk
bool useWeight

Detailed Description

Definition at line 21 of file EcalTBH4BeamSD.h.


Constructor & Destructor Documentation

EcalTBH4BeamSD::EcalTBH4BeamSD ( G4String  name,
const DDCompactView cpv,
SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 20 of file EcalTBH4BeamSD.cc.

References birk1, birk2, birk3, g, edm::ParameterSet::getParameter(), setNumberingScheme(), and useBirk.

                                                               : 
  CaloSD(name, cpv, clg, p, manager), numberingScheme(0) {
  
  edm::ParameterSet m_EcalTBH4BeamSD = p.getParameter<edm::ParameterSet>("EcalTBH4BeamSD");
  useBirk= m_EcalTBH4BeamSD.getParameter<bool>("UseBirkLaw");
  birk1  = m_EcalTBH4BeamSD.getParameter<double>("BirkC1")*(g/(MeV*cm2));
  birk2  = m_EcalTBH4BeamSD.getParameter<double>("BirkC2");
  birk3  = m_EcalTBH4BeamSD.getParameter<double>("BirkC3");

  EcalNumberingScheme* scheme=0;
  if     (name == "EcalTBH4BeamHits") { 
    scheme = dynamic_cast<EcalNumberingScheme*>(new EcalHodoscopeNumberingScheme());
  } 
  else {edm::LogWarning("EcalTBSim") << "EcalTBH4BeamSD: ReadoutName not supported\n";}

  if (scheme)  setNumberingScheme(scheme);
  edm::LogInfo("EcalTBSim") << "Constructing a EcalTBH4BeamSD  with name " 
                            << GetName();
  edm::LogInfo("EcalTBSim") << "EcalTBH4BeamSD:: Use of Birks law is set to  " 
                            << useBirk << "        with three constants kB = "
                            << birk1 << ", C1 = " << birk2 << ", C2 = " 
                            << birk3;
}
EcalTBH4BeamSD::~EcalTBH4BeamSD ( ) [virtual]

Definition at line 47 of file EcalTBH4BeamSD.cc.

References numberingScheme.

                                {
  if (numberingScheme) delete numberingScheme;
}

Member Function Documentation

void EcalTBH4BeamSD::getBaseNumber ( const G4Step *  aStep) [private]

Definition at line 85 of file EcalTBH4BeamSD.cc.

References EcalBaseNumber::addLevel(), EcalBaseNumber::getCapacity(), LogDebug, EcalBaseNumber::reset(), EcalBaseNumber::setSize(), and theBaseNumber.

Referenced by setDetUnitId().

                                                      {

  theBaseNumber.reset();
  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
  int theSize = touch->GetHistoryDepth()+1;
  if ( theBaseNumber.getCapacity() < theSize ) theBaseNumber.setSize(theSize);
  //Get name and copy numbers
  if ( theSize > 1 ) {
    for (int ii = 0; ii < theSize ; ii++) {
      theBaseNumber.addLevel(touch->GetVolume(ii)->GetName(),touch->GetReplicaNumber(ii));
      LogDebug("EcalTBSim") << "EcalTBH4BeamSD::getBaseNumber(): Adding level " << ii 
                            << ": " << touch->GetVolume(ii)->GetName() << "["
                            << touch->GetReplicaNumber(ii) << "]";
    }
  }
}
double EcalTBH4BeamSD::getEnergyDeposit ( G4Step *  aStep) [virtual]

Reimplemented from CaloSD.

Definition at line 51 of file EcalTBH4BeamSD.cc.

References birk1, birk2, birk3, CaloSD::getAttenuation(), LogDebug, NULL, CaloSD::preStepPoint, useBirk, and CommonMethods::weight().

                                                      {
  
  if (aStep == NULL) {
    return 0;
  } else {
    preStepPoint        = aStep->GetPreStepPoint();
    G4String nameVolume = preStepPoint->GetPhysicalVolume()->GetName();

    // take into account light collection curve for crystals
    double weight = 1.;
    if (useBirk)   weight *= getAttenuation(aStep, birk1, birk2, birk3);
    double edep   = aStep->GetTotalEnergyDeposit() * weight;
    LogDebug("EcalTBSim") << "EcalTBH4BeamSD:: " << nameVolume
                        <<" Light Collection Efficiency " << weight 
                        << " Weighted Energy Deposit " << edep/MeV << " MeV";
    return edep;
  } 
}
uint32_t EcalTBH4BeamSD::setDetUnitId ( G4Step *  step) [virtual]
void EcalTBH4BeamSD::setNumberingScheme ( EcalNumberingScheme scheme)

Definition at line 75 of file EcalTBH4BeamSD.cc.

References numberingScheme.

Referenced by EcalTBH4BeamSD().

                                                                   {
  if (scheme != 0) {
    edm::LogInfo("EcalTBSim") << "EcalTBH4BeamSD: updates numbering scheme for " 
                            << GetName() << "\n";
    if (numberingScheme) delete numberingScheme;
    numberingScheme = scheme;
  }
}

Member Data Documentation

double EcalTBH4BeamSD::birk1 [private]

Definition at line 38 of file EcalTBH4BeamSD.h.

Referenced by EcalTBH4BeamSD(), and getEnergyDeposit().

double EcalTBH4BeamSD::birk2 [private]

Definition at line 38 of file EcalTBH4BeamSD.h.

Referenced by EcalTBH4BeamSD(), and getEnergyDeposit().

double EcalTBH4BeamSD::birk3 [private]

Definition at line 38 of file EcalTBH4BeamSD.h.

Referenced by EcalTBH4BeamSD(), and getEnergyDeposit().

Definition at line 35 of file EcalTBH4BeamSD.h.

Referenced by setDetUnitId(), setNumberingScheme(), and ~EcalTBH4BeamSD().

Definition at line 39 of file EcalTBH4BeamSD.h.

Referenced by getBaseNumber(), and setDetUnitId().

bool EcalTBH4BeamSD::useBirk [private]

Definition at line 37 of file EcalTBH4BeamSD.h.

Referenced by EcalTBH4BeamSD(), and getEnergyDeposit().

bool EcalTBH4BeamSD::useWeight [private]

Definition at line 36 of file EcalTBH4BeamSD.h.