24 std::vector<spr::propagatedTrackID> vdets;
27 reco::TrackCollection::const_iterator trkItr;
28 for (trkItr = trkCollection->begin(),indx=0; trkItr != trkCollection->end(); ++trkItr,indx++) {
32 vdet.
ok = (pTrack->
quality(trackQuality_));
36 if (debug)
std::cout <<
"Propagate track " << indx <<
" p " << trkItr->p() <<
" eta " << trkItr->eta() <<
" phi " << trkItr->phi() <<
" Flag " << vdet.
ok << std::endl;
57 if (debug)
std::cout <<
"Track charge " <<
charge <<
" p " << momentum <<
" position " << vertex << std::endl;
59 std::pair<math::XYZPoint,bool>
info =
83 std::cout <<
"Track [" << indx <<
"] Flag: " << vdet.
ok <<
" ECAL ("
91 vdets.push_back(vdet);
95 std::cout <<
"propagateCALO:: for " << vdets.size() <<
" tracks" << std::endl;
96 for (
unsigned int i=0;
i<vdets.size(); ++
i) {
97 std::cout <<
"Track [" <<
i <<
"] Flag: " << vdets[
i].ok <<
" ECAL (" << vdets[
i].okECAL <<
") ";
111 std::vector<spr::propagatedTrackID> vdets;
124 reco::TrackCollection::const_iterator trkItr;
125 for (trkItr = trkCollection->begin(),indx=0; trkItr != trkCollection->end(); ++trkItr,indx++) {
129 vdet.
ok = (pTrack->
quality(trackQuality_));
133 if (debug)
std::cout <<
"Propagate track " << indx <<
" p " << trkItr->p() <<
" eta " << trkItr->eta() <<
" phi " << trkItr->phi() <<
" Flag " << vdet.
ok << std::endl;
136 vdet.
okECAL = info.second;
149 vdet.
okHCAL = info.second;
157 std::cout <<
"Track [" << indx <<
"] Flag: " << vdet.
ok <<
" ECAL ("
165 vdets.push_back(vdet);
169 std::cout <<
"propagateCALO:: for " << vdets.size() <<
" tracks" << std::endl;
170 for (
unsigned int i=0;
i<vdets.size(); ++
i) {
171 std::cout <<
"Track [" <<
i <<
"] Flag: " << vdets[
i].ok <<
" ECAL (" << vdets[
i].okECAL <<
") ";
190 reco::TrackCollection::const_iterator trkItr;
191 for (trkItr = trkCollection->begin(),indx=0; trkItr != trkCollection->end(); ++trkItr,indx++) {
195 trkD.
ok = (pTrack->
quality(trackQuality_));
199 if (debug)
std::cout <<
"Propagate track " << indx <<
" p " << trkItr->p() <<
" eta " << trkItr->eta() <<
" phi " << trkItr->phi() <<
" Flag " << trkD.
ok << std::endl;
222 trkDir.push_back(trkD);
226 std::cout <<
"propagateCALO:: for " << trkDir.size() <<
" tracks" << std::endl;
227 for (
unsigned int i=0;
i<trkDir.size(); ++
i) {
228 std::cout <<
"Track [" <<
i <<
"] Flag: " << trkDir[
i].ok <<
" ECAL (" << trkDir[
i].okECAL <<
")";
229 if (trkDir[
i].okECAL) {
230 std::cout <<
" point " << trkDir[
i].pointECAL <<
" direction "
231 << trkDir[
i].directionECAL <<
" ";
232 if (trkDir[
i].detIdECAL.subdetId() ==
EcalBarrel) {
238 std::cout <<
" HCAL (" << trkDir[
i].okHCAL <<
")";
239 if (trkDir[
i].okHCAL) {
240 std::cout <<
" point " << trkDir[
i].pointHCAL <<
" direction "
241 << trkDir[
i].directionHCAL <<
" "
260 if (debug)
std::cout <<
"Propagate track: p " << pTrack->
p() <<
" eta " << pTrack->
eta() <<
" phi " << pTrack->
phi() <<
" Flag " << vdet.
ok << std::endl;
263 vdet.
okECAL = info.second;
276 vdet.
okHCAL = info.second;
285 std::cout <<
"propagateCALO:: for 1 track" << std::endl;
303 std::vector<spr::propagatedGenTrackID> trkDir;
305 HepMC::GenEvent::particle_const_iterator
p;
306 for (p=genEvent->particles_begin(),indx=0; p != genEvent->particles_end(); ++
p,++indx) {
312 trkD.
pdgId = ((*p)->pdg_id());
313 trkD.
charge = ((pdt->particle(trkD.
pdgId))->
ID().threeCharge())/3;
315 if (debug)
std::cout <<
"Propagate track " << indx <<
" pdg " << trkD.
pdgId <<
" charge " << trkD.
charge <<
" p " << momentum << std::endl;
318 if ( (*p)->status()==1 &&
std::abs((*p)->momentum().eta()) < etaMax ) {
320 0.1*(*p)->production_vertex()->position().y(),
321 0.1*(*p)->production_vertex()->position().z());
346 trkDir.push_back(trkD);
350 std::cout <<
"propagateCALO:: for " << trkDir.size() <<
" tracks" << std::endl;
351 for (
unsigned int i=0;
i<trkDir.size(); ++
i) {
352 if (trkDir[
i].okECAL)
std::cout <<
"Track [" <<
i <<
"] Flag: " << trkDir[
i].ok <<
" ECAL (" << trkDir[
i].okECAL <<
")";
353 if (trkDir[
i].okECAL) {
354 std::cout <<
" point " << trkDir[
i].pointECAL <<
" direction "
355 << trkDir[
i].directionECAL <<
" ";
356 if (trkDir[
i].detIdECAL.subdetId() ==
EcalBarrel) {
362 if (trkDir[
i].okECAL)
std::cout <<
" HCAL (" << trkDir[
i].okHCAL <<
")";
363 if (trkDir[
i].okHCAL) {
364 std::cout <<
" point " << trkDir[
i].pointHCAL <<
" direction "
365 << trkDir[
i].directionHCAL <<
" "
380 std::vector<spr::propagatedGenParticleID> trkDir;
382 reco::GenParticleCollection::const_iterator
p;
383 for (p=genParticles->begin(),indx=0; p != genParticles->end(); ++
p,++indx) {
389 trkD.
pdgId = (p->pdgId());
390 trkD.
charge = p->charge();
392 if (debug)
std::cout <<
"Propagate track " << indx <<
" pdg " << trkD.
pdgId <<
" charge " << trkD.
charge <<
" p " << momentum << std::endl;
395 if ( p->status()==1 &&
std::abs(momentum.
eta()) < etaMax ) {
421 trkDir.push_back(trkD);
425 std::cout <<
"propagateCALO:: for " << trkDir.size() <<
" tracks" << std::endl;
426 for (
unsigned int i=0;
i<trkDir.size(); ++
i) {
427 if (trkDir[
i].okECAL)
std::cout <<
"Track [" <<
i <<
"] Flag: " << trkDir[
i].ok <<
" ECAL (" << trkDir[
i].okECAL <<
")";
428 if (trkDir[
i].okECAL) {
429 std::cout <<
" point " << trkDir[
i].pointECAL <<
" direction "
430 << trkDir[
i].directionECAL <<
" ";
431 if (trkDir[
i].detIdECAL.subdetId() ==
EcalBarrel) {
437 if (trkDir[
i].okECAL)
std::cout <<
" HCAL (" << trkDir[
i].okHCAL <<
")";
438 if (trkDir[
i].okHCAL) {
439 std::cout <<
" point " << trkDir[
i].pointHCAL <<
" direction "
440 << trkDir[
i].directionHCAL <<
" "
461 if (debug)
std::cout <<
"Propagate track " << thisTrk <<
" charge " << trk.
charge <<
" position " << trk.
position <<
" p " << trk.
momentum <<
" Flag " << trkD.
ok << std::endl;
489 std::cout <<
"propagateCALO:: for track [" << thisTrk <<
"] Flag: " << trkD.
ok <<
" ECAL (" << trkD.
okECAL <<
") HCAL (" << trkD.
okHCAL <<
")" << std::endl;
535 return std::pair<math::XYZPoint,bool>(track.
point,track.
ok);
562 return std::pair<math::XYZPoint,bool>(track.
point,track.
ok);
570 return std::pair<math::XYZPoint,bool>(track1.point,track1.ok);
580 if (debug)
std::cout <<
"propagateTrackerEnd:: Vertex " << vertex <<
" Momentum " << momentum <<
" Charge " <<
charge <<
" Radius " << radius <<
" Z " << zdist << std::endl;
606 math::XYZPoint vDiff(point.x()-vertex.x(), point.y()-vertex.y(), point.z()-vertex.z());
607 double dphi = direction.
phi()-momentum.
phi();
608 double rdist =
std::sqrt(vDiff.x()*vDiff.x()+vDiff.y()*vDiff.y());
609 double rat = 0.5*dphi/
std::sin(0.5*dphi);
610 double dZ = vDiff.z();
611 double dS = rdist*rat;
614 std::cout <<
"propagateTracker:: Barrel " << tsosb.
isValid() <<
" Endcap " << tsose.
isValid() <<
" OverAll " << ok <<
" Point " << point <<
" RDist " << rdist <<
" dS " << dS <<
" dS/pt " << rdist*rat/momentum.perp() <<
" zdist " << dZ <<
" dz/pz " << dZ/momentum.z() <<
" Length " << length << std::endl;
617 return std::pair<math::XYZPoint,double>(
point,length);
623 if (debug)
std::cout <<
"propagateCalo:: Vertex " << tpVertex <<
" Momentum " << tpMomentum <<
" Charge " << tpCharge <<
" Radius " << radius <<
" Z " << zdist <<
" Corner " << corner << std::endl;
634 if (tpMomentum.
eta() < 0) {
645 if (absEta < corner) {
659 track.
point.SetXYZ(-999., -999., -999.);
664 std::cout <<
"propagateCalo:: Barrel " << tsosb.
isValid() <<
" Endcap " << tsose.
isValid() <<
" OverAll " << track.
ok <<
" Point " << track.
point <<
" Direction " << track.
direction << std::endl;
668 double rdist =
std::sqrt(vDiff.x()*vDiff.x()+vDiff.y()*vDiff.y());
669 double pt = tpMomentum.
perp();
670 double rat = 0.5*dphi/
std::sin(0.5*dphi);
671 std::cout <<
"RDist " << rdist <<
" pt " << pt <<
" r/pt " << rdist*rat/pt <<
" zdist " << vDiff.z() <<
" pz " << tpMomentum.
z() <<
" z/pz " << vDiff.z()/tpMomentum.
z() << std::endl;
681 edm::SimTrackContainer::const_iterator itr = SimTk->end();
682 for (edm::SimTrackContainer::const_iterator simTrkItr = SimTk->begin(); simTrkItr!= SimTk->end(); simTrkItr++) {
683 if ( simTrkItr->trackId() == thisTrk ) {
684 if (debug)
std::cout <<
"matched trackId (maximum occurance) " << thisTrk <<
" type " << simTrkItr->type() << std::endl;
690 if (itr != SimTk->end()) {
691 int vertIndex = itr->vertIndex();
692 if (vertIndex != -1 && vertIndex < (
int)SimVtx->size()) {
693 edm::SimVertexContainer::const_iterator simVtxItr= SimVtx->begin();
694 for (
int iv=0; iv<vertIndex; iv++) simVtxItr++;
698 trk.
charge = (int)(itr->charge());
const double Z[kNumberCalorimeter]
virtual DetId getClosestCell(const GlobalPoint &r) const
double p() const
momentum vector magnitude
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual DetId getClosestCell(const GlobalPoint &r) const
reco::GenParticleCollection::const_iterator trkItr
TrackQuality
track quality
std::pair< math::XYZPoint, bool > propagateHCAL(const reco::Track *, const MagneticField *, bool debug=false)
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
double phi() const
azimuthal angle of momentum vector
spr::trackAtOrigin simTrackAtOrigin(unsigned int thisTrk, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, bool debug=false)
GlobalVector directionECAL
spr::propagatedTrack propagateCalo(const GlobalPoint &vertex, const GlobalVector &momentum, int charge, const MagneticField *, float zdist, float radius, float corner, bool debug=false)
double px() const
x coordinate of momentum vector
const math::XYZPoint & outerPosition() const
position of the outermost hit
HepMC::GenEvent::particle_const_iterator trkItr
const math::XYZPoint & innerPosition() const
position of the innermost hit
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
reco::TrackCollection::const_iterator trkItr
double eta() const
pseudorapidity of momentum vector
Abs< T >::type abs(const T &t)
GlobalVector directionECAL
std::pair< math::XYZPoint, bool > propagateTracker(const reco::Track *, const MagneticField *, bool debug=false)
std::pair< math::XYZPoint, bool > propagateECAL(const reco::Track *, const MagneticField *, bool debug=false)
spr::propagatedTrack propagateTrackToECAL(const reco::Track *, const MagneticField *, bool debug=false)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
double pz() const
z coordinate of momentum vector
virtual DetId getClosestCell(const GlobalPoint &r) const
double vz() const
z coordinate of the reference point on track
static TrackQuality qualityByName(const std::string &name)
GlobalVector directionHCAL
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
GlobalVector directionHCAL
XYZPointD XYZPoint
point in space with cartesian internal representation
GlobalVector directionHCAL
bool quality(const TrackQuality) const
Track quality.
double vy() const
y coordinate of the reference point on track
GlobalVector directionECAL
std::pair< math::XYZPoint, double > propagateTrackerEnd(const reco::Track *, const MagneticField *, bool debug=false)
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
std::vector< spr::propagatedTrackID > propagateCosmicCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
reco::TrackCollection::const_iterator trkItr
int charge() const
track electric charge
spr::propagatedTrack propagateTrackToHCAL(const reco::Track *, const MagneticField *, bool debug=false)
*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
double py() const
y coordinate of momentum vector
double vx() const
x coordinate of the reference point on track
Global3DVector GlobalVector
GlobalVector globalDirection() const