CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

PreshowerHitMaker Class Reference

#include <PreshowerHitMaker.h>

Inheritance diagram for PreshowerHitMaker:
CaloHitMaker

List of all members.

Public Types

typedef ROOT::Math::Transform3DPJ Transform3D
typedef math::XYZVector XYZPoint
typedef math::XYZVector XYZVector

Public Member Functions

bool addHit (double r, double phi, unsigned layer=0)
const std::map< unsigned, float > & getHits ()
float layer1Calibrated () const
float layer2Calibrated () const
 PreshowerHitMaker (CaloGeometryHelper *calo, const XYZPoint &, const XYZVector &, const XYZPoint &, const XYZVector &, const LandauFluctuationGenerator *aGenerator)
void setMipEnergy (double e1, double e2)
void setSpotEnergy (double e)
float totalCalibrated () const
float totalLayer1 () const
float totalLayer2 () const
 ~PreshowerHitMaker ()

Private Attributes

float anglecorrection1_
float anglecorrection2_
bool layer1valid_
bool layer2valid_
Transform3D locToGlobal1_
Transform3D locToGlobal2_
double mip1_
double mip2_
XYZVector psLayer1Dir_
XYZPoint psLayer1Entrance_
XYZVector psLayer2Dir_
XYZPoint psLayer2Entrance_
const LandauFluctuationGeneratortheGenerator
 The Landau Fluctuation generator.
float totalLayer1_
float totalLayer2_

Detailed Description

Definition at line 10 of file PreshowerHitMaker.h.


Member Typedef Documentation

Definition at line 16 of file PreshowerHitMaker.h.

Reimplemented from CaloHitMaker.

Definition at line 15 of file PreshowerHitMaker.h.

Reimplemented from CaloHitMaker.

Definition at line 14 of file PreshowerHitMaker.h.


Constructor & Destructor Documentation

PreshowerHitMaker::PreshowerHitMaker ( CaloGeometryHelper calo,
const XYZPoint layer1entrance,
const XYZVector layer1dir,
const XYZPoint layer2entrance,
const XYZVector layer2dir,
const LandauFluctuationGenerator aGenerator 
)

Definition at line 18 of file PreshowerHitMaker.cc.

