Hi all,
I am running a root macro from another root macro using gROOT->ProcessLine(".L myControlPlots.C+");
. Again I have to run the same after updating a weight inside same macro. So, one easy way is to write a bash script and run using it.
But, I am trying to modify the macro inside my root macro uisng system("sed ...... ")
. And when I run the macro again in same macro, then its giving me error saying variables are re-defined. You can see my macro below.
Is there any way that before loading a macro I completely reset the privious loaded information?
Thanks in advance for help.
with regards,
Ram
#include "controlplotvars_CHS_jes_up.h"
#include "controlplotvars_CHS_jes_dn.h"
void RunMacro_Limits()
{
gROOT->ProcessLine(".L myControlPlots.C+");
gROOT->ProcessLine("myControlPlots(\"DibosonBoostedElMuCuts13TeV_SignalRegion_CHS.txt\", \"DibosonBoostedElMuSamples13TeV.txt\", commonplotvars_chs , \"Nominal.root\" , 0 , \"RECREATE\" , 1) ");
gROOT->Reset();
system("sed 's/pu_Weight/pu_Weight_up/g' myControlPlots.C > myControlPlots_temp_up.C");
system("sed -i 's/myControlPlots/myControlPlots_temp_up/g' myControlPlots_temp_up.C");
gROOT->ProcessLine(".L myControlPlots_temp_up.C+");
gROOT->ProcessLine("myControlPlots_temp_up(\"DibosonBoostedElMuCuts13TeV_SignalRegion_CHS.txt\", \"DibosonBoostedElMuSamples13TeV_pu_up.txt\", commonplotvars_chs , \"Nominal.root\" , 0 , \"UPDATE\" , 0) ");
system("rm myControlPlots_temp_up.C");
gROOT->Reset();
system("sed 's/pu_Weight/pu_Weight_down/g' myControlPlots.C > myControlPlots_temp_dn.C");
system("sed -i 's/myControlPlots/myControlPlots_temp_dn/g' myControlPlots_temp_dn.C");
gROOT->ProcessLine(".L myControlPlots_temp_dn.C+");
gROOT->ProcessLine("myControlPlots_temp_dn(\"DibosonBoostedElMuCuts13TeV_SignalRegion_CHS.txt\", \"DibosonBoostedElMuSamples13TeV_pu_dn.txt\", commonplotvars_chs , \"Nominal.root\" , 0 , \"UPDATE\" , 0) ");
system("rm myControlPlots_temp_dn.C");
}