CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

GflashShowino Class Reference

#include <GflashShowino.h>

List of all members.

Public Member Functions

void addEnergyDeposited (double energy)
double getDepth ()
double getEnergy ()
double getEnergyDeposited ()
double getGlobalTime ()
GflashTrajectorygetHelix ()
double getPathLength ()
double getPathLengthAtShower ()
double getPathLengthOnEcal ()
Gflash3VectorgetPosition ()
Gflash3VectorgetPositionAtShower ()
int getShowerType ()
double getStepLengthToHcal ()
double getStepLengthToOut ()
 GflashShowino ()
void initialize (int showerType, double energy, double globalTime, double charge, Gflash3Vector &position, Gflash3Vector &momentum, double magneticField)
void setGlobalTime (double globalTime)
void setPathLength (double pathLength)
void setPosition (Gflash3Vector position)
void updateShowino (double deltaStep)
 ~GflashShowino ()

Private Member Functions

int convertShowerType (int fastSimShowerType, const Gflash3Vector &pos)
void evaluateLengths ()
Gflash3VectorsimulateFirstInteractionPoint (int showType, Gflash3Vector &pos)

Private Attributes

double theEnergy
double theEnergyDeposited
double theGlobalTime
GflashTrajectorytheHelix
double thePathLength
double thePathLengthAtShower
double thePathLengthOnEcal
Gflash3Vector thePosition
Gflash3Vector thePositionAtShower
int theShowerType
double theStepLengthToHcal
double theStepLengthToOut

Detailed Description

Definition at line 8 of file GflashShowino.h.


Constructor & Destructor Documentation

GflashShowino::GflashShowino ( )
GflashShowino::~GflashShowino ( )

Definition at line 12 of file GflashShowino.cc.

References theHelix.

{
  delete theHelix;
}

Member Function Documentation

void GflashShowino::addEnergyDeposited ( double  energy) [inline]
int GflashShowino::convertShowerType ( int  fastSimShowerType,
const Gflash3Vector pos 
) [private]
void GflashShowino::evaluateLengths ( ) [private]

Definition at line 61 of file GflashShowino.cc.

References eta, Gflash::EtaMax, GflashTrajectory::getPathLengthAtRhoEquals(), GflashTrajectory::getPathLengthAtZ(), Gflash::kENCA, Gflash::kESPM, Gflash::kHB, Gflash::kHE, min, Gflash::RFrontCrystalEB, Gflash::Rmax, Gflash::Rmin, theHelix, thePathLength, thePathLengthAtShower, thePathLengthOnEcal, thePosition, theStepLengthToHcal, theStepLengthToOut, Gflash::ZFrontCrystalEE, Gflash::Zmax, and Gflash::Zmin.

Referenced by initialize().

                                    {
  //thePathLengthAtShower: path Length from the origin to the shower starting point in cm
  //theStepLengthToOut: the total path length from the starting point of
  //                    shower to the maximum distance inside paramerized envelopes
  double eta = thePosition.getEta();
  
  if (std::fabs(eta) < Gflash::EtaMax[Gflash::kESPM]) {
    thePathLengthOnEcal   = theHelix->getPathLengthAtRhoEquals(Gflash::RFrontCrystalEB);
    thePathLengthAtShower = theHelix->getPathLengthAtRhoEquals(thePosition.getRho());
    double pathLengthAtHcalBack = theHelix->getPathLengthAtRhoEquals(Gflash::Rmax[Gflash::kHB]);
    if (pathLengthAtHcalBack>0) {
      theStepLengthToOut  = std::min(300.,pathLengthAtHcalBack - thePathLengthAtShower);
    }
    else {
      theStepLengthToOut  = 200.;
    }
    theStepLengthToHcal   = theHelix->getPathLengthAtRhoEquals(Gflash::Rmin[Gflash::kHB]) - thePathLengthAtShower;

  }
  else if (std::fabs(eta) < Gflash::EtaMax[Gflash::kENCA] ) {
    double zsign = (eta > 0) ? 1.0 : -1.0 ; 
    thePathLengthOnEcal   = theHelix->getPathLengthAtZ(zsign*Gflash::ZFrontCrystalEE);
    thePathLengthAtShower = theHelix->getPathLengthAtZ(thePosition.getZ());
    theStepLengthToOut    = std::min(300.,theHelix->getPathLengthAtZ(zsign*Gflash::Zmax[Gflash::kHE]) - thePathLengthAtShower);
    theStepLengthToHcal   = theHelix->getPathLengthAtZ(zsign*Gflash::Zmin[Gflash::kHE]) - thePathLengthAtShower;
  }
  else { 
    //@@@extend for HF later
    theStepLengthToOut = 200.0;
  }
  
  thePathLength = thePathLengthAtShower;

}
double GflashShowino::getDepth ( void  ) [inline]
double GflashShowino::getEnergy ( ) [inline]
double GflashShowino::getEnergyDeposited ( ) [inline]

