From 517880cbe5c4547eb28f3c43cf6263cb614a542a Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Wed, 28 Mar 2018 21:02:17 -0400 Subject: [PATCH] add file suffix option --- hallRadiation.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hallRadiation.cc b/hallRadiation.cc index 6d83a3e..c1fb980 100644 --- a/hallRadiation.cc +++ b/hallRadiation.cc @@ -33,6 +33,7 @@ void FinalizeAvg(); void WriteOutput(); int processInput(int,char**); +string suffix; string finNm("0"); int nAvg(100000); vector detNr={1001, 1002, 1003, 1004, 1005, 1006, 1101, 1102, 2101, 2105, 2110, 2112, 3120, 3121, 3201, 2401, 2411}; @@ -47,7 +48,11 @@ int main(int argc, char **argv){ if(inputRes) return inputRes; - string foutNm = Form("%s_hallRad.root",finNm.substr(0,finNm.find(".")).c_str()); + string foutNm; + if(suffix!="") + foutNm = suffix + "_hallRad.root"; + else + foutNm = Form("%s_hallRad.root",finNm.substr(0,finNm.find(".")).c_str()); fout=new TFile(foutNm.c_str(),"RECREATE"); Initialize(); @@ -358,6 +363,7 @@ int processInput(int argc, char **argv){ cout< : int used as number of events to average over for uncertainty\n"; cout << "\t--detList : list of detectors that you want to process\n"; + cout << "\t--suffix : suffix for output file. can contain path to a particular folder\n"; return 1; } @@ -369,6 +375,8 @@ int processInput(int argc, char **argv){ nAvg = atoi(argv[i+1]); }else if(strcmp("--default",argv[i])==0){ defaultFlag=1; + }else if(strcmp("--suffix",argv[i])==0){ + suffix=argv[i+1]; }else if(strcmp("--detList",argv[i])==0){ defaultFlag = -1; detNr.clear();