7 #define MDC_TREE_NAME "mdc"
13 iFile = TFile::Open(fName);
14 if((iFile==NULL) || (iFile!=NULL && !iFile->IsOpen())) {
15 cout <<
"injection::Init : Error opening root file " << fName.Data() << endl;
21 ndim = tree->GetUserInfo()->GetSize();
24 cout <<
"injection::Init : number of detectors declared in the constructor (" << n
25 <<
") are not equals to the one ("<<ndim<<
") declared in the root file : "
26 << fName.Data() << endl;
32 <<
" not present in the root file " << fName.Data() << endl;
37 cout <<
"injection::Init : number of detectors is not declared in the constructor or"
38 <<
" not present in the root file : " << endl << fName.Data() << endl;
48 if (tree == 0)
return;
93 else {
delete name;
name=
new string();}
94 if (!
psi)
psi= (Float_t*)malloc(2*
sizeof(Float_t));
95 else psi= (Float_t*)realloc(
psi,2*
sizeof(Float_t));
96 if (!
iota)
iota= (Float_t*)malloc(2*
sizeof(Float_t));
97 else iota= (Float_t*)realloc(
iota,2*
sizeof(Float_t));
98 if (!
phi)
phi= (Float_t*)malloc(2*
sizeof(Float_t));
99 else phi= (Float_t*)realloc(
phi,2*
sizeof(Float_t));
100 if (!
theta)
theta= (Float_t*)malloc(2*
sizeof(Float_t));
101 else theta= (Float_t*)realloc(
theta,2*
sizeof(Float_t));
102 if (!
bp)
bp= (Float_t*)malloc(
ndim*
sizeof(Float_t));
103 else bp= (Float_t*)realloc(
bp,
ndim*
sizeof(Float_t));
104 if (!
bx)
bx= (Float_t*)malloc(
ndim*
sizeof(Float_t));
105 else bx= (Float_t*)realloc(
bx,
ndim*
sizeof(Float_t));
107 if (!
time)
time= (Double_t*)malloc(
ndim*
sizeof(Double_t));
108 else time= (Double_t*)realloc(
time,
ndim*
sizeof(Double_t));
116 if (!
hrss)
hrss= (Double_t*)malloc(
ndim*
sizeof(Double_t));
117 else hrss= (Double_t*)realloc(
hrss,
ndim*
sizeof(Double_t));
118 if (!
snr)
snr= (Float_t*)malloc(
ndim*
sizeof(Float_t));
119 else snr= (Float_t*)realloc(
snr,
ndim*
sizeof(Float_t));
120 if (!
Deff)
Deff= (Float_t*)malloc(
ndim*
sizeof(Float_t));
121 else Deff= (Float_t*)realloc(
Deff,
ndim*
sizeof(Float_t));
122 if (!
mass)
mass= (Float_t*)malloc(2*
sizeof(Float_t));
123 else mass= (Float_t*)realloc(
mass,2*
sizeof(Float_t));
124 if (!
spin)
spin= (Float_t*)malloc(6*
sizeof(Float_t));
125 else spin= (Float_t*)realloc(
spin,6*
sizeof(Float_t));
181 return fChain->GetEntry(entry);
186 return fChain->GetEntries();
241 waveTree->Branch(
"ndim", &
ndim,
"ndim/I");
242 waveTree->Branch(
"run", &
run,
"run/I");
243 waveTree->Branch(
"nevent", &
nevent,
"nevent/I");
244 waveTree->Branch(
"eventID", &
eventID,
"eventID/I");
245 waveTree->Branch(
"type", &
type,
"type/I");
246 waveTree->Branch(
"name",
name);
247 waveTree->Branch(
"factor", &
factor,
"factor/F");
248 waveTree->Branch(
"distance", &
distance,
"distance/F");
249 waveTree->Branch(
"mchirp", &
mchirp,
"mchirp/F");
250 waveTree->Branch(
"rp0", &
rp0,
"rp0/F");
251 waveTree->Branch(
"e0", &
e0,
"e0/F");
252 waveTree->Branch(
"redshift", &
redshift,
"redshift/F");
253 waveTree->Branch(
"gps", &
gps,
"gps/D");
254 waveTree->Branch(
"strain", &
strain,
"strain/D");
255 waveTree->Branch(
"psi",
psi, cpsi);
256 waveTree->Branch(
"iota",
iota, ciota);
257 waveTree->Branch(
"phi",
phi, cphi);
258 waveTree->Branch(
"theta",
theta, ctheta);
259 waveTree->Branch(
"bp",
bp, cbp);
260 waveTree->Branch(
"bx",
bx, cbx);
261 waveTree->Branch(
"time",
time, ctime);
262 waveTree->Branch(
"duration",
duration, cduration);
263 waveTree->Branch(
"frequency",
frequency, cfrequency);
264 waveTree->Branch(
"bandwidth",
bandwidth, cbandwidth);
265 waveTree->Branch(
"hrss",
hrss, chrss);
266 waveTree->Branch(
"snr",
snr, csnr);
267 waveTree->Branch(
"Deff",
Deff, cDeff);
268 waveTree->Branch(
"mass",
mass, cmass);
269 waveTree->Branch(
"spin",
spin, cspin);
303 for(i=0; i<6; i++) this->
spin[i] = a.
spin[i];
305 for(i=0; i<
ndim; i++){
333 int ID =
id<0 ? abs(
id+1) : abs(
id);
335 if(!N || !M || !I || ID<0)
return false;
341 double hphp, hxhx, hphx, T0, To, Eo;
342 double Pi = 3.14159265358979312;
358 if((p = strtok(ch,
" \t")) == NULL)
return false;
360 p = strtok(NULL,
" \t");
363 p = strtok(NULL,
" \t");
364 p = strtok(NULL,
" \t");
365 p = strtok(NULL,
" \t");
366 this->
iota[0] = atof(p);
367 this->
phi[1] = atof(p);
368 p = strtok(NULL,
" \t");
369 this->
psi[1] = atof(p);
370 p = strtok(NULL,
" \t");
371 if(
fabs(atof(p))>1) {
372 cout<<
"injection:fill_in error: external theta not valid, must be [-1,1]\n"<<endl;
375 this->
theta[0] = acos(atof(p));
377 p = strtok(NULL,
" \t");
378 this->
phi[0] = atof(p) > 0 ? atof(p) : 2*Pi+atof(p);
379 this->
phi[0]*= 180/
Pi;
380 p = strtok(NULL,
" \t");
381 this->
psi[0] = atof(p);
382 this->
psi[0]*= 180/
Pi;
384 p = strtok(NULL,
" \t");
385 p = strtok(NULL,
" \t");
389 p = strtok(NULL,
" \t");
391 this->
name->assign(p, strlen(p));
395 if(itag.find(p) == string::npos)
continue;
396 this->
type = i+1;
break;
399 p = strtok(NULL,
" \t");
401 p = strtok(NULL,
" \t");
403 p = strtok(NULL,
" \t");
409 if(nst >=
str.length()) {
410 cout<<
"injection:fill_in error: no injections for detector "
411 << net->
getifo(m)->
Name <<
" was found in the injection list !!!\n\n";
416 itag =
str.substr(nst);
418 if((p = strtok(ch,
" \t")) == NULL)
continue;
420 p = strtok(NULL,
" \t");
421 this->
time[
m] = atof(p);
426 p = strtok(NULL,
" \t");
427 this->
bp[
m] = atof(p);
428 p = strtok(NULL,
" \t");
429 this->
bx[
m] = atof(p);
431 nst =
str.find(
"insp") <
str.find(
"ebbh") ?
str.find(
"insp") :
str.find(
"ebbh");
433 if(nst <
str.length()) {
434 p = strtok(NULL,
" \t");
435 this->
Deff[
m] = atof(p);
443 if(!save)
return save;
445 nst =
str.find(
"distance");
447 if(nst <
str.length()) {
448 itag =
str.substr(nst);
450 if((p = strtok(ch,
" \t")) != NULL)
451 this->
distance = atof(strtok(NULL,
" \t"));
454 nst =
str.find(
"mass1");
456 if(nst <
str.length()) {
457 itag =
str.substr(nst);
459 if((p = strtok(ch,
" \t")) != NULL)
460 this->
mass[0] = atof(strtok(NULL,
" \t"));
463 nst =
str.find(
"mass2");
465 if(nst <
str.length()) {
466 itag =
str.substr(nst);
468 if((p = strtok(ch,
" \t")) != NULL)
469 this->
mass[1] = atof(strtok(NULL,
" \t"));
472 nst =
str.find(
"mchirp");
474 if(nst <
str.length()) {
475 itag =
str.substr(nst);
477 if((p = strtok(ch,
" \t")) != NULL)
478 this->
mchirp = atof(strtok(NULL,
" \t"));
481 nst =
str.find(
"rp0");
483 if(nst <
str.length()) {
484 itag =
str.substr(nst);
486 if((p = strtok(ch,
" \t")) != NULL)
487 this->
rp0 = atof(strtok(NULL,
" \t"));
490 nst =
str.find(
"e0");
492 if(nst <
str.length()) {
493 itag =
str.substr(nst);
495 if((p = strtok(ch,
" \t")) != NULL)
496 this->
e0 = atof(strtok(NULL,
" \t"));
499 nst =
str.find(
"redshift");
501 if(nst <
str.length()) {
502 itag =
str.substr(nst);
504 if((p = strtok(ch,
" \t")) != NULL)
505 this->
redshift = atof(strtok(NULL,
" \t"));
508 nst =
str.find(
"spin1");
512 if(nst <
str.length()) {
513 itag =
str.substr(nst);
515 if((p = strtok(ch,
" \t")) != NULL) {
516 this->
spin[0] = atof(strtok(NULL,
" \t"));
517 this->
spin[1] = atof(strtok(NULL,
" \t"));
518 this->
spin[2] = atof(strtok(NULL,
" \t"));
522 nst =
str.find(
"spin2");
526 if(nst <
str.length()) {
527 itag =
str.substr(nst);
529 if((p = strtok(ch,
" \t")) != NULL) {
530 this->
spin[3] = atof(strtok(NULL,
" \t"));
531 this->
spin[4] = atof(strtok(NULL,
" \t"));
532 this->
spin[5] = atof(strtok(NULL,
" \t"));
544 if(pd->
TIME.
data[ID] < 1.) save =
false;
547 if(!save || Eo<=0.)
return save;
556 this->
time[
m] += To - T0;
561 int idSize = pd->
IWFID.size();
563 for (
int mm=0; mm<idSize; mm++)
if (pd->
IWFID[mm]==
id) wfIndex=mm;
564 this->
pwf[
m] = wfIndex>=0 ? pd->
IWFP[wfIndex] : NULL;
578 if(!N || !M || !I)
return;
579 double FACTOR =
fabs(factor);
580 factor = factor<=0 ? 1 :
fabs(factor);
587 int dsize = waveTree->GetUserInfo()->GetSize();
588 if(dsize!=0 && dsize!=M) {
589 cout<<
"injection::output(): wrong user detector list in header tree"<<endl;
exit(1);
592 for(
int n=0;n<
M;n++) {
596 waveTree->GetUserInfo()->Add(pD);
608 this->factor = FACTOR;
Int_t fCurrent
pointer to the analyzed TTree or TChain
detector * getifo(size_t n)
param: detector index
TTree * Init(TString fName, int n)
virtual size_t size() const
Double_t * time
beam pattern coefficients for hx
std::vector< double > * getmdcTime()
wavearray< double > a(hp.size())
void output(TTree *, network *, double, bool=true)
Float_t * snr
injected hrss in the detectors
string getmdcType(size_t n)
Float_t * iota
source psi angle
string getmdcList(size_t n)
Float_t * duration
injection gps time
Float_t * bandwidth
average center_of_hrss frequency
virtual void start(double s)
Float_t * theta
source phi angle
Int_t ndim
current Tree number in a TChain
network ** net
NOISE_MDC_SIMULATION.
void Show(Int_t entry=-1)
Float_t factor
injection name
Double_t * hrss
estimated bandwidth
virtual injection & operator=(const injection &)
Float_t * mass
detector specific effective distance
Int_t run
number of detectors
std::vector< wavearray< double > * > IWFP
Float_t * phi
source iota angle
Float_t * bx
beam pattern coefficients for hp
WSeries< double > * getTFmap()
param: no parameters
double fabs(const Complex &x)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
Float_t * bp
source theta angle
Float_t * frequency
estimated duration
Bool_t fill_in(network *, int, bool=true)
size_t getmdc__ID(size_t n)
wavearray< double > ** pwf
[x1,y1,z1,x2,y2,z2] components of spin vector
TBranch * b_ndim
pointer to the reconstructed waveform
Float_t * spin
[m1,m2], binary mass parameters
TTree * fChain
root input file cointainig the mdc TTree
Float_t * Deff
injected snr in the detectors