Skip to content

Commit 2fb2515

Browse files
wiechulashahor02
authored andcommitted
TPC: generalize cluster QC
* move Krcluster to DataFormatsTPC * modify cluster QC to accept ClusterNative and KrCluster as input
1 parent 7f869cc commit 2fb2515

12 files changed

Lines changed: 36 additions & 18 deletions

File tree

DataFormats/Detectors/TPC/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ o2_target_root_dictionary(
4141
include/DataFormatsTPC/ClusterHardware.h
4242
include/DataFormatsTPC/Digit.h
4343
include/DataFormatsTPC/Helpers.h
44+
include/DataFormatsTPC/KrCluster.h
4445
include/DataFormatsTPC/TrackTPC.h
4546
include/DataFormatsTPC/LaserTrack.h
4647
include/DataFormatsTPC/Constants.h

DataFormats/Detectors/TPC/include/DataFormatsTPC/ClusterNative.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ struct ClusterNative {
8282
setTimePackedFlags(time, flags);
8383
}
8484

85+
GPUd() uint16_t getQmax() const { return qMax; }
86+
GPUd() uint16_t getQtot() const { return qTot; }
8587
GPUd() uint8_t getFlags() const { return timeFlagsPacked >> 24; }
8688
GPUd() uint32_t getTimePacked() const { return timeFlagsPacked & 0xFFFFFF; }
8789
GPUd() void setTimePackedFlags(uint32_t timePacked, uint8_t flags)

Detectors/TPC/reconstruction/include/TPCReconstruction/KrCluster.h renamed to DataFormats/Detectors/TPC/include/DataFormatsTPC/KrCluster.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#ifndef ALICEO2_TPC_KrCluster_H_
1717
#define ALICEO2_TPC_KrCluster_H_
1818

19+
#include "Rtypes.h"
20+
1921
namespace o2
2022
{
2123
namespace tpc
@@ -33,8 +35,15 @@ struct KrCluster {
3335
float meanRow = 0; ///< Center of gravity (Row number)
3436
float sigmaPad = 0; ///< RMS of cluster in pad direction
3537
float sigmaRow = 0; ///< RMS of cluster in row direction
36-
double meanTime = 0; ///< Center of gravity (Time)
37-
double sigmaTime = 0; ///< RMS of cluster in time direction
38+
float meanTime = 0; ///< Center of gravity (Time)
39+
float sigmaTime = 0; ///< RMS of cluster in time direction
40+
41+
float getQmax() const { return maxCharge; }
42+
float getQtot() const { return totCharge; }
43+
float getPad() const { return meanPad; }
44+
float getSigmaPad() const { return sigmaPad; }
45+
float getTime() const { return meanTime; }
46+
float getSigmaTime() const { return sigmaTime; }
3847

3948
/// Used to set all Cluster variables to zero.
4049
void reset()
@@ -53,7 +62,7 @@ struct KrCluster {
5362
sigmaTime = 0;
5463
}
5564

56-
ClassDefNV(KrCluster, 3);
65+
ClassDefNV(KrCluster, 4);
5766
};
5867

5968
} // namespace tpc

DataFormats/Detectors/TPC/src/DataFormatsTPCLinkDef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,7 @@
5151
#pragma link C++ class o2::ctf::EncodedBlocks < o2::tpc::CTFHeader, 23, uint32_t> + ;
5252
#pragma link C++ enum o2::tpc::StatisticsType;
5353
#pragma link C++ class o2::tpc::TrackCuts + ;
54+
#pragma link C++ class o2::tpc::KrCluster + ;
55+
#pragma link C++ class std::vector<o2::tpc::KrCluster> + ;
5456

5557
#endif

Detectors/TPC/qc/include/TPCQC/Clusters.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class Clusters
4242
public:
4343
Clusters() = default;
4444

45-
bool processCluster(const o2::tpc::ClusterNative& cluster, const o2::tpc::Sector sector, const int row);
45+
template <class T>
46+
bool processCluster(const T& cluster, const o2::tpc::Sector sector, const int row);
4647

4748
void fillADCValue(int cru, int rowInSector, int padInRow, int timeBin, float adcValue);
4849

Detectors/TPC/qc/src/Clusters.cxx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,26 @@
2121
#include "TPCBase/CRU.h"
2222
#include "TPCBase/Mapper.h"
2323
#include "DataFormatsTPC/ClusterNative.h"
24+
#include "DataFormatsTPC/KrCluster.h"
2425

2526
ClassImp(o2::tpc::qc::Clusters);
2627

2728
using namespace o2::tpc::qc;
2829

2930
//______________________________________________________________________________
30-
bool Clusters::processCluster(const o2::tpc::ClusterNative& cluster, const o2::tpc::Sector sector, const int row)
31+
template <class T>
32+
bool Clusters::processCluster(const T& cluster, const o2::tpc::Sector sector, const int row)
3133
{
3234
const int nROC = row < 63 ? int(sector) : int(sector) + 36;
3335
const int rocRow = row < 63 ? row : row - 63;
3436

3537
const float pad = cluster.getPad();
3638

37-
const uint16_t qMax = cluster.qMax;
38-
const uint16_t qTot = cluster.qTot;
39-
const float sigmaPad = cluster.getSigmaPad();
40-
const float sigmaTime = cluster.getSigmaTime();
41-
const float timeBin = cluster.getTime();
39+
const auto qMax = cluster.getQmax();
40+
const auto qTot = cluster.getQtot();
41+
const auto sigmaPad = cluster.getSigmaPad();
42+
const auto sigmaTime = cluster.getSigmaTime();
43+
const auto timeBin = cluster.getTime();
4244

4345
float count = mNClusters.getCalArray(nROC).getValue(rocRow, pad);
4446
mNClusters.getCalArray(nROC).setValue(rocRow, pad, count + 1);
@@ -113,3 +115,7 @@ void Clusters::dumpToFile(std::string filename)
113115
g->WriteObject(&mTimeBin, mTimeBin.getName().data());
114116
g->Close();
115117
}
118+
119+
// ===| explicit instantiations |===============================================
120+
template bool Clusters::processCluster<o2::tpc::ClusterNative>(const o2::tpc::ClusterNative&, const o2::tpc::Sector, const int);
121+
template bool Clusters::processCluster<o2::tpc::KrCluster>(const o2::tpc::KrCluster&, const o2::tpc::Sector, const int);

Detectors/TPC/reconstruction/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ o2_target_root_dictionary(
4949
include/TPCReconstruction/HwClustererParam.h
5050
include/TPCReconstruction/KrBoxClusterFinder.h
5151
include/TPCReconstruction/KrBoxClusterFinderParam.h
52-
include/TPCReconstruction/KrCluster.h
5352
include/TPCReconstruction/RawReader.h
5453
include/TPCReconstruction/RawReaderCRU.h
5554
include/TPCReconstruction/RawReaderEventSync.h

Detectors/TPC/reconstruction/include/TPCReconstruction/KrBoxClusterFinder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
#define ALICEO2_TPC_KrBoxClusterFinder_H_
7777

7878
#include "DataFormatsTPC/Digit.h"
79-
#include "TPCReconstruction/KrCluster.h"
79+
#include "DataFormatsTPC/KrCluster.h"
8080
#include "TPCReconstruction/KrBoxClusterFinderParam.h"
8181

8282
#include "TPCBase/Mapper.h"

Detectors/TPC/reconstruction/macro/findKrBoxCluster.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "TFile.h"
1919
#include "TTree.h"
2020

21-
#include "TPCReconstruction/KrCluster.h"
21+
#include "DataFormatsTPC/KrCluster.h"
2222
#include "TPCReconstruction/KrBoxClusterFinder.h"
2323
#include "DataFormatsTPC/Digit.h"
2424

Detectors/TPC/reconstruction/src/TPCReconstructionLinkDef.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#pragma link C++ class o2::tpc::SyncPatternMonitor + ;
2929
#pragma link C++ class o2::tpc::HardwareClusterDecoder + ;
3030
#pragma link C++ class o2::tpc::KrBoxClusterFinder + ;
31-
#pragma link C++ class o2::tpc::KrCluster + ;
32-
#pragma link C++ class std::vector<o2::tpc::KrCluster> + ;
3331

3432
#pragma link C++ class o2::tpc::Clusterer + ;
3533
#pragma link C++ class o2::tpc::ClustererTask + ;

0 commit comments

Comments
 (0)