|
|
Go to the documentation of this file.
51 : mySimEvent(aSimEvent),
52 _theGeometry(nullptr),
53 _theFieldMap(nullptr),
54 theMaterialEffects(nullptr),
55 myDecayEngine(nullptr),
56 theGeomTracker(nullptr),
57 theGeomSearchTracker(nullptr),
59 theNegLayerOffset(27),
68 if (
decays.getParameter<
bool>(
"ActivateDecays")) {
82 pTmin =
simHits.getUntrackedParameter<
double>(
"pTmin", 0.5);
137 std::list<TrackerLayer>::const_iterator cyliter;
163 PP.setPropagationConditions(*cyliter);
164 if (PP.inside() && !PP.onSurface())
176 double ppcos2T = PP.particle().cos2Theta();
177 double ppcos2V = PP.particle().cos2ThetaV();
180 if ((ppcos2T > 0.99 && ppcos2T < 0.9998) && (cyl == 0 || (ppcos2V > 0.99 && ppcos2V < 0.9998))) {
186 }
else if (ppcos2T > 0.9998 && (cyl == 0 || ppcos2V > 0.9998)) {
190 if (ppcos2T > 0.9998 && (cyl == 0 || ppcos2V > 0.9998)) {
200 if (cyliter->surface().mediumProperties().radLen() < 1E-10) {
209 bool escapeBarrel = PP.getSuccess() == -1;
210 bool escapeEndcap = (PP.getSuccess() == -2 &&
success == 1);
212 bool fullPropagation = (PP.getSuccess() <= 0 &&
success == 0) || escapeEndcap;
226 fullPropagation =
true;
231 PP.setPropagationConditions(*cyliter, !fullPropagation);
233 PP.increaseRCyl(0.0005);
240 if (!PP.propagateToBoundSurface(*cyliter) || PP.getSuccess() <= 0) {
247 if (PP.hasDecayed() ||
259 if (PP.getSuccess() > 0 && PP.onFiducial()) {
261 PP.particle().charge() != 0. &&
262 cyliter->sensitive() &&
270 saveHit &= PP.particle().E() > 1E-6;
274 if (cyliter->sensitive()) {
325 PP.propagateToEcal();
329 if (PP.getSuccess() == 0) {
333 PP.setPropagationConditions(*cyliter);
334 PP.propagateToBoundSurface(*cyliter);
337 if (PP.getSuccess() < 0) {
417 std::list<TrackerLayer>::const_iterator cyliter;
425 if (
layer != cyliter->layerNumber())
453 double magBefore =
std::sqrt(momentumBefore.Vect().mag2());
454 double magAfter =
std::sqrt(momentumAfter.Vect().mag2());
456 XYZVector axis = momentumBefore.Vect().Cross(momentumAfter.Vect());
457 double angle = std::acos(momentumBefore.Vect().Dot(momentumAfter.Vect()) / (magAfter * magBefore));
460 double rescale = magAfter / magBefore;
477 int theClosestChargedDaughterId = -1;
483 for (; daughter !=
daughters.end(); ++daughter) {
487 double dist = (daughter->Vect().Unit().Cross(PP.
particle().
Vect().Unit())).R();
490 theClosestChargedDaughterId = theDaughterId;
496 if (theClosestChargedDaughterId >= 0)
508 XYZVector newMomentum(
r * daughMomentum.Vect());
510 double newEnergy =
std::sqrt(newMomentum.mag2() + daughMomentum.mag2());
513 XYZTLorentzVector(newMomentum.X(), newMomentum.Y(), newMomentum.Z(), newEnergy));
522 std::map<double, PSimHit>& theHitMap,
548 std::vector<DetWithState> compat = tkLayer->
compatibleDets(trajState, alongProp, est);
551 std::map<double, PSimHit> theTrackHits;
552 for (std::vector<DetWithState>::const_iterator
i = compat.begin();
i != compat.end();
i++) {
564 auto plane =
layer->surface().tangentPlane(
pos);
571 std::map<double, PSimHit>& theHitMap,
579 for (std::vector<const GeomDet*>::const_iterator
i =
comp.begin();
i !=
comp.end();
i++) {
582 theHitMap.insert(theHitMap.end(),
makeSinglePSimHit(*du, ts, tkID, el, thick, pID, tTopo));
586 theHitMap.insert(theHitMap.end(),
makeSinglePSimHit(*du, ts, tkID, el, thick, pID, tTopo));
597 const float onSurfaceTolarance = 0.01;
607 std::pair<bool, double>
path = crossing.pathLength(det.
surface());
610 return std::pair<double, PSimHit>(0.,
PSimHit());
619 float halfThick = 0.5 * theDetPlane.bounds().thickness();
626 eloss *= (2. * halfThick - 0.003) / (9.36 * thick);
637 int localTkID = tkID;
646 unsigned subdet =
DetId(
hit.detUnitId()).subdetId();
647 double boundX = theDetPlane.bounds().width() / 2.;
648 double boundY = theDetPlane.bounds().length() / 2.;
651 if (subdet == 4 || subdet == 6)
652 boundX *= 1. -
hit.localPosition().
y() / theDetPlane.position().perp();
655 unsigned detid =
DetId(
hit.detUnitId()).rawId();
657 unsigned theLayer = 0;
658 unsigned theRing = 0;
662 std::cout <<
"\tPixel Barrel Layer " << theLayer << std::endl;
667 theLayer = tTopo->
pxfDisk(detid);
668 std::cout <<
"\tPixel Forward Disk " << theLayer << std::endl;
674 std::cout <<
"\tTIB Layer " << theLayer << std::endl;
680 theRing = tTopo->
tidRing(detid);
681 unsigned int theSide =
module.side();
683 std::cout <<
"\tTID Petal Back " << std::endl;
685 std::cout <<
"\tTID Petal Front" << std::endl;
686 std::cout <<
"\tTID Layer " << theLayer << std::endl;
687 std::cout <<
"\tTID Ring " << theRing << std::endl;
694 std::cout <<
"\tTOB Layer " << theLayer << std::endl;
699 theRing = tTopo->
tecRing(detid);
700 unsigned int theSide =
module.petal()[0];
702 std::cout <<
"\tTEC Petal Back " << std::endl;
704 std::cout <<
"\tTEC Petal Front" << std::endl;
705 std::cout <<
"\tTEC Layer " << theLayer << std::endl;
706 std::cout <<
"\tTEC Ring " << theRing << std::endl;
716 std::cout <<
"Thickness = " << 2. * halfThick - 0.003 <<
"; " << thick * 9.36 << std::endl
720 std::cout <<
"Hit position = " <<
hit.localPosition().
x() <<
" " <<
hit.localPosition().
y() <<
" "
721 <<
hit.localPosition().
z() << std::endl;
734 dist = (fabs(
hit.localPosition().
x()) > boundX || fabs(
hit.localPosition().
y()) > boundY)
754 return std::pair<double, PSimHit>(dist,
hit);
770 LogDebug(
"FastTracking") <<
"Barrel DetLayer dump: ";
771 for (
auto bl = barrelLayers.begin(); bl != barrelLayers.end(); ++bl) {
772 LogDebug(
"FastTracking") <<
"radius " << (**bl).specificSurface().radius();
776 LogDebug(
"FastTracking") <<
"Positive Forward DetLayer dump: ";
777 for (
auto fl = posForwardLayers.begin(); fl != posForwardLayers.end(); ++fl) {
778 LogDebug(
"FastTracking") <<
"Z pos " << (**fl).surface().position().z() <<
" radii "
779 << (**fl).specificSurface().innerRadius() <<
", "
780 << (**fl).specificSurface().outerRadius();
783 const float rTolerance = 1.5;
784 const float zTolerance = 3.;
786 LogDebug(
"FastTracking") <<
"Dump of TrackerInteractionGeometry cylinders:";
792 LogDebug(
"FastTracking") <<
"Famos Layer no " <<
i->layerNumber() <<
" is sensitive? " <<
i->sensitive() <<
" pos "
793 <<
i->surface().position();
797 if (cyl !=
nullptr) {
798 LogDebug(
"FastTracking") <<
" cylinder radius " << cyl->radius();
800 for (
auto bl = barrelLayers.begin(); bl != barrelLayers.end(); ++bl) {
801 if (fabs(cyl->radius() - (**bl).specificSurface().radius()) < rTolerance) {
804 LogDebug(
"FastTracking") <<
"Corresponding DetLayer found with radius " << (**bl).specificSurface().radius();
809 edm::LogWarning(
"FastTracking") <<
" Trajectory manager FAILED to find a corresponding DetLayer!";
812 LogDebug(
"FastTracking") <<
" disk radii " << disk->innerRadius() <<
", " << disk->outerRadius();
814 for (
auto fl = posForwardLayers.begin(); fl != posForwardLayers.end(); ++fl) {
815 if (fabs(disk->position().z() - (**fl).surface().position().z()) < zTolerance) {
818 LogDebug(
"FastTracking") <<
"Corresponding DetLayer found with Z pos " << (**fl).surface().position().z()
819 <<
" and radii " << (**fl).specificSurface().innerRadius() <<
", "
820 << (**fl).specificSurface().outerRadius();
825 edm::LogWarning(
"FastTracking") <<
"FAILED to find a corresponding DetLayer!";
832 for (
auto nl = negForwardLayers.begin(); nl != negForwardLayers.end(); ++nl) {
836 if (fabs((**nl).surface().position().z() +
theLayerMap[
i]->surface().position().z()) < zTolerance) {
845 if (zpos > 0 || !
layer.forward())
852 std::map<unsigned, std::map<double, PSimHit> >::const_iterator itrack =
thePSimHits.begin();
853 std::map<unsigned, std::map<double, PSimHit> >::const_iterator itrackEnd =
thePSimHits.end();
854 for (; itrack != itrackEnd; ++itrack) {
855 std::map<double, PSimHit>::const_iterator it = (itrack->second).begin();
856 std::map<double, PSimHit>::const_iterator itEnd = (itrack->second).
end();
857 for (; it != itEnd; ++it) {
869 c.push_back(it->second);
double thickness() const
Return the thickness of the current layer.
PythiaDecays * myDecayEngine
void reconstruct(const TrackerTopology *tTopo, RandomEngineAndDistribution const *)
Does the real job.
void setMomentum(const math::XYZTLorentzVector &newMomentum)
Reset the momentum (to be used with care)
void makePSimHits(const GeomDet *det, const TrajectoryStateOnSurface &ts, std::map< double, PSimHit > &theHitMap, int tkID, float el, float thick, int pID, const TrackerTopology *tTopo)
and there
LocalVector localMomentum() const
int nDaughters() const
Number of daughters.
void createPSimHits(const TrackerLayer &layer, const ParticlePropagator &P_before, std::map< double, PSimHit > &theHitMap, int trackID, int partID, const TrackerTopology *tTopo)
Create a vector of PSimHits.
bool propagateToEcalEntrance(bool first=true)
virtual float width() const =0
bool propagateToBoundSurface(const TrackerLayer &)
void initializeTrackerGeometry(const TrackerGeometry *geomTracker)
Initialize the full Tracker Geometry.
RawParticle const & particle() const
The particle being propagated.
const DetLayer * detLayer(const TrackerLayer &layer, float zpos) const
Returns the DetLayer pointer corresponding to the FAMOS layer.
const FSimTrack & mother() const
mother
void setLayer1(const RawParticle &pp, int success)
Set the preshower layer1 variables.
void setEcal(const RawParticle &pp, int success)
Set the ecal variables.
void propagateToCalorimeters(ParticlePropagator &PP, int fsimi, RandomEngineAndDistribution const *)
Propagate the particle through the calorimeters.
const XYZTLorentzVector & momentum() const
the momentum fourvector
std::list< TrackerLayer >::const_iterator cylinderEnd() const
Returns the last pointer in the cylinder list.
void initializeRecoGeometry(const GeometricSearchTracker *geomSearchTracker, const TrackerInteractionGeometry *interactionGeometry, const MagneticFieldMap *aFieldMap)
Initialize the Reconstruction Geometry.
const XYZTLorentzVector & vertex() const
the vertex fourvector
FSimVertex & vertex(int id) const
Return vertex with given Id.
GlobalPoint globalPosition() const
void moveAllDaughters(int fsimi, const Rotation &r, double rescale)
Move, rescale and rotate all daughters after propagation, material effects and decay of the mother.
const MagneticFieldMap * _theFieldMap
void setTkPosition(const math::XYZVectorD &pos)
const GeometricSearchTracker * theGeomSearchTracker
math::XYZVector XYZVector
const FSimVertex & endVertex() const
end vertex
const TrackerGeometry * theGeomTracker
double energyLoss() const
Return the energy loss by ionization in the current layer.
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
ROOT::Math::AxisAngle Rotation
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
virtual std::vector< const GeomDet * > components() const
Returns direct components, if any.
double transverseCurvature() const
math::XYZTLorentzVector XYZTLorentzVector
Global3DVector GlobalVector
unsigned int nTracks() const
Number of tracks.
double charge() const
get the MEASURED charge
void setPropagationConditions(const TrackerLayer &, bool firstLoop=true)
Log< level::Warning, false > LogWarning
void interact(FSimEvent &simEvent, const TrackerLayer &layer, ParticlePropagator &PP, unsigned i, RandomEngineAndDistribution const *)
unsigned int tidRing(const DetId &id) const
void setVFcal(const RawParticle &pp, int success)
Set the hcal variables.
uint32_t tobStereo(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
virtual float length() const =0
unsigned int pxbLayer(const DetId &id) const
double Z() const
z of vertex
bool propagateToHcalEntrance(bool first=true)
const Plane & surface() const
The nominal surface of the GeomDet.
int closestDaughterId() const
Get the index of the closest charged daughter.
Vector3DBase unit() const
~TrajectoryManager()
Default Destructor.
FSimTrack & track(int id) const
Return track with given Id.
bool propagateToPreshowerLayer2(bool first=true)
const DaughterParticleList & particleDaughters(ParticlePropagator &particle, CLHEP::HepRandomEngine *)
std::pair< double, PSimHit > makeSinglePSimHit(const GeomDetUnit &det, const TrajectoryStateOnSurface &ts, int tkID, float el, float thick, int pID, const TrackerTopology *tTopo) const
and there
MaterialEffects * theMaterialEffects
const Bounds & bounds() const
void setTkMomentum(const math::XYZTLorentzVectorD &mom)
double getMagneticField() const
Get the magnetic field.
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
std::vector< RawParticle > DaughterParticleList
std::vector< BarrelDetLayer const * > const & barrelLayers() const
Global3DPoint GlobalPoint
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
XYZVector Vect() const
the momentum threevector
TrajectoryManager()
Default Constructor.
const HepPDT::ParticleDataTable * theTable() const
Get the pointer to the particle data table.
constexpr std::array< uint8_t, layerIndexSize > layer
const TrackerInteractionGeometry * _theGeometry
int addSimTrack(const RawParticle *p, int iv, int ig=-1, const HepMC::GenVertex *ev=nullptr)
Add a new track to the Event and to the various lists.
int id() const
the index in FBaseSimEvent and other vectors
DetId geographicalId() const
The label of this GeomDet.
LocalPoint localPosition() const
const FSimVertex vertex() const
Origin vertex.
int id() const
the index in FBaseSimEvent
const math::XYZTLorentzVector & position() const
Temporary (until CMSSW moves to Mathcore) - No ! Actually very useful.
std::list< TrackerLayer >::const_iterator cylinderBegin() const
Returns the first pointer in the cylinder list.
unsigned int tecRing(const DetId &id) const
ring id
bool propagateToPreshowerLayer1(bool first=true)
unsigned int pxfDisk(const DetId &id) const
std::map< unsigned, std::map< double, PSimHit > > thePSimHits
int type() const
particle type (HEP PDT convension)
const FSimTrack & daughter(int i) const
Ith daughter.
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
CLHEP::HepRandomEngine & theEngine() const
const XYZTLorentzVector & momentum() const
Temporary (until move of SimTrack to Mathcore) - No! Actually very useful.
const BasicVectorType & basicVector() const
double cTau(int pdgID, const HepPDT::ParticleDataTable *pdt)
TrajectoryStateOnSurface makeTrajectoryState(const DetLayer *layer, const ParticlePropagator &pp, const MagneticField *field) const
Teddy, you must put comments there.
GlobalVector globalMomentum() const
void loadSimHits(edm::PSimHitContainer &c) const
std::vector< const DetLayer * > theLayerMap
unsigned int tobLayer(const DetId &id) const
std::vector< ForwardDetLayer const * > const & negForwardLayers() const
void setHcal(const RawParticle &pp, int success)
Set the hcal variables.
constexpr uint32_t rawId() const
get the raw id
const TrackerInteractionGeometry * theGeometry()
Returns the pointer to geometry.
void setClosestDaughterId(int id)
Set the index of the closest charged daughter.
bool onFiducial() const
Is the vertex on some material ?
bool acceptParticle(const RawParticle &p) const
std::vector< ForwardDetLayer const * > const & posForwardLayers() const
bool propagateToLayer(ParticlePropagator &PP, unsigned layer)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
T getParameter(std::string const &) const
bool propagateToVFcalEntrance(bool first=true)
bool notYetToEndVertex(const XYZTLorentzVector &pos) const
Compare the end vertex position with another position.
int addSimVertex(const XYZTLorentzVector &decayVertex, int im=-1, FSimVertexType::VertexType type=FSimVertexType::ANY)
Add a new vertex to the Event and to the various lists.
const KineParticleFilter & filter() const
DaughterParticleList::const_iterator DaughterParticleIterator
std::vector< PSimHit > PSimHitContainer
bool noMother() const
no mother particle
void save()
Save nuclear interaction information.
unsigned int tecWheel(const DetId &id) const
void updateWithDaughters(ParticlePropagator &PP, int fsimi, RandomEngineAndDistribution const *)
Decay the particle and update the SimEvent with daughters.
bool hasDecayed() const
Has the particle decayed while propagated ?
void setPosition(const math::XYZTLorentzVector &newPosition)
Reset the position (to be used with care)
void setPropagate()
The particle has been propgated through the tracker.
void initializeLayerMap()
Initialize correspondence map between Famos interaction geometry and tracker reco geometry.
unsigned int tibLayer(const DetId &id) const
void setLayer2(const RawParticle &pp, int success)
Set the preshower layer2 variables.