43 for (
size_t i = 0; i <
fScaler.size(); i++) {
57 Int_t current_roc_id = -1;
58 Int_t current_bank_id = -1;
61 const TString default_norm_channel =
"1";
63 Name_to_Scaler_Map_t::iterator current_norm_channel =
fName_Map.find(default_norm_channel);
64 double current_norm_factor = 1;
66 std::vector<Name_to_Scaler_Map_t::iterator> norm_channel;
67 std::vector<double> norm_factor;
73 Bool_t differential =
false;
78 while (mapstr.ReadNextLine()) {
80 mapstr.TrimWhitespace();
81 if (mapstr.LineIsEmpty())
continue;
83 TString varname, varvalue;
84 if (mapstr.HasVariablePair(
"=", varname, varvalue)) {
88 if (varname ==
"roc") {
89 current_roc_id = value;
91 }
else if (varname ==
"bank") {
92 current_bank_id = value;
94 }
else if (varname ==
"norm") {
96 string dummy = mapstr.GetNextToken(
"=");
97 string channame = mapstr.GetNextToken(
"/");
98 string channorm = mapstr.GetNextToken(
"/");
103 current_norm_channel =
fName_Map.find(channame);
105 current_norm_factor = lexical_cast<
double>(channorm);
106 }
catch (boost::bad_lexical_cast&) {
107 current_norm_factor = 1;
111 }
else if (varname ==
"header") {
117 }
else if (varname ==
"differential") {
120 differential = lexical_cast<
bool>(varvalue);
121 }
catch (boost::bad_lexical_cast&) {
122 differential =
false;
133 TString modtype = mapstr.GetTypedNextToken<TString>();
134 UInt_t modnum = mapstr.GetTypedNextToken<UInt_t>();
135 UInt_t channum = mapstr.GetTypedNextToken<UInt_t>();
136 TString dettype = mapstr.GetTypedNextToken<TString>();
137 TString keyword = mapstr.GetTypedNextToken<TString>();
142 if (modtype ==
"SIS3801" || modtype ==
"SIS3801D24" || modtype ==
"SIS3801D32") {
143 offset = QwSIS3801D24_Channel::GetBufferOffset(modnum, channum, header);
144 }
else if (modtype ==
"STR7200") {
145 offset = QwSIS3801D32_Channel::GetBufferOffset(modnum, channum, header);
159 QwVerbose <<
"Registering " << modtype <<
" " << keyword
161 <<
" in ROC 0x" << current_roc_id <<
", bank 0x" << current_bank_id
163 <<
" at mod " << modnum <<
", chan " << channum
167 if (modtype ==
"SIS3801" || modtype ==
"SIS3801D24")
169 else if (modtype ==
"SIS3801D32")
171 else if (modtype ==
"STR7200")
190 norm_channel.push_back(current_norm_channel);
191 norm_factor.push_back(current_norm_factor);
197 for (Name_to_Scaler_Map_t::iterator iter =
fName_Map.begin(); iter !=
fName_Map.end(); iter++) {
198 if (iter->second == -1 && iter->first != default_norm_channel) {
205 for (
size_t i = 0; i <
fScaler.size(); i++) {
206 Int_t norm_index = norm_channel.at(i)->second;
207 if (norm_index < 0) {
209 fNorm.at(i).first = 0;
210 fNorm.at(i).second = 1;
214 fNorm.at(i).second = norm_factor.at(i);
216 fNorm.at(norm_index).first = 0;
217 fNorm.at(norm_index).second = 1;
230 while (mapstr.ReadNextLine()) {
231 mapstr.TrimComment();
232 mapstr.TrimWhitespace();
233 if (mapstr.LineIsEmpty())
continue;
235 TString varname = mapstr.GetTypedNextToken<TString>();
237 varname.Remove(TString::kBoth,
' ');
238 Double_t varped = mapstr.GetTypedNextToken<Double_t>();
239 Double_t varcal = mapstr.GetTypedNextToken<Double_t>();
244 QwMessage <<
"Parameters scaler channel " << varname <<
": "
245 <<
"ped = " << varped <<
", "
247 fScaler[index]->SetPedestal(varped);
248 fScaler[index]->SetCalibrationFactor(varcal);
263 for (
size_t i = 0; i <
fScaler.size(); i++) {
264 fScaler.at(i)->ClearEventData();
295 UInt_t words_read = 0;
300 if (subbank >= 0 && num_words > 0) {
308 for (
size_t modnum = 0; modnum <
fSubbank_Map[subbank].size(); modnum++) {
309 for (
size_t channum = 0; channum <
fSubbank_Map[subbank].at(modnum).size(); channum++) {
310 Int_t index =
fSubbank_Map[subbank].at(modnum).at(channum);
313 words_read +=
fScaler[index]->ProcessEvBuffer(&(buffer[offset]), num_words - offset);
317 words_read = num_words;
327 for (
size_t i = 0; i <
fScaler.size(); i++) {
332 for (
size_t i = 0; i <
fScaler.size(); i++) {
333 if (
fNorm.at(i).first) {
342 for(
size_t i = 0; i <
fScaler.size(); i++) {
343 fScaler.at(i)->ConstructHistograms(folder, prefix);
349 for(
size_t i = 0; i <
fScaler.size(); i++) {
350 fScaler.at(i)->FillHistograms();
356 for (
size_t i = 0; i <
fScaler.size(); i++) {
357 fScaler.at(i)->ConstructBranchAndVector(tree, prefix, values);
363 for(
size_t i = 0; i <
fScaler.size(); i++) {
364 fScaler.at(i)->FillTreeVector(values);
378 for (
size_t i = 0; i <
fScaler.size(); i++) {
394 for (
size_t i = 0; i <
fScaler.size(); i++) {
410 for (
size_t i = 0; i <
fScaler.size(); i++) {
453 for (
size_t i = 0; i <
fScaler.size(); i++) {
465 for (
size_t i = 0; i <
fScaler.size(); i++) {
530 if (value == 0)
return kFALSE;
533 Bool_t result = kTRUE;
534 if (
typeid(*value) !=
typeid(*
this)) {
555 for (
size_t i = 0; i <
fScaler.size(); i++) {
556 QwOut <<
" scaler " << i <<
": ";
566 for(
size_t i = 0; i <
fScaler.size(); i++) {
Bool_t Compare(VQwSubsystem *source)
Int_t GetSubbankIndex() const
#define QwMessage
Predefined log drain for regular messages.
std::map< TString, TString > fDetectorMaps
#define QwOut
Predefined log drain for explicit output.
Int_t LoadChannelMap(TString mapfile)
void FillTreeVector(std::vector< Double_t > &values) const
Fill the tree vector.
static UInt_t GetUInt(const TString &varvalue)
Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
void PrintErrorCounters() const
Report the number of events failed due to HW and event cut failures.
std::vector< std::pair< VQwScaler_Channel *, double > > fNorm
VQwSubsystem & operator=(VQwSubsystem *value)
#define QwVerbose
Predefined log drain for verbose messages.
Virtual base class for the parity subsystems.
class QwScaler_Channel< 0xffffffff, 0 > QwSTR7200_Channel
Int_t ProcessEvBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
Bool_t ApplySingleEventCuts()
Apply the single event cuts.
Module_Channel_to_Scaler_Map_t fModuleChannel_Map
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
void FillHistograms()
Fill the histograms for this subsystem.
virtual VQwSubsystem & operator=(VQwSubsystem *value)
Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsy...
Name_to_Scaler_Map_t fName_Map
static void DefineOptions()
Define options function (note: no virtual static functions in C++)
virtual void SetDifferentialScaler(Bool_t diff)
void IncrementErrorCounters()
Increment the error counters.
VQwSubsystem & operator+=(VQwSubsystem *value)
virtual ~QwScaler()
Destructor.
void CalculateRunningAverage()
virtual void PrintInfo() const
Print some information about the subsystem.
Int_t GetChannelIndex(TString channelName, UInt_t module_number)
UInt_t GetEventcutErrorFlag()
Return the error flag to the top level routines related to stability checks and ErrorFlag updates...
Subbank_to_Scaler_Map_t fSubbank_Map
The pure virtual base class of all subsystems.
class QwScaler_Channel< 0xffffffff, 0 > QwSIS3801D32_Channel
void Difference(VQwSubsystem *value1, VQwSubsystem *value2)
std::vector< UInt_t > fBufferOffset
class QwScaler_Channel< 0x00ffffff, 0 > QwSIS3801D24_Channel
Int_t RegisterSubbank(const UInt_t bank_id)
Tell the object that it will decode data from this sub-bank in the ROC currently open for registratio...
virtual Int_t RegisterROCNumber(const UInt_t roc_id, const UInt_t bank_id=0)
Tell the object that it will decode data from this ROC and sub-bank.
static std::ostream & endl(std::ostream &)
End of the line.
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct the branch and tree vector.
VQwSubsystem & operator-=(VQwSubsystem *value)
void Scale(Double_t factor)
void ProcessOptions(QwOptions &options)
Process the command line options.
void Ratio(VQwSubsystem *value1, VQwSubsystem *value2)
std::vector< VQwScaler_Channel * > fScaler
QwScaler()
Private default constructor (not implemented, will throw linker error on use)
Int_t LoadInputParameters(TString pedestalfile)
Mandatory parameter file definition.
void Sum(VQwSubsystem *value1, VQwSubsystem *value2)
#define RegisterSubsystemFactory(A)
#define QwError
Predefined log drain for errors.
Int_t LoadEventCuts(TString filename)
Load the event cuts file.
void AccumulateRunningSum(VQwSubsystem *value)