Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DrawAlmFromFits.C
Go to the documentation of this file.
1 //
2 // this example draw to to 2d hist the spherical harmonic coefficients
3 // Author : Gabriele Vedovato
4 // fitsName = fits file name
5 
6 void DrawAlmFromFits(TString fitsName) {
7 
8  #include <complex>
9 
10  skymap sm(const_cast<char*>(fitsName.Data()));
11  int L = sm.size();
12  cout << "L " << L << endl;
13  cout << "mean " << sm.mean() << endl;
14 
15  double en=0;
16  for(int i=0;i<L;i++) en+=pow(sm.get(i),2);
17 
18  double dw = 1./L;
19  cout << "EN " << en*dw << endl;
20 
21  wat::Alm alm = sm.getAlm(256);
22  cout << "alm(0,0).real()/sqrt(4*TMath::Pi()) : " << alm(0,0).real()/sqrt(4*TMath::Pi()) << endl;
23  double norm=0;
24  for(int l=0;l<=alm.Lmax();l++) {
25  int limit = TMath::Min(l,alm.Mmax());
26  for (int m=0; m<=limit; m++) {
27  double mod = pow(alm(l,m).real(),2)+pow(alm(l,m).imag(),2);
28  norm+= m==0 ? mod : 2*mod;
29  }
30  }
31  norm = norm/(4*TMath::Pi());
32  cout << "norm : " << norm << " = en " << en*dw << " from Parseval Formula" << endl;
33 
34  TCanvas* canvas = new TCanvas("Alm", "LVC experiment", 300,40, 600, 600);
35 
36  TH2D* h2 = new TH2D("alm","alm", alm.Lmax(), 0, alm.Lmax(), alm.Lmax(), 0, alm.Lmax());
37  h2->SetStats(kFALSE);
38  h2->SetTitleFont(12);
39  h2->SetFillColor(kWhite);
40  h2->GetXaxis()->SetTitle("l");
41  h2->GetYaxis()->SetTitle("m");
42 
43  double min=+100;
44  double max=-100;
45  for(int l=1;l<=alm.Lmax();l++) { // l=0 is excluded !!!
46  int limit = TMath::Min(l,alm.Mmax());
47  for (int m=0; m<=limit; m++) {
48  double mod = pow(alm(l,m).real(),2)+pow(alm(l,m).imag(),2);
49  h2->SetBinContent(l,m,log10(mod));
50  if(max<log10(mod)) max=log10(mod);
51  if(min>log10(mod)) min=log10(mod);
52  //h2->SetBinContent(m,l,log10(mod));
53  }
54  }
55  cout << "min " << min << " max " << max << endl;
56  h2->GetZaxis()->SetRangeUser(min,max);
57 
58  h2->Draw("colz");
59 
60 }
double min(double x, double y)
Definition: eBBH.cc:13
int Lmax() const
Returns the maximum l.
Definition: alm.hh:52
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
TString("c")
return wmap canvas
int m
Definition: cwb_net.C:10
i drho i
double mean()
Definition: skymap.cc:462
int Mmax() const
Returns the maximum m.
Definition: alm.hh:54
double Pi
Definition: skymap.hh:45
Definition: alm.hh:175
int l
Definition: cbc_plots.C:434
double get(size_t i)
param: sky index
Definition: skymap.cc:681
void DrawAlmFromFits(TString fitsName)
size_t size()
Definition: skymap.hh:118