            Trk::StraightLineSurface strip;
                                                                                
            // Check if Cluster Hit or SingleStrip Hit, construct TrkStraightLineSurface accordingly
            InPlaneResidual.setX(m_SCT_Manager->getDetectorElement(surfaceID)->localPositionOfCell(surfaceID).x() - hitOnTrack->localParameters()[Trk::locX]);
            InPlaneResidual.setY(m_SCT_Manager->getDetectorElement(surfaceID)->localPositionOfCell(surfaceID).y() - hitOnTrack->localParameters()[Trk::locY]);
                                                                                
            if (InPlaneResidual.mag() > 1.0 * micrometer) {
              //log << MSG::DEBUG << "RIO seems to be a Cluster" << endreq;
              HitIsCluster = true;
                                                                                
              // Get eos (EndOfStrip)
              eos = GetSCTClusterEndpoints(surfaceID, *tsos);
                                                                                
              // Build Strip from Endpoints
              strip = CreateStraightLine(eos);
                                                                                
            } else { // no cluster hit (single strip hit)
              //log << MSG::DEBUG << "RIO seems to be Single Strip Hit" << endreq;
              HitIsCluster = false;
              //strip = GetStraightLineSCT(surfaceID, misAlignment);
                                                                                
              eos = GetSCTStripEndpoints(surfaceID);
                                                                                
              // Build Strip from Endpoints
              strip = CreateStraightLine(eos);
                                                                                
            }
                                                                                
            residualVector = getResidual(*tsos, strip, surfaceID);
//taka wakaran            derivativeVector = getDerivatives(eos, *tsos, surfaceID, (*m_hVector));
            if (HitIsCluster) {
              log << MSG::DEBUG << "DOCA: " << residualVector[0] << " +/- " << sqrt(residualVector[1]) << endreq;
            } else {
              log << MSG::DEBUG << "DOCA: " << residualVector[0] << " +/- " << sqrt(residualVector[1]) << endreq;
            }
            /*
            for (int i = 0; i < 6; ++i) {
              log << MSG::INFO << "Derivative Parameter " << i << " = " << derivativeVector[i] << endreq;
            }
            */
                                                                                
            if (residualVector[1] != 0) { //Test if residual and derivative calculation succeeded
                                                                                
                                                                                
              // Barrel Loop
              if (m_SCT_Manager->getIdHelper()->is_barrel(surfaceID)) {
                ++nHitsBarrel;
                //log << MSG::DEBUG << "SCT Barrel Hit " << nHitsBarrel << " on
" << m_idHelper->show_to_string(surfaceID,0,'/') << endreq;
                                                                                
                if (HitIsCluster) {
                  m_histo1D_Barrel_Cluster->fill(residualVector[0]);
                  m_histo1D_Barrel_ClusterPull->fill(residualVector[0]/sqrt(residualVector[1]));
                } else {
                  m_histo1D_Barrel_Residual->fill(residualVector[0]);
                  m_histo1D_Barrel_ResidualPull->fill(residualVector[0]/sqrt(residualVector[1]));
                }
                                                                                
                if (m_SCT_Manager->getIdHelper()->layer_disk(surfaceID) == 0) {
// Barrel Layer 0
                  if (HitIsCluster) {
                    m_histo1D_Barrel_0_Cluster->fill(residualVector[0]);
                    m_histo1D_Barrel_0_ClusterPull->fill(residualVector[0]/sqrt(residualVector[1]));
                  } else {
                    m_histo1D_Barrel_0_Residual->fill(residualVector[0]);
                    m_histo1D_Barrel_0_ResidualPull->fill(residualVector[0]/sqrt(residualVector[1]));
                  }
                } else if (m_SCT_Manager->getIdHelper()->layer_disk(surfaceID) == 1) { // Barrel Layer 1
                  if (HitIsCluster) {
                    m_histo1D_Barrel_1_Cluster->fill(residualVector[0]);
                    m_histo1D_Barrel_1_ClusterPull->fill(residualVector[0]/sqrt(residualVector[1]));
                  } else {
                    m_histo1D_Barrel_1_Residual->fill(residualVector[0]);
                    m_histo1D_Barrel_1_ResidualPull->fill(residualVector[0]/sqrt(residualVector[1]));
                  }
                } else if (m_SCT_Manager->getIdHelper()->layer_disk(surfaceID) == 2) { // Barrel Layer 2
                  if (HitIsCluster) {
                    m_histo1D_Barrel_2_Cluster->fill(residualVector[0]);
                    m_histo1D_Barrel_2_ClusterPull->fill(residualVector[0]/sqrt(residualVector[1]));
                  } else {
                    m_histo1D_Barrel_2_Residual->fill(residualVector[0]);
                    m_histo1D_Barrel_2_ResidualPull->fill(residualVector[0]/sqrt(residualVector[1]));
                  }
                } else if (m_SCT_Manager->getIdHelper()->layer_disk(surfaceID) == 3) { // Barrel Layer 3
                  if (HitIsCluster) {
                    m_histo1D_Barrel_3_Cluster->fill(residualVector[0]);
                    m_histo1D_Barrel_3_ClusterPull->fill(residualVector[0]/sqrt(residualVector[1]));
                  } else {
                    m_histo1D_Barrel_3_Residual->fill(residualVector[0]);
                    m_histo1D_Barrel_3_ResidualPull->fill(residualVector[0]/sqrt(residualVector[1]));
                  }
                }
              } // end of "is Barrel"
                // EndCap Loop
                else {
                ++nHitsEndCap;
                //log << MSG::DEBUG << "SCT Forward Hit " << nHitsEndCap << " on " << m_idHelper->show_to_string(surfaceID,0,'/') << endreq;
                                                                                
                                                                                
              } // end of "is EndCap"
            } else {
              log << MSG::ERROR << "No Extrapolation Results for Hit: " << m_idHelper->show_to_string(surfaceID,0,'/') << endreq;
                                                                                
            }  // end of "did extrapolation succeed?
