TPC: adding option to use custom scalers (IDCs) for SC correction map scaling#12205
Conversation
shahor02
left a comment
There was a problem hiding this comment.
Looks good, please see a few minor comments below.
Also,
AliceO2/prodtests/full-system-test/dpl-workflow.sh
Lines 269 to 277 in ccbd217
--require-ctp-lumi (and now your lumi-type) are workflow level options while the rest is device level options.When the same device needs to use
severity different from the default, we need to pass this option as e.g. --gpu-reconstruction \"<option>\" and now the options must include all options of that device...Could you find a way to remove from the
$TPC_CORR_SCALING the eventual lumi-type <N> and assign it to ASK_CTP_LUMI_GPU?
| setInstLumi(mInstLumiFactor * (mCTPLumiSource == 0 ? lumiObj.getLumi() : lumiObj.getLumiAlt())); | ||
| } else if (getLumiScaleType() == 2 && mInstLumiOverride <= 0.) { | ||
| float tpcScaler = pc.inputs().get<float>("tpcscaler"); | ||
| setInstLumi(tpcScaler); |
There was a problem hiding this comment.
Why not applying the optional mInstLumiFactor also here? This would allow to use different maps with "mean" lumi nominated in other units than the source of "inst" lumi.
| tpcScalerTree.SetBranchAddress("TPCScaler", &scalerTmp); | ||
| const int entries = tpcScalerTree.GetEntries(); | ||
| if (entries > 0) { | ||
| tpcScalerTree.GetEntry(0); | ||
| *this = std::move(*scalerTmp); | ||
| delete scalerTmp; | ||
| } else { | ||
| LOGP(error, "TPCScaler not found in input file"); | ||
| } |
There was a problem hiding this comment.
why not simply
tpcScalerTree.SetBranchAddress("TPCScaler", &this);
if (entries > 0) {
tpcScalerTree.GetEntry(0);
} else {
LOGP(error, "TPCScaler not found in input file");
}
?
There was a problem hiding this comment.
I tried it and it seems to be not working: lvalue required as unary '&' operand. I think its related to this discussion https://stackoverflow.com/questions/13476879/how-can-you-assign-a-value-to-the-pointer-this-in-c
If I try something like this tpcScalerTree.SetBranchAddress("TPCScaler", &(*this)); it compiles, but then crashes Error in <TTree::SetBranchAddress>: The address for "TPCScaler" should be the address of a pointer!
There was a problem hiding this comment.
Indeed, but you can use intermediate pointer, thus avoiding the copy of the object. For me this works:
$ cat tcl.C
#include "TTree.h"
#include "TFile.h"
struct TstCl
{
int a=0;
void dumpToFile(const char* file = "tstcl.root", const char* name = "tsttree")
{
TFile out(file, "RECREATE");
TTree tree("tsttree", "");
tree.Branch("b", this);
tree.Fill();
out.WriteObject(&tree, name);
}
void setFromTree(TTree& t)
{
TstCl* adr = this;
t.SetBranchAddress("b",&adr);
t.GetEntry(0);
t.SetBranchAddress("b",nullptr);
}
ClassDefNV(TstCl, 1);
};
root [0] .L tcl.C+
root [1] TstCl v0{10};
root [2] v0.dumpToFile();
root [3] ff = TFile::Open("tstcl.root");
root [4] auto tt = (TTree*)gFile->Get("tsttree");
root [5] TstCl v1;
root [6] v1.a
(int) 0
root [7] v1.setFromTree(*tt);
root [7] v1.a
(int) 10
Hello @shahor02 thanks for the comments, but I don't understand really understand what you mean by this. Can you explain it in more detail? |
Workflow global options (those which alter inputs/outputs must be global ones, i.e. added via AliceO2/Detectors/TPC/calibration/src/CorrectionMapsLoader.cxx Lines 88 to 92 in ccbd217 TPC_CORR_SCALING and the gpu-reco workflow need to use explicitly the --gpu-reconstruction ... device options, we need to parse the $TPC_CORR_SCALING to 2 pieces which are passed separately.E.g. TPC_CORR_SCALING=" --lumi-type 2 --corrmap-lumi-mean XXX" in the generated command line should become
in the the |
|
Many thanks @shahor02 ! If I understand correctly this should be sufficient ?: |
|
@matthias-kleiner almost: there should be no anymore |
okay, many thanks for your help |
… scaling
Adding a generic method to provide scaling of the space-charge
correction maps based on the IDCs (and cluster currents).
In the `o2-tpc-scaler-workflow` for each TF the last n values (dependent
on the specified ion drift time and integration length of the scalers)
are averaged and provided as scaling value.
- A- and C-side values are averaged for now!
Example how to run with scalersfrom local file:
```
scaler="file:///data/mkleiner/run3/LHC23zo/539399_lowIR/=TPC/Calib/Scaler"
o2-ctf-reader-workflow --copy-cmd no-copy --onlyDet TPC --ctf-input ${INPUT} --severity warning --condition-remap "${scaler}" |
o2-tpc-scaler-workflow |
o2-tpc-reco-workflow --lumi-type 2 --input-type compressed-clusters-ctf --output-type "tracks,disable-writer" --disable-mc -b
```
- Adding mInstLumiFactor as optional scaling factor
ccbd217 to
ce75ac5
Compare
shahor02
left a comment
There was a problem hiding this comment.
@matthias-kleiner the last comment on the setFromTree is just a suggestion (to avoid object copy of potentially large object). Otherwise, the PR looks fine, but it is still in draft mode.
Many thanks, this works now |
wiechula
left a comment
There was a problem hiding this comment.
@shahor02 looks fine for me.
@matthias-kleiner thanks for the implementation!
Adding a generic method to provide scaling of the space-charge correction maps based on the IDCs (and cluster currents). In the
o2-tpc-scaler-workflowfor each TF the last n values (dependent on the specified ion drift time and integration length of the scalers) are averaged and provided as a scaling value.Example how to run with scalers from local file: