CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
EcalHitMaker Class Reference

#include <EcalHitMaker.h>

Inheritance diagram for EcalHitMaker:
CaloHitMaker

Public Types

typedef ROOT::Math::Plane3D Plane3D
 
typedef math::XYZVector XYZNormal
 
typedef math::XYZVector XYZPoint
 
typedef math::XYZVector XYZVector
 
- Public Types inherited from CaloHitMaker
typedef ROOT::Math::Plane3D Plane3D
 
typedef math::XYZVector XYZPoint
 
typedef math::XYZVector XYZVector
 

Public Member Functions

bool addHit (double r, double phi, unsigned layer=0)
 
bool addHitDepth (double r, double phi, double depth=-1)
 
const XYZPointecalEntrance () const
 used in FamosHcalHitMaker More...
 
double ecalHcalGapTotalL0 () const
 ECAL-HCAL transition. More...
 
double ecalHcalGapTotalX0 () const
 ECAL-HCAL transition. More...
 
 EcalHitMaker (CaloGeometryHelper *calo, const XYZPoint &ecalentrance, const DetId &cell, int onEcal, unsigned size, unsigned showertype, const RandomEngineAndDistribution *engine)
 
double ecalTotalL0 () const
 in the ECAL More...
 
double ecalTotalX0 () const
 in the ECAL More...
 
unsigned fastInsideCell (const CLHEP::Hep2Vector &point, double &sp, bool debug=false)
 
const std::vector< Crystal > & getCrystals () const
 for debugging More...
 
const FSimTrackgetFSimTrack () const
 To retrieve the track. More...
 
const std::map< CaloHitID,
float > & 
getHits ()
 not been done. More...
 
bool getPads (double depth, bool inCm=false)
 
const std::vector< CaloSegment > & getSegments () const
 
double getX0back () const
 
double hcalTotalL0 () const
 in the HCAL More...
 
double hcalTotalX0 () const
 in the HCAL More...
 
double ps1TotalL0 () const
 total number of L0 in the PS (Layer1). More...
 
double ps1TotalX0 () const
 
double ps2eeTotalL0 () const
 
double ps2eeTotalX0 () const
 
double ps2TotalL0 () const
 total number of L0 in the PS (Layer2). More...
 
double ps2TotalX0 () const
 total number of X0 in the PS (Layer2). More...
 
void setCrackPadSurvivalProbability (double val)
 
void setPreshowerPresent (bool ps)
 
void setPulledPadSurvivalProbability (double val)
 
void setRadiusFactor (double r)
 
void setSpotEnergy (double e)
 
void setTrackParameters (const XYZNormal &normal, double X0depthoffset, const FSimTrack &theTrack)
 
double totalL0 () const
 Number of interaction length "seen" by the track. More...
 
double totalX0 () const
 
double x0DepthOffset () const
 get the offset (e.g the number of X0 after which the shower starts) More...
 
 ~EcalHitMaker ()
 
- Public Member Functions inherited from CaloHitMaker
 CaloHitMaker (const CaloGeometryHelper *calo, DetId::Detector det, int subdetn, int cal, unsigned sht=0)
 
const CaloGeometryHelpergetCalorimeter () const
 
virtual ~CaloHitMaker ()
 

Private Types

typedef std::pair
< CaloDirection, unsigned > 
neighbour
 

Private Member Functions

void buildGeometry ()
 
void buildSegments (const std::vector< CaloPoint > &cp)
 
void cellLine (std::vector< CaloPoint > &cp)
 
void configureGeometry ()
 
void convertIntegerCoordinates (double x, double y, unsigned &ix, unsigned &iy) const
 
CLHEP::Hep2Vector & correspondingEdge (neighbour &myneighbour, CaloDirection dir2)
 
void cracksPads (std::vector< neighbour > &cracks, unsigned iq)
 
bool diagonalEdge (unsigned myPad, CaloDirection dir, CLHEP::Hep2Vector &point)
 
void ecalCellLine (const XYZPoint &, const XYZPoint &, std::vector< CaloPoint > &cp)
 
void gapsLifting (std::vector< neighbour > &gaps, unsigned iq)
 
void hcalCellLine (std::vector< CaloPoint > &cp) const
 
bool inside3D (const std::vector< XYZPoint > &, const XYZPoint &p) const
 
void prepareCrystalNumberArray ()
 
void preshowerCellLine (std::vector< CaloPoint > &cp) const
 
bool pulled (const XYZPoint &origin, const XYZNormal &normal, XYZPoint &fPoint) const
 
void reorganizePads ()
 
bool unbalancedDirection (const std::vector< neighbour > &dirs, unsigned &unb, unsigned &dir1, unsigned &dir2)
 

Private Attributes

double bfactor_
 
std::vector< DetIdCellsWindow_
 
int central_
 
bool configuredGeometry_
 
std::vector< XYZPointcorners
 
double crackPadProbability_
 
std::vector< CrystalPadcrackpadsatdepth_
 
double currentdepth_
 
bool detailedShowerTail_
 
std::map< DetId, unsigned > DetIdMap_
 
bool doreorg_
 
XYZPoint EcalEntrance_
 
int ecalFirstSegment_
 
unsigned etasize_
 
bool hitmaphasbeencalculated_
 
std::vector< float > hits_
 
std::vector< CaloPointintersections_
 
double L0ECAL_
 
double L0EHGAP_
 
double L0HCAL_
 
double L0PS1_
 
double L0PS2_
 
double L0PS2EE_
 
double maxX0_
 
std::vector< CLHEP::Hep2Vector > mycorners
 
std::vector< std::vector
< unsigned > > 
myCrystalNumberArray_
 
CrystalWindowMapmyCrystalWindowMap_
 
const FSimTrackmyTrack_
 
unsigned ncrackpadsatdepth_
 
unsigned ncrystals_
 
XYZNormal normal_
 
unsigned npadsatdepth_
 
unsigned nx_
 
unsigned ny_
 
int onEcal_
 
double outsideWindowEnergy_
 
std::vector< CrystalPadpadsatdepth_
 
unsigned phisize_
 
Crystal pivot_
 
Plane3D plan_
 
double pulledPadProbability_
 
double radiusCorrectionFactor_
 
double radiusFactor_
 
const RandomEngineAndDistributionrandom
 
double rearleakage_
 
std::vector< CrystalregionOfInterest_
 
std::vector< CaloSegmentsegments_
 
bool simulatePreshower_
 
double sizex_
 
double sizey_
 
double totalL0_
 
double totalX0_
 
bool truncatedGrid_
 
std::vector< bool > validPads_
 
double X0depthoffset_
 
double X0ECAL_
 
double X0EHGAP_
 
double X0HCAL_
 
double X0PS1_
 
double X0PS2_
 
double X0PS2EE_
 
double xmax_
 
double xmin_
 
double ymax_
 
double ymin_
 

Additional Inherited Members

- Static Protected Member Functions inherited from CaloHitMaker
static XYZPoint intersect (const Plane3D &p, const XYZPoint &a, const XYZPoint &b, double &t, bool segment, bool debug=false)
 
- Protected Attributes inherited from CaloHitMaker
bool EMSHOWER
 
bool HADSHOWER
 
std::map< CaloHitID, float > hitMap_
 
double interactionLength
 
bool MIP
 
double moliereRadius
 
const CaloGeometryHelpermyCalorimeter
 
unsigned showerType_
 
double spotEnergy
 
const CalorimeterPropertiestheCaloProperties
 

Detailed Description

Definition at line 24 of file EcalHitMaker.h.

Member Typedef Documentation

typedef std::pair<CaloDirection,unsigned > EcalHitMaker::neighbour
private

Definition at line 178 of file EcalHitMaker.h.

typedef ROOT::Math::Plane3D EcalHitMaker::Plane3D

Definition at line 31 of file EcalHitMaker.h.

Definition at line 30 of file EcalHitMaker.h.

Definition at line 29 of file EcalHitMaker.h.

Definition at line 28 of file EcalHitMaker.h.

Constructor & Destructor Documentation

EcalHitMaker::EcalHitMaker ( CaloGeometryHelper calo,
const XYZPoint ecalentrance,
const DetId cell,
int  onEcal,
unsigned  size,
unsigned  showertype,
const RandomEngineAndDistribution engine 
)

Definition at line 33 of file EcalHitMaker.cc.

