35 const DetId& cell,
int onEcal,
36 unsigned size,
unsigned showertype,
39 EcalEntrance_(ecalentrance),
274 unsigned size=localCellVector.size();
283 for(
unsigned ic=0;ic<8&&ic<
size;++ic)
285 unsigned iq=localCellVector[ic];
308 unsigned iquadinside=999;
322 if(!found&&debug)
std::cout <<
" Not found in the cracks " << std::endl;
329 double X0depthoffset,
355 for(
unsigned idir=0;idir<4;++idir)
367 std::vector<CaloSegment>::const_iterator segiterator;
389 double x0=segiterator->x0FromCm(dist);
451 std::cout <<
" Problem with the grid " << std::endl;
457 sort(cp.begin(),cp.end(),myDistance);
491 XYZPoint point2=point1+dir*cmthickness;
514 XYZPoint point2=point1+dir*cmthickness;
538 if(onHcal<=2&&onHcal>0)
542 double eta=point1.eta();
547 XYZPoint point2=point1+dir*thickness;
556 double eta=point1.eta();
563 XYZPoint point2=point1+dir*thickness;
578 DetId c_entrance,c_exit;
579 bool entrancefound(
false),exitfound(
false);
591 unsigned ncrystals=(unsigned)(backdistance*0.45);
592 unsigned highlim=(ncrystals+4);
599 while(ic<
ncrystals_&&(ic<highlim||!exitfound))
640 if(entrancefound&&exitfound&&c_entrance==c_exit)
return;
642 for(
unsigned iside=0;iside<4;++iside)
668 unsigned size=cp.size();
675 unsigned nsegments=size/2;
683 unsigned ncrossedxtals = 0;
688 if(cp[2*is].getDetId()!=cp[2*is+1].getDetId()&&
705 if(cp[2*is+1].whichDetector()==
DetId::Ecal && cp[2*is+1].whichSubDetector()==
EcalPreshower && cp[2*is+1].whichLayer()==1)
718 std::cout <<
" Strange segment between Preshower1 and " << cp[2*is+1].whichDetector();
729 if(cp[2*is+1].whichDetector()==
DetId::Ecal && cp[2*is+1].whichSubDetector()==
EcalPreshower && cp[2*is+1].whichLayer()==2)
741 if(is<(nsegments-1) && cp[2*is+2].whichDetector()==
DetId::Ecal && cp[2*is+2].whichSubDetector()==
EcalEndcap)
755 std::cout <<
" Strange segment between Preshower2 and " << cp[2*is+1].whichDetector();
768 DetId cell2=cp[2*is+1].getDetId();
773 if(cp[2*is].getDetId()==cell2)
788 std::cout <<
" One more bug in the segment " <<std::endl;
792 if(is>0 && is<nsegments)
794 DetId cell3=cp[2*is].getDetId();
825 std::cout <<
" Strange segment between " << cp[2*is].whichDetector();
826 std::cout <<
" and " << cp[2*is+1].whichDetector() << std::endl;
873 myHistos->fill(
"h400",zvertex,
X0ECAL_);
890 std::vector<unsigned>
empty;
893 for(
unsigned inx=0;inx<(unsigned)nx_;++inx)
945 double locxmin,locxmax,locymin,locymax;
948 std::vector<CaloSegment>::const_iterator segiterator;
967 std::cout <<
" FamosGrid: Could not go at such depth " << depth << std::endl;
982 std::cout <<
" In " << segiterator->whichDetector() << std::endl;
1025 bool hasbeenpulled=
false;
1026 bool behindback=
false;
1027 for(
unsigned il=0;il<4;++il)
1034 if(
pulled(origin,normal_,a))
1045 if(dummyt>1) behindback=
true;
1092 padsatdepth_[ic].extrems(locxmin,locxmax,locymin,locymax);
1122 for(
unsigned idir=0;idir<8;++idir)
1136 DetId newcell(oldcell);
1145 std::map<DetId,unsigned>::const_iterator niter(
DetIdMap_.find(newcell));
1187 double dotproduct=normal.Dot(fPoint-origin);
1188 if(dotproduct<=0.)
return false;
1191 fPoint -= (1+dotproduct)*normal;
1213 if(tix>=0) ix=(unsigned)tix;
1214 if(tiy>=0) iy=(unsigned)tiy;
1228 hitMap_.insert(std::pair<CaloHitID,float>(current_id,
hits_[ic]));
1232 hitMap_.insert(std::pair<CaloHitID,float>(current_id,
hits_[ic]));
1251 std::vector<neighbour> gaps;
1252 std::vector<std::vector<neighbour> > cracks;
1264 for(
unsigned iside=0;iside<4;++iside)
1272 if(neighbourstatus<0)
1275 unsigned neighbourNumber=
regionOfInterest_[iq].crystalNeighbour(iside).number();
1278 if(neighbourstatus==1)
1281 cracks[iq].push_back(
neighbour(thisside,neighbourNumber));
1285 gaps.push_back(
neighbour(thisside,neighbourNumber));
1293 unsigned ncracks=cracks.size();
1295 for(
unsigned icrack=0;icrack<ncracks;++icrack)
1330 if(dirs.size()==1)
return false;
1331 if(dirs.size()%2==0)
return false;
1361 unsigned ngaps=gaps.size();
1367 std::cout <<
" Avant " << ngaps <<
" " <<gaps[0].first<< std::endl;
1395 std::cout <<
" Avant " << ngaps <<
" " <<gaps[0].first<<
" " <<gaps[1].first << std::endl;
1397 std::cout <<
" Voisin 1 " << (gaps[0].second) << std::endl;
1398 std::cout <<
" Voisin 2 " << (gaps[1].second) << std::endl;
1402 CLHEP::Hep2Vector
point(0.,0.);
1414 if(gaps[0].first==
EAST||gaps[0].first==
WEST)
1449 unsigned iubd,idir1,idir2;
1451 CLHEP::Hep2Vector
point(0.,0.);
1478 CLHEP::Hep2Vector
point(0.,0.);
1496 unsigned ncracks=cracks.size();
1498 for(
unsigned ic=0;ic<ncracks;++ic)
1502 switch(cracks[ic].
first)
1556 XYZVector crossproduct(0.,0.,0.),previouscrossproduct(0.,0.,0.);
1558 for(
unsigned ip=0;ip<4 ; ++ip) {
1559 crossproduct = (corners[ip]-
p).Cross(corners[(ip+1)%4]-
p);
1561 previouscrossproduct=crossproduct;
1563 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)
double flatShoot(double xmin=0.0, double xmax=1.0) const
void hcalCellLine(std::vector< CaloPoint > &cp) const
EcalHitMaker(CaloGeometryHelper *calo, const XYZPoint &ecalentrance, const DetId &cell, int onEcal, unsigned size, unsigned showertype, const RandomEngineAndDistribution *engine)
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
const RandomEngineAndDistribution * random
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
const PreshowerLayer1Properties * layer1Properties(int onLayer1) const
Preshower Layer1 properties.
void prepareCrystalNumberArray()
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
const CaloSubdetectorGeometry * getEcalGeometry(int subdetn) const
ROOT::Math::Transform3DPJ Transform3DR
double L0length() const
length of the segment (in L9)
int hashedIndex(int ieta, int iphi)
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
std::map< CaloHitID, float > hitMap_
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
const std::map< CaloHitID, float > & getHits()
not been done.
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::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 GlobalPoint & getPosition() const
Returns the position of reference for this cell.
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)