Logo coherent WaveBurst  
Library Reference Guide
Logo
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* xstart;
14  int* xstop;
15  CWB_PLUGIN_IMPORT(int*,xstart);
16  CWB_PLUGIN_IMPORT(int*,xstop);
17 
18 
19  int seed = (*net)->nRun; // WARNING : seed must be the same for each detector within the same job
20 
21  double GPS=0;
22  float RA;
23  float DEC;
24  float RADIUS;
25 
26  ifstream in;
27  in.open(HEN_LIST,ios::in);
28  if (!in.good()) {
29  cout << "CWB_Plugin_HEN_BKG_Config.C - Error Opening File : " << HEN_LIST << endl;
30  gSystem->Exit(1);
31  }
32 
33  char str[1024];
34  while(true) {
35  in.getline(str,1024);
36  if (!in.good()) break;
37  if(str[0] == '#') continue;
38  TObjArray* token = TString(str).Tokenize(TString(" "));
39  if(token->GetEntries()!=16) {
40  cout << "CWB_Plugin_HEN_BKG_Config.C - bad line format : " << str << endl;
41  gSystem->Exit(1);
42  }
43  TObjString* otoken;
44  TString stoken;
45 
46  otoken = (TObjString*)token->At(2);
47  stoken = otoken->GetString();
48  GPS = stoken.Atof();
49 
50  otoken = (TObjString*)token->At(3);
51  stoken = otoken->GetString();
52  RA = stoken.Atof();
53 
54  otoken = (TObjString*)token->At(4);
55  stoken = otoken->GetString();
56  DEC = stoken.Atof();
57 
58  otoken = (TObjString*)token->At(5);
59  stoken = otoken->GetString();
60  RADIUS = stoken.Atof();
61 
62  int GPS1 = GPS-ONSOURCE_TIME/2;
63  if(GPS1>xstart && GPS1<=xstop) break;
64 
65  int GPS2 = GPS+ONSOURCE_TIME/2;
66  if(GPS2>xstart && GPS2<=xstop) break;
67 
68  delete token;
69  }
70  in.close();
71 
72  if(GPS==0) {
73  cout << "CWB_Plugin_HEN_BKG_Config.C - no trigger in the range : " << xtart << " " << xstop << endl;
74  gSystem->Exit(1);
75  } else {
76  cout << "CWB_Plugin_HEN_BKG_Config.C - trigger found at gps : "
77  << GPS << " ra : " << RA << " dec : " << DEC << " radius : " << RADIUS << endl;
78  }
79 
80  // --------------------------------------------------------
81  // define SetSkyMaskCC
82  // --------------------------------------------------------
83  sprintf(cfg->skyMaskCCFile,"--theta %f --phi %f --radius %f",DEC,RA,RADIUS);
84  cwb* CWB = new cwb;
85  CWB->SetSkyMask(net,cfg,cfg->skyMaskCCFile,'c');
86  delete CWB;
87 }
CWB::config * cfg
Definition: ced.hh:42
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
int * xstart
ifstream in
int SetSkyMask(network *net, CWB::config *cfg, char *options, char skycoord, double skyres=-1)
Definition: cwb.cc:2484
char skyMaskCCFile[1024]
Definition: config.hh:309
Definition: cwb.hh:136