BluetAnalyzer/include/BluetAnalyzer.hh

159 lines
3.4 KiB
C++
Raw Permalink Normal View History

2024-11-23 16:56:50 +08:00
//---------------------------------------------------------------------------
// version: v1.0
// code log:
// 1) read and study on the BluetFactory output data in BluetDataModel format
// 2) get the phi30 beam profile from 6Li(n,t) in the low energy region
// 3) get drift velocity
// author: yih@ihep.ac.cn
// date: 2023-04-04
//--------------------------------------------------------------------------
// #include "../../sources/config/include/BluetDataModel.hh"
#include "ROOT/TDataFrame.hxx"
#include "TApplication.h"
#include "TChain.h"
#include "TF1.h"
#include "TF2.h"
#include "TGTab.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TInterpreter.h"
#include "fmt/core.h"
#include "string"
#include "BluetDataModel.hh"
const int sizeX = 1200;
const int sizeY = 1200;
2024-11-23 16:56:50 +08:00
const double rBeam = 35. / 2;
const double rTarget = 73. / 2;
const double rSubstrate = 89. / 2;
const double rPCB = rSubstrate + 10.;
class BluetAnalyzer {
public:
BluetAnalyzer() {
// Declare main frame
int argc = 0;
char **argv = nullptr;
app = new TApplication("app", &argc, argv);
mFrame = new TGMainFrame(gClient->GetRoot(), sizeX, sizeY);
mTab = new TGTab(mFrame, sizeX, sizeY);
mFrame->AddFrame(mTab, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
// Declare Data Models
const string bluetBase = getenv("bluet_base");
const string datamodel = fmt::format(
"#include \"{}/sources/config/include/BluetDataModel.hh\"", bluetBase);
gInterpreter->Declare(datamodel.c_str());
};
~BluetAnalyzer();
private:
TApplication *app;
TGMainFrame *mFrame;
TGTab *mTab;
double sidelength;
int Nlayer;
double driftL;
double kickdT;
double flighL;
2024-11-23 16:56:50 +08:00
double sampleT;
2024-11-24 21:12:20 +08:00
bool cutEnable;
2024-11-23 16:56:50 +08:00
double EcutMin;
double EcutMax;
double tofCutMin;
double tofCutMax;
double stampCutMin;
double stampCutMax;
double cathAmpCutMin;
double cathAmpCutMax;
double cathTimeCutMax;
double cathTimeCutMin;
double meshAmpCutMin;
double meshAmpCutMax;
double meshTimeCutMax;
double meshTimeCutMin;
int NtrkCutMin;
int NtrkCutMax;
double lengthCutMin;
double lengthCutMax;
bool rCut;
double rCutMin;
double rCutMax;
double cosCutMin;
double CenterPos[2];
double sliceW;
TF1 *fbeam1;
TF2 *fbeam2;
TF1 *fbeamr;
TF1 *fdgaus;
TChain *eventTree = new TChain("eventTree");
BluetEvent *fEvent = nullptr;
int Nevent;
int Nbin;
double tmin;
double tmax;
int Nrbin;
double rmax;
double *Sbin;
TH2F *hprofile;
TH1F *hslicex;
TH1F *hslicey;
TH1F *hbeamr;
TH1F *hrinte;
TH2F *htofE;
TH1F *htof;
TH1F *htofr0;
TH1F *htofr1;
TH1F *hpull;
TH1F *hratio;
TH2F *hLengthE;
TH1F *htcath;
TH1F *htpad;
TH1F *hv0;
TH1F *hv1;
TH1F *hcos;
TH1F *hphi;
TH2F *hdeltacos1;
TH2F *hdeltacos2;
TH2F *hts;
TH2F *htn;
TH2F *hamp;
TH2F *han;
TH2F *hta;
TH2F *htt;
TH2F *hte;
TH1F *hec;
2024-11-23 16:56:50 +08:00
public:
void readCutParameters(string cfgfile);
void defineFitFunctions();
void defineHistograms();
bool isGoodEvent(BluetEvent *event);
bool isGoodTrack(BluetTrack *track);
void readTreeData(vector<string> files);
void FillHistograms();
void postOperations();
void saveHistograms(TString filename);
2024-11-23 16:56:50 +08:00
void drawHistograms();
private:
void drawVertex();
void drawTOF();
void drawDrift();
void drawAngle();
void draw1DFeatures();
void draw2DFeatures();
void drawPadFeatures();
2024-11-24 17:50:16 +08:00
// void drawExcitationCurve();
2024-11-23 16:56:50 +08:00
};