80  const int nClusters = track.getNClusterReferences();
 
   82  int nClsROC[4] = {0, 0, 0, 0};
 
   83  int nClsSubThreshROC[4] = {0, 0, 0, 0};
 
   86  std::array<std::vector<float>, nType> chargeTotROC;
 
   87  std::array<std::vector<float>, nType> chargeMaxROC;
 
   88  for (
int i = 0; 
i < nType; ++
i) {
 
   94  std::vector<int> excludeClVector;
 
   95  std::vector<int> regionVector;
 
   96  std::vector<unsigned char> rowIndexVector;
 
   97  std::vector<unsigned char> padVector;
 
   98  std::vector<unsigned char> sectorVector;
 
   99  std::vector<int> stackVector;
 
  100  std::vector<float> localXVector;
 
  101  std::vector<float> localYVector;
 
  102  std::vector<float> offsPadVector;
 
  104  std::vector<float> topologyCorrVector;
 
  105  std::vector<float> topologyCorrTotVector;
 
  106  std::vector<float> topologyCorrMaxVector;
 
  107  std::vector<float> gainVector;
 
  108  std::vector<float> gainResidualVector;
 
  109  std::vector<float> residualCorrTotVector;
 
  110  std::vector<float> residualCorrMaxVector;
 
  111  std::vector<float> scCorrVector;
 
  113  std::vector<o2::tpc::TrackTPC> trackVector;
 
  114  std::vector<o2::tpc::ClusterNative> clVector;
 
  115  std::vector<unsigned int> occupancyVector;
 
  116  std::vector<bool> isClusterShared;
 
  129    topologyCorrTotVector.reserve(
nClusters);
 
  130    topologyCorrMaxVector.reserve(
nClusters);
 
  133    residualCorrTotVector.reserve(
nClusters);
 
  134    residualCorrMaxVector.reserve(
nClusters);
 
  143  unsigned char rowIndexOld = 0;
 
  144  unsigned char sectorIndexOld = 0;
 
  145  float minChargeTot = 100000.f;
 
  146  float minChargeMax = 100000.f;
 
  149  for (
int iCl = 0; iCl < 
nClusters; iCl++) {
 
  153    unsigned char sectorIndex = 0;
 
  154    unsigned char rowIndex = 0;
 
  155    unsigned int clusterIndexNumb = 0;
 
  158    track.getClusterReference(*mTPCTrackClIdxVecInput, iCl, sectorIndex, rowIndex, clusterIndexNumb);
 
  161    const unsigned int absoluteIndex = mClusterIndex->
clusterOffset[sectorIndex][rowIndex] + clusterIndexNumb;
 
  167    const CRU cru(
Sector(sectorIndex), region);
 
  171    const int stackNumber = 
static_cast<int>(
stack);
 
  177    const auto flagsCl = cl.getFlags();
 
  190      excludeCl += 0b10000; 
 
  197    if (!mPropagateTrack) {
 
  198      if (mRefit == 
nullptr) {
 
  199        LOGP(error, 
"mRefit is a nullptr, call the function setRefit() before looping over the tracks.");
 
  201      mRefit->setTrackReferenceX(xPosition);
 
  202      check = (mRefit->RefitTrackAsGPU(track, 
false, 
true) < 0) ? 
false : 
true;
 
  205      track.rotate(o2::math_utils::detail::sector2Angle<float>(sectorIndex));
 
  209    if (!
check || std::isnan(track.getParam(1))) {
 
  213    if (excludeCl != 0) {
 
  216        excludeClVector.emplace_back(excludeCl);
 
  217        regionVector.emplace_back(region);
 
  218        rowIndexVector.emplace_back(rowIndex);
 
  219        padVector.emplace_back(pad);
 
  220        sectorVector.emplace_back(sectorIndex);
 
  221        stackVector.emplace_back(stackNumber);
 
  222        localXVector.emplace_back(localX);
 
  223        localYVector.emplace_back(localY);
 
  224        offsPadVector.emplace_back(offsPad);
 
  225        trackVector.emplace_back(track);
 
  226        clVector.emplace_back(cl);
 
  228        isClusterShared.emplace_back(isShared);
 
  230        topologyCorrVector.emplace_back(-999.f);
 
  231        topologyCorrTotVector.emplace_back(-999.f);
 
  232        topologyCorrMaxVector.emplace_back(-999.f);
 
  233        gainVector.emplace_back(-999.f);
 
  234        gainResidualVector.emplace_back(-999.f);
 
  235        residualCorrTotVector.emplace_back(-999.f);
 
  236        residualCorrMaxVector.emplace_back(-999.f);
 
  237        scCorrVector.emplace_back(-999.f);
 
  240      rowIndexOld = rowIndex;
 
  241      sectorIndexOld = sectorIndex;
 
  246    float chargeTot = cl.
qTot;
 
  247    float chargeMax = cl.
qMax;
 
  250    const float threshold = mCalibCont.getZeroSupressionThreshold(sectorIndex, rowIndex, pad);
 
  253    int missingClusters = rowIndexOld - rowIndex - 1;
 
  254    if ((missingClusters > 0) && (missingClusters <= mMaxMissingCl)) {
 
  256        if (sectorIndexOld == sectorIndex) {
 
  258            nClsSubThreshROC[0] += missingClusters;
 
  259            nClsROC[0] += missingClusters;
 
  261            nClsSubThreshROC[1] += missingClusters;
 
  262            nClsROC[1] += missingClusters;
 
  264            nClsSubThreshROC[2] += missingClusters;
 
  265            nClsROC[2] += missingClusters;
 
  267            nClsSubThreshROC[3] += missingClusters;
 
  268            nClsROC[3] += missingClusters;
 
  273          nClsSubThreshROC[0] += missingClusters;
 
  274          nClsROC[0] += missingClusters;
 
  276          nClsSubThreshROC[1] += missingClusters;
 
  277          nClsROC[1] += missingClusters;
 
  279          nClsSubThreshROC[2] += missingClusters;
 
  280          nClsROC[2] += missingClusters;
 
  282          nClsSubThreshROC[3] += missingClusters;
 
  283          nClsROC[3] += missingClusters;
 
  287    rowIndexOld = rowIndex;
 
  288    sectorIndexOld = sectorIndex;
 
  291    float effectiveLength = 1.0f;
 
  292    float effectiveLengthTot = 1.0f;
 
  293    float effectiveLengthMax = 1.0f;
 
  296      chargeTot /= effectiveLength;
 
  297      chargeMax /= effectiveLength;
 
  302      chargeTot /= effectiveLengthTot;
 
  303      chargeMax /= effectiveLengthMax;
 
  308    float gainResidual = 1.0f;
 
  310      gain = mCalibCont.getGain(sectorIndex, rowIndex, pad);
 
  313      gainResidual = mCalibCont.getResidualGain(sectorIndex, rowIndex, pad);
 
  315    chargeTot /= gain * gainResidual;
 
  316    chargeMax /= gain * gainResidual;
 
  319    float corrTot = 1.0f;
 
  320    float corrMax = 1.0f;
 
  322      corrTot = mCalibCont.getResidualCorrection(stackID, 
ChargeType::Tot, track.getTgl(), track.getSnp());
 
  323      corrMax = mCalibCont.getResidualCorrection(stackID, 
ChargeType::Max, track.getTgl(), track.getSnp());
 
  325        chargeTot /= corrTot;
 
  328        chargeMax /= corrMax;
 
  333    if (chargeTot < minChargeTot) {
 
  334      minChargeTot = chargeTot;
 
  337    if (chargeMax < minChargeMax) {
 
  338      minChargeMax = chargeMax;
 
  342    const float time = cl.getTime() - track.getTime0(); 
 
  355      chargeTotROC[0].emplace_back(chargeTot);
 
  356      chargeMaxROC[0].emplace_back(chargeMax);
 
  359      chargeTotROC[1].emplace_back(chargeTot);
 
  360      chargeMaxROC[1].emplace_back(chargeMax);
 
  363      chargeTotROC[2].emplace_back(chargeTot);
 
  364      chargeMaxROC[2].emplace_back(chargeMax);
 
  367      chargeTotROC[3].emplace_back(chargeTot);
 
  368      chargeMaxROC[3].emplace_back(chargeMax);
 
  372    chargeTotROC[4].emplace_back(chargeTot);
 
  373    chargeMaxROC[4].emplace_back(chargeMax);
 
  377      excludeClVector.emplace_back(0); 
 
  378      regionVector.emplace_back(region);
 
  379      rowIndexVector.emplace_back(rowIndex);
 
  380      padVector.emplace_back(pad);
 
  381      sectorVector.emplace_back(sectorIndex);
 
  382      stackVector.emplace_back(stackNumber);
 
  383      localXVector.emplace_back(localX);
 
  384      localYVector.emplace_back(localY);
 
  385      offsPadVector.emplace_back(offsPad);
 
  386      trackVector.emplace_back(track);
 
  387      clVector.emplace_back(cl);
 
  389      isClusterShared.emplace_back(isShared);
 
  391      topologyCorrVector.emplace_back(effectiveLength);
 
  392      topologyCorrTotVector.emplace_back(effectiveLengthTot);
 
  393      topologyCorrMaxVector.emplace_back(effectiveLengthMax);
 
  394      gainVector.emplace_back(gain);
 
  395      gainResidualVector.emplace_back(gainResidual);
 
  396      residualCorrTotVector.emplace_back(corrTot);
 
  397      residualCorrMaxVector.emplace_back(corrMax);
 
  398      scCorrVector.emplace_back(scCorr);
 
  403  output.NHitsSubThresholdIROC = nClsROC[0];
 
  404  output.NHitsSubThresholdOROC1 = nClsROC[1];
 
  405  output.NHitsSubThresholdOROC2 = nClsROC[2];
 
  406  output.NHitsSubThresholdOROC3 = nClsROC[3];
 
  409  if (minChargeTot <= mMinChargeTotThreshold && minChargeMax <= mMinChargeMaxThreshold) {
 
  410    output.NHitsIROC = nClsROC[0] - nClsSubThreshROC[0];
 
  411    output.NHitsOROC1 = nClsROC[1] - nClsSubThreshROC[1];
 
  412    output.NHitsOROC2 = nClsROC[2] - nClsSubThreshROC[2];
 
  413    output.NHitsOROC3 = nClsROC[3] - nClsSubThreshROC[3];
 
  417      fillMissingClusters(nClsSubThreshROC, minChargeTot, minChargeMax, subthresholdMethod, chargeTotROC, chargeMaxROC);
 
  420    output.NHitsIROC = nClsROC[0];
 
  421    output.NHitsOROC1 = nClsROC[1];
 
  422    output.NHitsOROC2 = nClsROC[2];
 
  423    output.NHitsOROC3 = nClsROC[3];
 
  427  auto chargeTotVector = mDebug ? chargeTotROC[4] : std::vector<float>();
 
  428  auto chargeMaxVector = mDebug ? chargeMaxROC[4] : std::vector<float>();
 
  445    if (mStreamer == 
nullptr) {
 
  449    (*mStreamer) << 
"dEdxDebug" 
  451                 << 
"excludeClVector=" << excludeClVector
 
  452                 << 
"regionVector=" << regionVector
 
  453                 << 
"rowIndexVector=" << rowIndexVector
 
  454                 << 
"padVector=" << padVector
 
  455                 << 
"sectorVector=" << sectorVector
 
  456                 << 
"stackVector=" << stackVector
 
  457                 << 
"topologyCorrVector=" << topologyCorrVector
 
  458                 << 
"topologyCorrTotVector=" << topologyCorrTotVector
 
  459                 << 
"topologyCorrMaxVector=" << topologyCorrMaxVector
 
  460                 << 
"gainVector=" << gainVector
 
  461                 << 
"gainResidualVector=" << gainResidualVector
 
  462                 << 
"residualCorrTotVector=" << residualCorrTotVector
 
  463                 << 
"residualCorrMaxVector=" << residualCorrMaxVector
 
  464                 << 
"scCorrVector=" << scCorrVector
 
  465                 << 
"localXVector=" << localXVector
 
  466                 << 
"localYVector=" << localYVector
 
  467                 << 
"offsPadVector=" << offsPadVector
 
  468                 << 
"trackVector=" << trackVector
 
  469                 << 
"clVector=" << clVector
 
  470                 << 
"minChargeTot=" << minChargeTot
 
  471                 << 
"minChargeMax=" << minChargeMax
 
  473                 << 
"occupancy=" << occupancyVector
 
  474                 << 
"chargeTotVector=" << chargeTotVector
 
  475                 << 
"chargeMaxVector=" << chargeMaxVector
 
  476                 << 
"isClusterShared=" << isClusterShared