@@ -134,10 +134,10 @@ enum EMiscHistograms {
134134 eMiscHistograms_N
135135};
136136
137- enum EExternalHistograms {
137+ enum EWeightsHistograms {
138138 ePhi = 0 ,
139139 ePt,
140- eExternalHistograms_N
140+ eWeightsHistograms_N
141141};
142142
143143enum EObservables {
@@ -159,7 +159,7 @@ static constexpr std::array<const char*, eMultiplicityTables_N> MultiplicityTabl
159159 " multFT0M" ,
160160 " multNTracksPV" };
161161
162- static constexpr std::array<const char *, eExternalHistograms_N > WeightsNames = {
162+ static constexpr std::array<const char *, eWeightsHistograms_N > WeightsNames = {
163163 " ePhi" ,
164164 " ePt" };
165165
@@ -187,7 +187,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
187187
188188 // *) external root files
189189 Configurable<bool > cfExternalFileSwitch{" cfExternalFileSwitch" , false , " choose to include external root files or not" };
190- Configurable<std::string> cfFileWithWeights{" cfFileWithWeights" , " /alice-ccdb.cern.ch/Users/m/mei/O2challenge -" , " path to external ROOT file which holds all particle weights" };
190+ Configurable<std::string> cfFileWithWeights{" cfFileWithWeights" , " /alice-ccdb.cern.ch/Users/m/mei/thesis -" , " path to external ROOT file which holds all particle weights" };
191191
192192 // *) binnings
193193 Configurable<bool > cfALICECentBinSwitch{" cfALICECentBinSwitch" , true , " switch on or off to use ALICE default binning" };
@@ -247,7 +247,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
247247 // *) External histograms:
248248 struct ExternalHistograms {
249249 TList* fExternalHistogramsList = nullptr ;
250- std::array<std::array<TH1F *, eCuts_N>, eExternalHistograms_N > fWeights {}; // ! [type][before, after cuts]
250+ std::array<std::array<TH1F *, eCuts_N>, eWeightsHistograms_N > fWeights {}; // ! [type][before, after cuts]
251251 } ex;
252252
253253 struct Observables {
@@ -275,7 +275,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
275275 }
276276
277277 template <typename T1 >
278- void updateQVectorsTable (std::vector<std::vector<TComplex>>& QVectorsTable, T1 phi, T1 weight = T1 (1 ))
278+ void updateQVectorsTable (std::vector<std::vector<TComplex>>& QVectorsTable, T1 const & phi, T1 weight = T1 (1 ))
279279 {
280280 const int maxHarmonic = QVectorsTable.size ();
281281 const int maxPower = QVectorsTable.empty () ? 0 : QVectorsTable[0 ].size ();
@@ -526,9 +526,9 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
526526
527527 // templates
528528 template <typename T1 >
529- float chooseCent (T1 const & collision)
529+ float chooseCent (T1 const & collision, int const & whichEstimator )
530530 {
531- switch (centralityEstimator ) {
531+ switch (whichEstimator ) {
532532 case eFT0C:
533533 return static_cast <float >(collision.centFT0C ());
534534 case eFT0M:
@@ -544,9 +544,9 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
544544 }
545545
546546 template <typename T1 >
547- float chooseMult (T1 const & collision)
547+ float chooseMult (T1 const & collision, int const & whichTable )
548548 {
549- switch (multiplicityTables ) {
549+ switch (whichTable ) {
550550 case eMultTPC:
551551 return static_cast <float >(collision.multTPC ());
552552 case eMultFV0M:
@@ -598,8 +598,8 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
598598 if constexpr (rs == eRec || rs == eRecAndSim) {
599599 // Fill reconstructed-level event histograms
600600 if (rm == eReal) {
601- auto thisCent = chooseCent (collision);
602- auto thisRefMult = chooseMult (collision);
601+ auto thisCent = chooseCent (collision, centralityEstimator );
602+ auto thisRefMult = chooseMult (collision, multiplicityTables );
603603 int multiplicityRec = static_cast <int >(tracks.size ());
604604 if constexpr (cuts == eBefore) {
605605 ec.fEventHist [eHistMultiplicity][eRec][eBefore]->Fill (multiplicityRec);
@@ -772,10 +772,13 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
772772
773773 void loadWeights (int runNumber)
774774 {
775- for (int i = 0 ; i < eExternalHistograms_N ; ++i) {
775+ for (int i = 0 ; i < eWeightsHistograms_N ; ++i) {
776776 for (int j = 0 ; j < eCuts_N; ++j) {
777- ex.fWeights [i][j] =
778- getHistogramWithWeights (cfFileWithWeights.value .c_str (), Form (" %d" , runNumber), Form (" [%s][%s]" , WeightsNames[i], CutsNames[j]));
777+ ex.fWeights [i][j] = getHistogramWithWeights (cfFileWithWeights.value .c_str (), Form (" %d" , runNumber), Form (" [%s][%s]" , WeightsNames[i], CutsNames[j]));
778+ if (!ex.fWeights [i][j]) {
779+ LOGF (info, " [%s][%s] not found" , WeightsNames[i], CutsNames[j]);
780+ continue ;
781+ }
779782 ex.fExternalHistogramsList ->Add (ex.fWeights [i][j]);
780783 }
781784 }
@@ -784,7 +787,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
784787 template <ERecSim rs, typename T1 >
785788 void qaFill (T1 const & collision)
786789 {
787- auto thisCent = chooseCent (collision);
790+ auto thisCent = chooseCent (collision, centralityEstimator );
788791 if constexpr (rs == eRecAndSim || rs == eSim) {
789792 if (!collision.has_mcCollision ()) {
790793 return ;
@@ -807,7 +810,8 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
807810 if (tc.fDryRun ) {
808811 return ;
809812 }
810- int thisRunNumber = collision.bc ().runNumber ();
813+ const int thisRunNumber = collision.bc ().runNumber ();
814+ LOGF (info, " Successfully running, run number is %d" , thisRunNumber);
811815
812816 if (isFirstCollision) {
813817 // Get run number
@@ -848,27 +852,30 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
848852 auto track = tracks.iteratorAt (0 ); // set the type and scope from one instance
849853 for (int64_t i = 0 ; i < tracks.size (); i++) {
850854 track = tracks.iteratorAt (i);
851- const float thisPhi = track.phi ();
852- const float thisPt = track.pt ();
853- float wPhiBefore = 1 .f ;
854- float wPhiAfter = 1 .f ;
855- float wPtBefore = 1 .f ;
856- float wPtAfter = 1 .f ;
857- if (cfExternalFileSwitch && ex.fWeights [ePhi][eBefore]) {
858- wPhiBefore = ex.fWeights [ePhi][eBefore]->GetBinContent (ex.fWeights [ePhi][eBefore]->FindBin (thisPhi));
859- wPhiAfter = ex.fWeights [ePhi][eAfter]->GetBinContent (ex.fWeights [ePhi][eAfter]->FindBin (thisPhi));
860- wPtBefore = ex.fWeights [ePt][eBefore]->GetBinContent (ex.fWeights [ePt][eBefore]->FindBin (thisPt));
861- wPtAfter = ex.fWeights [ePt][eAfter]->GetBinContent (ex.fWeights [ePt][eAfter]->FindBin (thisPt));
855+ float thisPhi = track.phi ();
856+ float thisPt = track.pt ();
857+ std::array<float , 2 > thisPhiAndPt = {thisPhi, thisPt};
858+ std::array<std::array<float , 2 >, 2 > thisWeights = {{{1 .f , 1 .f }, {1 .f , 1 .f }}}; // {{wPhiBefore, wPhiAfter},{wPtBefore, wPtAfter}}
859+
860+ // eWeightsHistograms_N
861+ if (cfExternalFileSwitch) {
862+ for (int i = 0 ; i < eWeightsHistograms_N; ++i) {
863+ for (int j = 0 ; j < eCuts_N; ++j) {
864+ if (ex.fWeights [i][j]) {
865+ thisWeights[i][j] = ex.fWeights [i][j]->GetBinContent (ex.fWeights [i][j]->FindBin (thisPhiAndPt[i]));
866+ }
867+ }
868+ }
862869 }
863870
864871 particleHistFill<rs, eReal, eBefore>(track);
865872 particleHistFill<rs, eMC, eBefore>(track);
866- updateQVectorsTable (qVectorsTableBeforeCutsReal, thisPhi, wPhiBefore * wPtBefore );
873+ updateQVectorsTable (qVectorsTableBeforeCutsReal, thisPhi, thisWeights[ePhi][eBefore] * thisWeights[ePt][eBefore] );
867874
868875 if (cfMasterCutSwitch) {
869876 if (passesEventCutsReal && particleCuts<rs, eReal>(track)) {
870877 particleHistFill<rs, eReal, eAfter>(track);
871- updateQVectorsTable (qVectorsTableAfterCutsReal, thisPhi, wPhiAfter * wPtAfter );
878+ updateQVectorsTable (qVectorsTableAfterCutsReal, thisPhi, thisWeights[ePhi][eAfter] * thisWeights[ePt][eAfter] );
872879 }
873880 if (passesEventCutsMC && particleCuts<rs, eMC>(track)) {
874881 particleHistFill<rs, eMC, eAfter>(track);
0 commit comments