JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
VQwDataHandler Class Reference

Abstract base for handlers that consume multiple subsystems and produce derived outputs. More...

#include <VQwDataHandler.h>

+ Inheritance diagram for VQwDataHandler:
+ Collaboration diagram for VQwDataHandler:

Public Types

enum  EQwHandleType {
  kHandleTypeUnknown =0 , kHandleTypeMps , kHandleTypeAsym , kHandleTypeDiff ,
  kHandleTypeYield
}
 
typedef std::vector< VQwHardwareChannel * >::iterator Iterator_HdwChan
 
typedef std::vector< VQwHardwareChannel * >::const_iterator ConstIterator_HdwChan
 

Public Member Functions

 VQwDataHandler (const TString &name)
 
 VQwDataHandler (const VQwDataHandler &source)
 
virtual void ParseConfigFile (QwParameterFile &file)
 
void SetPointer (QwHelicityPattern *ptr)
 
void SetPointer (QwSubsystemArrayParity *ptr)
 
virtual Int_t ConnectChannels (QwSubsystemArrayParity &, QwSubsystemArrayParity &asym, QwSubsystemArrayParity &diff)
 
virtual Int_t ConnectChannels (QwSubsystemArrayParity &)
 
Int_t ConnectChannels (QwHelicityPattern &helicitypattern)
 
virtual void ProcessData ()
 
virtual void UpdateBurstCounter (Short_t burstcounter)
 
virtual void FinishDataHandler ()
 
 ~VQwDataHandler () override
 
TString GetName ()
 
virtual void ClearEventData ()
 
void InitRunningSum ()
 
void AccumulateRunningSum ()
 
virtual void AccumulateRunningSum (VQwDataHandler &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
 
void CalculateRunningAverage ()
 
void PrintValue () const
 
void WritePromptSummary (QwPromptSummary *ps, TString type)
 
virtual void ConstructTreeBranches (QwRootFile *treerootfile, const std::string &treeprefix="", const std::string &branchprefix="")
 
virtual void FillTreeBranches (QwRootFile *treerootfile)
 
virtual void ConstructNTupleFields (QwRootFile *treerootfile, const std::string &treeprefix="", const std::string &branchprefix="")
 RNTuple methods.
 
virtual void FillNTupleFields (QwRootFile *treerootfile)
 
virtual void ConstructHistograms (TDirectory *, TString &)
 Construct the histograms in a folder with a prefix.
 
virtual void FillHistograms ()
 Fill the histograms.
 
void FillTreeVector (QwRootTreeBranchVector &values) const
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, QwRootTreeBranchVector &values)
 
void SetRunLabel (TString x)
 
Int_t LoadChannelMap ()
 
virtual Int_t LoadChannelMap (const std::string &)
 
Bool_t PublishInternalValues () const override
 Publish all variables of the subsystem.
 
Bool_t PublishByRequest (TString device_name) override
 Try to publish an internal variable matching the submitted name.
 
- Public Member Functions inherited from MQwPublishable_child< QwDataHandlerArray, VQwDataHandler >
 MQwPublishable_child ()
 Default constructor Initializes the child object and sets up self-reference for publishing.
 
 MQwPublishable_child (const MQwPublishable_child &source)
 Copy constructor.
 
virtual ~MQwPublishable_child ()
 Virtual destructor.
 
void SetParent (QwDataHandlerArray *parent)
 Set the parent container for this child object.
 
QwDataHandlerArrayGetParent () const
 Get the parent container for this child object.
 

Protected Member Functions

 VQwDataHandler ()
 
virtual Int_t ConnectChannels (QwSubsystemArrayParity &asym, QwSubsystemArrayParity &diff)
 
void SetEventcutErrorFlagPointer (const UInt_t *errorflagptr)
 
UInt_t GetEventcutErrorFlag () const
 
std::pair< EQwHandleType, std::string > ParseHandledVariable (const std::string &variable)
 
void CalcOneOutput (const VQwHardwareChannel *dv, VQwHardwareChannel *output, std::vector< const VQwHardwareChannel * > &ivs, std::vector< Double_t > &sens)
 
- Protected Member Functions inherited from MQwPublishable_child< QwDataHandlerArray, VQwDataHandler >
Bool_t RequestExternalValue (const TString &name, VQwHardwareChannel *value) const
 Retrieve the variable name from other subsystem arrays Get the value corresponding to some variable name from a different data array.
 
const VQwHardwareChannelRequestExternalPointer (const TString &name) const
 Retrieve a pointer to an external variable by name Requests a direct pointer to a variable from sibling subsystems via the parent container.
 
Bool_t PublishInternalValue (const TString name, const TString desc, const VQwHardwareChannel *element) const
 Publish a variable from this child into the parent container.
 

Protected Attributes

Int_t fPriority
 
Short_t fBurstCounter
 When a datahandler array is processed, handlers with lower priority will be processed before handlers with higher priority.
 
TString fName
 
std::string fMapFile
 
std::string fTreeName
 
std::string fTreeComment
 
std::string fPrefix
 
TString run_label
 
const UInt_t * fErrorFlagPtr
 Error flag pointer.
 
QwSubsystemArrayParityfSubsystemArray
 Single event pointer.
 
QwHelicityPatternfHelicityPattern
 Helicity pattern pointer.
 
std::vector< std::string > fDependentFull
 
std::vector< EQwHandleTypefDependentType
 
std::vector< std::string > fDependentName
 
std::vector< const VQwHardwareChannel * > fDependentVar
 
std::vector< Double_t > fDependentValues
 
std::vector< VQwHardwareChannel * > fOutputVar
 
std::vector< Double_t > fOutputValues
 
std::vector< std::vector< TString > > fPublishList
 
std::string ParseSeparator
 
Bool_t fKeepRunningSum
 
Bool_t fRunningsumFillsTree
 
