Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 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_SIM_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_SIM_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_SIM_Config.C - no trigger in the range : " << xtart << " " << xstop << endl;
68  gSystem->Exit(1);
69  } else {
70  cout << "CWB_Plugin_HEN_SIM_Config.C - trigger found at gps : "
71  << GPS << " ra : " << RA << " dec : " << DEC << " radius : " << RADIUS << endl;
72  }
73 
74  // --------------------------------------------------------
75  // define MDC injections
76  // --------------------------------------------------------
77 
80 
81  char wf_name[256];
83  vector<mdcpar> par;
84 
85  par.resize(2);
86 
87  par[0].name="frequency"; par[0].value=100.;
88  par[1].name="Q"; par[1].value=8.9;
89  MDC->AddWaveform(MDC_SGC, par);
90 
91  par[0].name="frequency"; par[0].value=153.;
92  par[1].name="Q"; par[1].value=8.9;
93  MDC->AddWaveform(MDC_SGC, par);
94 
95  par[0].name="frequency"; par[0].value=1053.;
96  par[1].name="Q"; par[1].value=9;
97  MDC->AddWaveform(MDC_SGC, par);
98 
99  par[0].name="frequency"; par[0].value=1304.;
100  par[1].name="Q"; par[1].value=9;
101  MDC->AddWaveform(MDC_SGC, par);
102 
103  MDC->Print();
104 
105  // --------------------------------------------------------
106  // define injection parameters
107  // --------------------------------------------------------
108  MDC->SetInjHrss(2.5e-21);
109  MDC->SetInjRate(0.02);
110  MDC->SetInjJitter(10.0);
111 
112  // --------------------------------------------------------
113  // define sky distribution
114  // --------------------------------------------------------
115  par.resize(3);
116  par[0].name="theta"; par[0].value=DEC;
117  par[1].name="phi"; par[1].value=RA;
118  par[2].name="entries"; par[2].value=1000;
119  MDC->SetSkyDistribution(MDC_CELESTIAL_FIX,par,seed);
120 
121 
122  // --------------------------------------------------------
123  // define SetSkyMaskCC
124  // --------------------------------------------------------
125  char options[256];
126  sprintf(options,"--dec %f --ra %f --radius %f",DEC,RA,RADIUS);
127  cwb* CWB = new cwb;
128  CWB->SetSkyMaskCC(net,cfg,options);
129  delete CWB;
130 }
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
ifstream in
Definition: mdc.hh:189
Definition: ced.hh:24
#define ONSOURCE_TIME
void SetInjRate(double inj_rate=MDC_INJ_RATE)
Definition: mdc.hh:279
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:445
void Print(int level=0)
Definition: mdc.cc:2707
void SetSkyDistribution(MDC_DISTRIBUTION sky_distribution, vector< mdcpar > par, int seed=0, bool add=false)
Definition: mdc.cc:3415
#define HEN_LIST
Definition: mdc.hh:216
Definition: mdc.hh:121
void SetInjJitter(double inj_jitter=MDC_INJ_JITTER)
Definition: mdc.hh:285
TObjArray * token
vector< mdcpar > par
double e
char options[256]
network ** net
NOISE_MDC_SIMULATION.
double GPS
char wf_name[256]
Definition: cwb.hh:119
void SetInjHrss(double inj_hrss=MDC_INJ_HRSS)
Definition: mdc.hh:275
TString name
Definition: mdc.hh:178