30 LOG(info) <<
"Number of common topologies: " <<
mCommonMap.size();
31 LOG(info) <<
"Number of groups of rare topologies: " <<
mGroupMap.size();
46 LOG(info) <<
"ITS3 TopologyDictionary";
47 LOG(info) <<
"InnerBarrel";
49 LOG(info) <<
"OuterBarrel";
63 auto&
data = (IB) ? mDataIB : mDataOB;
64 data.mCommonMap.clear();
65 data.mGroupMap.clear();
71 os <<
"--- InnerBarrel:\n";
73 os <<
"ID: " <<
ID++ <<
" Hash: " << p.mHash <<
" ErrX: " << p.mErrX <<
" ErrZ : " << p.mErrZ <<
" xCOG: " << p.mXCOG <<
" zCOG: " << p.mZCOG <<
" Npixles: " << p.mNpixels <<
" Frequency: " << p.mFrequency <<
" isGroup : " << std::boolalpha << p.mIsGroup <<
'\n'
75 <<
"*********************************************************" <<
'\n'
79 os <<
"--- OuterBarrel:\n";
81 os <<
"ID: " <<
ID++ <<
" Hash: " << p.mHash <<
" ErrX: " << p.mErrX <<
" ErrZ : " << p.mErrZ <<
" xCOG: " << p.mXCOG <<
" zCOG: " << p.mZCOG <<
" Npixles: " << p.mNpixels <<
" Frequency: " << p.mFrequency <<
" isGroup : " << std::boolalpha << p.mIsGroup <<
'\n'
83 <<
"*********************************************************" <<
'\n'
91 std::ofstream file_output(outputfile, std::ios::out | std::ios::binary);
93 throw std::runtime_error(fmt::format(
"Cannot open output file %s!", outputfile));
96 auto writeData = [](
auto& file_output,
auto&
data) {
97 auto size =
data.mVectorOfIDs.size();
98 file_output.write(
reinterpret_cast<char*
>(&
size),
sizeof(
size));
99 for (
auto& p :
data.mVectorOfIDs) {
100 file_output.write(
reinterpret_cast<char*
>(&p.mHash),
sizeof(
unsigned long));
101 file_output.write(
reinterpret_cast<char*
>(&p.mErrX),
sizeof(
float));
102 file_output.write(
reinterpret_cast<char*
>(&p.mErrZ),
sizeof(
float));
103 file_output.write(
reinterpret_cast<char*
>(&p.mErr2X),
sizeof(
float));
104 file_output.write(
reinterpret_cast<char*
>(&p.mErr2Z),
sizeof(
float));
105 file_output.write(
reinterpret_cast<char*
>(&p.mXCOG),
sizeof(
float));
106 file_output.write(
reinterpret_cast<char*
>(&p.mZCOG),
sizeof(
float));
107 file_output.write(
reinterpret_cast<char*
>(&p.mNpixels),
sizeof(int));
108 file_output.write(
reinterpret_cast<char*
>(&p.mFrequency),
sizeof(double));
109 file_output.write(
reinterpret_cast<char*
>(&p.mIsGroup),
sizeof(
bool));
110 file_output.write(
const_cast<char*
>(
reinterpret_cast<const char*
>(&p.mPattern.getPattern())),
115 writeData(file_output, mDataIB);
116 writeData(file_output, mDataOB);
123 LOGP(info,
"Reading TopologyDictionary from File '{}'", fname);
125 std::unique_ptr<TopologyDictionary>
d{
loadFrom(fname)};
130 throw std::runtime_error(fmt::format(
"Unrecognized format {}", fname));
138 std::ifstream in(fname.data(), std::ios::in | std::ios::binary);
140 LOG(
error) <<
"The file " << fname <<
" coud not be opened";
141 throw std::runtime_error(
"The file coud not be opened");
146 std::size_t
size{}, cur{};
148 in.read(
reinterpret_cast<char*
>(&
size),
sizeof(std::size_t));
149 while (cur++ !=
size) {
150 in.read(
reinterpret_cast<char*
>(&gr.
mHash),
sizeof(
unsigned long));
151 in.read(
reinterpret_cast<char*
>(&gr.
mErrX),
sizeof(
float));
152 in.read(
reinterpret_cast<char*
>(&gr.
mErrZ),
sizeof(
float));
153 in.read(
reinterpret_cast<char*
>(&gr.
mErr2X),
sizeof(
float));
154 in.read(
reinterpret_cast<char*
>(&gr.
mErr2Z),
sizeof(
float));
155 in.read(
reinterpret_cast<char*
>(&gr.
mXCOG),
sizeof(
float));
156 in.read(
reinterpret_cast<char*
>(&gr.
mZCOG),
sizeof(
float));
157 in.read(
reinterpret_cast<char*
>(&gr.
mNpixels),
sizeof(int));
158 in.read(
reinterpret_cast<char*
>(&gr.
mFrequency),
sizeof(double));
159 in.read(
reinterpret_cast<char*
>(&gr.
mIsGroup),
sizeof(
bool));
161 data.mVectorOfIDs.push_back(gr);
163 data.mCommonMap.insert(std::make_pair(gr.
mHash, groupID));
168 data.mGroupMap.insert(std::make_pair((
int)(gr.
mHash >> 32) & 0x00000000ffffffff, groupID));
183 auto* histo =
new TH1F(hname.data(), Form(
"%s;Topology ID;Frequency", (IB) ?
"InnerBarrel" :
"OuterBarrel"), dictSize, -0.5, dictSize - 0.5);
184 histo->SetFillColor(kRed);
185 histo->SetFillStyle(3005);
186 histo->SetDrawOption(
"histo");
187 for (
int i = 0;
i < dictSize;
i++) {
196 static std::array<o2::its3::SegmentationMosaix, 3> mIBSegmentations{0, 1, 2};
197 math_utils::Point3D<T> locCl;
204 mIBSegmentations[
layer].detectorToLocalUnchecked(cl.
getRow(), cl.
getCol(), locCl);
206 locCl.SetY(its3::constants::pixelarray::pixels::apts::responseYShift);
208 float xCurved{0.f}, yCurved{0.f};
209 mIBSegmentations[
layer].flatToCurved(locCl.X(), locCl.Y(), xCurved, yCurved);
210 locCl.SetXYZ(xCurved, yCurved, locCl.Z());
218 static std::array<o2::its3::SegmentationMosaix, 3> mIBSegmentations{0, 1, 2};
219 auto refRow = cl.
getRow();
220 auto refCol = cl.
getCol();
221 float xCOG = 0, zCOG = 0;
224 refRow -= round(xCOG);
225 refCol -= round(zCOG);
227 math_utils::Point3D<T> locCl;
232 mIBSegmentations[
layer].detectorToLocalUnchecked(refRow + xCOG, refCol + zCOG, locCl);
233 float xCurved{0.f}, yCurved{0.f};
234 mIBSegmentations[
layer].flatToCurved(locCl.X(), locCl.Y(), xCurved, yCurved);
235 locCl.SetXYZ(xCurved, yCurved, locCl.Z());
242 LOGP(info,
"Loading TopologyDictionary from {} with name {}", fname, objName);
244 TFile fl(fname.c_str(),
"READ");
245 if (fl.IsZombie() || !fl.IsOpen()) {
246 throw std::runtime_error(fmt::format(
"Failed to open {} file", fname));
249 if (dict ==
nullptr) {
250 throw std::runtime_error(fmt::format(
"Failed to load {} from {}", objName, fname));
256template math_utils::Point3D<float> TopologyDictionary::getClusterCoordinates<float>(
const itsmft::CompClusterExt& cl)
const;
258template math_utils::Point3D<double> TopologyDictionary::getClusterCoordinates<double>(
const itsmft::CompClusterExt& cl)
const;
Definition of the BuildTopologyDictionary class for ITS3.
ClassImp(o2::its3::TopologyDictionary)
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc bool
configStandalone Reconstruction rec_tpc float
char error[CURL_ERROR_SIZE]
Definition of the SegmentationAlpide class.
Definition of the SegmentationMosaix class.
static constexpr float PitchCol
static constexpr float PitchRow
void readFromFile(const std::string &fileName)
static TopologyDictionary * loadFrom(const std::string &fileName="", const std::string &objName="ccdb_object")
void reset() noexcept
Resets internal structures.
math_utils::Point3D< T > getClusterCoordinates(const itsmft::CompClusterExt &cl) const
Returns the local position of a compact cluster.
void readBinaryFile(const std::string &fileName)
Reads the dictionary from a binary file.
void print() const noexcept
double getFrequency(int n, bool IB=true) const
Returns the frequency of the n_th element;.
void writeBinaryFile(const std::string &outputFile)
Prints the dictionary in a binary file.
int getSize(bool IB) const
Returns the number of elements in the dicionary;.
bool isGroup(int n, bool IB=true) const
Returns true if the element corresponds to a group of rare topologies.
void resetMaps(bool IB=true) noexcept
TH1F * getTopologyDistribution(const std::string_view hname, bool IB=true) const
Fills a hostogram with the distribution of the IDs.
int getColumnSpan() const
Returns the number of columns.
static int getCOG(int rowSpan, int colSpan, const unsigned char patt[MaxPatternBytes], float &xCOG, float &zCOG)
Static: Compute pattern's COG position. Returns the number of fired pixels.
static constexpr int kExtendedPatternBytes
Maximum number of bytes for the cluster puttern + 2 bytes respectively for the number of rows and col...
unsigned char getByte(int n) const
Returns a specific byte of the pattern.
const std::array< unsigned char, kExtendedPatternBytes > & getPattern() const
Returns the pattern.
int getUsedBytes() const
Returns the number of bytes used for the pattern.
UShort_t getSensorID() const
UShort_t getPatternID() const
static void detectorToLocalUnchecked(L row, L col, T &xRow, T &zCol)
static constexpr float PitchCol
static constexpr float PitchRow
GLenum GLuint GLint GLint layer
T getDetID2Layer(T detID)
std::ostream & operator<<(std::ostream &os, const BuildTopologyDictionary &DB)
void readData(o2::tpc::GBTFrameContainer &container, std::vector< std::ofstream * > &outfiles, int &run, int &done)
std::unordered_map< unsigned long, int > mCommonMap
Map of pair <hash, position in mVectorOfIDs>
void print() const noexcept
std::vector< itsmft::GroupStruct > mVectorOfIDs
Vector of topologies and groups.
std::unordered_map< int, int > mGroupMap
Map of pair <groudID, position in mVectorOfIDs>
std::array< int, STopoSize > mSmallTopologiesLUT
Look-Up Table for the topologies with 1-byte linearised matrix.
Structure containing the most relevant pieces of information of a topology.
float mErrX
Error associated to the hit point in the x direction.
float mErr2X
Squared Error associated to the hit point in the x direction.
float mErrZ
Error associated to the hit point in the z direction.
unsigned long mHash
Hashcode.
float mXCOG
x position of the COG wrt the bottom left corner of the bounding box
int mNpixels
Number of fired pixels.
double mFrequency
Frequency of the topology.
bool mIsGroup
false: common topology; true: group of rare topologies
float mErr2Z
Squared Error associated to the hit point in the z direction.
float mZCOG
z position of the COG wrt the bottom left corner of the bounding box
static bool endsWith(const std::string &s, const std::string &ending)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"