VQwDataHandlerfRunningsum
 

Detailed Description

Abstract base for handlers that consume multiple subsystems and produce derived outputs.

A data handler observes one or more subsystem arrays (yields, asymmetries, differences) and computes derived channels or diagnostics. Typical examples include linear regression, correlation studies, and alarm/quality handlers.

Key responsibilities:

  • Establish connections to required input channels via ConnectChannels.
  • ProcessData once per event to update derived quantities.
  • Maintain running sums/averages and optionally publish variables to trees, histograms, or RNTuples.

Design notes:

  • Uses container-delegation at the system level; underlying arithmetic is performed by the concrete channel classes.
  • Handlers participate in the MQwPublishable pattern for on-demand output publication, and in cloneable factories for configuration-driven creation.

Definition at line 43 of file VQwDataHandler.h.

Member Typedef Documentation

◆ ConstIterator_HdwChan

typedef std::vector<VQwHardwareChannel*>::const_iterator VQwDataHandler::ConstIterator_HdwChan

Definition at line 52 of file VQwDataHandler.h.

◆ Iterator_HdwChan

typedef std::vector<VQwHardwareChannel*>::iterator VQwDataHandler::Iterator_HdwChan

Definition at line 51 of file VQwDataHandler.h.

Member Enumeration Documentation

◆ EQwHandleType

Enumerator
kHandleTypeUnknown 
kHandleTypeMps 
kHandleTypeAsym 
kHandleTypeDiff 
kHandleTypeYield 

Definition at line 47 of file VQwDataHandler.h.

Constructor & Destructor Documentation

◆ VQwDataHandler() [1/3]

VQwDataHandler::VQwDataHandler ( const TString & name)

Constructor: initialize base data handler with name and defaults.

Definition at line 36 of file VQwDataHandler.cc.

37: fPriority(0),
39 fName(name),
40 fMapFile(""),
41 fTreeName(""),
42 fTreeComment(""),
43 fPrefix(""),
47 fKeepRunningSum(kFALSE)
48{ fRunningsum=NULL;}
QwSubsystemArrayParity * fSubsystemArray
Single event pointer.
std::string fPrefix
VQwDataHandler * fRunningsum
const UInt_t * fErrorFlagPtr
Error flag pointer.
Short_t fBurstCounter
When a datahandler array is processed, handlers with lower priority will be processed before handlers...
std::string fTreeComment
std::string fTreeName
QwHelicityPattern * fHelicityPattern
Helicity pattern pointer.
std::string fMapFile

References fBurstCounter, fErrorFlagPtr, fHelicityPattern, fKeepRunningSum, fMapFile, fName, fPrefix, fPriority, fRunningsum, fSubsystemArray, fTreeComment, and fTreeName.

Referenced by QwCorrelator::AccumulateRunningSum(), AccumulateRunningSum(), LRBCorrector::LRBCorrector(), QwAlarmHandler::QwAlarmHandler(), QwAlarmHandler::QwAlarmHandler(), QwCombiner::QwCombiner(), QwCombiner::QwCombiner(), QwCorrelator::QwCorrelator(), QwCorrelator::QwCorrelator(), QwExtractor::QwExtractor(), QwExtractor::QwExtractor(), and VQwDataHandler().

+ Here is the caller graph for this function:

◆ VQwDataHandler() [2/3]

VQwDataHandler::VQwDataHandler ( const VQwDataHandler & source)

Copy constructor: deep-copy output variables and running sums.

Definition at line 51 of file VQwDataHandler.cc.

52: fPriority(source.fPriority),
54 fName(source.fName),
55 fMapFile(source.fMapFile),
56 fTreeName(source.fTreeName),
58 fPrefix(source.fPrefix),
63{
68 // Create new objects for the the outputs.
69 fOutputVar.resize(source.fOutputVar.size());
70 for (size_t i = 0; i < this->fDependentVar.size(); i++) {
71 //const QwVQWK_Channel* vqwk = dynamic_cast<const QwVQWK_Channel*>(source.fOutputVar[i]);
72 this->fOutputVar[i] = source.fOutputVar[i]->Clone(VQwDataElement::kDerived);
73 //this->fOutputVar[i] = new QwVQWK_Channel(*vqwk, VQwDataElement::kDerived);
74 }
75 if (source.fRunningsum!=NULL){
76 fRunningsum = source.fRunningsum->Clone();
77 } else {
78 fRunningsum = NULL;
79 }
80}
std::vector< const VQwHardwareChannel * > fDependentVar
std::string ParseSeparator
std::vector< VQwHardwareChannel * > fOutputVar
std::vector< EQwHandleType > fDependentType
std::vector< std::string > fDependentName

References fBurstCounter, fDependentName, fDependentType, fDependentVar, fErrorFlagPtr, fHelicityPattern, fKeepRunningSum, fMapFile, fName, fOutputVar, fPrefix, fPriority, fRunningsum, fSubsystemArray, fTreeComment, fTreeName, VQwDataElement::kDerived, ParseSeparator, and VQwDataHandler().

+ Here is the call graph for this function:

◆ ~VQwDataHandler()

VQwDataHandler::~VQwDataHandler ( )
override

Destructor: clean up owned output variable clones.

Definition at line 84 of file VQwDataHandler.cc.

84 {
85
86 for (size_t i = 0; i < fOutputVar.size(); ++i) {
87 if (fOutputVar.at(i) != NULL){
88 delete fOutputVar.at(i);
89 }
90 }
91 fOutputVar.clear();
92
93}

References fOutputVar.

◆ VQwDataHandler() [3/3]

VQwDataHandler::VQwDataHandler ( )
inlineprotected

Definition at line 149 of file VQwDataHandler.h.

149{ }

Member Function Documentation

◆ AccumulateRunningSum() [1/2]

void VQwDataHandler::AccumulateRunningSum ( )

