Logo coherent WaveBurst  
Library Reference Guide
Logo
CWB_Plugin_HEN_SIM_Config.C
Go to the documentation of this file.
1 //!NOISE_MDC_SIMULATION
2 // Config Plugin to injected 'on the fly' MDC & 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_SIM_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_SIM_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_SIM_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_SIM_Config.C - no trigger in the range : " << xtart << " " << xstop << endl;
74  gSystem->Exit(1);
75  } else {
76  cout << "CWB_Plugin_HEN_SIM_Config.C - trigger found at gps : "
77  << GPS << " ra : " << RA << " dec : " << DEC << " radius : " << RADIUS << endl;
78  }
79 
80  // --------------------------------------------------------
81  // define MDC injections
82  // --------------------------------------------------------
83 
86 
87  char wf_name[256];
89  vector<mdcpar> par;
90 
91  par.resize(2);
92 
93  par[0].name="frequency"; par[0].value=100.;
94  par[1].name="Q"; par[1].value=8.9;
95  MDC->AddWaveform(MDC_SGC, par);
96 
97  par[0].name="frequency"; par[0].value=153.;
98  par[1].name="Q"; par[1].value=8.9;
99  MDC->AddWaveform(MDC_SGC, par);
100 
101  par[0].name="frequency"; par[0].value=1053.;
102  par[1].name="Q"; par[1].value=9;
103  MDC->AddWaveform(MDC_SGC, par);
104 
105  par[0].name="frequency"; par[0].value=1304.;
106  par[1].name="Q"; par[1].value=9;
107  MDC->AddWaveform(MDC_SGC, par);
108 
109  MDC->Print();
110 
111  // --------------------------------------------------------
112  // define injection parameters
113  // --------------------------------------------------------
114  MDC->SetInjHrss(2.5e-21);
115  MDC->SetInjRate(0.02);
116  MDC->SetInjJitter(10.0);
117 
118  // --------------------------------------------------------
119  // define sky distribution
120  // --------------------------------------------------------
121  par.resize(3);
122  par[0].name="theta"; par[0].value=DEC;
123  par[1].name="phi"; par[1].value=RA;
124  par[2].name="entries"; par[2].value=1000;
125  MDC->SetSkyDistribution(MDC_CELESTIAL_FIX,par,seed);
126 
127 
128  // --------------------------------------------------------
129  // define SetSkyMaskCC
130  // --------------------------------------------------------
131  char options[256];
132  sprintf(options,"--dec %f --ra %f --radius %f",DEC,RA,RADIUS);
133  cwb* CWB = new cwb;
134  CWB->SetSkyMaskCC(net,cfg,options);
135  delete CWB;
136 }
CWB::config * cfg
ifstream in
Definition: mdc.hh:219
Definition: ced.hh:42
#define ONSOURCE_TIME
void SetInjRate(double inj_rate=MDC_INJ_RATE)
Definition: mdc.hh:311
TString("c")
CWB::mdc * MDC
waveform wf
sprintf(options,"--dec %f --ra %f --radius %f", DEC, RA, RADIUS)
float RADIUS
CWB_PLUGIN_IMPORT(network **, net)
char str[1024]
mdcid AddWaveform(MDC_TYPE mdc_type, vector< mdcpar > par, TString uname="")
Definition: mdc.cc:472
void Print(int level=0)
Definition: mdc.cc:2736
void SetSkyDistribution(MDC_DISTRIBUTION sky_distribution, vector< mdcpar > par, int seed=0, bool add=false)
Definition: mdc.cc:3444
#define HEN_LIST
Definition: mdc.hh:248
Definition: mdc.hh:151
int * xstart
void SetInjJitter(double inj_jitter=MDC_INJ_JITTER)
Definition: mdc.hh:317
TObjArray * token
vector< mdcpar > par
double e
char options[256]
network ** net
NOISE_MDC_SIMULATION.
double GPS
char wf_name[256]
Definition: cwb.hh:136
void SetInjHrss(double inj_hrss=MDC_INJ_HRSS)
Definition: mdc.hh:307
TString name
Definition: mdc.hh:208