CMS 3D CMS Logo

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(),
11  mom_(nullptr),
12  id_(-1),
13  charge_(-999),
14  endv_(-1),
15  layer1(0),
16  layer2(0),
17  ecal(0),
18  hcal(0),
19  vfcal(0),
20  hcalexit(0),
21  hoentr(0),
22  prop(false),
23  closestDaughterId_(-1),
24  info_(nullptr),
25  properDecayTime(1E99) {
26  ;
27 }
28 
29 FSimTrack::FSimTrack(const RawParticle* p, int iv, int ig, int id, FBaseSimEvent* mom, double dt)
30  : // SimTrack(p->pid(),*p,iv,ig), // to uncomment once Mathcore is installed
31  SimTrack(p->pid(), p->momentum(), iv, ig),
32  mom_(mom),
33  id_(id),
34  charge_(-999),
35  endv_(-1),
36  layer1(0),
37  layer2(0),
38  ecal(0),
39  hcal(0),
40  vfcal(0),
41  hcalexit(0),
42  hoentr(0),
43  prop(false),
44  closestDaughterId_(-1),
45  momentum_(p->momentum()),
46  properDecayTime(dt) {
47  setTrackId(id);
48  info_ = mom_->theTable()->particle(HepPDT::ParticleID(type()));
49 }
50 
54  int iv,
55  int ig,
56  int id,
57  double charge,
58  const math::XYZTLorentzVector& tkp,
59  const math::XYZTLorentzVector& tkm,
60  const SimVertex& tkv)
61  : SimTrack(ipart, p, iv, ig, math::XYZVectorD(tkp.X(), tkp.Y(), tkp.Z()), tkm),
62  vertex_(tkv),
63  mom_(nullptr),
64  id_(id),
65  charge_(charge),
66  endv_(-1),
67  layer1(0),
68  layer2(0),
69  ecal(0),
70  hcal(0),
71  vfcal(0),
72  hcalexit(0),
73  hoentr(0),
74  prop(false),
75  closestDaughterId_(-1),
76  info_(nullptr),
77  momentum_(p),
78  properDecayTime(-1),
79  isGlobal_(false) {
80  setTrackId(id);
81 }
82 
84 
86  // If there is no end vertex, nothing to compare to
87  if (noEndVertex())
88  return true;
89  // If the particle immediately decays, no need to propagate
90  if ((endVertex().position() - vertex().position()).Vect().Mag2() < 1e-4)
91  return false;
92  // If the end vertex has a larger radius, not yet there
93  if (endVertex().position().Perp2() > pos.Perp2() + 1e-10)
94  return true;
95  // If the end vertex has a larger z, not yet there
96  if (fabs(endVertex().position().Z()) > fabs(pos.Z()) + 1e-5)
97  return true;
98  // Otherwise, the end vertex is overtaken already
99  return false;
100 }
101 
103 void FSimTrack::setPropagate() { prop = true; }
104 
108  layer1 = success;
109 }
110 
114  layer2 = success;
115 }
116 
119  ECAL_Entrance = pp;
120  ecal = success;
121 }
122 
125  HCAL_Entrance = pp;
126  hcal = success;
127 }
128 
131  VFCAL_Entrance = pp;
132  vfcal = success;
133 }
134 
137  HCAL_Exit = pp;
138  hcalexit = success;
139 }
140 
142  HO_Entrance = pp;
143  hoentr = success;
144 }
145 
146 std::ostream& operator<<(std::ostream& o, const FSimTrack& t) {
147  std::string name = t.particleInfo() ? t.particleInfo()->name() : "Unknown";
148  const XYZTLorentzVector& momentum1 = t.momentum();
149  XYZVector vertex1 = t.vertex().position().Vect();
150  int vertexId1 = t.vertex().id();
151 
152  o.setf(std::ios::fixed, std::ios::floatfield);
153  o.setf(std::ios::right, std::ios::adjustfield);
154 
155  o << std::setw(4) << t.id() << "; " << std::setw(4) << t.genpartIndex() << "; " << name << "\n\t\t";
156 
157  //for(unsigned int k=0;k<11-name.length() && k<12; k++) o << "; ";
158 
159  o << "Position: " << std::setw(6) << std::setprecision(2) << momentum1.eta() << "; " << std::setw(6)
160  << std::setprecision(2) << momentum1.phi() << "; " << std::setw(6) << std::setprecision(2) << momentum1.pt() << "; "
161  << std::setw(6) << std::setprecision(2) << momentum1.e() << "; " << std::setw(4) << vertexId1 << "; "
162  << std::setw(6) << std::setprecision(1) << vertex1.x() << "; " << std::setw(6) << std::setprecision(1)
163  << vertex1.y() << "; " << std::setw(6) << std::setprecision(1) << vertex1.z() << "; " << std::setw(4)
164  << (t.particleInfo() ? (t.noMother() ? -1 : t.mother().id()) : -1) << "; "
165  << "\n\t\t";
166 
167  if (!t.noEndVertex()) {
168  XYZTLorentzVector vertex2 = t.endVertex().position();
169  int vertexId2 = t.endVertex().id();
170 
171  o << "Decayed particle: " << std::setw(4) << vertexId2 << "; " << std::setw(6) << std::setprecision(2)
172  << vertex2.eta() << "; " << std::setw(6) << std::setprecision(2) << vertex2.phi() << "; " << std::setw(5)
173  << std::setprecision(1) << vertex2.pt() << "; " << std::setw(6) << std::setprecision(1) << vertex2.z() << "; ";
174  for (int i = 0; i < t.nDaughters(); ++i)
175  o << std::setw(4) << t.daughter(i).id() << "; "
176  << "\n\t\t";
177 
178  } else {
179  if (t.onLayer1()) {
180  XYZTLorentzVector vertex2 = t.layer1Entrance().vertex();
181 
182  o << "Layer 1: " << std::setw(4) << -t.onLayer1() << "; " << std::setw(6) << std::setprecision(2) << vertex2.eta()
183  << "; " << std::setw(6) << std::setprecision(2) << vertex2.phi() << "; " << std::setw(5) << std::setprecision(1)
184  << vertex2.pt() << "; " << std::setw(6) << std::setprecision(1) << vertex2.z() << "; " << std::setw(6)
185  << std::setprecision(2) << t.layer1Entrance().pt() << "; " << std::setw(6) << std::setprecision(2)
186  << t.layer1Entrance().e() << "; "
187  << "\n\t\t";
188  }
189  if (t.onLayer2()) {
190  XYZTLorentzVector vertex2 = t.layer2Entrance().vertex();
191 
192  o << "Layer 2: " << std::setw(4) << -t.onLayer2() << "; " << std::setw(6) << std::setprecision(2) << vertex2.eta()
193  << "; " << std::setw(6) << std::setprecision(2) << vertex2.phi() << "; " << std::setw(5) << std::setprecision(1)
194  << vertex2.pt() << "; " << std::setw(6) << std::setprecision(1) << vertex2.z() << "; " << std::setw(6)
195  << std::setprecision(2) << t.layer2Entrance().pt() << "; " << std::setw(6) << std::setprecision(2)
196  << t.layer2Entrance().e() << "; "
197  << "\n\t\t";
198  }
199  //if ( t.onEcal() ) {
200 
201  XYZTLorentzVector vertex2 = t.ecalEntrance().vertex();
202 
203  o << "ECAL: " << std::setw(4) << -t.onEcal() << "; " << std::setw(6) << std::setprecision(2) << vertex2.eta()
204  << "; " << std::setw(6) << std::setprecision(2) << vertex2.phi() << "; " << std::setw(5) << std::setprecision(1)
205  << vertex2.pt() << "; " << std::setw(6) << std::setprecision(1) << vertex2.z() << "; " << std::setw(6)
206  << std::setprecision(2) << t.ecalEntrance().pt() << "; " << std::setw(6) << std::setprecision(2)
207  << t.ecalEntrance().e() << "; "
208  << "\n\t\t";
209  //}
210  //if ( t.onHcal() ) {
211 
212  vertex2 = t.hcalEntrance().vertex();
213 
214  o << "HCAL: " << std::setw(4) << -t.onHcal() << "; " << std::setw(6) << std::setprecision(2) << vertex2.eta()
215  << "; " << std::setw(6) << std::setprecision(2) << vertex2.phi() << "; " << std::setw(5) << std::setprecision(1)
216  << vertex2.pt() << "; " << std::setw(6) << std::setprecision(1) << vertex2.z() << "; " << std::setw(6)
217  << std::setprecision(2) << t.hcalEntrance().pt() << "; " << std::setw(6) << std::setprecision(2)
218  << t.hcalEntrance().e() << "; "
219  << "\n\t\t";
220  //}
221  //if ( t.onVFcal() ) {
222 
223  vertex2 = t.vfcalEntrance().vertex();
224 
225  o << "VFCAL: " << std::setw(4) << -t.onVFcal() << "; " << std::setw(6) << std::setprecision(2) << vertex2.eta()
226  << "; " << std::setw(6) << std::setprecision(2) << vertex2.phi() << "; " << std::setw(5) << std::setprecision(1)
227  << vertex2.pt() << "; " << std::setw(6) << std::setprecision(1) << vertex2.z() << "; " << std::setw(6)
228  << std::setprecision(2) << t.vfcalEntrance().pt() << "; " << std::setw(6) << std::setprecision(2)
229  << t.vfcalEntrance().e() << "; "
230  << "\n\t\t";
231  //}
232  }
233  return o;
234 }
FSimTrack::Layer1_Entrance
RawParticle Layer1_Entrance
Definition: FSimTrack.h:241
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
RawParticle
Definition: RawParticle.h:37
mps_fire.i
i
Definition: mps_fire.py:428
SimVertex
Definition: SimVertex.h:5
funct::false
false
Definition: Factorize.h:29
FSimTrack::setLayer1
void setLayer1(const RawParticle &pp, int success)
Set the preshower layer1 variables.
Definition: FSimTrack.cc:106
FSimTrack::setEcal
void setEcal(const RawParticle &pp, int success)
Set the ecal variables.
Definition: FSimTrack.cc:118
X
#define X(str)
Definition: MuonsGrabber.cc:38
FSimTrack::vfcal
int vfcal
Definition: FSimTrack.h:235
hcal
Definition: ConfigurationDatabase.cc:13
gpuVertexFinder::iv
int32_t *__restrict__ iv
Definition: gpuClusterTracksDBSCAN.h:42
pos
Definition: PixelAliasList.h:18
FSimTrack::mom_
FBaseSimEvent * mom_
Definition: FSimTrack.h:224
operator<<
std::ostream & operator<<(std::ostream &o, const FSimTrack &t)
Definition: FSimTrack.cc:146
FSimTrack.h
XYZVector
math::XYZVector XYZVector
Definition: RawParticle.h:26
FSimTrack::endVertex
const FSimVertex & endVertex() const
end vertex
FSimTrack::ECAL_Entrance
RawParticle ECAL_Entrance
Definition: FSimTrack.h:243
XYZTLorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
ecal
Definition: ElectronicsMappingGPU.h:13
FSimTrack::setVFcal
void setVFcal(const RawParticle &pp, int success)
Set the hcal variables.
Definition: FSimTrack.cc:130
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
dt
float dt
Definition: AMPTWrapper.h:136
CoreSimTrack::setTrackId
void setTrackId(unsigned int t)
Definition: CoreSimTrack.h:30
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:114
FSimTrack::info_
const HepPDT::ParticleData * info_
Definition: FSimTrack.h:252
FBaseSimEvent::theTable
const HepPDT::ParticleDataTable * theTable() const
Get the pointer to the particle data table.
Definition: FBaseSimEvent.h:54
math::XYZVectorD
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
FSimTrack::vertex
const FSimVertex vertex() const
Origin vertex.
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
FSimTrack::Layer2_Entrance
RawParticle Layer2_Entrance
Definition: FSimTrack.h:242
FSimTrack::~FSimTrack
virtual ~FSimTrack()
Destructor.
Definition: FSimTrack.cc:83
FSimTrack::prop
bool prop
Definition: FSimTrack.h:239
CoreSimTrack::type
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:22
FSimTrack::HO_Entrance
RawParticle HO_Entrance
Definition: FSimTrack.h:247
FSimTrack::HCAL_Exit
RawParticle HCAL_Exit
Definition: FSimTrack.h:246
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FSimTrack::FSimTrack
FSimTrack()
Default constructor.
Definition: FSimTrack.cc:9
FSimTrack::VFCAL_Entrance
RawParticle VFCAL_Entrance
Definition: FSimTrack.h:245
FSimTrack::setHO
void setHO(const RawParticle &pp, int success)
Set the ho variables.
Definition: FSimTrack.cc:141
FSimTrack::noEndVertex
bool noEndVertex() const
no end vertex
FSimTrack::setHcal
void setHcal(const RawParticle &pp, int success)
Set the hcal variables.
Definition: FSimTrack.cc:124
FSimTrack::hcalexit
int hcalexit
Definition: FSimTrack.h:236
math
Definition: choleskyInversion.h:19
SimTrack
Definition: SimTrack.h:9
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
FSimTrack::layer2
int layer2
Definition: FSimTrack.h:232
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
FSimTrack::setHcalExit
void setHcalExit(const RawParticle &pp, int success)
Set the hcal exit variables.
Definition: FSimTrack.cc:136
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:32
FSimTrack::layer1
int layer1
Definition: FSimTrack.h:231
FSimTrack::notYetToEndVertex
bool notYetToEndVertex(const XYZTLorentzVector &pos) const
Compare the end vertex position with another position.
Definition: FSimTrack.cc:85
FSimTrack
Definition: FSimTrack.h:30
createTree.pp
pp
Definition: createTree.py:17
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:33
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
FSimTrack::hoentr
int hoentr
Definition: FSimTrack.h:237
LHEGenericFilter_cfi.ParticleID
ParticleID
Definition: LHEGenericFilter_cfi.py:6
FBaseSimEvent
Definition: FBaseSimEvent.h:42
FSimTrack::setPropagate
void setPropagate()
The particle has been propgated through the tracker.
Definition: FSimTrack.cc:103
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
FSimTrack::setLayer2
void setLayer2(const RawParticle &pp, int success)
Set the preshower layer2 variables.
Definition: FSimTrack.cc:112
FSimTrack::HCAL_Entrance
RawParticle HCAL_Entrance
Definition: FSimTrack.h:244