@@ -85,10 +85,10 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
8585 bool updateCurvatureIU = false ; // To update the track parameter Q/Pt in trackIU table, particularly used for V0 mass width dependence on Q/Pt
8686 bool updatePulls = false ;
8787 bool isInputFileFromCCDB = false ; // query input file from CCDB or local folder
88- std::string pathInputFile = " " ; // Path to file containing DCAxy, DCAz graphs from data and MC
89- std::string nameInputFile = " " ; // Name of the file containing DCAxy, DCAz graphs from data and MC
90- std::string pathFileQoverPt = " " ; // Path to file containing Q/Pt correction graphs from data and MC (only one proxy provided, i.e. D0 sigma graphs from data and MC)
91- std::string nameFileQoverPt = " " ; // file name containing Q/Pt correction graphs from data and MC
88+ std::string pathInputFile{}; // Path to file containing DCAxy, DCAz graphs from data and MC
89+ std::string nameInputFile{}; // Name of the file containing DCAxy, DCAz graphs from data and MC
90+ std::string pathFileQoverPt{}; // Path to file containing Q/Pt correction graphs from data and MC (only one proxy provided, i.e. D0 sigma graphs from data and MC)
91+ std::string nameFileQoverPt{}; // file name containing Q/Pt correction graphs from data and MC
9292 bool usePvRefitCorrections = false ; // establish whether to use corrections obtained with or w/o PV refit
9393 float qOverPtMC = -1 .; // 1/pt MC
9494 float qOverPtData = -1 .; // 1/pt data
@@ -99,7 +99,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
9999 int nPhiBins = 1 ;
100100 int runNumber = 0 ; // first run number considered in analysis (useful only if autoDetectDcaCalib = true)
101101 bool areGraphsConfigured = false ;
102- std::string outputString = " " ;
102+ std::string outputString{} ;
103103
104104 std::map<std::string, std::string> metadata;
105105
@@ -380,8 +380,9 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
380380
381381 LOG (info) << " [TrackTuner]" ;
382382 LOG (info) << " [TrackTuner] >>> String slices:" ;
383- for (const std::string& s : slices)
383+ for (const std::string& s : slices) {
384384 LOG (info) << " [TrackTuner] " << s;
385+ }
385386
386387 // / check if the number of input parameters is correct
387388 if (static_cast <uint8_t >(slices.size ()) != NPars) {
@@ -409,9 +410,9 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
409410
410411 // / further lambda expression to handle bool initialization
411412 auto setBoolFromString = [=](bool & b, const std::string& str) {
412- if (! str. compare ( " 1" ) || str.find (" true" ) != std::string::npos || str.find (" True" ) != std::string::npos || str.find (" TRUE" ) != std::string::npos) {
413+ if (str == " 1" || str.find (" true" ) != std::string::npos || str.find (" True" ) != std::string::npos || str.find (" TRUE" ) != std::string::npos) {
413414 b = true ;
414- } else if (! str. compare ( " 0" ) || str.find (" false" ) != std::string::npos || str.find (" False" ) != std::string::npos || str.find (" FALSE" ) != std::string::npos) {
415+ } else if (str == " 0" || str.find (" false" ) != std::string::npos || str.find (" False" ) != std::string::npos || str.find (" FALSE" ) != std::string::npos) {
415416 b = false ;
416417 } else {
417418 LOG (fatal) << " [TrackTuner] Wrong bool initialization from configuration " ;
@@ -422,36 +423,36 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
422423 LOG (info) << " [TrackTuner] >>> Parameters after the custom settings" ;
423424 // Configure autoDetectDcaCalib
424425 setBoolFromString (autoDetectDcaCalib, getValueString (AutoDetectDcaCalib));
425- outputString += " autoDetectDcaCalib=" + std::to_string (autoDetectDcaCalib);
426+ outputString += " autoDetectDcaCalib=" + std::to_string (static_cast < int >( autoDetectDcaCalib) );
426427 LOG (info) << " [TrackTuner] autoDetectDcaCalib = " << autoDetectDcaCalib;
427428 // Configure debugInfo
428429 setBoolFromString (debugInfo, getValueString (DebugInfo));
429430 LOG (info) << " [TrackTuner] debugInfo = " << debugInfo;
430- outputString += " , debugInfo=" + std::to_string (debugInfo);
431+ outputString += " , debugInfo=" + std::to_string (static_cast < int >( debugInfo) );
431432 // Configure updateTrackDCAs
432433 setBoolFromString (updateTrackDCAs, getValueString (UpdateTrackDCAs));
433434 LOG (info) << " [TrackTuner] updateTrackDCAs = " << updateTrackDCAs;
434- outputString += " , updateTrackDCAs=" + std::to_string (updateTrackDCAs);
435+ outputString += " , updateTrackDCAs=" + std::to_string (static_cast < int >( updateTrackDCAs) );
435436 // Configure updateTrackCovMat
436437 setBoolFromString (updateTrackCovMat, getValueString (UpdateTrackCovMat));
437438 LOG (info) << " [TrackTuner] updateTrackCovMat = " << updateTrackCovMat;
438- outputString += " , updateTrackCovMat=" + std::to_string (updateTrackCovMat);
439+ outputString += " , updateTrackCovMat=" + std::to_string (static_cast < int >( updateTrackCovMat) );
439440 // Configure updateCurvature
440441 setBoolFromString (updateCurvature, getValueString (UpdateCurvature));
441442 LOG (info) << " [TrackTuner] updateCurvature = " << updateCurvature;
442- outputString += " , updateCurvature=" + std::to_string (updateCurvature);
443+ outputString += " , updateCurvature=" + std::to_string (static_cast < int >( updateCurvature) );
443444 // Configure updateCurvatureIU
444445 setBoolFromString (updateCurvatureIU, getValueString (UpdateCurvatureIU));
445446 LOG (info) << " [TrackTuner] updateCurvatureIU = " << updateCurvatureIU;
446- outputString += " , updateCurvatureIU=" + std::to_string (updateCurvatureIU);
447+ outputString += " , updateCurvatureIU=" + std::to_string (static_cast < int >( updateCurvatureIU) );
447448 // Configure updatePulls
448449 setBoolFromString (updatePulls, getValueString (UpdatePulls));
449450 LOG (info) << " [TrackTuner] updatePulls = " << updatePulls;
450- outputString += " , updatePulls=" + std::to_string (updatePulls);
451+ outputString += " , updatePulls=" + std::to_string (static_cast < int >( updatePulls) );
451452 // Configure isInputFileFromCCDB
452453 setBoolFromString (isInputFileFromCCDB, getValueString (IsInputFileFromCCDB));
453454 LOG (info) << " [TrackTuner] isInputFileFromCCDB = " << isInputFileFromCCDB;
454- outputString += " , isInputFileFromCCDB=" + std::to_string (isInputFileFromCCDB);
455+ outputString += " , isInputFileFromCCDB=" + std::to_string (static_cast < int >( isInputFileFromCCDB) );
455456 // Configure pathInputFile
456457 pathFileQoverPt = getValueString (PathFileQoverPt);
457458 outputString += " , pathFileQoverPt=" + pathFileQoverPt;
@@ -466,7 +467,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
466467 LOG (info) << " [TrackTuner] nameFileQoverPt = " << nameFileQoverPt;
467468 // Configure usePvRefitCorrections
468469 setBoolFromString (usePvRefitCorrections, getValueString (UsePvRefitCorrections));
469- outputString += " , usePvRefitCorrections=" + std::to_string (usePvRefitCorrections);
470+ outputString += " , usePvRefitCorrections=" + std::to_string (static_cast < int >( usePvRefitCorrections) );
470471 LOG (info) << " [TrackTuner] usePvRefitCorrections = " << usePvRefitCorrections;
471472 // Configure qOverPtMC
472473 qOverPtMC = std::stof (getValueString (QOverPtMC));
@@ -479,8 +480,9 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
479480 // Configure nPhiBins
480481 nPhiBins = std::stoi (getValueString (NPhiBins));
481482 outputString += " , nPhiBins=" + std::to_string (nPhiBins);
482- if (nPhiBins < 0 )
483+ if (nPhiBins < 0 ) {
483484 LOG (fatal) << " [TrackTuner] negative nPhiBins!" << nPhiBins;
485+ }
484486 LOG (info) << " [TrackTuner] nPhiBins = " << nPhiBins;
485487 // Configure pathInputFile
486488 if (!autoDetectDcaCalib) {
@@ -515,36 +517,36 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
515517 LOG (info) << " [TrackTuner] >>> Parameters after the custom settings" ;
516518 // Configure autoDetectDcaCalib
517519 autoDetectDcaCalib = cfgAutoDetectDcaCalib;
518- outputString += " autoDetectDcaCalib=" + std::to_string (autoDetectDcaCalib);
520+ outputString += " autoDetectDcaCalib=" + std::to_string (static_cast < int >( autoDetectDcaCalib) );
519521 LOG (info) << " [TrackTuner] autoDetectDcaCalib = " << autoDetectDcaCalib;
520522 // Configure debugInfo
521523 debugInfo = cfgDebugInfo;
522524 LOG (info) << " [TrackTuner] debugInfo = " << debugInfo;
523- outputString += " , debugInfo=" + std::to_string (debugInfo);
525+ outputString += " , debugInfo=" + std::to_string (static_cast < int >( debugInfo) );
524526 // Configure updateTrackDCAs
525527 updateTrackDCAs = cfgUpdateTrackDCAs;
526528 LOG (info) << " [TrackTuner] updateTrackDCAs = " << updateTrackDCAs;
527- outputString += " , updateTrackDCAs=" + std::to_string (updateTrackDCAs);
529+ outputString += " , updateTrackDCAs=" + std::to_string (static_cast < int >( updateTrackDCAs) );
528530 // Configure updateTrackCovMat
529531 updateTrackCovMat = cfgUpdateTrackCovMat;
530532 LOG (info) << " [TrackTuner] updateTrackCovMat = " << updateTrackCovMat;
531- outputString += " , updateTrackCovMat=" + std::to_string (updateTrackCovMat);
533+ outputString += " , updateTrackCovMat=" + std::to_string (static_cast < int >( updateTrackCovMat) );
532534 // Configure updateCurvature
533535 updateCurvature = cfgUpdateCurvature;
534536 LOG (info) << " [TrackTuner] updateCurvature = " << updateCurvature;
535- outputString += " , updateCurvature=" + std::to_string (updateCurvature);
537+ outputString += " , updateCurvature=" + std::to_string (static_cast < int >( updateCurvature) );
536538 // Configure updateCurvatureIU
537539 updateCurvatureIU = cfgUpdateCurvatureIU;
538540 LOG (info) << " [TrackTuner] updateCurvatureIU = " << updateCurvatureIU;
539- outputString += " , updateCurvatureIU=" + std::to_string (updateCurvatureIU);
541+ outputString += " , updateCurvatureIU=" + std::to_string (static_cast < int >( updateCurvatureIU) );
540542 // Configure updatePulls
541543 updatePulls = cfgUpdatePulls;
542544 LOG (info) << " [TrackTuner] updatePulls = " << updatePulls;
543- outputString += " , updatePulls=" + std::to_string (updatePulls);
545+ outputString += " , updatePulls=" + std::to_string (static_cast < int >( updatePulls) );
544546 // Configure isInputFileFromCCDB
545547 isInputFileFromCCDB = cfgIsInputFileFromCCDB;
546548 LOG (info) << " [TrackTuner] isInputFileFromCCDB = " << isInputFileFromCCDB;
547- outputString += " , isInputFileFromCCDB=" + std::to_string (isInputFileFromCCDB);
549+ outputString += " , isInputFileFromCCDB=" + std::to_string (static_cast < int >( isInputFileFromCCDB) );
548550 // Configure pathQoverPt
549551 pathFileQoverPt = cfgPathFileQoverPt;
550552 outputString += " , pathFileQoverPt=" + pathFileQoverPt;
@@ -559,7 +561,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
559561 LOG (info) << " [TrackTuner] nameFileQoverPt = " << nameFileQoverPt;
560562 // Configure usePvRefitCorrections
561563 usePvRefitCorrections = cfgUsePvRefitCorrections;
562- outputString += " , usePvRefitCorrections=" + std::to_string (usePvRefitCorrections);
564+ outputString += " , usePvRefitCorrections=" + std::to_string (static_cast < int >( usePvRefitCorrections) );
563565 LOG (info) << " [TrackTuner] usePvRefitCorrections = " << usePvRefitCorrections;
564566 // Configure qOverPtMC
565567 qOverPtMC = cfgQOverPtMC;
@@ -572,8 +574,9 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
572574 // Configure nPhiBins
573575 nPhiBins = cfgNPhiBins;
574576 outputString += " , nPhiBins=" + std::to_string (nPhiBins);
575- if (nPhiBins < 0 )
577+ if (nPhiBins < 0 ) {
576578 LOG (fatal) << " [TrackTuner] negative nPhiBins!" << nPhiBins;
579+ }
577580 LOG (info) << " [TrackTuner] nPhiBins = " << nPhiBins;
578581 // Configure pathInputFile
579582 if (!autoDetectDcaCalib) {
@@ -606,9 +609,6 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
606609 TList* ccdb_object_dca = nullptr ;
607610 TList* ccdb_object_qoverpt = nullptr ;
608611
609- std::string grOneOverPtPionNameMC = " sigmaVsPtMc" ;
610- std::string grOneOverPtPionNameData = " sigmaVsPtData" ;
611-
612612 if (isInputFileFromCCDB) {
613613 // / use input correction file from CCDB
614614
@@ -633,10 +633,13 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
633633
634634 // / open the input correction file - q/pt correction
635635 TFile* inputFileQoverPt = TFile::Open (fullNameFileQoverPt.c_str (), " READ" );
636- if (!inputFileQoverPt && (updateCurvature || updateCurvatureIU)) {
637- LOG (fatal) << " Something wrong with the Q/Pt input file" << fullNameFileQoverPt << " for Q/Pt correction. Fix it!" ;
636+ if (!inputFileQoverPt) {
637+ if (updateCurvature || updateCurvatureIU) {
638+ LOG (fatal) << " Something wrong with the Q/Pt input file" << fullNameFileQoverPt << " for Q/Pt correction. Fix it!" ;
639+ }
640+ } else {
641+ ccdb_object_qoverpt = dynamic_cast <TList*>(inputFileQoverPt->Get (" ccdb_object" ));
638642 }
639- ccdb_object_qoverpt = dynamic_cast <TList*>(inputFileQoverPt->Get (" ccdb_object" ));
640643 }
641644
642645 getDcaGraphs (ccdb_object_dca, ccdb_object_qoverpt);
@@ -658,14 +661,15 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
658661 if (usePvRefitCorrections) {
659662 dir = " withPvRefit" ;
660663 }
661- TList* td = dynamic_cast <TList*>(ccdb_object_dca->FindObject (dir.c_str ()));
664+ auto td = dynamic_cast <TList*>(ccdb_object_dca->FindObject (dir.c_str ()));
662665 if (!td) {
663666 LOG (fatal) << " [TrackTuner] TList " << td << " not found in ccdb_object_dca. Fix it!" ;
664667 }
665668
666669 int inputNphiBins = nPhiBins;
667- if (inputNphiBins == 0 )
670+ if (inputNphiBins == 0 ) {
668671 nPhiBins = 1 ; // old phi_independent settings
672+ }
669673
670674 // reserve memory and initialize vector for needed number of graphs
671675 grDcaXYResVsPtPionMC.resize (nPhiBins);
@@ -767,8 +771,9 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
767771
768772 // get phibin
769773 double phiMC = mcparticle.phi ();
770- if (phiMC < 0 .)
774+ if (phiMC < 0 .) {
771775 phiMC += o2::constants::math::TwoPI; // 2 * std::numbers::pi;//
776+ }
772777 int phiBin = phiMC / (o2::constants::math::TwoPI + 0.0000001 ) * nPhiBins; // 0.0000001 just a numerical protection
773778
774779 dcaXYResMC = evalGraph (ptMC, grDcaXYResVsPtPionMC[phiBin].get ());
@@ -1204,10 +1209,12 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
12041209 int nPoints = graph->GetN ();
12051210 double xMin = graph->GetX ()[0 ];
12061211 double xMax = graph->GetX ()[nPoints - 1 ];
1207- if (x > xMax)
1212+ if (x > xMax) {
12081213 return graph->Eval (xMax);
1209- if (x < xMin)
1214+ }
1215+ if (x < xMin) {
12101216 return graph->Eval (xMin);
1217+ }
12111218 return graph->Eval (x);
12121219 }
12131220};
0 commit comments