ATLAS Offline Software
Loading...
Searching...
No Matches
AlfaLocalHits Class Reference

#include <AlfaLocalHits.h>

Inheritance diagram for AlfaLocalHits:
Collaboration diagram for AlfaLocalHits:

Public Member Functions

 AlfaLocalHits ()
void update ()
int AddHit (const AlfaLocalHit &h)
void Reset ()
void ResetPaths ()
int size ()
int GetNhits ()
int GetNpaths ()
void Dump ()
void DumpPaths ()
void ApplyPathPattern (const char *pattern)
AlfaLocalHitsGetPathHits (int ipath)
AlfaLocalHitGetHit (int ihit)
void SetPathPattern (const char *pattern)
TString GetPathPattern ()
void SetHit (const ALFA_LocRecCorrEvent *LocRecCorrHit)
void AssignZ ()
int GetPotNum () const
float GetX () const
float GetY () const
float GetZ () const
int IsHi () const
int GetMDindex (const char *name)
TString GetPotName () const
TString GetMDname (int i)
const ALFA_LocRecCorrEventGetLocRecCorr () const
void Print ()

Private Attributes

std::vector< AlfaLocalHitm_hits
int m_nhits
std::vector< AlfaLocalHitsm_paths
int m_npaths
TString m_pathpattern
int m_pot = 0
TString m_potname
int m_ishit = 0
Float_t m_x = 0.0F
Float_t m_y = 0.0F
Float_t m_z = 0.0F
const ALFA_LocRecCorrEventm_LocRecCorr = nullptr

Detailed Description

Definition at line 58 of file AlfaLocalHits.h.

Constructor & Destructor Documentation

◆ AlfaLocalHits()

AlfaLocalHits::AlfaLocalHits ( )

Definition at line 123 of file AlfaLocalHits.cxx.

123 {
124 m_hits.clear();
125 m_paths.clear();
126 m_nhits = m_hits.size();
127 m_npaths = m_paths.size();
128 m_pathpattern ="";
129}
TString m_pathpattern
std::vector< AlfaLocalHits > m_paths
std::vector< AlfaLocalHit > m_hits

Member Function Documentation

◆ AddHit()

int AlfaLocalHits::AddHit ( const AlfaLocalHit & h)

Definition at line 134 of file AlfaLocalHits.cxx.

134 {
135 m_hits.push_back(h);
136 update();
137 return m_hits.size();
138}

◆ ApplyPathPattern()

void AlfaLocalHits::ApplyPathPattern ( const char * pattern)

Definition at line 178 of file AlfaLocalHits.cxx.

