172 std::vector<PSimHit> theCSCHits;
173 std::vector<PSimHit> theDTHits;
174 std::vector<PSimHit> theRPCHits;
180 for (
unsigned int itrk = 0; itrk < simMuons->size(); itrk++) {
181 const SimTrack& mySimTrack = (*simMuons)[itrk];
187 int pid = mySimTrack.
type();
188 if (
abs(pid) != 13 &&
abs(pid) != 1000024)
194 t0 = (*simVertices)[ivert].position().t();
198 initialPosition = xyzzy;
205 double tof =
t0 / 29.98;
208 std::cout <<
" ===> MuonSimHitProducer::reconstruct() found SIMTRACK - pid = " << pid;
209 std::cout <<
" : pT = " << mySimP4.Pt() <<
", eta = " << mySimP4.Eta() <<
", phi = " << mySimP4.Phi() << std::endl;
227 GlobalVector dtracker = startingPosition - initialPosition;
228 tof += dtracker.
mag() / 29.98;
231 std::cout <<
" the Muon START position " << startingPosition << std::endl;
232 std::cout <<
" the Muon START momentum " << startingMomentum << std::endl;
247 std::vector<const DetLayer*> navLayers;
248 if (fabs(startingState.globalMomentum().eta()) > 4.5) {
249 navLayers = navigation.compatibleEndcapLayers(*(startingState.freeState()),
alongMomentum);
251 navLayers = navigation.compatibleLayers(*(startingState.freeState()),
alongMomentum);
258 if (navLayers.empty())
262 std::cout <<
"Found " << navLayers.size() <<
" compatible DetLayers..." << std::endl;
266 for (
unsigned int ilayer = 0; ilayer < navLayers.size(); ilayer++) {
268 std::cout <<
"Propagating to layer " << ilayer <<
" " << dumper.dumpLayer(navLayers[ilayer]) << std::endl;
271 std::vector<DetWithState> comps =
277 std::cout <<
"Propagating " << propagatedState << std::endl;
287 ->propagate(shsStart, navLayers[ilayer]->surface(), shsDest);
288 std::pair<TrajectoryStateOnSurface, double>
next(shsDest.
getStateOnSurface(navLayers[ilayer]->surface()),
292 if (!
next.first.isValid())
296 double radPath = shsDest.
radPath();
297 double pathLength =
next.second;
301 std::pair<TrajectoryStateOnSurface, double> nextNoMaterial =
305 propagatedState =
next.first;
314 if (!propagatedState.
isValid())
322 double pavg = 0.5 * (
pi +
pf);
323 double m = mySimP4.M();
324 double rbeta =
sqrt(1 +
m *
m / (pavg * pavg)) / 29.98;
325 double dtof = pathLength * rbeta;
328 std::cout <<
"Propagated to next surface... path length = " << pathLength <<
" cm, dTOF = " << dtof <<
" ns" 334 for (
unsigned int icomp = 0; icomp < comps.size(); icomp++) {
335 const GeomDet* gd = comps[icomp].first;
339 std::vector<const DTSuperLayer*> superlayer =
chamber->superLayers();
340 for (
unsigned int isl = 0; isl < superlayer.size(); isl++) {
341 std::vector<const DTLayer*>
layer = superlayer[isl]->layers();
342 for (
unsigned int ilayer = 0; ilayer <
layer.size(); ilayer++) {
355 std::pair<bool, double>
path = crossing.pathLength(det->
surface());
375 double pmu = lmom.
mag();
376 double theDTHitIneff = pmu > 0 ?
exp(
kDT *
log(pmu) +
fDT) : 0.;
377 if (random.flatShoot() < theDTHitIneff)
381 double pz = fabs(lmom.
z());
384 double dtof =
path.second * rbeta;
385 int trkid = mySimTrack.
trackId();
386 unsigned int id = wid.rawId();
387 short unsigned int processType = 2;
389 entry,
exit, lmom.
mag(), tof + dtof, eloss, pid,
id, trkid, lmom.
theta(), lmom.
phi(), processType);
390 theDTHits.push_back(
hit);
397 for (
unsigned int ilayer = 0; ilayer <
layers.size(); ilayer++) {
402 << lid.
layer() <<
")" << std::endl;
410 std::pair<bool, double>
path = crossing.pathLength(det->
surface());
418 if (!laygeom->
inside(lpos))
427 double pmu = lmom.
mag();
428 double theCSCHitIneff = pmu > 0 ?
exp(
kCSC *
log(pmu) +
fCSC) : 0.;
431 theCSCHitIneff = theCSCHitIneff * 0.442;
432 if (random.flatShoot() < theCSCHitIneff)
436 double pz = fabs(lmom.
z());
439 double dtof =
path.second * rbeta;
440 int trkid = mySimTrack.
trackId();
441 unsigned int id = lid.
rawId();
442 short unsigned int processType = 2;
444 entry,
exit, lmom.
mag(), tof + dtof, eloss, pid,
id, trkid, lmom.
theta(), lmom.
phi(), processType);
445 theCSCHits.push_back(
hit);
451 std::vector<const RPCRoll*>
roll =
chamber->rolls();
452 for (
unsigned int iroll = 0; iroll <
roll.size(); iroll++) {
456 std::cout <<
" Extrapolated to RPC (" <<
rid.ring() <<
"," <<
rid.station() <<
"," <<
rid.sector() <<
"," 457 <<
rid.subsector() <<
"," <<
rid.layer() <<
"," <<
rid.roll() <<
")" << std::endl;
465 std::pair<bool, double>
path = crossing.pathLength(det->
surface());
475 double pz = fabs(lmom.
z());
478 double dtof =
path.second * rbeta;
479 int trkid = mySimTrack.
trackId();
480 unsigned int id =
rid.rawId();
481 short unsigned int processType = 2;
483 entry,
exit, lmom.
mag(), tof + dtof, eloss, pid,
id, trkid, lmom.
theta(), lmom.
phi(), processType);
484 theRPCHits.push_back(
hit);
487 std::cout <<
"Extrapolated to unknown subdetector '" << gd->
subDetector() <<
"'..." << std::endl;
494 for (std::vector<PSimHit>::const_iterator
i = theCSCHits.begin();
i != theCSCHits.end();
i++) {
500 for (std::vector<PSimHit>::const_iterator
i = theDTHits.begin();
i != theDTHits.end();
i++) {
506 for (std::vector<PSimHit>::const_iterator
i = theRPCHits.begin();
i != theRPCHits.end();
i++) {
int station() const
Return the station number.
const MagneticField * magfield
const edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > particleDataTableESToken_
TrajectoryStateOnSurface getStateOnSurface(const Surface &surf, bool returnTangentPlane=false) const
const DTGeometry * dtGeom
const math::XYZVectorD & trackerSurfacePosition() const
std::unique_ptr< Propagator > propagatorWithoutMaterial
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Geom::Phi< T > phi() const
edm::ESHandle< MuonDetLayerGeometry > detLayerGeometry() const
get the detLayer geometry
ReturnType plane(const PositionType &pos, const RotationType &rot) const
Global3DPoint GlobalPoint
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::EDGetTokenT< std::vector< SimVertex > > simVertexToken
void applyMaterialEffects(TrajectoryStateOnSurface &tsosWithdEdx, TrajectoryStateOnSurface &tsos, double radPath, RandomEngineAndDistribution const *, HepPDT::ParticleDataTable const &)
Simulate material effects in iron (dE/dx, multiple scattering)
float charge() const
charge
const math::XYZTLorentzVectorD & momentum() const
const RPCGeometry * rpcGeom
int firstChannel() const
Returns the wire number of the first wire.
virtual float thickness() const =0
int type() const
particle type (HEP PDT convension)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
GlobalPoint globalPosition() const
const Propagator * propagatorWithMaterial
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
LocalVector localMomentum() const
Abs< T >::type abs(const T &t)
const CSCGeometry * cscGeom
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
DetId geographicalId() const
The label of this GeomDet.
const BasicVectorType & basicVector() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const Plane & surface() const
The nominal surface of the GeomDet.
int superlayer() const
Return the superlayer number (deprecated method name)
const RPCChamber * chamber(RPCDetId id) const
constexpr uint32_t rawId() const
get the raw id
double transverseCurvature() const
virtual SubDetector subDetector() const
Which subdetector.
GlobalVector globalMomentum() const
edm::EDGetTokenT< std::vector< SimTrack > > simMuonToken
MuonServiceProxy * theService
int layer() const
Return the layer number.
int wheel() const
Return the wheel number.
static int position[264][3]
int channel(const LocalPoint &p) const override
unsigned int trackId() const
TkRotation< float > RotationType
int lastChannel() const
Returns the wire number of the last wire.
const math::XYZTLorentzVectorD & trackerSurfaceMomentum() const
std::vector< PSimHit > PSimHitContainer
Vector3DBase unit() const
bool inside(const Local3DPoint &, const LocalError &, float scale=1.f) const override
std::unique_ptr< MaterialEffects > theMaterialEffects
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Global3DVector GlobalVector
Geom::Theta< T > theta() const
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Chi2MeasurementEstimator theEstimator
const Bounds & bounds() const