Skip to content

Commit 45ba3a5

Browse files
Dmitri Peresunkoshahor02
authored andcommitted
MCLabels in clusters; Fix to read full raw payload
1 parent 91c0186 commit 45ba3a5

File tree

8 files changed

+9
-254
lines changed

8 files changed

+9
-254
lines changed

DataFormats/Detectors/PHOS/include/DataFormatsPHOS/Cluster.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,10 @@ class Cluster
6464

6565
float getTime() const { return mTime; }
6666

67-
int getLabel() const { return mLabel; } //Index in MCContainer entry
68-
void setLabel(int l) { mLabel = l; }
69-
7067
protected:
7168
char mMulDigit = 0; ///< Digit nultiplicity
7269
char mModule = 0; ///< Module number
7370
char mNExMax = -1; ///< number of (Ex-)maxima before unfolding
74-
int mLabel = -1; ///< Ref to entry in MCTruthContainer with list of labels
7571
float mLocalPosX = 0.; ///< Center of gravity position in local module coordunates (phi direction)
7672
float mLocalPosZ = 0.; ///< Center of gravity position in local module coordunates (z direction)
7773
float mFullEnergy = 0.; ///< full energy of a shower
@@ -82,7 +78,7 @@ class Cluster
8278
float mTime = 0.; ///< Time of the digit with maximal energy deposition
8379
float mDistToBadChannel = 999; ///< Distance to nearest bad crystal
8480

85-
ClassDefNV(Cluster, 1);
81+
ClassDefNV(Cluster, 2);
8682
};
8783
} // namespace phos
8884
} // namespace o2

Detectors/PHOS/reconstruction/src/AltroDecoder.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ void AltroDecoder::readChannels()
6666
int currentpos = 0;
6767
auto& buffer = mRawReader.getPayload().getPayloadWords();
6868

69-
int payloadend = mRCUTrailer.getPayloadSize();
69+
int payloadend = buffer.size() - mRCUTrailer.getTrailerSize(); //mRCUTrailer.getPayloadSize() was not updated in case of merged pages.
7070
while (currentpos < payloadend) {
7171
auto currentword = buffer[currentpos++];
7272
ChannelHeader header = {currentword};
73-
7473
if (header.mMark != 1) {
75-
LOG(ERROR) << "Channel header mark not found";
74+
if (currentword != 0) {
75+
LOG(ERROR) << "Channel header mark not found, header word " << currentword;
76+
}
7677
continue;
7778
}
7879
// starting a new channel

Detectors/PHOS/reconstruction/src/Clusterer.cxx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ void Clusterer::process(gsl::span<const Digit> digits, gsl::span<const TriggerRe
4444
clusters->clear(); //final out list of clusters
4545
trigRec->clear();
4646
cluMC->clear();
47+
mProcessMC = (dmc != nullptr);
4748

4849
for (const auto& tr : dtr) {
4950
mFirstDigitInEvent = tr.getFirstEntry();
@@ -104,9 +105,7 @@ void Clusterer::processCells(gsl::span<const Cell> cells, gsl::span<const Trigge
104105
cluMC->clear();
105106
mProcessMC = (dmc != nullptr);
106107
miCellLabel = 0;
107-
printf("start clustering \n");
108108
for (const auto& tr : ctr) {
109-
printf(" tf=%d, %d \n", tr.getFirstEntry(), tr.getNumberOfObjects());
110109
int firstCellInEvent = tr.getFirstEntry();
111110
int lastCellInEvent = firstCellInEvent + tr.getNumberOfObjects();
112111
int indexStart = clusters->size();
@@ -116,10 +115,8 @@ void Clusterer::processCells(gsl::span<const Cell> cells, gsl::span<const Trigge
116115

117116
if (mBadMap.get() == nullptr) {
118117
if (o2::phos::PHOSSimParams::Instance().mCCDBPath.compare("localtest") == 0) {
119-
mBadMap.reset(new BadChannelMap(1)); // test default map
120-
printf("SetBadMap \n");
118+
mBadMap.reset(new BadChannelMap(1)); // test default map
121119
mCalibParams.reset(new CalibParams(1)); //test calibration map
122-
printf("SetCalib \n");
123120
LOG(INFO) << "No reading BadMap/Calibration from ccdb requested, set default";
124121
} else {
125122
// LOG(INFO) << "Getting BadMap object from ccdb";
@@ -137,22 +134,17 @@ void Clusterer::processCells(gsl::span<const Cell> cells, gsl::span<const Trigge
137134
// // }
138135
}
139136
}
140-
printf("converteing: %d, %d \n", firstCellInEvent, lastCellInEvent);
141-
LOG(INFO) << "Converting ";
142137
convertCellsToDigits(cells, firstCellInEvent, lastCellInEvent);
143138
// Collect digits to clusters
144-
printf("makeClu \n");
145139
makeClusters(mDigits);
146140
// Unfold overlapped clusters
147141
// Split clusters with several local maxima if necessary
148142
if (o2::phos::PHOSSimParams::Instance().mUnfoldClusters) {
149143
makeUnfoldings(mDigits);
150144
}
151-
printf("cluprop \n");
152145

153146
// Calculate properties of collected clusters (Local position, energy, disp etc.)
154147
evalCluProperties(mDigits, clusters, dmc, cluMC);
155-
printf("cdone \n");
156148

157149
LOG(DEBUG) << "Found clusters from " << indexStart << " to " << clusters->size();
158150

@@ -440,7 +432,6 @@ void Clusterer::evalCluProperties(gsl::span<const Digit> digits, std::vector<Clu
440432
auto clu = mClusters.begin();
441433

442434
while (clu != mClusters.end()) {
443-
444435
if (clu->getEnergy() < 1.e-4) { //Marked earlier for removal
445436
++clu;
446437
continue;
@@ -498,7 +489,6 @@ void Clusterer::evalCluProperties(gsl::span<const Digit> digits, std::vector<Clu
498489
}
499490
++ll;
500491
}
501-
clusters->back().setLabel(labelIndex);
502492
labelIndex++;
503493
} // Work with MC
504494
}

Detectors/PHOS/workflow/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
o2_add_library(PHOSWorkflow
1212
SOURCES src/RecoWorkflow.cxx
13-
src/PublisherSpec.cxx
1413
src/ReaderSpec.cxx
1514
src/CellConverterSpec.cxx
1615
src/RawToCellConverterSpec.cxx

Detectors/PHOS/workflow/include/PHOSWorkflow/PublisherSpec.h

Lines changed: 0 additions & 46 deletions
This file was deleted.

Detectors/PHOS/workflow/src/ClusterizerSpec.cxx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,16 @@ void ClusterizerSpec::run(framework::ProcessingContext& ctx)
5353

5454
LOG(DEBUG) << "PHOSClusterizer - run run on cells called";
5555

56-
printf("Getting cells \n");
5756
auto cells = ctx.inputs().get<std::vector<o2::phos::Cell>>("cells");
5857
// auto cells = ctx.inputs().get<gsl::span<o2::phos::Cell>>("cells");
5958
LOG(DEBUG) << "[PHOSClusterizer - run] Received " << cells.size() << " cells, running clusterizer ...";
60-
printf("Getting TR \n");
6159
// auto cellsTR = ctx.inputs().get<gsl::span<o2::phos::TriggerRecord>>("cellTriggerRecords");
6260
auto cellsTR = ctx.inputs().get<std::vector<o2::phos::TriggerRecord>>("cellTriggerRecords");
6361
if (mPropagateMC) {
64-
printf("Getting MC \n");
6562
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::phos::MCLabel>> truthcont(ctx.inputs().get<o2::dataformats::MCTruthContainer<o2::phos::MCLabel>*>("cellsmctr"));
6663
// truthmap = ctx.inputs().get<gsl::span<uint>>("cellssmcmap");
67-
printf("Clustering \n");
6864
mClusterizer.processCells(cells, cellsTR, truthcont.get(), &mOutputClusters, &mOutputClusterTrigRecs, &mOutputTruthCont); // Find clusters on digits (pass by ref)
6965
} else {
70-
printf("Clustering2 \n");
7166
mClusterizer.processCells(cells, cellsTR, nullptr, &mOutputClusters, &mOutputClusterTrigRecs, &mOutputTruthCont); // Find clusters on digits (pass by ref)
7267
}
7368
}
@@ -82,7 +77,6 @@ void ClusterizerSpec::run(framework::ProcessingContext& ctx)
8277
if (mPropagateMC) {
8378
ctx.outputs().snapshot(o2::framework::Output{"PHS", "CLUSTERTRUEMC", 0, o2::framework::Lifetime::Timeframe}, mOutputTruthCont);
8479
}
85-
LOG(INFO) << "Finished ";
8680
ctx.services().get<o2::framework::ControlService>().readyToQuit(framework::QuitRequest::Me);
8781
}
8882

Detectors/PHOS/workflow/src/PublisherSpec.cxx

Lines changed: 0 additions & 179 deletions
This file was deleted.

Detectors/PHOS/workflow/src/RecoWorkflow.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ o2::framework::WorkflowSpec getWorkflow(bool disableRootInp,
8989
}
9090
if (isEnabled(OutputType::Clusters)) {
9191
specs.emplace_back(o2::phos::reco_workflow::getRawToCellConverterSpec());
92-
specs.emplace_back(o2::phos::reco_workflow::getClusterizerSpec(false)); //no MC propagation
92+
specs.emplace_back(o2::phos::reco_workflow::getCellClusterizerSpec(false)); //no MC propagation
9393
if (!disableRootOut) {
94-
specs.emplace_back(o2::phos::getClusterWriterSpec(propagateMC));
94+
specs.emplace_back(o2::phos::getClusterWriterSpec(false));
9595
}
9696
}
9797
}

0 commit comments

Comments
 (0)