26 std::vector<spr::propagatedTrackID> vdets;
29 reco::TrackCollection::const_iterator trkItr;
30 for (trkItr = trkCollection->begin(),indx=0; trkItr != trkCollection->end(); ++trkItr,indx++) {
34 vdet.
ok = (pTrack->
quality(trackQuality_));
39 if (debug)
std::cout <<
"Propagate track " << indx <<
" p " << trkItr->p() <<
" eta " << trkItr->eta() <<
" phi " << trkItr->phi() <<
" Flag " << vdet.
ok << std::endl;
61 if (debug)
std::cout <<
"Track charge " <<
charge <<
" p " << momentum <<
" position " << vertex << std::endl;
63 std::pair<math::XYZPoint,bool>
info =
66 if (debug)
std::cout <<
"Propagate to ECAL " << info.second <<
" at (" << info.first.x() <<
", "<< info.first.y() <<
", " << info.first.z() <<
")\n";
96 if (debug)
std::cout <<
"Propagate to HCAL " << info.second <<
" at (" << info.first.x() <<
", "<< info.first.y() <<
", " << info.first.z() <<
")\n";
107 std::cout <<
"Track [" << indx <<
"] Flag: " << vdet.
ok <<
" ECAL (" 116 vdets.push_back(vdet);
121 std::cout <<
"propagateCALO:: for " << vdets.size() <<
" tracks" << std::endl;
122 for (
unsigned int i=0;
i<vdets.size(); ++
i) {
123 std::cout <<
"Track [" <<
i <<
"] Flag: " << vdets[
i].ok <<
" ECAL (" << vdets[
i].okECAL <<
") ";
138 std::vector<spr::propagatedTrackID> vdets;
151 reco::TrackCollection::const_iterator trkItr;
152 for (trkItr = trkCollection->begin(),indx=0; trkItr != trkCollection->end(); ++trkItr,indx++) {
156 vdet.
ok = (pTrack->
quality(trackQuality_));
161 if (debug)
std::cout <<
"Propagate track " << indx <<
" p " << trkItr->p() <<
" eta " << trkItr->eta() <<
" phi " << trkItr->phi() <<
" Flag " << vdet.
ok << std::endl;
164 vdet.
okECAL = info.second;
180 vdet.
okHCAL = info.second;
189 std::cout <<
"Track [" << indx <<
"] Flag: " << vdet.
ok <<
" ECAL (" 198 vdets.push_back(vdet);
202 std::cout <<
"propagateCALO:: for " << vdets.size() <<
" tracks" << std::endl;
203 for (
unsigned int i=0;
i<vdets.size(); ++
i) {
204 std::cout <<
"Track [" <<
i <<
"] Flag: " << vdets[
i].ok <<
" ECAL (" << vdets[
i].okECAL <<
") ";
224 reco::TrackCollection::const_iterator trkItr;
225 for (trkItr = trkCollection->begin(),indx=0; trkItr != trkCollection->end(); ++trkItr,indx++) {
229 trkD.
ok = (pTrack->
quality(trackQuality_));
234 if (debug)
std::cout <<
"Propagate track " << indx <<
" p " << trkItr->p() <<
" eta " << trkItr->eta() <<
" phi " << trkItr->phi() <<
" Flag " << trkD.
ok << std::endl;
260 trkDir.push_back(trkD);
264 std::cout <<
"propagateCALO:: for " << trkDir.size() <<
" tracks" << std::endl;
265 for (
unsigned int i=0;
i<trkDir.size(); ++
i) {
266 std::cout <<
"Track [" <<
i <<
"] Flag: " << trkDir[
i].ok <<
" ECAL (" << trkDir[
i].okECAL <<
")";
267 if (trkDir[
i].okECAL) {
268 std::cout <<
" point " << trkDir[
i].pointECAL <<
" direction " 269 << trkDir[
i].directionECAL <<
" ";
270 if (trkDir[
i].detIdECAL.subdetId() ==
EcalBarrel) {
276 std::cout <<
" HCAL (" << trkDir[
i].okHCAL <<
")";
277 if (trkDir[
i].okHCAL) {
278 std::cout <<
" point " << trkDir[
i].pointHCAL <<
" direction " 279 << trkDir[
i].directionHCAL <<
" " 300 if (debug)
std::cout <<
"Propagate track: p " << pTrack->
p() <<
" eta " << pTrack->
eta() <<
" phi " << pTrack->
phi() <<
" Flag " << vdet.
ok << std::endl;
303 vdet.
okECAL = info.second;
319 vdet.
okHCAL = info.second;
328 std::cout <<
"propagateCALO:: for 1 track" << std::endl;
347 std::vector<spr::propagatedGenTrackID> trkDir;
349 HepMC::GenEvent::particle_const_iterator
p;
350 for (p=genEvent->particles_begin(),indx=0; p != genEvent->particles_end(); ++
p,++indx) {
356 trkD.
pdgId = ((*p)->pdg_id());
357 trkD.
charge = ((pdt->particle(trkD.
pdgId))->
ID().threeCharge())/3;
360 if (debug)
std::cout <<
"Propagate track " << indx <<
" pdg " << trkD.
pdgId <<
" charge " << trkD.
charge <<
" p " << momentum << std::endl;
363 if ( (*p)->status()==1 &&
std::abs((*p)->momentum().eta()) < etaMax ) {
365 0.1*(*p)->production_vertex()->position().y(),
366 0.1*(*p)->production_vertex()->position().z());
394 trkDir.push_back(trkD);
398 std::cout <<
"propagateCALO:: for " << trkDir.size() <<
" tracks" << std::endl;
399 for (
unsigned int i=0;
i<trkDir.size(); ++
i) {
400 if (trkDir[
i].okECAL)
std::cout <<
"Track [" <<
i <<
"] Flag: " << trkDir[
i].ok <<
" ECAL (" << trkDir[
i].okECAL <<
")";
401 if (trkDir[
i].okECAL) {
402 std::cout <<
" point " << trkDir[
i].pointECAL <<
" direction " 403 << trkDir[
i].directionECAL <<
" ";
404 if (trkDir[
i].detIdECAL.subdetId() ==
EcalBarrel) {
410 if (trkDir[
i].okECAL)
std::cout <<
" HCAL (" << trkDir[
i].okHCAL <<
")";
411 if (trkDir[
i].okHCAL) {
412 std::cout <<
" point " << trkDir[
i].pointHCAL <<
" direction " 413 << trkDir[
i].directionHCAL <<
" " 429 std::vector<spr::propagatedGenParticleID> trkDir;
431 reco::GenParticleCollection::const_iterator
p;
432 for (p=genParticles->begin(),indx=0; p != genParticles->end(); ++
p,++indx) {
438 trkD.
pdgId = (p->pdgId());
439 trkD.
charge = p->charge();
442 if (debug)
std::cout <<
"Propagate track " << indx <<
" pdg " << trkD.
pdgId <<
" charge " << trkD.
charge <<
" p " << momentum << std::endl;
445 if ( p->status()==1 &&
std::abs(momentum.
eta()) < etaMax ) {
474 trkDir.push_back(trkD);
478 std::cout <<
"propagateCALO:: for " << trkDir.size() <<
" tracks" << std::endl;
479 for (
unsigned int i=0;
i<trkDir.size(); ++
i) {
480 if (trkDir[
i].okECAL)
std::cout <<
"Track [" <<
i <<
"] Flag: " << trkDir[
i].ok <<
" ECAL (" << trkDir[
i].okECAL <<
")";
481 if (trkDir[
i].okECAL) {
482 std::cout <<
" point " << trkDir[
i].pointECAL <<
" direction " 483 << trkDir[
i].directionECAL <<
" ";
484 if (trkDir[
i].detIdECAL.subdetId() ==
EcalBarrel) {
490 if (trkDir[
i].okECAL)
std::cout <<
" HCAL (" << trkDir[
i].okHCAL <<
")";
491 if (trkDir[
i].okHCAL) {
492 std::cout <<
" point " << trkDir[
i].pointHCAL <<
" direction " 493 << trkDir[
i].directionHCAL <<
" " 516 if (debug)
std::cout <<
"Propagate track " << thisTrk <<
" charge " << trk.
charge <<
" position " << trk.
position <<
" p " << trk.
momentum <<
" Flag " << trkD.
ok << std::endl;
547 std::cout <<
"propagateCALO:: for track [" << thisTrk <<
"] Flag: " << trkD.
ok <<
" ECAL (" << trkD.
okECAL <<
") HCAL (" << trkD.
okHCAL <<
")" << std::endl;
578 if (debug)
std::cout <<
"Propagate track " << thisTrk <<
" charge " << trk.
charge <<
" position " << trk.
position <<
" p " << trk.
momentum <<
" Flag " << trkD.
ok << std::endl;
592 std::cout <<
"propagateCALO:: for track [" << thisTrk <<
"] Flag: " << trkD.
ok <<
" ECAL (" << trkD.
okECAL <<
") HCAL (" << trkD.
okHCAL <<
")" << std::endl;
613 return std::pair<bool,HcalDetId>(
false,
HcalDetId());
646 std::pair<math::XYZPoint,bool>
info =
propagateECAL(vertex,momentum,0,bField,debug);
661 return std::pair<DetId,bool>(eId,info.second);
666 return std::pair<math::XYZPoint,bool>(track.
point,track.
ok);
693 return std::pair<math::XYZPoint,bool>(track.
point,track.
ok);
701 return std::pair<math::XYZPoint,bool>(track1.point,track1.ok);
717 if (
debug)
std::cout <<
"propagateTrackerEnd:: Vertex " << vertex <<
" Momentum " << momentum <<
" Charge " <<
charge <<
" Radius " << radius <<
" Z " << zdist << std::endl;
743 math::XYZPoint vDiff(point.x()-vertex.x(), point.y()-vertex.y(), point.z()-vertex.z());
744 double dphi = direction.
phi()-momentum.
phi();
745 double rdist =
std::sqrt(vDiff.x()*vDiff.x()+vDiff.y()*vDiff.y());
746 double rat = 0.5*dphi/
std::sin(0.5*dphi);
747 double dZ = vDiff.z();
748 double dS = rdist*rat;
752 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;
756 return std::pair<math::XYZPoint,double>(
point,length);
770 if (
debug)
std::cout <<
"propagateCalo:: Vertex " << tpVertex <<
" Momentum " << tpMomentum <<
" Charge " << tpCharge <<
" Radius " << radius <<
" Z " << zdist <<
" Corner " << corner << std::endl;
782 if (tpMomentum.
eta() < 0) {
793 if (absEta < corner) {
807 track.
point.SetXYZ(-999., -999., -999.);
813 std::cout <<
"propagateCalo:: Barrel " << tsosb.
isValid() <<
" Endcap " << tsose.
isValid() <<
" OverAll " << track.
ok <<
" Point " << track.
point <<
" Direction " << track.
direction << std::endl;
817 double rdist =
std::sqrt(vDiff.x()*vDiff.x()+vDiff.y()*vDiff.y());
818 double pt = tpMomentum.
perp();
819 double rat = 0.5*dphi/
std::sin(0.5*dphi);
820 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;
837 edm::SimTrackContainer::const_iterator itr = SimTk->end();
838 for (edm::SimTrackContainer::const_iterator simTrkItr = SimTk->begin(); simTrkItr!= SimTk->end(); simTrkItr++) {
839 if ( simTrkItr->trackId() == thisTrk ) {
841 if (
debug)
std::cout <<
"matched trackId (maximum occurance) " << thisTrk <<
" type " << simTrkItr->type() << std::endl;
848 if (itr != SimTk->end()) {
849 int vertIndex = itr->vertIndex();
850 if (vertIndex != -1 && vertIndex < (
int)SimVtx->size()) {
851 edm::SimVertexContainer::const_iterator simVtxItr= SimVtx->begin();
852 for (
int iv=0; iv<vertIndex; iv++) simVtxItr++;
872 if (debug)
std::cout <<
"Propagate track with charge " <<
charge <<
" position " << vertex <<
" p " << momentum << std::endl;
874 std::pair<HcalDetId,HcalDetId>
ids =
propagateHCAL(geo, bField, vertex, momentum,
charge, typeRZ, rz, debug);
876 (ids.first.ieta() == ids.second.ieta()) &&
877 (ids.first.iphi() == ids.second.iphi()));
885 if (debug)
std::cout <<
"Propagate track " << thisTrk <<
" charge " << trk.
charge <<
" position " << trk.
position <<
" p " << trk.
momentum << std::endl;
889 (ids.first.ieta() == ids.second.ieta()) &&
890 (ids.first.iphi() == ids.second.iphi()));
899 const std::pair<double,double> rz,
bool 906 if (
debug)
std::cout <<
"propagateCalo:: Vertex " << vertex <<
" Momentum " << momentum <<
" Charge " << charge <<
" R/Z " << rz.first <<
" : " << rz.second <<
" Type " << typeRZ << std::endl;
913 for (
int k=0;
k<2; ++
k) {
915 double rzv = (
k == 0) ? rz.first : rz.second;
930 std::cout <<
"Iteration " <<
k <<
" Point " << point <<
" ID ";
939 if (
debug)
std::cout <<
"propagateCalo:: Front " << id1 <<
" Back " << id2 << std::endl;
941 return std::pair<HcalDetId,HcalDetId>(
id1,
id2);
double p() const
momentum vector magnitude
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
static const double etaBEEcal
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.
static const double zBackTE
static const double etaBEHcal
std::pair< DetId, bool > propagateIdECAL(const HcalDetId &id, const CaloGeometry *geo, const MagneticField *, bool debug=false)
reco::GenParticleCollection::const_iterator trkItr
TrackQuality
track quality
std::pair< math::XYZPoint, bool > propagateHCAL(const reco::Track *, const MagneticField *, bool debug=false)
static const double zFrontHE
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)
static const double zBackHE
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
static const double rFrontHB
HepMC::GenEvent::particle_const_iterator trkItr
const math::XYZPoint & innerPosition() const
position of the innermost hit
static const double rBackHB
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
reco::TrackCollection::const_iterator trkItr
static const double zFrontEE
double eta() const
pseudorapidity of momentum vector
static const double rBackTB
spr::propagatedTrackDirection propagateHCALBack(unsigned int thisTrk, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const CaloGeometry *geo, const MagneticField *bField, bool debug=false)
static PlanePointer build(Args &&...args)
static const double rFrontEB
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) ...
GlobalPoint getPosition(const DetId &id) const
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
static const double zFrontTE
XYZPointD XYZPoint
point in space with cartesian internal representation
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
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)
static const double etaBETrak
*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