Skip to content

Commit 297dd8d

Browse files
author
Pengchong Hu
committed
correction of weightsfile
1 parent cc32d67 commit 297dd8d

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

PWGCF/MultiparticleCorrelations/Tasks/multiharmonicCorrelations.cxx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
419419
return;
420420
}
421421
// Print current run number:
422-
// LOGF(info, "Run number: %d", collision.bc().runNumber());
423422
int currentRun = collision.bc().runNumber();
424423
auto it = phih.histMap.find(currentRun);
425424
auto histweight = wh.weightsmap.find(currentRun);
@@ -532,8 +531,14 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
532531
it->second->Fill(phi);
533532
}
534533

535-
if (cfUseWeights && histweight != wh.weightsmap.end())
536-
weight = histweight->second->GetBinContent(histweight->second->FindBin(phi));
534+
if (cfUseWeights){
535+
if (histweight != wh.weightsmap.end() && histweight->second)
536+
weight = histweight->second->GetBinContent(histweight->second->FindBin(phi));
537+
else{
538+
LOG(warning) << "No weights found for run " << currentRun << ", using weight=1";
539+
weight = 1;
540+
}
541+
}
537542
else
538543
weight = 1;
539544

@@ -573,9 +578,9 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
573578
float wFour = Four(0, 0, 0, 0).Re();
574579
float four32 = Four(3, 2, -3, -2).Re() / wFour;
575580
float four42 = Four(4, 2, -4, -2).Re() / wFour;
576-
float v22 = Two(2, -2) / wTwo;
577-
float v32 = Two(3, -3) / wTwo;
578-
float v42 = Two(4, -4) / wTwo;
581+
float v22 = Two(2, -2).Re() / wTwo;
582+
float v32 = Two(3, -3).Re() / wTwo;
583+
float v42 = Two(4, -4).Re() / wTwo;
579584
if (std::isnan(v22) || std::isnan(v32) || std::isnan(v42) || std::isnan(four32) || std::isnan(four42)) {
580585
LOGF(info, "\033[1;31m%s std::isnan(v22) || std::isnan(v32) || std::isnan(v42) || std::isnan(four32) || std::isnan(four42)\033[0m", __FUNCTION__);
581586
LOGF(error, "v22 = %f\nv32 = %f\nv42 = %f\nfour32=%f\nv42 = %f\n", v22, v32, v42, four32, four42);
@@ -802,6 +807,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
802807
LOG(fatal) << "Failed to load weights for run " << run;
803808
return;
804809
}
810+
histweights->SetName(Form("histWithEfficiencyCorrections_%d", run));
805811
wh.fWeightsHistList->Add(histweights);
806812
wh.weightsmap[run] = histweights;
807813
}

0 commit comments

Comments
 (0)