BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnZdcBScanner.h
Go to the documentation of this file.
1/*
2 * File: BmnZdcBScanner.cxx
3 * Author: pnaleks <pnaleks@gmail.com>
4 *
5 * Created on 25 октября 2019 г., 12:15
6 */
7
8#ifndef BMNZDCBSCANNER_H
9#define BMNZDCBSCANNER_H
10
11#include <BmnMath.h>
12#include <BmnZDCDigit.h>
13#include <TChain.h>
14#include <TClonesArray.h>
15#include <TH1D.h>
16
17class ZdcMoment
18{
19 Int_t fHits = 0;
20 Double_t fM = 0;
21 Double_t fMX = 0;
22 Double_t fMY = 0;
23 Double_t fMXX = 0;
24 Double_t fMYY = 0;
25 Double_t fXc = 0;
26 Double_t fYc = 0;
27 Double_t fMC = 0;
28 Double_t fMD = 0;
29
30 public:
31 void Reset()
32 {
33 fHits = 0;
34 fM = fMX = fMY = fMXX = fMYY = fMC = fMD = 0.;
35 }
36 void SetCenter(Double_t x /*mm*/, Double_t y /*mm*/)
37 {
38 fXc = x;
39 fYc = y;
40 }
41 void Add(BmnZDCDigit* p, Double_t scale = 1.)
42 {
43 Int_t chan = p->GetChannel();
44 Double_t m = (scale * p->GetAmp()) * 1e-3; // MeV ->GeV
45 if (chan > 104 || m == 0)
46 return;
47
48 Double_t x = (p->GetX() - fXc) * 1e-3; // mm -> m
49 Double_t y = (p->GetX() - fYc) * 1e-3; // mm -> m
50
51 fHits++;
52 fM += m;
53 fMX += m * x;
54 fMY += m * y;
55 fMXX += m * x * x;
56 fMYY += m * y * y;
57
58 if (chan < 69)
59 fMD += m;
60 else
61 fMC += m;
62 }
63
64 Int_t GetHits() { return fHits; }
65 Double_t GetE() { return fM; }
66
67 Double_t GetXo() { return fM == 0. ? 0. : fMX / fM; }
68 Double_t GetYo() { return fM == 0. ? 0. : fMY / fM; }
70 {
71 Double_t x = GetXo();
72 Double_t y = GetYo();
73 return TMath::Sqrt(x * x + y * y);
74 }
75
77 { /*GeV*m^2*/
78 Double_t Xo = GetXo();
79 return (fMXX - 2.0 * Xo * fMX + Xo * Xo * fM);
80 }
82 { /*GeV*m^2*/
83 Double_t Yo = GetYo();
84 return (fMYY - 2.0 * Yo * fMY + Yo * Yo * fM);
85 }
86 Double_t GetI() { return GetIx() + GetIy(); } /*GeV*m^2*/
87 Double_t GetIo() { return (fMXX + fMYY); } /*GeV*m^2*/
88 Double_t GetM() { return fM == 0. ? 0. : GetI() / fM; } /*m^2*/
89 Double_t GetMo() { return fM == 0. ? 0. : GetIo() / fM; } /*m^2*/
90 Double_t GetA() { return fM == 0. ? 0. : (fMC - fMD) / fM; }
91};
92
94{
95 TChain fInpChain;
97 UInt_t fScanWidth = 1000;
99
101
102 class ZdcMoment fEventData;
103
104 struct Item
105 {
107 Double_t b;
108 }* fIndex = 0;
109 UInt_t fIndexSize = 0;
110
111 static bool compareItem(Item i1, Item i2) { return (i1.index < i2.index); }
112
113 void OnEvent(TClonesArray* pArrayOfBmnZDCDigit, char mode, Double_t b);
114 void OnScan(Int_t n, Double_t scanValue, TH1D* pBH);
115
116 public:
118 : fInpChain("cbmsim")
119 {}
121 {
122 if (fIndex)
123 delete fIndex;
124 }
125
126 void SetShowProgress(Bool_t show) { fShowProgress = show; }
127 void SetEventData(TClonesArray* pArrayOfBmnZDCDigit, Double_t scale = 1.);
128 void AddSimDigit(const char* fileName) { fInpChain.Add(fileName); }
129 void SetSimScale(Double_t scale) { fSimScale = scale; }
130
131 void SetScanWidth(UInt_t entries) { fScanWidth = entries; }
132
133 virtual TH1D* Scan(char mode);
134};
135
136#endif /* BMNZDCBSCANNER_H */
__m128 m
Definition P4_F32vec4.h:27
bool Bool_t
int Int_t
unsigned int UInt_t
constexpr Bool_t kFALSE
double Double_t
Float_t GetX() const
UShort_t GetChannel() const
Float_t GetAmp() const
class ZdcMoment fEventData
void OnEvent(TClonesArray *pArrayOfBmnZDCDigit, char mode, Double_t b)
static bool compareItem(Item i1, Item i2)
virtual ~BmnZdcBScanner()
void SetSimScale(Double_t scale)
void SetShowProgress(Bool_t show)
void SetEventData(TClonesArray *pArrayOfBmnZDCDigit, Double_t scale=1.)
struct BmnZdcBScanner::Item * fIndex
void OnScan(Int_t n, Double_t scanValue, TH1D *pBH)
virtual TH1D * Scan(char mode)
void AddSimDigit(const char *fileName)
void SetScanWidth(UInt_t entries)
Double_t fMYY
Double_t GetIo()
Double_t GetIx()
Double_t GetE()
Double_t fYc
Double_t GetYo()
Double_t GetIy()
Double_t GetXo()
Double_t fMY
Int_t GetHits()
Double_t GetA()
Double_t GetR()
Double_t fMC
Double_t fMX
Double_t GetMo()
Double_t GetI()
Double_t GetM()
void Add(BmnZDCDigit *p, Double_t scale=1.)
Double_t fMXX
Double_t fM
Double_t fMD
void SetCenter(Double_t x, Double_t y)
Double_t fXc
*brief user defined string literal for JSON values *sa std::size_t n
Definition json.hpp:20362
Double_t Sqrt(Double_t x)