178 {
180// ... apply path pattern to all the hits
181// paths will be the same objects contaioning
182// only the wanted hits
183// pattern examples: B7L1U_A7L1U_X_B7R1L etc. X ... anything
186 TString ts_pattern(pattern);
187 TObjArray toa_tokenized_pattern(4,0);
188 toa_tokenized_pattern = * ts_pattern.Tokenize("_");
189 if(toa_tokenized_pattern.GetEntries() != 4){
190 std::runtime_error("AlfaLocalHits: Pattern of wrong length!!! " + ts_pattern);
191 }
192 TString patternitem("");
193 AlfaLocalHits alh_tmp;
194 for(int i1 = 0; i1 < m_nhits; i1++){
195 int i1last = (i1 == m_nhits-1);
196 AlfaLocalHit h1(m_hits.at(i1));
197 TString patternitem0 = TString(((TObjString*) toa_tokenized_pattern.At(0))->GetString());
198 if((h1.GetPotName().Contains(patternitem0))
199 || (i1last && patternitem0.Contains("X"))
200 ){
201 for(int i2 = 0; i2 < m_nhits; i2++){
202 int i2last = (i2 == m_nhits-1);
203 if(i2 == i1 && !i2last) continue;
204 AlfaLocalHit h2(m_hits.at(i2));
205 TString patternitem1 = TString(((TObjString*) toa_tokenized_pattern.At(1))->GetString());
206 if((h2.GetPotName().Contains(patternitem1))
207 ||(i2last && patternitem1.Contains("X"))
208 ){
209 for(int i3 = 0; i3 < m_nhits; i3++){
210 int i3last = (i3 == m_nhits-1);
211 if(i3 == i1 && !i3last) continue;
212 if(i3 == i2 && !i3last) continue;
213 AlfaLocalHit h3(m_hits.at(i3));
214 TString patternitem2 = TString(((TObjString*) toa_tokenized_pattern.At(2))->GetString());
215 if((h3.GetPotName().Contains(patternitem2))
216 ||(i3last && patternitem2.Contains("X"))
217 ){
218 for(int i4 = 0; i4 < m_nhits; i4++){
219 int i4last = (i4 == m_nhits-1);
220 if(i4 == i1 && !i4last) continue;
221 if(i4 == i2 && !i4last) continue;
222 if(i4 == i3 && !i4last) continue;
223 AlfaLocalHit h4(m_hits.at(i4));
224 TString patternitem3 = TString(((TObjString*) toa_tokenized_pattern.At(3))->GetString());
225 if((h4.GetPotName().Contains(patternitem3))
226 ||(i4last && patternitem3.Contains("X"))
227 ){
228 if(patternitem0!='X') {alh_tmp.AddHit(h1);}
229 if(patternitem1!='X') {alh_tmp.AddHit(h2);}
230 if(patternitem2!='X') {alh_tmp.AddHit(h3);}
231 if(patternitem3!='X') {alh_tmp.AddHit(h4);}
232 }
233 }
234 }
235 }
236 }
237 }
238 }
239 }
240 alh_tmp.SetPathPattern(m_pathpattern.Data());
241 m_paths.push_back(std::move(alh_tmp));
242 update();
243}
int AddHit(const AlfaLocalHit &h)
void SetPathPattern(const char *pattern)

◆ AssignZ()

void AlfaLocalHit::AssignZ ( )
inherited

Definition at line 64 of file AlfaLocalHits.cxx.

64 {
65 if(m_pot < 0) {
66 throw std::runtime_error("AlfaLocalHit::AssignZ() m_pot not assigned");
67 }
68 m_z = 1.e10;
69 if(m_potname.Contains("B7L1U")) m_z = 241528.;
70 if(m_potname.Contains("A7L1U")) m_z = 237388.;
71 if(m_potname.Contains("B7L1L")) m_z = 241538.;
72 if(m_potname.Contains("A7L1L")) m_z = 237398.;
73 if(m_potname.Contains("B7R1U")) m_z = -241548.;
74 if(m_potname.Contains("A7R1U")) m_z = -237408.;
75 if(m_potname.Contains("B7R1L")) m_z = -241538.;
76 if(m_potname.Contains("A7R1L")) m_z = -237398.;
77 if(!(m_z < 1.e10)){
78 throw std::runtime_error("AlfaLocalHit::AssignZ: z coordinate was not assigned for the hit");
79 }
80}
TString m_potname

◆ Dump()

void AlfaLocalHits::Dump ( )

Definition at line 159 of file AlfaLocalHits.cxx.

159 {
160 if(m_nhits == 0){
161 cout << "Cannot dump the AlfaLocalHits object, it has zero size." << endl;
162 }else{
163 cout << "Dumping object of AlfaLocalHits class:" << endl;
164 for(Int_t i = 0; i < m_nhits; i++){
165 cout << "at " << i << " ";
166 m_hits.at(i).Print();
167 cout << endl;
168 }
169 }
170}

◆ DumpPaths()

void AlfaLocalHits::DumpPaths ( )

Definition at line 171 of file AlfaLocalHits.cxx.

171 {
172 cout << "Dumping paths for " << m_pathpattern.Data() << " pattern" << endl;
173 for(int i = 0; i < m_npaths; i++){
174 m_paths.at(i).Dump();
175 }
176}

◆ GetHit()

AlfaLocalHit * AlfaLocalHits::GetHit ( int ihit)

