#include <PreshowerHitMaker.h>
Definition at line 10 of file PreshowerHitMaker.h.
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.
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.
{;}
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.
Referenced by CalorimetryManager::EMShowerSimulation().
void PreshowerHitMaker::setSpotEnergy | ( | double | e | ) | [inline, virtual] |
Implements CaloHitMaker.
Definition at line 27 of file PreshowerHitMaker.h.
References alignCSCRings::e, and CaloHitMaker::spotEnergy.
Referenced by EMShower::compute().
{ spotEnergy=e;}
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] |
float PreshowerHitMaker::totalLayer2 | ( | ) | const [inline] |
float PreshowerHitMaker::anglecorrection1_ [private] |
Definition at line 50 of file PreshowerHitMaker.h.
Referenced by addHit(), and PreshowerHitMaker().
float PreshowerHitMaker::anglecorrection2_ [private] |
Definition at line 51 of file PreshowerHitMaker.h.
Referenced by addHit(), and PreshowerHitMaker().
bool PreshowerHitMaker::layer1valid_ [private] |
Definition at line 46 of file PreshowerHitMaker.h.
Referenced by addHit(), and PreshowerHitMaker().
bool PreshowerHitMaker::layer2valid_ [private] |
Definition at line 47 of file PreshowerHitMaker.h.
Referenced by addHit(), and PreshowerHitMaker().
Transform3D PreshowerHitMaker::locToGlobal1_ [private] |
Definition at line 48 of file PreshowerHitMaker.h.
Referenced by addHit(), and PreshowerHitMaker().
Transform3D PreshowerHitMaker::locToGlobal2_ [private] |
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().
XYZVector PreshowerHitMaker::psLayer1Dir_ [private] |
Definition at line 43 of file PreshowerHitMaker.h.
XYZPoint PreshowerHitMaker::psLayer1Entrance_ [private] |
Definition at line 42 of file PreshowerHitMaker.h.
Referenced by PreshowerHitMaker().
XYZVector PreshowerHitMaker::psLayer2Dir_ [private] |
Definition at line 45 of file PreshowerHitMaker.h.
XYZPoint PreshowerHitMaker::psLayer2Entrance_ [private] |
Definition at line 44 of file PreshowerHitMaker.h.
Referenced by PreshowerHitMaker().
const LandauFluctuationGenerator* PreshowerHitMaker::theGenerator [private] |
The Landau Fluctuation generator.
Definition at line 56 of file PreshowerHitMaker.h.
Referenced by addHit().
float PreshowerHitMaker::totalLayer1_ [private] |
Definition at line 53 of file PreshowerHitMaker.h.
Referenced by addHit(), layer1Calibrated(), totalCalibrated(), and totalLayer1().
float PreshowerHitMaker::totalLayer2_ [private] |
Definition at line 54 of file PreshowerHitMaker.h.
Referenced by addHit(), layer2Calibrated(), totalCalibrated(), and totalLayer2().