@@ -109,32 +109,30 @@ struct NonLinProducer {
109109 template <o2::soa::is_table TClusters, o2::soa::is_iterator TCollisio>
110110 void runEMC(TClusters const& clusters, TCollisio& collision)
111111 {
112- float cent = getCentrality(collision);
113112
114113 int32_t collIndex = collision.globalIndex();
114+ float cent = getCentrality(collision);
115+ emNonLinContextEMC.setParams(emNonLinEMC.resolveParams(o2::pwgem::nonlin::EMNonLin::PhotonType::kEMC, cent));
116+
115117 for (const auto& cluster : clusters) {
116- float nonLinE = 0.f;
117- float nonLinPt = 0.f;
118- float nonLinFactor = 1.f;
119118
120119 // check that we are at the correct collision
121120 if (cluster.emphotoneventId() != collIndex) {
122121 collIndex = cluster.emphotoneventId();
123122 collision.setCursor(collIndex);
124123 cent = getCentrality(collision);
124+ emNonLinContextEMC.setParams(emNonLinEMC.resolveParams(o2::pwgem::nonlin::EMNonLin::PhotonType::kEMC, cent));
125125 }
126126
127- emNonLinContextEMC.setParams(emNonLinEMC.resolveParams(o2::pwgem::nonlin::EMNonLin::PhotonType::kEMC, cent));
128-
129127 // fill before non lin histograms
130128 historeg.fill(HIST("QA/EMC/EIn"), cluster.e());
131129 historeg.fill(HIST("QA/EMC/PtIn"), cluster.pt());
132130
133131 // get NonLin factor from class dependent on the centrality
134- nonLinFactor = emNonLinEMC.getCorrectionFactor(cluster.e(), emNonLinContextEMC);
132+ float nonLinFactor = emNonLinEMC.getCorrectionFactor(cluster.e(), emNonLinContextEMC);
135133
136- nonLinE = nonLinFactor * cluster.e();
137- nonLinPt = nonLinFactor * cluster.pt();
134+ float nonLinE = nonLinFactor * cluster.e();
135+ float nonLinPt = nonLinFactor * cluster.pt();
138136
139137 // fill after non lin histograms
140138 historeg.fill(HIST("QA/EMC/EOut"), nonLinE);
@@ -147,29 +145,27 @@ struct NonLinProducer {
147145 template <o2::soa::is_table TV0, o2::soa::is_iterator TCollisio>
148146 void runPCM(TV0 const& v0s, TCollisio& collision)
149147 {
150- float cent = getCentrality(collision);
151148
152149 int32_t collIndex = collision.globalIndex();
150+ float cent = getCentrality(collision);
151+ emNonLinContextPCM.setParams(emNonLinPCM.resolveParams(o2::pwgem::nonlin::EMNonLin::PhotonType::kPCM, cent));
153152 for (const auto& v0 : v0s) {
154- float nonLinPt = 0.f;
155- float nonLinFactor = 1.f;
156153
157154 // check that we are at the correct collision
158155 if (v0.emphotoneventId() != collIndex) {
159156 collIndex = v0.emphotoneventId();
160157 collision.setCursor(collIndex);
161158 cent = getCentrality(collision);
159+ emNonLinContextPCM.setParams(emNonLinPCM.resolveParams(o2::pwgem::nonlin::EMNonLin::PhotonType::kPCM, cent));
162160 }
163161
164- emNonLinContextPCM.setParams(emNonLinPCM.resolveParams(o2::pwgem::nonlin::EMNonLin::PhotonType::kPCM, cent));
165-
166162 // fill before non lin histograms
167163 historeg.fill(HIST("QA/PCM/PtIn"), v0.pt());
168164
169165 // get NonLin factor from class dependent on the centrality
170- nonLinFactor = emNonLinEMC.getCorrectionFactor(v0.pt(), emNonLinContextPCM);
166+ float nonLinFactor = emNonLinEMC.getCorrectionFactor(v0.pt(), emNonLinContextPCM);
171167
172- nonLinPt = nonLinFactor * v0.pt();
168+ float nonLinPt = nonLinFactor * v0.pt();
173169
174170 // fill after non lin histograms
175171 historeg.fill(HIST("QA/PCM/PtOut"), nonLinPt);
0 commit comments