Skip to content

Commit 8c47460

Browse files
developing digitizer, added chips
1 parent e85b558 commit 8c47460

6 files changed

Lines changed: 38 additions & 20 deletions

File tree

Detectors/Upgrades/ALICE3/IOTOF/DataFormatsIOTOF/include/DataFormatsIOTOF/Digit.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ class Digit : public o2::itsmft::Digit
3737
// Getters
3838
double getTime() const { return mTime; }
3939

40+
static UInt_t getOrderingKey(UShort_t chipindex, UShort_t row, UShort_t col)
41+
{
42+
return (static_cast<UInt_t>(chipindex) << 16) | (static_cast<UInt_t>(row) << 8) | static_cast<UInt_t>(col);
43+
}
44+
4045
private:
4146
double mTime = 0.; ///< Measured time (ns)
4247
ClassDefNV(Digit, 1);

Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/GeometryTGeo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,29 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
3333
static const char* getIOTOFVolPattern() { return sIOTOFVolumeName.c_str(); }
3434

3535
// Inner TOF
36+
const int getITOFNumberOfChips() { return mNumberOfChipsIOTOF[0]; }
3637
static const char* getITOFLayerPattern() { return sITOFLayerName.c_str(); }
3738
static const char* getITOFStavePattern() { return sITOFStaveName.c_str(); }
3839
static const char* getITOFModulePattern() { return sITOFModuleName.c_str(); }
3940
static const char* getITOFChipPattern() { return sITOFChipName.c_str(); }
4041
static const char* getITOFSensorPattern() { return sITOFSensorName.c_str(); }
4142

4243
// Outer TOF
44+
const int getOTOFNumberOfChips() { return mNumberOfChipsIOTOF[1]; }
4345
static const char* getOTOFLayerPattern() { return sOTOFLayerName.c_str(); }
4446
static const char* getOTOFStavePattern() { return sOTOFStaveName.c_str(); }
4547
static const char* getOTOFModulePattern() { return sOTOFModuleName.c_str(); }
4648
static const char* getOTOFChipPattern() { return sOTOFChipName.c_str(); }
4749
static const char* getOTOFSensorPattern() { return sOTOFSensorName.c_str(); }
4850

4951
// Forward TOF
52+
const int getFTOFNumberOfChips() { return mNumberOfChipsFTOF; }
5053
static const char* getFTOFLayerPattern() { return sFTOFLayerName.c_str(); }
5154
static const char* getFTOFChipPattern() { return sFTOFChipName.c_str(); }
5255
static const char* getFTOFSensorPattern() { return sFTOFSensorName.c_str(); }
5356

5457
// Backward TOF
58+
const int getBTOFNumberOfChips() { return mNumberOfChipsBTOF; }
5559
static const char* getBTOFLayerPattern() { return sBTOFLayerName.c_str(); }
5660
static const char* getBTOFChipPattern() { return sBTOFChipName.c_str(); }
5761
static const char* getBTOFSensorPattern() { return sBTOFSensorName.c_str(); }

Detectors/Upgrades/ALICE3/IOTOF/base/src/GeometryTGeo.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ void GeometryTGeo::fillMatrixCache(int mask)
273273
return;
274274
}
275275

276+
LOG(debug) << "Filling matrix cache for " << getName() << " with mask " << mask;
277+
276278
if ((mask & o2::math_utils::bit2Mask(o2::math_utils::TransformType::L2G)) && !getCacheL2G().isFilled()) {
277279
// Matrices for Local (Sensor!!! rather than the full chip) to Global frame transformation
278280
LOG(info) << "Loading " << getName() << " L2G matrices from TGeo; there are " << mSize << " matrices";

Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID)
107107
uint16_t chipIndex = static_cast<uint16_t>(detID);
108108

