CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZ_vect.h

Go to the documentation of this file.
00001 #ifndef DAClusterizerInZ_vect_h
00002 #define DAClusterizerInZ_vect_h
00003 
00012 #include "RecoVertex/PrimaryVertexProducer/interface/TrackClusterizerInZ.h"
00013 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00015 #include <vector>
00016 #include "DataFormats/Math/interface/Error.h"
00017 #include "RecoVertex/VertexTools/interface/VertexDistanceXY.h"
00018 #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h"
00019 
00020 #include "DataFormats/Math/interface/VDTMath.h"
00021 
00022 // this class uses the C++11 standard
00023 #ifdef __GXX_EXPERIMENTAL_CXX0X__
00024 class DAClusterizerInZ_vect: public TrackClusterizerInZ {
00025 
00026 public:
00027         // Internal data structure to 
00028         struct track_t {
00029 
00030                 void AddItem( double new_z, double new_dz2, const reco::TransientTrack* new_tt, double new_pi   )
00031                 {
00032                         z.push_back( new_z );
00033                         dz2.push_back( new_dz2 );
00034                         tt.push_back( new_tt );
00035 
00036                         pi.push_back( new_pi ); // track weight
00037                         Z_sum.push_back( 1.0); // Z[i]   for DA clustering, initial value as done in ::fill
00038                 }
00039 
00040 
00041 
00042                 unsigned int GetSize() const
00043                 {
00044                         return z.size();
00045                 }
00046 
00047 
00048                 // has to be called everytime the items are modified
00049                 void ExtractRaw()
00050                 {
00051                         _z = &z.front();
00052                         _dz2 = &dz2.front();
00053                         _Z_sum = &Z_sum.front();
00054                         _pi = &pi.front();
00055                 }
00056 
00057                 double * __restrict__ _z; // z-coordinate at point of closest approach to the beamline
00058                 double * __restrict__  _dz2; // square of the error of z(pca)
00059 
00060                 double * __restrict__  _Z_sum; // Z[i]   for DA clustering
00061                 double * __restrict__  _pi; // track weight
00062 
00063                 std::vector<double> z; // z-coordinate at point of closest approach to the beamline
00064                 std::vector<double> dz2; // square of the error of z(pca)
00065                 std::vector< const reco::TransientTrack* > tt; // a pointer to the Transient Track
00066 
00067                 std::vector<double> Z_sum; // Z[i]   for DA clustering
00068                 std::vector<double> pi; // track weight
00069         };
00070 
00071         struct vertex_t {
00072                 std::vector<double> z; //           z coordinate
00073                 std::vector<double> pk; //           vertex weight for "constrained" clustering
00074 
00075                 // --- temporary numbers, used during update
00076                 std::vector<double> ei_cache;
00077                 std::vector<double> ei;
00078                 std::vector<double> sw;
00079                 std::vector<double> swz;
00080                 std::vector<double> se;
00081                 std::vector<double> swE;
00082 
00083 
00084                 unsigned int GetSize() const
00085                 {
00086                         return z.size();
00087                 }
00088 
00089                 void AddItem( double new_z, double new_pk   )
00090                 {
00091                         z.push_back( new_z);
00092                         pk.push_back( new_pk);
00093 
00094                         ei_cache.push_back( 0.0 );
00095                         ei.push_back( 0.0 );
00096                         sw.push_back( 0.0 );
00097                         swz.push_back( 0.0);
00098                         se.push_back( 0.0);
00099                         swE.push_back( 0.0);
00100 
00101                         ExtractRaw();
00102                 }
00103 
00104                 void InsertItem( unsigned int i, double new_z, double new_pk   )
00105                 {
00106                         z.insert(z.begin() + i, new_z);
00107                         pk.insert(pk.begin() + i, new_pk);
00108 
00109                         ei_cache.insert(ei_cache.begin() + i, 0.0 );
00110                         ei.insert( ei.begin()  + i, 0.0 );
00111                         sw.insert( sw.begin()  + i, 0.0 );
00112                         swz.insert(swz.begin() + i, 0.0 );
00113                         se.insert( se.begin()  + i, 0.0 );
00114                         swE.insert(swE.begin() + i, 0.0 );
00115 
00116                         ExtractRaw();
00117                 }
00118 
00119                 void RemoveItem( unsigned int i )
00120                 {
00121                         z.erase( z.begin() + i );
00122                         pk.erase( pk.begin() + i );
00123 
00124                         ei_cache.erase( ei_cache.begin() + i);
00125                         ei.erase( ei.begin() + i);
00126                         sw.erase( sw.begin() + i);
00127                         swz.erase( swz.begin() + i);
00128                         se.erase(se.begin() + i);
00129                         swE.erase(swE.begin() + i);
00130 
00131                         ExtractRaw();
00132                 }
00133 
00134                 void DebugOut()
00135                 {
00136                         std::cout <<  "vertex_t size: " << GetSize() << std::endl;
00137 
00138                         for ( unsigned int i =0; i < GetSize(); ++ i)
00139                         {
00140                                 std::cout << " z = " << _z[i] << " pk = " << _pk[i] << std::endl;
00141                         }
00142                 }
00143 
00144                 // has to be called everytime the items are modified
00145                 void ExtractRaw()
00146                 {
00147                         _z = &z.front();
00148                         _pk = &pk.front();
00149 
00150                         _ei = &ei.front();
00151                         _sw = &sw.front();
00152                         _swz = &swz.front();
00153                         _se = &se.front();
00154                         _swE = &swE.front();
00155                         _ei_cache = &ei_cache.front();
00156 
00157                 }
00158 
00159                 double * __restrict__ _z;
00160                 double * __restrict__ _pk;
00161 
00162                 double * __restrict__ _ei_cache;
00163                 double * __restrict__ _ei;
00164                 double * __restrict__ _sw;
00165                 double * __restrict__ _swz;
00166                 double * __restrict__ _se;
00167                 double * __restrict__ _swE;
00168 
00169         };
00170 
00171         DAClusterizerInZ_vect(const edm::ParameterSet& conf);
00172 
00173 
00174         std::vector<std::vector<reco::TransientTrack> >
00175         clusterize(const std::vector<reco::TransientTrack> & tracks) const;
00176 
00177 
00178         std::vector<TransientVertex>
00179         vertices(const std::vector<reco::TransientTrack> & tracks,
00180                         const int verbosity = 0) const
00181                         CMS_VECTORIZE ;
00182 
00183         track_t fill(const std::vector<reco::TransientTrack> & tracks) const;
00184 
00185         double update(double beta, track_t & gtracks,
00186                         vertex_t & gvertices, bool useRho0, double & rho0) const
00187                         CMS_VECTORIZE ;
00188 
00189         void dump(const double beta, const vertex_t & y,
00190                         const track_t & tks, const int verbosity = 0) const;
00191         bool merge(vertex_t &) const;
00192         bool merge(vertex_t & y, double & beta)const;
00193         bool purge(vertex_t &, track_t &, double &,
00194                         const double) const;
00195 
00196         void splitAll( vertex_t & y) const;
00197         bool split(const double beta,  track_t &t, vertex_t & y ) const;
00198 
00199         double beta0(const double betamax, track_t & tks, vertex_t & y) const;
00200 
00201         double Eik( double const& t_z, double const& k_z, double const& t_dz2) const;
00202 
00203         inline double local_exp( double const& inp) const;
00204         inline void local_exp_list( double* arg_inp, double* arg_out,const int arg_arr_size) const;
00205 
00206 private:
00207         bool verbose_;
00208         float vertexSize_;
00209         int maxIterations_;
00210         double coolingFactor_;
00211         float betamax_;
00212         float betastop_;
00213         double dzCutOff_;
00214         double d0CutOff_;
00215         bool use_vdt_;
00216         bool useTc_;
00217 };
00218 
00219 // #ifdef __GXX_EXPERIMENTAL_CXX0X__
00220 #endif
00221 
00222 //#ifndef DAClusterizerInZ_new_h
00223 #endif