diff --git a/CMakeLists.txt b/CMakeLists.txt index 794d01a5773406c9483be77f68037469ed820ff0..8abde6251ed30190df2002d9eb11af14c7f9c39b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ message(STATUS "Compiling for system '${CMAKE_SYSTEM_NAME}' version '${CMAKE_SYS # set the compiler ###### -set(CMAKE_CXX_FLAGS "-std=c++11 -fPIC -Wall -Werror") +set(CMAKE_CXX_FLAGS "-std=c++11 -fPIC -Wall -Werror -Wno-unused-variable") #flags for specific build types set(CMAKE_CXX_FLAGS_DEBUG "-g") diff --git a/include/TFRChiSquaredFit.cpp b/include/TFRChiSquaredFit.cpp index ae13741f1148c05a2ea02e1bad3ca3088f5c94a1..8e003a1b1865a00d859d47545158819c9a38d1cb 100644 --- a/include/TFRChiSquaredFit.cpp +++ b/include/TFRChiSquaredFit.cpp @@ -38,11 +38,38 @@ bool TFRChiSquaredFit::FitLinear1D_matrix(TFRTrack *track, bool xz_view, // (t = trans. matrix, W = V-1) //the covariance matrix of the parameters is: // Vp = (At W A)-1 + + //get the number of hits of the track, useful to determine the dimensions of the matrices + unsigned int num_hits = track->GetNClusters(); + + //TASK: define the matrices that you need: you will fill them later + + //I've no clue why the hell in ROOT there aren't nice implementations of iterators, + //but just this stupid way (that I even didn't used at my C course during my bachelor) + TIter it_cluster((TFRClusters*) track->GetClusters()); + TFRCluster *curr_cluster; + + //index to fill the matrices and vectors + unsigned int i = 0; + + //loop over the clusters + while((curr_cluster = (TFRCluster*) it_cluster.Next())){ + + //TASK: fill the matrices that you need + // with the measurements from the detector + + ++i; + + } //loop over the clusters //track parameters TVectorD P(2); - //TASK: compute the track parameters and covariance with chi2 minimisation fit + //V_p covariance matrix of the parameters + TMatrixD V_p(3, 3); + + //TASK: compute the track parameter filling the vector P + // and covariance matric V_p //set the track parameters if(xz_view) @@ -50,6 +77,18 @@ bool TFRChiSquaredFit::FitLinear1D_matrix(TFRTrack *track, bool xz_view, else track->SetTrackParamsYZ(P(0), P(1)); + //------------------------------------------// + // set the covariance matrix of the track // + //------------------------------------------// + //in the linear chi2 fit the covariance matrix is 2x2, + //but I have to fill a 3x3 matrix + TMatrixD V_p_temp(3, 3); + + V_p_temp.SetSub(0, 0, V_p); + + //finally set the track covariance matrix + track->SetCovarianceMatrixXZ(V_p_temp); + //--------------------// // compute the chi2 // //--------------------//