Class Reference for E1039 Core & Analysis Software
ana_NMR_event.cc
Go to the documentation of this file.
1 #include "NMRDataManager.h"
2 
4 {
5  NMRDataManager man;
6  //man.Verb(1); // 0 = silent, 1 = some, 2 = every event
7  gSystem->mkdir("result", true);
8 
12  man.ReadEventFile("2024-02-08_19h02m57s");
13  man.ReadEventFile("2024-02-08_22h13m47s");
14  man.PrintKeyList();
15 
19  TTimeStamp ts0(2024, 2, 8, 18, 0, 0);
20  int utime0 = ts0.GetSec() + TTimeStamp::GetZoneOffset();
21 
25  TGraph* gr_pol = new TGraph();
26  TGraph* gr_pres = new TGraph();
27 
28  int n_evt = man.GetNumEvent();
29  for (int i_evt = 0; i_evt < n_evt; i_evt++) {
30  NMREvent* evt = man.GetEvent(i_evt);
31  int evt_num = evt->GetInt ("EventNum");
32  double pol = evt->GetDouble("Polarization");
33  double area = evt->GetDouble("Area");
34  string qmeter = evt->GetString("QMeterName");
35  double pres = evt->GetDouble("He4Press");
36  //string YMDhms = NMRUtil::ConvEventNum(evt_num);
37 
38  if (utime0 == 0) utime0 = evt_num;
39  if (evt_num < utime0) continue;
40 
41  int n_pt = gr_pol->GetN();
42  double time = (evt_num - utime0) / 3600.0;
43  gr_pol ->SetPoint(n_pt, time, pol );
44  gr_pres->SetPoint(n_pt, time, pres);
45  }
46 
50  TCanvas* c1 = new TCanvas("c1", "");
51  c1->SetGrid(true);
52 
53  gr_pol->SetTitle( (";Hours since "+NMRUtil::ConvEventNum(utime0)+";Polarization").c_str() );
54  gr_pol->SetMarkerStyle(7);
55  gr_pol->Draw("AP");
56  c1->SaveAs("result/gr_pol.png");
57 
58  gr_pres->SetTitle( (";Hours since "+NMRUtil::ConvEventNum(utime0)+";Pressure (Torr)").c_str() );
59  gr_pres->SetMarkerStyle(7);
60  gr_pres->Draw("AP");
61  gr_pres->GetYaxis()->SetRangeUser(21.0, 26.0);
62  c1->SaveAs("result/gr_pres.png");
63 
64  delete c1;
65  exit(0);
66 }
void ana_NMR_event()
Definition: ana_NMR_event.cc:3
void ReadEventFile(const std::string label)
NMREvent * GetEvent(const int index)
void PrintKeyList(std::ostream &os=std::cout)
std::string GetString(const int idx)
Definition: NMREvent.h:22
double GetDouble(const int idx)
Definition: NMREvent.h:24
int GetInt(const int idx)
Definition: NMREvent.h:23
void ConvEventNum(const int event_num, int &YYYY, int &MM, int &DD, int &hh, int &mm, int &ss)
Definition: NMRUtil.h:6