QwAnalysis
QwBeamDetectorID.cc
Go to the documentation of this file.
1 /**********************************************************\
2 * File: QwBeamDetectorID.cc *
3 * *
4 * Author: *
5 * Time-stamp: *
6 \**********************************************************/
7 
8 #include "QwBeamDetectorID.h"
9 
10 // Qweak headers
11 #include "QwVQWK_Channel.h"
12 #include "QwScaler_Channel.h"
13 #include "QwBPMStripline.h"
14 #include "QwQPD.h"
15 #include "QwLinearDiodeArray.h"
16 #include "QwBPMCavity.h"
17 
18 //*****************************************************************
19 QwBeamDetectorID::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<UInt_t>(); //slot number
36  channum = paramfile.GetTypedNextToken<UInt_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  if(fmoduletype=="VQWK"){
45  } else if(fmoduletype=="SCALER") {
47  } else {
48  fWordInSubbank = -1;
49  }
50  fTypeID = GetQwBeamInstrumentType(fdetectortype);
51 
52  size_t namesize = fChannelName.Sizeof();
53  switch (fTypeID){
54  case kQwBPMStripline:
55  fdetectorname = fChannelName(0,namesize-3);
56  fSubelementName = fChannelName(namesize-3,2);
58  break;
59  case kQwQPD:
60  fdetectorname = fChannelName(0,namesize-3);
61  fSubelementName = fChannelName(namesize-3,2);
63  break;
64  case kQwLinearArray:
65  fdetectorname = fChannelName(0,namesize-3);
66  fSubelementName = fChannelName(namesize-3,2);
68  break;
69  case kQwBPMCavity:
70  fdetectorname = fChannelName(0,namesize-2);
71  fSubelementName = fChannelName(namesize-2,1);
73  break;
74  default:
76  fSubelementName = "";
77  fSubelement = 0;
78  break;
79  }
80 
81 }
82 
84 {
87  fmoduletype = input.fmoduletype;
90  fTypeID = input.fTypeID;
91  fIndex = input.fIndex;
92  fSubelement = input.fSubelement;
93  fChannelName = input.fChannelName;
95 }
96 
97 
99 {
100  Bool_t lineok;
101  lineok = kTRUE;
102  if(fWordInSubbank<0){
103  QwError<< "QwBeamLine::LoadChannelMap: Unknown module type, "
104  << fmoduletype <<", the detector "
105  << fChannelName <<" will not be decoded "
106  << QwLog::endl;
107  lineok=kFALSE;
108  }
110  QwError << "QwBeamLine::LoadChannelMap: Unknown detector type, "
111  << fdetectortype <<", the detector "
112  << fChannelName <<" will not be decoded "
113  << QwLog::endl;
114  lineok=kFALSE;
115  }
117  QwError << "QwBeamLine::LoadChannelMap: "<< fSubelementName
118  << " was not recognized as a valid subelement for "
119  << fdetectortype << "device type (channel name=="
120  << fChannelName << ")" <<QwLog::endl;;
121  lineok=kFALSE;
122  }
123  return lineok;
124 }
125 
126 //*****************************************************************
128 {
129 
130  std::cout<<std::endl<<"Detector name= "<<fdetectorname<<std::endl;
131  std::cout<<"SubbankkIndex= "<<fSubbankIndex<<std::endl;
132  std::cout<<"word index in subbank= "<<fWordInSubbank<<std::endl;
133  std::cout<<"module type= "<<fmoduletype<<std::endl;
134  std::cout<<"detector type= "<<fdetectortype<<" that is index="<<fTypeID<<std::endl;
135  std::cout<<"Index of this detector in the vector of similar detector= "<<
136  fIndex<<std::endl;
137  std::cout<<"Subelement index= "<<
138  fSubelement<<std::endl;
139  std::cout<<"---------------------------------------------------"<<std::endl;
140  std::cout<<std::endl;
141 
142 
143  return;
144 }
void Print() const
EQwBeamInstrumentType GetQwBeamInstrumentType(TString name)
Definition: QwTypes.cc:29
static UInt_t GetSubElementIndex(TString subname)
static Int_t GetBufferOffset(Int_t scalerindex, Int_t wordindex, UInt_t header=1)
Bool_t ReportInitErrors() const
static UInt_t GetSubElementIndex(TString subname)
Definition: QwBPMCavity.cc:412
static const UInt_t kInvalidSubelementIndex
Definition: QwTypes.h:191
EQwBeamInstrumentType fTypeID
static UInt_t GetSubElementIndex(TString subname)
Definition: QwQPD.cc:477
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
static UInt_t GetSubElementIndex(TString subname)
T GetTypedNextToken()
Get next token into specific type.
static Int_t GetBufferOffset(Int_t moduleindex, Int_t channelindex)
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40