JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwExtractor.cc
Go to the documentation of this file.
1/*
2 * QwExtractor.cc
3 *
4 * Created on: Nov 22, 2019
5 * Author: cameronc137
6 *
7 */
8
9#include "QwExtractor.h"
10
11// System includes
12#include <utility>
13
14// ROOT headers
15#include "TFile.h"
16
17// Qweak headers
18#include "QwOptions.h"
19#include "QwHelicityPattern.h"
20#include "VQwDataElement.h"
21#include "QwVQWK_Channel.h"
22#include "QwParameterFile.h"
23#include "QwRootFile.h"
24
25
26/// \brief Constructor with name
27QwExtractor::QwExtractor(const TString& name)
28: VQwDataHandler(name)
29{
30 ParseSeparator = ":";
31 fKeepRunningSum = kTRUE;
32 fTreeName = "bmw";
33 fTreeComment = "BMOD Extractor";
34 fErrorFlagMask = 0x9000;
36
37}
38
40: VQwDataHandler(source)
41{
42 fErrorFlagMask = 0x9000;
44}
45
46/// Destructor
48
49Int_t QwExtractor::LoadChannelMap(const std::string& mapfile) {return 0;}
50
51/** Connect to the dependent and independent channels (implementation) */
53{
54 // Keep a pointer to the source Detectors/RingOutput
55 //fSourcePointer = &event;
56 SetPointer(&event);
58 // Make a copy of RingOutput
59 // Normal ConnectChannels for the test variable/ErrorFlag
60 // Store error flag pointer
61 QwMessage << "Using event error flag" << QwLog::endl;
62 fErrorFlagPointer = event.GetEventcutErrorFlagPointer();
63 return 0;
64}
65
67 QwRootFile *treerootfile,
68 const std::string& treeprefix,
69 const std::string& branchprefix)
70{
71 // Check if tree name is specified
72 if (fTreeName == "") {
73 QwWarning << "QwCorrelator: no tree name specified, use 'tree-name = value'" << QwLog::endl;
74 return;
75 }
76
77 // Construct tree name and create new tree
78 fTreeName = treeprefix + fTreeName;
80 //fTree = treerootfile->GetTree(fTreeName);
81}
82
84{
85 fLocalFlag = 0;
86 if (fErrorFlagMask!=0 && fErrorFlagPointer!=NULL) {
88 //QwMessage << "0x" << std::hex << *fErrorFlagPointer << " passed mask " << "0x" << std::hex << fErrorFlagMask << std::dec << QwLog::endl;
89 fLocalFlag = 1;
90 fSourceCopy->operator=(*fSourcePointer);
91 }// else {
92 // QwMessage << "0x" << std::hex << *fErrorFlagPointer << " failed mask " << "0x" << std::hex << fErrorFlagMask << std::dec << QwLog::endl;
93 // }
94 }
95 else{
96 fLocalFlag = 1;
97 fSourceCopy->operator=(*fSourcePointer);
98 }
99}
100
102{
103 if (fTreeName.size()>0 && fLocalFlag == 1 ){
104 //QwMessage << fLocalFlag << " passed mask " << "0x" << std::hex<< fErrorFlagMask << std::dec << QwLog::endl;
105 treerootfile->FillTreeBranches(*fSourceCopy);
106 treerootfile->FillTree(fTreeName);
107 }
108 //else {
109 // QwMessage << fLocalFlag << " failed mask " << "0x" << fErrorFlagMask << std::dec << QwLog::endl;
110 //}
111}
An options class which parses command line, config file and environment.
#define QwWarning
Predefined log drain for warnings.
Definition QwLog.h:44
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
ROOT file and tree management wrapper classes.
Parameter file parsing and management.
Definition of the pure virtual base class of all data elements.
Decoding and management for VQWK ADC channels (6x32-bit datawords)
Data extraction handler for output processing.
Helicity pattern analysis and management.
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
A wrapper class for a ROOT file or memory mapped file.
Definition QwRootFile.h:833
Int_t FillTree(const std::string &name)
Fill the tree with name.
Definition QwRootFile.h:955
void ConstructTreeBranches(const std::string &name, const std::string &desc, T &object, const std::string &prefix="")
Construct the tree branches of a generic object.
void FillTreeBranches(const std::string &name, const T &object)
Fill the tree branches of a generic object by tree name.
QwSubsystemArrayParity * fSourceCopy
Definition QwExtractor.h:56
void SetPointer(QwSubsystemArrayParity *ptr)
Definition QwExtractor.h:44
const UInt_t * fErrorFlagPointer
Definition QwExtractor.h:52
Int_t ConnectChannels(QwSubsystemArrayParity &event) override
Connect to channels (event-only extraction).
Int_t fLocalFlag
Definition QwExtractor.h:53
void FillTreeBranches(QwRootFile *treerootfile) override
QwExtractor(const TString &name)
Constructor with name.
void ConstructTreeBranches(QwRootFile *treerootfile, const std::string &treeprefix="", const std::string &branchprefix="") override
void ProcessData() override
UInt_t fErrorFlagMask
Default constructor (Protected for child class access)
Definition QwExtractor.h:51
~QwExtractor() override
Virtual destructor.
Subsystem array container specialized for parity analysis with asymmetry calculations.
VQwDataHandler(const TString &name)
std::string ParseSeparator
std::string fTreeComment
std::string fTreeName