Skip to content

Commit c09848c

Browse files
committed
CPV,PHS: code reduction and fix in digitization
1 parent 4215700 commit c09848c

File tree

4 files changed

+5
-46
lines changed

4 files changed

+5
-46
lines changed

Steer/DigitizerWorkflow/src/CPVDigitizerSpec.cxx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,6 @@ void DigitizerSpec::initDigitizerTask(framework::InitContext& ic)
5555
mDeadTime = o2::cpv::CPVSimParams::Instance().mDeadTime; // PHOS dead time (should include readout => mReadoutTime< mDeadTime)
5656
}
5757
}
58-
// helper function which will be offered as a service
59-
void DigitizerSpec::retrieveHits(const char* brname,
60-
int sourceID,
61-
int entryID)
62-
{
63-
auto br = mSimChains[sourceID]->GetBranch(brname);
64-
if (!br) {
65-
LOG(error) << "No branch found";
66-
return;
67-
}
68-
mHits->clear();
69-
br->SetAddress(&mHits);
70-
br->GetEntry(entryID);
71-
}
7258

7359
void DigitizerSpec::updateTimeDependentParams(framework::ProcessingContext& ctx)
7460
{
@@ -165,7 +151,8 @@ void DigitizerSpec::run(framework::ProcessingContext& pc)
165151
// get the hits for this event and this source
166152
int source = part->sourceID;
167153
int entry = part->entryID;
168-
retrieveHits("CPVHit", source, entry);
154+
mHits->clear();
155+
context->retrieveHits(mSimChains, "CPVHit", source, entry, mHits);
169156
part++;
170157
if (part == eventParts[collID].end() && isLastStream) { // last stream, copy digits directly to output vector
171158
mDigitizer.processHits(mHits, mDigitsFinal, mDigitsOut, mLabels, collID, source, dt);

Steer/DigitizerWorkflow/src/CPVDigitizerSpec.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ class DigitizerSpec final : public o2::base::BaseDPLDigitizer
5454
void run(framework::ProcessingContext& ctx);
5555

5656
private:
57-
/// \brief helper function which will be offered as a service
58-
/// \param brname Name of the hit branch
59-
/// \param sourceID ID of the source
60-
/// \param entryID ID of the entry in the source
61-
void retrieveHits(const char* brname,
62-
int sourceID,
63-
int entryID);
64-
6557
void updateTimeDependentParams(framework::ProcessingContext& ctx);
6658

6759
float mReadoutTime = 0.; ///< PHOS readout time

Steer/DigitizerWorkflow/src/PHOSDigitizerSpec.cxx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,6 @@ void DigitizerSpec::initDigitizerTask(framework::InitContext& ic)
6060
}
6161
mHits = new std::vector<Hit>();
6262
}
63-
// helper function which will be offered as a service
64-
void DigitizerSpec::retrieveHits(const char* brname,
65-
int sourceID,
66-
int entryID)
67-
{
68-
auto br = mSimChains[sourceID]->GetBranch(brname);
69-
if (!br) {
70-
LOG(error) << "No branch found";
71-
return;
72-
}
73-
mHits->clear();
74-
br->SetAddress(&mHits);
75-
br->GetEntry(entryID);
76-
}
7763

7864
void DigitizerSpec::run(framework::ProcessingContext& pc)
7965
{
@@ -156,7 +142,9 @@ void DigitizerSpec::run(framework::ProcessingContext& pc)
156142
// get the hits for this event and this source
157143
int source = part->sourceID;
158144
int entry = part->entryID;
159-
retrieveHits("PHSHit", source, entry);
145+
mHits->clear();
146+
context->retrieveHits(mSimChains, "PHSHit", source, entry, mHits);
147+
160148
part++;
161149
if (part == eventParts[collID].end() && isLastStream) { // last stream, copy digits directly to output vector
162150
mDigitizer.processHits(mHits, mDigitsFinal, mDigitsOut, mLabels, entry, source, dt);

Steer/DigitizerWorkflow/src/PHOSDigitizerSpec.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ class DigitizerSpec final : public o2::base::BaseDPLDigitizer
5555
void run(framework::ProcessingContext& ctx);
5656

5757
private:
58-
/// \brief helper function which will be offered as a service
59-
/// \param brname Name of the hit branch
60-
/// \param sourceID ID of the source
61-
/// \param entryID ID of the entry in the source
62-
void retrieveHits(const char* brname,
63-
int sourceID,
64-
int entryID);
65-
6658
float mReadoutTime = 0.; ///< PHOS readout time
6759
float mDeadTime = 0.; ///< PHOS dead time
6860
bool mInitSimParams = true; ///< To initialize SimParams

0 commit comments

Comments
 (0)