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