24 m_MuonSelectionTool.declarePropertyFor(
this,
"MuonSelectionTool",
"Instance of the MuonSelectionTool needed for the HighPt categorization");
25 m_MuonIntSagittaTool.declarePropertyFor(
this,
"SagittaTool",
"Instance of the Sagitta bias corrections sub tool");
26 m_MuonIntScaleSmearTool.declarePropertyFor(
this,
"ScaleAndSmearTool",
"Instance of the tool that applies the smearing & scale corrections");
27 m_MuonIntHighTSmearTool.declarePropertyFor(
this,
"HighPtSmearingTool",
"Extra smearing of the high pt working point");
40 ATH_MSG_INFO(
"Data will be corrected for sagitta bias and Montecarlo will be corrected using CB calibration");
42 }
else if (
m_calibMode == MuonCalibTool::correctData_IDMS) {
43 ATH_MSG_INFO(
"Data will be corrected for sagitta bias and Montecarlo will be corrected using ID+MS calibration");
45 }
else if (
m_calibMode == MuonCalibTool::notCorrectData_IDMS) {
46 ATH_MSG_INFO(
"Data will be untouched (no sagitta bias corrections) and Montecarlo will be corrected using ID+MS calibration");
48 }
else if (
m_calibMode == MuonCalibTool::notCorrectData_CB) {
49 ATH_MSG_INFO(
"Data will be untouched (no sagitta bias corrections) and Montecarlo will be corrected using CB calibration");
51 }
else if (
m_calibMode == MuonCalibTool::correctData_IDonly) {
52 ATH_MSG_INFO(
"Data will be corrected for sagitta bias and Montecarlo will be corrected using ID calibration only");
54 }
else if (
m_calibMode == MuonCalibTool::correctData_MSonly) {
55 ATH_MSG_INFO(
"Data will be corrected for sagitta bias and Montecarlo will be corrected using MS calibration only");
57 }
else if (
m_calibMode == MuonCalibTool::userDefined) {
62 << MuonCalibTool::correctData_CB <<
") correctData_IDMS ("
63 << MuonCalibTool::correctData_IDMS <<
") or notCorrectData_IDMS ("
64 << MuonCalibTool::notCorrectData_IDMS <<
") or notCorrectData_CB ("
65 << MuonCalibTool::notCorrectData_CB <<
") or correctData_IDonly ("
66 << MuonCalibTool::correctData_IDonly <<
") or correctData_MSonly ("
67 << MuonCalibTool::correctData_MSonly <<
")");
68 return StatusCode::FAILURE;
85 addSubtool (*selectionTool);
121 return StatusCode::FAILURE;
127 return StatusCode::FAILURE;
131 return StatusCode::SUCCESS;
144 ATH_MSG_VERBOSE(
"Muon Type = " << mu(
acc.muonTypeAcc) <<
" ( 0: Combined, 1: StandAlone, 2: SegmentTagged, 3: CaloTagged, 4: SiliconAssociatedForwardMuon)");
172 if (mu(
acc.muonTypeAcc) == xAOD::Muon::MuonType::Combined)
183 ATH_MSG_DEBUG(
"Checking Output Muon Info for data - Pt_ID: " <<
acc.dec_idPt(mu));
184 ATH_MSG_DEBUG(
"Checking Output Muon Info for data - Pt_MS: " <<
acc.dec_mePt(mu));
185 ATH_MSG_DEBUG(
"Checking Output Muon Info for data - Pt_CB: " << mu(
acc.ptAcc));
195 if ((mu(
acc.muonTypeAcc) != xAOD::Muon::MuonType::SiliconAssociatedForwardMuon))
260 inTrk.
charge() / (res_pt * std::cosh(inTrk.
eta())));
271 "Non-null pointer received. "
272 "There's a possible memory leak!");
278 output->makePrivateStore(input);
291 return sys.find(systematic) != sys.end();
308 if(code != StatusCode::SUCCESS)
return code;
311 if(code != StatusCode::SUCCESS)
return code;
315 if(code != StatusCode::SUCCESS)
return code;
361 double Primary_eta = mu(
acc.etaAcc);
362 double Primary_phi = mu(
acc.phiAcc);
366 static const SG::AuxElement::Accessor<float> id_pt(
"expert_ptid");
367 static const SG::AuxElement::Accessor<float> ms_pt(
"expert_ptms");
368 static const SG::AuxElement::Accessor<float> cb_pt(
"expert_ptcb");
370 loc_ptid = id_pt(mu.getXAODObject()) *
MeVtoGeV;
371 loc_ptms = ms_pt(mu.getXAODObject()) *
MeVtoGeV;
372 loc_ptcb = cb_pt(mu.getXAODObject()) *
MeVtoGeV;
377 auto CB_track = mu(
acc.combinedTrackParticleLinkAcc);
378 auto ID_track = mu(
acc.inDetTrackParticleLinkAcc).opt_value();
379 auto ME_track = mu(
acc.extrapolatedMuonSpectrometerTrackParticleLinkAcc);
403 double denominator = (loc_ptcb)*std::sqrt(sigmaID * sigmaID + sigmaMS * sigmaMS);
404 return denominator ? sigmaID * sigmaMS / denominator : 0.;
432 double Primary_eta = mu(
acc.etaAcc);
433 double Primary_phi = mu(
acc.phiAcc);
439 static const SG::AuxElement::Accessor<float> cb_pt(
"expert_ptcb");
440 static const SG::AuxElement::Accessor<float> id_pt(
"expert_ptid");
441 static const SG::AuxElement::Accessor<float> ms_pt(
"expert_ptms");
442 static const SG::AuxElement::Accessor<
AmgVector(5)> CBParam(
"CBParam");
443 static const SG::AuxElement::Accessor<
AmgSymMatrix(5)> CBCov(
"CBCov");
444 static const SG::AuxElement::Accessor<
AmgVector(5)> IDParam(
"IDParam");
445 static const SG::AuxElement::Accessor<
AmgSymMatrix(5)> IDCov(
"IDCov");
446 static const SG::AuxElement::Accessor<
AmgVector(5)> MEParam(
"MEParam");
447 static const SG::AuxElement::Accessor<
AmgSymMatrix(5)> MECov(
"MECov");
467 auto CB_track = mu(
acc.combinedTrackParticleLinkAcc);
468 auto ID_track = mu(
acc.inDetTrackParticleLinkAcc).opt_value();
469 auto ME_track = mu(
acc.extrapolatedMuonSpectrometerTrackParticleLinkAcc);
472 if (mu(
acc.muonTypeAcc) == xAOD::Muon::MuonType::SiliconAssociatedForwardMuon)
474 if (CB_track)
charge = CB_track.value()(
acc.trkChargeAcc);
529 TRandom3 loc_random3;
535 const UInt_t seed = 1 + std::abs(muonObj.
CB.
phi) * 1E6 + std::abs(muonObj.
CB.
eta) * 1E3 +
eventNumber;
536 loc_random3.SetSeed(seed);
538 muonObj.
rnd_g0 = loc_random3.Gaus(0, 1);
539 muonObj.
rnd_g1 = loc_random3.Gaus(0, 1);
540 muonObj.
rnd_g2 = loc_random3.Gaus(0, 1);
541 muonObj.
rnd_g3 = loc_random3.Gaus(0, 1);
542 muonObj.
rnd_g4 = loc_random3.Gaus(0, 1);
556 constexpr unsigned int last_run_16 = 320000;
557 constexpr unsigned int last_run_17 = 342000;
558 constexpr unsigned int last_run_18 = 370000;
559 constexpr unsigned int last_run_22 = 440614;
560 constexpr unsigned int last_run_23 = 456750;
561 constexpr unsigned int last_run_24 = 999999;
563 static const std::set<int> MCperiods1516{284500};
564 static const std::set<int> MCperiods17{300000, 304000, 305000};
565 static const std::set<int> MCperiods18{310000};
566 static const std::set<int> MCperiods22{330000, 410000};
567 static const std::set<int> MCperiods23{450000};
568 static const std::set<int> MCperiods24{470000};
570 static const std::set<int> MCperiodsRun4{350000, 350060, 350140, 350200};
573 unsigned int run = 0;
575 else run = evtInfo(
acc.runNumberAcc);
578 if (
acc.acc_rnd.isAvailable(evtInfo))
579 run =
acc.acc_rnd(evtInfo);
582 "No random runnumber could be found although the tool is configured to assign the years based on it. Please make sure "
583 "to apply the prwTool before-hand or consider to set the property 'useRandomRunNumber' to false.");
588 if (!isData && (!
m_useRndRun || !
acc.acc_rnd.isAvailable(evtInfo))) {
589 if (MCperiods1516.count(
run)) {
590 ATH_MSG_DEBUG(
"The current run " <<
run <<
" corresponds to data mc20a / data15-16");
592 }
else if (MCperiods17.count(
run)) {
593 ATH_MSG_DEBUG(
"The current run " <<
run <<
" corresponds to data mc20d / data17");
595 }
else if (MCperiods18.count(
run)) {
596 ATH_MSG_DEBUG(
"The current run " <<
run <<
" corresponds to data mc20e / data18");
598 }
else if (MCperiods22.count(
run)) {
599 ATH_MSG_DEBUG(
"The current run " <<
run <<
" corresponds to data mc21 / mc23a / data22");
601 }
else if (MCperiods23.count(
run)) {
602 ATH_MSG_DEBUG(
"The current run " <<
run <<
" corresponds to data mc23c / mc23d / data23");
604 }
else if (MCperiods24.count(
run)) {
605 ATH_MSG_DEBUG(
"The current run " <<
run <<
" corresponds to data mc23e / data24");
607 }
else if (MCperiodsRun4.count(
run)) {
615 if (
run < last_run_16) {
618 }
else if (
run <= last_run_17) {
621 }
else if (
run <= last_run_18) {
624 }
else if (
run <= last_run_22) {
627 }
else if (
run < last_run_23) {
630 }
else if (
run < last_run_24) {
635 static std::atomic<bool> warningPrinted {
false};
636 if (!warningPrinted) {
637 ATH_MSG_WARNING(
"Could not assign run-number " <<
run <<
" to a specific year of data-taking, using default year 24");
638 warningPrinted =
true;
653 throw std::runtime_error(
"OutOfValidityRange in applyCorrection");
656 throw std::runtime_error(
"Error in applyCorrection");
665 auto eventInfo =
acc.m_eventInfoCol(event);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define AmgSymMatrix(dim)
Return value from object correction CP tools.
@ Error
Some error happened during the object correction.
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
This module implements the central registry for handling systematic uncertainties with CP tools.
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
StatusCode registerSystematics(const IReentrantSystematicsTool &tool)
effects: register all the systematics from the tool
Class to wrap a set of SystematicVariations.
a class representing a single optional object (electron, muons, etc.)
@ IS_SIMULATION
true: simulation, false: data
float z0() const
Returns the parameter.
float theta() const
Returns the parameter, which has range 0 to .
float d0() const
Returns the parameter.
void setDefiningParameters(float d0, float z0, float phi0, float theta, float qOverP)
Set the defining parameters.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float charge() const
Returns the charge.
float phi0() const
Returns the parameter, which has range to .
Select isolated Photons, Electrons and Muons.
constexpr double muonMassInMeV
the mass of the muon (in MeV)
ObjectId< MuonDef > MuonId
ObjectRange< EventContextDef > EventContextRange
ObjectId< EventContextDef > EventContextId
ObjectRange< MuonDef > MuonRange
ObjectId< EventInfoDef > EventInfoId
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version:
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
double expectedPercentResME
double rnd_g0
Random numbers helping for the calibration.
std::optional< ResolutionCategory > raw_mst_category
double expectedPercentResID
Basic object to cache all relevant information from the track.
int calib_charge
Value of the track-charge (after calibration).
const double eta
Value of the track-eta.
const double phi
Value of the track-phi.
double calib_pt
Smeared track pt.
int run(int argc, char *argv[])