Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_HEN_BKG_Config.C
Go to the documentation of this file.
1 //!NOISE_MDC_SIMULATION
2 // Config Plugin to set SkyMaskCC 'on the fly'
3 
4 {
5  #define HEN_LIST "config/HEN_list_2009_2010.txt"
6  #define ONSOURCE_TIME 1000 // sec
7 
8  cout << "-----> CWB_Plugin_HEN_BKG_Config.C" << endl;
9 
10  network** net;
12 
13  int seed = (*net)->nRun; // WARNING : seed must be the same for each detector within the same job
14 
15  double GPS=0;
16  float RA;
17  float DEC;
18  float RADIUS;
19 
20  ifstream in;
21  in.open(HEN_LIST,ios::in);
22  if (!in.good()) {
23  cout << "CWB_Plugin_HEN_BKG_Config.C - Error Opening File : " << HEN_LIST << endl;
24  gSystem->Exit(1);
25  }
26 
27  char str[1024];
28  while(true) {
29  in.getline(str,1024);
30  if (!in.good()) break;
31  if(str[0] == '#') continue;
32  TObjArray* token = TString(str).Tokenize(TString(" "));
33  if(token->GetEntries()!=16) {
34  cout << "CWB_Plugin_HEN_BKG_Config.C - bad line format : " << str << endl;
35  gSystem->Exit(1);
36  }
37  TObjString* otoken;
38  TString stoken;
39 
40  otoken = (TObjString*)token->At(2);
41  stoken = otoken->GetString();
42  GPS = stoken.Atof();
43 
44  otoken = (TObjString*)token->At(3);
45  stoken = otoken->GetString();
46  RA = stoken.Atof();
47 
48  otoken = (TObjString*)token->At(4);
49  stoken = otoken->GetString();
50  DEC = stoken.Atof();
51 
52  otoken = (TObjString*)token->At(5);
53  stoken = otoken->GetString();
54  RADIUS = stoken.Atof();
55 
56  int GPS1 = GPS-ONSOURCE_TIME/2;
57  if(GPS1>xstart && GPS1<=xstop) break;
58 
59  int GPS2 = GPS+ONSOURCE_TIME/2;
60  if(GPS2>xstart && GPS2<=xstop) break;
61 
62  delete token;
63  }
64  in.close();
65 
66  if(GPS==0) {
67  cout << "CWB_Plugin_HEN_BKG_Config.C - no trigger in the range : " << xtart << " " << xstop << endl;
68  gSystem->Exit(1);
69  } else {
70  cout << "CWB_Plugin_HEN_BKG_Config.C - trigger found at gps : "
71  << GPS << " ra : " << RA << " dec : " << DEC << " radius : " << RADIUS << endl;
72  }
73 
74  // --------------------------------------------------------
75  // define SetSkyMaskCC
76  // --------------------------------------------------------
77  sprintf(cfg->skyMaskCCFile,"--theta %f --phi %f --radius %f",DEC,RA,RADIUS);
78  cwb* CWB = new cwb;
79  CWB->SetSkyMask(net,cfg,cfg->skyMaskCCFile,'c');
80  delete CWB;
81 }
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
Definition: ced.hh:24
TString("c")
CWB_PLUGIN_IMPORT(network **, net)
double GPS
sprintf(cfg->skyMaskCCFile,"--theta %f --phi %f --radius %f", DEC, RA, RADIUS)
network ** net
NOISE_MDC_SIMULATION.
char str[1024]
#define ONSOURCE_TIME
#define HEN_LIST
TObjArray * token
float RADIUS
ifstream in
int SetSkyMask(network *net, CWB::config *cfg, char *options, char skycoord, double skyres=-1)
Definition: cwb.cc:2465
char skyMaskCCFile[1024]
Definition: config.hh:291
Definition: cwb.hh:119