BmnRoot
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 <TClonesArray.h>
12#include <TChain.h>
13#include <TH1D.h>
14#include <BmnMath.h>
15#include <BmnZDCDigit.h>
16
17class ZdcMoment {
18 Int_t fHits = 0;
19 Double_t fM = 0;
20 Double_t fMX = 0;
21 Double_t fMY = 0;
22 Double_t fMXX = 0;
23 Double_t fMYY = 0;
24 Double_t fXc = 0;
25 Double_t fYc = 0;
26 Double_t fMC = 0;
27 Double_t fMD = 0;
28public:
29 void Reset() { fHits = 0; fM = fMX = fMY = fMXX = fMYY = fMC = fMD = 0.; }
30 void SetCenter(Double_t x /*mm*/, Double_t y /*mm*/) {
31 fXc = x; fYc = y;
32 }
33 void Add(BmnZDCDigit * p, Double_t scale = 1.) {
34 Int_t chan = p->GetChannel();
35 Double_t m = (scale * p->GetAmp())*1e-3; // MeV ->GeV
36 if (chan > 104 || m == 0) return;
37
38 Double_t x = (p->GetX() - fXc)*1e-3; // mm -> m
39 Double_t y = (p->GetX() - fYc)*1e-3; // mm -> m
40
41 fHits++;
42 fM += m;
43 fMX += m*x;
44 fMY += m*y;
45 fMXX += m*x*x;
46 fMYY += m*y*y;
47
48 if (chan < 69) fMD += m; else fMC += m;
49 }
50
51 Int_t GetHits() { return fHits; }
52 Double_t GetE() { return fM; }
53
54 Double_t GetXo() { return fM == 0. ? 0. : fMX/fM; }
55 Double_t GetYo() { return fM == 0. ? 0. : fMY/fM; }
56 Double_t GetR() {
57 Double_t x = GetXo();
58 Double_t y = GetYo();
59 return TMath::Sqrt(x*x + y*y);
60 }
61
62 Double_t GetIx() {/*GeV*m^2*/
63 Double_t Xo = GetXo();
64 return (fMXX - 2.0*Xo*fMX + Xo*Xo*fM);
65 }
66 Double_t GetIy() {/*GeV*m^2*/
67 Double_t Yo = GetYo();
68 return (fMYY - 2.0*Yo*fMY + Yo*Yo*fM);
69 }
70 Double_t GetI() { return GetIx() + GetIy(); } /*GeV*m^2*/
71 Double_t GetIo() { return (fMXX + fMYY); } /*GeV*m^2*/
72 Double_t GetM() { return fM == 0. ? 0. : GetI() / fM; } /*m^2*/
73 Double_t GetMo() { return fM == 0. ? 0. : GetIo() / fM; } /*m^2*/
74 Double_t GetA() { return fM == 0. ? 0. : (fMC - fMD) / fM; }
75};
76
77
78
80 TChain fInpChain;
81 UInt_t fMaxEntries = 0;
82 UInt_t fScanWidth = 1000;
83 Double_t fSimScale = 1.;
84
85 Bool_t fShowProgress = kFALSE;
86
87 class ZdcMoment fEventData;
88
89 struct Item {
90 Double_t index;
91 Double_t b;
92 } * fIndex = 0;
93 UInt_t fIndexSize = 0;
94
95 static bool compareItem(Item i1, Item i2) {
96 return (i1.index < i2.index);
97 }
98
99 void OnEvent(TClonesArray* pArrayOfBmnZDCDigit, char mode, Double_t b);
100 void OnScan(Int_t n, Double_t scanValue, TH1D* pBH);
101public:
102 BmnZdcBScanner() : fInpChain("cbmsim") {}
103 virtual ~BmnZdcBScanner() {
104 if (fIndex) delete fIndex;
105 }
106
107 void SetShowProgress(Bool_t show) { fShowProgress = show; }
108 void SetEventData(TClonesArray * pArrayOfBmnZDCDigit, Double_t scale = 1.);
109 void AddSimDigit(const char * fileName) { fInpChain.Add(fileName); }
110 void SetSimScale(Double_t scale) { fSimScale = scale; }
111
112 void SetScanWidth(UInt_t entries) { fScanWidth = entries; }
113
114 virtual TH1D * Scan(char mode);
115};
116
117#endif /* BMNZDCBSCANNER_H */
118
__m128 m
Definition P4_F32vec4.h:27
Float_t GetX() const
UShort_t GetChannel() const
Float_t GetAmp() const
virtual ~BmnZdcBScanner()
void SetSimScale(Double_t scale)
virtual TH1D * Scan(char mode)
void SetShowProgress(Bool_t show)
void SetEventData(TClonesArray *pArrayOfBmnZDCDigit, Double_t scale=1.)
void AddSimDigit(const char *fileName)
void SetScanWidth(UInt_t entries)
Double_t GetIo()
Double_t GetIx()
Double_t GetE()
Double_t GetYo()
Double_t GetIy()
Double_t GetXo()
Int_t GetHits()
Double_t GetA()
Double_t GetR()
Double_t GetMo()
Double_t GetI()
Double_t GetM()
void Add(BmnZDCDigit *p, Double_t scale=1.)
void SetCenter(Double_t x, Double_t y)