JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
VQwDetectorArray.cc
Go to the documentation of this file.
1/*!
2 * \file VQwDetectorArray.cc
3 * \brief Virtual base class implementation for detector arrays managing PMT collections
4 *
5 * Base detector array implementation managing PMT collections (integration
6 * and combined), including channel mapping, event cuts, normalization options,
7 * publishing, tree construction, and running sums. Derived classes implement
8 * specific detector systems. Documentation-only edits; runtime behavior unchanged.
9 */
10
11#include "VQwDetectorArray.h"
12
13// System headers
14#include <sstream>
15
16#ifdef HAS_RNTUPLE_SUPPORT
17// ROOT headers for RNTuple support
18#include <ROOT/RNTupleModel.hxx>
19#include <ROOT/RNTupleWriter.hxx>
20#endif
21
22// Qweak headers
23#include "QwSubsystemArray.h"
24#include "QwLog.h"
25#ifdef __USE_DATABASE__
26#include "QwParitySchema.h"
27#include "QwParityDB.h"
28#endif
29#include "QwPromptSummary.h"
30
31/**
32 * Define command-line options for detector array normalization.
33 *
34 * @param options Options object to configure.
35 */
37 // Define the execution options
38 options.AddOptions()
39 ("QwDetectorArray.normalize",
40 po::value<bool>()->default_bool_value(true),
41 "Normalize the detectors by beam current");
42
43 options.AddOptions()
44 ("QwDetectorArray.norm_threshold",
45 po::value<double>()->default_value(2.5),
46 "Normalize the detectors for currents above this value");
47}
48
49/**
50 * Load detector array configuration from parsed command-line options.
51 *
52 * @param options Options object.
53 */
55
56 bNormalization = options.GetValue<bool>("QwDetectorArray.normalize");
57
58 if (! bNormalization) {
59
60 QwWarning << "QwDetectorArray::ProcessOptions: "
61 << "Detector yields WILL NOT be normalized."
62 << QwLog::endl;
63
64 }
65
66 fNormThreshold = options.GetValue<double>("QwDetectorArray.norm_threshold");
67
68}
69
70
71//*****************************************************************//
72/**
73 * Publish internal detector channels according to the configured
74 * publish list (integration and combined PMTs).
75 *
76 * @return true if all requested channels are successfully published.
77 */
79
80 // Publish variables
81
82 Bool_t status = kTRUE;
83
84/*
85 status = status && PublishInternalValue("qwk_md1neg", "qwk_md1neg", GetIntegrationPMT("qwk_md1neg")->GetChannel("qwk_md1neg"));
86 status = status && PublishInternalValue("qwk_md1pos", "qwk_md1pos", GetIntegrationPMT("qwk_md1pos")->GetChannel("qwk_md1pos"));
87 status = status && PublishInternalValue("qwk_md2neg", "qwk_md2neg", GetIntegrationPMT("qwk_md2neg")->GetChannel("qwk_md2neg"));
88 status = status && PublishInternalValue("qwk_md2pos", "qwk_md2pos", GetIntegrationPMT("qwk_md2pos")->GetChannel("qwk_md2pos"));
89 status = status && PublishInternalValue("qwk_md3neg", "qwk_md3neg", GetIntegrationPMT("qwk_md3neg")->GetChannel("qwk_md3neg"));
90 status = status && PublishInternalValue("qwk_md3pos", "qwk_md3pos", GetIntegrationPMT("qwk_md3pos")->GetChannel("qwk_md3pos"));
91 status = status && PublishInternalValue("qwk_md4neg", "qwk_md4neg", GetIntegrationPMT("qwk_md4neg")->GetChannel("qwk_md4neg"));
92 status = status && PublishInternalValue("qwk_md4pos", "qwk_md4pos", GetIntegrationPMT("qwk_md4pos")->GetChannel("qwk_md4pos"));
93 status = status && PublishInternalValue("qwk_md5neg", "qwk_md5neg", GetIntegrationPMT("qwk_md5neg")->GetChannel("qwk_md5neg"));
94 status = status && PublishInternalValue("qwk_md5pos", "qwk_md5pos", GetIntegrationPMT("qwk_md5pos")->GetChannel("qwk_md5pos"));
95 status = status && PublishInternalValue("qwk_md6neg", "qwk_md6neg", GetIntegrationPMT("qwk_md6neg")->GetChannel("qwk_md6neg"));
96 status = status && PublishInternalValue("qwk_md6pos", "qwk_md6pos", GetIntegrationPMT("qwk_md6pos")->GetChannel("qwk_md6pos"));
97 status = status && PublishInternalValue("qwk_md7neg", "qwk_md7neg", GetIntegrationPMT("qwk_md7neg")->GetChannel("qwk_md7neg"));
98 status = status && PublishInternalValue("qwk_md7pos", "qwk_md7pos", GetIntegrationPMT("qwk_md7pos")->GetChannel("qwk_md7pos"));
99 status = status && PublishInternalValue("qwk_md8neg", "qwk_md8neg", GetIntegrationPMT("qwk_md8neg")->GetChannel("qwk_md8neg"));
100 status = status && PublishInternalValue("qwk_md8pos", "qwk_md8pos", GetIntegrationPMT("qwk_md8pos")->GetChannel("qwk_md8pos"));
101 status = status && PublishInternalValue("qwk_md9neg", "qwk_md9neg", GetIntegrationPMT("qwk_md9neg")->GetChannel("qwk_md9neg"));
102 status = status && PublishInternalValue("qwk_md9pos", "qwk_md9pos", GetIntegrationPMT("qwk_md9pos")->GetChannel("qwk_md9pos"));
103*/
104
105/*
106 status = status && PublishInternalValue("qwk_md1barsum","qwk_md1barsum", GetCombinedPMT("qwk_md1barsum")->GetChannel("qwk_md1barsum"));
107 status = status && PublishInternalValue("qwk_md2barsum","qwk_md2barsum", GetCombinedPMT("qwk_md2barsum")->GetChannel("qwk_md2barsum"));
108 status = status && PublishInternalValue("qwk_md3barsum","qwk_md3barsum", GetCombinedPMT("qwk_md3barsum")->GetChannel("qwk_md3barsum"));
109 status = status && PublishInternalValue("qwk_md4barsum","qwk_md4barsum", GetCombinedPMT("qwk_md4barsum")->GetChannel("qwk_md4barsum"));
110 status = status && PublishInternalValue("qwk_md5barsum","qwk_md5barsum", GetCombinedPMT("qwk_md5barsum")->GetChannel("qwk_md5barsum"));
111 status = status && PublishInternalValue("qwk_md6barsum","qwk_md6barsum", GetCombinedPMT("qwk_md6barsum")->GetChannel("qwk_md6barsum"));
112 status = status && PublishInternalValue("qwk_md7barsum","qwk_md7barsum", GetCombinedPMT("qwk_md7barsum")->GetChannel("qwk_md7barsum"));
113 status = status && PublishInternalValue("qwk_md8barsum","qwk_md8barsum", GetCombinedPMT("qwk_md8barsum")->GetChannel("qwk_md8barsum"));
114
115 status = status && PublishInternalValue("qwk_mdallbars","qwk_mdallbars", GetCombinedPMT("qwk_mdallbars")->GetChannel("qwk_mdallbars"));
116*/
117
118 //return status;
119
120
121 // TODO:
122 // The variables should be published based on the parameter file.
123 // See QwBeamLine class for an implementation.
124
125 // Publish variables through map file
126 // This should work with bcm, bpmstripline, bpmcavity, combo bpm and combo bcm
127
128 for (size_t pp = 0; pp < fPublishList.size(); pp++) {
129
130 TString publish_name = fPublishList.at(pp).at(0);
131 TString device_type = fPublishList.at(pp).at(1);
132 TString device_name = fPublishList.at(pp).at(2);
133 TString device_prop = fPublishList.at(pp).at(3);
134 device_type.ToLower();
135 device_prop.ToLower();
136
137 const VQwHardwareChannel* tmp_channel = NULL;
138
139 if (device_type == "integrationpmt") {
140
141 tmp_channel = GetIntegrationPMT(device_name)->GetChannel(device_name);
142
143 } else if (device_type == "combinedpmt") {
144
145 tmp_channel = GetCombinedPMT(device_name)->GetChannel(device_name);
146
147 } else {
148
149 QwError << "QwBeamLine::PublishInternalValues() error "<< QwLog::endl;
150
151 }
152
153 if (tmp_channel == NULL) {
154
155 QwError << "QwBeamLine::PublishInternalValues(): " << publish_name << " not found" << QwLog::endl;
156 status |= kFALSE;
157
158 } else {
159
160 QwDebug << "QwBeamLine::PublishInternalValues(): " << publish_name << " found" << QwLog::endl;
161
162 }
163
164 status = status && PublishInternalValue(publish_name, publish_name, tmp_channel);
165
166 }
167
168 return status;
169
170}
171
172
173/**
174 * Publish a specific device channel on-demand by name lookup.
175 *
176 * @param device_name Name of the detector channel to publish.
177 * @return true if the channel is found and published successfully.
178 */
179Bool_t VQwDetectorArray::PublishByRequest(TString device_name) {
180
181 Bool_t status = kFALSE;
182 //std::cerr << "##### device_name==\"" << device_name << "\"" << std::endl;
183
184 for(size_t i=0;i<fMainDetID.size();i++) {
185
186 //std::cerr << "fMainDetID[i].fdetectorname==\"" << fMainDetID[i].fdetectorname << "\"" << std::endl;
187
188 if(device_name.CompareTo(fMainDetID[i].fdetectorname)!=0) continue;
189
190 if (fMainDetID[i].fTypeID == kQwCombinedPMT){
191
192 status = PublishInternalValue(device_name, "published-by-request",
193 fCombinedPMT[fMainDetID[i].fIndex].GetChannel(device_name));
195 } else if (fMainDetID[i].fTypeID == kQwIntegrationPMT) {
196
197 status = PublishInternalValue(device_name, "published-by-request",
198 fIntegrationPMT[fMainDetID[i].fIndex].GetChannel(device_name));
199
200 } else {
201
202 QwError << "Unknown channel name: " << device_name << QwLog::endl;
203
204 }
205
206 break;
207
208 }
209
210 if (!status)
211 QwDebug << "VQwDetectorArray::PublishByRequest: Failed to publish channel name: " << device_name << QwLog::endl;
212
213 return status;
214
215}
216
217
218//*****************************************************************//
219/**
220 * Load detector channel map file, creating integration and combined PMTs
221 * and configuring buffer layout, saturation limits, and sample sizes.
222 *
223 * @param mapfile Path to the channel map file.
224 * @return 0 on success.
225 */
226Int_t VQwDetectorArray::LoadChannelMap(TString mapfile) {
227
228 Bool_t ldebug=kFALSE;
229
230 std::vector<TString> combinedchannelnames;
231 std::vector<Double_t> weight;
232 Int_t wordsofar=0;
233 Int_t currentsubbankindex=-1;
234 Int_t sample_size=0;
235 Double_t abs_saturation_limit = 8.5; // default saturation limit(volt)
236 Bool_t bAssignedLimit = kFALSE;
237
238 // Open the file
239 QwParameterFile mapstr(mapfile.Data());
240 TString varname, varvalue;
241
243 mapstr.EnableGreediness();
244 mapstr.SetCommentChars("!");
245
246 UInt_t value;
247 size_t vqwk_buffer_offset = 0;
248
249 while (mapstr.ReadNextLine()) {
250
251 RegisterRocBankMarker(mapstr);
252 if (mapstr.PopValue("abs_saturation_limit",value)) {
253 abs_saturation_limit=value;
254 bAssignedLimit = kTRUE;
255 }
256
257 if (mapstr.PopValue("sample_size",value)) {
258 sample_size=value;
259 }
260
261 if (mapstr.PopValue("vqwk_buffer_offset",value)) {
262 vqwk_buffer_offset=value;
263 }
264
265 mapstr.TrimComment('!'); // Remove everything after a '!' character.
266 mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
267
268 if (mapstr.LineIsEmpty()) continue;
269
270 Bool_t lineok = kTRUE;
271 TString keyword = "";
272 TString keyword2 = "";
273 TString modtype = "";
274 TString dettype = "";
275 TString namech = "";
276 Int_t modnum = 0;
277 Int_t channum = 0;
278
279 modtype = mapstr.GetTypedNextToken<TString>(); // module type
280
281 modtype.ToUpper();
282
283 if (modtype == "VPMT") {
284
285 channum = mapstr.GetTypedNextToken<Int_t>(); //channel number
286 Int_t combinedchans = mapstr.GetTypedNextToken<Int_t>(); //number of combined channels
287 dettype = mapstr.GetTypedNextToken<TString>(); //type-purpose of the detector
288 dettype.ToLower();
289 namech = mapstr.GetTypedNextToken<TString>(); //name of the detector
290 namech.ToLower();
291 combinedchannelnames.clear();
292
293 for (int i=0; i<combinedchans; i++){
294
295 TString nameofcombinedchan = mapstr.GetTypedNextToken<TString>();
296 nameofcombinedchan.ToLower();
297 combinedchannelnames.push_back(nameofcombinedchan);
298 }
299
300 weight.clear();
301
302 for (int i=0; i<combinedchans; i++) {
303
304 weight.push_back( mapstr.GetTypedNextToken<Double_t>());
305 }
306
307 keyword = mapstr.GetTypedNextToken<TString>();
308 keyword.ToLower();
309 keyword2 = mapstr.GetTypedNextToken<TString>();
310 keyword2.ToLower();
311
312 } else {
313
314 modnum = mapstr.GetTypedNextToken<Int_t>(); //slot number
315 channum = mapstr.GetTypedNextToken<Int_t>(); //channel number
316 dettype = mapstr.GetTypedNextToken<TString>(); //type-purpose of the detector
317 dettype.ToLower();
318 namech = mapstr.GetTypedNextToken<TString>(); //name of the detector
319 namech.ToLower();
320
321 keyword = mapstr.GetTypedNextToken<TString>();
322 keyword.ToLower();
323 keyword2 = mapstr.GetTypedNextToken<TString>();
324 keyword2.ToLower();
325 }
326
327
328 if (currentsubbankindex!=GetSubbankIndex(fCurrentROC_ID,fCurrentBank_ID)) {
329
331 wordsofar=0;
332 }
333
334 QwDetectorArrayID localMainDetID;
335 localMainDetID.fdetectorname=namech;
336 localMainDetID.fmoduletype=modtype;
337 localMainDetID.fSubbankIndex=currentsubbankindex;
338 localMainDetID.fdetectortype=dettype;
339
340 //localMainDetID.fWordInSubbank=wordsofar;
341
342 if (modtype=="MOLLERADC") {
343
344 UInt_t decode_mode = 0;
345 mapstr.ReturnValue("molleradc_decode_mode", decode_mode)
346 || mapstr.ReturnValue("decode_mode", decode_mode);
348
349 Int_t offset = QwMollerADC_Channel::GetBufferOffset(modnum, channum)+vqwk_buffer_offset;
350
351 if (offset>=0){
352
353 localMainDetID.fWordInSubbank = wordsofar + offset;
354 }
355
356 } else if (modtype=="VPMT") {
357
358 localMainDetID.fCombinedChannelNames = combinedchannelnames;
359 localMainDetID.fWeight = weight;
360
361 //std::cout<<"Add in a combined channel"<<std::endl;
362 } else {
363
364 QwError << "VQwDetectorArray::LoadChannelMap: Unknown module type: "
365 << modtype <<", the detector "<<namech<<" will not be decoded "
366 << QwLog::endl;
367 lineok=kFALSE;
368 continue;
369 }
370
371 localMainDetID.fTypeID=GetDetectorTypeID(dettype);
372
373 if (localMainDetID.fTypeID==kQwUnknownPMT) {
374
375 QwError << "VQwDetectorArray::LoadChannelMap: Unknown detector type: "
376 << dettype <<", the detector "<<namech<<" will not be decoded "
377 << QwLog::endl;
378 lineok=kFALSE;
379 continue;
380 }
381
382 localMainDetID.fIndex= GetDetectorIndex(localMainDetID.fTypeID,
383 localMainDetID.fdetectorname);
384
385 if (localMainDetID.fIndex==-1){
386
387 if (localMainDetID.fTypeID==kQwIntegrationPMT){
388
389 QwIntegrationPMT localIntegrationPMT(GetName(),localMainDetID.fdetectorname);
390
391 if (keyword=="not_blindable" || keyword2=="not_blindable")
392 localIntegrationPMT.SetBlindability(kFALSE);
393
394 else
395 localIntegrationPMT.SetBlindability(kTRUE);
396
397 if (keyword=="not_normalizable" || keyword2=="not_normalizable")
398 localIntegrationPMT.SetNormalizability(kFALSE);
399
400 else
401 localIntegrationPMT.SetNormalizability(kTRUE);
402
403 fIntegrationPMT.push_back(localIntegrationPMT);
404 fIntegrationPMT[fIntegrationPMT.size()-1].SetDefaultSampleSize(sample_size);
405
406 if(bAssignedLimit)
407 fIntegrationPMT[fIntegrationPMT.size()-1].SetSaturationLimit(abs_saturation_limit);
408
409 localMainDetID.fIndex=fIntegrationPMT.size()-1;
410
411 } else if (localMainDetID.fTypeID==kQwCombinedPMT) {
412
413 QwCombinedPMT localcombinedPMT(GetName(),localMainDetID.fdetectorname);
414
415 if (keyword=="not_normalizable" || keyword2=="not_normalizable")
416 localcombinedPMT.SetNormalizability(kFALSE);
417
418 else
419 localcombinedPMT.SetNormalizability(kTRUE);
420
421 if (keyword=="not_blindable" || keyword2 =="not_blindable")
422 localcombinedPMT.SetBlindability(kFALSE);
423
424 else
425 localcombinedPMT.SetBlindability(kTRUE);
426
427 fCombinedPMT.push_back(localcombinedPMT);
428 fCombinedPMT[fCombinedPMT.size()-1].SetDefaultSampleSize(sample_size);
429 localMainDetID.fIndex=fCombinedPMT.size()-1;
430 }
431 }
432
433 if (ldebug) {
434
435 localMainDetID.Print();
436 std::cout<<"line ok=";
437
438 if (lineok)
439 std::cout<<"TRUE"<<std::endl;
440
441 else
442 std::cout<<"FALSE"<<std::endl;
443 }
444
445 if (lineok)
446 fMainDetID.push_back(localMainDetID);
447
448 } // End of "while (mapstr.ReadNextLine())"
449
450 for (size_t i=0; i<fMainDetID.size(); i++) {
451
452 if (fMainDetID[i].fTypeID==kQwCombinedPMT) {
453
454 Int_t ind = fMainDetID[i].fIndex;
455
456 //check to see if all required channels are available
457 if (ldebug) {
458
459 std::cout<<"fMainDetID[i].fCombinedChannelNames.size()="
460 <<fMainDetID[i].fCombinedChannelNames.size()<<std::endl<<"name list: ";
461
462 for (size_t n=0; n<fMainDetID[i].fCombinedChannelNames.size(); n++)
463 std::cout<<" "<<fMainDetID[i].fCombinedChannelNames[n];
464
465 std::cout<<std::endl;
466 }
467
468 Int_t chanmatched=0;
469
470 for (size_t j=0; j<fMainDetID[i].fCombinedChannelNames.size(); j++) {
471
472 for (size_t k=0; k<fMainDetID.size(); k++) {
473
474 if (fMainDetID[i].fCombinedChannelNames[j]==fMainDetID[k].fdetectorname) {
475
476 if (ldebug)
477 std::cout<<"found a to-be-combined channel candidate"<<std::endl;
478
479 chanmatched ++;
480 break;
481 }
482 }
483 }
484
485 if ((Int_t) fMainDetID[i].fCombinedChannelNames.size()==chanmatched) {
486
487 for (size_t l=0; l<fMainDetID[i].fCombinedChannelNames.size(); l++) {
488
489 Int_t ind_pmt = GetDetectorIndex(GetDetectorTypeID("integrationpmt"),
490 fMainDetID[i].fCombinedChannelNames[l]);
491
492 fCombinedPMT[ind].Add(&fIntegrationPMT[ind_pmt],fMainDetID[i].fWeight[l]);
493 }
494
495 fCombinedPMT[ind].LinkChannel(fMainDetID[i].fdetectorname);
496
497 if (ldebug)
498 std::cout<<"linked a combined channel"<<std::endl;
499 } else {
500
501 std::cerr<<"cannot combine void channels for "<<fMainDetID[i].fdetectorname<<std::endl;
502 fMainDetID[i].fIndex = -1;
503 continue;
504 }
505 }
506 }
507
508
509 // Now load the variables to publish
510 mapstr.RewindToFileStart();
511 std::unique_ptr<QwParameterFile> section;
512 std::vector<TString> publishinfo;
513 while ((section = mapstr.ReadNextSection(varvalue))) {
514
515 if (varvalue == "PUBLISH") {
516
517 fPublishList.clear();
518
519 while (section->ReadNextLine()) {
520
521 section->TrimComment(); // Remove everything after a comment character
522 section->TrimWhitespace(); // Get rid of leading and trailing spaces
523
524 for (int ii = 0; ii < 4; ii++) {
525
526 varvalue = section->GetNextToken().c_str();
527
528 if (varvalue.Length()) {
529
530 publishinfo.push_back(varvalue);
531 }
532 }
533
534 if (publishinfo.size() == 4)
535 fPublishList.push_back(publishinfo);
536
537 publishinfo.clear();
538 }
539 }
540 }
541
542 // Print list of variables to publish
543 if (fPublishList.size()>0){
544
545 QwMessage << "Variables to publish:" << QwLog::endl;
546
547 for (size_t jj = 0; jj < fPublishList.size(); jj++)
548 QwMessage << fPublishList.at(jj).at(0) << " " << fPublishList.at(jj).at(1) << " "
549 << fPublishList.at(jj).at(2) << " " << fPublishList.at(jj).at(3) << QwLog::endl;
550 }
551
552 if (ldebug) {
553
554 std::cout<<"Done with Load channel map\n";
555
556 for (size_t i=0;i<fMainDetID.size();i++)
557 if (fMainDetID[i].fIndex>=0)
558 fMainDetID[i].Print();
559 }
560
561 ldebug=kFALSE;
562 mapstr.Close(); // Close the file (ifstream)
563 return 0;
564}
565
566void VQwDetectorArray::LoadEventCuts_Line(QwParameterFile &mapstr, TString &varvalue, Int_t &eventcut_flag) {
567 TString device_type = mapstr.GetTypedNextToken<TString>();
568 device_type.ToLower();
569 TString device_name = mapstr.GetTypedNextToken<TString>();
570 device_name.ToLower();
571
572 Int_t det_index = GetDetectorIndex(GetDetectorTypeID(device_type),device_name);
573 if (det_index == -1) {
574 QwWarning << " Device not found " << device_name << " of type " << device_type << QwLog::endl;
575 //continue;
576 }
577
578 Double_t LLX = mapstr.GetTypedNextToken<Double_t>(); //lower limit for IntegrationPMT value
579 Double_t ULX = mapstr.GetTypedNextToken<Double_t>(); //upper limit for IntegrationPMT value
580 varvalue = mapstr.GetTypedNextToken<TString>();//global/local
581 varvalue.ToLower();
582
583 Double_t burplevel = mapstr.GetTypedNextToken<Double_t>();
584 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
585
587 QwMessage << "VQwDetectorArray Error Code passing to QwIntegrationPMT " << GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut) << QwLog::endl;
588 fIntegrationPMT[det_index].SetSingleEventCuts(GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut),LLX,ULX,stabilitycut,burplevel);
589 } else if (device_type == GetQwPMTInstrumentTypeName(kQwCombinedPMT)){
590 QwMessage << "VQwDetectorArray Error Code passing to QwCombinedPMT " << GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut) << QwLog::endl;
591 fCombinedPMT[det_index].SetSingleEventCuts(GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut),LLX,ULX,stabilitycut,burplevel);
592 }
593}
594
595void VQwDetectorArray::LoadEventCuts_Fin(Int_t &eventcut_flag) {
596 for (size_t i = 0; i < fIntegrationPMT.size(); i++)
597 fIntegrationPMT[i].SetEventCutMode(eventcut_flag);
598 for (size_t i = 0; i < fCombinedPMT.size(); i++)
599 fCombinedPMT[i].SetEventCutMode(eventcut_flag);
600
601 fMainDetErrorCount = 0;//set the error counter to zero
602}
603
604
605
606Int_t VQwDetectorArray::LoadInputParameters(TString pedestalfile) {
607
608 Bool_t ldebug=kFALSE;
609 TString varname;
610 Double_t varped;
611 Double_t varcal;
612
613 // Double_t varbaserate;
614 Double_t varnormrate;
615 Double_t varvoltperhz;
616 Double_t varasym;
617 Double_t varcx;
618 Double_t varcy;
619 Double_t varcxp;
620 Double_t varcyp;
621 Double_t varce;
622
623 TString localname;
624
625 Int_t lineread=0;
626
627 QwParameterFile mapstr(pedestalfile.Data()); //Open the file
629
630 while (mapstr.ReadNextLine()) {
631
632 lineread+=1;
633 if (ldebug)std::cout<<" line read so far ="<<lineread<<"\n";
634 mapstr.TrimComment('!'); // Remove everything after a '!' character.
635
636 mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
637
638 if (mapstr.LineIsEmpty()) continue;
639
640 else {
641 varname = mapstr.GetTypedNextToken<TString>(); //name of the channel
642 varname.ToLower();
643 varname.Remove(TString::kBoth,' ');
644 varped = mapstr.GetTypedNextToken<Double_t>(); // value of the pedestal
645 varcal = mapstr.GetTypedNextToken<Double_t>(); // value of the calibration factor
646
647
648
649
650 if (ldebug)
651 std::cout << "Inputs for channel " << varname << ": ped=" << varped << ": cal=" << varcal << "\n"
652 << ": varnormrate=" << varnormrate << "\n"
653 << ": varvoltperhz=" << varvoltperhz << "\n"
654 << ": asym=" << varasym << "\n"
655 << ": C_x=" << varcx << ": C_y=" << varcy << "\n"
656 << ": C_xp=" << varcxp << ": C_yp=" << varcyp << "\n"
657 << ": C_e=" << varce << "\n";
658
659 // Bool_t notfound=kTRUE;
660
661 // if (notfound)
662 for (size_t i=0;i<fIntegrationPMT.size();i++){
663 if (fIntegrationPMT[i].GetElementName()==varname) {
664
665 fIntegrationPMT[i].SetPedestal(varped);
666 fIntegrationPMT[i].SetCalibrationFactor(varcal);
667
668
669
670 // i=fIntegrationPMT.size()+1;
671 // notfound=kFALSE;
672 // i=fIntegrationPMT.size()+1;
673
674 break;
675
676 }
677 }
678
679 }
680
681 }
682
683 if (ldebug)
684 std::cout<<" line read in the pedestal + cal file ="<<lineread<<" \n";
685
686 ldebug=kFALSE;
687 mapstr.Close(); // Close the file (ifstream)
688 return 0;
689
690}
691
692
693
694
695
696
697
698
699
701
702 Bool_t ldebug=kFALSE;
703 TString varname;
704 Double_t varped;
705 Double_t varcal;
706
707 // Double_t varbaserate;
708 Double_t varnormrate;
709 Double_t varvoltperhz;
710 Double_t varasym;
711 Double_t varcx;
712 Double_t varcy;
713 Double_t varcxp;
714 Double_t varcyp;
715 Double_t varce;
716
717 TString localname;
718
719 Int_t lineread=0;
720
721 QwParameterFile mapstr(pedestalfile.Data()); //Open the file
723
724 while (mapstr.ReadNextLine()) {
725
726 lineread+=1;
727 if (ldebug)std::cout<<" line read so far ="<<lineread<<"\n";
728 mapstr.TrimComment('!'); // Remove everything after a '!' character.
729
730 mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
731
732 if (mapstr.LineIsEmpty()) continue;
733
734 else {
735 varname = mapstr.GetTypedNextToken<TString>(); //name of the channel
736 varname.ToLower();
737 varname.Remove(TString::kBoth,' ');
738
739
740 varnormrate = mapstr.GetTypedNextToken<Double_t>(); // value of the NormRate
741 varvoltperhz = mapstr.GetTypedNextToken<Double_t>(); // value of the VoltPerHz
742 varasym = mapstr.GetTypedNextToken<Double_t>(); // value of the asymmetry
743 varcx = mapstr.GetTypedNextToken<Double_t>(); // value of the coefficient C_x
744 varcy = mapstr.GetTypedNextToken<Double_t>(); // value of the coefficient C_y
745 varcxp = mapstr.GetTypedNextToken<Double_t>(); // value of the coefficient C_xp
746 varcyp = mapstr.GetTypedNextToken<Double_t>(); // value of the coefficient C_yp
747 varce = mapstr.GetTypedNextToken<Double_t>(); // value of the coefficient C_e
748
749
750 if (ldebug)
751 std::cout << "Inputs for channel " << varname << ": ped=" << varped << ": cal=" << varcal << "\n"
752 << ": varnormrate=" << varnormrate << "\n"
753 << ": varvoltperhz=" << varvoltperhz << "\n"
754 << ": asym=" << varasym << "\n"
755 << ": C_x=" << varcx << ": C_y=" << varcy << "\n"
756 << ": C_xp=" << varcxp << ": C_yp=" << varcyp << "\n"
757 << ": C_e=" << varce << "\n";
758
759 // Bool_t notfound=kTRUE;
760
761 // if (notfound)
762 for (size_t i=0;i<fIntegrationPMT.size();i++){
763 if (fIntegrationPMT[i].GetElementName()==varname) {
764
765
766 fIntegrationPMT[i].SetNormRate(varnormrate);
767 fIntegrationPMT[i].SetVoltPerHz(varvoltperhz);
768 fIntegrationPMT[i].SetAsymmetry(varasym);
769 fIntegrationPMT[i].SetCoefficientCx(varcx);
770 fIntegrationPMT[i].SetCoefficientCy(varcy);
771 fIntegrationPMT[i].SetCoefficientCxp(varcxp);
772 fIntegrationPMT[i].SetCoefficientCyp(varcyp);
773 fIntegrationPMT[i].SetCoefficientCe(varce);
774
775 // i=fIntegrationPMT.size()+1;
776 // notfound=kFALSE;
777 // i=fIntegrationPMT.size()+1;
778
779 break;
780
781 }
782 }
783
784 }
785
786 }
787
788 if (ldebug)
789 std::cout<<" line read in the pedestal + cal file ="<<lineread<<" \n";
790
791 ldebug=kFALSE;
792 mapstr.Close(); // Close the file (ifstream)
793
794}
795
796
797
798
799
800
801
802
803
804
805
806
808
809 Bool_t test=kTRUE;
810 return test;
811
812}
813
815
816 for (size_t i=0;i<fIntegrationPMT.size();i++){
817
818 fIntegrationPMT[i].ClearEventData();
819
820 }
821
822 for (size_t i=0;i<fCombinedPMT.size();i++)
824
825 return;
826
827}
828
829
830/********************************************************/
831
832void VQwDetectorArray::SetRandomEventParameters(Double_t mean, Double_t sigma) {
833
834 for (size_t i = 0; i < fMainDetID.size(); i++) {
835
836 // This is a QwIntegrationPMT
837 if (fMainDetID.at(i).fTypeID == kQwIntegrationPMT)
838 fIntegrationPMT[fMainDetID.at(i).fIndex].SetRandomEventParameters(mean, sigma);
839
840 }
841
842}
843
845
846 for (size_t i = 0; i < fMainDetID.size(); i++) {
847
848 // This is a QwIntegrationPMT
849 if (fMainDetID.at(i).fTypeID == kQwIntegrationPMT)
850 fIntegrationPMT[fMainDetID.at(i).fIndex].SetRandomEventAsymmetry(asymmetry);
851
852 }
853
854}
855
856void VQwDetectorArray::RandomizeEventData(int helicity, double time) {
857
858 for (size_t i = 0; i < fMainDetID.size(); i++) {
859
860 // This is a QwIntegrationPMT
861 if (fMainDetID.at(i).fTypeID == kQwIntegrationPMT)
862 fIntegrationPMT[fMainDetID.at(i).fIndex].RandomizeEventData(helicity, time);
863
864 }
865
866}
867
868void VQwDetectorArray::EncodeEventData(std::vector<UInt_t> &buffer) {
869
870 std::vector<UInt_t> elements;
871 elements.clear();
872
873 // Get all buffers in the order they are defined in the map file
874 for (size_t i = 0; i < fMainDetID.size(); i++) {
875
876 // This is a QwIntegrationPMT
877 if (fMainDetID.at(i).fTypeID == kQwIntegrationPMT)
878 fIntegrationPMT[fMainDetID.at(i).fIndex].EncodeEventData(elements);
879
880 }
881
882
883 // If there is element data, generate the subbank header
884 std::vector<UInt_t> subbankheader;
885 std::vector<UInt_t> rocheader;
886
887 if (elements.size() > 0) {
888
889 // Form CODA subbank header
890 subbankheader.clear();
891 subbankheader.push_back(elements.size() + 1); // subbank size
892 subbankheader.push_back((fCurrentBank_ID << 16) | (0x01 << 8) | (1 & 0xff));
893 // subbank tag | subbank type | event number
894
895 // Form CODA bank/roc header
896 rocheader.clear();
897 rocheader.push_back(subbankheader.size() + elements.size() + 1); // bank/roc size
898 rocheader.push_back((fCurrentROC_ID << 16) | (0x10 << 8) | (1 & 0xff));
899 // bank tag == ROC | bank type | event number
900
901 // Add bank header, subbank header and element data to output buffer
902 buffer.insert(buffer.end(), rocheader.begin(), rocheader.end());
903 buffer.insert(buffer.end(), subbankheader.begin(), subbankheader.end());
904 buffer.insert(buffer.end(), elements.begin(), elements.end());
905
906 }
907
908}
909
910void VQwDetectorArray::RandomizeMollerEvent(int helicity /*, const QwBeamCharge& charge, const QwBeamPosition& xpos, const QwBeamPosition& ypos, const QwBeamAngle& xprime, const QwBeamAngle& yprime, const QwBeamEnergy& energy*/) {
911
912 /* fTargetCharge.PrintInfo();
913 fTargetX.PrintInfo();
914 fTargetY.PrintInfo();
915 fTargetXprime.PrintInfo();
916 fTargetYprime.PrintInfo();
917 fTargetEnergy.PrintInfo();*/
918
919 if(RequestExternalValue("x_targ", &fTargetX)){
920
921 if (bDEBUG){
922
923 dynamic_cast<QwMollerADC_Channel*>(&fTargetX)->PrintInfo();
924 QwWarning << "VQwDetectorArray::RandomizeMollerEvent Found "<<fTargetX.GetElementName()<< QwLog::endl;
925 }
926
927 }else{
928
929 bIsExchangedDataValid = kFALSE;
930 QwError << GetName() << " could not get external value for "
931 << fTargetX.GetElementName() << QwLog::endl;
932
933 }
934
935 if(RequestExternalValue("y_targ", &fTargetY)){
936
937 if (bDEBUG){
938 dynamic_cast<QwMollerADC_Channel*>(&fTargetY)->PrintInfo();
939 QwWarning << "VQwDetectorArray::RandomizeMollerEvent Found "<<fTargetY.GetElementName()<< QwLog::endl;
940 }
941
942 }else{
943
944 bIsExchangedDataValid = kFALSE;
945 QwError << GetName() << " could not get external value for "
946 << fTargetY.GetElementName() << QwLog::endl;
947 }
948
949 if(RequestExternalValue("xp_targ", &fTargetXprime)){
950
951 if (bDEBUG){
952
953 dynamic_cast<QwMollerADC_Channel*>(&fTargetXprime)->PrintInfo();
954 QwWarning << "VQwDetectorArray::RandomizeMollerEvent Found "<<fTargetXprime.GetElementName()<< QwLog::endl;
955 }
956
957 }else{
958
959 bIsExchangedDataValid = kFALSE;
960 QwError << GetName() << " could not get external value for "
961 << fTargetXprime.GetElementName() << QwLog::endl;
962
963 }
964
965 if(RequestExternalValue("yp_targ", &fTargetYprime)){
966
967 if (bDEBUG){
968
969 dynamic_cast<QwMollerADC_Channel*>(&fTargetYprime)->PrintInfo();
970 QwWarning << "VQwDetectorArray::RandomizeMollerEvent Found "<<fTargetYprime.GetElementName()<< QwLog::endl;
971
972 }
973
974 }else{
975
976 bIsExchangedDataValid = kFALSE;
977 QwError << GetName() << " could not get external value for "
978 << fTargetYprime.GetElementName() << QwLog::endl;
979
980 }
981
982 if(RequestExternalValue("e_targ", &fTargetEnergy)){
983
984 if (bDEBUG){
985
986 dynamic_cast<QwMollerADC_Channel*>(&fTargetEnergy)->PrintInfo();
987 QwWarning << "VQwDetectorArray::RandomizeMollerEvent Found "<<fTargetEnergy.GetElementName()<< QwLog::endl;
988
989 }
990
991 }else{
992
993 bIsExchangedDataValid = kFALSE;
994 QwError << GetName() << " could not get external value for "
995 << fTargetEnergy.GetElementName() << QwLog::endl;
996
997 }
998
999 for (size_t i = 0; i < fMainDetID.size(); i++) {
1000
1002 //fIntegrationPMT[i].PrintInfo();
1003
1004 }
1005
1006}
1007
1008Int_t VQwDetectorArray::ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) {
1009
1010 /* Int_t index = GetSubbankIndex(roc_id,bank_id);
1011 if (index>=0 && num_words>0){
1012 // We want to process the configuration data for this ROC.
1013 UInt_t words_read = 0;
1014 for (size_t i = 0; i < fMainDetID.size(); i++) {
1015 words_read += fIntegrationPMT[i].ProcessConfigurationBuffer(&(buffer[words_read]),
1016 num_words-words_read);
1017 }
1018 }*/
1019 return 0;
1020
1021}
1022
1023
1024Int_t VQwDetectorArray::ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) {
1025
1026 Bool_t lkDEBUG=kFALSE;
1027
1028 Int_t index = GetSubbankIndex(roc_id,bank_id);
1029
1030 if (index>=0 && num_words>0) {
1031
1032 // We want to process this ROC. Begin looping through the data.
1033 if (lkDEBUG)
1034 std::cout << "VQwDetectorArray::ProcessEvBuffer: "
1035 << "Begin processing ROC" << roc_id
1036 << " and subbank "<<bank_id
1037 << " number of words="<<num_words<<std::endl;
1038
1039 for (size_t i=0;i<fMainDetID.size();i++) {
1040
1041 if (fMainDetID[i].fSubbankIndex==index) {
1042
1043 if (fMainDetID[i].fTypeID == kQwIntegrationPMT) {
1044
1045 if (lkDEBUG) {
1046
1047 std::cout<<"found IntegrationPMT data for "<<fMainDetID[i].fdetectorname<<std::endl;
1048 std::cout<<"word left to read in this buffer:"<<num_words-fMainDetID[i].fWordInSubbank<<std::endl;
1049
1050 }
1051
1052 fIntegrationPMT[fMainDetID[i].fIndex].ProcessEvBuffer(&(buffer[fMainDetID[i].fWordInSubbank]),
1053 num_words-fMainDetID[i].fWordInSubbank);
1054
1055 }
1056
1057 }
1058
1059 }
1060
1061 }
1062
1063 return 0;
1064
1065}
1066
1067
1068
1070
1071 Bool_t status=kTRUE;
1072 for(size_t i=0;i<fIntegrationPMT.size();i++){
1073
1074 status &= fIntegrationPMT[i].ApplySingleEventCuts();
1075 if(!status && bDEBUG)
1076 std::cout<<"******* VQwDetectorArray::SingleEventCuts()->IntegrationPMT[ "<<i<<" , "<<fIntegrationPMT[i].GetElementName()<<" ] ******\n";
1077 }
1078
1079 for(size_t i=0;i<fCombinedPMT.size();i++){
1080
1081 status &= fCombinedPMT[i].ApplySingleEventCuts();
1082 if(!status && bDEBUG)
1083 std::cout<<"******* VQwDetectorArray::SingleEventCuts()->CombinedPMT[ "<<i<<" , "<<fCombinedPMT[i].GetElementName()<<" ] ******\n";
1084 }
1085
1086 if (!status)
1087 fMainDetErrorCount++; //failed event counter for VQwDetectorArray
1088
1089 return status;
1090}
1091
1092
1093UInt_t VQwDetectorArray::GetEventcutErrorFlag() { //return the error flag
1094
1095 UInt_t ErrorFlag;
1096
1097 ErrorFlag=0;
1098
1099 for(size_t i=0;i<fIntegrationPMT.size();i++){
1100
1101 ErrorFlag |= fIntegrationPMT[i].GetEventcutErrorFlag();
1102
1103 }
1104
1105 for(size_t i=0;i<fCombinedPMT.size();i++){
1106
1107 ErrorFlag |= fCombinedPMT[i].GetEventcutErrorFlag();
1108
1109 }
1110
1111 return ErrorFlag;
1112
1113}
1114
1116
1117 for(size_t i=0;i<fIntegrationPMT.size();i++){
1118
1119 fIntegrationPMT[i].IncrementErrorCounters();
1120
1121 }
1122
1123 for(size_t i=0;i<fCombinedPMT.size();i++){
1124
1125 fCombinedPMT[i].IncrementErrorCounters();
1126
1127 }
1128
1129}
1130
1131//inherited from the VQwSubsystemParity; this will display the error summary
1133
1134 QwMessage<<"*********VQwDetectorArray Error Summary****************"<<QwLog::endl;
1136
1137 for(size_t i=0;i<fIntegrationPMT.size();i++){
1138
1139 //std::cout<<" IntegrationPMT ["<<i<<"] "<<std::endl;
1140 fIntegrationPMT[i].PrintErrorCounters();
1141
1142 }
1143
1144 for(size_t i=0;i<fCombinedPMT.size();i++){
1145
1146 //std::cout<<" CombinedPMT ["<<i<<"] "<<std::endl;
1147 fCombinedPMT[i].PrintErrorCounters();
1148
1149 }
1150
1152
1153}
1154
1156
1157 Bool_t burpstatus = kFALSE;
1158 VQwSubsystem* tmp = const_cast<VQwSubsystem *>(subsys);
1159
1160 if(Compare(tmp)) {
1161
1162 const VQwDetectorArray* input = dynamic_cast<const VQwDetectorArray*>(subsys);
1163
1164 for(size_t i=0;i<input->fIntegrationPMT.size();i++)
1165 burpstatus |= (this->fIntegrationPMT[i]).CheckForBurpFail(&(input->fIntegrationPMT[i]));
1166
1167 for(size_t i=0;i<input->fCombinedPMT.size();i++)
1168 burpstatus |= (this->fCombinedPMT[i]).CheckForBurpFail(&(input->fCombinedPMT[i]));
1169
1170 }
1171
1172 return burpstatus;
1173
1174}
1175
1176
1178
1179 VQwSubsystem* tmp = const_cast<VQwSubsystem*>(ev_error);
1180
1181 if(Compare(tmp)){
1182
1183 const VQwDetectorArray* input = dynamic_cast<const VQwDetectorArray*> (ev_error);
1184
1185 for (size_t i=0;i<input->fIntegrationPMT.size();i++)
1186 this->fIntegrationPMT[i].UpdateErrorFlag(&(input->fIntegrationPMT[i]));
1187
1188 for (size_t i=0;i<input->fCombinedPMT.size();i++)
1189 this->fCombinedPMT[i].UpdateErrorFlag(&(input->fCombinedPMT[i]));
1190
1191 }
1192
1193}
1194
1195
1197
1198 for (size_t i=0;i<fIntegrationPMT.size();i++)
1200
1201 for (size_t i=0;i<fCombinedPMT.size();i++) {
1202
1203 //std::cout<<"Process combination "<<i<<std::endl;
1204 fCombinedPMT[i].ProcessEvent();
1205
1206 }
1207
1208 return;
1209
1210}
1211
1212/**
1213 * Exchange data between subsystems
1214 */
1215
1217
1218 //QwWarning << "VQwDetectorArray::ExchangeProcessedData "<< QwLog::endl;
1219 bIsExchangedDataValid = kTRUE;
1220
1221 if (1==1 || bNormalization) {
1222
1223 if(RequestExternalValue("q_targ", &fTargetCharge)) {
1224
1225 if (bDEBUG) {
1226
1227 QwWarning << "VQwDetectorArray::ExchangeProcessedData Found "<<fTargetCharge.GetElementName()<< QwLog::endl;
1228 //QwWarning <<"****VQwDetectorArray****"<< QwLog::endl;
1229 (dynamic_cast<QwMollerADC_Channel*>(&fTargetCharge))->PrintInfo();
1230
1231 }
1232
1233 } else {
1234
1235 bIsExchangedDataValid = kFALSE;
1236 QwError << GetName() << " could not get external value for "
1237 << fTargetCharge.GetElementName() << QwLog::endl;
1238
1239 }
1240
1241 }
1242
1243}
1244
1245
1247
1249
1250 //data is valid, process it
1251
1252 if (bDEBUG) {
1253
1254 Double_t pedestal = fTargetCharge.GetPedestal();
1255 Double_t calfactor = fTargetCharge.GetCalibrationFactor();
1256 Double_t volts = fTargetCharge.GetAverageVolts();
1257
1258 std::cout<<"VQwDetectorArray::ProcessEvent_2(): processing with exchanged data"<<std::endl;
1259 std::cout<<"pedestal, calfactor, average volts = "<<pedestal<<", "<<calfactor<<", "<<volts<<std::endl;
1260
1261 }
1262
1264 this->DoNormalization();
1265
1266 } else {
1267
1268 QwWarning<<"VQwDetectorArray::ProcessEvent_2(): could not get all external values."<<QwLog::endl;
1269
1270 }
1271
1272}
1273
1274
1275
1276
1277void VQwDetectorArray::ConstructHistograms(TDirectory *folder, TString &prefix) {
1278
1279 for (size_t i=0;i<fIntegrationPMT.size();i++)
1280 fIntegrationPMT[i].ConstructHistograms(folder,prefix);
1281
1282 for (size_t i=0;i<fCombinedPMT.size();i++)
1283 fCombinedPMT[i].ConstructHistograms(folder,prefix);
1284
1285 return;
1286
1287}
1288
1289
1291
1292 for (size_t i=0;i<fIntegrationPMT.size();i++)
1294
1295 for (size_t i=0;i<fCombinedPMT.size();i++)
1297
1298 return;
1299
1300}
1301
1302
1303void VQwDetectorArray::ConstructBranchAndVector(TTree *tree, TString & prefix, QwRootTreeBranchVector &values) {
1304
1305 for (size_t i=0;i<fIntegrationPMT.size();i++)
1306 fIntegrationPMT[i].ConstructBranchAndVector(tree, prefix, values);
1307
1308 for (size_t i=0;i<fCombinedPMT.size();i++)
1309 fCombinedPMT[i].ConstructBranchAndVector(tree, prefix, values);
1310
1311 return;
1312
1313}
1314
1315void VQwDetectorArray::ConstructBranch(TTree *tree, TString & prefix) {
1316
1317 for (size_t i=0;i<fIntegrationPMT.size();i++)
1318 fIntegrationPMT[i].ConstructBranch(tree, prefix);
1319
1320 for (size_t i=0;i<fCombinedPMT.size();i++)
1321 fCombinedPMT[i].ConstructBranch(tree, prefix);
1322
1323 return;
1324
1325}
1326
1327void VQwDetectorArray::ConstructBranch(TTree *tree, TString & prefix, QwParameterFile& trim_file) {
1328
1329 TString tmp;
1330 std::unique_ptr<QwParameterFile> nextmodule;
1331 trim_file.RewindToFileStart();
1332 tmp="QwIntegrationPMT";
1333 trim_file.RewindToFileStart();
1334
1335 if (trim_file.FileHasModuleHeader(tmp)){
1336
1337 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
1338
1339 for (size_t i=0;i<fIntegrationPMT.size();i++)
1340 fIntegrationPMT[i].ConstructBranch(tree, prefix, *nextmodule);
1341
1342 }
1343
1344 tmp="QwCombinedPMT";
1345 trim_file.RewindToFileStart();
1346
1347 if (trim_file.FileHasModuleHeader(tmp)){
1348
1349 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
1350
1351 for (size_t i=0;i<fCombinedPMT.size();i++)
1352 fCombinedPMT[i].ConstructBranch(tree, prefix, *nextmodule );
1353 }
1354
1355 return;
1356}
1357
1359
1360 for (size_t i=0;i<fIntegrationPMT.size();i++)
1362
1363 for (size_t i=0;i<fCombinedPMT.size();i++)
1364 fCombinedPMT[i].FillTreeVector(values);
1365
1366 return;
1367
1368}
1369
1370#ifdef HAS_RNTUPLE_SUPPORT
1371void VQwDetectorArray::ConstructNTupleAndVector(std::unique_ptr<ROOT::RNTupleModel>& model, TString& prefix, std::vector<Double_t>& values, std::vector<std::shared_ptr<Double_t>>& fieldPtrs) {
1372
1373 for (size_t i=0;i<fIntegrationPMT.size();i++)
1374 fIntegrationPMT[i].ConstructNTupleAndVector(model, prefix, values, fieldPtrs);
1375
1376 for (size_t i=0;i<fCombinedPMT.size();i++)
1377 fCombinedPMT[i].ConstructNTupleAndVector(model, prefix, values, fieldPtrs);
1378
1379 return;
1380
1381}
1382
1383void VQwDetectorArray::FillNTupleVector(std::vector<Double_t>& values) const {
1384
1385 for (size_t i=0;i<fIntegrationPMT.size();i++)
1386 fIntegrationPMT[i].FillNTupleVector(values);
1387
1388 for (size_t i=0;i<fCombinedPMT.size();i++)
1389 fCombinedPMT[i].FillNTupleVector(values);
1390
1391 return;
1392
1393}
1394#endif
1395
1396
1397const QwIntegrationPMT* VQwDetectorArray::GetChannel(const TString name) const {
1398
1399 return GetIntegrationPMT(name);
1400
1401}
1402
1403
1405
1406 // std::cout<<" Here in VQwDetectorArray::Compare \n";
1407
1408 Bool_t res=kTRUE;
1409
1410 if (typeid(*value)!=typeid(*this)) {
1411
1412 res=kFALSE;
1413 //std::cout<<" types are not ok \n";
1414 //std::cout<<" this is bypassed just for now but should be fixed eventually \n";
1415
1416 } else {
1417
1418 VQwDetectorArray* input = dynamic_cast<VQwDetectorArray*>(value);
1419
1420 if (input->fIntegrationPMT.size()!=fIntegrationPMT.size()
1421 || input->fCombinedPMT.size()!=fCombinedPMT.size() ) {
1422
1423 res=kFALSE;
1424 //std::cout<<" not the same number of channels \n";
1425
1426 }
1427
1428 }
1429
1430 return res;
1431
1432}
1433
1434
1436
1437 // std::cout<<" here in VQwDetectorArray::operator= \n";
1438
1439 if (this != value && Compare(value)) {
1440
1442 VQwDetectorArray* input = dynamic_cast<VQwDetectorArray*> (value);
1443
1444 for (size_t i=0;i<input->fIntegrationPMT.size();i++)
1445 this->fIntegrationPMT[i]=input->fIntegrationPMT[i];
1446
1447 for (size_t i=0;i<input->fCombinedPMT.size();i++)
1448 (this->fCombinedPMT[i])=(input->fCombinedPMT[i]);
1449
1450 }
1451
1452 return *this;
1453
1454}
1455
1456
1458
1459 if (Compare(value)) {
1460
1461 VQwDetectorArray* input= dynamic_cast<VQwDetectorArray*>(value) ;
1462
1463 for (size_t i=0;i<input->fIntegrationPMT.size();i++)
1464 this->fIntegrationPMT[i]+=input->fIntegrationPMT[i];
1465
1466 for (size_t i=0;i<input->fCombinedPMT.size();i++)
1467 this->fCombinedPMT[i]+=input->fCombinedPMT[i];
1468
1469 }
1470
1471 return *this;
1472
1473}
1474
1475
1477
1478 if (Compare(value)) {
1479
1480 VQwDetectorArray* input= dynamic_cast<VQwDetectorArray*>(value);
1481
1482 for (size_t i=0;i<input->fIntegrationPMT.size();i++)
1483 this->fIntegrationPMT[i]-=input->fIntegrationPMT[i];
1484
1485 for (size_t i=0;i<input->fCombinedPMT.size();i++)
1486 this->fCombinedPMT[i]-=input->fCombinedPMT[i];
1487
1488 }
1489
1490 return *this;
1491
1492}
1493
1494
1496
1497 if (Compare(numer)&&Compare(denom)) {
1498
1499 VQwDetectorArray* innumer= dynamic_cast<VQwDetectorArray*>(numer) ;
1500 VQwDetectorArray* indenom= dynamic_cast<VQwDetectorArray*>(denom) ;
1501
1502 for (size_t i=0;i<innumer->fIntegrationPMT.size();i++)
1503 this->fIntegrationPMT[i].Ratio(innumer->fIntegrationPMT[i],indenom->fIntegrationPMT[i]);
1504
1505 for (size_t i=0;i<innumer->fCombinedPMT.size();i++)
1506 this->fCombinedPMT[i].Ratio(innumer->fCombinedPMT[i],indenom->fCombinedPMT[i]);
1507
1508 }
1509
1510 return;
1511
1512}
1513
1514
1515void VQwDetectorArray::Scale(Double_t factor) {
1516
1517 for (size_t i=0;i<fIntegrationPMT.size();i++)
1518 fIntegrationPMT[i].Scale(factor);
1519
1520 for (size_t i=0;i<fCombinedPMT.size();i++)
1521 fCombinedPMT[i].Scale(factor);
1522
1523 return;
1524
1525}
1526
1527//*****************************************************************//
1528
1530
1531 for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1532 fIntegrationPMT[i].Normalize(denom);
1533
1534 for (size_t i = 0; i < fCombinedPMT.size(); i++)
1535 fCombinedPMT[i].Normalize(denom);
1536
1537}
1538
1539
1540
1542
1543 for (size_t i=0;i<fIntegrationPMT.size();i++)
1545
1546 for (size_t i=0;i<fCombinedPMT.size();i++)
1548
1549 return;
1550
1551}
1552
1553
1554void VQwDetectorArray::AccumulateRunningSum(VQwSubsystem* value1, Int_t count, Int_t ErrorMask) {
1555
1556 if (Compare(value1)) {
1557
1558 VQwDetectorArray* value = dynamic_cast<VQwDetectorArray*>(value1);
1559
1560 for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1561 fIntegrationPMT[i].AccumulateRunningSum(value->fIntegrationPMT[i], count, ErrorMask);
1562
1563 for (size_t i = 0; i < fCombinedPMT.size(); i++)
1564 fCombinedPMT[i].AccumulateRunningSum(value->fCombinedPMT[i], count, ErrorMask);
1565
1566 }
1567
1568}
1569
1571
1572 if (Compare(value1)) {
1573
1574 VQwDetectorArray* value = dynamic_cast<VQwDetectorArray*>(value1);
1575
1576 for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1578
1579 for (size_t i = 0; i < fCombinedPMT.size(); i++)
1580 fCombinedPMT[i].DeaccumulateRunningSum(value->fCombinedPMT[i], ErrorMask);
1581
1582 }
1583
1584}
1585
1586
1592
1593//*****************************************************************//
1594
1596
1597 Bool_t ldebug=kFALSE;
1598
1599 if (ldebug) {
1600
1601 std::cout<<"VQwDetectorArray::GetDetectorIndex\n";
1602 std::cout<<"type_id=="<<type_id<<" name="<<name<<"\n";
1603 std::cout<<fMainDetID.size()<<" already registered detector\n";
1604 }
1605
1606 Int_t result=-1;
1607 for (size_t i=0;i<fMainDetID.size();i++) {
1608
1609 if (fMainDetID[i].fTypeID==type_id)
1610 if (fMainDetID[i].fdetectorname==name) {
1611
1612 result=fMainDetID[i].fIndex;
1613
1614 if (ldebug)
1615 std::cout<<"testing against ("<<fMainDetID[i].fTypeID
1616 <<","<<fMainDetID[i].fdetectorname<<")=>"<<result<<"\n";
1617
1618 }
1619 }
1620
1621 return result;
1622
1623}
1624
1626
1627 TString tmpname = name;
1628 tmpname.ToLower();
1629 if (! fIntegrationPMT.empty()) {
1630
1631 for (size_t i=0;i<fIntegrationPMT.size();i++) {
1632
1633 if (fIntegrationPMT.at(i).GetElementName() == tmpname) {
1634
1635 //std::cout<<"Get IntegrationPMT "<<tmpname<<std::endl;
1636 return &(fIntegrationPMT.at(i));
1637
1638 }
1639
1640 }
1641
1642 }
1643
1644 QwMessage << "VQwDetectorArray::GetIntegrationPMT: cannot find channel " << tmpname << QwLog::endl;
1645
1646 return NULL;
1647
1648}
1649
1650
1651const QwCombinedPMT* VQwDetectorArray::GetCombinedPMT(const TString name) const {
1652 TString tmpname = name;
1653 tmpname.ToLower();
1654 if (! fCombinedPMT.empty())
1655 {
1656 for (size_t i=0;i<fCombinedPMT.size();i++)
1657 {
1658 if (fCombinedPMT.at(i).GetElementName() == tmpname)
1659 {
1660 //std::cout<<"Get CombinedPMT "<<tmpname<<std::endl;
1661 return &(fCombinedPMT.at(i));
1662 }
1663 }
1664 }
1665 QwMessage << "VQwDetectorArray::GetCombinedPMT: cannot find channel " << tmpname << QwLog::endl;
1666 return NULL;
1667}
1668
1670
1672
1673 try {
1674
1675 this->Normalize(&fTargetCharge);
1676
1677 }
1678
1679 catch (std::exception& e) {
1680
1681 std::cerr << e.what() << std::endl;
1682
1683 }
1684
1685 }
1686
1687}
1688
1689#ifdef __USE_DATABASE__
1690void VQwDetectorArray::FillDB(QwParityDB *db, TString datatype) {
1691
1692 Bool_t local_print_flag = false;
1693
1694 if(local_print_flag) {
1695
1696 QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1697 QwMessage << " VQwDetectorArray::FillDB " << QwLog::endl;
1698 QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1699
1700 }
1701
1702 std::vector<QwDBInterface> interface;
1703 std::vector<QwParitySchema::md_data_row> entrylist;
1704
1705 UInt_t analysis_id = db->GetAnalysisID();
1706
1707 TString measurement_type;
1708 measurement_type = QwDBInterface::DetermineMeasurementTypeID(datatype);
1709
1710 UInt_t i,j;
1711 i = j = 0;
1712
1713 if(local_print_flag) QwMessage << QwColor(Qw::kGreen) << "IntegrationPMT" <<QwLog::endl;
1714
1715 for(i=0; i<fIntegrationPMT.size(); i++) {
1716
1717 interface.clear();
1718 interface = fIntegrationPMT[i].GetDBEntry();
1719
1720 for(j=0; j<interface.size(); j++) {
1721
1722 interface.at(j).SetAnalysisID( analysis_id );
1723 interface.at(j).SetMainDetectorID( db );
1724 interface.at(j).SetMeasurementTypeID( measurement_type );
1725 interface.at(j).PrintStatus( local_print_flag );
1726 interface.at(j).AddThisEntryToList( entrylist );
1727 }
1728 }
1729
1730 if(local_print_flag) QwMessage << QwColor(Qw::kGreen) << "Combined PMT" <<QwLog::endl;
1731
1732 for(i=0; i< fCombinedPMT.size(); i++) {
1733
1734 interface.clear();
1735 interface = fCombinedPMT[i].GetDBEntry();
1736
1737 for(j=0; j<interface.size(); j++) {
1738
1739 interface.at(j).SetAnalysisID( analysis_id );
1740 interface.at(j).SetMainDetectorID( db );
1741 interface.at(j).SetMeasurementTypeID( measurement_type );
1742 interface.at(j).PrintStatus( local_print_flag );
1743 interface.at(j).AddThisEntryToList( entrylist );
1744 }
1745
1746 }
1747
1748 if(local_print_flag) {
1749
1750 QwMessage << QwColor(Qw::kGreen) << "Entrylist Size : "
1751 << QwColor(Qw::kBoldRed) << entrylist.size()
1752 << QwColor(Qw::kNormal) << QwLog::endl;
1753
1754 }
1755
1756 // Check the entrylist size, if it isn't zero, start to query..
1757 if( entrylist.size() ) {
1758 auto c = db->GetScopedConnection();
1759 for (const auto& entry : entrylist) {
1760 c->QueryExecute(entry.insert_into());
1761 }
1762 } else {
1763 QwMessage << "VQwDetectorArray::FillDB :: This is the case when the entrylist contains nothing in "<< datatype.Data() << QwLog::endl;
1764 }
1765}
1766#endif
1767
1769
1770 QwMessage << "=== VQwDetectorArray: " << GetName() << " ===" << QwLog::endl;
1771
1772 for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1774
1775 for (size_t i = 0; i < fCombinedPMT.size(); i++)
1777
1778}
1779
1781
1782 std::cout<<"Name of the subsystem ="<<fSystemName<<"\n";
1783
1784 std::cout<<"there are "<<fIntegrationPMT.size()<<" IntegrationPMT \n";
1785 std::cout<<" "<<fCombinedPMT.size()<<" CombinedPMT \n";
1786
1787 std::cout<<" Printing Running AVG and other channel info"<<std::endl;
1788
1789 for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1791 for (size_t i = 0; i < fCombinedPMT.size(); i++)
1793
1794}
1795
1797
1798 for (size_t i=0;i<fMainDetID.size();i++) {
1799
1800 std::cout<<"============================="<<std::endl;
1801 std::cout<<" Detector ID="<<i<<std::endl;
1802 fMainDetID[i].Print();
1803
1804 }
1805
1806 return;
1807
1808}
1809
1810#ifdef __USE_DATABASE__
1811void VQwDetectorArray::FillErrDB(QwParityDB *db, TString datatype) {
1812
1813 Bool_t local_print_flag = false;
1814 if(local_print_flag){
1815
1816 QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1817 QwMessage << " QwDetectorArrayID::FillErrDB " << QwLog::endl;
1818 QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1819
1820 }
1821
1822
1823 std::vector<QwErrDBInterface> interface;
1824 std::vector<QwParitySchema::md_errors_row> entrylist;
1825
1826 UInt_t analysis_id = db->GetAnalysisID();
1827
1828 UInt_t i,j;
1829 i = j = 0;
1830 if(local_print_flag) QwMessage << QwColor(Qw::kGreen) << "IntegrationPMT" <<QwLog::endl;
1831
1832 for(i=0; i<fIntegrationPMT.size(); i++) {
1833
1834 interface.clear();
1835 interface = fIntegrationPMT[i].GetErrDBEntry();
1836
1837 for(j=0; j<interface.size(); j++) {
1838
1839 interface.at(j).SetAnalysisID ( analysis_id );
1840 interface.at(j).SetMainDetectorID ( db );
1841 interface.at(j).PrintStatus ( local_print_flag );
1842 interface.at(j).AddThisEntryToList( entrylist );
1843
1844 }
1845
1846 }
1847
1848 if(local_print_flag) QwMessage << QwColor(Qw::kGreen) << "Combined PMT" <<QwLog::endl;
1849
1850 for(i=0; i< fCombinedPMT.size(); i++) {
1851
1852 interface.clear();
1853 interface = fCombinedPMT[i].GetErrDBEntry();
1854
1855 for(j=0; j<interface.size(); j++) {
1856
1857 interface.at(j).SetAnalysisID ( analysis_id );
1858 interface.at(j).SetMainDetectorID ( db );
1859 interface.at(j).PrintStatus ( local_print_flag );
1860 interface.at(j).AddThisEntryToList( entrylist );
1861
1862 }
1863
1864 }
1865
1866 if(local_print_flag) {
1867
1868 QwMessage << QwColor(Qw::kGreen) << "Entrylist Size : "
1869 << QwColor(Qw::kBoldRed) << entrylist.size()
1870 << QwColor(Qw::kNormal) << QwLog::endl;
1871
1872 }
1873
1874 // Check the entrylist size, if it isn't zero, start to query..
1875 if( entrylist.size() ) {
1876 auto c = db->GetScopedConnection();
1877 for (const auto& entry : entrylist) {
1878 c->QueryExecute(entry.insert_into());
1879 }
1880 } else {
1881 QwMessage << "VQwDetectorArray::FillErrDB :: This is the case when the entrylist contains nothing in "<< datatype.Data() << QwLog::endl;
1882 }
1883}
1884#endif
1885
1886
1888
1889 Bool_t local_print_flag = false;
1890 Bool_t local_add_element= type.Contains("yield");
1891
1892 if(local_print_flag){
1893
1894 QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1895 QwMessage << " QwDetectorArrayID::WritePromptSummary() " << QwLog::endl;
1896 QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1897 }
1898
1899 const VQwHardwareChannel* tmp_channel = 0;
1900 TString element_name = "";
1901 Double_t element_value = 0.0;
1902 Double_t element_value_err = 0.0;
1903 Double_t element_value_width = 0.0;
1904
1905 PromptSummaryElement *local_ps_element = NULL;
1906 Bool_t local_add_these_elements= false;
1907
1908 for (size_t i = 0; i < fMainDetID.size(); i++) {
1909
1910 element_name = fMainDetID[i].fdetectorname;
1911 tmp_channel=GetIntegrationPMT(element_name)->GetChannel(element_name);
1912 element_value = 0.0;
1913 element_value_err = 0.0;
1914 element_value_width = 0.0;
1915
1916
1917 local_add_these_elements=element_name.Contains("sam"); // Need to change this to add other detectorss in summary
1918
1919 if(local_add_these_elements&&local_add_element){
1920
1921 ps->AddElement(new PromptSummaryElement(element_name));
1922
1923 }
1924
1925
1926 local_ps_element=ps->GetElementByName(element_name);
1927
1928
1929 if(local_ps_element) {
1930
1931 element_value = tmp_channel->GetValue();
1932 element_value_err = tmp_channel->GetValueError();
1933 element_value_width = tmp_channel->GetValueWidth();
1934
1935 local_ps_element->Set(type, element_value, element_value_err, element_value_width);
1936
1937 }
1938
1939 if( local_print_flag && local_ps_element) {
1940
1941 printf("Type %12s, Element %32s, value %12.4e error %8.4e width %12.4e\n",
1942 type.Data(), element_name.Data(), element_value, element_value_err, element_value_width);
1943
1944 }
1945
1946 }
1947
1948 return;
1949
1950}
1951
1952
1953
1955
1956 std::cout<<std::endl<<"Detector name= "<<fdetectorname<<std::endl;
1957 std::cout<<"SubbankkIndex= "<<fSubbankIndex<<std::endl;
1958 std::cout<<"word index in subbank= "<<fWordInSubbank<<std::endl;
1959 std::cout<<"module type= "<<fmoduletype<<std::endl;
1960 std::cout<<"detector type= "<<fdetectortype<<" index= "<<fTypeID<<std::endl;
1961 std::cout<<"Index of this detector in the vector of similar detector= "<<fIndex<<std::endl;
1962 std::cout<<"Subelement index= "<<fSubelement<<std::endl;
1963 std::cout<<"==========================================\n";
1964
1965 return;
1966
1967}
Array container for managing multiple subsystems.
EQwPMTInstrumentType GetQwPMTInstrumentType(TString name)
Definition QwTypes.cc:16
TString GetQwPMTInstrumentTypeName(EQwPMTInstrumentType type)
Definition QwTypes.cc:81
ULong64_t BankID_t
Definition QwTypes.h:21
UInt_t GetGlobalErrorFlag(TString evtype, Int_t evMode, Double_t stabilitycut)
Definition QwTypes.cc:132
EQwPMTInstrumentType
Definition QwTypes.h:135
@ kQwUnknownPMT
Definition QwTypes.h:136
@ kQwCombinedPMT
Definition QwTypes.h:139
@ kQwIntegrationPMT
Definition QwTypes.h:137
UInt_t ROCID_t
Definition QwTypes.h:20
A logfile class, based on an identical class in the Hermes analyzer.
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
#define QwWarning
Predefined log drain for warnings.
Definition QwLog.h:44
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
#define QwDebug
Predefined log drain for debugging output.
Definition QwLog.h:59
Prompt summary data management.
Virtual base class for detector arrays (PMTs, etc.)
@ kBoldRed
Definition QwColor.h:79
@ kGreen
Definition QwColor.h:77
@ kNormal
Definition QwColor.h:81
Bool_t RequestExternalValue(const TString &name, VQwHardwareChannel *value) const
Bool_t PublishInternalValue(const TString name, const TString desc, const VQwHardwareChannel *element) const
static TString DetermineMeasurementTypeID(TString type, TString suffix="", Bool_t forcediffs=kFALSE)
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
Concrete hardware channel for Moller ADC modules (6x32-bit words)
static void PrintErrorCounterHead()
static void SetDecodeMode(UInt_t input)
static Int_t GetBufferOffset(Int_t moduleindex, Int_t channelindex)
static void PrintErrorCounterTail()
Command-line and configuration file options processor.
Definition QwOptions.h:141
T GetValue(const std::string &key)
Get a templated value.
Definition QwOptions.h:236
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
Definition QwOptions.h:170
Configuration file parser with flexible tokenization and search capabilities.
T GetTypedNextToken()
Get next token into specific type.
std::unique_ptr< QwParameterFile > ReadUntilNextModule(const bool add_current_line=false)
Bool_t PopValue(const std::string keyname, T &retvalue)
void TrimWhitespace(TString::EStripType head_tail=TString::kBoth)
void SetCommentChars(const std::string value)
Set various sets of special characters.
void TrimComment(const char commentchar)
const std::pair< TString, TString > GetParamFileNameContents()
Bool_t FileHasModuleHeader(const std::string &secname)
Bool_t ReturnValue(const std::string keyname, T &retvalue)
std::unique_ptr< QwParameterFile > ReadNextSection(std::string &secname, const bool keep_header=false)
void Set(TString type, const Double_t a, const Double_t a_err, const Double_t a_width)
void AddElement(PromptSummaryElement *in)
PromptSummaryElement * GetElementByName(TString name)
A helper class to manage a vector of branch entries for ROOT trees.
Definition QwRootFile.h:55
The pure virtual base class of all data elements.
Abstract base for concrete hardware channels implementing dual-operator pattern.
Double_t GetValueError() const
Double_t GetValueWidth() const
Double_t GetValue() const
std::vector< std::vector< TString > > fPublishList
BankID_t fCurrentBank_ID
Bank ID (and Marker word) that is currently being processed;.
TString fSystemName
Name of this subsystem.
Int_t GetSubbankIndex() const
virtual VQwSubsystem & operator=(VQwSubsystem *value)
Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsy...
void RegisterRocBankMarker(QwParameterFile &mapstr)
static void DefineOptions()
Define options function (note: no virtual static functions in C++)
TString GetName() const
std::map< TString, TString > fDetectorMaps
Map of file name to full path or content.
VQwSubsystem(const TString &name)
Constructor with name.
ROCID_t fCurrentROC_ID
ROC ID that is currently being processed.
Combines multiple integration PMTs into weighted sum/average.
void SetNormalizability(Bool_t isnormalizable)
void SetBlindability(Bool_t isblindable)
const QwMollerADC_Channel * GetChannel(const TString name) const
Integration PMT providing yield/diff/asym readout from Moller ADC.
const QwMollerADC_Channel * GetChannel(const TString name) const
void SetBlindability(Bool_t isblindable)
void SetNormalizability(Bool_t isnormalizable)
Identifier and mapping information for detector-array channels.
std::vector< Double_t > fWeight
std::vector< TString > fCombinedChannelNames
EQwPMTInstrumentType fTypeID
Int_t LoadInputParameters(TString pedestalfile) override
Mandatory parameter file definition.
Bool_t ApplySingleEventCuts() override
Apply the single event cuts.
void LoadEventCuts_Fin(Int_t &eventcut_flag) override
const QwCombinedPMT * GetCombinedPMT(const TString name) const
void Ratio(VQwSubsystem *numer, VQwSubsystem *denom) override
Int_t GetDetectorIndex(EQwPMTInstrumentType TypeID, TString name)
void ProcessOptions(QwOptions &options) override
void AccumulateRunningSum(VQwSubsystem *value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override
Update the running sums for devices.
QwBeamPosition fTargetX
const QwIntegrationPMT * GetChannel(const TString name) const
EQwPMTInstrumentType GetDetectorTypeID(TString name)
void DoNormalization(Double_t factor=1.0)
void LoadMockDataParameters(TString pedestalfile) override
VQwDetectorArray()
Private default constructor (not implemented, will throw linker error on use)
QwBeamAngle fTargetXprime
QwBeamPosition fTargetY
void FillTreeVector(QwRootTreeBranchVector &values) const override
Fill the tree vector.
Int_t LoadChannelMap(TString mapfile) override
void IncrementErrorCounters() override
Increment the error counters.
void DeaccumulateRunningSum(VQwSubsystem *value, Int_t ErrorMask=0xFFFFFFF) override
remove one entry from the running sums for devices
void ConstructBranch(TTree *tree, TString &prefix) override
Construct the branch and tree vector.
void WritePromptSummary(QwPromptSummary *ps, TString type) override
Int_t ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware v...
std::vector< QwIntegrationPMT > fIntegrationPMT
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Bool_t CheckForBurpFail(const VQwSubsystem *subsys) override
Report the number of events failed due to HW and event cut failures.
void LoadEventCuts_Line(QwParameterFile &mapstr, TString &varvalue, Int_t &eventcut_flag) override
Bool_t Compare(VQwSubsystem *source)
VQwSubsystem & operator-=(VQwSubsystem *value) override
void PrintDetectorID() const
void PrintErrorCounters() const override
QwBeamAngle fTargetYprime
Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
static const Bool_t bDEBUG
void ExchangeProcessedData() override
Bool_t PublishInternalValues() const override
std::vector< QwDetectorArrayID > fMainDetID
void EncodeEventData(std::vector< UInt_t > &buffer) override
void Normalize(VQwDataElement *denom)
VQwSubsystem & operator+=(VQwSubsystem *value) override
QwBeamCharge fTargetCharge
std::vector< QwCombinedPMT > fCombinedPMT
VQwSubsystem & operator=(VQwSubsystem *value) override
Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsy...
void PrintValue() const override
Print values of all channels.
void SetRandomEventAsymmetry(Double_t asymmetry)
void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override
Construct the branch and tree vector.
UInt_t GetEventcutErrorFlag() override
Return the error flag to the top level routines related to stability checks and ErrorFlag updates.
Bool_t PublishByRequest(TString device_name) override
void SetRandomEventParameters(Double_t mean, Double_t sigma)
void PrintInfo() const override
Print some information about the subsystem.
void CalculateRunningAverage() override
Calculate the average for all good events.
void Scale(Double_t factor) override
void ProcessEvent() override
void RandomizeMollerEvent(int helicity)
void ClearEventData() override
void ProcessEvent_2() override
Process the event data again, including data from other subsystems. Not all derived classes will requ...
const QwIntegrationPMT * GetIntegrationPMT(const TString name) const
void RandomizeEventData(int helicity=0, Double_t time=0.0) override
QwBeamEnergy fTargetEnergy
void FillHistograms() override
Fill the histograms for this subsystem.
virtual void FillDB(QwParityDB *, TString)
Fill the database.
virtual UInt_t UpdateErrorFlag()
Uses the error flags of contained data elements to update Returns the error flag to the top level rou...
virtual void FillErrDB(QwParityDB *, TString)