41 EcalEntrance_(ecalentrance),
253 unsigned size = localCellVector.size();
262 for (
unsigned ic = 0; ic < 8 && ic <
size; ++ic) {
263 unsigned iq = localCellVector[ic];
285 unsigned iquadinside = 999;
297 std::cout <<
" Not found in the cracks " << std::endl;
321 for (
unsigned ic = 0; ic <
ncrystals_; ++ic) {
322 for (
unsigned idir = 0; idir < 4; ++idir) {
332 std::vector<CaloSegment>::const_iterator segiterator;
348 double x0 = segiterator->x0FromCm(dist);
399 std::cout <<
" Problem with the grid " << std::endl;
405 sort(
cp.begin(),
cp.end(), myDistance);
431 if (cmthickness > 0) {
449 if (cmthickness > 0) {
470 if (onHcal <= 2 && onHcal > 0) {
473 double eta = point1.eta();
485 double eta = point1.eta();
503 DetId c_entrance, c_exit;
504 bool entrancefound(
false), exitfound(
false);
516 unsigned ncrystals = (unsigned)(backdistance * 0.45);
517 unsigned highlim = (ncrystals + 4);
524 while (ic <
ncrystals_ && (ic < highlim || !exitfound)) {
537 entrancefound =
true;
562 if (entrancefound && exitfound && c_entrance == c_exit)
565 for (
unsigned iside = 0; iside < 4; ++iside) {
586 unsigned size =
cp.size();
592 unsigned nsegments =
size / 2;
602 unsigned ncrossedxtals = 0;
605 while (is < nsegments) {
606 if (
cp[2 * is].getDetId() !=
cp[2 * is + 1].getDetId() &&
cp[2 * is].whichDetector() !=
DetId::Hcal &&
620 cp[2 * is].whichLayer() == 1) {
622 cp[2 * is + 1].whichLayer() == 1) {
632 std::cout <<
" Strange segment between Preshower1 and " <<
cp[2 * is + 1].whichDetector();
642 cp[2 * is].whichLayer() == 2) {
644 cp[2 * is + 1].whichLayer() == 2) {
655 if (is < (nsegments - 1) &&
cp[2 * is + 2].whichDetector() ==
DetId::Ecal &&
667 std::cout <<
" Strange segment between Preshower2 and " <<
cp[2 * is + 1].whichDetector();
686 if (
cp[2 * is].getDetId() ==
cell2) {
700 std::cout <<
" One more bug in the segment " << std::endl;
704 if (is > 0 && is < nsegments) {
705 DetId cell3 =
cp[2 * is].getDetId();
737 std::cout <<
" Strange segment between " <<
cp[2 * is].whichDetector();
738 std::cout <<
" and " <<
cp[2 * is + 1].whichDetector() << std::endl;
785 myHistos->fill(
"h400", zvertex,
X0ECAL_);
799 std::vector<unsigned>
empty;
802 for (
unsigned inx = 0; inx < (unsigned)
nx_; ++inx) {
810 for (
unsigned ic = 0; ic <
ncrystals_; ++ic) {
848 double locxmin, locxmax, locymin, locymax;
851 std::vector<CaloSegment>::const_iterator segiterator;
867 std::cout <<
" FamosGrid: Could not go at such depth " <<
depth << std::endl;
880 std::cout <<
" In " << segiterator->whichDetector() << std::endl;
910 (
Point)(origin + newaxis),
914 for (
unsigned ic = 0; ic <
ncrystals_; ++ic) {
923 bool hasbeenpulled =
false;
924 bool behindback =
false;
925 for (
unsigned il = 0; il < 4; ++il) {
933 hasbeenpulled =
true;
945 if (
xx.mag2() != 0) {
980 for (
unsigned ic = 0; ic <
ncrystals_; ++ic) {
987 padsatdepth_[ic].extrems(locxmin, locxmax, locymin, locymax);
1012 for (
unsigned ic = 0; ic <
ncrystals_; ++ic) {
1014 for (
unsigned idir = 0; idir < 8; ++idir) {
1025 DetId newcell(oldcell);
1033 std::map<DetId, unsigned>::const_iterator niter(
DetIdMap_.find(newcell));
1069 double dotproduct =
normal.Dot(fPoint - origin);
1070 if (dotproduct <= 0.)
1074 fPoint -= (1 + dotproduct) *
normal;
1101 for (
unsigned ic = 0; ic <
ncrystals_; ++ic) {
1111 hitMap_.insert(std::pair<CaloHitID, float>(current_id,
hits_[ic]));
1114 hitMap_.insert(std::pair<CaloHitID, float>(current_id,
hits_[ic]));
1129 std::vector<neighbour> gaps;
1130 std::vector<std::vector<neighbour> > cracks;
1134 for (
unsigned iq = 0; iq <
ncrystals_; ++iq) {
1141 for (
unsigned iside = 0; iside < 4; ++iside) {
1147 if (neighbourstatus < 0)
1150 unsigned neighbourNumber =
regionOfInterest_[iq].crystalNeighbour(iside).number();
1154 if (neighbourstatus == 1) {
1156 cracks[iq].push_back(
neighbour(thisside, neighbourNumber));
1159 gaps.push_back(
neighbour(thisside, neighbourNumber));
1167 unsigned ncracks = cracks.size();
1169 for (
unsigned icrack = 0; icrack < ncracks; ++icrack) {
1200 if (
dirs.size() == 1)
1202 if (
dirs.size() % 2 == 0)
1228 unsigned ngaps = gaps.size();
1232 std::cout <<
" Avant " << ngaps <<
" " << gaps[0].first << std::endl;
1250 }
else if (ngaps == 2) {
1252 std::cout <<
" Avant " << ngaps <<
" " << gaps[0].first <<
" " << gaps[1].first << std::endl;
1254 std::cout <<
" Voisin 1 " << (gaps[0].second) << std::endl;
1255 std::cout <<
" Voisin 2 " << (gaps[1].second) << std::endl;
1259 CLHEP::Hep2Vector
point(0., 0.);
1268 }
else if (corner0 ==
NONE) {
1295 }
else if (ngaps == 3) {
1297 unsigned iubd, idir1, idir2;
1299 CLHEP::Hep2Vector
point(0., 0.);
1318 }
else if (ngaps == 4) {
1322 CLHEP::Hep2Vector
point(0., 0.);
1338 unsigned ncracks = cracks.size();
1340 for (
unsigned ic = 0; ic < ncracks; ++ic) {
1343 switch (cracks[ic].
first) {
1384 XYZVector crossproduct(0., 0., 0.), previouscrossproduct(0., 0., 0.);
1386 for (
unsigned ip = 0; ip < 4; ++ip) {
1389 previouscrossproduct = crossproduct;
1390 else if (crossproduct.Dot(previouscrossproduct) < 0.)
const CaloSubdetectorGeometry * getEcalGeometry(int subdetn) const
void ecalCellLine(const XYZPoint &, const XYZPoint &, std::vector< CaloPoint > &cp)
const DetId & getDetId() const
get the DetId
double pulledPadProbability_
bool addHit(double r, double phi, unsigned layer=0) override
void buildCrystal(const DetId &id, Crystal &) const
const RawParticle & vfcalEntrance() const
The particle at VFCAL entrance.
CrystalWindowMap * myCrystalWindowMap_
void convertIntegerCoordinates(double x, double y, unsigned &ix, unsigned &iy) const
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
std::map< DetId, unsigned > DetIdMap_
std::vector< CrystalPad > crackpadsatdepth_
const RawParticle & hcalEntrance() const
The particle at HCAL entrance.
static CaloDirection add2d(const CaloDirection &dir1, const CaloDirection &dir2)
const PreshowerLayer1Properties * layer1Properties(int onLayer1) const
Preshower Layer1 properties.
static const char * normal
const RawParticle & layer2Entrance() const
The particle at Preshower Layer 2.
EcalHitMaker(CaloGeometryHelper *calo, const XYZPoint &ecalentrance, const DetId &cell, int onEcal, unsigned size, unsigned showertype, const RandomEngineAndDistribution *engine)
bool getCrystalWindow(unsigned, std::vector< unsigned > &) const
get the ordered list of the crystals around the crystal given as a first argument ...
std::map< CaloHitID, float > hitMap_
static CaloDirection oppositeSide(const CaloDirection &side)
ROOT::Math::Plane3D::Vector Vector
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
bool unbalancedDirection(const std::vector< neighbour > &dirs, unsigned &unb, unsigned &dir1, unsigned &dir2)
std::vector< CrystalPad > padsatdepth_
Sin< T >::type sin(const T &t)
const PreshowerLayer2Properties * layer2Properties(int onLayer2) const
Preshower Layer2 properties.
void getWindow(const DetId &pivot, int s1, int s2, std::vector< DetId > &) const
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
const EcalEndcapGeometry * getEcalEndcapGeometry() const
void prepareCrystalNumberArray()
const FSimVertex vertex() const
Origin vertex.
static unsigned neighbourDirection(const CaloDirection &side)
unsigned int -> Direction for the neighbours
const CaloGeometryHelper * myCalorimeter
ROOT::Math::Transform3DPJ Transform3DR
double thickness(const double eta) const override
bool inside3D(const std::vector< XYZPoint > &, const XYZPoint &p) const
bool pulled(const XYZPoint &origin, const XYZNormal &normal, XYZPoint &fPoint) const
int hashedIndex(int ieta, int iphi)
unsigned fastInsideCell(const CLHEP::Hep2Vector &point, double &sp, bool debug=false)
double crackPadProbability_
const XYZVector & getFirstEdge() const
Direction of the first edge.
bool addHitDepth(double r, double phi, double depth=-1)
const std::map< CaloHitID, float > & getHits() override
double radiusCorrectionFactor_
void setTrackParameters(const XYZNormal &normal, double X0depthoffset, const FSimTrack &theTrack)
Cos< T >::type cos(const T &t)
const FSimTrack * myTrack_
double ecalTotalX0() const
in the ECAL
bool move(DetId &cell, const CaloDirection &dir, bool fast=true) const
static Histos * instance()
Tan< T >::type tan(const T &t)
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)
std::vector< CaloPoint > intersections_
double L0length() const
length of the segment (in L9)
static CaloDirection Side(unsigned i)
unsigned int -> Side conversion
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
double outsideWindowEnergy_
void gapsLifting(std::vector< neighbour > &gaps, unsigned iq)
CLHEP::Hep2Vector & correspondingEdge(neighbour &myneighbour, CaloDirection dir2)
ROOT::Math::Plane3D Plane3D
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
This class is used to determine if a point lies in the segment.
XYZVector Vect() const
the momentum threevector
std::pair< CaloDirection, unsigned > neighbour
unsigned ncrackpadsatdepth_
std::vector< XYZPoint > corners
double thickness(double eta) const override
bool borderCrossing(const DetId &, const DetId &) const
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
void preshowerCellLine(std::vector< CaloPoint > &cp) const
ROOT::Math::Plane3D Plane3D
const math::XYZTLorentzVector & position() const
Temporary (until CMSSW moves to Mathcore) - No ! Actually very useful.
double length() const
length of the segment (in cm)
bool getPads(double depth, bool inCm=false)
void cellLine(std::vector< CaloPoint > &cp)
std::vector< std::vector< unsigned > > myCrystalNumberArray_
std::vector< float > hits_
std::vector< Crystal > regionOfInterest_
double magneticField() const
void buildSegments(const std::vector< CaloPoint > &cp)
double X0length() const
length of the segment (in X0)
void hcalCellLine(std::vector< CaloPoint > &cp) const
Structure Point Contains parameters of Gaussian fits to DMRs.
math::XYZVector XYZVector
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
void setSurvivalProbability(double val)
std::vector< bool > validPads_
std::vector< DetId > CellsWindow_
CaloDirection
Codes the local directions in the cell lattice.
virtual double thickness(double eta) const =0
Thickness (in cm) of the homegeneous material as a function of rapidity.
double flatShoot(double xmin=0.0, double xmax=1.0) const
ROOT::Math::Plane3D::Point Point
bool hitmaphasbeencalculated_
const RawParticle & layer1Entrance() const
The particle at Preshower Layer 1.
static constexpr float d1
const HCALProperties * hcalProperties(int onHcal) const
HCAL properties.
math::XYZVector XYZNormal
Geom::Theta< T > theta() const
*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
const XYZTLorentzVector & vertex() const
the vertex fourvector
bool diagonalEdge(unsigned myPad, CaloDirection dir, CLHEP::Hep2Vector &point)
std::vector< CaloSegment > segments_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)