34 const DetId& cell,
int onEcal,
35 unsigned size,
unsigned showertype,
38 EcalEntrance_(ecalentrance),
273 unsigned size=localCellVector.size();
282 for(
unsigned ic=0;ic<8&&ic<
size;++ic)
284 unsigned iq=localCellVector[ic];
307 unsigned iquadinside=999;
321 if(!found&&debug)
std::cout <<
" Not found in the cracks " << std::endl;
328 double X0depthoffset,
354 for(
unsigned idir=0;idir<4;++idir)
366 std::vector<CaloSegment>::const_iterator segiterator;
388 double x0=segiterator->x0FromCm(dist);
450 std::cout <<
" Problem with the grid " << std::endl;
456 sort(cp.begin(),cp.end(),myDistance);
490 XYZPoint point2=point1+dir*cmthickness;
513 XYZPoint point2=point1+dir*cmthickness;
537 if(onHcal<=2&&onHcal>0)
541 double eta=point1.eta();
546 XYZPoint point2=point1+dir*thickness;
555 double eta=point1.eta();
562 XYZPoint point2=point1+dir*thickness;
577 DetId c_entrance,c_exit;
578 bool entrancefound(
false),exitfound(
false);
590 unsigned ncrystals=(unsigned)(backdistance*0.45);
591 unsigned highlim=(ncrystals+4);
598 while(ic<
ncrystals_&&(ic<highlim||!exitfound))
639 if(entrancefound&&exitfound&&c_entrance==c_exit)
return;
641 for(
unsigned iside=0;iside<4;++iside)
667 unsigned size=cp.size();
674 unsigned nsegments=size/2;
682 unsigned ncrossedxtals = 0;
687 if(cp[2*is].getDetId()!=cp[2*is+1].getDetId()&&
704 if(cp[2*is+1].whichDetector()==
DetId::Ecal && cp[2*is+1].whichSubDetector()==
EcalPreshower && cp[2*is+1].whichLayer()==1)
717 std::cout <<
" Strange segment between Preshower1 and " << cp[2*is+1].whichDetector();
728 if(cp[2*is+1].whichDetector()==
DetId::Ecal && cp[2*is+1].whichSubDetector()==
EcalPreshower && cp[2*is+1].whichLayer()==2)
740 if(is<(nsegments-1) && cp[2*is+2].whichDetector()==
DetId::Ecal && cp[2*is+2].whichSubDetector()==
EcalEndcap)
754 std::cout <<
" Strange segment between Preshower2 and " << cp[2*is+1].whichDetector();
767 DetId cell2=cp[2*is+1].getDetId();
772 if(cp[2*is].getDetId()==cell2)
787 std::cout <<
" One more bug in the segment " <<std::endl;
791 if(is>0 && is<nsegments)
793 DetId cell3=cp[2*is].getDetId();
824 std::cout <<
" Strange segment between " << cp[2*is].whichDetector();
825 std::cout <<
" and " << cp[2*is+1].whichDetector() << std::endl;
872 myHistos->fill(
"h400",zvertex,
X0ECAL_);
889 std::vector<unsigned>
empty;
892 for(
unsigned inx=0;inx<(unsigned)nx_;++inx)
944 double locxmin,locxmax,locymin,locymax;
947 std::vector<CaloSegment>::const_iterator segiterator;
966 std::cout <<
" FamosGrid: Could not go at such depth " << depth << std::endl;
970 for(
unsigned ii=0; ii<
segments_.size() ; ++ii)
981 std::cout <<
" In " << segiterator->whichDetector() << std::endl;
1024 bool hasbeenpulled=
false;
1025 bool behindback=
false;
1026 for(
unsigned il=0;il<4;++il)
1033 if(
pulled(origin,normal_,a))
1044 if(dummyt>1) behindback=
true;
1091 padsatdepth_[ic].extrems(locxmin,locxmax,locymin,locymax);
1121 for(
unsigned idir=0;idir<8;++idir)
1135 DetId newcell(oldcell);
1144 std::map<DetId,unsigned>::const_iterator niter(
DetIdMap_.find(newcell));
1186 double dotproduct=normal.Dot(fPoint-origin);
1187 if(dotproduct<=0.)
return false;
1190 fPoint -= (1+dotproduct)*normal;
1212 if(tix>=0) ix=(unsigned)tix;
1213 if(tiy>=0) iy=(unsigned)tiy;
1239 std::vector<neighbour> gaps;
1240 std::vector<std::vector<neighbour> > cracks;
1252 for(
unsigned iside=0;iside<4;++iside)
1260 if(neighbourstatus<0)
1263 unsigned neighbourNumber=
regionOfInterest_[iq].crystalNeighbour(iside).number();
1266 if(neighbourstatus==1)
1269 cracks[iq].push_back(
neighbour(thisside,neighbourNumber));
1273 gaps.push_back(
neighbour(thisside,neighbourNumber));
1281 unsigned ncracks=cracks.size();
1283 for(
unsigned icrack=0;icrack<ncracks;++icrack)
1318 if(dirs.size()==1)
return false;
1319 if(dirs.size()%2==0)
return false;
1349 unsigned ngaps=gaps.size();
1350 static bool debug=
false;
1355 std::cout <<
" Avant " << ngaps <<
" " <<gaps[0].first<< std::endl;
1383 std::cout <<
" Avant " << ngaps <<
" " <<gaps[0].first<<
" " <<gaps[1].first << std::endl;
1385 std::cout <<
" Voisin 1 " << (gaps[0].second) << std::endl;
1386 std::cout <<
" Voisin 2 " << (gaps[1].second) << std::endl;
1390 CLHEP::Hep2Vector
point(0.,0.);
1402 if(gaps[0].first==
EAST||gaps[0].first==
WEST)
1437 unsigned iubd,idir1,idir2;
1439 CLHEP::Hep2Vector
point(0.,0.);
1466 CLHEP::Hep2Vector
point(0.,0.);
1484 unsigned ncracks=cracks.size();
1486 for(
unsigned ic=0;ic<ncracks;++ic)
1490 switch(cracks[ic].
first)
1544 XYZVector crossproduct(0.,0.,0.),previouscrossproduct(0.,0.,0.);
1546 for(
unsigned ip=0;ip<4 ; ++ip) {
1547 crossproduct = (corners[ip]-
p).Cross(corners[(ip+1)%4]-
p);
1549 previouscrossproduct=crossproduct;
1551 if (crossproduct.Dot(previouscrossproduct)<0.)
return false;
void ecalCellLine(const XYZPoint &, const XYZPoint &, std::vector< CaloPoint > &cp)
double pulledPadProbability_
CrystalWindowMap * myCrystalWindowMap_
void buildCrystal(const DetId &id, Crystal &) const
std::map< DetId, unsigned > DetIdMap_
const RawParticle & vfcalEntrance() const
The particle at VFCAL entrance.
std::vector< CrystalPad > crackpadsatdepth_
bool addHit(double r, double phi, unsigned layer=0)
static CaloDirection add2d(const CaloDirection &dir1, const CaloDirection &dir2)
void hcalCellLine(std::vector< CaloPoint > &cp) const
static CaloDirection oppositeSide(const CaloDirection &side)
ROOT::Math::Plane3D::Vector Vector
std::pair< CaloDirection, unsigned > neighbour
bool unbalancedDirection(const std::vector< neighbour > &dirs, unsigned &unb, unsigned &dir1, unsigned &dir2)
double length() const
length of the segment (in cm)
double thickness(const double eta) const
std::vector< CrystalPad > padsatdepth_
Sin< T >::type sin(const T &t)
const RawParticle & layer1Entrance() const
The particle at Preshower Layer 1.
Geom::Theta< T > theta() const
double X0length() const
length of the segment (in X0)
std::vector< CLHEP::Hep2Vector > mycorners
static unsigned oppositeDirection(unsigned iside)
CLHEP::Hep2Vector & edge(unsigned iside, int n)
access to the corners in direction iside; n=0,1
bool pulled(const XYZPoint &origin, const XYZNormal &normal, XYZPoint &fPoint) const
EcalHitMaker(CaloGeometryHelper *calo, const XYZPoint &ecalentrance, const DetId &cell, int onEcal, unsigned size, unsigned showertype, const RandomEngine *engine)
const PreshowerLayer1Properties * layer1Properties(int onLayer1) const
Preshower Layer1 properties.
void prepareCrystalNumberArray()
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
std::vector< std::vector< unsigned > > myCrystalNumberArray_
bool borderCrossing(const DetId &, const DetId &) const
static unsigned neighbourDirection(const CaloDirection &side)
unsigned int -> Direction for the neighbours
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
ROOT::Math::Transform3DPJ Transform3DR
double L0length() const
length of the segment (in L9)
unsigned fastInsideCell(const CLHEP::Hep2Vector &point, double &sp, bool debug=false)
bool getCrystalWindow(unsigned, std::vector< unsigned > &) const
get the ordered list of the crystals around the crystal given as a first argument ...
double ecalTotalX0() const
in the ECAL
double crackPadProbability_
const PreshowerLayer2Properties * layer2Properties(int onLayer2) const
Preshower Layer2 properties.
bool addHitDepth(double r, double phi, double depth=-1)
const math::XYZTLorentzVector & position() const
Temporary (until CMSSW moves to Mathcore) - No ! Actually very useful.
double radiusCorrectionFactor_
void setTrackParameters(const XYZNormal &normal, double X0depthoffset, const FSimTrack &theTrack)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Cos< T >::type cos(const T &t)
const FSimTrack * myTrack_
const HCALProperties * hcalProperties(int onHcal) const
HCAL properties.
static Histos * instance()
Tan< T >::type tan(const T &t)
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
void cracksPads(std::vector< neighbour > &cracks, unsigned iq)
static XYZPoint intersect(const Plane3D &p, const XYZPoint &a, const XYZPoint &b, double &t, bool segment, bool debug=false)
const FSimVertex & vertex() const
Origin vertex.
std::vector< CaloPoint > intersections_
double magneticField() const
static CaloDirection Side(unsigned i)
unsigned int -> Side conversion
double outsideWindowEnergy_
void gapsLifting(std::vector< neighbour > &gaps, unsigned iq)
CLHEP::Hep2Vector & correspondingEdge(neighbour &myneighbour, CaloDirection dir2)
const XYZTLorentzVector & vertex() const
the vertex fourvector
ROOT::Math::Plane3D Plane3D
This class is used to determine if a point lies in the segment.
unsigned ncrackpadsatdepth_
std::vector< XYZPoint > corners
const RandomEngine * random
const XYZVector & getFirstEdge() const
Direction of the first edge.
ROOT::Math::Plane3D Plane3D
void getWindow(const DetId &pivot, int s1, int s2, std::vector< DetId > &) const
double flatShoot(double xmin=0.0, double xmax=1.0) const
double thickness(double eta) const
bool getPads(double depth, bool inCm=false)
void cellLine(std::vector< CaloPoint > &cp)
std::vector< float > hits_
std::vector< std::vector< double > > tmp
std::vector< Crystal > regionOfInterest_
const DetId & getDetId() const
get the DetId
void buildSegments(const std::vector< CaloPoint > &cp)
const RawParticle & layer2Entrance() const
The particle at Preshower Layer 2.
void preshowerCellLine(std::vector< CaloPoint > &cp) const
math::XYZVector XYZVector
const RawParticle & hcalEntrance() const
The particle at HCAL entrance.
void setSurvivalProbability(double val)
std::map< uint32_t, float > hitMap_
std::vector< bool > validPads_
std::vector< DetId > CellsWindow_
CaloDirection
Codes the local directions in the cell lattice.
bool inside3D(const std::vector< XYZPoint > &, const XYZPoint &p) const
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
virtual double thickness(double eta) const =0
Thickness (in cm) of the homegeneous material as a function of rapidity.
bool hitmaphasbeencalculated_
const std::map< uint32_t, float > & getHits()
not been done.
math::XYZVector XYZNormal
const EcalEndcapGeometry * getEcalEndcapGeometry() const
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
bool diagonalEdge(unsigned myPad, CaloDirection dir, CLHEP::Hep2Vector &point)
bool move(DetId &cell, const CaloDirection &dir, bool fast=true) const
std::vector< CaloSegment > segments_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)