Skip to content

HMPID condition paramters calibration using DCS DPs#9171

Merged
shahor02 merged 21 commits into
AliceO2Group:devfrom
gvolpe79:hmpcalib
Sep 1, 2022
Merged

HMPID condition paramters calibration using DCS DPs#9171
shahor02 merged 21 commits into
AliceO2Group:devfrom
gvolpe79:hmpcalib

Conversation

@gvolpe79
Copy link
Copy Markdown
Collaborator

No description provided.

startValidity = std::chrono::duration_cast<std::chrono::milliseconds>(timeNow.time_since_epoch()).count(); // in ms
}

mProcessor->setStartValidity(startValidity);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are setting startvalidity each time you receive something, i.e. at least every 5 s (when the full DPs image is sent even if nothing was changed). Should not you use as a start validity the beginning of the integration period?

// Called At the end of the Stream of DPs, in
// HMPIDDCSDataProcessorSpec::endOfStream() function
void HMPIDDCSProcessor::finalize()
{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see, you create a CCDB object only in the endOfStream, but this means never, as the workflow is running permanently, w/o any correlation with data taking (SOR/EOR).
In case you need to perform some action at the EOR, you can use https://github.com/AliceO2Group/AliceO2/blob/dev/Detectors/DCS/include/DetectorsDCS/RunStatusChecker.h, see how EMCAL does this:

if (mCheckRunStartStop) {
const auto* grp = mRunChecker.check(); // check if there is a run with EMC
// this is an example of what it will return
if (mRunChecker.getRunStatus() == RunStatus::NONE) {
LOGP(info, "No run with is ongoing or finished");
} else if (mRunChecker.getRunStatus() == RunStatus::START) { // saw new run with wanted detectors
LOGP(info, "Run {} has started", mRunChecker.getFollowedRun());
grp->print();
mProcessor->setRunNumberFromGRP(mRunChecker.getFollowedRun());
} else if (mRunChecker.getRunStatus() == RunStatus::ONGOING) { // run which was already seen is still ongoing
LOGP(info, "Run {} is still ongoing", mRunChecker.getFollowedRun());
} else if (mRunChecker.getRunStatus() == RunStatus::STOP) { // run which was already seen was stopped (EOR seen)
LOGP(info, "Run {} was stopped", mRunChecker.getFollowedRun());
}
} else {
mProcessor->setRunNumberFromGRP(-2);
}


/// / return timestamp of first fetched datapoint for a given ID (Tin/Tout,
/// Environment pressure, HV, chamber pressure)
TimeStampType getMinTime(const std::vector<DPCOM> dps)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass by ref. instead of copy: const std::vector<DPCOM>& dps

}
// return timestamp of last fetched datapoint for a given ID (Tin/Tout,
// Environment pressure, HV, chamber pressure)
TimeStampType getMaxTime(const std::vector<DPCOM> dps)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem.

return lastTime;
}

void checkEntries(const std::vector<TF1> arQthresh,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem.


for (int iCh = 0; iCh < 7; ++iCh) {
for (int iSec = 0; iSec < 6; ++iSec) {
auto tf = arQthresh.at(6 * iCh + iSec);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use [i] instead of .at(i), also below


std::unique_ptr<HMPIDDCSProcessor> mProcessor;
HighResClock::time_point mTimer;
int64_t mDPsUpdateInterval;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where you set or use update interval. Please avoid very frequent updates of CCDB at every change. See how other detectors, e.g. FIT/FT0/calibration/testWorkflow/FT0DCSDataProcessorSpec.h do

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @shahor02, variable mDPsUpdateInterval is not used indeed, is there by mistake, we are going to remove it! We update CCDB just at the end of RUN (see endOfStream method). I think this is correct! At least if I have not misunderstood something!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gvolpe79
The endOfStream for the DP processor is rather meaningless: the DP processing workflow runs continuously and is not synchronized with SOR/EOR. The only way to detect run start/stop is to use mRunChecker.getRunStatus() as you do and send run-related output from the run(..) method. That said, note that it is not 100% reliable: if the AliECS crashes, the EOR will be never flagged in the CCDB. @knopers8 works on fixing this but the ETA is not clear.

Comment on lines +695 to +698
std::unique_ptr<TF1> pEnv = finalizeEnvPressure();
for (int iCh = 0; iCh < 7; iCh++) {

std::unique_ptr<TF1> pChPres = finalizeChPressure(iCh);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the role of these histos? They are created and deleted when going out of scope w/o being used

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, are not in the CCDB but used to create the objects (charge threshold) to be stored in the CCDB (see lines 717 and 718 ) and then deleted.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you are using the name only, why do you need to create a histo?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not an histos, they are TF1 objects coming from the fit of histos.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, still don't fully understand the logic, but given that it is done once per run at finalization, the overhead should not be important.

outputs, AlgorithmSpec{adaptFromTask<o2::hmpid::HMPIDDCSDataProcessor>()},
Options{{"ccdb-path",
VariantType::String,
"localhost:8080",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use o2::base::NameConf::getCCDBServer() as a default.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to replace the local host?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the default server should be o2::base::NameConf::getCCDBServer(), so it can be globally changed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, we are going to modify the line

{"Use CCDB to configure"}},
{"follow-hmpid-run",
VariantType::Bool,
false,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I get it right, with default setting (no run following) you will not produce any output? Is this what you want?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is what we want.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, but then it is not clear why this is an option, moreover set to false by default ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, the idea was to optimize the code later on! Anyway, since it is simple to modify it, we are doing to do it now.

@shahor02 shahor02 merged commit 8302be8 into AliceO2Group:dev Sep 1, 2022
@gvolpe79 gvolpe79 deleted the hmpcalib branch December 19, 2022 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants