BmnRoot
Loading...
Searching...
No Matches
BmnZDCEventData.cxx
Go to the documentation of this file.
1/*
2 * File: BmnZDCEventData.cxx
3 * Author: pnaleks
4 *
5 * Created on 5 июня 2020 г., 13:43
6 */
7
8#include "BmnZDCEventData.h"
9
10#include <iostream>
11using namespace std;
12
14 fE = fEc = fEn = fEp = 0.;
15 fH = fHc = fHn = fHp = 0;
16 fX = fY = 0.;
17 fAsymmetry = fMoment = 0.;
18}
19
22
23void BmnZDCEventData::Set(TClonesArray * pArrayOfBmnZDCDigits, Float_t * pModuleScale, Float_t * pModuleThreshold) {
24 fE = fEc = fEn = fEp = 0.;
25 fH = fHc = fHn = fHp = 0;
26 fX = fY = 0.;
27 fAsymmetry = fMoment = 0.;
28
29 Double_t SEx = 0, SEy = 0, SExx = 0, SEyy = 0;
30 Int_t N = pArrayOfBmnZDCDigits->GetEntries();
31 for (Int_t i = 0; i < N; i++) {
32 BmnZDCDigit * p = (BmnZDCDigit *) pArrayOfBmnZDCDigits->At(i);
33
34 Int_t ch = p->GetChannel();
35 if (ch < 1 || ch > 104) continue;
36
37 Float_t e = p->GetAmp() * 1e-3; // MeV -> GeV
38 if (pModuleScale) e *= pModuleScale[ch];
39
40 if (pModuleThreshold && e < pModuleThreshold[ch]) continue;
41
42 fH++;
43 fE += e;
44
45 switch (ch) {
46 case 3: case 4: case 5:
47 case 10: case 11: case 12:
48 case 17: case 18: case 19:
49 case 24: case 25: case 26:
50 fHn++;
51 fEn += e;
52 break;
53 case 43: case 44: case 45:
54 case 50: case 51: case 52:
55 case 57: case 58: case 59:
56 case 64: case 65: case 66:
57 fHp++;
58 fEp += e;
59 break;
60 default:
61 if (ch > 68) {
62 fHc++;
63 fEc += e;
64 }
65 }
66
67 SEx += e * p->GetX();
68 SEy += e * p->GetY();
69 SExx += e * p->GetX() * p->GetX();
70 SEyy += e * p->GetY() * p->GetY();
71 }
72
73 if (fE > 0.) {
74 fX = SEx / fE / 10.; // mm -> cm
75 fY = SEy / fE / 10.; // mm -> cm
76 fMoment = (SExx + SEyy) / fE / 100.; // mm^2 -> cm^2
77 fAsymmetry = 2.*fEc/fE - 1.;
78 }
79}
80
82 switch (op) {
83 case 'c': case 'C': return fEc;
84 case 'n': case 'N': return fEn;
85 case 'p': case 'P': return fEp;
86 }
87
88 return fE;
89}
90
92 switch (op) {
93 case 'c': case 'C': return fHc;
94 case 'n': case 'N': return fHn;
95 case 'p': case 'P': return fHp;
96 }
97
98 return fH;
99}
100
101void BmnZDCEventData::Print(Option_t *option) const {
102 cout << "BmnZDCEventData:";
103 if (fH) {
104 cout << endl;
105 cout << " Hits: " << fH << endl;
106 cout << " Energy: " << fE << " GeV" << endl;
107 cout << " Asym.: " << fAsymmetry << endl;
108 cout << " Moment: " << fMoment << " cm^2" << endl;
109 } else {
110 cout << " is empty" << endl;
111 }
112}
int i
Definition P4_F32vec4.h:22
Float_t GetX() const
UShort_t GetChannel() const
Float_t GetY() const
Float_t GetAmp() const
virtual ~BmnZDCEventData()
void Set(TClonesArray *pArrayOfBmnZDCDigits, Float_t *pModuleScale=0, Float_t *pModuleThreshold=0)
virtual void Print(Option_t *option="") const
STL namespace.