BmnRoot 26.10.0-19-g6979a6c6
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnTof400Qa.cxx
Go to the documentation of this file.
1#include "BmnTof400Qa.h"
2
3#include "BmnGlobalTrack.h"
4
5#include <TFile.h>
6#include <TStopwatch.h>
7
8static Double_t fWorkTime = 0.0;
9
11{
12 fStsTracks = nullptr;
13 fGlobalTracks = nullptr;
14 fKalman = nullptr;
15 fTof400Hits = nullptr;
17}
18
20{
21
22 TStopwatch sw;
23 sw.Start();
25
26 FairRootManager* ioman = FairRootManager::Instance();
27 if (!ioman)
28 Fatal("Init", "FairRootManager is not instantiated");
29
30 fTof400Hits = (TClonesArray*)ioman->GetObject("BmnTof400Hit");
31 fStsTracks = (TClonesArray*)ioman->GetObject("StsVector");
32 fGlobalTracks = (TClonesArray*)ioman->GetObject("BmnGlobalTrack");
33
34 fHistoManager->Create1<TH1F>("TOF400_ResidX_total", "Total residuals in X coordinate; dX, cm; N", 100, -5.0, 5.0);
35 fHistoManager->Create1<TH1F>("TOF400_ResidY_total", "Total residuals in Y coordinate; dY, cm; N", 100, -5.0, 5.0);
36 fHistoManager->Create2<TH2F>("TOF400_Banan_total", "Total #beta vs rigidity; rigidity, GeV/c/Q; #beta", 400, -5.0,
37 10.0, 400, 0.2, 1.1);
38 fHistoManager->Create2<TH2F>("TOF400_Mass2_total", "Total m^{2} vs rigidity; rigidity, GeV/c/Q; m^{2}", 400, -5.0,
39 10.0, 400, -0.5, 10.0);
40
41 for (Int_t i = 0; i < nModules; ++i) {
42 fHistoManager->Create1<TH1F>(Form("TOF400_ResidX_%d", i),
43 Form("Residuals in X coordinate for module %d; dX, cm; N", i), 100, -5.0, 5.0);
44 fHistoManager->Create1<TH1F>(Form("TOF400_ResidY_%d", i),
45 Form("Residuals in Y coordinate for module %d; dY, cm; N", i), 100, -5.0, 5.0);
46 }
47
48 tof400Dir = gFile->mkdir("TOF400");
49
50 sw.Stop();
51 fWorkTime += sw.RealTime();
52
53 return kSUCCESS;
54}
55
57{
58
59 TStopwatch sw;
60 sw.Start();
61
62 if (!IsActive())
63 return;
64 for (Int_t iTr = 0; iTr < fGlobalTracks->GetEntriesFast(); ++iTr) {
66 if (track->GetTof1HitIndex() == -1)
67 continue;
68 BmnTofHit* hit = (BmnTofHit*)fTof400Hits->At(track->GetTof1HitIndex());
69 fHistoManager->H1("TOF400_ResidX_total")->Fill(hit->GetResX());
70 fHistoManager->H1("TOF400_ResidY_total")->Fill(hit->GetResY());
71 Int_t mod = ((hit->GetDetectorID() & 0x0000FF00) >> 8) - 1;
72 fHistoManager->H1(Form("TOF400_ResidX_%d", mod))->Fill(hit->GetResX());
73 fHistoManager->H1(Form("TOF400_ResidY_%d", mod))->Fill(hit->GetResY());
74 // fHistoManager->H2("TOF400_Banan_total")->Fill(track->GetP(), track->GetBeta(1));
75 fHistoManager->H2("TOF400_Mass2_total")->Fill(track->GetP(), track->GetMass2(1));
76 }
77
78 sw.Stop();
79 fWorkTime += sw.RealTime();
80}
81
83{
84
85 TStopwatch sw;
86 sw.Start();
87
88 for (Int_t i = 0; i < nModules; ++i) {
89 fHistoManager->H1(Form("TOF400_ResidX_%d", i))->Fit("gaus", "QSR", "", -2, 2);
90 fHistoManager->H1(Form("TOF400_ResidY_%d", i))->Fit("gaus", "QSR", "", -2, 2);
91 }
92
93 tof400Dir->cd();
94 fHistoManager->WriteToFile();
95
96 sw.Stop();
97 fWorkTime += sw.RealTime();
98
99 printf("Work time of BmnTof400Qa: %4.2f sec.\n", fWorkTime);
100}
static Double_t fWorkTime
int i
Definition P4_F32vec4.h:22
int Int_t
double Double_t
const char Option_t
void Fatal(const char *location, const char *msgfmt,...)
#define gFile
char * Form(const char *fmt,...)
BmnGlobalTrack.h.
Int_t GetTof1HitIndex() const
Float_t GetMass2(Int_t tofID) const
Double_t GetResX()
Definition BmnHit.h:40
Double_t GetResY()
Definition BmnHit.h:41
virtual InitStatus Init()
BmnKalmanFilter * fKalman
Definition BmnTof400Qa.h:33
TDirectory * tof400Dir
Definition BmnTof400Qa.h:39
const Int_t nModules
Definition BmnTof400Qa.h:41
TClonesArray * fStsTracks
Definition BmnTof400Qa.h:35
TClonesArray * fTof400Hits
Definition BmnTof400Qa.h:34
BmnTof400Qa()
Default constructor.
virtual void Finish()
virtual void Exec(Option_t *opt)
TClonesArray * fGlobalTracks
Definition BmnTof400Qa.h:36
BmnQaHistoManager * fHistoManager
Definition BmnTof400Qa.h:38
Double_t GetP()
Definition BmnTrack.h:67
Double_t RealTime()
void Start(Bool_t reset=kTRUE)
void Stop()