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") {
61 if (paramfile.ReturnValue("MollerADC_buffer_offset",offset)) {
62 fWordInSubbank += offset;
63 }
64 } else {
65 fWordInSubbank = -1;
66 }
68
69 size_t namesize = fChannelName.Sizeof();
70 switch (fTypeID){
71 case kQwBPMStripline:
72 fdetectorname = fChannelName(0,namesize-3);
73 fSubelementName = fChannelName(namesize-3,2);
75 break;
76 case kQwQPD:
77 fdetectorname = fChannelName(0,namesize-3);
78 fSubelementName = fChannelName(namesize-3,2);
80 break;
81 case kQwLinearArray:
82 fdetectorname = fChannelName(0,namesize-3);
83 fSubelementName = fChannelName(namesize-3,2);
85 break;
86 case kQwBPMCavity:
89 break;
90 default:
92 fSubelementName = "";
93 fSubelement = 0;
94 break;
95 }
96}
97
111
112
114{
115 Bool_t lineok;
116 lineok = kTRUE;
117 if(fWordInSubbank<0){
118 QwError<< "QwBeamLine::LoadChannelMap: Unknown module type, "
119 << fmoduletype <<", the detector "
120 << fChannelName <<" will not be decoded "
121 << QwLog::endl;
122 lineok=kFALSE;
123 }
125 QwError << "QwBeamLine::LoadChannelMap: Unknown detector type, "
126 << fdetectortype <<", the detector "
127 << fChannelName <<" will not be decoded "
128 << QwLog::endl;
129 lineok=kFALSE;
130 }
132 QwError << "QwBeamLine::LoadChannelMap: "<< fSubelementName
133 << " was not recognized as a valid subelement for "
134 << fdetectortype << "device type (channel name=="
135 << fChannelName << ")" <<QwLog::endl;;
136 lineok=kFALSE;
137 }
138 return lineok;
139}
140
141//*****************************************************************
143{
144
145 std::cout<<std::endl<<"Detector name= "<<fdetectorname<<std::endl;
146 std::cout<<"SubbankkIndex= "<<fSubbankIndex<<std::endl;
147 std::cout<<"word index in subbank= "<<fWordInSubbank<<std::endl;
148 std::cout<<"module type= "<<fmoduletype<<std::endl;
149 std::cout<<"detector type= "<<fdetectortype<<" that is index="<<fTypeID<<std::endl;
150 std::cout<<"Index of this detector in the vector of similar detector= "<<
151 fIndex<<std::endl;
152 std::cout<<"Subelement index= "<<
153 fSubelement<<std::endl;
154 std::cout<<"---------------------------------------------------"<<std::endl;
155 std::cout<<std::endl;
156
157
158 return;
159}
Base and derived classes for scaler channel data handling.
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
Decoding and management for Moller ADC channels (6x32-bit datawords)
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
Quadrant photodiode beam position monitor implementation.
Beam detector identification and mapping class.
Linear diode array beam position monitor implementation.
Stripline beam position monitor implementation.
Cavity 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 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