CMS 3D CMS Logo

SLHCEvent.h
Go to the documentation of this file.
1 // This holds two classes: L1SimTrack (truth level simulated track), and SLHCEvent (support for maintaining standalone running)
2 #ifndef L1Trigger_TrackFindingTracklet_interface_SLHCEvent_h
3 #define L1Trigger_TrackFindingTracklet_interface_SLHCEvent_h
4 
5 #include <iostream>
6 #include <fstream>
7 #include <cstdlib>
8 #include <vector>
9 #include <cmath>
10 #include <cassert>
11 
13 
14 namespace trklet {
15 
16  class L1SimTrack {
17  public:
18  L1SimTrack();
19  L1SimTrack(int eventid, int trackid, int type, double pt, double eta, double phi, double vx, double vy, double vz);
20  ~L1SimTrack() = default;
21 
22  void write(std::ofstream& out);
23  void write(std::ostream& out);
24 
25  int eventid() const { return eventid_; }
26  int trackid() const { return trackid_; }
27  int type() const { return type_; }
28  double pt() const { return pt_; }
29  double eta() const { return eta_; }
30  double phi() const { return phi_; }
31  double vx() const { return vx_; }
32  double vy() const { return vy_; }
33  double vz() const { return vz_; }
34  double dxy() const { return -vx() * sin(phi()) + vy() * cos(phi()); }
35  double d0() const { return -dxy(); }
36  int charge() const {
37  if (type_ == 11 || type_ == 13 || type_ == -211 || type_ == -321 || type_ == -2212)
38  return -1;
39  return 1;
40  }
41 
42  private:
43  int eventid_;
44  int trackid_;
45  int type_;
46  double pt_;
47  double eta_;
48  double phi_;
49  double vx_;
50  double vy_;
51  double vz_;
52  };
53 
54  class SLHCEvent {
55  public:
57  //empty constructor to be used with 'filler' functions
58  eventnum_ = 0;
59  }
60  SLHCEvent(std::istream& in);
61  ~SLHCEvent() = default;
62 
63  void setIPx(double x) { x_offset_ = x; }
64  void setIPy(double y) { y_offset_ = y; }
65 
67 
68  void addL1SimTrack(
69  int eventid, int trackid, int type, double pt, double eta, double phi, double vx, double vy, double vz);
70 
71  bool addStub(int layer,
72  int ladder,
73  int module,
74  int strip,
75  int eventid,
76  std::vector<int> tps,
77  double pt,
78  double bend,
79  double x,
80  double y,
81  double z,
82  int isPSmodule,
83  int isFlipped);
84 
85  const L1TStub& lastStub() const { return stubs_.back(); }
86 
87  void write(std::ofstream& out);
88  void write(std::ostream& out);
89 
90  unsigned int layersHit(int tpid, int& nlayers, int& ndisks);
91 
92  int nstubs() const { return stubs_.size(); }
93 
94  const L1TStub& stub(int i) const { return stubs_[i]; }
95 
96  unsigned int nsimtracks() const { return simtracks_.size(); }
97 
98  const L1SimTrack& simtrack(int i) const { return simtracks_[i]; }
99 
100  int eventnum() const { return eventnum_; }
101 
102  int getSimtrackFromSimtrackid(int simtrackid, int eventid = 0) const;
103 
104  private:
106  std::vector<L1SimTrack> simtracks_;
107  std::vector<L1TStub> stubs_;
108 
109  double x_offset_{0.0};
110  double y_offset_{0.0};
111  };
112 
113 }; // namespace trklet
114 #endif
trklet::SLHCEvent::stub
const L1TStub & stub(int i) const
Definition: SLHCEvent.h:94
L1TStub.h
trklet::L1SimTrack::vy_
double vy_
Definition: SLHCEvent.h:50
mps_fire.i
i
Definition: mps_fire.py:428
trklet::L1SimTrack::d0
double d0() const
Definition: SLHCEvent.h:35
trklet::L1SimTrack::vy
double vy() const
Definition: SLHCEvent.h:32
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
trklet::L1SimTrack::type
int type() const
Definition: SLHCEvent.h:27
trklet::SLHCEvent::setIPy
void setIPy(double y)
Definition: SLHCEvent.h:64
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
trklet::SLHCEvent::x_offset_
double x_offset_
Definition: SLHCEvent.h:109
trklet::L1TStub
Definition: L1TStub.h:12
trklet::L1SimTrack::type_
int type_
Definition: SLHCEvent.h:45
trklet::L1SimTrack
Definition: SLHCEvent.h:16
trklet::SLHCEvent::setEventNum
void setEventNum(int eventnum)
Definition: SLHCEvent.h:66
trklet::L1SimTrack::vz
double vz() const
Definition: SLHCEvent.h:33
trklet::SLHCEvent::SLHCEvent
SLHCEvent()
Definition: SLHCEvent.h:56
trklet::L1SimTrack::eventid_
int eventid_
Definition: SLHCEvent.h:43
trklet::L1SimTrack::vz_
double vz_
Definition: SLHCEvent.h:51
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
trklet::L1SimTrack::trackid
int trackid() const
Definition: SLHCEvent.h:26
trklet::L1SimTrack::eventid
int eventid() const
Definition: SLHCEvent.h:25
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
PVValHelper::eta
Definition: PVValidationHelpers.h:69
trklet::L1SimTrack::~L1SimTrack
~L1SimTrack()=default
trklet::L1SimTrack::phi_
double phi_
Definition: SLHCEvent.h:48
trklet::L1SimTrack::dxy
double dxy() const
Definition: SLHCEvent.h:34
trklet::SLHCEvent::nstubs
int nstubs() const
Definition: SLHCEvent.h:92
trklet::SLHCEvent::y_offset_
double y_offset_
Definition: SLHCEvent.h:110
trklet::L1SimTrack::eta_
double eta_
Definition: SLHCEvent.h:47
trklet::L1SimTrack::L1SimTrack
L1SimTrack()
Definition: SLHCEvent.cc:8
trklet::L1SimTrack::write
void write(std::ofstream &out)
Definition: SLHCEvent.cc:26
trklet::L1SimTrack::phi
double phi() const
Definition: SLHCEvent.h:30
trklet::L1SimTrack::trackid_
int trackid_
Definition: SLHCEvent.h:44
trklet::L1SimTrack::pt
double pt() const
Definition: SLHCEvent.h:28
trklet::L1SimTrack::eta
double eta() const
Definition: SLHCEvent.h:29
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
recoMuon::in
Definition: RecoMuonEnumerators.h:6
trklet::SLHCEvent
Definition: SLHCEvent.h:54
trklet::L1SimTrack::pt_
double pt_
Definition: SLHCEvent.h:46
trklet::SLHCEvent::eventnum
int eventnum() const
Definition: SLHCEvent.h:100
trklet::SLHCEvent::nsimtracks
unsigned int nsimtracks() const
Definition: SLHCEvent.h:96
trklet::SLHCEvent::layersHit
unsigned int layersHit(int tpid, int &nlayers, int &ndisks)
Definition: SLHCEvent.cc:239
trklet::SLHCEvent::write
void write(std::ofstream &out)
Definition: SLHCEvent.cc:211
trklet
Definition: AllProjectionsMemory.h:9
trklet::SLHCEvent::addL1SimTrack
void addL1SimTrack(int eventid, int trackid, int type, double pt, double eta, double phi, double vx, double vy, double vz)
Definition: SLHCEvent.cc:40
trklet::L1SimTrack::charge
int charge() const
Definition: SLHCEvent.h:36
trklet::SLHCEvent::eventnum_
int eventnum_
Definition: SLHCEvent.h:105
trklet::SLHCEvent::addStub
bool addStub(int layer, int ladder, int module, int strip, int eventid, std::vector< int > tps, double pt, double bend, double x, double y, double z, int isPSmodule, int isFlipped)
Definition: SLHCEvent.cc:48
trklet::SLHCEvent::lastStub
const L1TStub & lastStub() const
Definition: SLHCEvent.h:85
trklet::bend
double bend(double r, double rinv, double stripPitch)
Definition: Util.h:160
trklet::L1SimTrack::vx_
double vx_
Definition: SLHCEvent.h:49
PVValHelper::ladder
Definition: PVValidationHelpers.h:72
trklet::SLHCEvent::~SLHCEvent
~SLHCEvent()=default
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
trklet::SLHCEvent::setIPx
void setIPx(double x)
Definition: SLHCEvent.h:63
trklet::SLHCEvent::getSimtrackFromSimtrackid
int getSimtrackFromSimtrackid(int simtrackid, int eventid=0) const
Definition: SLHCEvent.cc:287
trklet::L1SimTrack::vx
double vx() const
Definition: SLHCEvent.h:31
trklet::SLHCEvent::simtrack
const L1SimTrack & simtrack(int i) const
Definition: SLHCEvent.h:98
trklet::SLHCEvent::simtracks_
std::vector< L1SimTrack > simtracks_
Definition: SLHCEvent.h:106
trklet::SLHCEvent::stubs_
std::vector< L1TStub > stubs_
Definition: SLHCEvent.h:107
nlayers
Definition: HIMultiTrackSelector.h:48