CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DAClusterizerInZ_vect.h
Go to the documentation of this file.
1 #ifndef DAClusterizerInZ_vect_h
2 #define DAClusterizerInZ_vect_h
3 
15 #include <vector>
19 
20 
22 
23 public:
24  // Internal data structure to
25  struct track_t {
26 
27  void AddItem( double new_z, double new_dz2, const reco::TransientTrack* new_tt, double new_pi )
28  {
29  z.push_back( new_z );
30  dz2.push_back( new_dz2 );
31  tt.push_back( new_tt );
32 
33  pi.push_back( new_pi ); // track weight
34  Z_sum.push_back( 1.0); // Z[i] for DA clustering, initial value as done in ::fill
35  }
36 
37 
38 
39  unsigned int GetSize() const
40  {
41  return z.size();
42  }
43 
44 
45  // has to be called everytime the items are modified
46  void ExtractRaw()
47  {
48  _z = &z.front();
49  _dz2 = &dz2.front();
50  _Z_sum = &Z_sum.front();
51  _pi = &pi.front();
52  }
53 
54  double * __restrict__ _z; // z-coordinate at point of closest approach to the beamline
55  double * __restrict__ _dz2; // square of the error of z(pca)
56 
57  double * __restrict__ _Z_sum; // Z[i] for DA clustering
58  double * __restrict__ _pi; // track weight
59 
60  std::vector<double> z; // z-coordinate at point of closest approach to the beamline
61  std::vector<double> dz2; // square of the error of z(pca)
62  std::vector< const reco::TransientTrack* > tt; // a pointer to the Transient Track
63 
64  std::vector<double> Z_sum; // Z[i] for DA clustering
65  std::vector<double> pi; // track weight
66  };
67 
68  struct vertex_t {
69  std::vector<double> z; // z coordinate
70  std::vector<double> pk; // vertex weight for "constrained" clustering
71 
72  // --- temporary numbers, used during update
73  std::vector<double> ei_cache;
74  std::vector<double> ei;
75  std::vector<double> sw;
76  std::vector<double> swz;
77  std::vector<double> se;
78  std::vector<double> swE;
79 
80 
81  unsigned int GetSize() const
82  {
83  return z.size();
84  }
85 
86  void AddItem( double new_z, double new_pk )
87  {
88  z.push_back( new_z);
89  pk.push_back( new_pk);
90 
91  ei_cache.push_back( 0.0 );
92  ei.push_back( 0.0 );
93  sw.push_back( 0.0 );
94  swz.push_back( 0.0);
95  se.push_back( 0.0);
96  swE.push_back( 0.0);
97 
98  ExtractRaw();
99  }
100 
101  void InsertItem( unsigned int i, double new_z, double new_pk )
102  {
103  z.insert(z.begin() + i, new_z);
104  pk.insert(pk.begin() + i, new_pk);
105 
106  ei_cache.insert(ei_cache.begin() + i, 0.0 );
107  ei.insert( ei.begin() + i, 0.0 );
108  sw.insert( sw.begin() + i, 0.0 );
109  swz.insert(swz.begin() + i, 0.0 );
110  se.insert( se.begin() + i, 0.0 );
111  swE.insert(swE.begin() + i, 0.0 );
112 
113  ExtractRaw();
114  }
115 
116  void RemoveItem( unsigned int i )
117  {
118  z.erase( z.begin() + i );
119  pk.erase( pk.begin() + i );
120 
121  ei_cache.erase( ei_cache.begin() + i);
122  ei.erase( ei.begin() + i);
123  sw.erase( sw.begin() + i);
124  swz.erase( swz.begin() + i);
125  se.erase(se.begin() + i);
126  swE.erase(swE.begin() + i);
127 
128  ExtractRaw();
129  }
130 
131  void DebugOut()
132  {
133  std::cout << "vertex_t size: " << GetSize() << std::endl;
134 
135  for ( unsigned int i =0; i < GetSize(); ++ i)
136  {
137  std::cout << " z = " << _z[i] << " pk = " << _pk[i] << std::endl;
138  }
139  }
140 
141  // has to be called everytime the items are modified
142  void ExtractRaw()
143  {
144  _z = &z.front();
145  _pk = &pk.front();
146 
147  _ei = &ei.front();
148  _sw = &sw.front();
149  _swz = &swz.front();
150  _se = &se.front();
151  _swE = &swE.front();
152  _ei_cache = &ei_cache.front();
153 
154  }
155 
156  double * __restrict__ _z;
157  double * __restrict__ _pk;
158 
159  double * __restrict__ _ei_cache;
160  double * __restrict__ _ei;
161  double * __restrict__ _sw;
162  double * __restrict__ _swz;
163  double * __restrict__ _se;
164  double * __restrict__ _swE;
165 
166  };
167 
169 
170 
171  std::vector<std::vector<reco::TransientTrack> >
172  clusterize(const std::vector<reco::TransientTrack> & tracks) const;
173 
174 
175  std::vector<TransientVertex>
176  vertices(const std::vector<reco::TransientTrack> & tracks,
177  const int verbosity = 0) const ;
178 
179  track_t fill(const std::vector<reco::TransientTrack> & tracks) const;
180 
181  double update(double beta, track_t & gtracks,
182  vertex_t & gvertices, bool useRho0, double & rho0) const;
183 
184  void dump(const double beta, const vertex_t & y,
185  const track_t & tks, const int verbosity = 0) const;
186  bool merge(vertex_t &) const;
187  bool merge(vertex_t & y, double & beta)const;
188  bool purge(vertex_t &, track_t &, double &,
189  const double) const;
190 
191  void splitAll( vertex_t & y) const;
192  bool split(const double beta, track_t &t, vertex_t & y ) const;
193 
194  double beta0(const double betamax, track_t const & tks, vertex_t const & y) const;
195 
196 
197 private:
198  bool verbose_;
199  float vertexSize_;
202  float betamax_;
203  float betastop_;
204  double dzCutOff_;
205  double d0CutOff_;
206  bool useTc_;
207 };
208 
209 
210 //#ifndef DAClusterizerInZ_new_h
211 #endif
void AddItem(double new_z, double new_dz2, const reco::TransientTrack *new_tt, double new_pi)
const double beta
int i
Definition: DBlmapReader.cc:9
void splitAll(vertex_t &y) const
void AddItem(double new_z, double new_pk)
bool split(const double beta, track_t &t, vertex_t &y) const
track_t fill(const std::vector< reco::TransientTrack > &tracks) const
std::vector< const reco::TransientTrack * > tt
bool merge(vertex_t &) const
std::vector< std::vector< reco::TransientTrack > > clusterize(const std::vector< reco::TransientTrack > &tracks) const
void InsertItem(unsigned int i, double new_z, double new_pk)
double update(double beta, track_t &gtracks, vertex_t &gvertices, bool useRho0, double &rho0) const
tuple conf
Definition: dbtoconf.py:185
double beta0(const double betamax, track_t const &tks, vertex_t const &y) const
DAClusterizerInZ_vect(const edm::ParameterSet &conf)
void dump(const double beta, const vertex_t &y, const track_t &tks, const int verbosity=0) const
tuple tracks
Definition: testEve_cfg.py:39
std::vector< TransientVertex > vertices(const std::vector< reco::TransientTrack > &tracks, const int verbosity=0) const
tuple cout
Definition: gather_cfg.py:121
bool purge(vertex_t &, track_t &, double &, const double) const
tuple verbosity
Definition: mvaPFMET_cff.py:80