Skip to content
Snippets Groups Projects
Commit b18e799b authored by Christopher Rob Jones's avatar Christopher Rob Jones
Browse files

GlobalReco: Small updates to scripts to make RICH performance plots

parent c335a0b2
No related branches found
No related tags found
No related merge requests found
Pipeline #6542255 failed
......@@ -606,11 +606,15 @@ void GlobalPID::saveFigures( const std::string& type ) {
void GlobalPID::loadTTree( const std::string& filename ) {
resetFile();
std::cout << "Opening file : " << filename << std::endl;
m_file = std::make_unique<TFile>( filename.c_str() );
m_file->cd( ( filename + ":/ChargedProtoTuple" ).c_str() );
fChain = (TTree*)gDirectory->Get( "protoPtuple" );
Init( fChain );
if ( boost::filesystem::exists( filename ) ) {
std::cout << "Opening file '" << filename << "'" << std::endl;
m_file = std::make_unique<TFile>( filename.c_str() );
m_file->cd( ( filename + ":/ChargedProtoTuple" ).c_str() );
fChain = (TTree*)gDirectory->Get( "protoPtuple" );
Init( fChain );
} else {
std::cout << "File '" << filename << "' does not exist" << std::endl;
}
}
void GlobalPID::resetFile() {
......@@ -618,6 +622,7 @@ void GlobalPID::resetFile() {
m_file->Close();
m_file.reset( nullptr );
}
fChain = nullptr;
}
GlobalPID::GlobalPID() {}
......
......@@ -31,9 +31,9 @@ void MakeRichPlots() {
const std::string fName = "RichFuture-Feature-x86_64_v2-centos7-gcc12+detdesc-opt-Expert-ProtoTuple.root";
const std::vector<std::string> nametags = {"FromMCHits/3D/lumi-2.0e33", "FromMCHits/3D/lumi-1.2e34",
"FromMCHits/4D/lumi-2.0e33/PixWin-3.000/PhotWin-0.100",
"FromMCHits/4D/lumi-1.2e34/PixWin-3.000/PhotWin-0.100"};
const std::vector<std::string> nametags = {"FromMCHits-V3/3D/lumi-2.0e33", "FromMCHits-V3/3D/lumi-1.2e34",
"FromMCHits-V3/4D/lumi-2.0e33/PixWin-1.000/PhotWin-0.100",
"FromMCHits-V3/4D/lumi-1.2e34/PixWin-1.000/PhotWin-0.100"};
for ( auto nametag : nametags ) {
......
......@@ -9,10 +9,14 @@
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include <array>
#include <map>
#include <memory>
#include <tuple>
#include <utility>
#include <vector>
#include "GlobalPID.C"
......@@ -30,45 +34,91 @@ void RichKaonIDCompareFiles() {
// dataSets["Run3Tracking-3D"].push_back( "DSTs-MCTracks" );
// dataSets["Run3Tracking-3D"].push_back( "DSTs-RecoTracks" );
// const std::string bName = "FromMCHits-V2";
// for ( const std::string lumi : {"1.5e34", "1.2e34", "1.0e34", "3.0e33", "2.0e33", "2.0e32"} ) {
// dataSets[bName + "-3D"].push_back( bName + "/3D/lumi-" + lumi );
// for ( const std::string pixWin : {"3.000"} ) {
// for ( const std::string photWin : {"1.000", "0.500", "0.250", "0.100", "0.050", "0.010"} ) {
// const auto n = bName + "/4D/lumi-" + lumi + "/PixWin-" + pixWin + "/PhotWin-" + photWin;
// dataSets[bName + "-4D-PixW_" + pixWin + "-PhoW_" + photWin].push_back( n );
// dataSets[bName + "-4D-PixW_" + pixWin + "-Lumi_" + lumi].push_back( n );
auto nA = []( const std::string& label, const std::string& value ) {
return ( value.empty() ? "" : label + "-" + value + "/" );
};
auto add = [&]( const auto& tag, const auto& name ) {
const auto full_name = dir + "/" + name + "/" + fName;
if ( boost::filesystem::exists( full_name ) ) {
dataSets[tag].push_back( name );
} else {
std::cout << "WARNING: '" << full_name << "' does not exist" << std::endl;
}
};
// for ( const std::string bName : {"PixSize-R1-V1", "PixSize-R2-V1", "PixSize-R1R2-V1"} ) {
// for ( const std::string lumi : {"1.2e34"} ) {
// for ( const std::string innerQ : {"1.00", "2.00", "3.00"} ) {
// for ( const std::string outerQ : {"", "2.00", "4.00", "6.00"} ) {
// const auto d1 = nA( "lumi", lumi ) + nA( "InnerPixQ", innerQ ) + nA( "OuterPixQ", outerQ );
// add( bName + "/3D", bName + "/3D/" + d1 );
// for ( const std::string pixWin : {"1.000"} ) {
// for ( const std::string photWin : {"0.300", "0.150", "0.075", "0.050"} ) {
// const auto data = bName + "/4D/" + d1 + nA( "PixWin", pixWin ) + nA( "PhotWin", photWin );
// add( bName + "/4D-PixW_" + pixWin + "-PhoW_" + photWin, data );
// // add( bName + "/4D-PixW_" + pixWin + "-Lumi_" + lumi, data );
// }
// }
// }
// }
// }
// }
for ( const std::string lumi : {"1.2e34", "2.0e33", "2.0e32"} ) {
const std::string bName = "BkgTuneRich1";
for ( const std::string w : {"0.600", "0.800", "1.000", "1.200", "1.400"} ) {
dataSets["3D/lumi-" + lumi + "/" + bName].push_back( bName + "/3D/lumi-" + lumi + "/R1PixBckW-" + w );
const std::string batch = "FromMCHits-V5";
const std::string innerQ = "2.80";
const std::string outerQ = "5.60";
const bool addEmulated = true;
const auto QS = nA( "InnerPixQ", innerQ ) + nA( "OuterPixQ", outerQ );
for ( const std::string vari : {"Nominal", "MultiHits", "MultiHits-PerfectMCPos"} ) {
const auto bName = batch + "-" + vari;
for ( const std::string lumi : {"1.5e34", "1.2e34", "1.0e34", "3.0e33", "2.0e33"} ) {
add( vari + "/3D", bName + "/3D/" + nA( "lumi", lumi ) );
if ( addEmulated ) { add( vari + "/3D", "PixSize-R1R2-V1/3D/" + nA( "lumi", lumi ) + QS ); }
for ( const std::string pixWin : {"1.000"} ) {
for ( const std::string photWin : {"0.250", "0.100", "0.050"} ) {
const auto name = "4D/lumi-" + lumi + "/PixWin-" + pixWin + "/" + bName + "_PhotWin-" + photWin;
dataSets[name].push_back( bName + "/4D/lumi-" + lumi + "/R1PixBckW-" + w + "/PixWin-" + pixWin + "/PhotWin-" +
photWin );
for ( const std::string photWin : {"0.300", "0.150", "0.075", "0.050"} ) {
auto data = bName + "/4D/" + nA( "lumi", lumi ) + nA( "PixWin", pixWin ) + nA( "PhotWin", photWin );
add( vari + "/4D-PixW_" + pixWin + "-PhoW_" + photWin, data );
add( vari + "/4D-PixW_" + pixWin + "-Lumi_" + lumi, data );
if ( addEmulated ) {
data = "PixSize-R1R2-V1/4D/" + nA( "lumi", lumi ) + QS + nA( "PixWin", pixWin ) + nA( "PhotWin", photWin );
add( vari + "/4D-PixW_" + pixWin + "-PhoW_" + photWin, data );
add( vari + "/4D-PixW_" + pixWin + "-Lumi_" + lumi, data );
}
}
}
}
}
for ( const std::string lumi : {"1.2e34", "2.0e33", "2.0e32"} ) {
const std::string bName = "BkgTuneRich2";
for ( const std::string w : {"0.600", "0.800", "1.000", "1.200", "1.400"} ) {
dataSets["3D/lumi-" + lumi + "/" + bName].push_back( bName + "/3D/lumi-" + lumi + "/R2PixBckW-" + w );
for ( const std::string pixWin : {"1.000"} ) {
for ( const std::string photWin : {"0.250", "0.100", "0.050"} ) {
const auto name = "4D/lumi-" + lumi + "/PixWin-" + pixWin + "/" + bName + "_PhotWin-" + photWin;
dataSets[name].push_back( bName + "/4D/lumi-" + lumi + "/R2PixBckW-" + w + "/PixWin-" + pixWin + "/PhotWin-" +
photWin );
}
}
}
}
// for ( const std::string lumi : {"1.2e34", "2.0e33", "2.0e32"} ) {
// const std::string bName = "BkgTuneRich1";
// for ( const std::string w : {"0.600", "0.800", "1.000", "1.200", "1.400"} ) {
// dataSets["3D/lumi-" + lumi + "/" + bName].push_back( bName + "/3D/lumi-" + lumi + "/R1PixBckW-" + w );
// for ( const std::string pixWin : {"1.000"} ) {
// for ( const std::string photWin : {"0.250", "0.100", "0.050"} ) {
// const auto name = "4D/lumi-" + lumi + "/PixWin-" + pixWin + "/" + bName + "_PhotWin-" + photWin;
// dataSets[name].push_back( bName + "/4D/lumi-" + lumi + "/R1PixBckW-" + w + "/PixWin-" + pixWin +
// "/PhotWin-" +
// photWin );
// }
// }
// }
// }
// for ( const std::string lumi : {"1.2e34", "2.0e33", "2.0e32"} ) {
// const std::string bName = "BkgTuneRich2";
// for ( const std::string w : {"0.600", "0.800", "1.000", "1.200", "1.400"} ) {
// dataSets["3D/lumi-" + lumi + "/" + bName].push_back( bName + "/3D/lumi-" + lumi + "/R2PixBckW-" + w );
// for ( const std::string pixWin : {"1.000"} ) {
// for ( const std::string photWin : {"0.250", "0.100", "0.050"} ) {
// const auto name = "4D/lumi-" + lumi + "/PixWin-" + pixWin + "/" + bName + "_PhotWin-" + photWin;
// dataSets[name].push_back( bName + "/4D/lumi-" + lumi + "/R2PixBckW-" + w + "/PixWin-" + pixWin +
// "/PhotWin-" +
// photWin );
// }
// }
// }
// }
const Long64_t nTracks = 1e6;
......@@ -93,8 +143,8 @@ void RichKaonIDCompareFiles() {
gConf.useFixedGraphRange = true;
gConf.minGraphX = 80;
gConf.maxGraphX = 100;
gConf.minGraphY = 0.05;
gConf.maxGraphY = 100;
gConf.minGraphY = 0.08;
gConf.maxGraphY = 60;
} else if ( GlobalPID::Upstream == tktype ) {
gConf.useFixedGraphRange = true;
gConf.minGraphX = 40;
......@@ -155,17 +205,20 @@ void RichKaonIDCompareFiles() {
gConf.writeCutValues = false;
using PlotData = std::vector<std::tuple<std::string, std::string, Color_t>>;
using PlotData = std::vector<std::tuple<std::string, std::string, int>>;
// colours ... https://root.cern.ch/doc/master/classTColor.html
const std::array<Color_t, 11> colors{kYellow - 1, kRed + 1, kGreen + 2, kBlue + 1, kMagenta + 2, kBlack,
kRed - 6, kBlue - 1, kCyan + 2, kGreen - 5, kGray + 2};
const auto colors =
std::array{kRed + 1, kBlue + 1, kGreen + 2, kMagenta + 2, kBlack + 0, kOrange + 7, kCyan - 3,
kMagenta - 7, kGreen - 8, kRed - 6, kCyan + 2, kGray + 2, kAzure + 8};
auto lastColor = colors.begin();
auto genTuple = [&]( const auto& tag ) {
if ( colors.end() == lastColor ) { lastColor = colors.begin(); }
return std::make_tuple( dir + "/" + tag + "/" + fName, tag, *( lastColor++ ) );
auto fullname = dir + "/" + tag + "/" + fName;
boost::replace_all( fullname, "//", "/" );
return std::make_tuple( std::move( fullname ), tag, *( lastColor++ ) );
};
PlotData plotdata;
......@@ -180,7 +233,7 @@ void RichKaonIDCompareFiles() {
pid->config.title += " | " + dname;
pid->config.subtitle = title;
pid->config.superImpose = ( iPlot++ != 0 );
pid->config.color = color;
pid->config.color = (Color_t)color;
// create the plot
pid->makeCurve( nTracks );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment