Skip to content

Commit a97b2a1

Browse files
committed
EventPlaneHelper: avoid copying FT0 Geometry on every call
GetPhiFT0 and SumQvectors took o2::ft0::Geometry by value, causing a full copy (TObject heap allocation + destruction) on every invocation. SumQvectors is called ~208 times per event, so this was ~14% of CPU in Q-vector trains.
1 parent 30d4749 commit a97b2a1

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

Common/Core/EventPlaneHelper.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ double EventPlaneHelper::GetPhiFV0(int chno, o2::fv0::Geometry* fv0geom)
6161
return TMath::ATan2(chPos.y + offsetY, chPos.x + offsetX);
6262
}
6363

64-
double EventPlaneHelper::GetPhiFT0(int chno, o2::ft0::Geometry ft0geom)
64+
double EventPlaneHelper::GetPhiFT0(int chno, const o2::ft0::Geometry& ft0geom)
6565
{
6666
/* Calculate the azimuthal angle in FT0 for the channel number 'chno'. The offset
6767
of FT0-A is taken into account if chno is between 0 and 95. */
@@ -76,12 +76,11 @@ double EventPlaneHelper::GetPhiFT0(int chno, o2::ft0::Geometry ft0geom)
7676

7777
ft0geom.calculateChannelCenter();
7878
auto chPos = ft0geom.getChannelCenter(chno);
79-
/// printf("Channel id: %d X: %.3f Y: %.3f\n", chno, chPos.X(), chPos.Y());
8079

8180
return TMath::ATan2(chPos.Y() + offsetY, chPos.X() + offsetX);
8281
}
8382

84-
void EventPlaneHelper::SumQvectors(int det, int chno, float ampl, int nmod, TComplex& Qvec, float& sum, o2::ft0::Geometry ft0geom, o2::fv0::Geometry* fv0geom)
83+
void EventPlaneHelper::SumQvectors(int det, int chno, float ampl, int nmod, TComplex& Qvec, float& sum, const o2::ft0::Geometry& ft0geom, o2::fv0::Geometry* fv0geom)
8584
{
8685
/* Calculate the complex Q-vector for the provided detector and channel number,
8786
before adding it to the total Q-vector given as argument. */

Common/Core/EventPlaneHelper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ class EventPlaneHelper
6060
}
6161

6262
// Methods to calculate the azimuthal angles for each part of FIT, given the channel number.
63-
double GetPhiFT0(int chno, o2::ft0::Geometry ft0geom);
63+
double GetPhiFT0(int chno, const o2::ft0::Geometry& ft0geom);
6464
double GetPhiFV0(int chno, o2::fv0::Geometry* fv0geom);
6565

6666
// Method to get the Q-vector and sum of amplitudes for any channel in FIT, given
6767
// the detector and amplitude.
68-
void SumQvectors(int det, int chno, float ampl, int nmod, TComplex& Qvec, float& sum, o2::ft0::Geometry ft0geom, o2::fv0::Geometry* fv0geom);
68+
void SumQvectors(int det, int chno, float ampl, int nmod, TComplex& Qvec, float& sum, const o2::ft0::Geometry& ft0geom, o2::fv0::Geometry* fv0geom);
6969

7070
// Method to get the bin corresponding to a centrality percentile, according to the
7171
// centClasses[] array defined in Tasks/qVectorsQA.cxx.

0 commit comments

Comments
 (0)