Logo Coherent WaveBurst  
Reference Guide
Logo
 All Namespaces Files Functions Variables Macros Pages
CreateChunkCuts.C
Go to the documentation of this file.
1 #define CHUNK_FILE_LIST "Chunk_List.txt"
2 #define MACRO_READ_CHUNK "ReadChunkList.C"
3 #define CHUNK_MAX_SIZE 100
4 
5 #define OFILE_CHUNK_CUTS "Chunks_Cuts.hh"
6 
7 //#define EXECUTE
8 
9 void CreateChunkCuts(TString run) {
10 
11  // get CWB_CONFIG
12  char cwb_config_env[1024] = "";
13  if(gSystem->Getenv("CWB_CONFIG")!=NULL) {
14  strcpy(cwb_config_env,TString(gSystem->Getenv("CWB_CONFIG")).Data());
15  }
16 
17  char chunk_file_list[1024];
18  sprintf(chunk_file_list,"%s/%s/CHUNKS/%s",cwb_config_env,run.Data(),CHUNK_FILE_LIST);
19  cout << chunk_file_list << endl;
20 
21  char macro_read_chunk_path[1024];
22  sprintf(macro_read_chunk_path,"%s/MACROS/%s",cwb_config_env,MACRO_READ_CHUNK);
23 
24  CWB::Toolbox::checkFile(macro_read_chunk_path);
25 
26  // load macro
27  gROOT->LoadMacro(gSystem->ExpandPathName(macro_read_chunk_path));
28 
29  int chunk[CHUNK_MAX_SIZE];
30  double start[CHUNK_MAX_SIZE];
31  double stop[CHUNK_MAX_SIZE];
32 
33  int nChunks = ReadChunkList(chunk_file_list,chunk,start,stop);
34 
35  char tcut[256];
36 
37  char ofile[1024];
38  sprintf(ofile,"%s/%s/CHUNKS/%s",cwb_config_env,run.Data(),OFILE_CHUNK_CUTS);
39  cout << "output file list : " << ofile << endl;
40 #ifdef EXECUTE
41  ofstream out;
42  out.open(ofile,ios::out);
43 #endif
44  for(int k=0;k<nChunks;k++) {
45 // cout << "\t" << chunk[k] << "\t" << (int)start[k] << "\t" << (int)stop[k] << endl;
46 
47  sprintf(tcut,"TCut O2_K%02d_cut(\"O2_K%02d_cut\",\"time[0]>%d && time[0]<=%d\");",chunk[k],chunk[k],start[k],stop[k]);
48 
49 #ifdef EXECUTE
50  out << tcut << endl;
51 #else
52  cout << tcut << endl;
53 #endif
54 
55  }
56 
57  // create cut chunk99 : full period
58  sprintf(tcut,"TCut O2_K%02d_cut(\"O2_K%02d_cut\",\"time[0]>%d && time[0]<=%d\");",99,99,start[0],stop[nChunks-1]);
59 #ifdef EXECUTE
60  out << tcut << endl;
61 #else
62  cout << tcut << endl;
63 #endif
64 
65 
66 #ifdef EXECUTE
67  out.close();
68 #endif
69 
70  exit(0);
71 
72 }
strcpy(analysis,"2G")
int nChunks
double start[CHUNK_MAX_SIZE]
int ReadChunkList(TString ifile, int *chunk=NULL, double *start=NULL, double *stop=NULL)
Definition: ReadChunkList.C:4
char tcut[256]
int chunk[CHUNK_MAX_SIZE]
void CreateChunkCuts(TString run)
double stop[CHUNK_MAX_SIZE]
char ofile[1024]
#define OFILE_CHUNK_CUTS
sprintf(ofile,"/home/waveburst/O1/CHUNKS/O1_Chunks_Cuts.hh")
#define CHUNK_MAX_SIZE
#define MACRO_READ_CHUNK
#define CHUNK_FILE_LIST