You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pw.fWeightsList->Add(pw.fDiffWeightsHist[whichDiffWeight][bin]); // This is working at the moment, because I am fetching all weights in Preprocess(), which is called after init()
6656
+
// But if eventually it will be possible to fetch run number programatically in init(), I will have to re-think this line.
6655
6657
6656
6658
// Flag:
6657
6659
if (!pw.fUseDiffWeights[whichDiffWeight]) // yes, set it only once to kTRUE, for all bins
// Nevertheless, I could switch to enums and make it more general, i.e. I could introduce additional data members and configurables,
6691
6693
// for the names of histograms with weights. Like I did it in void GetHistogramWithCustomNUA(const char* filePath, eNUAPDF variable)
6692
6694
6695
+
// TBI 20241021 Strictly speaking, I do not need to pass here first 2 arguments, "filePath" and "runNumber", because they are initialized at call from data members.
6696
+
// But since this function is called only once, it's not an important performance loss. But re-think the design here eventually.
6697
+
6693
6698
// a) Return value;
6694
6699
// b) Basic protection for arguments;
6695
6700
// c) Determine from filePath if the file in on a local machine, or in AliEn, or in CCDB;
LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__);
6888
6893
}
6889
-
hist->SetDirectory(0);
6890
6894
6895
+
// *) insanity check for differential weights => check if boundaries of current bin are the same as bin boundaries for which these weights were calculated.
6896
+
// This way I ensure that weights correspond to same kinematic cuts and binning as in current analysis.
6897
+
// Current example format which was set in MakeWeights.C: someString(s), min < kinematic-variable-name < max
6898
+
// Algorithm: IFS is " " and I take (N-1)th and (N-5)th entry:
6899
+
TObjArray* oa = TString(hist->GetTitle()).Tokenize("");
6900
+
if (!oa) {
6901
+
LOGF(fatal, "in function \033[1;31m%s at line %d \n hist->GetTitle() = %s\033[0m", __FUNCTION__, __LINE__, hist->GetTitle());
6902
+
}
6903
+
Int_t nEntries = oa->GetEntries();
6904
+
6905
+
// I need to figure out corresponding variable from results histograms and its formatting:
LOGF(fatal, "in function \033[1;31m%s at line %d : mismatch in upper bin boundaries \n from title = %f , local = %f\033[0m", __FUNCTION__, __LINE__, TString(oa->At(nEntries - 1)->GetName()).Atof(), max);
6896
6929
}
6930
+
if (!(TMath::Abs(TString(oa->At(nEntries - 5)->GetName()).Atof() - min) < 1.e-6)) {
LOGF(fatal, "in function \033[1;31m%s at line %d : mismatch in lower bin boundaries \n from title = %f , local = %f\033[0m", __FUNCTION__, __LINE__, TString(oa->At(nEntries - 5)->GetName()).Atof(), min);
// *) check if particles in this pt bin survive particle cuts in pt. If not, skip this bin, because for that pt bin weights are simply not available:
7518
7563
if (!(res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 2) > pc.fdParticleCuts[ePt][eMin])) {
7519
7564
// this branch protects against the case when I am e.g. in pt bin [0.0,0.2], and pt cut is 0.2 < pt < 5.0
7520
-
LOGF(info, "\033[1;32m%s at line %d : you are requesting phi(pt) weight for pt bin = %d from (%f,%f), which is outside (below) pt phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 2), pc.fdParticleCuts[ePt][eMin], pc.fdParticleCuts[ePt][eMax]);
7565
+
LOGF(info, "\033[1;33m%s at line %d : you are requesting phi(pt) weight for pt bin = %d from (%f,%f), which is outside (below) pt phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 2), pc.fdParticleCuts[ePt][eMin], pc.fdParticleCuts[ePt][eMax]);
7521
7566
continue;
7522
7567
}
7523
7568
if (!(res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 1) < pc.fdParticleCuts[ePt][eMax])) {
7524
7569
// this branch protects against the case when I am e.g. in pt bin [5.0,10.0], and pt cut is 0.2 < pt < 5.0
7525
-
LOGF(info, "\033[1;32m%s at line %d : you are requesting phi(pt) weight for pt bin = %d from (%f,%f), which is outside (above) pt phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 2), pc.fdParticleCuts[ePt][eMin], pc.fdParticleCuts[ePt][eMax]);
7570
+
LOGF(info, "\033[1;33m%s at line %d : you are requesting phi(pt) weight for pt bin = %d from (%f,%f), which is outside (above) pt phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 2), pc.fdParticleCuts[ePt][eMin], pc.fdParticleCuts[ePt][eMax]);
7526
7571
continue;
7527
7572
}
7528
7573
@@ -7532,23 +7577,6 @@ void GetParticleWeights()
7532
7577
LOGF(fatal, "\033[1;31m%s at line %d : phiptWeights is NULL. Check the external file %s with particle weights\033[0m", __FUNCTION__, __LINE__, pw.fFileWithWeights.Data());
7533
7578
}
7534
7579
7535
-
// *) insanity check for differential weights => check if boundaries of current bin b are the same as bin boundaries for which these weights were calculated.
7536
-
// This way I ensure that weights correspond to same kinematic cuts and binning as in current analysis.
7537
-
// Current example format: <somePath>/weightsO2.root, 0.20 < p_{T} < 0.30
7538
-
// Algorithm: IFS is " ", and I take (N-1)th and (N-5)th entry:
7539
-
TObjArray* oa = TString(phiptWeights->GetTitle()).Tokenize("");
7540
-
if (!oa) {
7541
-
LOGF(fatal, "in function \033[1;31m%s at line %d \n phiptWeights->GetTitle() = %s\033[0m", __FUNCTION__, __LINE__, phiptWeights->GetTitle());
LOGF(fatal, "in function \033[1;31m%s at line %d : mismatch in upper bin boundaries \n from title = %f , local = %f\033[0m", __FUNCTION__, __LINE__, TString(oa->At(nEntries - 1)->GetName()).Atof(), res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 2));
LOGF(fatal, "in function \033[1;31m%s at line %d : mismatch in lower bin boundaries \n from title = %f , local = %f\033[0m", __FUNCTION__, __LINE__, TString(oa->At(nEntries - 5)->GetName()).Atof(), res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 1));
7549
-
}
7550
-
delete oa; // yes, otherwise it's a memory leak
7551
-
7552
7580
// *) okay, just use this histogram with weights:
7553
7581
SetDiffWeightsHist(phiptWeights, wPHIPT, b);
7554
7582
}
@@ -7563,12 +7591,12 @@ void GetParticleWeights()
7563
7591
// *) check if particles in this eta bin survive particle cuts in eta. If not, skip this bin, because for that eta bin weights are simply not available:
7564
7592
if (!(res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 2) > pc.fdParticleCuts[eEta][eMin])) {
7565
7593
// this branch protects against the case when I am e.g. in eta bin [-1.0,-0.8], and eta cut is -0.8 < eta < 0.8
7566
-
LOGF(info, "\033[1;32m%s at line %d : you are requesting phi(eta) weight for eta bin = %d from (%f,%f), which is outside (below) eta phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 2), pc.fdParticleCuts[eEta][eMin], pc.fdParticleCuts[eEta][eMax]);
7594
+
LOGF(info, "\033[1;33m%s at line %d : you are requesting phi(eta) weight for eta bin = %d from (%f,%f), which is outside (below) eta phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 2), pc.fdParticleCuts[eEta][eMin], pc.fdParticleCuts[eEta][eMax]);
7567
7595
continue;
7568
7596
}
7569
7597
if (!(res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 1) < pc.fdParticleCuts[eEta][eMax])) {
7570
7598
// this branch protects against the case when I am e.g. in eta bin [0.8,1.0], and eta cut is 0.8 < eta < 1.0
7571
-
LOGF(info, "\033[1;32m%s at line %d : you are requesting phi(eta) weight for eta bin = %d from (%f,%f), which is outside (above) eta phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 2), pc.fdParticleCuts[eEta][eMin], pc.fdParticleCuts[eEta][eMax]);
7599
+
LOGF(info, "\033[1;33m%s at line %d : you are requesting phi(eta) weight for eta bin = %d from (%f,%f), which is outside (above) eta phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 2), pc.fdParticleCuts[eEta][eMin], pc.fdParticleCuts[eEta][eMax]);
7572
7600
continue;
7573
7601
}
7574
7602
@@ -7578,23 +7606,6 @@ void GetParticleWeights()
7578
7606
LOGF(fatal, "\033[1;31m%s at line %d : phietaWeights is NULL. Check the external file %s with particle weights\033[0m", __FUNCTION__, __LINE__, pw.fFileWithWeights.Data());
7579
7607
}
7580
7608
7581
-
// *) insanity check for differential weights => check if boundaries of current bin b are the same as bin boundaries for which these weights were calculated.
7582
-
// This way I ensure that weights correspond to same kinematic cuts and binning as in current analysis.
7583
-
// Current example format: <somePath>/weightsO2.root, -0.8 < #eta < -0.4
7584
-
// Algorithm: IFS is " ", and I take (N-1)th and (N-5)th entry:
7585
-
TObjArray* oa = TString(phietaWeights->GetTitle()).Tokenize("");
7586
-
if (!oa) {
7587
-
LOGF(fatal, "in function \033[1;31m%s at line %d \n phietaWeights->GetTitle() = %s\033[0m", __FUNCTION__, __LINE__, phietaWeights->GetTitle());
LOGF(fatal, "in function \033[1;31m%s at line %d : mismatch in upper bin boundaries \n from title = %f , local = %f\033[0m", __FUNCTION__, __LINE__, TString(oa->At(nEntries - 1)->GetName()).Atof(), res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 2));
LOGF(fatal, "in function \033[1;31m%s at line %d : mismatch in lower bin boundaries \n from title = %f , local = %f\033[0m", __FUNCTION__, __LINE__, TString(oa->At(nEntries - 5)->GetName()).Atof(), res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 1));
Preprocess(collision); // yes, so that e.g. I can only test if the weights were correctly fetched from external file and initialized locally into data members
0 commit comments