Logo coherent WaveBurst  
Library Reference Guide
Logo
cwb_inet2G.C
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Gabriele Vedovato
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 // multistage 2G interactive cwb pipeline
20 
21 void
22 cwb_inet2G(int runID, TString fName, CWB_STAGE jstage, TString uName="", bool eced=false) {
23 
24  cwb2G* CWB = NULL;
25 
26  if(eced) { // get fName from env option --cfg
27  TString cwb_eced_opts=TString(gSystem->Getenv("CWB_ECED_OPTS"));
28  if(cwb_eced_opts!="") {
29  TString ECED_CFG = CWB::Toolbox::getParameter(cwb_eced_opts,"--cfg");
30  if(ECED_CFG!="") {
31  fName = gSystem->ExpandPathName(ECED_CFG.Data());
32  }
33  }
34  }
35 
36  if(fName.EndsWith(".root")) { // job file
37  CWB = new cwb2G(fName,uName,jstage);
38  // Warning : define the file to be saved in CED, must be implemented
39  // Must include the config in the root file and the aux user config file
40  // Temporarily is declared as empty and it is not saved : see ced.cc
41  gSystem->Setenv("CWB_UPARAMETERS_FILE","");
42  } else { // user configuration file
43  CWB::config icfg;
44  icfg.Import("$CWB_PARAMETERS_FILE");
45 #ifdef _USE_ROOT6
46  if(eced) { // skip config::check (used by eced)
47  int nIFO=1;int nfactor=1;
48  EXPORT(int,nIFO,TString::Format("nIFO = %d",nIFO).Data())
49  EXPORT(int,nfactor,TString::Format("nfactor = %d",nfactor).Data())
50  }
51 #else
52  if(eced) {nIFO=1;nfactor=1;} // skip config::check (used by eced)
53 #endif
54  icfg.Import(fName);
55  strcpy(icfg.analysis,"2G");
56  icfg.Export();
57  CWB = new cwb2G(icfg,jstage);
58  // updated standard user config (saved in CED)
59  gSystem->Setenv("CWB_UPARAMETERS_FILE",fName);
60  }
61 
62  if(CWB) {
63  CWB::config* cfg = CWB->GetConfig();
64  TArrayC lagBuffer;
65  if(CWB->GetLagBuffer().GetSize()) {
66 #ifdef _USE_ROOT6
67  char* lagFile=NULL;
68  char lagMode[2];
69 #endif
70  // read lags from job file (used in multistage analysis)
71  lagBuffer = CWB->GetLagBuffer();
72  lagFile = lagBuffer.GetArray();
73  lagMode[0] = CWB->GetLagMode();
74 #ifdef _USE_ROOT6
75  EXPORT(char*,lagFile,TString::Format("lagFile = (char*)%p",lagFile).Data())
76  EXPORT(char*,lagMode,TString::Format("strcpy(lagMode,(char*)%p)",lagMode).Data())
77  strcpy(cfg->lagMode,lagMode);
78  cfg->Import();
79 #endif
80  }
81  if(eced) cfg->Import(gSystem->ExpandPathName("$CWB_MACROS/cwb_eced.C")); // easy ced
82  cfg->Import(gSystem->ExpandPathName("$CWB_MACROS/cwb_inet.C"));
83  CWB->SetupStage(jstage);
84 #ifdef _USE_ROOT6
85  char tmp_dir[1024]; strcpy(tmp_dir,cfg->tmp_dir);
86 #endif
87  if(eced) cfg->Print(TString(tmp_dir)+"/eced_parameters.C"); // dump full parameters file
88  CWB->run(runID);
89  delete CWB;
90  }
91 
92  gSystem->Exit(0);
93 }
CWB::config * cfg
char analysis[8]
Definition: config.hh:117
TString cwb_eced_opts
Definition: cwb_eced.C:51
void Export(TString fname="")
Definition: config.cc:406
void Print(Option_t *option="")
Definition: config.cc:737
Definition: ced.hh:42
TString("c")
void Import(TString umacro="")
Definition: config.cc:352
Definition: cwb2G.hh:33
#define nIFO
char tmp_dir[512]
Definition: test_config1.C:153
char lagMode[2]
Definition: test_config1.C:57
void SetupStage(CWB_STAGE jstage)
Definition: cwb.cc:2242
virtual void run(int runID=0)
Definition: cwb.cc:281
char tmp_dir[1024]
Definition: config.hh:325
char lagMode[2]
Definition: config.hh:173
#define EXPORT(TYPE, VAR, CMD)
Definition: config.cc:92
static TString getParameter(TString options, TString param="")
Definition: Toolbox.cc:6727
CWB::config * GetConfig()
Definition: cwb.hh:150
char * lagFile
Definition: test_config1.C:56
strcpy(RunLabel, RUN_LABEL)
int nfactor
Definition: test_config1.C:83
char GetLagMode()
Definition: cwb.hh:170
char fName[256]
TArrayC GetLagBuffer()
Definition: cwb.hh:171
void cwb_inet2G(int runID, TString fName, CWB_STAGE jstage, TString uName="", bool eced=false)
Definition: cwb_inet2G.C:22
CWB_STAGE
Definition: cwb.hh:122