Definition at line 35 of file GflashShowino.h.

References theEnergyDeposited.

Referenced by GflashHadronShowerProfile::hadronicParameterization().

{ return theEnergyDeposited ; }
double GflashShowino::getGlobalTime ( ) [inline]
GflashTrajectory* GflashShowino::getHelix ( ) [inline]
double GflashShowino::getPathLength ( ) [inline]

Definition at line 33 of file GflashShowino.h.

References thePathLength.

Referenced by GflashHadronShowerProfile::hadronicParameterization().

{ return thePathLength; }
double GflashShowino::getPathLengthAtShower ( ) [inline]
double GflashShowino::getPathLengthOnEcal ( ) [inline]
Gflash3Vector& GflashShowino::getPosition ( ) [inline]
Gflash3Vector& GflashShowino::getPositionAtShower ( ) [inline]
int GflashShowino::getShowerType ( ) [inline]
double GflashShowino::getStepLengthToHcal ( ) [inline]

Definition at line 28 of file GflashShowino.h.

References theStepLengthToHcal.

Referenced by GflashHadronShowerProfile::longitudinalProfile().

{ return theStepLengthToHcal; }
double GflashShowino::getStepLengthToOut ( ) [inline]

Definition at line 29 of file GflashShowino.h.

References theStepLengthToOut.

Referenced by GflashHadronShowerProfile::hadronicParameterization().

{ return theStepLengthToOut; }
void GflashShowino::initialize ( int  showerType,
double  energy,
double  globalTime,
double  charge,
Gflash3Vector position,
Gflash3Vector momentum,
double  magneticField 
)

Definition at line 17 of file GflashShowino.cc.

References relval_parameters_module::energy, evaluateLengths(), Gflash::findShowerType(), GflashTrajectory::initializeTrajectory(), position, simulateFirstInteractionPoint(), theEnergy, theEnergyDeposited, theGlobalTime, theHelix, thePosition, thePositionAtShower, and theShowerType.

Referenced by GflashEMShowerProfile::initialize(), and GflashHadronShowerProfile::initialize().

                                                     {

  theEnergy = energy;
  theGlobalTime = globalTime;
  theEnergyDeposited = 0.0;

  // inside the magnetic field (tesla unit);
  theHelix->initializeTrajectory(momentum,position,charge,magneticField);

  if(showerType<100) {
    thePositionAtShower = position;  
    thePosition = thePositionAtShower;
    theShowerType = showerType;

  }
  else {
    //this input is from FastSimulation
    //1. simulate the shower starting position
    thePositionAtShower = simulateFirstInteractionPoint(showerType,position);
    thePosition = thePositionAtShower;

    //2. find shower type depending on where is the shower starting point
    theShowerType = Gflash::findShowerType(thePositionAtShower);

  }  

  evaluateLengths();

}
void GflashShowino::setGlobalTime ( double  globalTime) [inline]

Definition at line 38 of file GflashShowino.h.

References theGlobalTime.

{ theGlobalTime = globalTime; }
void GflashShowino::setPathLength ( double  pathLength) [inline]

Definition at line 39 of file GflashShowino.h.

References thePathLength.

Referenced by GflashHadronShowerProfile::hadronicParameterization().

{ thePathLength = pathLength; }
void GflashShowino::setPosition ( Gflash3Vector  position) [inline]

Definition at line 40 of file GflashShowino.h.

References position, and thePosition.

Gflash3Vector & GflashShowino::simulateFirstInteractionPoint ( int  showType,
Gflash3Vector pos 
) [private]

fraction before the crystal, but inside Ecal

Definition at line 96 of file GflashShowino.cc.

References alignCSCRings::e, GflashTrajectory::getGflashTrajectoryPoint(), GflashTrajectory::getPathLengthAtRhoEquals(), GflashTrajectory::getPathLengthAtZ(), GflashTrajectoryPoint::getPosition(), Gflash::kHB, Gflash::kHE, Gflash::LengthCrystalEB, Gflash::LengthCrystalEE, funct::log(), Gflash::RFrontCrystalEB, Gflash::Rmax, Gflash::Rmin, funct::sin(), theEnergy, theHelix, thePathLengthOnEcal, Gflash::ZFrontCrystalEE, Gflash::Zmax, and Gflash::Zmin.

Referenced by initialize().

                                                                                                          {

  //determine the shower starting point (ssp):
  //the position at the entrance + the mean free path till the inelastic interaction inside calo

  double depthAtShower = 0.0;

  //set thePathLengthOnEcal, the pathLength at the reference (r=123.8 for barrel and z=304.5 for endcap)
    
  //effective interaction length fitter to ssp from Geant4
  double effectiveLambda = 0.0;
  if(theEnergy > 0.0 &&  theEnergy < 15) {
    effectiveLambda = 24.6+2.6*std::tanh(3.0*(std::log(theEnergy)-1.43));
  }
  else {
    effectiveLambda = 28.4+1.20*std::tanh(1.5*(std::log(theEnergy)-4.3));
  }
  //fraction before the crystal, but inside Ecal
  //  double frac_ssp1 = 1.5196e-01+1.3300e-01*tanh(-4.6971e-01*(std::log(theEnergy)+2.4162e+00));
  //fraction after the crystal, but before Hcal
  double frac_ssp2 = 2.8310e+00+2.6766e+00*tanh(-4.8068e-01*(std::log(theEnergy)+3.4857e+00));

  if(fastSimShowerType == 100 ) { //fastTrack.onEcal() == 1

    //    double rhoTemp = Gflash::ROffCrystalEB + Gflash::LengthCrystalEB*std::sin(position.getTheta());
    double rhoTemp = Gflash::LengthCrystalEB*std::sin(position.getTheta());
    thePathLengthOnEcal  = theHelix->getPathLengthAtRhoEquals(Gflash::RFrontCrystalEB);
    double pathLengthAt2 = theHelix->getPathLengthAtRhoEquals(Gflash::RFrontCrystalEB + rhoTemp );
    double pathLengthAt3 = theHelix->getPathLengthAtRhoEquals(Gflash::Rmin[Gflash::kHB]);

    /*
    if(CLHEP::HepUniformRand() < frac_ssp1 ) {
      depthAtShower = (pathLengthAt1-thePathLengthOnEcal)*CLHEP::HepUniformRand();
    }
    else {
    */
    //inside the crystal
    //      depthAtShower = (pathLengthAt1-thePathLengthOnEcal) - effectiveLambda*log(CLHEP::HepUniformRand());
      depthAtShower = - effectiveLambda*log(CLHEP::HepUniformRand());
      //after the crystal
      if(depthAtShower > (pathLengthAt2 - thePathLengthOnEcal) ) {
        //before Hcal
        if(CLHEP::HepUniformRand() < frac_ssp2 ) {
          depthAtShower = (pathLengthAt2 - thePathLengthOnEcal) + (pathLengthAt3-pathLengthAt2)*CLHEP::HepUniformRand();
        }
        //inside Hcal
        else {
          depthAtShower = (pathLengthAt3 - thePathLengthOnEcal) - effectiveLambda*log(CLHEP::HepUniformRand());
          //check whether the shower starts beyond HB
          double pathLengthAt4 = theHelix->getPathLengthAtRhoEquals(Gflash::Rmax[Gflash::kHB]);
          if(depthAtShower > (pathLengthAt4 - thePathLengthOnEcal)) {
            depthAtShower = (pathLengthAt4 - pathLengthAt3)*CLHEP::HepUniformRand();
          }
        }
      }
      //    }
  }
  else if(fastSimShowerType == 101 ) { //fastTrack.onEcal() == 2 

    double zTemp = Gflash::LengthCrystalEE;
    double zsign = (position.getEta() > 0) ? 1.0 : -1.0 ; 

    thePathLengthOnEcal  = theHelix->getPathLengthAtZ(zsign*Gflash::ZFrontCrystalEE);
    double pathLengthAt2 = theHelix->getPathLengthAtZ(zsign*(Gflash::ZFrontCrystalEE + zTemp));
    double pathLengthAt3 = theHelix->getPathLengthAtZ(zsign*Gflash::Zmin[Gflash::kHE]);
      
    /*
    if(CLHEP::HepUniformRand() <  frac_ssp1 ) {
      depthAtShower = (pathLengthAt1-thePathLengthOnEcal)*CLHEP::HepUniformRand();
    }
    else {
    */
    //      depthAtShower = (pathLengthAt1-thePathLengthOnEcal)-effectiveLambda*std::log(CLHEP::HepUniformRand());
      depthAtShower = -effectiveLambda*std::log(CLHEP::HepUniformRand());

      if(depthAtShower > (pathLengthAt2 - thePathLengthOnEcal) ) {
        if(CLHEP::HepUniformRand() < frac_ssp2 ) {
          depthAtShower = (pathLengthAt2 - thePathLengthOnEcal) +(pathLengthAt3 - pathLengthAt2)*CLHEP::HepUniformRand();
        }
        else {
          depthAtShower = (pathLengthAt3 - thePathLengthOnEcal)-effectiveLambda*std::log(CLHEP::HepUniformRand());
          //shower starts beyond HE
          double pathLengthAt4 = theHelix->getPathLengthAtZ(zsign*Gflash::Zmax[Gflash::kHE]);
          if(depthAtShower > (pathLengthAt4 - thePathLengthOnEcal)) {
            depthAtShower = (pathLengthAt4 - pathLengthAt3)*CLHEP::HepUniformRand();
          }
        }
      }
      //    }
  }
  else {
    depthAtShower = 0.0; 
  }

  double pathLength  = thePathLengthOnEcal + depthAtShower;
  GflashTrajectoryPoint trajectoryPoint;
  theHelix->getGflashTrajectoryPoint(trajectoryPoint,pathLength);

  //return the initial showino position at the shower starting position
  return trajectoryPoint.getPosition();

}
void GflashShowino::updateShowino ( double  deltaStep)

Definition at line 49 of file GflashShowino.cc.

References GflashTrajectory::getGflashTrajectoryPoint(), GflashTrajectoryPoint::getPosition(), theEnergy, theGlobalTime, theHelix, thePathLength, and thePosition.

Referenced by GflashHadronShowerProfile::hadronicParameterization().

{
  thePathLength += deltaStep;
  //trajectory point of showino along the shower depth at the pathLength
  GflashTrajectoryPoint trajectoryShowino;
  theHelix->getGflashTrajectoryPoint(trajectoryShowino,thePathLength);

  thePosition = trajectoryShowino.getPosition();

  theGlobalTime +=  (theEnergy/100.0)*deltaStep/30.0; //@@@calculate exact time change in nsec
}

Member Data Documentation

double GflashShowino::theEnergy [private]

Definition at line 63 of file GflashShowino.h.

Referenced by addEnergyDeposited(), getEnergyDeposited(), and initialize().

double GflashShowino::theGlobalTime [private]

Definition at line 61 of file GflashShowino.h.

Referenced by getGlobalTime(), initialize(), setGlobalTime(), and updateShowino().

double GflashShowino::thePathLength [private]

Definition at line 54 of file GflashShowino.h.

Referenced by evaluateLengths(), getDepth(), and getPathLengthAtShower().

Definition at line 62 of file GflashShowino.h.

Referenced by evaluateLengths(), getPosition(), initialize(), setPosition(), and updateShowino().

Definition at line 53 of file GflashShowino.h.

Referenced by getPositionAtShower(), and initialize().

Definition at line 51 of file GflashShowino.h.

Referenced by getShowerType(), and initialize().

Definition at line 56 of file GflashShowino.h.

Referenced by evaluateLengths(), and getStepLengthToHcal().

Definition at line 57 of file GflashShowino.h.

Referenced by evaluateLengths(), and getStepLengthToOut().