@@ -120,7 +120,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
120120 Configurable<std::vector<float >> cfEta{" cfEta" , {-0.8 , 0.8 }, " eta range" };
121121
122122 Configurable<std::vector<int >> cfRuns{" cfRuns" , {544091 , 544095 , 544098 , 544116 , 544121 , 544122 , 544123 , 544124 }, " List of run numbers to analyze" };
123- Configurable<std::string> cfFileWithWeights{" cfFileWithWeights" , " /alice-ccdb.cern.ch/Users/p/pengchon/weightsfile05 " , " path to external ROOT file which holds all particle weights" };
123+ Configurable<std::string> cfFileWithWeights{" cfFileWithWeights" , " /alice-ccdb.cern.ch/Users/p/pengchon/weightsfile06 " , " path to external ROOT file which holds all particle weights" };
124124
125125 // *) Define and initialize all data members to be called in the main process* functions:
126126 // **) Task configuration:
@@ -139,7 +139,6 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
139139 TH1F * fHistTracksdcaXY [2 ] = {NULL };
140140 TH1F * fHistTracksdcaZ [2 ] = {NULL };
141141 TH1F * histWeights = NULL ;
142- std::unordered_map<int , TH1F *> weightsmap;
143142 } pc; // you have to prepend "pc." for all objects name in this group later in the code
144143
145144 struct EventHistograms {
@@ -161,21 +160,27 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
161160 } qa;
162161
163162 static constexpr int maxHarmonic = 7 ;
163+ static constexpr int maxPower = 5 ;
164164 struct CorrelationVariables {
165165 TList* fCorrelationVariablesList = NULL ;
166166 TProfile* pv22_centr = NULL ;
167167 TProfile* pv32_centr = NULL ;
168168 TProfile* pv42_centr = NULL ;
169169 TProfile* pfour32_centr = NULL ;
170170 TProfile* pfour42_centr = NULL ;
171- TComplex Qvector[maxHarmonic];
171+ TComplex Qvector[maxHarmonic][maxPower] ;
172172 } cor;
173173
174174 struct PhiHist {
175175 TList* fPhiHistList = NULL ;
176176 std::unordered_map<int , TH1F *> histMap;
177177 } phih;
178178
179+ struct WeightsHist {
180+ TList* fWeightsHistList = NULL ;
181+ std::unordered_map<int , TH1F *> weightsmap;
182+ } wh;
183+
179184 TObject* GetObjectFromList (TList* list, const char * objectName)
180185 {
181186 // Get TObject pointer from TList, even if it's in some nested TList. Foreseen
@@ -372,21 +377,26 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
372377 return true ;
373378 }
374379
375- TComplex Q (Int_t n )
380+ TComplex Q (int n, int p )
376381 {
377382 // Using the fact that Q{-n,p} = Q{n,p}^*.
378383 if (n >= 0 ) {
379- return cor.Qvector [n];
384+ return cor.Qvector [n][p] ;
380385 }
381- return TComplex::Conjugate (cor.Qvector [-n]);
386+ return TComplex::Conjugate (cor.Qvector [-n][p] );
382387 }
383388
389+ TComplex Two (Int_t n1, Int_t n2)
390+ {
391+ // Generic two-particle correlation <exp[i(n1*phi1+n2*phi2)]>.
392+ TComplex two = Q (n1, 1 ) * Q (n2, 1 ) - Q (n1 + n2, 2 );
393+ return two;
394+
395+ } // TComplex Two(Int_t n1, Int_t n2)
384396 TComplex Four (Int_t n1, Int_t n2, Int_t n3, Int_t n4)
385397 { // Generic four-particle correlation <exp[i(n1*phi1+n2*phi2+n3*phi3+n4*phi4)]>.
386- TComplex four = Q (n1) * Q (n2) * Q (n3) * Q (n4) - Q (n1 + n2) * Q (n3) * Q (n4) - Q (n2) * Q (n1 + n3) * Q (n4) - Q (n1) * Q (n2 + n3) * Q (n4) + 2 . * Q (n1 + n2 + n3) * Q (n4) - Q (n2) * Q (n3) * Q (n1 + n4) + Q (n2 + n3) * Q (n1 + n4) - Q (n1) * Q (n3) * Q (n2 + n4) + Q (n1 + n3) * Q (n2 + n4) + 2 . * Q (n3) * Q (n1 + n2 + n4) - Q (n1) * Q (n2) * Q (n3 + n4) + Q (n1 + n2) * Q (n3 + n4) + 2 . * Q (n2) * Q (n1 + n3 + n4) + 2 . * Q (n1) * Q (n2 + n3 + n4) - 6 . * Q (n1 + n2 + n3 + n4);
387-
398+ TComplex four = Q (n1, 1 ) * Q (n2, 1 ) * Q (n3, 1 ) * Q (n4, 1 ) - Q (n1 + n2, 2 ) * Q (n3, 1 ) * Q (n4, 1 ) - Q (n2, 1 ) * Q (n1 + n3, 2 ) * Q (n4, 1 ) - Q (n1, 1 ) * Q (n2 + n3, 2 ) * Q (n4, 1 ) + 2 . * Q (n1 + n2 + n3, 3 ) * Q (n4, 1 ) - Q (n2, 1 ) * Q (n3, 1 ) * Q (n1 + n4, 2 ) + Q (n2 + n3, 2 ) * Q (n1 + n4, 2 ) - Q (n1, 1 ) * Q (n3, 1 ) * Q (n2 + n4, 2 ) + Q (n1 + n3, 2 ) * Q (n2 + n4, 2 ) + 2 . * Q (n3, 1 ) * Q (n1 + n2 + n4, 3 ) - Q (n1, 1 ) * Q (n2, 1 ) * Q (n3 + n4, 2 ) + Q (n1 + n2, 2 ) * Q (n3 + n4, 2 ) + 2 . * Q (n2, 1 ) * Q (n1 + n3 + n4, 3 ) + 2 . * Q (n1, 1 ) * Q (n2 + n3 + n4, 3 ) - 6 . * Q (n1 + n2 + n3 + n4, 4 );
388399 return four;
389-
390400 } // TComplex Four(Int_t n1, Int_t n2, Int_t n3, Int_t n4)
391401
392402 template <eRecSim rs, typename T1 , typename T2 >
@@ -400,7 +410,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
400410 // LOGF(info, "Run number: %d", collision.bc().runNumber());
401411 int currentRun = collision.bc ().runNumber ();
402412 auto it = phih.histMap .find (currentRun);
403- auto histweight = pc .weightsmap .find (currentRun);
413+ auto histweight = wh .weightsmap .find (currentRun);
404414 float centr = 0 , M = 0 ., msel = 0 .;
405415
406416 if constexpr (rs == eRec || rs == eRecAndSim) {
@@ -455,7 +465,9 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
455465 // before loop over particles
456466 float phi = 0 , weight = 1 .;
457467 for (int ih = 0 ; ih < maxHarmonic; ih++) {
458- cor.Qvector [ih] = TComplex (0 ., 0 .);
468+ for (int ip = 0 ; ip < maxPower; ip++) {
469+ cor.Qvector [ih][ip] = TComplex (0 ., 0 .);
470+ }
459471 }
460472
461473 // Main loop over particles:
@@ -485,7 +497,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
485497 pc.fHistTracksdcaXY [eRec]->Fill (track.dcaXY ());
486498 pc.fHistTracksdcaZ [eRec]->Fill (track.dcaZ ());
487499
488- if (cfUseWeights && histweight != pc .weightsmap .end ())
500+ if (cfUseWeights && histweight != wh .weightsmap .end ())
489501 weight = histweight->second ->GetBinContent (histweight->second ->FindBin (phi));
490502 else
491503 weight = 1 ;
@@ -512,30 +524,34 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
512524 // analysis in the loop over particle
513525 msel = msel + 1 ;
514526 for (int ih = 0 ; ih < maxHarmonic; ih++) {
515- cor.Qvector [ih] += TComplex (weight * TMath::Cos (ih * phi), weight * TMath::Sin (ih * phi));
527+ for (int ip = 0 ; ip < maxPower; ip++) {
528+ cor.Qvector [ih][ip] += TComplex (std::pow (weight, ip) * TMath::Cos (ih * phi), std::pow (weight, ip) * TMath::Sin (ih * phi));
529+ }
516530 }
517531 } // end of for (auto track: tracks)
518532 event.fHistMsel ->Fill (msel);
519533 // calculate correlations
520534 float Mmin = 4 .;
521535 if (msel < Mmin)
522536 return ;
523- float four32 = Four (3 , 2 , -3 , -2 ).Re () / Four (0 , 0 , 0 , 0 ).Re ();
524- float four42 = Four (4 , 2 , -4 , -2 ).Re () / Four (0 , 0 , 0 , 0 ).Re ();
525- float v22 = (Q (2 ).Rho2 () - msel) / (msel * (msel - 1 .));
526- float v32 = (Q (3 ).Rho2 () - msel) / (msel * (msel - 1 .));
527- float v42 = (Q (4 ).Rho2 () - msel) / (msel * (msel - 1 .));
537+ float wTwo = Two (0 , 0 ).Re ();
538+ float wFour = Four (0 , 0 , 0 , 0 ).Re ();
539+ float four32 = Four (3 , 2 , -3 , -2 ).Re () / wFour;
540+ float four42 = Four (4 , 2 , -4 , -2 ).Re () / wFour;
541+ float v22 = Two (2 , -2 ) / wTwo;
542+ float v32 = Two (3 , -3 ) / wTwo;
543+ float v42 = Two (4 , -4 ) / wTwo;
528544 if (std::isnan (v22) || std::isnan (v32) || std::isnan (v42) || std::isnan (four32) || std::isnan (four42)) {
529545 LOGF (info, " \033 [1;31m%s std::isnan(v22) || std::isnan(v32) || std::isnan(v42) || std::isnan(four32) || std::isnan(four42)\033 [0m" , __FUNCTION__);
530546 LOGF (error, " v22 = %f\n v32 = %f\n v42 = %f\n four32=%f\n v42 = %f\n " , v22, v32, v42, four32, four42);
531547 return ;
532548 }
533549
534- cor.pv22_centr ->Fill (centr, v22, msel * (msel - 1 ) );
535- cor.pv32_centr ->Fill (centr, v32, msel * (msel - 1 ) );
536- cor.pv42_centr ->Fill (centr, v42, msel * (msel - 1 ) );
537- cor.pfour32_centr ->Fill (centr, four32, msel * (msel - 1 ) );
538- cor.pfour42_centr ->Fill (centr, four42, msel * (msel - 1 ) );
550+ cor.pv22_centr ->Fill (centr, v22, wTwo );
551+ cor.pv32_centr ->Fill (centr, v32, wTwo );
552+ cor.pv42_centr ->Fill (centr, v42, wTwo );
553+ cor.pfour32_centr ->Fill (centr, four32, wFour );
554+ cor.pfour42_centr ->Fill (centr, four42, wFour );
539555
540556 } // end of template <eRecSim rs, typename T1, typename T2> void Steer(T1 const& collision, T2 const& tracks)
541557
@@ -583,6 +599,11 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
583599 phih.fPhiHistList ->SetOwner (true );
584600 fBaseList ->Add (phih.fPhiHistList );
585601
602+ wh.fWeightsHistList = new TList ();
603+ wh.fWeightsHistList ->SetName (" WeightsHistograms" );
604+ wh.fWeightsHistList ->SetOwner (true );
605+ fBaseList ->Add (wh.fWeightsHistList );
606+
586607 // *) Book pt distribution with binning defined through configurables in the json file:
587608 vector<float > l_pt_bins = cfPtBins.value ; // define local array and initialize it from an array set in the configurables
588609 vector<float > l_phi_bins = cfPhiBins.value ;
@@ -695,14 +716,16 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
695716 event.fEventHistogramsList ->Add (event.fHistMult [eSim]);
696717 }
697718
719+ // loading weights
698720 for (const int & run : targetRuns) {
699721 std::string runStr = std::to_string (run);
700722 TH1F * histweights = GetHistogramWithWeights (cfFileWithWeights.value .c_str (), runStr.c_str ());
701723 if (!histweights) {
702724 LOG (fatal) << " Failed to load weights for run " << run;
703725 return ;
704726 }
705- pc.weightsmap [run] = histweights;
727+ wh.fWeightsHistList ->Add (histweights);
728+ wh.weightsmap [run] = histweights;
706729 }
707730
708731 event.fHistCentr [eRec] = new TH1F (" fHistCentr[eRec]" , " centrality distribution for reconstructed particles" , nBinscentr, mincentr, maxcentr);
0 commit comments