References bfactor_, CaloGeometryHelper::buildCrystal(), buildGeometry(), CellsWindow_, central_, corners, gather_cfg::cout, doreorg_, EcalEntrance_, ecalFirstSegment_, etasize_, CaloGeometryHelper::getClosestCell(), Crystal::getDetId(), Calorimeter::getEcalEndcapGeometry(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloGeometryHelper::getWindow(), hitmaphasbeencalculated_, Histos::instance(), L0ECAL_, L0EHGAP_, L0HCAL_, L0PS1_, L0PS2_, L0PS2EE_, maxX0_, CaloHitMaker::myCalorimeter, mycorners, myCrystalWindowMap_, ncrystals_, outsideWindowEnergy_, phisize_, pivot_, pulledPadProbability_, rearleakage_, simulatePreshower_, findQualityFiles::size, totalL0_, totalX0_, truncatedGrid_, X0depthoffset_, X0ECAL_, X0EHGAP_, X0HCAL_, X0PS1_, X0PS2_, and X0PS2EE_.

37  :
38  CaloHitMaker(theCalo,DetId::Ecal,((onEcal==1)?EcalBarrel:EcalEndcap),onEcal,showertype),
39  EcalEntrance_(ecalentrance),
40  onEcal_(onEcal),
41  myTrack_(NULL),
42  random(engine)
43 {
44 #ifdef FAMOSDEBUG
45  myHistos = Histos::instance();
46 #endif
47  // myHistos->debug("Constructeur EcalHitMaker");
48  simulatePreshower_ = true;
49  X0depthoffset_ = 0. ;
50  X0PS1_ = 0.;
51  X0PS2_ = 0.;
52  X0PS2EE_ = 0.;
53  X0ECAL_ = 0.;
54  X0EHGAP_ = 0.;
55  X0HCAL_ = 0.;
56  L0PS1_ = 0.;
57  L0PS2_ = 0.;
58  L0PS2EE_ = 0.;
59  L0ECAL_ = 0.;
60  L0EHGAP_ = 0.;
61  L0HCAL_ = 0.;
62  maxX0_ = 0.;
63  totalX0_ = 0;
64  totalL0_ = 0.;
67  rearleakage_ = 0.;
68  bfactor_ = 1.;
69  ncrystals_ = 0;
70 
71  doreorg_ = !showertype;
72 
74 
75  if(onEcal)
77  else
78  pivot_=Crystal();
79  central_=onEcal==1;
81 
83  // In some cases, a "dummy" grid, not based on a cell, can be built. The previous variables
84  // should however be initialized. In such a case onEcal=0
85  if(!onEcal) return;
86 
87  // Same size in eta-phi
88  etasize_ = size;
89  phisize_ = size;
90 
91  // Build the grid
92  // The result is put in CellsWindow and is ordered by distance to the pivot
94 
95  buildGeometry();
96  // std::cout << " Geometry built " << regionOfInterest_.size() << std::endl;
97 
99 
100  // A local vector of corners
101  mycorners.resize(4);
102  corners.resize(4);
103 
104 #ifdef DEBUGGW
105  myHistos->fill("h10",EcalEntrance_.eta(),CellsWindow_.size());
106  if(onEcal==2)
107  {
108  myHistos->fill("h20",EcalEntrance_.perp(),CellsWindow_.size());
109  if(EcalEntrance_.perp()>70&&EcalEntrance_.perp()<80&&CellsWindow_.size()<35)
110  {
111  std::cout << " Truncated grid " << CellsWindow_.size() << " " << EcalEntrance_.perp() << std::endl;
112  std::cout << " Pivot " << myCalorimeter->getEcalEndcapGeometry()->getGeometry(pivot_.getDetId())->getPosition().perp();
113  std::cout << EEDetId(pivot_.getDetId()) << std::endl;
114 
115  std::cout << " Test getClosestCell " << EcalEntrance_ << std::endl;
116  DetId testcell = myCalorimeter->getClosestCell(EcalEntrance_, true, false);
117  std::cout << " Result "<< EEDetId(testcell) << std::endl;
118  std::cout << " Position " << myCalorimeter->getEcalEndcapGeometry()->getGeometry(testcell)->getPosition() << std::endl;
119  }
120  }
121 
122 #endif
123 
124 }
double pulledPadProbability_
Definition: EcalHitMaker.h:277
CrystalWindowMap * myCrystalWindowMap_
Definition: EcalHitMaker.h:245
void buildCrystal(const DetId &id, Crystal &) const
double L0HCAL_
Definition: EcalHitMaker.h:216
std::vector< CLHEP::Hep2Vector > mycorners
Definition: EcalHitMaker.h:300
const RandomEngineAndDistribution * random
Definition: EcalHitMaker.h:303
#define NULL
Definition: scimark2.h:8
bool simulatePreshower_
Definition: EcalHitMaker.h:269
unsigned ncrystals_
Definition: EcalHitMaker.h:231
double X0HCAL_
Definition: EcalHitMaker.h:211
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:47
unsigned etasize_
Definition: EcalHitMaker.h:251
bool truncatedGrid_
Definition: EcalHitMaker.h:254
double L0PS2EE_
Definition: EcalHitMaker.h:214
double L0ECAL_
Definition: EcalHitMaker.h:215
double X0EHGAP_
Definition: EcalHitMaker.h:210
const FSimTrack * myTrack_
Definition: EcalHitMaker.h:284
static Histos * instance()
Definition: Histos.cc:15
double totalL0_
Definition: EcalHitMaker.h:204
double L0EHGAP_
Definition: EcalHitMaker.h:217
unsigned phisize_
Definition: EcalHitMaker.h:252
double outsideWindowEnergy_
Definition: EcalHitMaker.h:221
Definition: DetId.h:18
std::vector< XYZPoint > corners
Definition: EcalHitMaker.h:301
double X0PS2EE_
Definition: EcalHitMaker.h:208
double bfactor_
Definition: EcalHitMaker.h:267
Crystal pivot_
Definition: EcalHitMaker.h:224
void getWindow(const DetId &pivot, int s1, int s2, std::vector< DetId > &) const
XYZPoint EcalEntrance_
Definition: EcalHitMaker.h:225
double X0ECAL_
Definition: EcalHitMaker.h:209
int ecalFirstSegment_
Definition: EcalHitMaker.h:248
const DetId & getDetId() const
get the DetId
Definition: Crystal.h:49
tuple cout
Definition: gather_cfg.py:121
void buildGeometry()
double X0depthoffset_
Definition: EcalHitMaker.h:205
std::vector< DetId > CellsWindow_
Definition: EcalHitMaker.h:236
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
bool hitmaphasbeencalculated_
Definition: EcalHitMaker.h:297
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
const EcalEndcapGeometry * getEcalEndcapGeometry() const
Definition: Calorimeter.h:53
double rearleakage_
Definition: EcalHitMaker.h:220
tuple size
Write out results.
CaloHitMaker(const CaloGeometryHelper *calo, DetId::Detector det, int subdetn, int cal, unsigned sht=0)
Definition: CaloHitMaker.cc:10
double totalX0_
Definition: EcalHitMaker.h:203
EcalHitMaker::~EcalHitMaker ( )

Definition at line 126 of file EcalHitMaker.cc.

References myCrystalWindowMap_.

127 {
128  if (myCrystalWindowMap_ != 0)
129  {
130  delete myCrystalWindowMap_;
131  }
132 }
CrystalWindowMap * myCrystalWindowMap_
Definition: EcalHitMaker.h:245

Member Function Documentation

bool EcalHitMaker::addHit ( double  r,
double  phi,
unsigned  layer = 0 
)
virtual

Implements CaloHitMaker.

Definition at line 195 of file EcalHitMaker.cc.

References funct::cos(), fastInsideCell(), RandomEngineAndDistribution::flatShoot(), hits_, outsideWindowEnergy_, point, radiusFactor_, random, funct::sin(), and CaloHitMaker::spotEnergy.

Referenced by HFShower::compute(), HDShower::compute(), EMShower::compute(), and HDRShower::setHit().

196 {
197  // std::cout <<" Addhit " << std::endl;
198  // std::cout << " Before insideCell " << std::endl;
199  double sp(1.);
200  // std::cout << " Trying to add " << r << " " << phi << " " << radiusFactor_ << std::endl;
201  r*=radiusFactor_;
202  CLHEP::Hep2Vector point(r*std::cos(phi),r*std::sin(phi));
203  // std::cout << "point " << point << std::endl;
204  // CellID cellid=insideCell(point,sp);
205  unsigned xtal=fastInsideCell(point,sp);
206  // if(cellid.isZero()) std::cout << " cell is Zero " << std::endl;
207  if(xtal<1000)
208  {
209  if(sp==1.)
210  hits_[xtal]+=spotEnergy;
211  else
212  hits_[xtal]+=(random->flatShoot()<sp)*spotEnergy;
213  return true;
214  }
215 
217 // std::cout << " This hit ; r= " << point << " hasn't been added "<<std::endl;
218 // std::cout << " Xtal " << xtal << std::endl;
219 // for(unsigned ip=0;ip<npadsatdepth_;++ip)
220 // {
221 // std::cout << padsatdepth_[ip] << std::endl;
222 // }
223 
224  return false;
225 }
double flatShoot(double xmin=0.0, double xmax=1.0) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const RandomEngineAndDistribution * random
Definition: EcalHitMaker.h:303
unsigned fastInsideCell(const CLHEP::Hep2Vector &point, double &sp, bool debug=false)
double radiusFactor_
Definition: EcalHitMaker.h:261
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double outsideWindowEnergy_
Definition: EcalHitMaker.h:221
std::vector< float > hits_
Definition: EcalHitMaker.h:238
double spotEnergy
Definition: CaloHitMaker.h:51
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
bool EcalHitMaker::addHitDepth ( double  r,
double  phi,
double  depth = -1 
)

Definition at line 135 of file EcalHitMaker.cc.

References funct::cos(), fastInsideCell(), hits_, outsideWindowEnergy_, point, radiusFactor_, rearleakage_, regionOfInterest_, funct::sin(), CaloHitMaker::spotEnergy, and X0depthoffset_.

Referenced by EMShower::compute().

136 {
137 // std::cout << " Add hit depth called; Current deph is " << currentdepth_;
138 // std::cout << " Required depth is " << depth << std::endl;
140  double sp(1.);
141  r*=radiusFactor_;
142  CLHEP::Hep2Vector point(r*std::cos(phi),r*std::sin(phi));
143 
144  unsigned xtal=fastInsideCell(point,sp);
145  // if(cellid.isZero()) std::cout << " cell is Zero " << std::endl;
146 // if(xtal<1000)
147 // {
148 // std::cout << "Result " << regionOfInterest_[xtal].getX0Back() << " " ;
149 // std::cout << depth << std::endl;
150 // }
151 // myHistos->fill("h5000",depth);
152  if(xtal<1000)
153  {
154  // myHistos->fill("h5002",regionOfInterest_[xtal].getX0Back(),depth);
155  // myHistos->fill("h5003",ecalentrance_.eta(),maxX0_);
156  if(regionOfInterest_[xtal].getX0Back()>depth)
157  {
158  hits_[xtal]+=spotEnergy;
159  // myHistos->fill("h5005",r);
160  return true;
161  }
162  else
163  {
165  }
166  }
167  else
168  {
169 // std::cout << " Return false " << std::endl;
170 // std::cout << " Add hit depth called; Current deph is " << currentdepth_;
171 // std::cout << " Required depth is " << depth << std::endl;
172 // std::cout << " R = " << r << " " << radiusFactor_ << std::endl;
173  }
174 
176  return false;
177 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
unsigned fastInsideCell(const CLHEP::Hep2Vector &point, double &sp, bool debug=false)
double radiusFactor_
Definition: EcalHitMaker.h:261
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double outsideWindowEnergy_
Definition: EcalHitMaker.h:221
std::vector< float > hits_
Definition: EcalHitMaker.h:238
std::vector< Crystal > regionOfInterest_
Definition: EcalHitMaker.h:237
double X0depthoffset_
Definition: EcalHitMaker.h:205
double rearleakage_
Definition: EcalHitMaker.h:220
double spotEnergy
Definition: CaloHitMaker.h:51
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
void EcalHitMaker::buildGeometry ( )
private

Definition at line 880 of file EcalHitMaker.cc.

References CaloGeometryHelper::buildCrystal(), CellsWindow_, configuredGeometry_, DetIdMap_, relativeConstraints::empty, hits_, CaloHitMaker::myCalorimeter, myCrystalNumberArray_, myCrystalWindowMap_, ncrystals_, nx_, ny_, padsatdepth_, phisize_, regionOfInterest_, and validPads_.

Referenced by EcalHitMaker().

881 {
882  configuredGeometry_ = false;
883  ncrystals_ = CellsWindow_.size();
884  // create the vector with of pads with the appropriate size
885  padsatdepth_.resize(ncrystals_);
886 
887  // This is fully correct in the barrel.
888  ny_= phisize_;
890  std::vector<unsigned> empty;
891  empty.resize(ny_,0);
892  myCrystalNumberArray_.reserve((unsigned)nx_);
893  for(unsigned inx=0;inx<(unsigned)nx_;++inx)
894  {
895  myCrystalNumberArray_.push_back(empty);
896  }
897 
898  hits_.resize(ncrystals_,0.);
899  regionOfInterest_.clear();
901  validPads_.resize(ncrystals_);
902  for(unsigned ic=0;ic<ncrystals_;++ic)
903  {
905  regionOfInterest_[ic].setNumber(ic);
906  DetIdMap_.insert(std::pair<DetId,unsigned>(CellsWindow_[ic],ic));
907  }
908 
909  // Computes the map of the neighbours
911 }
unsigned ny_
Definition: EcalHitMaker.h:233
CrystalWindowMap * myCrystalWindowMap_
Definition: EcalHitMaker.h:245
void buildCrystal(const DetId &id, Crystal &) const
std::map< DetId, unsigned > DetIdMap_
Definition: EcalHitMaker.h:243
std::vector< CrystalPad > padsatdepth_
Definition: EcalHitMaker.h:294
std::vector< std::vector< unsigned > > myCrystalNumberArray_
Definition: EcalHitMaker.h:200
unsigned ncrystals_
Definition: EcalHitMaker.h:231
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:47
bool configuredGeometry_
Definition: EcalHitMaker.h:230
unsigned phisize_
Definition: EcalHitMaker.h:252
std::vector< float > hits_
Definition: EcalHitMaker.h:238
std::vector< Crystal > regionOfInterest_
Definition: EcalHitMaker.h:237
std::vector< bool > validPads_
Definition: EcalHitMaker.h:240
std::vector< DetId > CellsWindow_
Definition: EcalHitMaker.h:236
unsigned nx_
Definition: EcalHitMaker.h:233
void EcalHitMaker::buildSegments ( const std::vector< CaloPoint > &  cp)
private

Definition at line 664 of file EcalHitMaker.cc.

References CaloGeometryHelper::borderCrossing(), gather_cfg::cout, CaloSegment::CRACK, DetId::Ecal, EcalBarrel, EcalEndcap, EcalEntrance_, ecalFirstSegment_, CaloSegment::ECALHCALGAP, EcalPreshower, CaloSegment::GAP, CaloSegment::HCAL, DetId::Hcal, L0ECAL_, L0EHGAP_, L0HCAL_, CaloSegment::L0length(), L0PS1_, L0PS2_, L0PS2EE_, CaloSegment::length(), CaloHitMaker::myCalorimeter, myTrack_, CaloSegment::PbWO4, FSimVertex::position(), CaloSegment::PS, CaloSegment::PSEEGAP, alignCSCRings::s, segments_, findQualityFiles::size, totalL0_, totalX0_, FSimTrack::vertex(), X0ECAL_, X0EHGAP_, X0HCAL_, CaloSegment::X0length(), X0PS1_, X0PS2_, and X0PS2EE_.

Referenced by setTrackParameters().

665 {
666  // myHistos->debug();
667  // TimeMe theT("FamosGrid::buildSegments");
668  unsigned size=cp.size();
669  if(size%2!=0)
670  {
671  // std::cout << " There is a problem " << std::endl;
672  return;
673  }
674  // myHistos->debug();
675  unsigned nsegments=size/2;
676  segments_.reserve(nsegments);
677  if (size==0) return;
678  // curv abs
679  double s=0.;
680  double sX0=0.;
681  double sL0=0.;
682 
683  unsigned ncrossedxtals = 0;
684  unsigned is=0;
685  while(is<nsegments)
686  {
687 
688  if(cp[2*is].getDetId()!=cp[2*is+1].getDetId()&&
689  cp[2*is].whichDetector()!=DetId::Hcal&&
690  cp[2*is+1].whichDetector()!=DetId::Hcal)
691  {
692 // std::cout << " Problem with the segments " << std::endl;
693 // std::cout << cp[2*is].whichDetector() << " " << cp[2*is+1].whichDetector() << std::endl;
694 // std::cout << is << " " <<cp[2*is].getDetId().rawId() << std::endl;
695 // std::cout << (2*is+1) << " " <<cp[2*is+1].getDetId().rawId() << std::endl;
696  ++is;
697  continue;
698  }
699 
700  // Check if it is a Preshower segment - Layer 1
701  // One segment per layer, nothing between
702  // myHistos->debug("Just avant Preshower");
703  if(cp[2*is].whichDetector()==DetId::Ecal && cp[2*is].whichSubDetector()==EcalPreshower && cp[2*is].whichLayer()==1)
704  {
705  if(cp[2*is+1].whichDetector()==DetId::Ecal && cp[2*is+1].whichSubDetector()==EcalPreshower && cp[2*is+1].whichLayer()==1)
706  {
707  CaloSegment preshsegment(cp[2*is],cp[2*is+1],s,sX0,sL0,CaloSegment::PS,myCalorimeter);
708  segments_.push_back(preshsegment);
709  // std::cout << " Added (1-1)" << preshsegment << std::endl;
710  s+=preshsegment.length();
711  sX0+=preshsegment.X0length();
712  sL0+=preshsegment.L0length();
713  X0PS1_+=preshsegment.X0length();
714  L0PS1_+=preshsegment.L0length();
715  }
716  else
717  {
718  std::cout << " Strange segment between Preshower1 and " << cp[2*is+1].whichDetector();
719  std::cout << std::endl;
720  }
721  ++is;
722  continue;
723  }
724 
725  // Check if it is a Preshower segment - Layer 2
726  // One segment per layer, nothing between
727  if(cp[2*is].whichDetector()==DetId::Ecal && cp[2*is].whichSubDetector()==EcalPreshower && cp[2*is].whichLayer()==2)
728  {
729  if(cp[2*is+1].whichDetector()==DetId::Ecal && cp[2*is+1].whichSubDetector()==EcalPreshower && cp[2*is+1].whichLayer()==2)
730  {
731  CaloSegment preshsegment(cp[2*is],cp[2*is+1],s,sX0,sL0,CaloSegment::PS,myCalorimeter);
732  segments_.push_back(preshsegment);
733  // std::cout << " Added (1-2)" << preshsegment << std::endl;
734  s+=preshsegment.length();
735  sX0+=preshsegment.X0length();
736  sL0+=preshsegment.L0length();
737  X0PS2_+=preshsegment.X0length();
738  L0PS2_+=preshsegment.L0length();
739 
740  // material between preshower and EE
741  if(is<(nsegments-1) && cp[2*is+2].whichDetector()==DetId::Ecal && cp[2*is+2].whichSubDetector()==EcalEndcap)
742  {
743  CaloSegment gapsef(cp[2*is+1],cp[2*is+2],s,sX0,sL0,CaloSegment::PSEEGAP,myCalorimeter);
744  segments_.push_back(gapsef);
745  s+=gapsef.length();
746  sX0+=gapsef.X0length();
747  sL0+=gapsef.L0length();
748  X0PS2EE_+=gapsef.X0length();
749  L0PS2EE_+=gapsef.L0length();
750  // std::cout << " Created a segment " << gapsef.length()<< " " << gapsef.X0length()<< std::endl;
751  }
752  }
753  else
754  {
755  std::cout << " Strange segment between Preshower2 and " << cp[2*is+1].whichDetector();
756  std::cout << std::endl;
757  }
758  ++is;
759  continue;
760  }
761  // Now deal with the ECAL
762  // One segment in each crystal. Segment corresponding to cracks/gaps are added
763  // myHistos->debug("Just avant ECAL");
764  if(cp[2*is].whichDetector()==DetId::Ecal && (cp[2*is].whichSubDetector()==EcalBarrel || cp[2*is].whichSubDetector()==EcalEndcap))
765  {
766  if(cp[2*is+1].whichDetector()==DetId::Ecal && (cp[2*is+1].whichSubDetector()==EcalBarrel || cp[2*is+1].whichSubDetector()==EcalEndcap) )
767  {
768  DetId cell2=cp[2*is+1].getDetId();
769  // set the real entrance
771 
772  // !! Approximatiom : the first segment is always in a crystal
773  if(cp[2*is].getDetId()==cell2)
774  {
775  CaloSegment segment(cp[2*is],cp[2*is+1],s,sX0,sL0,CaloSegment::PbWO4,myCalorimeter);
776  segments_.push_back(segment);
777  // std::cout << " Added (2)" << segment << std::endl;
778  s+=segment.length();
779  sX0+=segment.X0length();
780  sL0+=segment.L0length();
781  X0ECAL_+=segment.X0length();
782  L0ECAL_+=segment.L0length();
783  ++ncrossedxtals;
784  ++is;
785  }
786  else
787  {
788  std::cout << " One more bug in the segment " <<std::endl;
789  ++is;
790  }
791  // Now check if a gap or crack should be added
792  if(is>0 && is<nsegments)
793  {
794  DetId cell3=cp[2*is].getDetId();
795  if(cp[2*is].whichDetector()!=DetId::Hcal)
796  {
797  // Crack inside the ECAL
798  bool bordercrossing=myCalorimeter->borderCrossing(cell2,cell3);
799  CaloSegment cracksegment(cp[2*is-1],cp[2*is],s,sX0,sL0,(bordercrossing)?CaloSegment::CRACK:CaloSegment::GAP,myCalorimeter);
800  segments_.push_back(cracksegment);
801  s+=cracksegment.length();
802  sX0+=cracksegment.X0length();
803  sL0+=cracksegment.L0length();
804  X0ECAL_+=cracksegment.X0length();
805  L0ECAL_+=cracksegment.L0length();
806  // std::cout <<" Added(3) "<< cracksegment << std::endl;
807  }
808  else
809  {
810  // a segment corresponding to ECAL/HCAL transition should be
811  // added here
812  CaloSegment cracksegment(cp[2*is-1],cp[2*is],s,sX0,sL0,CaloSegment::ECALHCALGAP,myCalorimeter);
813  segments_.push_back(cracksegment);
814  s+=cracksegment.length();
815  sX0+=cracksegment.X0length();
816  sL0+=cracksegment.L0length();
817  X0EHGAP_+=cracksegment.X0length();
818  L0EHGAP_+=cracksegment.L0length();
819  }
820  }
821  continue;
822  }
823  else
824  {
825  std::cout << " Strange segment between " << cp[2*is].whichDetector();
826  std::cout << " and " << cp[2*is+1].whichDetector() << std::endl;
827  ++is;
828  continue;
829  }
830  }
831  // myHistos->debug("Just avant HCAL");
832  // HCAL
833  if(cp[2*is].whichDetector()==DetId::Hcal&&cp[2*is+1].whichDetector()==DetId::Hcal)
834  {
835  CaloSegment segment(cp[2*is],cp[2*is+1],s,sX0,sL0,CaloSegment::HCAL,myCalorimeter);
836  segments_.push_back(segment);
837  s+=segment.length();
838  sX0+=segment.X0length();
839  sL0+=segment.L0length();
840  X0HCAL_+=segment.X0length();
841  L0HCAL_+=segment.L0length();
842  // std::cout <<" Added(4) "<< segment << std::endl;
843  ++is;
844  }
845  }
846 // std::cout << " PS1 " << X0PS1_ << " " << L0PS1_ << std::endl;
847 // std::cout << " PS2 " << X0PS2_ << " " << L0PS2_ << std::endl;
848 // std::cout << " ECAL " << X0ECAL_ << " " << L0ECAL_ << std::endl;
849 // std::cout << " HCAL " << X0HCAL_ << " " << L0HCAL_ << std::endl;
850 
853  // myHistos->debug("Just avant le fill");
854 
855  #ifdef DEBUGCELLLINE
856  myHistos->fill("h200",fabs(EcalEntrance_.eta()),X0ECAL_);
857  myHistos->fill("h210",EcalEntrance_.phi(),X0ECAL_);
858  if(X0ECAL_<20)
859  myHistos->fill("h212",EcalEntrance_.phi(),X0ECAL_);
860 // if(X0ECAL_<1.)
861 // {
862 // for(unsigned ii=0; ii<segments_.size() ; ++ii)
863 // {
864 // std::cout << segments_[ii] << std::endl;
865 // }
866 // }
867  myHistos->fillByNumber("h30",ncrossedxtals,EcalEntrance_.eta(),X0ECAL_);
868 
869  double zvertex = myTrack_->vertex().position().z();
870 
871  myHistos->fill("h310",EcalEntrance_.eta(),X0ECAL_);
872  if(X0ECAL_<22) myHistos->fill("h410",EcalEntrance_.phi());
873  myHistos->fill("h400",zvertex,X0ECAL_);
874  #endif
875  // std::cout << " Finished the segments " << std::endl;
876 
877 }
double L0HCAL_
Definition: EcalHitMaker.h:216
bool borderCrossing(const DetId &, const DetId &) const
double X0HCAL_
Definition: EcalHitMaker.h:211
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:47
double L0PS2EE_
Definition: EcalHitMaker.h:214
const math::XYZTLorentzVector & position() const
Temporary (until CMSSW moves to Mathcore) - No ! Actually very useful.
Definition: FSimVertex.h:49
double L0ECAL_
Definition: EcalHitMaker.h:215
double X0EHGAP_
Definition: EcalHitMaker.h:210
const FSimTrack * myTrack_
Definition: EcalHitMaker.h:284
double totalL0_
Definition: EcalHitMaker.h:204
double L0EHGAP_
Definition: EcalHitMaker.h:217
const FSimVertex & vertex() const
Origin vertex.
Definition: DetId.h:18
double X0PS2EE_
Definition: EcalHitMaker.h:208
XYZPoint EcalEntrance_
Definition: EcalHitMaker.h:225
double X0ECAL_
Definition: EcalHitMaker.h:209
int ecalFirstSegment_
Definition: EcalHitMaker.h:248
tuple cout
Definition: gather_cfg.py:121
tuple size
Write out results.
double totalX0_
Definition: EcalHitMaker.h:203
std::vector< CaloSegment > segments_
Definition: EcalHitMaker.h:289
void EcalHitMaker::cellLine ( std::vector< CaloPoint > &  cp)
private

Definition at line 411 of file EcalHitMaker.cc.

References central_, gather_cfg::cout, dir, ecalCellLine(), FSimTrack::ecalEntrance(), EcalEntrance_, hcalCellLine(), FSimTrack::hcalEntrance(), FSimTrack::layer1Entrance(), FSimTrack::layer2Entrance(), myTrack_, normal_, FSimTrack::onEcal(), onEcal_, FSimTrack::onHcal(), FSimTrack::onLayer1(), FSimTrack::onLayer2(), FSimTrack::onVFcal(), FSimVertex::position(), preshowerCellLine(), simulatePreshower_, python.multivaluedict::sort(), FSimTrack::vertex(), RawParticle::vertex(), and FSimTrack::vfcalEntrance().

Referenced by setTrackParameters().

412 {
413  cp.clear();
414  // if(myTrack->onVFcal()!=2)
415  // {
418  // }
419 
420  XYZPoint vertex(myTrack_->vertex().position().Vect());
421 
422  //sort the points by distance (in the ECAL they are not necessarily ordered)
423  XYZVector dir(0.,0.,0.);
424  if(myTrack_->onLayer1())
425  {
426  vertex=(myTrack_->layer1Entrance().vertex()).Vect();
427  dir=myTrack_->layer1Entrance().Vect().Unit();
428  }
429  else if(myTrack_->onLayer2())
430  {
431  vertex=(myTrack_->layer2Entrance().vertex()).Vect();
432  dir=myTrack_->layer2Entrance().Vect().Unit();
433  }
434  else if(myTrack_->onEcal())
435  {
436  vertex=(myTrack_->ecalEntrance().vertex()).Vect();
437  dir=myTrack_->ecalEntrance().Vect().Unit();
438  }
439  else if(myTrack_->onHcal())
440  {
441  vertex=(myTrack_->hcalEntrance().vertex()).Vect();
442  dir=myTrack_->hcalEntrance().Vect().Unit();
443  }
444  else if(myTrack_->onVFcal()==2)
445  {
446  vertex=(myTrack_->vfcalEntrance().vertex()).Vect();
447  dir=myTrack_->vfcalEntrance().Vect().Unit();
448  }
449  else
450  {
451  std::cout << " Problem with the grid " << std::endl;
452  }
453 
454  // Move the vertex for distance comparison (5cm)
455  vertex -= 5.*dir;
456  CaloPoint::DistanceToVertex myDistance(vertex);
457  sort(cp.begin(),cp.end(),myDistance);
458 
459  // The intersections with the HCAL shouldn't need to be sorted
460  // with the N.I it is actually a source of problems
461  hcalCellLine(cp);
462 
463 // std::cout << " Intersections ordered by distance to " << vertex << std::endl;
464 //
465 // for (unsigned ic=0;ic<cp.size();++ic)
466 // {
467 // XYZVector t=cp[ic]-vertex;
468 // std::cout << cp[ic] << " " << t.mag() << std::endl;
469 // }
470 }
XYZNormal normal_
Definition: EcalHitMaker.h:226
void ecalCellLine(const XYZPoint &, const XYZPoint &, std::vector< CaloPoint > &cp)
const RawParticle & vfcalEntrance() const
The particle at VFCAL entrance.
Definition: FSimTrack.h:139
int onLayer2() const
Definition: FSimTrack.h:96
void hcalCellLine(std::vector< CaloPoint > &cp) const
const RawParticle & layer1Entrance() const
The particle at Preshower Layer 1.
Definition: FSimTrack.h:127
bool simulatePreshower_
Definition: EcalHitMaker.h:269
int onEcal() const
Definition: FSimTrack.h:101
math::XYZVector XYZVector
const math::XYZTLorentzVector & position() const
Temporary (until CMSSW moves to Mathcore) - No ! Actually very useful.
Definition: FSimVertex.h:49
const FSimTrack * myTrack_
Definition: EcalHitMaker.h:284
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
Definition: FSimTrack.h:133
int onVFcal() const
Definition: FSimTrack.h:111
const FSimVertex & vertex() const
Origin vertex.
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:285
XYZPoint EcalEntrance_
Definition: EcalHitMaker.h:225
math::XYZVector XYZPoint
const RawParticle & layer2Entrance() const
The particle at Preshower Layer 2.
Definition: FSimTrack.h:130
int onLayer1() const
Definition: FSimTrack.h:91
int onHcal() const
Definition: FSimTrack.h:106
void preshowerCellLine(std::vector< CaloPoint > &cp) const
const RawParticle & hcalEntrance() const
The particle at HCAL entrance.
Definition: FSimTrack.h:136
tuple cout
Definition: gather_cfg.py:121
dbl *** dir
Definition: mlp_gen.cc:35
void EcalHitMaker::configureGeometry ( )
private

Definition at line 1116 of file EcalHitMaker.cc.

References bfactor_, CaloGeometryHelper::borderCrossing(), configuredGeometry_, DetIdMap_, dir, EcalEntrance_, M_PI, M_PI_2, CaloGeometryHelper::magneticField(), CaloGeometryHelper::move(), CaloHitMaker::myCalorimeter, ncrystals_, CaloDirectionOperations::neighbourDirection(), CaloDirectionOperations::oppositeDirection(), regionOfInterest_, ntuplemaker::status, and theta().

Referenced by getPads().

1117 {
1118  configuredGeometry_=true;
1119  for(unsigned ic=0;ic<ncrystals_;++ic)
1120  {
1121  // std::cout << " Building " << cellids_[ic] << std::endl;
1122  for(unsigned idir=0;idir<8;++idir)
1123  {
1124 
1125  unsigned oppdir=CaloDirectionOperations::oppositeDirection(idir);
1126  // Is there something else to do ?
1127  // The relationship with the neighbour may have been set previously.
1128  if(regionOfInterest_[ic].crystalNeighbour(idir).status()>=0)
1129  {
1130  // std::cout << " Nothing to do " << std::endl;
1131  continue ;
1132  }
1133 
1134  const DetId & oldcell(regionOfInterest_[ic].getDetId());
1136  DetId newcell(oldcell);
1137  if(!myCalorimeter->move(newcell,dir))
1138  {
1139  // no neighbour in this direction
1140  regionOfInterest_[ic].crystalNeighbour(idir).setStatus(-1);
1141  continue;
1142  }
1143  // Determine the number of this neighbour
1144  // std::cout << " The neighbour is " << newcell << std::endl;
1145  std::map<DetId,unsigned>::const_iterator niter(DetIdMap_.find(newcell));
1146  if(niter==DetIdMap_.end())
1147  {
1148  // std::cout << " The neighbour is not in the map " << std::endl;
1149  regionOfInterest_[ic].crystalNeighbour(idir).setStatus(-1);
1150  continue;
1151  }
1152  // Now there is a neighbour
1153  // std::cout << " The neighbour is " << niter->second << " " << cellids_[niter->second] << std::endl;
1154  regionOfInterest_[ic].crystalNeighbour(idir).setNumber(niter->second);
1155  // std::cout << " Managed to set crystalNeighbour " << ic << " " << idir << std::endl;
1156  // std::cout << " Trying " << niter->second << " " << oppdir << std::endl;
1157  regionOfInterest_[niter->second].crystalNeighbour(oppdir).setNumber(ic);
1158  // std::cout << " Crack/gap " << std::endl;
1159  if(myCalorimeter->borderCrossing(oldcell,newcell))
1160  {
1161  regionOfInterest_[ic].crystalNeighbour(idir).setStatus(1);
1162  regionOfInterest_[niter->second].crystalNeighbour(oppdir).setStatus(1);
1163  // std::cout << " Crack ! " << std::endl;
1164  }
1165  else
1166  {
1167  regionOfInterest_[ic].crystalNeighbour(idir).setStatus(0);
1168  regionOfInterest_[niter->second].crystalNeighbour(oppdir).setStatus(0);
1169  // std::cout << " Gap" << std::endl;
1170  }
1171  }
1172  }
1173  // Magnetic field a la Charlot
1174  double theta=EcalEntrance_.theta();
1175  if(theta>M_PI_2) theta=M_PI-theta;
1176  bfactor_=1./(1.+0.133*theta);
1177  if(myCalorimeter->magneticField()==0. ) bfactor_=1.;
1178 }
std::map< DetId, unsigned > DetIdMap_
Definition: EcalHitMaker.h:243
Geom::Theta< T > theta() const
#define M_PI_2
static unsigned oppositeDirection(unsigned iside)
bool borderCrossing(const DetId &, const DetId &) const
static unsigned neighbourDirection(const CaloDirection &side)
unsigned int -&gt; Direction for the neighbours
unsigned ncrystals_
Definition: EcalHitMaker.h:231
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:47
bool configuredGeometry_
Definition: EcalHitMaker.h:230
double magneticField() const
#define M_PI
Definition: DetId.h:18
double bfactor_
Definition: EcalHitMaker.h:267
XYZPoint EcalEntrance_
Definition: EcalHitMaker.h:225
std::vector< Crystal > regionOfInterest_
Definition: EcalHitMaker.h:237
dbl *** dir
Definition: mlp_gen.cc:35
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
tuple status
Definition: ntuplemaker.py:245
bool move(DetId &cell, const CaloDirection &dir, bool fast=true) const
void EcalHitMaker::convertIntegerCoordinates ( double  x,
double  y,
unsigned &  ix,
unsigned &  iy 
) const
private

Definition at line 1208 of file EcalHitMaker.cc.

References sizex_, sizey_, xmin_, and ymin_.

Referenced by fastInsideCell(), and prepareCrystalNumberArray().

1209 {
1210  int tix=(int)((x-xmin_)/sizex_);
1211  int tiy=(int)((y-ymin_)/sizey_);
1212  ix=iy=9999;
1213  if(tix>=0) ix=(unsigned)tix;
1214  if(tiy>=0) iy=(unsigned)tiy;
1215 }
CLHEP::Hep2Vector & EcalHitMaker::correspondingEdge ( neighbour myneighbour,
CaloDirection  dir2 
)
private

Definition at line 1305 of file EcalHitMaker.cc.

References CaloDirectionOperations::add2d(), dir, CaloDirectionOperations::oppositeSide(), and padsatdepth_.

Referenced by gapsLifting().

1306 {
1309  // std::cout << "Corresponding Edge " << dir<< " " << dir2 << " " << corner << std::endl;
1310  return padsatdepth_[myneighbour.second].edge(corner);
1311 }
static CaloDirection add2d(const CaloDirection &dir1, const CaloDirection &dir2)
static CaloDirection oppositeSide(const CaloDirection &side)
std::vector< CrystalPad > padsatdepth_
Definition: EcalHitMaker.h:294
dbl *** dir
Definition: mlp_gen.cc:35
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
void EcalHitMaker::cracksPads ( std::vector< neighbour > &  cracks,
unsigned  iq 
)
private

Definition at line 1493 of file EcalHitMaker.cc.

References crackPadProbability_, crackpadsatdepth_, EAST, CrystalPad::edge(), plotBeamSpotDB::first, mycorners, NORTH, NORTHEAST, NORTHWEST, padsatdepth_, CrystalPad::setSurvivalProbability(), SOUTH, SOUTHEAST, SOUTHWEST, and WEST.

Referenced by reorganizePads().

1494 {
1495  // std::cout << " myPad " << &myPad << std::endl;
1496  unsigned ncracks=cracks.size();
1497  CrystalPad & myPad = padsatdepth_[iq];
1498  for(unsigned ic=0;ic<ncracks;++ic)
1499  {
1500  // std::vector<CLHEP::Hep2Vector> mycorners;
1501  // mycorners.reserve(4);
1502  switch(cracks[ic].first)
1503  {
1504  case NORTH:
1505  {
1506  mycorners[0] = (padsatdepth_[cracks[ic].second].edge(SOUTHWEST));
1507  mycorners[1] = (padsatdepth_[cracks[ic].second].edge(SOUTHEAST));
1508  mycorners[2] = (myPad.edge(NORTHEAST));
1509  mycorners[3] = (myPad.edge(NORTHWEST));
1510  }
1511  break;
1512  case SOUTH:
1513  {
1514  mycorners[0] = (myPad.edge(SOUTHWEST));
1515  mycorners[1] = (myPad.edge(SOUTHEAST));
1516  mycorners[2] = (padsatdepth_[cracks[ic].second].edge(NORTHEAST));
1517  mycorners[3] = (padsatdepth_[cracks[ic].second].edge(NORTHWEST));
1518  }
1519  break;
1520  case EAST:
1521  {
1522  mycorners[0] = (myPad.edge(NORTHEAST));
1523  mycorners[1] = (padsatdepth_[cracks[ic].second].edge(NORTHWEST));
1524  mycorners[2] = (padsatdepth_[cracks[ic].second].edge(SOUTHWEST));
1525  mycorners[3] = (myPad.edge(SOUTHEAST));
1526  }
1527  break;
1528  case WEST:
1529  {
1530  mycorners[0] = (padsatdepth_[cracks[ic].second].edge(NORTHEAST));
1531  mycorners[1] = (myPad.edge(NORTHWEST));
1532  mycorners[2] = (myPad.edge(SOUTHWEST));
1533  mycorners[3] = (padsatdepth_[cracks[ic].second].edge(SOUTHEAST));
1534  }
1535  break;
1536  default:
1537  {
1538  }
1539  }
1540  CrystalPad crackpad(ic,mycorners);
1541  // to be tuned. A simpleconfigurable should be used
1542  crackpad.setSurvivalProbability(crackPadProbability_);
1543  crackpadsatdepth_.push_back(crackpad);
1544  }
1545  // std::cout << " Finished cracksPads " << std::endl;
1546 }
std::vector< CrystalPad > crackpadsatdepth_
Definition: EcalHitMaker.h:295
std::vector< CrystalPad > padsatdepth_
Definition: EcalHitMaker.h:294
std::vector< CLHEP::Hep2Vector > mycorners
Definition: EcalHitMaker.h:300
CLHEP::Hep2Vector & edge(unsigned iside, int n)
access to the corners in direction iside; n=0,1
Definition: CrystalPad.cc:263
double crackPadProbability_
Definition: EcalHitMaker.h:279
bool EcalHitMaker::diagonalEdge ( unsigned  myPad,
CaloDirection  dir,
CLHEP::Hep2Vector &  point 
)
private

Definition at line 1313 of file EcalHitMaker.cc.

References CaloDirectionOperations::neighbourDirection(), CaloDirectionOperations::oppositeSide(), padsatdepth_, regionOfInterest_, ntuplemaker::status, and validPads_.

Referenced by gapsLifting().

1314 {
1316  if(regionOfInterest_[myPad].crystalNeighbour(idir).status()<0)
1317  return false;
1318  unsigned nneighbour=regionOfInterest_[myPad].crystalNeighbour(idir).number();
1319  if(!validPads_[nneighbour])
1320  {
1321  // std::cout << " Wasn't able to move " << std::endl;
1322  return false;
1323  }
1325  return true;
1326 }
static CaloDirection oppositeSide(const CaloDirection &side)
std::vector< CrystalPad > padsatdepth_
Definition: EcalHitMaker.h:294
static unsigned neighbourDirection(const CaloDirection &side)
unsigned int -&gt; Direction for the neighbours
std::vector< Crystal > regionOfInterest_
Definition: EcalHitMaker.h:237
std::vector< bool > validPads_
Definition: EcalHitMaker.h:240
dbl *** dir
Definition: mlp_gen.cc:35
tuple status
Definition: ntuplemaker.py:245
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
void EcalHitMaker::ecalCellLine ( const XYZPoint a,
const XYZPoint b,
std::vector< CaloPoint > &  cp 
)
private

Definition at line 571 of file EcalHitMaker.cc.

References angle(), corners, DOWN, inside3D(), CaloHitMaker::intersect(), mag2(), ncrystals_, normal_, regionOfInterest_, CaloDirectionOperations::Side(), mathSSE::sqrt(), tree::t, funct::tan(), and UP.

Referenced by cellLine().

572 {
573  // std::vector<XYZPoint> corners;
574  // corners.resize(4);
575  unsigned ic=0;
576  double t;
577  XYZPoint xp;
578  DetId c_entrance,c_exit;
579  bool entrancefound(false),exitfound(false);
580  // std::cout << " Look for intersections " << ncrystals_ << std::endl;
581  // std::cout << " regionOfInterest_ " << truncatedGrid_ << " " << regionOfInterest_.size() << std::endl;
582  // try to determine the number of crystals to test
583  // First determine the incident angle
584  double angle=std::acos(normal_.Dot(regionOfInterest_[0].getAxis().Unit()));
585 
586  // std::cout << " Normal " << normal_<< " Axis " << regionOfInterest_[0].getAxis().Unit() << std::endl;
587  double backdistance=std::sqrt(regionOfInterest_[0].getAxis().mag2())*std::tan(angle);
588  // 1/2.2cm = 0.45
589 // std::cout << " Angle " << angle << std::endl;
590 // std::cout << " Back distance " << backdistance << std::endl;
591  unsigned ncrystals=(unsigned)(backdistance*0.45);
592  unsigned highlim=(ncrystals+4);
593  highlim*=highlim;
594  if(highlim>ncrystals_) highlim=ncrystals_;
595  // unsigned lowlim=(ncrystals>2)? (ncrystals-2):0;
596  // std::cout << " Ncrys " << ncrystals << std::endl;
597 
598 
599  while(ic<ncrystals_&&(ic<highlim||!exitfound))
600  {
601  // Check front side
602  // if(!entrancefound)
603  {
604  const Plane3D& plan=regionOfInterest_[ic].getFrontPlane();
605 // XYZVector axis1=(plan.Normal());
606 // XYZVector axis2=regionOfInterest_[ic].getFirstEdge();
607  xp=intersect(plan,a,b,t,false);
608  regionOfInterest_[ic].getFrontSide(corners);
609  // CrystalPad pad(9999,onEcal_,corners,regionOfInterest_[ic].getCorner(0),axis1,axis2);
610  // if(pad.globalinside(xp))
611  if(inside3D(corners,xp))
612  {
613  cp.push_back(CaloPoint(regionOfInterest_[ic].getDetId(),UP,xp));
614  entrancefound=true;
615  c_entrance=regionOfInterest_[ic].getDetId();
616  // myHistos->fill("j12",highlim,ic);
617  }
618  }
619 
620  // check rear side
621  // if(!exitfound)
622  {
623  const Plane3D& plan=regionOfInterest_[ic].getBackPlane();
624 // XYZVector axis1=(plan.Normal());
625 // XYZVector axis2=regionOfInterest_[ic].getFifthEdge();
626  xp=intersect(plan,a,b,t,false);
627  regionOfInterest_[ic].getBackSide(corners);
628  // CrystalPad pad(9999,onEcal_,corners,regionOfInterest_[ic].getCorner(4),axis1,axis2);
629  // if(pad.globalinside(xp))
630  if(inside3D(corners,xp))
631  {
632  cp.push_back(CaloPoint(regionOfInterest_[ic].getDetId(),DOWN,xp));
633  exitfound=true;
634  c_exit=regionOfInterest_[ic].getDetId();
635  // std::cout << " Crystal : " << ic << std::endl;
636  // myHistos->fill("j10",highlim,ic);
637  }
638  }
639 
640  if(entrancefound&&exitfound&&c_entrance==c_exit) return;
641  // check lateral sides
642  for(unsigned iside=0;iside<4;++iside)
643  {
644  const Plane3D& plan=regionOfInterest_[ic].getLateralPlane(iside);
645  xp=intersect(plan,a,b,t,false);
646 // XYZVector axis1=(plan.Normal());
647 // XYZVector axis2=regionOfInterest_[ic].getLateralEdge(iside);
648  regionOfInterest_[ic].getLateralSide(iside,corners);
649  // CrystalPad pad(9999,onEcal_,corners,regionOfInterest_[ic].getCorner(iside),axis1,axis2);
650  // if(pad.globalinside(xp))
651  if(inside3D(corners,xp))
652  {
653  cp.push_back(CaloPoint(regionOfInterest_[ic].getDetId(),CaloDirectionOperations::Side(iside),xp));
654  // std::cout << cp[cp.size()-1] << std::endl;
655  }
656  }
657  // Go to next crystal
658  ++ic;
659  }
660 }
XYZNormal normal_
Definition: EcalHitMaker.h:226
tuple t
Definition: tree.py:139
unsigned ncrystals_
Definition: EcalHitMaker.h:231
T sqrt(T t)
Definition: SSEVec.h:48
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
static XYZPoint intersect(const Plane3D &p, const XYZPoint &a, const XYZPoint &b, double &t, bool segment, bool debug=false)
Definition: CaloHitMaker.cc:38
static CaloDirection Side(unsigned i)
unsigned int -&gt; Side conversion
Definition: DetId.h:18
std::vector< XYZPoint > corners
Definition: EcalHitMaker.h:301
double b
Definition: hdecay.h:120
std::vector< Crystal > regionOfInterest_
Definition: EcalHitMaker.h:237
math::XYZVector XYZPoint
double a
Definition: hdecay.h:121
bool inside3D(const std::vector< XYZPoint > &, const XYZPoint &p) const
ROOT::Math::Plane3D Plane3D
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
const XYZPoint& EcalHitMaker::ecalEntrance ( ) const
inline

used in FamosHcalHitMaker

Definition at line 128 of file EcalHitMaker.h.

References EcalEntrance_.

Referenced by HcalHitMaker::HcalHitMaker().

128 {return EcalEntrance_;};
XYZPoint EcalEntrance_
Definition: EcalHitMaker.h:225
double EcalHitMaker::ecalHcalGapTotalL0 ( ) const
inline

ECAL-HCAL transition.

Definition at line 95 of file EcalHitMaker.h.

References L0EHGAP_.

Referenced by HDRShower::computeShower(), HDShower::HDShower(), and HFShower::HFShower().

95 { return L0EHGAP_;}
double L0EHGAP_
Definition: EcalHitMaker.h:217
double EcalHitMaker::ecalHcalGapTotalX0 ( ) const
inline

ECAL-HCAL transition.

Definition at line 74 of file EcalHitMaker.h.

References X0EHGAP_.

Referenced by HDShower::HDShower(), and HFShower::HFShower().

74 { return X0EHGAP_;}
double X0EHGAP_
Definition: EcalHitMaker.h:210
double EcalHitMaker::ecalTotalL0 ( ) const
inline

in the ECAL

Definition at line 89 of file EcalHitMaker.h.

References L0ECAL_.

Referenced by HDRShower::computeShower(), HDShower::HDShower(), and HFShower::HFShower().

89 {return L0ECAL_;}
double L0ECAL_
Definition: EcalHitMaker.h:215
double EcalHitMaker::ecalTotalX0 ( ) const
inline

in the ECAL

Definition at line 71 of file EcalHitMaker.h.

References X0ECAL_.

Referenced by EMShower::prepareSteps(), and setTrackParameters().

71 {return X0ECAL_;}
double X0ECAL_
Definition: EcalHitMaker.h:209
unsigned EcalHitMaker::fastInsideCell ( const CLHEP::Hep2Vector &  point,
double &  sp,
bool  debug = false 
)

Definition at line 244 of file EcalHitMaker.cc.

References convertIntegerCoordinates(), gather_cfg::cout, crackpadsatdepth_, newFWLiteAna::found, CrystalWindowMap::getCrystalWindow(), myCrystalNumberArray_, myCrystalWindowMap_, ncrackpadsatdepth_, nx_, ny_, padsatdepth_, findQualityFiles::size, ntuplemaker::status, and validPads_.

Referenced by addHit(), and addHitDepth().

245 {
246 
247  // debug = true;
248  bool found=false;
249  unsigned niter=0;
250  // something clever has to be implemented here
251  unsigned d1,d2;
252  convertIntegerCoordinates(point.x(),point.y(),d1,d2);
253  // std::cout << "Fastinside cell " << point.x() << " " << point.y() << " " << d1 << " "<< d2 << " " << nx_ << " " << ny_ << std::endl;
254  if(d1>=nx_||d2>=ny_)
255  {
256  // std::cout << " Not in the map " <<std::endl;
257  return 9999;
258  }
259  unsigned cell=myCrystalNumberArray_[d1][d2];
260  // We are likely to be lucky
261  // std::cout << " Got the cell " << cell << std::endl;
262  if (validPads_[cell]&&padsatdepth_[cell].inside(point))
263  {
264  // std::cout << " We are lucky " << cell << std::endl;
265  sp = padsatdepth_[cell].survivalProbability();
266  return cell;
267  }
268 
269  // std::cout << "Starting the loop " << std::endl;
270  bool status(true);
271  const std::vector<unsigned>& localCellVector(myCrystalWindowMap_->getCrystalWindow(cell,status));
272  if(status)
273  {
274  unsigned size=localCellVector.size();
275  // std::cout << " Starting from " << EBDetId(regionOfInterest_[cell].getDetId()) << std::endl;
276  // const std::vector<DetId>& neighbours=myCalorimeter->getNeighbours(regionOfInterest_[cell].getDetId());
277 // std::cout << " The neighbours are " << std::endl;
278 // for(unsigned ic=0;ic<neighbours.size(); ++ic)
279 // {
280 // std::cout << EBDetId(neighbours[ic]) << std::endl;
281 // }
282 // std::cout << " Done " << std::endl;
283  for(unsigned ic=0;ic<8&&ic<size;++ic)
284  {
285  unsigned iq=localCellVector[ic];
286 // std::cout << " Testing " << EBDetId(regionOfInterest_[iq].getDetId()) << std::endl; ;
287 // std::cout << " " << iq << std::endl;
288 // std::cout << padsatdepth_[iq] ;
289  if(validPads_[iq]&&padsatdepth_[iq].inside(point))
290  {
291  // std::cout << " Yes " << std::endl;
292  // myHistos->fill("h1000",niter);
293  sp = padsatdepth_[iq].survivalProbability();
294  // std::cout << "Finished the loop " << niter << std::endl;
295  // std::cout << "Inside " << std::endl;
296  return iq;
297  }
298  // std::cout << " Not inside " << std::endl;
299  // std::cout << "No " << std::endl;
300  ++niter;
301  }
302  }
303  if(debug) std::cout << " not found in a quad, let's check the " << ncrackpadsatdepth_ << " cracks " << std::endl;
304  // std::cout << "Finished the loop " << niter << std::endl;
305  // Let's check the cracks
306  // std::cout << " Let's check the cracks " << ncrackpadsatdepth_ << " " << crackpadsatdepth_.size() << std::endl;
307  unsigned iquad=0;
308  unsigned iquadinside=999;
309  while(iquad<ncrackpadsatdepth_&&!found)
310  {
311  // std::cout << " Inside the while " << std::endl;
312  if(crackpadsatdepth_[iquad].inside(point))
313  {
314  iquadinside=iquad;
315  found=true;
316  sp = crackpadsatdepth_[iquad].survivalProbability();
317  }
318  ++iquad;
319  ++niter;
320  }
321  // myHistos->fill("h1002",niter);
322  if(!found&&debug) std::cout << " Not found in the cracks " << std::endl;
323  return (found) ? crackpadsatdepth_[iquadinside].getNumber(): 9999;
324 }
unsigned ny_
Definition: EcalHitMaker.h:233
CrystalWindowMap * myCrystalWindowMap_
Definition: EcalHitMaker.h:245
std::vector< CrystalPad > crackpadsatdepth_
Definition: EcalHitMaker.h:295
std::vector< CrystalPad > padsatdepth_
Definition: EcalHitMaker.h:294
std::vector< std::vector< unsigned > > myCrystalNumberArray_
Definition: EcalHitMaker.h:200
bool getCrystalWindow(unsigned, std::vector< unsigned > &) const
get the ordered list of the crystals around the crystal given as a first argument ...
unsigned ncrackpadsatdepth_
Definition: EcalHitMaker.h:272
#define debug
Definition: HDRShower.cc:19
tuple cout
Definition: gather_cfg.py:121
std::vector< bool > validPads_
Definition: EcalHitMaker.h:240
tuple status
Definition: ntuplemaker.py:245
void convertIntegerCoordinates(double x, double y, unsigned &ix, unsigned &iy) const
tuple size
Write out results.
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
unsigned nx_
Definition: EcalHitMaker.h:233
void EcalHitMaker::gapsLifting ( std::vector< neighbour > &  gaps,
unsigned  iq 
)
private

Definition at line 1357 of file EcalHitMaker.cc.

References CaloDirectionOperations::add2d(), constexpr, correspondingEdge(), gather_cfg::cout, debug, diagonalEdge(), GetRecoTauVFromDQM_MC_cff::dir2, EAST, CrystalPad::edge(), plotBeamSpotDB::first, NONE, NORTH, NORTHEAST, NORTHWEST, CaloDirectionOperations::oppositeSide(), padsatdepth_, point, SOUTH, SOUTHEAST, SOUTHWEST, unbalancedDirection(), and WEST.

Referenced by reorganizePads().

1358 {
1359  // std::cout << " Entering gapsLifting " << std::endl;
1360  CrystalPad & myPad = padsatdepth_[iq];
1361  unsigned ngaps=gaps.size();
1362  constexpr bool debug=false;
1363  if(ngaps==1)
1364  {
1365  if(debug)
1366  {
1367  std::cout << " Avant " << ngaps << " " <<gaps[0].first<< std::endl;
1368  std::cout << myPad << std::endl;
1369  }
1370  if(gaps[0].first==NORTH||gaps[0].first==SOUTH)
1371  {
1374  myPad.edge(dir1)=correspondingEdge(gaps[0],EAST);
1375  myPad.edge(dir2)=correspondingEdge(gaps[0],WEST);
1376  }
1377  else
1378  {
1381  myPad.edge(dir1)=correspondingEdge(gaps[0],NORTH);
1382  myPad.edge(dir2)=correspondingEdge(gaps[0],SOUTH);
1383  }
1384  if(debug)
1385  {
1386  std::cout << " Apres " << std::endl;
1387  std::cout << myPad << std::endl;
1388  }
1389  }
1390  else
1391  if(ngaps==2)
1392  {
1393  if(debug)
1394  {
1395  std::cout << " Avant " << ngaps << " " <<gaps[0].first<< " " <<gaps[1].first << std::endl;
1396  std::cout << myPad << std::endl;
1397  std::cout << " Voisin 1 " << (gaps[0].second) << std::endl;
1398  std::cout << " Voisin 2 " << (gaps[1].second) << std::endl;
1399  }
1400  CaloDirection corner0=CaloDirectionOperations::add2d(gaps[0].first,gaps[1].first);
1401 
1402  CLHEP::Hep2Vector point(0.,0.);
1403  if(corner0!=NONE&&diagonalEdge(iq,corner0,point))
1404  {
1407  myPad.edge(corner0) = point;
1408  myPad.edge(corner1) = correspondingEdge(gaps[1],CaloDirectionOperations::oppositeSide(gaps[0].first));
1409  myPad.edge(corner2) = correspondingEdge(gaps[0],CaloDirectionOperations::oppositeSide(gaps[1].first));
1410  }
1411  else
1412  if(corner0==NONE)
1413  {
1414  if(gaps[0].first==EAST||gaps[0].first==WEST)
1415  {
1416  CaloDirection corner1=CaloDirectionOperations::add2d(gaps[0].first,NORTH);
1417  CaloDirection corner2=CaloDirectionOperations::add2d(gaps[0].first,SOUTH);
1418  myPad.edge(corner1)=correspondingEdge(gaps[0],NORTH);
1419  myPad.edge(corner2)=correspondingEdge(gaps[0],SOUTH);
1420 
1421  corner1=CaloDirectionOperations::add2d(gaps[1].first,NORTH);
1422  corner2=CaloDirectionOperations::add2d(gaps[1].first,SOUTH);
1423  myPad.edge(corner1)=correspondingEdge(gaps[1],NORTH);
1424  myPad.edge(corner2)=correspondingEdge(gaps[1],SOUTH);
1425  }
1426  else
1427  {
1428  CaloDirection corner1=CaloDirectionOperations::add2d(gaps[0].first,EAST);
1429  CaloDirection corner2=CaloDirectionOperations::add2d(gaps[0].first,WEST);
1430  myPad.edge(corner1)=correspondingEdge(gaps[0],EAST);
1431  myPad.edge(corner2)=correspondingEdge(gaps[0],WEST);
1432 
1433  corner1=CaloDirectionOperations::add2d(gaps[1].first,EAST);
1434  corner2=CaloDirectionOperations::add2d(gaps[1].first,WEST);
1435  myPad.edge(corner1)=correspondingEdge(gaps[1],EAST);
1436  myPad.edge(corner2)=correspondingEdge(gaps[1],WEST);
1437  }
1438  }
1439  if(debug)
1440  {
1441  std::cout << " Apres " << std::endl;
1442  std::cout << myPad << std::endl;
1443  }
1444  }
1445  else
1446  if(ngaps==3)
1447  {
1448  // in this case the four corners have to be changed
1449  unsigned iubd,idir1,idir2;
1450  CaloDirection diag;
1451  CLHEP::Hep2Vector point(0.,0.);
1452  // std::cout << " Yes : 3 gaps" << std::endl;
1453  if(unbalancedDirection(gaps,iubd,idir1,idir2))
1454  {
1455  CaloDirection ubd(gaps[iubd].first),dir1(gaps[idir1].first);
1456  CaloDirection dir2(gaps[idir2].first);
1457 
1458  // std::cout << " Avant " << std::endl << myPad << std::endl;
1459  // std::cout << ubd << " " << dir1 << " " << dir2 << std::endl;
1460  diag=CaloDirectionOperations::add2d(ubd,dir1);
1461  if(diagonalEdge(iq,diag,point))
1462  myPad.edge(diag)=point;
1463  diag=CaloDirectionOperations::add2d(ubd,dir2);
1464  if(diagonalEdge(iq,diag,point))
1465  myPad.edge(diag)=point;
1467  myPad.edge(CaloDirectionOperations::add2d(oppside,dir1))=correspondingEdge(gaps[idir1],oppside);
1468  myPad.edge(CaloDirectionOperations::add2d(oppside,dir2))=correspondingEdge(gaps[idir2],oppside);
1469  // std::cout << " Apres " << std::endl << myPad << std::endl;
1470  }
1471  }
1472  else
1473  if(ngaps==4)
1474  {
1475  // std::cout << " Waouh :4 gaps" << std::endl;
1476  // std::cout << " Avant " << std::endl;
1477  // std::cout << myPad<< std::endl;
1478  CLHEP::Hep2Vector point(0.,0.);
1479  if(diagonalEdge(iq,NORTHEAST,point))
1480  myPad.edge(NORTHEAST)=point;
1481  if(diagonalEdge(iq,NORTHWEST,point))
1482  myPad.edge(NORTHWEST)=point;
1483  if(diagonalEdge(iq,SOUTHWEST,point))
1484  myPad.edge(SOUTHWEST)=point;
1485  if(diagonalEdge(iq,SOUTHEAST,point))
1486  myPad.edge(SOUTHEAST)=point;
1487  // std::cout << " Apres " << std::endl;
1488  // std::cout << myPad<< std::endl;
1489  }
1490 }
static CaloDirection add2d(const CaloDirection &dir1, const CaloDirection &dir2)
static CaloDirection oppositeSide(const CaloDirection &side)
bool unbalancedDirection(const std::vector< neighbour > &dirs, unsigned &unb, unsigned &dir1, unsigned &dir2)
std::vector< CrystalPad > padsatdepth_
Definition: EcalHitMaker.h:294
CLHEP::Hep2Vector & edge(unsigned iside, int n)
access to the corners in direction iside; n=0,1
Definition: CrystalPad.cc:263
#define constexpr
CLHEP::Hep2Vector & correspondingEdge(neighbour &myneighbour, CaloDirection dir2)
#define debug
Definition: HDRShower.cc:19
tuple cout
Definition: gather_cfg.py:121
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
bool diagonalEdge(unsigned myPad, CaloDirection dir, CLHEP::Hep2Vector &point)
const std::vector<Crystal>& EcalHitMaker::getCrystals ( ) const
inline

for debugging

Definition at line 140 of file EcalHitMaker.h.

References regionOfInterest_.

140 {return regionOfInterest_;}
std::vector< Crystal > regionOfInterest_
Definition: EcalHitMaker.h:237
const FSimTrack* EcalHitMaker::getFSimTrack ( ) const
inline

To retrieve the track.

Definition at line 125 of file EcalHitMaker.h.

References myTrack_.

Referenced by HcalHitMaker::HcalHitMaker(), and HcalHitMaker::setDepth().

125 {return myTrack_;}
const FSimTrack * myTrack_
Definition: EcalHitMaker.h:284
const std::map< CaloHitID, float > & EcalHitMaker::getHits ( )
virtual

not been done.

get the map of the stored hits. Triggers the calculation of the grid if it has

Implements CaloHitMaker.

Definition at line 1217 of file EcalHitMaker.cc.

References Calorimeter::getEcalGeometry(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), ecalpyutils::hashedIndex(), CaloHitMaker::hitMap_, hitmaphasbeencalculated_, hits_, PV3DBase< T, PVType, FrameType >::mag(), CaloHitMaker::myCalorimeter, ncrystals_, onEcal_, and regionOfInterest_.

Referenced by CalorimetryManager::EMShowerSimulation().

1218 {
1219  if (hitmaphasbeencalculated_) return hitMap_;
1220  for(unsigned ic=0;ic<ncrystals_;++ic)
1221  {
1222  //calculate time of flight
1223  float tof = 0.0;
1224  if(onEcal_==1 || onEcal_==2) tof = (myCalorimeter->getEcalGeometry(onEcal_)->getGeometry(regionOfInterest_[ic].getDetId())->getPosition().mag())/29.98; //speed of light
1225 
1226  if(onEcal_==1){
1227  CaloHitID current_id(EBDetId(regionOfInterest_[ic].getDetId().rawId()).hashedIndex(),tof,0); //no track yet
1228  hitMap_.insert(std::pair<CaloHitID,float>(current_id,hits_[ic]));
1229  }
1230  else if(onEcal_==2){
1231  CaloHitID current_id(EEDetId(regionOfInterest_[ic].getDetId().rawId()).hashedIndex(),tof,0); //no track yet
1232  hitMap_.insert(std::pair<CaloHitID,float>(current_id,hits_[ic]));
1233  }
1234  }
1236  return hitMap_;
1237 }
unsigned ncrystals_
Definition: EcalHitMaker.h:231
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:47
const CaloSubdetectorGeometry * getEcalGeometry(int subdetn) const
Definition: Calorimeter.cc:135
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:42
T mag() const
Definition: PV3DBase.h:67
std::map< CaloHitID, float > hitMap_
Definition: CaloHitMaker.h:65
std::vector< float > hits_
Definition: EcalHitMaker.h:238
std::vector< Crystal > regionOfInterest_
Definition: EcalHitMaker.h:237
bool hitmaphasbeencalculated_
Definition: EcalHitMaker.h:297
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
bool EcalHitMaker::getPads ( double  depth,
bool  inCm = false 
)

computes the crystals-plan intersection at depth (in X0 or L0 depending on the shower type) if it is not possible to go at such a depth, the result is false

Definition at line 917 of file EcalHitMaker.cc.

References a, b, bfactor_, central_, configuredGeometry_, configureGeometry(), corners, gather_cfg::cout, crackpadsatdepth_, currentdepth_, HLT_25ns14e33_v1_cff::depth, detailedShowerTail_, doreorg_, DetId::Ecal, CaloHitMaker::EMSHOWER, Crystal::getFirstEdge(), CaloHitMaker::HADSHOWER, cuy::ii, CaloHitMaker::interactionLength, CaloHitMaker::intersect(), CaloHitMaker::moliereRadius, myTrack_, ncrackpadsatdepth_, ncrystals_, normal_, npadsatdepth_, nx_, ny_, padsatdepth_, pivot_, plan_, prepareCrystalNumberArray(), pulled(), pulledPadProbability_, radiusCorrectionFactor_, radiusFactor_, regionOfInterest_, reorganizePads(), segments_, jetcorrextractor::sign(), sizex_, sizey_, validPads_, X0depthoffset_, xmax_, xmin_, ymax_, and ymin_.

Referenced by HFShower::compute(), HDShower::compute(), EMShower::compute(), and HDRShower::computeShower().

918 {
919  //std::cout << " New depth " << depth << std::endl;
920  // The first time, the relationship between crystals must be calculated
921  // but only in the case of EM showers
922 
924 
925 
927  detailedShowerTail_ = false;
928  if(EMSHOWER)
930  else
932 
933 // if(currentdepth_>maxX0_+ps1TotalX0()+ps2TotalX0())
934 // {
935 // currentdepth_=maxX0_+ps1TotalX0()+ps2TotalX0()-1.; // the -1 is for safety
936 // detailedShowerTail_=true;
937 // }
938 
939 // std::cout << " FamosGrid::getQuads " << currentdepth_ << " " << maxX0_ << std::endl;
940 
942 
943  xmin_=ymin_=999;
944  xmax_=ymax_=-999;
945  double locxmin,locxmax,locymin,locymax;
946 
947  // Get the depth of the pivot
948  std::vector<CaloSegment>::const_iterator segiterator;
949  // First identify the correct segment
950 
951  if(inCm) // centimeter
952  {
953  segiterator = find_if(segments_.begin(),segments_.end(),CaloSegment::inSegment(currentdepth_));
954  }
955  else
956  {
957  // EM shower
958  if(EMSHOWER)
959  segiterator = find_if(segments_.begin(),segments_.end(),CaloSegment::inX0Segment(currentdepth_));
960 
961  //Hadron shower
962  if(HADSHOWER)
963  segiterator = find_if(segments_.begin(),segments_.end(),CaloSegment::inL0Segment(currentdepth_));
964  }
965  if(segiterator==segments_.end())
966  {
967  std::cout << " FamosGrid: Could not go at such depth " << depth << std::endl;
968  std::cout << " EMSHOWER " << EMSHOWER << std::endl;
969  std::cout << " Track " << *myTrack_ << std::endl;
970  std::cout << " Segments " << segments_.size() << std::endl;
971  for(unsigned ii=0; ii<segments_.size() ; ++ii)
972  {
973  std::cout << segments_[ii] << std::endl;
974  }
975 
976  return false;
977  }
978  // std::cout << *segiterator << std::endl;
979 
980  if(segiterator->whichDetector()!=DetId::Ecal)
981  {
982  std::cout << " In " << segiterator->whichDetector() << std::endl;
983  // buildPreshower();
984  return false;
985  }
986 
987  // std::cout << *segiterator << std::endl;
988  // get the position of the origin
989 
990  XYZPoint origin;
991  if(inCm)
992  {
993  origin=segiterator->positionAtDepthincm(currentdepth_);
994  }
995  else
996  {
997  if(EMSHOWER)
998  origin=segiterator->positionAtDepthinX0(currentdepth_);
999  if(HADSHOWER)
1000  origin=segiterator->positionAtDepthinL0(currentdepth_);
1001  }
1002  // std::cout << " currentdepth_ " << currentdepth_ << " " << origin << std::endl;
1003  XYZVector newaxis=pivot_.getFirstEdge().Cross(normal_);
1004 
1005 // std::cout << "Normal " << normal_ << std::endl;
1006 // std::cout << " New axis " << newaxis << std::endl;
1007 
1008 // std::cout << " ncrystals " << ncrystals << std::endl;
1009  plan_ = Plane3D((Vector)normal_,(Point)origin);
1010 
1011  unsigned nquads=0;
1012  double sign=(central_) ? -1.: 1.;
1013  Transform3DR trans((Point)origin,(Point)(origin+normal_),(Point)(origin+newaxis),
1014  Point(0,0,0), Point(0.,0.,sign), Point(0.,1.,0.));
1015  for(unsigned ic=0;ic<ncrystals_;++ic)
1016  {
1017  // std::cout << " Building geometry for " << regionOfInterest_[ic].getCellID() << std::endl;
1018  XYZPoint a,b;
1019 
1020  // std::cout << " Origin " << origin << std::endl;
1021 
1022  // std::vector<XYZPoint> corners;
1023  // corners.reserve(4);
1024  double dummyt;
1025  bool hasbeenpulled=false;
1026  bool behindback=false;
1027  for(unsigned il=0;il<4;++il)
1028  {
1029  // a is the il-th front corner of the crystal. b is the corresponding rear corner
1030  regionOfInterest_[ic].getLateralEdges(il,a,b);
1031 
1032  // pull the surface if necessary (only in the front of the crystals)
1033  XYZPoint aprime=a;
1034  if(pulled(origin,normal_,a))
1035  {
1036  b=aprime;
1037  hasbeenpulled=true;
1038  }
1039 
1040  // compute the intersection.
1041  // Check that the intersection is in the [a,b] segment if HADSHOWER
1042  // if EMSHOWER the intersection is calculated as if the crystals were infinite
1043  XYZPoint xx=(EMSHOWER)?intersect(plan_,a,b,dummyt,false):intersect(plan_,a,b,dummyt,true);
1044 
1045  if(dummyt>1) behindback=true;
1046  // std::cout << " Intersect " << il << " " << a << " " << b << " " << plan_ << " " << xx << std::endl;
1047  // check that the intersection actually exists
1048  if(xx.mag2()!=0)
1049  {
1050  corners[il] = xx;
1051  }
1052  }
1053  // std::cout << " ncorners " << corners.size() << std::endl;
1054  if(behindback&&EMSHOWER) detailedShowerTail_=true;
1055  // If the quad is completly defined. Store it !
1056  if(corners.size()==4)
1057  {
1059  // Parameter to be tuned
1060  if(hasbeenpulled) padsatdepth_[ic].setSurvivalProbability(pulledPadProbability_);
1061  validPads_[ic]=true;
1062  ++nquads;
1063  // In principle, this should be done after the quads reorganization. But it would cost one more loop
1064  // quadsatdepth_[ic].extrems(locxmin,locxmax,locymin,locymax);
1065  // if(locxmin<xmin_) xmin_=locxmin;
1066  // if(locymin<ymin_) ymin_=locymin;
1067  // if(locxmax>xmax_) xmax_=locxmax;
1068  // if(locymax>ymax_) ymax_=locymax;
1069  }
1070  else
1071  {
1072  padsatdepth_[ic]=CrystalPad();
1073  validPads_[ic]=false;
1074  }
1075  }
1076  // std::cout << " Number of quads " << quadsatdepth_.size() << std::endl;
1077  if(doreorg_)reorganizePads();
1078  // std::cout << "Finished to reorganize " << std::endl;
1079  npadsatdepth_=nquads;
1080  // std::cout << " prepareCellIDMap " << std::endl;
1081 
1082 
1083  // Resize the Quads to allow for some numerical inaccuracy
1084  // in the "inside" function
1085  for(unsigned ic=0;ic<ncrystals_;++ic)
1086  {
1087 
1088  if (!validPads_[ic]) continue;
1089 
1090  if(EMSHOWER) padsatdepth_[ic].resetCorners();
1091 
1092  padsatdepth_[ic].extrems(locxmin,locxmax,locymin,locymax);
1093  if(locxmin<xmin_) xmin_=locxmin;
1094  if(locymin<ymin_) ymin_=locymin;
1095  if(locxmax>xmax_) xmax_=locxmax;
1096  if(locymax>ymax_) ymax_=locymax;
1097  }
1098 
1099  sizex_=(xmax_-xmin_)/nx_;
1100  sizey_=(ymax_-ymin_)/ny_;
1101 
1102 
1103  // Make sure that sizex_ and sizey_ are set before running prepareCellIDMap
1105 
1106  // std::cout << " Finished prepareCellIDMap " << std::endl;
1108 
1109  return true;
1110 }
XYZNormal normal_
Definition: EcalHitMaker.h:226
double pulledPadProbability_
Definition: EcalHitMaker.h:277
bool detailedShowerTail_
Definition: EcalHitMaker.h:263
unsigned ny_
Definition: EcalHitMaker.h:233
std::vector< CrystalPad > crackpadsatdepth_
Definition: EcalHitMaker.h:295
void reorganizePads()
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
std::vector< CrystalPad > padsatdepth_
Definition: EcalHitMaker.h:294
double sign(double x)
Plane3D plan_
Definition: EcalHitMaker.h:274
bool pulled(const XYZPoint &origin, const XYZNormal &normal, XYZPoint &fPoint) const
void prepareCrystalNumberArray()
int ii
Definition: cuy.py:588
std::pair< double, double > Point
Definition: CaloEllipse.h:18
double currentdepth_
Definition: EcalHitMaker.h:265
unsigned ncrystals_
Definition: EcalHitMaker.h:231
math::XYZVector XYZVector
bool configuredGeometry_
Definition: EcalHitMaker.h:230
double radiusCorrectionFactor_
Definition: EcalHitMaker.h:259
double radiusFactor_
Definition: EcalHitMaker.h:261
math::XYZPoint Point
const FSimTrack * myTrack_
Definition: EcalHitMaker.h:284
static XYZPoint intersect(const Plane3D &p, const XYZPoint &a, const XYZPoint &b, double &t, bool segment, bool debug=false)
Definition: CaloHitMaker.cc:38
ROOT::Math::Plane3D Plane3D
Definition: EcalHitMaker.h:31
This class is used to determine if a point lies in the segment.
Definition: CaloSegment.h:86
unsigned ncrackpadsatdepth_
Definition: EcalHitMaker.h:272
std::vector< XYZPoint > corners
Definition: EcalHitMaker.h:301
const XYZVector & getFirstEdge() const
Direction of the first edge.
Definition: Crystal.h:45
double bfactor_
Definition: EcalHitMaker.h:267
Crystal pivot_
Definition: EcalHitMaker.h:224
void configureGeometry()
double interactionLength
Definition: CaloHitMaker.h:50
double b
Definition: hdecay.h:120
double moliereRadius
Definition: CaloHitMaker.h:49
std::vector< Crystal > regionOfInterest_
Definition: EcalHitMaker.h:237
math::XYZVector XYZPoint
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
double X0depthoffset_
Definition: EcalHitMaker.h:205
std::vector< bool > validPads_
Definition: EcalHitMaker.h:240
unsigned npadsatdepth_
Definition: EcalHitMaker.h:273
std::vector< CaloSegment > segments_
Definition: EcalHitMaker.h:289
unsigned nx_
Definition: EcalHitMaker.h:233
const std::vector<CaloSegment>& EcalHitMaker::getSegments ( ) const
inline

retrieve the segments (the path in the crystal crossed by the extrapolation of the track. Debugging only

Definition at line 99 of file EcalHitMaker.h.

References segments_.

Referenced by HcalHitMaker::setDepth().

99 {return segments_;};
std::vector< CaloSegment > segments_
Definition: EcalHitMaker.h:289
double EcalHitMaker::getX0back ( ) const
inline

Definition at line 109 of file EcalHitMaker.h.

References maxX0_.

Referenced by EMShower::compute().

109 {return maxX0_;}
void EcalHitMaker::hcalCellLine ( std::vector< CaloPoint > &  cp) const
private

Definition at line 532 of file EcalHitMaker.cc.

References dir, eta, DetId::Hcal, FSimTrack::hcalEntrance(), Calorimeter::hcalProperties(), CaloHitMaker::myCalorimeter, myTrack_, FSimTrack::onHcal(), FSimTrack::onVFcal(), CalorimeterProperties::thickness(), RawParticle::vertex(), and FSimTrack::vfcalEntrance().

Referenced by cellLine().

533 {
534  // FSimEvent& mySimEvent = myEventMgr->simSignal();
535  // FSimTrack myTrack = mySimEvent.track(fsimtrack_);
536  int onHcal=myTrack_->onHcal();
537 
538  if(onHcal<=2&&onHcal>0)
539  {
540  XYZPoint point1=(myTrack_->hcalEntrance().vertex()).Vect();
541 
542  double eta=point1.eta();
543  // HCAL thickness in cm (assuming that the particle is coming from 000)
544  double thickness= myCalorimeter->hcalProperties(onHcal)->thickness(eta);
545  cp.push_back(CaloPoint(DetId::Hcal,point1));
546  XYZVector dir=myTrack_->hcalEntrance().Vect().Unit();
547  XYZPoint point2=point1+dir*thickness;
548 
549  cp.push_back(CaloPoint(DetId::Hcal,point2));
550 
551  }
552  int onVFcal=myTrack_->onVFcal();
553  if(onVFcal==2)
554  {
555  XYZPoint point1=(myTrack_->vfcalEntrance().vertex()).Vect();
556  double eta=point1.eta();
557  // HCAL thickness in cm (assuming that the particle is coming from 000)
558  double thickness= myCalorimeter->hcalProperties(3)->thickness(eta);
559  cp.push_back(CaloPoint(DetId::Hcal,point1));
560  XYZVector dir=myTrack_->vfcalEntrance().Vect().Unit();
561  if(thickness>0)
562  {
563  XYZPoint point2=point1+dir*thickness;
564  cp.push_back(CaloPoint(DetId::Hcal,point2));
565  }
566 
567  }
568 }
const RawParticle & vfcalEntrance() const
The particle at VFCAL entrance.
Definition: FSimTrack.h:139
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:47
math::XYZVector XYZVector
const FSimTrack * myTrack_
Definition: EcalHitMaker.h:284
const HCALProperties * hcalProperties(int onHcal) const
HCAL properties.
Definition: Calorimeter.cc:86
int onVFcal() const
Definition: FSimTrack.h:111
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:285
math::XYZVector XYZPoint
int onHcal() const
Definition: FSimTrack.h:106
const RawParticle & hcalEntrance() const
The particle at HCAL entrance.
Definition: FSimTrack.h:136
dbl *** dir
Definition: mlp_gen.cc:35
virtual double thickness(double eta) const =0
Thickness (in cm) of the homegeneous material as a function of rapidity.
double EcalHitMaker::hcalTotalL0 ( ) const
inline

in the HCAL

Definition at line 92 of file EcalHitMaker.h.

References L0HCAL_.

Referenced by HDRShower::computeShower(), HDShower::HDShower(), and HFShower::HFShower().

92 {return L0HCAL_;}
double L0HCAL_
Definition: EcalHitMaker.h:216
double EcalHitMaker::hcalTotalX0 ( ) const
inline

in the HCAL

Definition at line 77 of file EcalHitMaker.h.

References X0HCAL_.

Referenced by EMShower::prepareSteps().

77 {return X0HCAL_;}
double X0HCAL_
Definition: EcalHitMaker.h:211
bool EcalHitMaker::inside3D ( const std::vector< XYZPoint > &  corners,
const XYZPoint p 
) const
private

Definition at line 1549 of file EcalHitMaker.cc.

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by ecalCellLine().

1551 {
1552  // corners and p are in the same plane
1553  // p is inside "corners" if the four crossproducts (corners[i]xcorners[i+1])
1554  // are in the same direction
1555 
1556  XYZVector crossproduct(0.,0.,0.),previouscrossproduct(0.,0.,0.);
1557 
1558  for(unsigned ip=0;ip<4 ; ++ip) {
1559  crossproduct = (corners[ip]-p).Cross(corners[(ip+1)%4]-p);
1560  if(ip==0)
1561  previouscrossproduct=crossproduct;
1562  else
1563  if (crossproduct.Dot(previouscrossproduct)<0.) return false;
1564  }
1565 
1566  return true;
1567 }
math::XYZVector XYZVector
std::vector< XYZPoint > corners
Definition: EcalHitMaker.h:301
void EcalHitMaker::prepareCrystalNumberArray ( )
private

Definition at line 1197 of file EcalHitMaker.cc.

References convertIntegerCoordinates(), myCrystalNumberArray_, npadsatdepth_, padsatdepth_, validPads_, x, and y.

Referenced by getPads().

1198 {
1199  for(unsigned iq=0;iq<npadsatdepth_;++iq)
1200  {
1201  if(!validPads_[iq]) continue;
1202  unsigned d1,d2;
1203  convertIntegerCoordinates(padsatdepth_[iq].center().x(),padsatdepth_[iq].center().y(),d1,d2);
1204  myCrystalNumberArray_[d1][d2]=iq;
1205  }
1206 }
std::vector< CrystalPad > padsatdepth_
Definition: EcalHitMaker.h:294
std::vector< std::vector< unsigned > > myCrystalNumberArray_
Definition: EcalHitMaker.h:200
std::vector< bool > validPads_
Definition: EcalHitMaker.h:240
unsigned npadsatdepth_
Definition: EcalHitMaker.h:273
void convertIntegerCoordinates(double x, double y, unsigned &ix, unsigned &iy) const
void EcalHitMaker::preshowerCellLine ( std::vector< CaloPoint > &  cp) const
private

Definition at line 474 of file EcalHitMaker.cc.

References dir, DetId::Ecal, EcalPreshower, RawParticle::eta(), FSimTrack::layer1Entrance(), Calorimeter::layer1Properties(), FSimTrack::layer2Entrance(), Calorimeter::layer2Properties(), CaloHitMaker::myCalorimeter, myTrack_, FSimTrack::onLayer1(), FSimTrack::onLayer2(), PreshowerLayer2Properties::thickness(), PreshowerLayer1Properties::thickness(), and RawParticle::vertex().

Referenced by cellLine().

475 {
476  // FSimEvent& mySimEvent = myEventMgr->simSignal();
477  // FSimTrack myTrack = mySimEvent.track(fsimtrack_);
478  // std::cout << "FsimTrack " << fsimtrack_<< std::endl;
479  // std::cout << " On layer 1 " << myTrack.onLayer1() << std::endl;
480  // std::cout << " preshowerCellLine " << std::endl;
481  if(myTrack_->onLayer1())
482  {
483  XYZPoint point1=(myTrack_->layer1Entrance().vertex()).Vect();
484  double phys_eta=myTrack_->layer1Entrance().eta();
485  double cmthickness =
487 
488  if(cmthickness>0)
489  {
490  XYZVector dir=myTrack_->layer1Entrance().Vect().Unit();
491  XYZPoint point2=point1+dir*cmthickness;
492 
493  CaloPoint cp1(DetId::Ecal,EcalPreshower,1,point1);
494  CaloPoint cp2(DetId::Ecal,EcalPreshower,1,point2);
495  cp.push_back(cp1);
496  cp.push_back(cp2);
497  }
498  else
499  {
500  // std::cout << "Track on ECAL " << myTrack.EcalEntrance_().vertex()*0.1<< std::endl;
501  }
502  }
503 
504  // std::cout << " On layer 2 " << myTrack.onLayer2() << std::endl;
505  if(myTrack_->onLayer2())
506  {
507  XYZPoint point1=(myTrack_->layer2Entrance().vertex()).Vect();
508  double phys_eta=myTrack_->layer2Entrance().eta();
509  double cmthickness =
511  if(cmthickness>0)
512  {
513  XYZVector dir=myTrack_->layer2Entrance().Vect().Unit();
514  XYZPoint point2=point1+dir*cmthickness;
515 
516 
517  CaloPoint cp1(DetId::Ecal,EcalPreshower,2,point1);
518  CaloPoint cp2(DetId::Ecal,EcalPreshower,2,point2);
519 
520  cp.push_back(cp1);
521  cp.push_back(cp2);
522  }
523  else
524  {
525  // std::cout << "Track on ECAL " << myTrack.EcalEntrance_().vertex()*0.1 << std::endl;
526  }
527  }
528  // std::cout << " Exit preshower CellLine " << std::endl;
529 }
int onLayer2() const
Definition: FSimTrack.h:96
double thickness(const double eta) const
const RawParticle & layer1Entrance() const
The particle at Preshower Layer 1.
Definition: FSimTrack.h:127
const PreshowerLayer1Properties * layer1Properties(int onLayer1) const
Preshower Layer1 properties.
Definition: Calorimeter.cc:102
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:47
math::XYZVector XYZVector
const PreshowerLayer2Properties * layer2Properties(int onLayer2) const
Preshower Layer2 properties.
Definition: Calorimeter.cc:110
const FSimTrack * myTrack_
Definition: EcalHitMaker.h:284
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:285
double thickness(double eta) const
math::XYZVector XYZPoint
const RawParticle & layer2Entrance() const
The particle at Preshower Layer 2.
Definition: FSimTrack.h:130
int onLayer1() const
Definition: FSimTrack.h:91
double eta() const
Definition: RawParticle.h:267
dbl *** dir
Definition: mlp_gen.cc:35
double EcalHitMaker::ps1TotalL0 ( ) const
inline

total number of L0 in the PS (Layer1).

Definition at line 80 of file EcalHitMaker.h.

References L0PS1_.

80 {return L0PS1_;}
double EcalHitMaker::ps1TotalX0 ( ) const
inline

Definition at line 62 of file EcalHitMaker.h.

References X0PS1_.

Referenced by EMShower::prepareSteps().

62 {return X0PS1_;}
double EcalHitMaker::ps2eeTotalL0 ( ) const
inline

Definition at line 86 of file EcalHitMaker.h.

References L0PS2EE_.

86 {return L0PS2EE_;}
double L0PS2EE_
Definition: EcalHitMaker.h:214
double EcalHitMaker::ps2eeTotalX0 ( ) const
inline

Definition at line 68 of file EcalHitMaker.h.

References X0PS2EE_.

Referenced by EMShower::prepareSteps().

68 {return X0PS2EE_;}
double X0PS2EE_
Definition: EcalHitMaker.h:208
double EcalHitMaker::ps2TotalL0 ( ) const
inline

total number of L0 in the PS (Layer2).

Definition at line 83 of file EcalHitMaker.h.

References L0PS2_.

83 {return L0PS2_;}
double EcalHitMaker::ps2TotalX0 ( ) const
inline

total number of X0 in the PS (Layer2).

Definition at line 65 of file EcalHitMaker.h.

References X0PS2_.

Referenced by EMShower::prepareSteps().

65 {return X0PS2_;}
bool EcalHitMaker::pulled ( const XYZPoint origin,
const XYZNormal normal,
XYZPoint fPoint 
) const
private

Definition at line 1182 of file EcalHitMaker.cc.

Referenced by getPads().

1185 {
1186  // check if fPoint is behind the origin
1187  double dotproduct=normal.Dot(fPoint-origin);
1188  if(dotproduct<=0.) return false;
1189 
1190  //norm of normal is 1
1191  fPoint -= (1+dotproduct)*normal;
1192  return true;
1193 }
void EcalHitMaker::reorganizePads ( )
private

Definition at line 1243 of file EcalHitMaker.cc.

References crackpadsatdepth_, cracksPads(), etasize_, gapsLifting(), ncrackpadsatdepth_, ncrystals_, phisize_, regionOfInterest_, CaloDirectionOperations::Side(), and validPads_.

Referenced by getPads().

1244 {
1245 
1246  // Some cleaning first
1247  // std::cout << " Starting reorganize " << std::endl;
1248  crackpadsatdepth_.clear();
1251  std::vector<neighbour> gaps;
1252  std::vector<std::vector<neighbour> > cracks;
1253  // cracks.clear();
1254  cracks.resize(ncrystals_);
1255 
1256 
1257  for(unsigned iq=0;iq<ncrystals_;++iq)
1258  {
1259  if(!validPads_[iq]) continue;
1260 
1261  gaps.clear();
1262  // std::cout << padsatdepth_[iq] << std::endl;
1263  //check all the directions
1264  for(unsigned iside=0;iside<4;++iside)
1265  {
1266  // std::cout << " To be glued " << iside << " " << regionOfInterest_[iq].crystalNeighbour(iside).toBeGlued() << std::endl;
1268  if(regionOfInterest_[iq].crystalNeighbour(iside).toBeGlued())
1269  {
1270  // look for the neighbour and check that it exists
1271  int neighbourstatus=regionOfInterest_[iq].crystalNeighbour(iside).status();
1272  if(neighbourstatus<0)
1273  continue;
1274 
1275  unsigned neighbourNumber=regionOfInterest_[iq].crystalNeighbour(iside).number();
1276  if(!validPads_[neighbourNumber]) continue;
1277  // there is a crack between
1278  if(neighbourstatus==1)
1279  {
1280  // std::cout << " 1 Crack : " << thisside << " " << cellids_[iq]<< " " << cellids_[neighbourNumber] << std::endl;
1281  cracks[iq].push_back(neighbour(thisside,neighbourNumber));
1282  } // else it is a gap
1283  else
1284  {
1285  gaps.push_back(neighbour(thisside,neighbourNumber));
1286  }
1287  }
1288  }
1289  // Now lift the gaps
1290  gapsLifting(gaps,iq);
1291  }
1292 
1293  unsigned ncracks=cracks.size();
1294  // std::cout << " Cracks treatment : " << cracks.size() << std::endl;
1295  for(unsigned icrack=0;icrack<ncracks;++icrack)
1296  {
1297  // std::cout << " Crack number " << crackiter->first << std::endl;
1298  cracksPads(cracks[icrack],icrack);
1299  }
1300 
1301 }
std::vector< CrystalPad > crackpadsatdepth_
Definition: EcalHitMaker.h:295
std::pair< CaloDirection, unsigned > neighbour
Definition: EcalHitMaker.h:178
unsigned ncrystals_
Definition: EcalHitMaker.h:231
unsigned etasize_
Definition: EcalHitMaker.h:251
void cracksPads(std::vector< neighbour > &cracks, unsigned iq)
unsigned phisize_
Definition: EcalHitMaker.h:252
static CaloDirection Side(unsigned i)
unsigned int -&gt; Side conversion
void gapsLifting(std::vector< neighbour > &gaps, unsigned iq)
unsigned ncrackpadsatdepth_
Definition: EcalHitMaker.h:272
std::vector< Crystal > regionOfInterest_
Definition: EcalHitMaker.h:237
std::vector< bool > validPads_
Definition: EcalHitMaker.h:240
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
void EcalHitMaker::setCrackPadSurvivalProbability ( double  val)
inline

Definition at line 134 of file EcalHitMaker.h.

References crackPadProbability_.

Referenced by CalorimetryManager::EMShowerSimulation().

134 {crackPadProbability_ = val ;};
double crackPadProbability_
Definition: EcalHitMaker.h:279
void EcalHitMaker::setPreshowerPresent ( bool  ps)
inline

Definition at line 137 of file EcalHitMaker.h.

References simulatePreshower_.

Referenced by CalorimetryManager::EMShowerSimulation().

137 {simulatePreshower_=ps;};
bool simulatePreshower_
Definition: EcalHitMaker.h:269
void EcalHitMaker::setPulledPadSurvivalProbability ( double  val)
inline

Definition at line 132 of file EcalHitMaker.h.

References pulledPadProbability_.

Referenced by CalorimetryManager::EMShowerSimulation().

132 {pulledPadProbability_ = val;};
double pulledPadProbability_
Definition: EcalHitMaker.h:277
void EcalHitMaker::setRadiusFactor ( double  r)
inline

Definition at line 130 of file EcalHitMaker.h.

References alignCSCRings::r, and radiusCorrectionFactor_.

Referenced by CalorimetryManager::EMShowerSimulation().

void EcalHitMaker::setSpotEnergy ( double  e)
inlinevirtual
void EcalHitMaker::setTrackParameters ( const XYZNormal normal,
double  X0depthoffset,
const FSimTrack theTrack 
)

Definition at line 328 of file EcalHitMaker.cc.

References buildSegments(), cellLine(), dir, DetId::Ecal, ecalFirstSegment_, ecalTotalX0(), CaloHitMaker::EMSHOWER, intersections_, maxX0_, myTrack_, ncrystals_, normal_, onEcal_, regionOfInterest_, segments_, CaloDirectionOperations::Side(), and X0depthoffset_.

Referenced by CalorimetryManager::EMShowerSimulation(), CalorimetryManager::HDShowerSimulation(), and CalorimetryManager::MuonMipSimulation().

331 {
332  // myHistos->debug("setTrackParameters");
333  // std::cout << " Track " << theTrack << std::endl;
334  intersections_.clear();
335  // This is certainly enough
336  intersections_.reserve(50);
337  myTrack_=&theTrack;
338  normal_=normal.Unit();
339  X0depthoffset_=X0depthoffset;
342 // std::cout << " Segments " << segments_.size() << std::endl;
343 // for(unsigned ii=0; ii<segments_.size() ; ++ii)
344 // {
345 // std::cout << segments_[ii] << std::endl;
346 // }
347 
348 
349  // This is only needed in case of electromagnetic showers
350  if(EMSHOWER&&onEcal_&&ecalTotalX0()>0.)
351  {
352  // std::cout << "Total X0 " << ecalTotalX0() << std::endl;
353  for(unsigned ic=0;ic<ncrystals_;++ic)
354  {
355  for(unsigned idir=0;idir<4;++idir)
356  {
357  XYZVector norm=regionOfInterest_[ic].exitingNormal(CaloDirectionOperations::Side(idir));
358  regionOfInterest_[ic].crystalNeighbour(idir).setToBeGlued((norm.Dot(normal_)<0.));
359  }
360  // Now calculate the distance in X0 of the back sides of the crystals
361  // (only for EM showers)
362  if(EMSHOWER)
363  {
364  XYZVector dir=regionOfInterest_[ic].getBackCenter()-segments_[ecalFirstSegment_].entrance();
365  double dist=dir.Dot(normal_);
366  double absciss= dist+segments_[ecalFirstSegment_].sEntrance();
367  std::vector<CaloSegment>::const_iterator segiterator;
368  // First identify the correct segment
369  // std::cout << " Crystal " << ic << regionOfInterest_[ic].getBackCenter() ;
370  // std::cout << " Entrance : " << segments_[ecalFirstSegment_].entrance()<< std::endl;
371  // std::cout << " Looking for the segment " << dist << std::endl;
372  segiterator = find_if(segments_.begin(),segments_.end(),CaloSegment::inSegment(absciss));
373  // std::cout << " Done " << std::endl;
374  if(segiterator==segments_.end() )
375  {
376  // in this case, we won't have any problem. No need to
377  // calculate the real depth.
378  regionOfInterest_[ic].setX0Back(9999);
379  }
380  else
381  {
382  DetId::Detector det(segiterator->whichDetector());
383  if(det!=DetId::Ecal)
384  {
385  regionOfInterest_[ic].setX0Back(9999);
386  }
387  else
388  {
389  double x0=segiterator->x0FromCm(dist);
390  if(x0<maxX0_) maxX0_=x0;
391  regionOfInterest_[ic].setX0Back(x0);
392  }
393  }
394  // myHistos->fill("h4000",ecalentrance_.eta(), regionOfInterest_[ic].getX0Back());
395  //}
396  // else
397  //{
398  // // in this case, we won't have any problem. No need to
399  // // calculate the real depth.
400  // regionOfInterest_[ic].setX0Back(9999);
401  //}
402  }//EMSHOWER
403  } // ndir
404  // myHistos->fill("h6000",segments_[ecalFirstSegment_].entrance().eta(),maxX0_);
405  }
406  // std::cout << "Leaving setTrackParameters" << std::endl
407 }
XYZNormal normal_
Definition: EcalHitMaker.h:226
unsigned ncrystals_
Definition: EcalHitMaker.h:231
double ecalTotalX0() const
in the ECAL
Definition: EcalHitMaker.h:71
math::XYZVector XYZVector
const FSimTrack * myTrack_
Definition: EcalHitMaker.h:284
std::vector< CaloPoint > intersections_
Definition: EcalHitMaker.h:287
static CaloDirection Side(unsigned i)
unsigned int -&gt; Side conversion
Detector
Definition: DetId.h:24
void cellLine(std::vector< CaloPoint > &cp)
int ecalFirstSegment_
Definition: EcalHitMaker.h:248
std::vector< Crystal > regionOfInterest_
Definition: EcalHitMaker.h:237
void buildSegments(const std::vector< CaloPoint > &cp)
double X0depthoffset_
Definition: EcalHitMaker.h:205
dbl *** dir
Definition: mlp_gen.cc:35
std::vector< CaloSegment > segments_
Definition: EcalHitMaker.h:289
double EcalHitMaker::totalL0 ( ) const
inline

Number of interaction length "seen" by the track.

Definition at line 56 of file EcalHitMaker.h.

References totalL0_.

56 {return totalL0_;};
double totalL0_
Definition: EcalHitMaker.h:204
double EcalHitMaker::totalX0 ( ) const
inline

Definition at line 53 of file EcalHitMaker.h.

References totalX0_.

Referenced by EMShower::prepareSteps().

53 {return totalX0_;};
double totalX0_
Definition: EcalHitMaker.h:203
bool EcalHitMaker::unbalancedDirection ( const std::vector< neighbour > &  dirs,
unsigned &  unb,
unsigned &  dir1,
unsigned &  dir2 
)
private

Definition at line 1328 of file EcalHitMaker.cc.

References CaloDirectionOperations::add2d(), plotBeamSpotDB::first, NONE, and tmp.

Referenced by gapsLifting().

1329 {
1330  if(dirs.size()==1) return false;
1331  if(dirs.size()%2==0) return false;
1333  tmp=CaloDirectionOperations::add2d(dirs[0].first,dirs[1].first);
1334  if(tmp==NONE)
1335  {
1336  unb=2;
1337  dir1=0;
1338  dir2=1;
1339  return true;
1340  }
1341  tmp=CaloDirectionOperations::add2d(dirs[0].first,dirs[2].first);
1342  if(tmp==NONE)
1343  {
1344  unb=1;
1345  dir1=0;
1346  dir2=2;
1347  return true;
1348  }
1349  unb=0;
1350  dir1=1;
1351  dir2=2;
1352  return true;
1353 }
static CaloDirection add2d(const CaloDirection &dir1, const CaloDirection &dir2)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
double EcalHitMaker::x0DepthOffset ( ) const
inline

get the offset (e.g the number of X0 after which the shower starts)

Definition at line 59 of file EcalHitMaker.h.

References X0depthoffset_.

Referenced by EMShower::prepareSteps().

59 {return X0depthoffset_;}
double X0depthoffset_
Definition: EcalHitMaker.h:205

Member Data Documentation

double EcalHitMaker::bfactor_
private

Definition at line 267 of file EcalHitMaker.h.

Referenced by configureGeometry(), EcalHitMaker(), and getPads().

std::vector<DetId> EcalHitMaker::CellsWindow_
private

Definition at line 236 of file EcalHitMaker.h.

Referenced by buildGeometry(), and EcalHitMaker().

int EcalHitMaker::central_
private

Definition at line 227 of file EcalHitMaker.h.

Referenced by cellLine(), EcalHitMaker(), and getPads().

bool EcalHitMaker::configuredGeometry_
private

Definition at line 230 of file EcalHitMaker.h.

Referenced by buildGeometry(), configureGeometry(), and getPads().

std::vector<XYZPoint> EcalHitMaker::corners
private

Definition at line 301 of file EcalHitMaker.h.

Referenced by ecalCellLine(), EcalHitMaker(), and getPads().

double EcalHitMaker::crackPadProbability_
private

Definition at line 279 of file EcalHitMaker.h.

Referenced by cracksPads(), and setCrackPadSurvivalProbability().

std::vector<CrystalPad> EcalHitMaker::crackpadsatdepth_
private

Definition at line 295 of file EcalHitMaker.h.

Referenced by cracksPads(), fastInsideCell(), getPads(), and reorganizePads().

double EcalHitMaker::currentdepth_
private

Definition at line 265 of file EcalHitMaker.h.

Referenced by getPads().

bool EcalHitMaker::detailedShowerTail_
private

Definition at line 263 of file EcalHitMaker.h.

Referenced by getPads().

std::map<DetId,unsigned> EcalHitMaker::DetIdMap_
private

Definition at line 243 of file EcalHitMaker.h.

Referenced by buildGeometry(), and configureGeometry().

bool EcalHitMaker::doreorg_
private

Definition at line 291 of file EcalHitMaker.h.

Referenced by EcalHitMaker(), and getPads().

XYZPoint EcalHitMaker::EcalEntrance_
private
int EcalHitMaker::ecalFirstSegment_
private

Definition at line 248 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and setTrackParameters().

unsigned EcalHitMaker::etasize_
private

Definition at line 251 of file EcalHitMaker.h.

Referenced by EcalHitMaker(), and reorganizePads().

bool EcalHitMaker::hitmaphasbeencalculated_
private

Definition at line 297 of file EcalHitMaker.h.

Referenced by EcalHitMaker(), and getHits().

std::vector<float> EcalHitMaker::hits_
private

Definition at line 238 of file EcalHitMaker.h.

Referenced by addHit(), addHitDepth(), buildGeometry(), and getHits().

std::vector<CaloPoint> EcalHitMaker::intersections_
private

Definition at line 287 of file EcalHitMaker.h.

Referenced by setTrackParameters().

double EcalHitMaker::L0ECAL_
private

Definition at line 215 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and ecalTotalL0().

double EcalHitMaker::L0EHGAP_
private

Definition at line 217 of file EcalHitMaker.h.

Referenced by buildSegments(), ecalHcalGapTotalL0(), and EcalHitMaker().

double EcalHitMaker::L0HCAL_
private

Definition at line 216 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and hcalTotalL0().

double EcalHitMaker::L0PS1_
private

Definition at line 212 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and ps1TotalL0().

double EcalHitMaker::L0PS2_
private

Definition at line 213 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and ps2TotalL0().

double EcalHitMaker::L0PS2EE_
private

Definition at line 214 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and ps2eeTotalL0().

double EcalHitMaker::maxX0_
private

Definition at line 219 of file EcalHitMaker.h.

Referenced by EcalHitMaker(), getX0back(), and setTrackParameters().

std::vector<CLHEP::Hep2Vector> EcalHitMaker::mycorners
private

Definition at line 300 of file EcalHitMaker.h.

Referenced by cracksPads(), and EcalHitMaker().

std::vector<std::vector<unsigned > > EcalHitMaker::myCrystalNumberArray_
private

Definition at line 200 of file EcalHitMaker.h.

Referenced by buildGeometry(), fastInsideCell(), and prepareCrystalNumberArray().

CrystalWindowMap* EcalHitMaker::myCrystalWindowMap_
private

Definition at line 245 of file EcalHitMaker.h.

Referenced by buildGeometry(), EcalHitMaker(), fastInsideCell(), and ~EcalHitMaker().

const FSimTrack* EcalHitMaker::myTrack_
private
unsigned EcalHitMaker::ncrackpadsatdepth_
private

Definition at line 272 of file EcalHitMaker.h.

Referenced by fastInsideCell(), getPads(), and reorganizePads().

unsigned EcalHitMaker::ncrystals_
private
XYZNormal EcalHitMaker::normal_
private

Definition at line 226 of file EcalHitMaker.h.

Referenced by cellLine(), ecalCellLine(), getPads(), and setTrackParameters().

unsigned EcalHitMaker::npadsatdepth_
private

Definition at line 273 of file EcalHitMaker.h.

Referenced by getPads(), and prepareCrystalNumberArray().

unsigned EcalHitMaker::nx_
private

Definition at line 233 of file EcalHitMaker.h.

Referenced by buildGeometry(), fastInsideCell(), and getPads().

unsigned EcalHitMaker::ny_
private

Definition at line 233 of file EcalHitMaker.h.

Referenced by buildGeometry(), fastInsideCell(), and getPads().

int EcalHitMaker::onEcal_
private

Definition at line 228 of file EcalHitMaker.h.

Referenced by cellLine(), getHits(), and setTrackParameters().

double EcalHitMaker::outsideWindowEnergy_
private

Definition at line 221 of file EcalHitMaker.h.

Referenced by addHit(), addHitDepth(), and EcalHitMaker().

std::vector<CrystalPad> EcalHitMaker::padsatdepth_
private
unsigned EcalHitMaker::phisize_
private

Definition at line 252 of file EcalHitMaker.h.

Referenced by buildGeometry(), EcalHitMaker(), and reorganizePads().

Crystal EcalHitMaker::pivot_
private

Definition at line 224 of file EcalHitMaker.h.

Referenced by EcalHitMaker(), and getPads().

Plane3D EcalHitMaker::plan_
private

Definition at line 274 of file EcalHitMaker.h.

Referenced by getPads().

double EcalHitMaker::pulledPadProbability_
private

Definition at line 277 of file EcalHitMaker.h.

Referenced by EcalHitMaker(), getPads(), and setPulledPadSurvivalProbability().

double EcalHitMaker::radiusCorrectionFactor_
private

Definition at line 259 of file EcalHitMaker.h.

Referenced by getPads(), and setRadiusFactor().

double EcalHitMaker::radiusFactor_
private

Definition at line 261 of file EcalHitMaker.h.

Referenced by addHit(), addHitDepth(), and getPads().

const RandomEngineAndDistribution* EcalHitMaker::random
private

Definition at line 303 of file EcalHitMaker.h.

Referenced by addHit().

double EcalHitMaker::rearleakage_
private

Definition at line 220 of file EcalHitMaker.h.

Referenced by addHitDepth(), and EcalHitMaker().

std::vector<Crystal> EcalHitMaker::regionOfInterest_
private
std::vector<CaloSegment> EcalHitMaker::segments_
private

Definition at line 289 of file EcalHitMaker.h.

Referenced by buildSegments(), getPads(), getSegments(), and setTrackParameters().

bool EcalHitMaker::simulatePreshower_
private

Definition at line 269 of file EcalHitMaker.h.

Referenced by cellLine(), EcalHitMaker(), and setPreshowerPresent().

double EcalHitMaker::sizex_
private

Definition at line 281 of file EcalHitMaker.h.

Referenced by convertIntegerCoordinates(), and getPads().

double EcalHitMaker::sizey_
private

Definition at line 281 of file EcalHitMaker.h.

Referenced by convertIntegerCoordinates(), and getPads().

double EcalHitMaker::totalL0_
private

Definition at line 204 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and totalL0().

double EcalHitMaker::totalX0_
private

Definition at line 203 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and totalX0().

bool EcalHitMaker::truncatedGrid_
private

Definition at line 254 of file EcalHitMaker.h.

Referenced by EcalHitMaker().

std::vector<bool> EcalHitMaker::validPads_
private
double EcalHitMaker::X0depthoffset_
private

Definition at line 205 of file EcalHitMaker.h.

Referenced by addHitDepth(), EcalHitMaker(), getPads(), setTrackParameters(), and x0DepthOffset().

double EcalHitMaker::X0ECAL_
private

Definition at line 209 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and ecalTotalX0().

double EcalHitMaker::X0EHGAP_
private

Definition at line 210 of file EcalHitMaker.h.

Referenced by buildSegments(), ecalHcalGapTotalX0(), and EcalHitMaker().

double EcalHitMaker::X0HCAL_
private

Definition at line 211 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and hcalTotalX0().

double EcalHitMaker::X0PS1_
private

Definition at line 206 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and ps1TotalX0().

double EcalHitMaker::X0PS2_
private

Definition at line 207 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and ps2TotalX0().

double EcalHitMaker::X0PS2EE_
private

Definition at line 208 of file EcalHitMaker.h.

Referenced by buildSegments(), EcalHitMaker(), and ps2eeTotalX0().

double EcalHitMaker::xmax_
private

Definition at line 234 of file EcalHitMaker.h.

Referenced by getPads().

double EcalHitMaker::xmin_
private

Definition at line 234 of file EcalHitMaker.h.

Referenced by convertIntegerCoordinates(), and getPads().

double EcalHitMaker::ymax_
private

Definition at line 234 of file EcalHitMaker.h.

Referenced by getPads().

double EcalHitMaker::ymin_
private

Definition at line 234 of file EcalHitMaker.h.

Referenced by convertIntegerCoordinates(), and getPads().