Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
FemtoYlmIndexes.cxx
1/*
2 * FemtoYlmIndexes.cpp
3 *
4 * Created on: 8 lip 2022
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#include "FemtoYlmIndexes.h"
10
11#include "Cout.h"
12
13#include <iostream>
14
15namespace Hal {
16
17
19 if (fEls) delete[] fEls;
20 if (fEms) delete[] fEms;
21 if (fElsi) delete[] fElsi;
22 if (fEmsi) delete[] fEmsi;
23 }
24
26 if (this == &other) return *this;
27 if (this->fL == other.fL) return *this;
28 Resize(other.fL);
29 return *this;
30 }
31
33 fL(L), fMaxJM((L + 1) * (L + 1)), fEls(nullptr), fEms(nullptr), fElsi(nullptr), fEmsi(nullptr) {
34 Resize(L);
35 }
36
37 void FemtoYlmIndexes::Resize(Int_t newL) {
38 if (fEls) {
39 delete[] fEls;
40 delete[] fEms;
41 delete[] fElsi;
42 delete[] fEmsi;
43 fEls = nullptr;
44 fEms = nullptr;
45 fElsi = nullptr;
46 fEmsi = nullptr;
47 }
48 fL = newL;
49 if (fL == 0) return;
50 if (fL > 6) { Cout::PrintInfo("Creating YLM for L>6!", EInfo::kError); }
51 fMaxJM = (fL + 1) * (fL + 1);
52 if (fL > 0) {
53 fEls = new Double_t[fMaxJM];
54 fEms = new Double_t[fMaxJM];
55 fElsi = new Int_t[fMaxJM];
56 fEmsi = new Int_t[fMaxJM];
57 fIndexes = Array_2<Int_t>(fL + 1, 2 * fL + 1);
58 for (int i = 0; i <= fL; i++) {
59 for (int j = 0; j < 2 * fL + 1; j++) {
60 fIndexes[i][j] = -1;
61 }
62 }
63 }
64 int el = 0;
65 int em = 0;
66 int il = 0;
67 do {
68 fEls[il] = el;
69 fEms[il] = em;
70 fElsi[il] = (int) el;
71 fEmsi[il] = (int) em;
72 fIndexes[el][fL + em] = il;
73#ifdef _FINISH_DEBUG_
74 std::cout << "il el em " << il << " " << fElsi[il] << " " << fEmsi[il] << std::endl;
75#endif
76 em++;
77 il++;
78 if (em > el) {
79 el++;
80 em = -el;
81 }
82 } while (el <= fL);
83 }
84
86
87 Int_t FemtoYlmIndexes::GetPadId(Int_t l, Int_t m) const {
89 map.MakeBigger(fL + 1, fL + 1);
90 Int_t pad = 1;
91 for (int i = 0; i <= fL; i++) {
92 for (int j = 0; j <= fL; j++) {
93 map[i][j] = pad++;
94 }
95 }
96 Int_t x = l;
97 Int_t y = 0;
98 if (m >= 0) {
99 y = l - m;
100 } else {
101 y = l;
102 x = l + m;
103 }
104 return map[x][y];
105 }
106
107 void FemtoYlmIndexes::Print(Option_t* /*option*/) const {
108 std::cout << ClassName() << std::endl;
109 std::cout << Form(" l m index") << std::endl;
110 for (int i = 0; i < fMaxJM; i++) {
111 std::cout << Form("%4i%4i%4i", fElsi[i], fEmsi[i], i) << std::endl;
112 }
113 std::cout << "------------" << std::endl;
114 }
115
116} /* namespace Hal */
void MakeBigger(Int_t sizeA, Int_t sizeB)
Definition Array.cxx:197
static void PrintInfo(TString text, Hal::EInfo status)
Definition Cout.cxx:370
void Resize(Int_t newL)
Int_t GetPadId(Int_t l, Int_t m) const
FemtoYlmIndexes & operator=(const FemtoYlmIndexes &other)