Accumulate current event into running sum if no error flags are set.

Definition at line 405 of file VQwDataHandler.cc.

406{
407 if (fKeepRunningSum && fErrorFlagPtr!=NULL && (*fErrorFlagPtr)==0){
408 fRunningsum->AccumulateRunningSum(*this);
409 }
410}

References fErrorFlagPtr, fKeepRunningSum, and fRunningsum.

Referenced by QwDataHandlerArray::AccumulateAllRunningSum(), QwCombinerSubsystem::AccumulateRunningSum(), and QwDataHandlerArray::AccumulateRunningSum().

+ Here is the caller graph for this function:

◆ AccumulateRunningSum() [2/2]

void VQwDataHandler::AccumulateRunningSum ( VQwDataHandler & value,
Int_t count = 0,
Int_t ErrorMask = 0xFFFFFFF )
virtual

Reimplemented in QwCorrelator.

Definition at line 412 of file VQwDataHandler.cc.

413{
414 for (size_t i = 0; i < fOutputVar.size(); i++){
415 this->fOutputVar[i]->AccumulateRunningSum(value.fOutputVar[i], count, ErrorMask);
416 }
417}

References fOutputVar, and VQwDataHandler().

+ Here is the call graph for this function:

◆ CalcOneOutput()

void VQwDataHandler::CalcOneOutput ( const VQwHardwareChannel * dv,
VQwHardwareChannel * output,
std::vector< const VQwHardwareChannel * > & ivs,
std::vector< Double_t > & sens )
protected

Calculate one corrected output by copying the dependent variable and applying sensitivity-weighted corrections from independent variables.

Definition at line 115 of file VQwDataHandler.cc.

117 {
118
119 // if second is NULL, can't do corrector
120 if (output == NULL){
121 QwError<<"Second is value is NULL, unable to calculate corrector."<<QwLog::endl;
122 return;
123 }
124 // For correct type (asym, diff, mps)
125 // if (fDependentType.at(dv) != type) continue;
126
127 // Clear data in second, if first is NULL
128 if (dv == NULL){
129 output->ClearEventData();
130 }else{
131 // Update second value
132 output->AssignValueFrom(dv);
133 }
134
135 // Add corrections
136 for (size_t iv = 0; iv < ivs.size(); iv++) {
137 output->ScaledAdd(sens.at(iv), ivs.at(iv));
138 }
139
140}
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
virtual void ScaledAdd(Double_t scale, const VQwHardwareChannel *value)=0
void ClearEventData() override
Clear the event data in this element.
void AssignValueFrom(const VQwDataElement *valueptr) override=0

References VQwHardwareChannel::AssignValueFrom(), VQwHardwareChannel::ClearEventData(), QwLog::endl(), QwError, and VQwHardwareChannel::ScaledAdd().

Referenced by LRBCorrector::ProcessData(), and QwCombiner::ProcessData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculateRunningAverage()

void VQwDataHandler::CalculateRunningAverage ( )

Definition at line 420 of file VQwDataHandler.cc.

421{
422 if (fKeepRunningSum && (fRunningsum != NULL)){
423 for(size_t i = 0; i < fRunningsum->fOutputVar.size(); i++) {
424 // calling CalculateRunningAverage in scope of VQwHardwareChannel
425 fRunningsum->fOutputVar[i]->CalculateRunningAverage();
426 }
427 }
428}

References fKeepRunningSum, and fRunningsum.

Referenced by QwCombinerSubsystem::CalculateRunningAverage(), QwDataHandlerArray::CalculateRunningAverage(), and FinishDataHandler().

+ Here is the caller graph for this function:

◆ ClearEventData()

void VQwDataHandler::ClearEventData ( )
virtual

Reimplemented in QwCombinerSubsystem, and QwCorrelator.

Definition at line 439 of file VQwDataHandler.cc.

440{
441 for(size_t i = 0; i < fOutputVar.size(); i++) {
442 fOutputVar[i]->ClearEventData();
443 }
444 if (fKeepRunningSum && fRunningsum!=NULL){
445 fRunningsum->ClearEventData();
446 }
447}

References fKeepRunningSum, fOutputVar, and fRunningsum.

Referenced by QwDataHandlerArray::ClearEventData().

+ Here is the caller graph for this function:

◆ ConnectChannels() [1/4]

Int_t VQwDataHandler::ConnectChannels ( QwHelicityPattern & helicitypattern)
inline

Definition at line 75 of file VQwDataHandler.h.

75 {
76 return this->ConnectChannels(
77 helicitypattern.GetYield(),
78 helicitypattern.GetAsymmetry(),
79 helicitypattern.GetDifference());
80 }
QwSubsystemArrayParity & GetDifference()
QwSubsystemArrayParity & GetYield()
QwSubsystemArrayParity & GetAsymmetry()
virtual Int_t ConnectChannels(QwSubsystemArrayParity &, QwSubsystemArrayParity &asym, QwSubsystemArrayParity &diff)

References ConnectChannels(), QwHelicityPattern::GetAsymmetry(), QwHelicityPattern::GetDifference(), and QwHelicityPattern::GetYield().

+ Here is the call graph for this function:

◆ ConnectChannels() [2/4]

virtual Int_t VQwDataHandler::ConnectChannels ( QwSubsystemArrayParity & )
inlinevirtual

Reimplemented in QwCombiner, and QwExtractor.

Definition at line 73 of file VQwDataHandler.h.

73{ return 0; }

◆ ConnectChannels() [3/4]

virtual Int_t VQwDataHandler::ConnectChannels ( QwSubsystemArrayParity & ,
QwSubsystemArrayParity & asym,
QwSubsystemArrayParity & diff )
inlinevirtual

Reimplemented in QwAlarmHandler.

Definition at line 68 of file VQwDataHandler.h.

