@@ -116,6 +116,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
116116 Configurable<bool > cfInitsim{" cfInitsim" , false , " init histograms of sim" };
117117 Configurable<bool > cfUseWeights{" cfUseWeights" , true , " use weights" };
118118 Configurable<bool > cfToyModel{" cfToyModel" , true , " phi-distribution from toy model" };
119+ Configurable<bool > cfNest{" cfNest" , true , " nested loops" };
119120
120121 Configurable<std::vector<float >> cfVertexZ{" cfVertexZ" , {-10 , 10 .}, " vertex z position range: {min, max}[cm], with convention: min <= Vz < max" };
121122 Configurable<std::vector<float >> cfPt{" cfPt" , {0.2 , 5.0 }, " transverse momentum range" };
@@ -171,6 +172,12 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
171172 TProfile* pfour32_centr = NULL ;
172173 TProfile* pfour42_centr = NULL ;
173174 TComplex Qvector[maxHarmonic][maxPower];
175+ std::vector<float > vecphi;
176+ std::vector<float > vecwei;
177+ TProfile* nestedLoops[maxHarmonic] = {NULL };
178+ TProfile* pv2_nest = NULL ;
179+ TProfile* pv3_nest = NULL ;
180+ TProfile* pv4_nest = NULL ;
174181 } cor;
175182
176183 struct PhiHist {
@@ -243,15 +250,15 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
243250 string pathstr = filePath;
244251 const string pathalien = " /alice/cern.ch/" ;
245252 const string pathccdb = " /alice-ccdb.cern.ch/" ;
246- if (pathstr.find (pathalien) == 0 ) {
253+ if (pathstr.starts_with (pathalien)) {
247254 bFileIsInAliEn = true ;
248- } else if (pathstr.find (pathccdb) == 0 ) {
255+ } else if (pathstr.starts_with (pathccdb)) {
249256 bFileIsInCCDB = true ;
250257 }
251258 LOGF (info, " bFileIsInCCDB= %d" , bFileIsInCCDB);
252259
253260 if (bFileIsInAliEn) {
254- TGrid* alien = TGrid::Connect (" alien" , gSystem ->Getenv (" USER" ), " " , " " ); // do not forget to add #include <TGrid.h> to the preamble of your analysis task
261+ const TGrid* alien = TGrid::Connect (" alien" , gSystem ->Getenv (" USER" ), " " , " " ); // do not forget to add #include <TGrid.h> to the preamble of your analysis task
255262 if (!alien) {
256263 LOGF (fatal, " \033 [1;31m%s at line %d\033 [0m" , __FUNCTION__, __LINE__);
257264 }
@@ -401,7 +408,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
401408 return four;
402409 } // TComplex Four(Int_t n1, Int_t n2, Int_t n3, Int_t n4)
403410
404- static double pdf (double * x, double * par)
411+ static double pdf (const double * x, const double * par)
405412 {
406413 double y = 1 ;
407414 int harm = 6 ;
@@ -423,7 +430,16 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
423430 auto it = phih.histMap .find (currentRun);
424431 auto histweight = wh.weightsmap .find (currentRun);
425432 float centr = 0 , M = 0 ., msel = 0 .;
426- TF1 * f = new TF1 (" f" , pdf, 0 , TMath::TwoPi (), 1 );
433+ // TF1* f = new TF1("f", pdf, 0, TMath::TwoPi(), 1);
434+ TF1 * f = new TF1 (" f" ,
435+ " 1 +"
436+ " 2 * (0.05) * cos(1 * (x - [0])) +"
437+ " 2 * (0.06) * cos(2 * (x - [0])) +"
438+ " 2 * (0.07) * cos(3 * (x - [0])) +"
439+ " 2 * (0.08) * cos(4 * (x - [0])) +"
440+ " 2 * (0.09) * cos(5 * (x - [0])) +"
441+ " 2 * (0.10) * cos(6 * (x - [0]))" ,
442+ 0 , TMath::TwoPi ());
427443 f->SetParameters (0 .);
428444
429445 if constexpr (rs == eRec || rs == eRecAndSim) {
@@ -486,12 +502,24 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
486502
487503 // before loop over particles
488504 float phi = 0 , weight = 1 .;
505+ vector<float >().swap (cor.vecphi );
506+ vector<float >().swap (cor.vecwei );
489507 for (int ih = 0 ; ih < maxHarmonic; ih++) {
490508 for (int ip = 0 ; ip < maxPower; ip++) {
491509 cor.Qvector [ih][ip] = TComplex (0 ., 0 .);
492510 }
493511 }
494512
513+ /*
514+ for (int ih = 0; ih < maxHarmonic; ih++) {
515+ for (int ip = 0; ip < maxPower; ip++) {
516+ LOGF(info, "Qvector[%d][%d]=%f, ", ih, ip, cor.Qvector[ih][ip].Rho2());
517+ }
518+ LOGF(info, "\n");
519+ }
520+ LOGF(info, "\n\n");
521+ */
522+
495523 // Main loop over particles:
496524 for (const auto & track : tracks) {
497525
@@ -527,6 +555,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
527555 if (cfToyModel) {
528556 phi = f->GetRandom ();
529557 }
558+ cor.vecphi .push_back (phi);
530559 if (it != phih.histMap .end ()) {
531560 it->second ->Fill (phi);
532561 }
@@ -541,6 +570,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
541570 } else {
542571 weight = 1 ;
543572 }
573+ cor.vecwei .push_back (weight);
544574
545575 // ... and corresponding MC truth simulated:
546576 // See https://github.com/AliceO2Group/O2Physics/blob/master/Tutorials/src/mcHistograms.cxx
@@ -570,6 +600,30 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
570600 }
571601 } // end of for (auto track: tracks)
572602 event.fHistMsel [eAfter]->Fill (msel);
603+
604+ if (cfNest) {
605+ float phi1 = 0 ., phi2 = 0 ., weight1 = 1 ., weight2 = 2 .;
606+ for (Int_t c = 0 ; c < maxHarmonic; c++) {
607+ delete cor.nestedLoops [c];
608+ cor.nestedLoops [c] = new TProfile (" " , " " , 1 , 0 ., 1 .);
609+ cor.nestedLoops [c]->Sumw2 ();
610+ }
611+ for (int i1 = 0 ; i1 < static_cast <int >(cor.vecphi .size ()); i1++) { // nested loop of particles
612+ phi1 = cor.vecphi [i1];
613+ weight1 = cor.vecwei [i1];
614+ for (int i2 = 0 ; i2 < static_cast <int >(cor.vecphi .size ()); i2++) {
615+ if (i2 == i1) {
616+ continue ;
617+ }
618+ phi2 = cor.vecphi [i2];
619+ weight2 = cor.vecwei [i2];
620+ cor.nestedLoops [0 ]->Fill (0.5 , TMath::Cos (2 * phi1 - 2 * phi2), weight1 * weight2);
621+ cor.nestedLoops [1 ]->Fill (0.5 , TMath::Cos (3 * phi1 - 3 * phi2), weight1 * weight2);
622+ cor.nestedLoops [2 ]->Fill (0.5 , TMath::Cos (4 * phi1 - 4 * phi2), weight1 * weight2);
623+ }
624+ } // end of two nested loop
625+ }
626+
573627 // calculate correlations
574628 float Mmin = 4 .;
575629 if (msel < Mmin)
@@ -593,6 +647,13 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
593647 cor.pfour32_centr ->Fill (centr, four32, wFour);
594648 cor.pfour42_centr ->Fill (centr, four42, wFour);
595649
650+ if (cfNest) {
651+ cor.pv2_nest ->Fill (centr, cor.nestedLoops [0 ]->GetBinContent (1 ), wTwo);
652+ cor.pv3_nest ->Fill (centr, cor.nestedLoops [1 ]->GetBinContent (1 ), wTwo);
653+ cor.pv4_nest ->Fill (centr, cor.nestedLoops [2 ]->GetBinContent (1 ), wTwo);
654+
655+ LOGF (info, " v22=%f, v22_nest=%f" , v22, cor.nestedLoops [0 ]->GetBinContent (1 ));
656+ }
596657 } // end of template <eRecSim rs, typename T1, typename T2> void Steer(T1 const& collision, T2 const& tracks)
597658
598659 // *) Initialize and book all objects:
@@ -827,6 +888,9 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
827888 cor.pv42_centr = new TProfile (" pv42" , " profile of v_{4}^{2}" , 9 , quantiles);
828889 cor.pfour32_centr = new TProfile (" pfour32" , " profile of v_{2}^{2}*v_{3}^{2}" , 9 , quantiles);
829890 cor.pfour42_centr = new TProfile (" pfour42" , " profile of v_{2}^{2}*v_{4}^{2}" , 9 , quantiles);
891+ cor.pv2_nest = new TProfile (" pv2_nest" , " profile of v_{2} from nest" , 9 , quantiles);
892+ cor.pv3_nest = new TProfile (" pv3_nest" , " profile of v_{3} from nest" , 9 , quantiles);
893+ cor.pv4_nest = new TProfile (" pv4_nest" , " profile of v_{4} from nest" , 9 , quantiles);
830894 cor.pv22_centr ->GetYaxis ()->SetTitle (" v_{2}^{2}" );
831895 cor.pv32_centr ->GetYaxis ()->SetTitle (" v_{3}^{2}" );
832896 cor.pv42_centr ->GetYaxis ()->SetTitle (" v_{4}^{2}" );
@@ -837,11 +901,22 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
837901 cor.pfour42_centr ->GetYaxis ()->SetTitle (" v_{2}^{2}v_{4}^{2}" );
838902 cor.pfour32_centr ->GetXaxis ()->SetTitle (" centrality" );
839903 cor.pfour42_centr ->GetXaxis ()->SetTitle (" centrality" );
904+ cor.pv2_nest ->GetYaxis ()->SetTitle (" v_{2}" );
905+ cor.pv3_nest ->GetYaxis ()->SetTitle (" v_{3}" );
906+ cor.pv4_nest ->GetYaxis ()->SetTitle (" v_{4}" );
907+ cor.pv2_nest ->GetXaxis ()->SetTitle (" centrality" );
908+ cor.pv3_nest ->GetXaxis ()->SetTitle (" centrality" );
909+ cor.pv4_nest ->GetXaxis ()->SetTitle (" centrality" );
840910 cor.fCorrelationVariablesList ->Add (cor.pv22_centr );
841911 cor.fCorrelationVariablesList ->Add (cor.pv32_centr );
842912 cor.fCorrelationVariablesList ->Add (cor.pv42_centr );
843913 cor.fCorrelationVariablesList ->Add (cor.pfour32_centr );
844914 cor.fCorrelationVariablesList ->Add (cor.pfour42_centr );
915+ if (cfNest) {
916+ cor.fCorrelationVariablesList ->Add (cor.pv2_nest );
917+ cor.fCorrelationVariablesList ->Add (cor.pv3_nest );
918+ cor.fCorrelationVariablesList ->Add (cor.pv4_nest );
919+ }
845920
846921 // init of phi hist for different runs
847922 for (const int & run : targetRuns) {
0 commit comments