109109
if (detID > mGeometry->getSize() || mGeometry->getSize() < 1) {
110-
LOG(debug) << "Invalid detector ID: " << detID;
110+
LOG(debug) << "Invalid detector ID: " << detID << ", geometry size: " << mGeometry->getSize();
111111
return; // invalid detector ID
112112
}
113113
const auto& matrix = mGeometry->getMatrixL2G(hit.GetDetectorID());

Detectors/Upgrades/ALICE3/IOTOF/workflow/src/DigitWriterSpec.cxx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "IOTOFWorkflow/DigitWriterSpec.h"
1515
#include "DPLUtils/MakeRootTreeWriterSpec.h"
16-
#include "DataFormatsITSMFT/Digit.h"
16+
#include "DataFormatsIOTOF/Digit.h"
1717
#include "DataFormatsITSMFT/GBTCalibData.h"
1818
#include "Headers/DataHeader.h"
1919
#include "DetectorsCommonDataFormats/DetID.h"
@@ -45,7 +45,7 @@ DataProcessorSpec getDigitWriterSpec(bool mctruth, bool dec, bool calib, o2::hea
4545
std::string detStrL = dec ? "o2_" : ""; // for decoded digits prepend by o2
4646
detStrL += detStr;
4747
std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower);
48-
auto logger = [](std::vector<o2::itsmft::Digit> const& inDigits) {
48+
auto logger = [](std::vector<o2::iotof::Digit> const& inDigits) {
4949
LOG(info) << "RECEIVED DIGITS SIZE " << inDigits.size();
5050
};
5151

@@ -85,20 +85,21 @@ DataProcessorSpec getDigitWriterSpec(bool mctruth, bool dec, bool calib, o2::hea
8585
MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Digits tree"},
8686
MakeRootTreeWriterSpec::CustomClose(finishWriting),
8787
// in case of labels we first read them as std::vector<char> and process them correctly in the fillLabels hook
88-
BranchDefinition<std::vector<char>>{InputSpec{"digitsMCTR", detOrig, "DIGITSMCTR", 0},
89-
(detStr + "DigitMCTruth").c_str(),
90-
(mctruth ? 1 : 0), fillLabels},
91-
BranchDefinition<std::vector<itsmft::MC2ROFRecord>>{InputSpec{"digitsMC2ROF", detOrig, "DIGITSMC2ROF", 0},
92-
(detStr + "DigitMC2ROF").c_str(),
93-
(mctruth ? 1 : 0)},
94-
BranchDefinition<std::vector<itsmft::Digit>>{InputSpec{"digits", detOrig, "DIGITS", 0},
88+
//BranchDefinition<std::vector<char>>{InputSpec{"digitsMCTR", detOrig, "DIGITSMCTR", 0},
89+
// (detStr + "DigitMCTruth").c_str(),
90+
// (mctruth ? 1 : 0), fillLabels},
91+
//BranchDefinition<std::vector<itsmft::MC2ROFRecord>>{InputSpec{"digitsMC2ROF", detOrig, "DIGITSMC2ROF", 0},
92+
// (detStr + "DigitMC2ROF").c_str(),
93+
// (mctruth ? 1 : 0)},
94+
BranchDefinition<std::vector<iotof::Digit>>{InputSpec{"digits", detOrig, "DIGITS", 0},
9595
(detStr + "Digit").c_str(),
96-
logger},
96+
logger} //,
9797
// BranchDefinition<std::vector<itsmft::GBTCalibData>>{InputSpec{"calib", detOrig, "GBTCALIB", 0},
9898
// (detStr + "Calib").c_str(),
9999
// (calib ? 1 : 0)},
100-
BranchDefinition<std::vector<itsmft::ROFRecord>>{InputSpec{"digitsROF", detOrig, "DIGITSROF", 0},
101-
(detStr + "DigitROF").c_str()})();
100+
//BranchDefinition<std::vector<itsmft::ROFRecord>>{InputSpec{"digitsROF", detOrig, "DIGITSROF", 0},
101+
// (detStr + "DigitROF").c_str()}
102+
)();
102103
}
103104

