Skip to content

Commit

Permalink
Merge branch 'AliceO2Group:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
DelloStritto authored Apr 10, 2024
2 parents e83093f + 6d055ab commit ad0c5de
Show file tree
Hide file tree
Showing 544 changed files with 62,607 additions and 21,916 deletions.
7 changes: 5 additions & 2 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ DISABLE:
DISABLE_LINTERS:
- BASH_EXEC
- BASH_SHFMT
- CPP_CLANG_FORMAT
- JSON_PRETTIER
- YAML_V8R
- YAML_PRETTIER
- REPOSITORY_DEVSKIM
- REPOSITORY_KICS
- REPOSITORY_SECRETLINT
- REPOSITORY_TRIVY
- YAML_PRETTIER
- YAML_V8R
DISABLE_ERRORS_LINTERS: # If errors are found by these linters, they will be considered as non blocking.
- PYTHON_BANDIT # The bandit check is overly broad and complains about subprocess usage.
SHOW_ELAPSED_TIME: true
Expand All @@ -32,3 +33,5 @@ FLAVOR_SUGGESTIONS: false # Don't show suggestions about different MegaLinter fl
PYTHON_ISORT_CONFIG_FILE: pyproject.toml
PYTHON_PYRIGHT_CONFIG_FILE: pyproject.toml
PYTHON_RUFF_CONFIG_FILE: pyproject.toml
CPP_CPPLINT_FILE_EXTENSIONS: [".C", ".c", ".c++", ".cc", ".cl", ".cpp", ".cu", ".cuh", ".cxx", ".cxx.in", ".h", ".h++", ".hh", ".h.in", ".hpp", ".hxx", ".inc", ".inl", ".macro"]
CPP_CLANG_FORMAT_FILE_EXTENSIONS: [".C", ".c", ".c++", ".cc", ".cl", ".cpp", ".cu", ".cuh", ".cxx", ".cxx.in", ".h", ".h++", ".hh", ".h.in", ".hpp", ".hxx", ".inc", ".inl", ".macro"]
12 changes: 10 additions & 2 deletions ALICE3/Tasks/alice3-qa-singleparticle.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ struct Alice3SingleParticle {
histos.add("particle/daughters/prodVx", "Daughters Prod. Vertex X " + tit, kTH1D, {axisProdx});
histos.add("particle/daughters/prodVy", "Daughters Prod. Vertex Y " + tit, kTH1D, {axisPrody});
histos.add("particle/daughters/prodVz", "Daughters Prod. Vertex Z " + tit, kTH1D, {axisProdz});
histos.add("particle/daughters/prodDistanceX", "Daughters Prod. distance " + tit, kTH1D, {axisProdx});
histos.add("particle/daughters/prodDistanceY", "Daughters Prod. distance " + tit, kTH1D, {axisPrody});
histos.add("particle/daughters/prodDistanceZ", "Daughters Prod. distance " + tit, kTH1D, {axisProdz});
histos.add("particle/daughters/prodDistanceVsPt", "Daughters Prod. distance " + tit, kTH2D, {axisPt, axisProdRadius});
histos.add("particle/daughters/prodRadiusVsPt", "Daughters Prod. Vertex Radius " + tit, kTH2D, {axisPt, axisProdRadius});
histos.add("particle/daughters/prodRadius3DVsPt", "Daughters Prod. Vertex Radius XYZ " + tit, kTH2D, {axisPt, axisProdRadius});

Expand Down Expand Up @@ -268,8 +272,12 @@ struct Alice3SingleParticle {
histos.fill(HIST("particle/daughters/prodVx"), daughter.vx());
histos.fill(HIST("particle/daughters/prodVy"), daughter.vy());
histos.fill(HIST("particle/daughters/prodVz"), daughter.vz());
histos.fill(HIST("particle/daughters/prodRadiusVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy()));
histos.fill(HIST("particle/daughters/prodRadius3DVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy() + mcParticle.vz() * mcParticle.vz()));
histos.fill(HIST("particle/daughters/prodDistanceX"), daughter.vx() - mcParticle.vx());
histos.fill(HIST("particle/daughters/prodDistanceY"), daughter.vy() - mcParticle.vy());
histos.fill(HIST("particle/daughters/prodDistanceZ"), daughter.vz() - mcParticle.vz());
histos.fill(HIST("particle/daughters/prodDistanceVsPt"), mcParticle.pt(), std::sqrt((daughter.vx() - mcParticle.vx()) * (daughter.vx() - mcParticle.vx()) + (daughter.vy() - mcParticle.vy()) * (daughter.vy() - mcParticle.vy()) + (daughter.vz() - mcParticle.vz()) * (daughter.vz() - mcParticle.vz())));
histos.fill(HIST("particle/daughters/prodRadiusVsPt"), mcParticle.pt(), std::sqrt(daughter.vx() * daughter.vx() + daughter.vy() * daughter.vy()));
histos.fill(HIST("particle/daughters/prodRadius3DVsPt"), mcParticle.pt(), std::sqrt(daughter.vx() * daughter.vx() + daughter.vy() * daughter.vy() + daughter.vz() * daughter.vz()));
}
}
if (mcParticle.has_mothers()) {
Expand Down
9 changes: 7 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,25 @@
/DPG/Tasks/AOTEvent @alibuild @ekryshen @strogolo
/DPG/Tasks/AOTTrack @alibuild @mfaggin @belikov @njacazio
/DPG/Tasks/TOF @alibuild @noferini @njacazio
/DPG/Tasks/FT0 @alibuild @afurs
/EventFiltering @alibuild @mpuccio @strogolo
/EventFiltering/PWGHF @alibuild @fgrosa @zhangbiao-phy @mpuccio @strogolo
/EventFiltering/PWGUD @alibuild @pbuehler @mpuccio @strogolo
/EventFiltering/PWGLF @alibuild @mpuccio @ercolessi @ChiaraDeMartin95 @strogolo
/EventFiltering/PWGCF @alibuild @lauraser @mpuccio @strogolo
/EventFiltering/PWGMM @alibuild @aortizve @mpuccio @strogolo
/EventFiltering/PWGJE @alibuild @fkrizek @nzardosh @mpuccio @strogolo
/PWGCF @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul
/PWGCF @alibuild @saganatt @victor-gonzalez @zchochul
/PWGCF/Core @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul
/PWGCF/DataModel @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul
/PWGCF/TableProducer @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul
/PWGCF/Tasks @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul
/PWGDQ @alibuild @iarsene @dsekihat @feisenhu @lucamicheletti93
/PWGEM @alibuild @mikesas @rbailhac @feisenhu
/PWGEM/Dilepton @alibuild @mikesas @rbailhac @dsekihat @ivorobye @feisenhu
/PWGEM/PhotonMeson @alibuild @mikesas @rbailhac @m-c-danisch @novitzky @mhemmer-cern @dsekihat
/PWGHF @alibuild @vkucera @fcolamar @fgrosa @fcatalan92 @mfaggin @mmazzilli @deepathoms @nzardosh @NicoleBastid
/PWGLF @alibuild @fmazzasc @chiarapinto @BongHwi @smaff92 @mbombara @ChiaraDeMartin95 @njacazio @skundu692
/PWGLF @alibuild @ercolessi @fmazzasc @chiarapinto @BongHwi @smaff92 @mbombara @ChiaraDeMartin95 @njacazio @skundu692
/PWGMM @alibuild @aalkin
/PWGMM/Lumi @alibuild @aalkin
/PWGMM/Mult @alibuild @aalkin @aortizve @ddobrigk
Expand Down
8 changes: 7 additions & 1 deletion Common/CCDB/EventSelectionParams.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ const char* selectionLabels[kNsel] = {
"kNoPileupTPC",
"kIsTriggerTVX",
"kIsINT1",
"kNoITSROFrameBorder"};
"kNoITSROFrameBorder",
"kNoTimeFrameBorder",
"kNoSameBunchPileup",
"kIsGoodZvtxFT0vsPV",
"kIsVertexITSTPC",
"kIsVertexTOFmatched",
"kIsVertexTRDmatched"};
} // namespace o2::aod::evsel

using namespace o2::aod::evsel;
Expand Down
15 changes: 14 additions & 1 deletion Common/CCDB/EventSelectionParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ enum EventSelectionFlags {
kIsTriggerTVX, // FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level
kIsINT1, // SPDGFO >= 1 || V0A || V0C
kNoITSROFrameBorder, // bunch crossing is far from ITS RO Frame border
kNoTimeFrameBorder, // bunch crossing is far from Time Frame borders
kNoSameBunchPileup, // reject collisions in case of pileup with another collision in the same foundBC
kIsGoodZvtxFT0vsPV, // small difference between z-vertex from PV and from FT0
kIsVertexITSTPC, // at least one ITS-TPC track (reject vertices built from ITS-only tracks)
kIsVertexTOFmatched, // at least one of vertex contributors is matched to TOF
kIsVertexTRDmatched, // at least one of vertex contributors is matched to TRD
kNsel // counter
};

Expand Down Expand Up @@ -134,7 +140,14 @@ class EventSelectionParams
float fV0CasymA = -25.f;
float fV0CasymB = 0.15f;

ClassDefNV(EventSelectionParams, 4)
int fTimeFrameOrbitShift = 0; // shift of first orbit in TF wrt (SOR-OrbitReset)%TFDuration (in orbits)
int fTimeFrameStartBorderMargin = 300; // number of bcs to cut in the beginning of TF
int fTimeFrameEndBorderMargin = 4000; // number of bcs to cut at the end of TF

int fITSROFrameStartBorderMargin = 10; // number of bcs to cut in the beginning of ITS readout frame
int fITSROFrameEndBorderMargin = 20; // number of bcs to cut in the end of ITS readout frame

ClassDefNV(EventSelectionParams, 5)
};

#endif // COMMON_CCDB_EVENTSELECTIONPARAMS_H_
78 changes: 30 additions & 48 deletions Common/CCDB/ctpRateFetcher.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@

namespace o2
{

using framework::Service;

double ctpRateFetcher::fetch(Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber, std::string sourceName)
double ctpRateFetcher::fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, std::string sourceName)
{
setupRun(runNumber, ccdb, timeStamp);
if (sourceName.find("ZNC") != std::string::npos) {
if (runNumber < 544448) {
return fetchCTPratesInputs(ccdb, timeStamp, runNumber, 26) / (sourceName.find("hadronic") != std::string::npos ? 28. : 1.);
return fetchCTPratesInputs(ccdb, timeStamp, runNumber, 25) / (sourceName.find("hadronic") != std::string::npos ? 28. : 1.);
} else {
return fetchCTPratesClasses(ccdb, timeStamp, runNumber, "C1ZNC-B-NOPF-CRU", 6) / (sourceName.find("hadronic") != std::string::npos ? 28. : 1.);
}
Expand All @@ -41,18 +39,15 @@ double ctpRateFetcher::fetch(Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t
if (runNumber < 534202) {
return fetchCTPratesClasses(ccdb, timeStamp, runNumber, "minbias_TVX_L0"); // 2022
} else {
return fetchCTPratesClasses(ccdb, timeStamp, runNumber, "CMTVX-B-NOPF-CRU");
return fetchCTPratesClasses(ccdb, timeStamp, runNumber, "CMTVX-B-NOPF");
}
}
LOG(error) << "CTP rate for " << sourceName << " not available";
return -1.;
}

double ctpRateFetcher::fetchCTPratesClasses(Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber, std::string className, int inputType)
double ctpRateFetcher::fetchCTPratesClasses(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, const std::string& className, int inputType)
{
getCTPscalers(ccdb, timeStamp, runNumber);
getCTPconfig(ccdb, timeStamp, runNumber);

std::vector<ctp::CTPClass> ctpcls = mConfig->getCTPClasses();
std::vector<int> clslist = mConfig->getTriggerClassList();
int classIndex = -1;
Expand All @@ -66,72 +61,59 @@ double ctpRateFetcher::fetchCTPratesClasses(Service<o2::ccdb::BasicCCDBManager>&
LOG(fatal) << "Trigger class " << className << " not found in CTPConfiguration";
}

auto rate{mScalers->getRateGivenT(timeStamp, classIndex, inputType)};
auto rate{mScalers->getRateGivenT(timeStamp * 1.e-3, classIndex, inputType)};

return pileUpCorrection(rate.second);
}

double ctpRateFetcher::fetchCTPratesInputs(Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber, int input)
double ctpRateFetcher::fetchCTPratesInputs(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, int input)
{
getCTPscalers(ccdb, timeStamp, runNumber);
getLHCIFdata(ccdb, timeStamp, runNumber);

std::vector<ctp::CTPScalerRecordO2> recs = mScalers->getScalerRecordO2();
if (recs[0].scalersInps.size() == 48) {
return pileUpCorrection(mScalers->getRateGivenT(timeStamp, input, 7).second);
return pileUpCorrection(mScalers->getRateGivenT(timeStamp * 1.e-3, input, 7).second);
} else {
LOG(error) << "Inputs not available";
return -1.;
}
}

void ctpRateFetcher::getCTPscalers(Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber)
double ctpRateFetcher::pileUpCorrection(double triggerRate)
{
if (runNumber == mRunNumber && mScalers != nullptr) {
return;
}
std::map<string, string> metadata;
metadata["runNumber"] = std::to_string(runNumber);
mScalers = ccdb->getSpecific<ctp::CTPRunScalers>("CTP/Calib/Scalers", timeStamp, metadata);
if (mScalers == nullptr) {
LOG(fatal) << "CTPRunScalers not in database, timestamp:" << timeStamp;
}
mScalers->convertRawToO2();
auto bfilling = mLHCIFdata->getBunchFilling();
std::vector<int> bcs = bfilling.getFilledBCs();
double nbc = bcs.size();
double nTriggersPerFilledBC = triggerRate / nbc / constants::lhc::LHCRevFreq;
double mu = -std::log(1 - nTriggersPerFilledBC);
return mu * nbc * constants::lhc::LHCRevFreq;
}

void ctpRateFetcher::getLHCIFdata(Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber)
void ctpRateFetcher::setupRun(int runNumber, o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp)
{
if (runNumber == mRunNumber && mLHCIFdata != nullptr) {
if (runNumber == mRunNumber) {
return;
}
mRunNumber = runNumber;
LOG(debug) << "Setting up CTP scalers for run " << mRunNumber;
if (mManualCleanup) {
delete mConfig;
delete mScalers;
delete mLHCIFdata;
}
std::map<string, string> metadata;
mLHCIFdata = ccdb->getSpecific<parameters::GRPLHCIFData>("GLO/Config/GRPLHCIF", timeStamp, metadata);
if (mLHCIFdata == nullptr) {
LOG(fatal) << "GRPLHCIFData not in database, timestamp:" << timeStamp;
}
}

void ctpRateFetcher::getCTPconfig(Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber)
{
if (runNumber == mRunNumber && mConfig != nullptr) {
return;
}
std::map<string, string> metadata;
metadata["runNumber"] = std::to_string(runNumber);
metadata["runNumber"] = std::to_string(mRunNumber);
mConfig = ccdb->getSpecific<ctp::CTPConfiguration>("CTP/Config/Config", timeStamp, metadata);
if (mConfig == nullptr) {
LOG(fatal) << "CTPRunConfig not in database, timestamp:" << timeStamp;
}
}

double ctpRateFetcher::pileUpCorrection(double triggerRate)
{
auto bfilling = mLHCIFdata->getBunchFilling();
std::vector<int> bcs = bfilling.getFilledBCs();
double nbc = bcs.size();
double nTriggersPerFilledBC = triggerRate / nbc / constants::lhc::LHCRevFreq;
double mu = -std::log(1 - nTriggersPerFilledBC);
return mu * nbc * constants::lhc::LHCRevFreq;
mScalers = ccdb->getSpecific<ctp::CTPRunScalers>("CTP/Calib/Scalers", timeStamp, metadata);
if (mScalers == nullptr) {
LOG(fatal) << "CTPRunScalers not in database, timestamp:" << timeStamp;
}
mScalers->convertRawToO2();
}

} // namespace o2
14 changes: 7 additions & 7 deletions Common/CCDB/ctpRateFetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <string>

#include "CCDB/BasicCCDBManager.h"
#include "Framework/AnalysisHelpers.h"

namespace o2
{
Expand All @@ -35,16 +34,17 @@ class ctpRateFetcher
{
public:
ctpRateFetcher() = default;
double fetch(framework::Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber, std::string sourceName);
double fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, std::string sourceName);

void setManualCleanup(bool manualCleanup = true) { mManualCleanup = manualCleanup; }

private:
void getCTPconfig(framework::Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber);
void getCTPscalers(framework::Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber);
void getLHCIFdata(framework::Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber);
double fetchCTPratesInputs(framework::Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber, int input);
double fetchCTPratesClasses(framework::Service<o2::ccdb::BasicCCDBManager>& ccdb, uint64_t timeStamp, int runNumber, std::string className, int inputType = 1);
double fetchCTPratesInputs(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, int input);
double fetchCTPratesClasses(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, const std::string& className, int inputType = 1);
double pileUpCorrection(double rate);
void setupRun(int runNumber, o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp);

bool mManualCleanup = false;
int mRunNumber = -1;
ctp::CTPConfiguration* mConfig = nullptr;
ctp::CTPRunScalers* mScalers = nullptr;
Expand Down
Loading

0 comments on commit ad0c5de

Please sign in to comment.