JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwBeamDetectorID.cc
Go to the documentation of this file.
1/*!
2 * \file QwBeamDetectorID.cc
3 * \brief Beam detector identification and mapping implementation
4 */
5
6#include "QwBeamDetectorID.h"
7
8// Qweak headers
9#include "QwVQWK_Channel.h"
10#include "QwADC18_Channel.h"
11#include "QwScaler_Channel.h"
12#include "QwBPMStripline.h"
13#include "QwQPD.h"
14#include "QwLinearDiodeArray.h"
15#include "QwBPMCavity.h"
16#include "QwMollerADC_Channel.h"
17
18//*****************************************************************
19QwBeamDetectorID::QwBeamDetectorID(Int_t subbankid, Int_t offset,
20 TString name, TString dettype,
21 TString modtype):
22 fSubbankIndex(subbankid),fWordInSubbank(offset),
23 fmoduletype(modtype),fdetectorname(name),fdetectortype(dettype),
24 fIndex(-1)
25{
27}
28
30 QwParameterFile &paramfile):
31 fSubbankIndex(subbankid), fIndex(-1)
32{
33 Int_t modnum, channum;
34 fmoduletype = paramfile.GetTypedNextToken<TString>();
35 modnum = paramfile.GetTypedNextToken<Int_t>(); //slot number
36 channum = paramfile.GetTypedNextToken<Int_t>(); //channel number
37 fdetectortype = paramfile.GetTypedNextToken<TString>(); //type-purpose of the detector
38 fChannelName = paramfile.GetTypedNextToken<TString>(); //name of the detector
39 fmoduletype.ToUpper();
40 fdetectortype.ToLower();
41 fChannelName.ToLower();
42
43 Int_t offset;
44 if (fmoduletype == "VQWK") {
46 if (paramfile.ReturnValue("vqwk_buffer_offset",offset)) {
47 fWordInSubbank += offset;
48 }
49 } else if (fmoduletype == "ADC18") {
51 if (paramfile.ReturnValue("adc18_buffer_offset",offset)) {
52 fWordInSubbank += offset;
53 }
54 } else if (fmoduletype == "SCALER") {
56 if (paramfile.ReturnValue("scaler_buffer_offset",offset)) {
57 fWordInSubbank += offset;
58 }
59 } else if (fmoduletype == "MOLLERADC") {
60 UInt_t decode_mode = 0;
61 paramfile.ReturnValue("molleradc_decode_mode", decode_mode)
62 || paramfile.ReturnValue("decode_mode", decode_mode);
64
66 if (paramfile.ReturnValue("MollerADC_buffer_offset",offset)) {
67 fWordInSubbank += offset;
68 }
69 } else {
70 fWordInSubbank = -1;
71 }
73
74 size_t namesize = fChannelName.Sizeof();
75 switch (fTypeID){
76 case kQwBPMStripline:
77 fdetectorname = fChannelName(0,namesize-3);
78 fSubelementName = fChannelName(namesize-3,2);
80 break;
81 case kQwQPD:
82 fdetectorname = fChannelName(0,namesize-3);
83 fSubelementName = fChannelName(namesize-3,2);
85 break;
86 case kQwLinearArray:
87 fdetectorname = fChannelName(0,namesize-3);
88 fSubelementName = fChannelName(namesize-3,2);
90 break;
91 case kQwBPMCavity:
94 break;
95 default:
97 fSubelementName = "";
98 fSubelement = 0;
99 break;
100 }
101}
102
116
117
119{
120 Bool_t lineok;
121 lineok = kTRUE;
122 if(fWordInSubbank<0){
123 QwError<< "QwBeamLine::LoadChannelMap: Unknown module type, "
124 << fmoduletype <<", the detector "
125 << fChannelName <<" will not be decoded "
126 << QwLog::endl;
127 lineok=kFALSE;
128 }
130 QwError << "QwBeamLine::LoadChannelMap: Unknown detector type, "
131 << fdetectortype <<", the detector "
132 << fChannelName <<" will not be decoded "
133 << QwLog::endl;
134 lineok=kFALSE;
135 }
137 QwError << "QwBeamLine::LoadChannelMap: "<< fSubelementName
138 << " was not recognized as a valid subelement for "
139 << fdetectortype << "device type (channel name=="
140 << fChannelName << ")" <<QwLog::endl;;
141 lineok=kFALSE;
142 }
143 return lineok;
144}
145
146//*****************************************************************
148{
149
150 std::cout<<std::endl<<"Detector name= "<<fdetectorname<<std::endl;
151 std::cout<<"SubbankkIndex= "<<fSubbankIndex<<std::endl;
152 std::cout<<"word index in subbank= "<<fWordInSubbank<<std::endl;
153 std::cout<<"module type= "<<fmoduletype<<std::endl;
154 std::cout<<"detector type= "<<fdetectortype<<" that is index="<<fTypeID<<std::endl;
155 std::cout<<"Index of this detector in the vector of similar detector= "<<
156 fIndex<<std::endl;
157 std::cout<<"Subelement index= "<<
158 fSubelement<<std::endl;
159 std::cout<<"---------------------------------------------------"<<std::endl;
160 std::cout<<std::endl;
161
162
163 return;
164}
Decoding and management for VQWK ADC channels (6x32-bit datawords)
static const UInt_t kInvalidSubelementIndex
Definition QwTypes.h:198
EQwBeamInstrumentType GetQwBeamInstrumentType(TString name)
Definition QwTypes.cc:34
@ kQwBPMStripline
Definition QwTypes.h:145
@ kQwLinearArray
Definition QwTypes.h:147
@ kQwQPD
Definition QwTypes.h:146
@ kQwUnknownDeviceType
Definition QwTypes.h:144
@ kQwBPMCavity
Definition QwTypes.h:153
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
Base and derived classes for scaler channel data handling.
Decoding and management for Moller ADC channels (6x32-bit datawords)
Beam detector identification and mapping class.
Quadrant photodiode beam position monitor implementation.
Cavity beam position monitor implementation.
Stripline beam position monitor implementation.
Linear diode array beam position monitor implementation.
static Int_t GetBufferOffset(Int_t moduleindex, Int_t channelindex)
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
static void SetDecodeMode(UInt_t input)
static Int_t GetBufferOffset(Int_t moduleindex, Int_t channelindex)
Configuration file parser with flexible tokenization and search capabilities.
T GetTypedNextToken()
Get next token into specific type.
Bool_t ReturnValue(const std::string keyname, T &retvalue)
static Int_t GetBufferOffset(Int_t scalerindex, Int_t wordindex, UInt_t header=1)
static Int_t GetBufferOffset(Int_t moduleindex, Int_t channelindex)
QwBeamDetectorID(Int_t subbankid, Int_t offset, TString name, TString dettype, TString modtype)
EQwBeamInstrumentType fTypeID
Bool_t ReportInitErrors() const
static Bool_t ParseChannelName(const TString &channel, TString &detname, TString &subname, UInt_t &localindex)
static UInt_t GetSubElementIndex(TString subname)
static UInt_t GetSubElementIndex(TString subname)
static UInt_t GetSubElementIndex(TString subname)
Definition QwQPD.cc:584