68 {
69 return this->ConnectChannels(asym, diff);
70 }

References ConnectChannels().

Referenced by LRBCorrector::ConnectChannels(), ConnectChannels(), ConnectChannels(), and QwDataHandlerArray::LoadDataHandlersFromParameterFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConnectChannels() [4/4]

Int_t VQwDataHandler::ConnectChannels ( QwSubsystemArrayParity & asym,
QwSubsystemArrayParity & diff )
protectedvirtual

Connect to external pointers for dependent variables from asym/diff subsystem arrays, creating corresponding output variables as clones.

Fill vector of pointers to the relevant data elements

Reimplemented in LRBCorrector, QwCombiner, and QwCorrelator.

Definition at line 159 of file VQwDataHandler.cc.

159 {
161
162 /// Fill vector of pointers to the relevant data elements
163 for (size_t dv = 0; dv < fDependentName.size(); dv++) {
164 // Get the dependent variables
165 const VQwHardwareChannel* dv_ptr = 0;
166 VQwHardwareChannel* new_ptr = NULL;
167 string name = "";
168 string cor = "cor_";
169
170 if (fDependentType.at(dv)==kHandleTypeMps) {
171 // Quietly ignore the MPS type when we're connecting the asym & diff
172 continue;
173 } else if(fDependentName.at(dv).at(0) == '@' ) {
174 name = fDependentName.at(dv).substr(1,fDependentName.at(dv).length());
175 }else{
176 dv_ptr = this->RequestExternalPointer(fDependentFull.at(dv));
177 if (dv_ptr == NULL){
178 switch (fDependentType.at(dv)) {
179 case kHandleTypeAsym:
180 dv_ptr = asym.RequestExternalPointer(fDependentName.at(dv));
181 break;
182 case kHandleTypeDiff:
183 dv_ptr = diff.RequestExternalPointer(fDependentName.at(dv));
184 break;
185 default:
186 QwWarning << "QwCombiner::ConnectChannels(QwSubsystemArrayParity& asym, QwSubsystemArrayParity& diff): Dependent variable, "
187 << fDependentName.at(dv)
188 << ", for asym/diff processing does not have proper type, type=="
189 << fDependentType.at(dv) << "."<< QwLog::endl;
190 break;
191 }
192 }
193 if (dv_ptr == NULL){
194 QwWarning << "VQwDataHandler::ConnectChannels(QwSubsystemArrayParity& asym, QwSubsystemArrayParity& diff): Dependent variable, "
195 << fDependentName.at(dv)
196 << ", was not found (fullname=="
197 << fDependentFull.at(dv)<< ")." << QwLog::endl;
198 continue;
199 }
200
201 name = dv_ptr->GetElementName().Data();
202 name.insert(0, cor);
203 new_ptr = dv_ptr->Clone(VQwDataElement::kDerived);
204 new_ptr->SetElementName(name);
205 new_ptr->SetSubsystemName(fName);
206 }
207
208 // alias
209 if(fDependentName.at(dv).at(0) == '@') {
210 //QwMessage << "dv: " << name << QwLog::endl;
211 new_ptr = new QwVQWK_Channel(name, VQwDataElement::kDerived);
212 new_ptr->SetSubsystemName(fName);
213 }
214 // defined type
215 else if(dv_ptr!=NULL) {
216 //QwMessage << "dv: " << fDependentName.at(dv) << QwLog::endl;
217 }else {
218 QwWarning << "Dependent variable " << fDependentName.at(dv) << " could not be found, "
219 << "or is not a VQWK channel." << QwLog::endl;
220 continue;
221 }
222
223 // pair creation
224 if(new_ptr != NULL) {
225 fDependentVar.push_back(dv_ptr);
226 fOutputVar.push_back(new_ptr);
227 }
228 }
229 return 0;
230}
#define QwWarning
Predefined log drain for warnings.
Definition QwLog.h:44
const VQwHardwareChannel * RequestExternalPointer(const TString &name) const
const VQwHardwareChannel * RequestExternalPointer(const TString &name) const
Retrieve a direct pointer to an external variable Searches for the named variable in external subsyst...
void SetSubsystemName(TString sysname)
Set the name of the inheriting subsystem name.
virtual const TString & GetElementName() const
Get the name of this element.
void SetElementName(const TString &name)
Set the name of this element.
virtual VQwHardwareChannel * Clone() const
const UInt_t * GetEventcutErrorFlagPointer() const
std::vector< std::string > fDependentFull
void SetEventcutErrorFlagPointer(const UInt_t *errorflagptr)

References VQwHardwareChannel::Clone(), QwLog::endl(), fDependentFull, fDependentName, fDependentType, fDependentVar, fName, fOutputVar, VQwDataElement::GetElementName(), QwSubsystemArrayParity::GetEventcutErrorFlagPointer(), VQwDataElement::kDerived, kHandleTypeAsym, kHandleTypeDiff, kHandleTypeMps, QwWarning, MQwPublishable< U, T >::RequestExternalPointer(), MQwPublishable_child< QwDataHandlerArray, VQwDataHandler >::RequestExternalPointer(), VQwDataElement::SetElementName(), SetEventcutErrorFlagPointer(), and VQwDataElement::SetSubsystemName().

+ Here is the call graph for this function:

◆ ConstructBranchAndVector()

void VQwDataHandler::ConstructBranchAndVector ( TTree * tree,
TString & prefix,
QwRootTreeBranchVector & values )

Definition at line 298 of file VQwDataHandler.cc.

302{
303 for (size_t i = 0; i < fOutputVar.size(); ++i) {
304 fOutputVar.at(i)->ConstructBranchAndVector(tree, prefix, values);
305 }
306}

References fOutputVar.

Referenced by QwCombinerSubsystem::ConstructBranchAndVector(), and QwDataHandlerArray::ConstructBranchAndVector().

+ Here is the caller graph for this function:

◆ ConstructHistograms()

virtual void VQwDataHandler::ConstructHistograms ( TDirectory * ,
TString &  )
inlinevirtual

Construct the histograms in a folder with a prefix.

Reimplemented in QwCombinerSubsystem, and QwCorrelator.

Definition at line 122 of file VQwDataHandler.h.

122{ };

◆ ConstructNTupleFields()

void VQwDataHandler::ConstructNTupleFields ( QwRootFile * treerootfile,
const std::string & treeprefix = "",
const std::string & branchprefix = "" )
virtual

RNTuple methods.

Definition at line 320 of file VQwDataHandler.cc.

324{
325 if (fTreeName.size() > 0) {
326 if (fOutputVar.size() == 0) {
327 QwWarning << "No data handler output; not creating RNTuple "
328 << treeprefix + fTreeName
329 << QwLog::endl;
330 } else {
331 TString tmp_branchprefix(branchprefix.c_str());
332 if (tmp_branchprefix.Contains("stat") && fKeepRunningSum
333 && fRunningsum!=NULL){
334 fRunningsumFillsTree = kTRUE;
335 } else {
336 fRunningsumFillsTree = kFALSE;
337 }
338 fTreeName = treeprefix+fTreeName;
339#ifdef HAS_RNTUPLE_SUPPORT
341 treerootfile->ConstructNTupleFields(fTreeName, fTreeComment, *fRunningsum, fPrefix+branchprefix);
342 }else {
343 treerootfile->ConstructNTupleFields(fTreeName, fTreeComment, *this, fPrefix+branchprefix);
344 }
345#endif
346 }
347 }
348}
Bool_t fRunningsumFillsTree

References QwLog::endl(), fKeepRunningSum, fOutputVar, fPrefix, fRunningsum, fRunningsumFillsTree, fTreeComment, fTreeName, and QwWarning.

+ Here is the call graph for this function:

◆ ConstructTreeBranches()

void VQwDataHandler::ConstructTreeBranches ( QwRootFile * treerootfile,
const std::string & treeprefix = "",
const std::string & branchprefix = "" )
virtual

Construct TTree branches for output variables, using running sum if configured for statistics trees.

Reimplemented in QwCorrelator, and QwExtractor.

Definition at line 270 of file VQwDataHandler.cc.

274{
275 if (fTreeName.size() > 0) {
276 if (fOutputVar.size() == 0) {
277 QwWarning << "No data handler output; not creating tree "
278 << treeprefix + fTreeName
279 << QwLog::endl;
280 } else {
281 TString tmp_branchprefix(branchprefix.c_str());
282 if (tmp_branchprefix.Contains("stat") && fKeepRunningSum
283 && fRunningsum!=NULL){
284 fRunningsumFillsTree = kTRUE;
285 } else {
286 fRunningsumFillsTree = kFALSE;
287 }
288 fTreeName = treeprefix+fTreeName;
290 treerootfile->ConstructTreeBranches(fTreeName, fTreeComment, *fRunningsum, fPrefix+branchprefix);
291 }else {
292 treerootfile->ConstructTreeBranches(fTreeName, fTreeComment, *this, fPrefix+branchprefix);
293 }
294 }
295 }
296}
void ConstructTreeBranches(const std::string &name, const std::string &desc, T &object, const std::string &prefix="")
Construct the tree branches of a generic object.

References QwRootFile::ConstructTreeBranches(), QwLog::endl(), fKeepRunningSum, fOutputVar, fPrefix, fRunningsum, fRunningsumFillsTree, fTreeComment, fTreeName, and QwWarning.

+ Here is the call graph for this function:

◆ FillHistograms()

virtual void VQwDataHandler::FillHistograms ( )
inlinevirtual

Fill the histograms.

Reimplemented in QwCombinerSubsystem, and QwCorrelator.

Definition at line 124 of file VQwDataHandler.h.

124{ };

Referenced by QwDataHandlerArray::FillHistograms().

+ Here is the caller graph for this function:

◆ FillNTupleFields()

void VQwDataHandler::FillNTupleFields ( QwRootFile * treerootfile)
virtual

Definition at line 350 of file VQwDataHandler.cc.

351{
352 if (fTreeName.size()>0){
353#ifdef HAS_RNTUPLE_SUPPORT
355 treerootfile->FillNTupleFields(*fRunningsum);
356 } else {
357 treerootfile->FillNTupleFields(*this);
358 }
359#endif
360 }
361}

References fRunningsum, fRunningsumFillsTree, and fTreeName.

◆ FillTreeBranches()

void VQwDataHandler::FillTreeBranches ( QwRootFile * treerootfile)
virtual

Reimplemented in QwCorrelator, and QwExtractor.

Definition at line 308 of file VQwDataHandler.cc.

309{
310 if (fTreeName.size()>0){
312 treerootfile->FillTreeBranches(*fRunningsum);
313 } else {
314 treerootfile->FillTreeBranches(*this);
315 }
316 treerootfile->FillTree(fTreeName);
317 }
318}
Int_t FillTree(const std::string &name)
Fill the tree with name.
Definition QwRootFile.h:949
void FillTreeBranches(const std::string &name, const T &object)
Fill the tree branches of a generic object by tree name.

References QwRootFile::FillTree(), QwRootFile::FillTreeBranches(), fRunningsum, fRunningsumFillsTree, and fTreeName.

+ Here is the call graph for this function:

◆ FillTreeVector()

void VQwDataHandler::FillTreeVector ( QwRootTreeBranchVector & values) const

Fill tree vector with current output variable values.

Definition at line 367 of file VQwDataHandler.cc.

368{
369 // Fill the data element
370 for (size_t i = 0; i < fOutputVar.size(); ++i) {
371 if (fOutputVar.at(i) == NULL) {continue;}
372 fOutputVar.at(i)->FillTreeVector(values);
373 }
374}