References anglecorrection1_, anglecorrection2_, CaloHitMaker::intersect(), layer1valid_, layer2valid_, locToGlobal1_, locToGlobal2_, CaloHitMaker::myCalorimeter, CaloGeometryHelper::preshowerZPosition(), psLayer1Entrance_, psLayer2Entrance_, and z.

                                                 :
  CaloHitMaker(calo,DetId::Ecal,EcalPreshower,2),
  psLayer1Entrance_(layer1entrance),
  psLayer1Dir_(layer1dir),
  psLayer2Entrance_(layer2entrance),
  psLayer2Dir_(layer2dir),
  totalLayer1_(0.),totalLayer2_(0.),
  theGenerator(aGenerator)
{
  double dummyt;
  anglecorrection1_ = 0.;
  anglecorrection2_ = 0.;
   // Check if the entrance points are really on the wafers
  // Layer 1 
  layer1valid_ = (layer1entrance.Mag2()>0.);
  if(layer1valid_)
    {
      int z=(psLayer1Entrance_.z()>0)? 1:-1;
      Plane3D plan1(0.,0.,1.,-z*myCalorimeter->preshowerZPosition(1));

      psLayer1Entrance_ = intersect(plan1,layer1entrance,layer1entrance+layer1dir,dummyt,false);

      XYZVector zaxis(0,0,1);
      XYZVector planeVec1=(zaxis.Cross(layer1dir)).Unit();
      locToGlobal1_=Transform3D(Point(0,0,0),
                                Point(0,0,1),
                                Point(1,0,0),
                                (Point)psLayer1Entrance_,
                                (Point)(psLayer1Entrance_+layer1dir),
                                (Point)(psLayer1Entrance_+planeVec1));

      anglecorrection1_ = fabs(zaxis.Dot(layer1dir));
      if(anglecorrection1_!=0.) anglecorrection1_ = 1./anglecorrection1_;
      //      std::cout << " Layer 1 entrance " << psLayer1Entrance_ << std::endl;
      //      std::cout << " Layer 1 corr " << anglecorrection1_ << std::endl;
    }

  // Layer 2
  layer2valid_ = (layer2entrance.Mag2()>0.);
  if(layer2valid_)
    {
      int z=(psLayer2Entrance_.z()>0) ? 1:-1;
      Plane3D plan2(0.,0.,1.,-z*myCalorimeter->preshowerZPosition(2));
      
      psLayer2Entrance_ = intersect(plan2,layer2entrance,layer2entrance+layer2dir,dummyt,false);

      XYZVector zaxis(0,0,1);
      XYZVector planeVec2=(zaxis.Cross(layer2dir)).Unit();
      locToGlobal2_=Transform3D(Point(0,0,0),
                                Point(0,0,1),
                                Point(1,0,0),
                               (Point)psLayer2Entrance_,
                               (Point)(psLayer2Entrance_+layer2dir),
                               (Point)(psLayer2Entrance_+planeVec2));
      
      anglecorrection2_ = fabs(zaxis.Dot(layer2dir));
      if(anglecorrection2_!=0.) anglecorrection2_ = 1./anglecorrection2_;
      //      std::cout << " Layer 2 entrance " << psLayer2Entrance_ << std::endl;
      //      std::cout << " Layer 2 corr " << anglecorrection2_ << std::endl;
    }
  //  theGenerator=LandauFluctuationGenerator();
}
PreshowerHitMaker::~PreshowerHitMaker ( ) [inline]

Definition at line 25 of file PreshowerHitMaker.h.

{;} 

Member Function Documentation

bool PreshowerHitMaker::addHit ( double  r,
double  phi,
unsigned  layer = 0 
) [virtual]

Implements CaloHitMaker.

Definition at line 89 of file PreshowerHitMaker.cc.

References anglecorrection1_, anglecorrection2_, funct::cos(), EcalPreshowerGeometry::getClosestCellInPlane(), Calorimeter::getEcalPreshowerGeometry(), CaloHitMaker::hitMap_, LandauFluctuationGenerator::landau(), layer1valid_, layer2valid_, locToGlobal1_, locToGlobal2_, mip1_, mip2_, CaloHitMaker::moliereRadius, CaloHitMaker::myCalorimeter, point, CaloGeometryHelper::preshowerZPosition(), funct::sin(), strip(), theGenerator, totalLayer1_, totalLayer2_, and z.

Referenced by EMShower::compute().

{
  if((layer==1&&!layer1valid_)||((layer==2&&!layer2valid_))) return false;

  r*=moliereRadius;
  XYZPoint point (r*std::cos(phi),r*std::sin(phi),0.);
  point =  (layer==1) ? locToGlobal1_((Point)point) : locToGlobal2_((Point)point);
  //  std::cout << "  Point " << point  << std::endl;
  int z=(point.z()>0) ? 1: -1;
  point = XYZPoint(point.x(),point.y(),z*myCalorimeter->preshowerZPosition(layer));
  //  std::cout << "r " << r << "  Point after " << point  << std::endl;
  //  std::cout << " Layer " << layer << " " << point << std::endl;
  DetId strip = myCalorimeter->getEcalPreshowerGeometry()->getClosestCellInPlane(GlobalPoint(point.x(),point.y(),point.z()),layer);

  float meanspot=(layer==1) ? mip1_ : mip2_; 
  float spote = meanspot + 0.000021*theGenerator->landau();
  spote *= ( (layer==1) ? anglecorrection1_ : anglecorrection2_ );

  if(!strip.null())
    {
      uint32_t stripNumber=strip.rawId();
      std::map<uint32_t,float>::iterator cellitr;
      cellitr = hitMap_.find(stripNumber);
      if( cellitr==hitMap_.end())
        {
          hitMap_.insert(std::pair<uint32_t,float>(stripNumber,spote));
        }
      else
        {
          cellitr->second+=spote;
        }  
      //      std::cout << " found " << stripNumber << " " << spote <<std::endl;
      if(layer==1){
        totalLayer1_+=spote;
      }
      else if (layer==2) {
        totalLayer2_+=spote;
      }
      return true;
    }
  //  std::cout << "  Could not find a cell " << point << std::endl;
  return false;
}
const std::map<unsigned,float>& PreshowerHitMaker::getHits ( ) [inline, virtual]

Implements CaloHitMaker.

Definition at line 30 of file PreshowerHitMaker.h.

References CaloHitMaker::hitMap_.

Referenced by CalorimetryManager::EMShowerSimulation().

{ return hitMap_ ;} ;
float PreshowerHitMaker::layer1Calibrated ( ) const [inline]

Definition at line 36 of file PreshowerHitMaker.h.

References totalLayer1_.

{ return 0.024/81.1E-6*totalLayer1_;}
float PreshowerHitMaker::layer2Calibrated ( ) const [inline]

Definition at line 37 of file PreshowerHitMaker.h.

References totalLayer2_.

{ return 0.024*0.7/81.1E-6*totalLayer2_;}
void PreshowerHitMaker::setMipEnergy ( double  e1,
double  e2 
) [inline]

Definition at line 32 of file PreshowerHitMaker.h.

References mip1_, and mip2_.

Referenced by CalorimetryManager::EMShowerSimulation().

{ mip1_=e1 ; mip2_=e2;} 
void PreshowerHitMaker::setSpotEnergy ( double  e) [inline, virtual]

Implements CaloHitMaker.

Definition at line 27 of file PreshowerHitMaker.h.

References ExpressReco_HICollisions_FallBack::e, and CaloHitMaker::spotEnergy.

Referenced by EMShower::compute().

float PreshowerHitMaker::totalCalibrated ( ) const [inline]

Definition at line 38 of file PreshowerHitMaker.h.

References totalLayer1_, and totalLayer2_.

{ return 0.024/81.1E-6*(totalLayer1_+0.7*totalLayer2_);}
float PreshowerHitMaker::totalLayer1 ( ) const [inline]

Definition at line 34 of file PreshowerHitMaker.h.

References totalLayer1_.

{ return totalLayer1_;}
float PreshowerHitMaker::totalLayer2 ( ) const [inline]

Definition at line 35 of file PreshowerHitMaker.h.

References totalLayer2_.

{ return totalLayer2_;}

Member Data Documentation

Definition at line 50 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

Definition at line 51 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

Definition at line 46 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

Definition at line 47 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

Definition at line 48 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

Definition at line 49 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

double PreshowerHitMaker::mip1_ [private]

Definition at line 52 of file PreshowerHitMaker.h.

Referenced by addHit(), and setMipEnergy().

double PreshowerHitMaker::mip2_ [private]

Definition at line 52 of file PreshowerHitMaker.h.

Referenced by addHit(), and setMipEnergy().

Definition at line 43 of file PreshowerHitMaker.h.

Definition at line 42 of file PreshowerHitMaker.h.

Referenced by PreshowerHitMaker().

Definition at line 45 of file PreshowerHitMaker.h.

Definition at line 44 of file PreshowerHitMaker.h.

Referenced by PreshowerHitMaker().

The Landau Fluctuation generator.

Definition at line 56 of file PreshowerHitMaker.h.

Referenced by addHit().

Definition at line 53 of file PreshowerHitMaker.h.

Referenced by addHit(), layer1Calibrated(), totalCalibrated(), and totalLayer1().

Definition at line 54 of file PreshowerHitMaker.h.

Referenced by addHit(), layer2Calibrated(), totalCalibrated(), and totalLayer2().