CbmRoot
CbmRichConverter.h
Go to the documentation of this file.
1 
9 #ifndef CBM_RICH_CONVERTER
10 #define CBM_RICH_CONVERTER
11 
12 #include "CbmRichHit.h"
13 #include "CbmRichRing.h"
14 #include "CbmRichRingLight.h"
15 #include "FairRootManager.h"
16 #include "TClonesArray.h"
17 
18 #include <iostream>
19 #include <vector>
20 
21 using std::cout;
22 using std::endl;
23 using std::vector;
24 
35 public:
41  static void CopyHitsToRingLight(const CbmRichRing* ring1,
42  CbmRichRingLight* ring2) {
43  if (NULL == fRichHits) { Init(); }
44  if (NULL == fRichHits) return;
45  int nofHits = ring1->GetNofHits();
46  for (int i = 0; i < nofHits; i++) {
47  Int_t hitInd = ring1->GetHit(i);
48  CbmRichHit* hit = (CbmRichHit*) fRichHits->At(hitInd);
49  if (NULL == hit) continue;
50  CbmRichHitLight hl(hit->GetX(), hit->GetY(), hitInd);
51  ring2->AddHit(hl);
52  }
53  }
54 
61  static void CopyHitsToRingLight(const vector<double>& hitX,
62  const vector<double>& hitY,
63  CbmRichRingLight* ring) {
64  int nofHits = hitX.size();
65  for (int i = 0; i < nofHits; i++) {
66  CbmRichHitLight hl(hitX[i], hitY[i]);
67  ring->AddHit(hl);
68  }
69  }
70 
76  static void CopyParamsToRing(const CbmRichRingLight* ring1,
77  CbmRichRing* ring2) {
78  ring2->SetCenterX(ring1->GetCenterX());
79  ring2->SetCenterY(ring1->GetCenterY());
80  ring2->SetChi2(ring1->GetChi2());
81  ring2->SetAaxis(ring1->GetAaxis());
82  ring2->SetBaxis(ring1->GetBaxis());
83  ring2->SetRadius(ring1->GetRadius());
84  ring2->SetPhi(ring1->GetPhi());
85  }
86 
87  static TClonesArray* fRichHits;
88 
89 public:
93  static void Init() {
94  FairRootManager* ioman = FairRootManager::Instance();
95  if (NULL == ioman) {
96  cout << "-E- CbmRichConverter::Init, RootManager not instantised!"
97  << endl;
98  return;
99  }
100  fRichHits = (TClonesArray*) ioman->GetObject("RichHit");
101  if (NULL == fRichHits) {
102  cout << "-W- CbmRichConverter::Init, No RichHit array" << endl;
103  }
104  }
105 };
106 
107 
108 #endif
CbmRichRing::SetRadius
void SetRadius(Float_t r)
Definition: CbmRichRing.h:57
CbmRichRing::SetCenterX
void SetCenterX(Float_t x)
Definition: CbmRichRing.h:55
CbmPixelHit::GetX
Double_t GetX() const
Definition: CbmPixelHit.h:83
CbmRichRing::SetAaxis
void SetAaxis(Double_t a)
Definition: CbmRichRing.h:58
CbmRichConverter::CopyHitsToRingLight
static void CopyHitsToRingLight(const vector< double > &hitX, const vector< double > &hitY, CbmRichRingLight *ring)
Copy hits coordinates from vectors to CbmRichRingLight.
Definition: CbmRichConverter.h:61
CbmPixelHit::GetY
Double_t GetY() const
Definition: CbmPixelHit.h:84
CbmRichRing::SetPhi
void SetPhi(Double_t phi)
Definition: CbmRichRing.h:63
CbmRichRingLight::GetChi2
float GetChi2() const
Definition: CbmRichRingLight.h:242
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmRichConverter::CopyParamsToRing
static void CopyParamsToRing(const CbmRichRingLight *ring1, CbmRichRing *ring2)
Copy parameters from CbmRichRingLight to CbmRichRing.
Definition: CbmRichConverter.h:76
CbmRichRing::GetNofHits
Int_t GetNofHits() const
Definition: CbmRichRing.h:40
CbmRichRing
Definition: CbmRichRing.h:17
CbmRichConverter::fRichHits
static TClonesArray * fRichHits
Definition: CbmRichConverter.h:87
CbmRichRing.h
CbmRichRing::GetHit
UInt_t GetHit(Int_t i) const
Definition: CbmRichRing.h:42
CbmRichRingLight::GetAaxis
float GetAaxis() const
Definition: CbmRichRingLight.h:163
CbmRichRing::SetChi2
void SetChi2(Double_t chi2)
Definition: CbmRichRing.h:64
CbmRichRingLight::GetCenterY
float GetCenterY() const
Definition: CbmRichRingLight.h:160
CbmRichRingLight.h
CbmRichRingLight::AddHit
void AddHit(CbmRichHitLight hit)
Add new hit to the ring.
Definition: CbmRichRingLight.h:87
CbmRichRingLight::GetBaxis
float GetBaxis() const
Definition: CbmRichRingLight.h:164
CbmRichHitLight
Definition: CbmRichRingLight.h:14
CbmRichRingLight::GetRadius
float GetRadius() const
Definition: CbmRichRingLight.h:161
CbmRichRing::SetBaxis
void SetBaxis(Double_t b)
Definition: CbmRichRing.h:59
CbmRichConverter::Init
static void Init()
Initialize array of RICH hits.
Definition: CbmRichConverter.h:93
CbmRichConverter::CopyHitsToRingLight
static void CopyHitsToRingLight(const CbmRichRing *ring1, CbmRichRingLight *ring2)
Copy hits from CbmRichRing to CbmRichRingLight.
Definition: CbmRichConverter.h:41
CbmRichRing::SetCenterY
void SetCenterY(Float_t y)
Definition: CbmRichRing.h:56
CbmRichHit.h
CbmRichRingLight::GetCenterX
float GetCenterX() const
Definition: CbmRichRingLight.h:159
CbmRichRingLight
Definition: CbmRichRingLight.h:39
CbmRichHit
Definition: CbmRichHit.h:19
CbmRichRingLight::GetPhi
float GetPhi() const
Definition: CbmRichRingLight.h:165
CbmRichConverter
Convert internal data classes to cbmroot common data classes.
Definition: CbmRichConverter.h:34