CbmRoot
Loading...
Searching...
No Matches
CbmMuchSectorRadial.cxx
Go to the documentation of this file.
1/* Copyright (C) 2012-2020 Petersburg Nuclear Physics Institute named by B.P.Konstantinov of National Research Centre "Kurchatov Institute", Gatchina
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Evgeny Kryshen [committer], Florian Uhlig , Apar Agarwal */
4
13#include "CbmMuchSectorRadial.h"
14
15#include "CbmMuchAddress.h" // for CbmMuchAddress, kMuchChannel
16#include "CbmMuchPadRadial.h" // for CbmMuchPadRadial
17
18#include <Logger.h> // for Logger, LOG
19
20#include <TMath.h> // for Ceil, Floor, Pi, TwoPi
21
22#include <vector> // for vector
23
24
25// ----- Default constructor -------------------------------------------
26CbmMuchSectorRadial::CbmMuchSectorRadial() : CbmMuchSector(), fR1(0.), fR2(0.), fPhi1(0.), fPhi2(0.), fPadDphi(0.) {}
27// -------------------------------------------------------------------------
28
29
30// ----- Standard constructor --------------------------------------------
31CbmMuchSectorRadial::CbmMuchSectorRadial(Int_t detId, Int_t secId, Double_t r1, Double_t r2, Double_t phi1,
32 Double_t phi2)
33 : CbmMuchSector(detId, secId, 0)
34 , fR1(r1)
35 , fR2(r2)
36 , fPhi1(0.)
37 , fPhi2(0.)
38 , fPadDphi((r2 - r1) / r1)
39{
40 if (phi2 < phi1) LOG(error) << "Error in description of module paramaters (phi1 > phi2)";
41 fNChannels = TMath::Ceil(((phi2 - phi1) / fPadDphi) - DBL_EPSILON);
42 fPhi1 = phi1;
43 fPhi2 = phi2;
44}
45// -----------------o--------------------------------------------------------
46
47
48// ----- Public method GetChannel --------------------------------------
50{
51 if (fPhi2 > TMath::Pi() && phi < fPhi1) phi += TMath::TwoPi();
52 if (phi < fPhi1 || phi > fPhi2) return -1;
53 return TMath::Floor((fPhi2 - phi) / fPadDphi);
54}
55// -------------------------------------------------------------------------
56
57
58// ----- Public method GetChannel --------------------------------------
60{
61 Int_t i = GetPadIndexByPhi(phi);
62 // printf("i=%i\n",i);
63 if (i == -1) return nullptr;
64
66}
67// -------------------------------------------------------------------------
68
69
70// -------------------------------------------------------------------------
72{
73 for (Int_t iChannel = 0; iChannel < fNChannels; iChannel++) {
74 UInt_t address = CbmMuchAddress::SetElementId(fAddress, kMuchChannel, iChannel);
75 Double_t r1, r2, phi1, phi2;
76 r1 = fR1;
77 r2 = fR2;
78 phi1 = fPhi2 - iChannel * fPadDphi;
79 phi2 = phi1 - fPadDphi;
80 CbmMuchPad* pad = new CbmMuchPadRadial(address, r1, r2, phi1, phi2);
81 fPads.push_back(pad);
82 LOG(debug) << "iChannel=" << iChannel << " fPads.size()=" << fPads.size() << " fNChannels=" << fNChannels;
83 }
84}
85// -------------------------------------------------------------------------
86
87// -------------------------------------------------------------------------
89{
90 for (Int_t iChannel = 0; iChannel < fNChannels; iChannel++) {
91 CbmMuchPadRadial* pad = (CbmMuchPadRadial*) fPads[iChannel];
92 pad->DrawPad();
93 // pad->Draw();
94 }
95}
96// -------------------------------------------------------------------------
97
98
ClassImp(CbmConverterManager)
@ kMuchChannel
Channel.
static uint32_t SetElementId(uint32_t address, int32_t level, int32_t newId)
CbmMuchPadRadial * GetPadByPhi(Double_t phi)
Int_t GetPadIndexByPhi(Double_t phi)
CbmMuchPad * GetPadByChannelIndex(Int_t iChannel) const
std::vector< CbmMuchPad * > fPads