104105
DataProcessorSpec getIOTOFDigitWriterSpec(bool mctruth, bool dec, bool calib)

Steer/DigitizerWorkflow/src/IOTOFDigitizerSpec.cxx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "IOTOFSimulation/Digitizer.h"
3030
#include "Headers/DataHeader.h"
3131
#include "IOTOFBase/GeometryTGeo.h"
32+
#include "IOTOFBase/IOTOFBaseParam.h"
3233

3334
#include <TChain.h>
3435
#include <TStopwatch.h>
@@ -53,8 +54,10 @@ class IOTOFDPLDigitizerTask : o2::base::BaseDPLDigitizer
5354
void initDigitizerTask(framework::InitContext& ic) override
5455
{
5556
mDisableQED = ic.options().get<bool>("disable-qed");
57+
5658
auto geom = GeometryTGeo::Instance();
5759
geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::L2G)); // make sure L2G matrices are loaded
60+
5861
mDigitizer.setGeometry(geom);
5962
mDigitizer.setChargeThreshold(-1000.f);
6063
mDigitizer.init();
@@ -85,8 +88,6 @@ class IOTOFDPLDigitizerTask : o2::base::BaseDPLDigitizer
8588
timer.Start();
8689
LOG(info) << " CALLING TF3 DIGITIZATION ";
8790

88-
uint64_t nDigits{0};
89-
9091
mDigitizer.setDigits(&mDigits);
9192
mDigitizer.setROFRecords(&mROFRecords);
9293
if (mWithMCTruth) {
@@ -111,7 +112,7 @@ class IOTOFDPLDigitizerTask : o2::base::BaseDPLDigitizer
111112
context->retrieveHits(mSimChains, o2::detectors::SimTraits::DETECTORBRANCHNAMES[mID][0].c_str(), part.sourceID, part.entryID, &mHits);
112113

113114
if (mHits.size() > 0) {
114-
mDigits.clear();
115+
//mDigits.clear();
115116
if (mWithMCTruth) {
116117
mLabels.clear();
117118
}
@@ -122,26 +123,31 @@ class IOTOFDPLDigitizerTask : o2::base::BaseDPLDigitizer
122123
}
123124
}
124125
if (mDigitizer.isContinuous()) {
125-
mDigits.clear();
126+
//mDigits.clear();
126127
if (mWithMCTruth) {
127128
mLabels.clear();
128129
}
129130
mDigitizer.fillOutputContainer();
130131
}
131132

133+
for (int iDigit = 0; iDigit < mDigits.size(); iDigit++) {
134+
mROFRecords.emplace_back();
135+
}
136+
132137
// here we have all digits and we can send them to consumer (aka snapshot it onto output)
138+
139+
LOG(debug) << "Digitization finished with " << mDigits.size() << " digits and " << mROFRecords.size() << " ROF records";
133140
pc.outputs().snapshot(Output{mOrigin, "DIGITS", 0}, mDigits);
134-
pc.outputs().snapshot(Output{mOrigin, "DIGITSROF"}, mROFRecords);
141+
//pc.outputs().snapshot(Output{mOrigin, "DIGITSROF", 0}, mROFRecords);
135142
if (mWithMCTruth) {
136143
//
137144
}
138145

139146
LOG(info) << mID.getName() << ": Sending ROMode= " << mROMode << " to GRPUpdater";
140-
pc.outputs().snapshot(Output{mOrigin, "ROMode", 0}, mROMode);
147+
//pc.outputs().snapshot(Output{mOrigin, "ROMode", 0}, mROMode);
141148

142149
timer.Stop();
143150
LOG(info) << "Digitization took " << timer.CpuTime() << "s";
144-
LOG(info) << "Produced " << nDigits << " digits";
145151

146152
// we should be only called once; tell DPL that this process is ready to exit
147153
pc.services().get<ControlService>().readyToQuit(QuitRequest::Me);

0 commit comments

Comments
 (0)