CbmRoot
CbmTrdParAsic.cxx
Go to the documentation of this file.
1 #include "CbmTrdParAsic.h"
2 
3 #include <FairLogger.h> // for Logger, LOG
4 
5 #include <stdio.h> // for printf
6 
7 //___________________________________________________________________
9  Int_t FebGrouping,
10  Double_t x,
11  Double_t y,
12  Double_t z,
13  std::uint64_t compId)
14  : CbmTrdParMod("CbmTrdParAsic", "TRD ASIC definition")
15  , fAddress(address)
16  , fX(x)
17  , fY(y)
18  , fZ(z)
19  , fFebGrouping(FebGrouping)
20  , fComponentId(compId)
21  , fChannelAddresses() {}
22 
23 //___________________________________________________________________
24 void CbmTrdParAsic::Print(Option_t* opt) const {
25  printf(
26  "%s @ %d pos[%5.2f %5.2f]\n", (opt ? opt : GetName()), fAddress, fX, fY);
27 }
28 
29 //___________________________________________________________________
30 Int_t CbmTrdParAsic::QueryChannel(Int_t chAddress) const {
31  Int_t ich(0);
32  for (std::vector<Int_t>::const_iterator it = fChannelAddresses.begin();
33  it != fChannelAddresses.end();
34  it++, ich++) {
35  if (chAddress == (*it)) return ich;
36  }
37  return -1;
38 }
39 
40 //___________________________________________________________________
41 void CbmTrdParAsic::SetChannelAddress(Int_t address) {
42  if (QueryChannel(address) >= 0) {
43  LOG(warn) << GetName() << "::SetChannelAddress : pad address " << address
44  << " already allocated";
45  return;
46  }
47  fChannelAddresses.push_back(address);
48 }
49 
50 //___________________________________________________________________
51 void CbmTrdParAsic::SetChannelAddresses(std::vector<Int_t> addresses) {
52  Int_t nofChannels = addresses.size();
53  if (nofChannels != GetNchannels()) {
54  LOG(warn) << GetName()
55  << "::SetChannelAddresses : input N channels:" << nofChannels
56  << "differs from definition " << GetNchannels()
57  << ". Input will be truncated.";
58  }
59  fChannelAddresses = addresses;
60 
61  // I do not see the reason for not directly copying the vector like above - PR - 03/25/2020 - The original code below contains a bug creating 63 channels...
62  // for (Int_t i = 0; i < TMath::Min(nofChannels, GetNchannels()); i++) SetChannelAddress(addresses[i]);
63  // addresses.clear();
64 }
65 
CbmTrdParAsic::SetChannelAddresses
virtual void SetChannelAddresses(std::vector< Int_t > addresses)
Definition: CbmTrdParAsic.cxx:51
CbmTrdParAsic
Definition of ASIC parameters.
Definition: CbmTrdParAsic.h:15
CbmTrdParAsic::CbmTrdParAsic
CbmTrdParAsic(Int_t address=0, Int_t FebGrouping=-1, Double_t x=0, Double_t y=0, Double_t z=0, std::uint64_t compId=0)
Definition: CbmTrdParAsic.cxx:8
CbmTrdParAsic.h
CbmTrdParAsic::Print
virtual void Print(Option_t *opt="") const
Definition: CbmTrdParAsic.cxx:24
CbmTrdParAsic::fChannelAddresses
std::vector< Int_t > fChannelAddresses
addresses of individual output channels
Definition: CbmTrdParAsic.h:77
CbmTrdParMod
Definition of generic parameters for one TRD module.
Definition: CbmTrdParMod.h:9
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmTrdParAsic::QueryChannel
virtual Int_t QueryChannel(Int_t ch) const
Query ASIC for specific pad address.
Definition: CbmTrdParAsic.cxx:30
CbmTrdParAsic::GetNchannels
virtual Int_t GetNchannels() const =0
CbmTrdParAsic::fX
Double_t fX
center of asic in global c.s. [cm]
Definition: CbmTrdParAsic.h:70
CbmTrdParAsic::fAddress
Int_t fAddress
unique ASIC ID
Definition: CbmTrdParAsic.h:69
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTrdParAsic::fY
Double_t fY
center of asic in global c.s. [cm]
Definition: CbmTrdParAsic.h:71
CbmTrdParAsic::SetChannelAddress
virtual void SetChannelAddress(Int_t address)
Definition: CbmTrdParAsic.cxx:41