CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FSimTrack.cc
Go to the documentation of this file.
2 
3 //C++ Headers
4 #include <iomanip>
5 #include <string>
6 
7 //using namespace HepPDT;
8 
10  SimTrack(), mom_(0), id_(-1), endv_(-1),
11  layer1(0), layer2(0), ecal(0), hcal(0), vfcal(0),
12  prop(false), closestDaughterId_(-1), info_(0),
13  properDecayTime(1E99) {;}
14 
16  int iv, int ig, int id,
17  FBaseSimEvent* mom,
18  double dt) :
19  // SimTrack(p->pid(),*p,iv,ig), // to uncomment once Mathcore is installed
20  SimTrack(p->pid(),p->momentum(),iv,ig),
21  mom_(mom), id_(id), endv_(-1),
22  layer1(0), layer2(0), ecal(0), hcal(0), vfcal(0), prop(false),
23  closestDaughterId_(-1), momentum_(p->momentum()),
24  properDecayTime(dt)
25 {
26  setTrackId(id);
27  info_ = mom_->theTable()->particle(HepPDT::ParticleID(type()));
28 }
29 
31 
32 bool
34  // If there is no end vertex, nothing to compare to
35  if ( noEndVertex() ) return true;
36  // If the particle immediately decays, no need to propagate
37  if ( (endVertex().position()-vertex().position()).Vect().Mag2() < 1e-4 )
38  return false;
39  // If the end vertex has a larger radius, not yet there
40  if ( endVertex().position().Perp2() > pos.Perp2()+1e-10 ) return true;
41  // If the end vertex has a larger z, not yet there
42  if ( fabs(endVertex().position().Z()) > fabs(pos.Z())+1e-5 ) return true;
43  // Otherwise, the end vertex is overtaken already
44  return false;
45 }
46 
48 void
50  prop=true;
51 }
52 
54 void
57  layer1=success;
58 }
59 
61 void
64  layer2=success;
65 }
66 
68 void
71  ecal=success;
72 }
73 
75 void
78  hcal=success;
79 }
80 
82 void
85  vfcal=success;
86 }
87 
88 std::ostream& operator <<(std::ostream& o , const FSimTrack& t) {
89 
90  std::string name = t.particleInfo() ? t.particleInfo()->name() : "Unknown";
91  XYZTLorentzVector momentum1 = t.momentum();
92  XYZVector vertex1 = t.vertex().position().Vect();
93  int vertexId1 = t.vertex().id();
94 
95  o.setf(std::ios::fixed, std::ios::floatfield);
96  o.setf(std::ios::right, std::ios::adjustfield);
97 
98  o << std::setw(4) << t.id() << " "
99  << std::setw(4) << t.genpartIndex() << " "
100  << name;
101 
102  for(unsigned int k=0;k<11-name.length() && k<12; k++) o << " ";
103 
104  o << std::setw(6) << std::setprecision(2) << momentum1.eta() << " "
105  << std::setw(6) << std::setprecision(2) << momentum1.phi() << " "
106  << std::setw(6) << std::setprecision(2) << momentum1.pt() << " "
107  << std::setw(6) << std::setprecision(2) << momentum1.e() << " "
108  << std::setw(4) << vertexId1 << " "
109  << std::setw(6) << std::setprecision(1) << vertex1.x() << " "
110  << std::setw(6) << std::setprecision(1) << vertex1.y() << " "
111  << std::setw(6) << std::setprecision(1) << vertex1.z() << " "
112  << std::setw(4) << t.mother().id() << " ";
113 
114  if ( !t.noEndVertex() ) {
115  XYZTLorentzVector vertex2 = t.endVertex().position();
116  int vertexId2 = t.endVertex().id();
117 
118  o << std::setw(4) << vertexId2 << " "
119  << std::setw(6) << std::setprecision(2) << vertex2.eta() << " "
120  << std::setw(6) << std::setprecision(2) << vertex2.phi() << " "
121  << std::setw(5) << std::setprecision(1) << vertex2.pt() << " "
122  << std::setw(6) << std::setprecision(1) << vertex2.z() << " ";
123  for (int i=0; i<t.nDaughters(); ++i)
124  o << std::setw(4) << t.daughter(i).id() << " ";
125 
126  } else {
127 
128  if ( t.onLayer1() ) {
129 
130  XYZTLorentzVector vertex2 = t.layer1Entrance().vertex();
131 
132  o << std::setw(4) << -t.onLayer1() << " "
133  << std::setw(6) << std::setprecision(2) << vertex2.eta() << " "
134  << std::setw(6) << std::setprecision(2) << vertex2.phi() << " "
135  << std::setw(5) << std::setprecision(1) << vertex2.pt() << " "
136  << std::setw(6) << std::setprecision(1) << vertex2.z() << " "
137  << std::setw(6) << std::setprecision(2) << t.layer1Entrance().pt() << " "
138  << std::setw(6) << std::setprecision(2) << t.layer1Entrance().e() << " ";
139 
140  } else if ( t.onEcal() ) {
141 
142  XYZTLorentzVector vertex2 = t.ecalEntrance().vertex();
143 
144  o << std::setw(4) << -t.onEcal() << " "
145  << std::setw(6) << std::setprecision(2) << vertex2.eta() << " "
146  << std::setw(6) << std::setprecision(2) << vertex2.phi() << " "
147  << std::setw(5) << std::setprecision(1) << vertex2.pt() << " "
148  << std::setw(6) << std::setprecision(1) << vertex2.z() << " "
149  << std::setw(6) << std::setprecision(2) << t.ecalEntrance().pt() << " "
150  << std::setw(6) << std::setprecision(2) << t.ecalEntrance().e() << " ";
151  }
152  }
153  return o;
154 }
const double Z[kNumberCalorimeter]
int id() const
the index in FBaseSimEvent
Definition: FSimVertex.h:44
float dt
Definition: AMPTWrapper.h:126
int i
Definition: DBlmapReader.cc:9
bool noEndVertex() const
no end vertex
const HepPDT::ParticleData * particleInfo() const
particle info...
Definition: FSimTrack.h:42
int layer2
Definition: FSimTrack.h:190
const FSimVertex & endVertex() const
end vertex
int ecal
Definition: FSimTrack.h:191
tuple pp
Definition: createTree.py:15
RawParticle Layer1_Entrance
Definition: FSimTrack.h:197
const HepPDT::ParticleData * info_
Definition: FSimTrack.h:206
RawParticle VFCAL_Entrance
Definition: FSimTrack.h:201
const XYZTLorentzVector & momentum() const
Temporary (until move of SimTrack to Mathcore) - No! Actually very useful.
Definition: FSimTrack.h:168
virtual ~FSimTrack()
Destructor.
Definition: FSimTrack.cc:30
const HepPDT::ParticleDataTable * theTable() const
Get the pointer to the particle data table.
Definition: FBaseSimEvent.h:64
const RawParticle & layer1Entrance() const
The particle at Preshower Layer 1.
Definition: FSimTrack.h:117
const FSimTrack & daughter(int i) const
Ith daughter.
void setEcal(const RawParticle &pp, int success)
Set the ecal variables.
Definition: FSimTrack.cc:69
void setPropagate()
The particle has been propgated through the tracker.
Definition: FSimTrack.cc:49
int nDaughters() const
Number of daughters.
void setLayer2(const RawParticle &pp, int success)
Set the preshower layer2 variables.
Definition: FSimTrack.cc:62
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
bool notYetToEndVertex(const XYZTLorentzVector &pos) const
Compare the end vertex position with another position.
Definition: FSimTrack.cc:33
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
int onEcal() const
Definition: FSimTrack.h:101
void setLayer1(const RawParticle &pp, int success)
Set the preshower layer1 variables.
Definition: FSimTrack.cc:55
math::XYZVector XYZVector
const math::XYZTLorentzVector & position() const
Temporary (until CMSSW moves to Mathcore) - No ! Actually very useful.
Definition: FSimVertex.h:49
int genpartIndex() const
index of the corresponding Generator particle in the Event container (-1 if no Genpart) ...
Definition: SimTrack.h:33
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
Definition: FSimTrack.h:123
const FSimVertex & vertex() const
Origin vertex.
int vfcal
Definition: FSimTrack.h:193
FSimTrack()
Default constructor.
Definition: FSimTrack.cc:9
int layer1
Definition: FSimTrack.h:189
int k[5][pyjets_maxn]
FBaseSimEvent * mom_
Definition: FSimTrack.h:183
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:284
RawParticle HCAL_Entrance
Definition: FSimTrack.h:200
void setTrackId(unsigned int t)
Definition: CoreSimTrack.h:48
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:40
int id() const
the index in FBaseSimEvent and other vectors
Definition: FSimTrack.h:86
int hcal
Definition: FSimTrack.h:192
int onLayer1() const
Definition: FSimTrack.h:91
void setVFcal(const RawParticle &pp, int success)
Set the hcal variables.
Definition: FSimTrack.cc:83
RawParticle Layer2_Entrance
Definition: FSimTrack.h:198
void setHcal(const RawParticle &pp, int success)
Set the hcal variables.
Definition: FSimTrack.cc:76
bool prop
Definition: FSimTrack.h:195
RawParticle ECAL_Entrance
Definition: FSimTrack.h:199
const FSimTrack & mother() const
mother
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15