Definition at line 257 of file AlfaLocalHits.cxx.

257 {
258 if(ihit >= m_nhits){
259 throw std::runtime_error("Requesting hit with overflow index");
260 }
261 return &(m_hits.at(ihit));
262}

◆ GetLocRecCorr()

const ALFA_LocRecCorrEvent * AlfaLocalHit::GetLocRecCorr ( ) const
inlineinherited

Definition at line 44 of file AlfaLocalHits.h.

44{return m_LocRecCorr;};
const ALFA_LocRecCorrEvent * m_LocRecCorr

◆ GetMDindex()

int AlfaLocalHit::GetMDindex ( const char * name)
inherited

Definition at line 90 of file AlfaLocalHits.cxx.

90 {
91 TString n(name);
92 if(n.Contains("B7L1U")) return 0;
93 if(n.Contains("B7L1L")) return 1;
94 if(n.Contains("A7L1U")) return 2;
95 if(n.Contains("A7L1L")) return 3;
96 if(n.Contains("A7R1U")) return 4;
97 if(n.Contains("A7R1L")) return 5;
98 if(n.Contains("B7R1U")) return 6;
99 if(n.Contains("B7R1L")) return 7;
100 throw std::runtime_error("AlfaLocalHit::GetMDindex ... Not recognised detector name: " + n);
101}

◆ GetMDname()

TString AlfaLocalHit::GetMDname ( int i)
inherited

Definition at line 102 of file AlfaLocalHits.cxx.

102 {
103 if(i == 0) return {"B7L1U"};
104 if(i == 1) return {"B7L1L"};
105 if(i == 2) return {"A7L1U"};
106 if(i == 3) return {"A7L1L"};
107 if(i == 4) return {"A7R1U"};
108 if(i == 5) return {"A7R1L"};
109 if(i == 6) return {"B7R1U"};
110 if(i == 7) return {"B7R1L"};
111 throw std::runtime_error("AlfaLocalHit::GetMDname ... Not recognised detector number: " + std::to_string(i));
112}

◆ GetNhits()

int AlfaLocalHits::GetNhits ( )
inline

Definition at line 72 of file AlfaLocalHits.h.

72{return m_nhits;}

◆ GetNpaths()

int AlfaLocalHits::GetNpaths ( )
inline

Definition at line 73 of file AlfaLocalHits.h.

73{return m_npaths;}

◆ GetPathHits()

AlfaLocalHits * AlfaLocalHits::GetPathHits ( int ipath)

Definition at line 249 of file AlfaLocalHits.cxx.

249 {
250 if(ipath >= m_npaths){
251 throw std::runtime_error("Requesting path with overflow index");
252 }
253 return &(m_paths.at(ipath));
254}

◆ GetPathPattern()

TString AlfaLocalHits::GetPathPattern ( )
inline

Definition at line 80 of file AlfaLocalHits.h.

80{return m_pathpattern;}

◆ GetPotName()

TString AlfaLocalHit::GetPotName ( ) const
inlineinherited

Definition at line 42 of file AlfaLocalHits.h.

42{return m_potname;};

◆ GetPotNum()

int AlfaLocalHit::GetPotNum ( ) const
inlineinherited

Definition at line 36 of file AlfaLocalHits.h.

36{return m_pot;};

◆ GetX()

float AlfaLocalHit::GetX ( ) const
inlineinherited

Definition at line 37 of file AlfaLocalHits.h.

37{return m_x;};

◆ GetY()

float AlfaLocalHit::GetY ( ) const
inlineinherited

Definition at line 38 of file AlfaLocalHits.h.

38{return m_y;};

◆ GetZ()

float AlfaLocalHit::GetZ ( ) const
inlineinherited

Definition at line 39 of file AlfaLocalHits.h.

39{return m_z;};

◆ IsHi()

int AlfaLocalHit::IsHi ( ) const
inlineinherited

Definition at line 40 of file AlfaLocalHits.h.

40{return m_ishit;};

◆ Print()

void AlfaLocalHit::Print ( )
inherited

Definition at line 82 of file AlfaLocalHits.cxx.

82 {
83 cout << "pot = " << m_pot
84 << " i.e " << m_potname.Data()
85 << " x = " << m_x
86 << " m_y = " << m_y
87 ;
88}

◆ Reset()

void AlfaLocalHits::Reset ( )

Definition at line 139 of file AlfaLocalHits.cxx.

139 {
140 m_hits.clear();
141 m_paths.clear();
142 m_pathpattern ="";
143 update();
144}

◆ ResetPaths()

void AlfaLocalHits::ResetPaths ( )

Definition at line 145 of file AlfaLocalHits.cxx.

145 {
146 m_paths.clear();
147 m_pathpattern ="";
148 update();
149}

◆ SetHit()

void AlfaLocalHit::SetHit ( const ALFA_LocRecCorrEvent * LocRecCorrHit)
inherited

Definition at line 52 of file AlfaLocalHits.cxx.

52 {
53 m_pot = LocRecCorrHit->getPotNum();
54 //cout << "AlfaLocalHit::SetHit... m_pot = " << m_pot << endl;
56 m_ishit = 1;
57 m_x = LocRecCorrHit->getXpositionLHC();
58 m_y = LocRecCorrHit->getYpositionLHC();
59 m_LocRecCorr = LocRecCorrHit;
60 AssignZ();
61}
TString GetMDname(int i)

◆ SetPathPattern()

void AlfaLocalHits::SetPathPattern ( const char * pattern)

Definition at line 245 of file AlfaLocalHits.cxx.

245 {
247}

◆ size()

int AlfaLocalHits::size ( )

Definition at line 152 of file AlfaLocalHits.cxx.

152 {
153 if(m_nhits != (int) m_hits.size()){
154 throw std::runtime_error("Class AlfaLocalHits: m_nhits != m_hits.size() !!! ");
155 }
156 return m_nhits;
157}

◆ update()

void AlfaLocalHits::update ( )

Definition at line 130 of file AlfaLocalHits.cxx.

130 {
131 m_nhits = m_hits.size();
132 m_npaths = m_paths.size();
133}

Member Data Documentation

◆ m_hits

std::vector<AlfaLocalHit> AlfaLocalHits::m_hits
private

Definition at line 60 of file AlfaLocalHits.h.

◆ m_ishit

int AlfaLocalHit::m_ishit = 0
privateinherited

Definition at line 27 of file AlfaLocalHits.h.

◆ m_LocRecCorr

const ALFA_LocRecCorrEvent* AlfaLocalHit::m_LocRecCorr = nullptr
privateinherited

Definition at line 29 of file AlfaLocalHits.h.

◆ m_nhits

int AlfaLocalHits::m_nhits
private

Definition at line 61 of file AlfaLocalHits.h.

◆ m_npaths

int AlfaLocalHits::m_npaths
private

Definition at line 63 of file AlfaLocalHits.h.

◆ m_pathpattern

TString AlfaLocalHits::m_pathpattern
private

Definition at line 64 of file AlfaLocalHits.h.

◆ m_paths

std::vector<AlfaLocalHits> AlfaLocalHits::m_paths
private

Definition at line 62 of file AlfaLocalHits.h.

◆ m_pot

int AlfaLocalHit::m_pot = 0
privateinherited

Definition at line 25 of file AlfaLocalHits.h.

◆ m_potname

TString AlfaLocalHit::m_potname
privateinherited

Definition at line 26 of file AlfaLocalHits.h.

◆ m_x

Float_t AlfaLocalHit::m_x = 0.0F
privateinherited

Definition at line 28 of file AlfaLocalHits.h.

◆ m_y

Float_t AlfaLocalHit::m_y = 0.0F
privateinherited

Definition at line 28 of file AlfaLocalHits.h.

◆ m_z

Float_t AlfaLocalHit::m_z = 0.0F
privateinherited

Definition at line 28 of file AlfaLocalHits.h.


The documentation for this class was generated from the following files: