EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbmRichConverter.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CbmRichConverter.h
1 
9 #ifndef CBM_RICH_CONVERTER
10 #define CBM_RICH_CONVERTER
11 
12 #include "CbmRichRingLight.h"
13 #include "CbmRichRing.h"
14 #include "CbmRichHit.h"
15 #include "FairRootManager.h"
16 #include "TClonesArray.h"
17 
18 #include <iostream>
19 #include <vector>
20 
21 using std::vector;
22 using std::cout;
23 using std::endl;
24 
35 {
36 public:
42  static void CopyHitsToRingLight(
43  const CbmRichRing* ring1,
44  CbmRichRingLight* ring2)
45  {
46  if (NULL == fRichHits) {
47  //Init();
48  }
49  if (NULL == fRichHits) return;
50  int nofHits = ring1->GetNofHits();
51  for (int i = 0; i < nofHits; i++){
52  Int_t hitInd = ring1->GetHit(i);
53  CbmRichHit* hit = (CbmRichHit*) fRichHits->At(hitInd);
54  if (NULL == hit) continue;
55  CbmRichHitLight hl(hit->GetX(), hit->GetY());
56  ring2->AddHit(hl);
57  }
58  }
59 
66  static void CopyHitsToRingLight(
67  const vector<double>& hitX,
68  const vector<double>& hitY,
69  CbmRichRingLight* ring)
70  {
71  int nofHits = hitX.size();
72  for (int i = 0; i < nofHits; i++){
73  CbmRichHitLight hl(hitX[i], hitY[i]);
74  ring->AddHit(hl);
75  }
76  }
77 
83  static void CopyParamsToRing(
84  const CbmRichRingLight* ring1,
85  CbmRichRing* ring2)
86  {
87  ring2->SetCenterX(ring1->GetCenterX());
88  ring2->SetCenterY(ring1->GetCenterY());
89  ring2->SetChi2(ring1->GetChi2());
90  ring2->SetAaxis(ring1->GetAaxis());
91  ring2->SetBaxis(ring1->GetBaxis());
92  ring2->SetRadius(ring1->GetRadius());
93  ring2->SetPhi(ring1->GetPhi());
94  }
95 
96  static TClonesArray* fRichHits;
97 
98 public:
102  static void Init()
103  {
105  if ( NULL == ioman) {
106  cout << "-E- CbmRichConverter::Init, RootManager not instantised!" << endl;
107  return;
108  }
109  fRichHits = (TClonesArray*) ioman->GetObject("RichHit");
110  if ( NULL == fRichHits) {
111  cout << "-W- CbmRichConverter::Init, No RichHit array" << endl;
112  }
113  }
114 };
115 
116 
117 
118 #endif