17#include <fmt/format.h>
30 const unsigned int switchAfterTB = getLastTimeBinForSwitch();
34 if (switchAfterTB == (mIntegrationIntervalsPerTF - 1) * mTimeStampsPerIntegrationInterval) {
39 for (
auto& idcs : mIDCs[mBufferIndex]) {
40 idcs.resize(idcs.capacity());
45 for (
const auto& digit :
digits) {
47 const unsigned int region = cru.
region();
48 const int timeStamp = digit.getTimeStamp();
49 if (timeStamp < switchAfterTB) {
50 const unsigned int indexPad = getIndex(timeStamp, region, digit.getRow(), digit.getPad());
51 mIDCs[mBufferIndex][region][indexPad] += digit.getChargeFloat();
53 const unsigned int indexPad = getIndex(timeStamp - switchAfterTB, region, digit.getRow(), digit.getPad());
54 mIDCs[!mBufferIndex][region][indexPad] += digit.getChargeFloat();
59 const float norm = 1. /
float(mTimeStampsPerIntegrationInterval);
60 for (
auto& idc : mIDCs[mBufferIndex]) {
61 std::transform(idc.begin(), idc.end(), idc.begin(), [norm](
float&
val) { return val * norm; });
64 mBufferIndex = !mBufferIndex;
68unsigned int o2::tpc::IDCSim::getLastTimeBinForSwitch()
const
70 const int totaloffs = mTimeBinsOff +
static_cast<int>(mTimeStampsRemainder);
71 return (totaloffs >= mTimeStampsPerIntegrationInterval) ? mIntegrationIntervalsPerTF * mTimeStampsPerIntegrationInterval - mTimeBinsOff : (mIntegrationIntervalsPerTF - mAddInterval) * mTimeStampsPerIntegrationInterval - mTimeBinsOff;
74void o2::tpc::IDCSim::setNewOffset()
76 const int totaloffs = mTimeBinsOff +
static_cast<int>(mTimeStampsRemainder);
77 mTimeBinsOff = (totaloffs >= mTimeStampsPerIntegrationInterval) ? (totaloffs -
static_cast<int>(mTimeStampsPerIntegrationInterval)) : totaloffs;
81void o2::tpc::IDCSim::resetIDCs()
83 for (
auto& idcs : mIDCs[!mBufferIndex]) {
84 std::fill(idcs.begin(), idcs.end(), 0);
90 TFile fOut(outFileName,
"RECREATE");
91 fOut.WriteObject(
this, outName);
99 createDebugTree(*
this, pcstream);
109 for (
TObject* keyAsObj : *fInp.GetListOfKeys()) {
110 const auto key =
dynamic_cast<TKey*
>(keyAsObj);
111 LOGP(info,
"Key name: {} Type: {}",
key->GetName(),
key->GetClassName());
113 if (std::strcmp(o2::tpc::IDCSim::Class()->GetName(),
key->GetClassName()) != 0) {
114 LOGP(info,
"skipping object. wrong class.");
119 createDebugTree(*idcsim, pcstream);
132 for (
const auto& idcs : idcsim.get()) {
135 unsigned int region = cruTmp.region();
137 std::vector<int> vRow(padsPerCRU);
138 std::vector<int> vPad(padsPerCRU);
139 std::vector<float> vXPos(padsPerCRU);
140 std::vector<float> vYPos(padsPerCRU);
141 std::vector<float> vGlobalXPos(padsPerCRU);
142 std::vector<float> vGlobalYPos(padsPerCRU);
143 std::vector<float> idcsPerTimeBin(padsPerCRU);
145 for (
unsigned int iPad = 0; iPad < padsPerCRU; ++iPad) {
147 const auto& padPosLocal = mapper.
padPos(globalNum);
148 vRow[iPad] = padPosLocal.getRow();
149 vPad[iPad] = padPosLocal.getPad();
153 vGlobalXPos[iPad] = globalPos.X();
154 vGlobalYPos[iPad] = globalPos.Y();
158 for (
unsigned int iPad = 0; iPad < padsPerCRU; ++iPad) {
164 <<
"sector=" << sectorTmp
165 <<
"region=" << region
166 <<
"integrationInterval=" << integrationInterval
167 <<
"IDC.=" << idcsPerTimeBin
172 <<
"gx.=" << vGlobalXPos
173 <<
"gy.=" << vGlobalYPos
184 poly->SetContour(255);
185 poly->SetTitle(
nullptr);
186 poly->GetYaxis()->SetTickSize(0.002f);
187 poly->GetYaxis()->SetTitleOffset(0.7f);
188 poly->GetZaxis()->SetTitleOffset(1.3f);
191 TCanvas* can =
new TCanvas(
"can",
"can", 2000, 1400);
192 can->SetRightMargin(0.14f);
193 can->SetLeftMargin(0.06f);
194 can->SetTopMargin(0.04f);
209 const float idc = mIDCs[!mBufferIndex][region][indexIDC];
210 poly->Fill(xPos, yPos, idc);
211 lat.SetTextAlign(12);
212 lat.DrawLatex(xPos, yPos, Form(
"%i", ipad));
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X coordinate
configStandalone Reconstruction rec_tpc float
class for integration of IDCs
unsigned char region() const
void createDebugTree(const char *nameTree) const
unsigned int getNIntegrationIntervalsPerTF() const
unsigned int getSector() const
void integrateDigitsForOneTF(const gsl::span< const o2::tpc::Digit > &digits)
void dumpIDCs(const char *outFileName, const char *outName="IDCSim") const
void drawIDCs(const unsigned int integrationInterval=0, const std::string filename="IDCs.pdf") const
static void createDebugTreeForAllSectors(const char *nameTree, const char *filename)
static GlobalPadNumber getGlobalPadNumber(const unsigned int lrow, const unsigned int pad, const unsigned int region)
const PadPos & padPos(GlobalPadNumber padNumber) const
static const std::vector< unsigned int > PADSPERROW[NREGIONS]
number of pads per row in region
static const std::vector< unsigned int > OFFSETCRULOCAL[NREGIONS]
row offset in cru for given local pad row
static constexpr unsigned int GLOBALPADOFFSET[NREGIONS]
offset of number of pads for region
static Mapper & instance(const std::string mappingDir="")
static constexpr unsigned int ROWSPERREGION[NREGIONS]
number of pad rows for region
static constexpr unsigned int NREGIONS
total number of regions in one sector
static GlobalPosition3D LocalToGlobal(const LocalPosition3D &pos, const double alpha)
static constexpr unsigned int PADSPERREGION[NREGIONS]
number of pads per CRU
GlobalPosition2D getPadCentre(const PadSecPos &padSec) const
GLsizei const GLubyte GLsizei GLenum const void * coords
math_utils::Point2D< float > LocalPosition2D
unsigned short GlobalPadNumber
global pad number
math_utils::Point2D< float > GlobalPosition2D
static TH2Poly * makeSectorHist(const std::string_view name="hSector", const std::string_view title="Sector;local #it{x} (cm);local #it{y} (cm)", const float xMin=83.65f, const float xMax=247.7f, const float yMin=-43.7f, const float yMax=43.7f, const Type type=Type::Pad, std::string binningStr="")
static std::vector< PadCoordinates > getPadCoordinatesSector()
create a vector of pad corner coordinate for one full sector
std::vector< Digit > digits