CbmRoot
CbmMuchSectorRadial.cxx
Go to the documentation of this file.
1 
9 #include "CbmMuchSectorRadial.h"
10 
11 #include "CbmMuchAddress.h" // for CbmMuchAddress, kMuchChannel
12 #include "CbmMuchPadRadial.h" // for CbmMuchPadRadial
13 
14 #include <TMath.h> // for Ceil, Floor, Pi, TwoPi
15 
16 #include <FairLogger.h> // for Logger, LOG
17 
18 #include <vector> // for vector
19 
20 
21 // ----- Default constructor -------------------------------------------
23  : CbmMuchSector(), fR1(0.), fR2(0.), fPhi1(0.), fPhi2(0.), fPadDphi(0.) {}
24 // -------------------------------------------------------------------------
25 
26 
27 // ----- Standard constructor --------------------------------------------
29  Int_t secId,
30  Double_t r1,
31  Double_t r2,
32  Double_t phi1,
33  Double_t phi2)
34  : CbmMuchSector(detId, secId, 0)
35  , fR1(r1)
36  , fR2(r2)
37  , fPhi1(0.)
38  , fPhi2(0.)
39  , fPadDphi((r2 - r1) / r1) {
40  if (phi2 < phi1) LOG(error) << "Panic!";
41  fNChannels = 2 * TMath::Ceil((phi2 - phi1) / 2 / fPadDphi);
42  fPhi1 = (phi1 + phi2) / 2 - fNChannels / 2 * fPadDphi;
43  fPhi2 = (phi1 + phi2) / 2 + fNChannels / 2 * fPadDphi;
44 }
45 // -----------------o--------------------------------------------------------
46 
47 
48 // ----- Public method GetChannel --------------------------------------
50  if (fPhi2 > TMath::Pi() && phi < fPhi1) phi += TMath::TwoPi();
51  if (phi < fPhi1 || phi > fPhi2) return -1;
52  return TMath::Floor((fPhi2 - phi) / fPadDphi);
53 }
54 // -------------------------------------------------------------------------
55 
56 
57 // ----- Public method GetChannel --------------------------------------
59  Int_t i = GetPadIndexByPhi(phi);
60  // printf("i=%i\n",i);
61  if (i == -1) return nullptr;
62 
64 }
65 // -------------------------------------------------------------------------
66 
67 
68 // -------------------------------------------------------------------------
70  for (Int_t iChannel = 0; iChannel < fNChannels; iChannel++) {
71  UInt_t address =
73  Double_t r1, r2, phi1, phi2;
74  r1 = fR1;
75  r2 = fR2;
76  phi1 = fPhi2 - iChannel * fPadDphi;
77  phi2 = phi1 - fPadDphi;
78  CbmMuchPad* pad = new CbmMuchPadRadial(address, r1, r2, phi1, phi2);
79  fPads.push_back(pad);
80  LOG(debug) << "iChannel=" << iChannel << " fPads.size()=" << fPads.size()
81  << " fNChannels=" << fNChannels;
82  }
83 }
84 // -------------------------------------------------------------------------
85 
86 // -------------------------------------------------------------------------
88  for (Int_t iChannel = 0; iChannel < fNChannels; iChannel++) {
89  CbmMuchPadRadial* pad = (CbmMuchPadRadial*) fPads[iChannel];
90  pad->DrawPad();
91  // pad->Draw();
92  }
93 }
94 // -------------------------------------------------------------------------
95 
96 
kMuchChannel
@ kMuchChannel
Channel.
Definition: CbmMuchAddress.h:22
CbmMuchSectorRadial
Definition: CbmMuchSectorRadial.h:19
CbmMuchSector
Definition: CbmMuchSector.h:22
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmMuchPadRadial::DrawPad
void DrawPad()
Definition: CbmMuchPadRadial.cxx:55
CbmMuchSectorRadial::CbmMuchSectorRadial
CbmMuchSectorRadial()
Definition: CbmMuchSectorRadial.cxx:22
CbmMuchPadRadial
Definition: CbmMuchPadRadial.h:17
CbmMuchSectorRadial::GetPadByPhi
CbmMuchPadRadial * GetPadByPhi(Double_t phi)
Definition: CbmMuchSectorRadial.cxx:58
CbmMuchSector::fNChannels
Int_t fNChannels
Definition: CbmMuchSector.h:39
CbmMuchSectorRadial::fR2
Double_t fR2
Definition: CbmMuchSectorRadial.h:38
CbmMuchSectorRadial::GetPadIndexByPhi
Int_t GetPadIndexByPhi(Double_t phi)
Definition: CbmMuchSectorRadial.cxx:49
CbmMuchSector::fAddress
UInt_t fAddress
Definition: CbmMuchSector.h:38
CbmMuchSector::GetPadByChannelIndex
CbmMuchPad * GetPadByChannelIndex(Int_t iChannel) const
Definition: CbmMuchSector.cxx:22
CbmMuchSectorRadial::fPhi2
Double_t fPhi2
Definition: CbmMuchSectorRadial.h:40
CbmMuchSectorRadial::AddPads
void AddPads()
Definition: CbmMuchSectorRadial.cxx:69
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmMuchAddress::SetElementId
static UInt_t SetElementId(UInt_t address, Int_t level, Int_t newId)
Definition: CbmMuchAddress.h:140
xMath::Pi
double Pi()
Definition: xMath.h:5
CbmMuchSectorRadial.h
CbmMuchSector::fPads
std::vector< CbmMuchPad * > fPads
Definition: CbmMuchSector.h:40
CbmMuchSectorRadial::DrawPads
void DrawPads()
Definition: CbmMuchSectorRadial.cxx:87
CbmMuchPad
Definition: CbmMuchPad.h:21
CbmMuchSectorRadial::fR1
Double_t fR1
Definition: CbmMuchSectorRadial.h:37
CbmMuchAddress.h
CbmMuchPadRadial.h
CbmMuchSectorRadial::fPhi1
Double_t fPhi1
Definition: CbmMuchSectorRadial.h:39
CbmMuchSectorRadial::fPadDphi
Double_t fPadDphi
Definition: CbmMuchSectorRadial.h:41