References fOutputVar.

Referenced by QwCombinerSubsystem::FillTreeVector(), and QwDataHandlerArray::FillTreeVector().

+ Here is the caller graph for this function:

◆ FinishDataHandler()

virtual void VQwDataHandler::FinishDataHandler ( )
inlinevirtual

Reimplemented in QwCorrelator.

Definition at line 86 of file VQwDataHandler.h.

86 {
88 };
void CalculateRunningAverage()

References CalculateRunningAverage().

+ Here is the call graph for this function:

◆ GetEventcutErrorFlag()

UInt_t VQwDataHandler::GetEventcutErrorFlag ( ) const
inlineprotected

Definition at line 156 of file VQwDataHandler.h.

156 {
157 if (fErrorFlagPtr)
158 return *fErrorFlagPtr;
159 else
160 return -1;
161 };

References fErrorFlagPtr.

Referenced by QwCorrelator::ProcessData().

+ Here is the caller graph for this function:

◆ GetName()

TString VQwDataHandler::GetName ( )
inline

Definition at line 92 of file VQwDataHandler.h.

92{return fName;}

References fName.

Referenced by QwCorrelator::CalcCorrelations(), QwDataHandlerArray::push_back(), and LRBCorrector::UpdateBurstCounter().

+ Here is the caller graph for this function:

◆ InitRunningSum()

void VQwDataHandler::InitRunningSum ( )

Initialize running sum accumulator as a clone of this handler.

Definition at line 395 of file VQwDataHandler.cc.

396{
397 if (fKeepRunningSum && fRunningsum == NULL){
398 fRunningsum = this->Clone();
399 fRunningsum->fKeepRunningSum = kFALSE;
400 fRunningsum->ClearEventData();
401 }
402}

References fKeepRunningSum, and fRunningsum.

Referenced by QwDataHandlerArray::LoadDataHandlersFromParameterFile().

+ Here is the caller graph for this function:

◆ LoadChannelMap() [1/2]

Int_t VQwDataHandler::LoadChannelMap ( )
inline

Definition at line 139 of file VQwDataHandler.h.

139{return this->LoadChannelMap(fMapFile);}

References fMapFile, and LoadChannelMap().

Referenced by LoadChannelMap(), and QwDataHandlerArray::LoadDataHandlersFromParameterFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadChannelMap() [2/2]

virtual Int_t VQwDataHandler::LoadChannelMap ( const std::string & )
inlinevirtual

Reimplemented in LRBCorrector, QwAlarmHandler, QwCombiner, QwCorrelator, and QwExtractor.

Definition at line 140 of file VQwDataHandler.h.

140{return 0;};

◆ ParseConfigFile()

void VQwDataHandler::ParseConfigFile ( QwParameterFile & file)
virtual

Parse configuration file for map file, priority, tree settings.

Reimplemented in LRBCorrector, QwAlarmHandler, and QwCorrelator.

Definition at line 96 of file VQwDataHandler.cc.

96 {
97 file.RewindToFileStart();
98 file.EnableGreediness();
99 while (file.ReadNextLine()) {
100 QwMessage << file.GetLine() << QwLog::endl;
101 }
102 // Check for and process key-value pairs
103 file.PopValue("map",fMapFile);
104 file.PopValue("priority",fPriority);
105 file.PopValue("tree-name",fTreeName);
106 file.PopValue("tree-comment",fTreeComment);
107 file.PopValue("prefix",fPrefix);
108}
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
Bool_t PopValue(const std::string keyname, T &retvalue)
std::string GetLine()

References QwParameterFile::EnableGreediness(), QwLog::endl(), fMapFile, fPrefix, fPriority, fTreeComment, fTreeName, QwParameterFile::GetLine(), QwParameterFile::PopValue(), QwMessage, QwParameterFile::ReadNextLine(), and QwParameterFile::RewindToFileStart().

Referenced by QwDataHandlerArray::LoadDataHandlersFromParameterFile(), LRBCorrector::ParseConfigFile(), QwAlarmHandler::ParseConfigFile(), and QwCorrelator::ParseConfigFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ParseHandledVariable()

pair< VQwDataHandler::EQwHandleType, string > VQwDataHandler::ParseHandledVariable ( const std::string & variable)
protected

Parse a variable string to extract type (asym/diff/yield/mps) and name.

Returns
Pair of handle type and variable name.

Definition at line 238 of file VQwDataHandler.cc.

238 {
239
240 pair<EQwHandleType,string> type_name;
241 size_t len = variable.length();
242 size_t pos1 = variable.find_first_of(ParseSeparator);
243 size_t pos2 = variable.find_first_not_of(ParseSeparator,pos1);
244 if (pos1 == string::npos) {
245 type_name.first = kHandleTypeUnknown;
246 type_name.second = variable;
247 } else {
248 string type = variable.substr(0,pos1);
249 string name = variable.substr(pos2,len-pos2);
250 if (type == "asym")
251 {type_name.first = kHandleTypeAsym;}
252 else if (type == "diff")
253 {type_name.first = kHandleTypeDiff;}
254 else if (type == "yield")
255 {type_name.first = kHandleTypeYield;}
256 else if (type == "mps")
257 {type_name.first = kHandleTypeMps;}
258 else
259 {type_name.first = kHandleTypeUnknown;}
260 type_name.second = name;
261 }
262 return type_name;
263
264}

References kHandleTypeAsym, kHandleTypeDiff, kHandleTypeMps, kHandleTypeUnknown, kHandleTypeYield, and ParseSeparator.

Referenced by LRBCorrector::LoadChannelMap(), QwAlarmHandler::LoadChannelMap(), QwCombiner::LoadChannelMap(), and QwCorrelator::LoadChannelMap().

+ Here is the caller graph for this function:

◆ PrintValue()

void VQwDataHandler::PrintValue ( ) const

Definition at line 430 of file VQwDataHandler.cc.

431{
432 QwMessage<<"=== "<< fName << " ==="<<QwLog::endl<<QwLog::endl;
433 for(size_t i = 0; i < fOutputVar.size(); i++) {
434 fOutputVar[i]->PrintValue();
435 }
436}

References QwLog::endl(), fName, fOutputVar, and QwMessage.

Referenced by QwCombinerSubsystem::PrintValue(), and QwDataHandlerArray::PrintValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessData()

void VQwDataHandler::ProcessData ( )
virtual

Copy dependent variables to output variables (default processing).

Reimplemented in LRBCorrector, QwAlarmHandler, QwCombiner, QwCombinerSubsystem, QwCorrelator, and QwExtractor.

Definition at line 143 of file VQwDataHandler.cc.

143 {
144
145 for (size_t i = 0; i < fDependentVar.size(); ++i) {
146 *(fOutputVar.at(i)) = *(fDependentVar[i]);
147 }
148 for (size_t i = 0; i < fDependentValues.size(); ++i) {
150 }
151
152}
std::vector< Double_t > fDependentValues
std::vector< Double_t > fOutputValues

References fDependentValues, fDependentVar, fOutputValues, and fOutputVar.

Referenced by QwDataHandlerArray::ProcessEvent().

+ Here is the caller graph for this function:

◆ PublishByRequest()

Bool_t VQwDataHandler::PublishByRequest ( TString device_name)
overridevirtual

Try to publish an internal variable matching the submitted name.

Implements MQwPublishable_child< QwDataHandlerArray, VQwDataHandler >.

Definition at line 487 of file VQwDataHandler.cc.

488{
489 Bool_t status = kFALSE;
490 for(size_t i=0;i<fOutputVar.size(); ++i) {
491 if(device_name.CompareTo(fOutputVar.at(i)->GetElementName())==0){
492 status = PublishInternalValue(device_name, "published-by-request",
493 fOutputVar.at(i));
494 break;
495 }
496 }
497 if (!status && fOutputVar.size()>0)
498 QwDebug << "VQwDataHandler::PublishByRequest: Failed to publish channel name: " << device_name << QwLog::endl;
499 return status;
500}
#define QwDebug
Predefined log drain for debugging output.
Definition QwLog.h:59
Bool_t PublishInternalValue(const TString name, const TString desc, const VQwHardwareChannel *element) const

References QwLog::endl(), fOutputVar, MQwPublishable_child< QwDataHandlerArray, VQwDataHandler >::PublishInternalValue(), and QwDebug.

+ Here is the call graph for this function:

◆ PublishInternalValues()

Bool_t VQwDataHandler::PublishInternalValues ( ) const
overridevirtual

Publish all variables of the subsystem.

Implements MQwPublishable_child< QwDataHandlerArray, VQwDataHandler >.

Definition at line 451 of file VQwDataHandler.cc.

452{
453 // Publish variables
454 Bool_t status = kTRUE;
455 VQwHardwareChannel* tmp_channel = nullptr;
456
457 // Publish variables through map file
458 for (size_t pp = 0; pp < fPublishList.size(); pp++) {
459 TString publish_name = fPublishList.at(pp).at(0);
460 TString device_type = fPublishList.at(pp).at(1);
461 TString device_name = fPublishList.at(pp).at(2);
462 TString device_prop = fPublishList.at(pp).at(3);
463 device_type.ToLower();
464 device_prop.ToLower();
465
466 tmp_channel = NULL;
467
468 for(size_t i=0;i<fOutputVar.size(); ++i) {
469 if(device_name.CompareTo(fOutputVar.at(i)->GetElementName())==0){
470 tmp_channel = fOutputVar.at(i);
471 break;
472 }
473 }
474 if (tmp_channel == NULL) {
475 QwError << "VQwDataHandler::PublishInternalValues(): " << publish_name
476 << " not found" << QwLog::endl;
477 status &= kFALSE;
478 } else {
479 QwDebug << "VQwDataHandler::PublishInternalValues(): " << publish_name
480 << " found" << QwLog::endl;
481 status &= PublishInternalValue(publish_name, "published-value", tmp_channel);
482 }
483 }
484 return status;
485}
std::vector< std::vector< TString > > fPublishList

References QwLog::endl(), fOutputVar, fPublishList, MQwPublishable_child< QwDataHandlerArray, VQwDataHandler >::PublishInternalValue(), QwDebug, and QwError.

+ Here is the call graph for this function:

◆ SetEventcutErrorFlagPointer()

void VQwDataHandler::SetEventcutErrorFlagPointer ( const UInt_t * errorflagptr)
inlineprotected

Definition at line 153 of file VQwDataHandler.h.

153 {
154 fErrorFlagPtr = errorflagptr;
155 }

References fErrorFlagPtr.

Referenced by QwAlarmHandler::ConnectChannels(), QwCorrelator::ConnectChannels(), and ConnectChannels().

+ Here is the caller graph for this function:

◆ SetPointer() [1/2]

void VQwDataHandler::SetPointer ( QwHelicityPattern * ptr)
inline

Definition at line 59 of file VQwDataHandler.h.

59 {
60 fHelicityPattern = ptr;
62 };
const UInt_t * GetEventcutErrorFlagPointer() const

References fErrorFlagPtr, fHelicityPattern, and QwHelicityPattern::GetEventcutErrorFlagPointer().

Referenced by QwDataHandlerArray::LoadDataHandlersFromParameterFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetPointer() [2/2]

void VQwDataHandler::SetPointer ( QwSubsystemArrayParity * ptr)
inline

Definition at line 63 of file VQwDataHandler.h.

63 {
64 fSubsystemArray = ptr;
66 };

References fErrorFlagPtr, fSubsystemArray, and QwSubsystemArrayParity::GetEventcutErrorFlagPointer().

+ Here is the call graph for this function:

◆ SetRunLabel()

void VQwDataHandler::SetRunLabel ( TString x)
inline

Definition at line 135 of file VQwDataHandler.h.

135 {
136 run_label = x;
137 }

References run_label.

Referenced by QwDataHandlerArray::LoadDataHandlersFromParameterFile().

+ Here is the caller graph for this function:

◆ UpdateBurstCounter()

virtual void VQwDataHandler::UpdateBurstCounter ( Short_t burstcounter)
inlinevirtual

Reimplemented in LRBCorrector.

Definition at line 84 of file VQwDataHandler.h.

84{fBurstCounter=burstcounter;};

References fBurstCounter.

◆ WritePromptSummary()

void VQwDataHandler::WritePromptSummary ( QwPromptSummary * ps,
TString type )

Definition at line 502 of file VQwDataHandler.cc.

503{
504 Bool_t local_print_flag = false;
505 Bool_t local_add_element= type.Contains("asy");
506
507
508 if(local_print_flag){
509 QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
510 QwMessage << " QwDataHandlerArray::WritePromptSummary() " << QwLog::endl;
511 QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
512 }
513
514 const VQwHardwareChannel* tmp_channel = 0;
515 TString element_name = "";
516 Double_t element_value = 0.0;
517 Double_t element_value_err = 0.0;
518 Double_t element_value_width = 0.0;
519
520 PromptSummaryElement *local_ps_element = NULL;
521 Bool_t local_add_these_elements= false;
522
523 for (size_t i = 0; i < fOutputVar.size(); i++)
524 {
525 element_name = fOutputVar[i]->GetElementName();
526 tmp_channel = fOutputVar[i];
527 element_value = 0.0;
528 element_value_err = 0.0;
529 element_value_width = 0.0;
530
531
532 local_add_these_elements=element_name.Contains("dd")||element_name.Contains("da"); // Need to change this to add other detectors in summary
533
534 if(local_add_these_elements && local_add_element){
535 ps->AddElement(new PromptSummaryElement(element_name));
536 }
537
538 local_ps_element=ps->GetElementByName(element_name);
539
540 if(local_ps_element) {
541 element_value = tmp_channel->GetValue();
542 element_value_err = tmp_channel->GetValueError();
543 element_value_width = tmp_channel->GetValueWidth();
544
545 local_ps_element->Set(type, element_value, element_value_err, element_value_width);
546 }
547
548 if( local_print_flag && local_ps_element) {
549 printf("Type %12s, Element %32s, value %12.4e error %8.4e width %12.4e\n", type.Data(), element_name.Data(), element_value, element_value_err, element_value_width);
550 }
551 }
552
553}
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)
Double_t GetValueError() const
Double_t GetValueWidth() const
Double_t GetValue() const

References QwPromptSummary::AddElement(), QwLog::endl(), fOutputVar, QwPromptSummary::GetElementByName(), VQwHardwareChannel::GetValue(), VQwHardwareChannel::GetValueError(), VQwHardwareChannel::GetValueWidth(), QwMessage, and PromptSummaryElement::Set().

Referenced by QwDataHandlerArray::WritePromptSummary().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ fBurstCounter

Short_t VQwDataHandler::fBurstCounter
protected

When a datahandler array is processed, handlers with lower priority will be processed before handlers with higher priority.

Definition at line 173 of file VQwDataHandler.h.

Referenced by LRBCorrector::ProcessData(), LRBCorrector::UpdateBurstCounter(), UpdateBurstCounter(), VQwDataHandler(), and VQwDataHandler().

◆ fDependentFull

◆ fDependentName

◆ fDependentType

◆ fDependentValues

std::vector< Double_t > VQwDataHandler::fDependentValues
protected

◆ fDependentVar

◆ fErrorFlagPtr

const UInt_t* VQwDataHandler::fErrorFlagPtr
protected

◆ fHelicityPattern

QwHelicityPattern* VQwDataHandler::fHelicityPattern
protected

Helicity pattern pointer.

Definition at line 191 of file VQwDataHandler.h.

Referenced by SetPointer(), VQwDataHandler(), and VQwDataHandler().

◆ fKeepRunningSum

◆ fMapFile

std::string VQwDataHandler::fMapFile
protected

Definition at line 177 of file VQwDataHandler.h.

Referenced by LoadChannelMap(), ParseConfigFile(), VQwDataHandler(), and VQwDataHandler().

◆ fName

◆ fOutputValues

std::vector< Double_t > VQwDataHandler::fOutputValues
protected

Definition at line 201 of file VQwDataHandler.h.

Referenced by ProcessData().

◆ fOutputVar

◆ fPrefix

std::string VQwDataHandler::fPrefix
protected

◆ fPriority

Int_t VQwDataHandler::fPriority
protected

Definition at line 171 of file VQwDataHandler.h.

Referenced by ParseConfigFile(), VQwDataHandler(), and VQwDataHandler().

◆ fPublishList

std::vector<std::vector<TString> > VQwDataHandler::fPublishList
protected

Definition at line 203 of file VQwDataHandler.h.

Referenced by QwCombiner::LoadChannelMap(), and PublishInternalValues().

◆ fRunningsum

◆ fRunningsumFillsTree

Bool_t VQwDataHandler::fRunningsumFillsTree
protected

◆ fSubsystemArray

QwSubsystemArrayParity* VQwDataHandler::fSubsystemArray
protected

Single event pointer.

Definition at line 189 of file VQwDataHandler.h.

Referenced by SetPointer(), VQwDataHandler(), and VQwDataHandler().

◆ fTreeComment

◆ fTreeName

◆ ParseSeparator

◆ run_label

TString VQwDataHandler::run_label
protected

The documentation for this class was generated from the following files: