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// Register this handler with the factory
27
28
29/// \brief Constructor with name
30QwExtractor::QwExtractor(const TString& name)
31: VQwDataHandler(name)
32{
33 ParseSeparator = ":";
34 fKeepRunningSum = kTRUE;
35 fTreeName = "bmw";
36 fTreeComment = "BMOD Extractor";
37 fErrorFlagMask = 0x9000;
39
40}
41
43: VQwDataHandler(source)
44{
45 fErrorFlagMask = 0x9000;
47}
48
49/// Destructor
51
52Int_t QwExtractor::LoadChannelMap(const std::string& mapfile) {return 0;}
53
54/** Connect to the dependent and independent channels (implementation) */
56{
57 // Keep a pointer to the source Detectors/RingOutput
58 //fSourcePointer = &event;
59 SetPointer(&event);
61 // Make a copy of RingOutput
62 // Normal ConnectChannels for the test variable/ErrorFlag
63 // Store error flag pointer
64 QwMessage << "Using event error flag" << QwLog::endl;
65 fErrorFlagPointer = event.GetEventcutErrorFlagPointer();
66 return 0;
67}
68
70 QwRootFile *treerootfile,
71 const std::string& treeprefix,
72 const std::string& branchprefix)
73{
74 // Check if tree name is specified
75 if (fTreeName == "") {
76 QwWarning << "QwCorrelator: no tree name specified, use 'tree-name = value'" << QwLog::endl;
77 return;
78 }
79
80 // Construct tree name and create new tree
81 fTreeName = treeprefix + fTreeName;
83 //fTree = treerootfile->GetTree(fTreeName);
84}
85
87{
88 fLocalFlag = 0;
89 if (fErrorFlagMask!=0 && fErrorFlagPointer!=NULL) {
91 //QwMessage << "0x" << std::hex << *fErrorFlagPointer << " passed mask " << "0x" << std::hex << fErrorFlagMask << std::dec << QwLog::endl;
92 fLocalFlag = 1;
93 fSourceCopy->operator=(*fSourcePointer);
94 }// else {
95 // QwMessage << "0x" << std::hex << *fErrorFlagPointer << " failed mask " << "0x" << std::hex << fErrorFlagMask << std::dec << QwLog::endl;
96 // }
97 }
98 else{
99 fLocalFlag = 1;
100 fSourceCopy->operator=(*fSourcePointer);
101 }
102}
103
105{
106 if (fTreeName.size()>0 && fLocalFlag == 1 ){
107 //QwMessage << fLocalFlag << " passed mask " << "0x" << std::hex<< fErrorFlagMask << std::dec << QwLog::endl;
108 treerootfile->FillTreeBranches(*fSourceCopy);
109 treerootfile->FillTree(fTreeName);
110 }
111 //else {
112 // QwMessage << fLocalFlag << " failed mask " << "0x" << fErrorFlagMask << std::dec << QwLog::endl;
113 //}
114}
115
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)
#define REGISTER_DATA_HANDLER_FACTORY(A)
Definition QwFactory.h:263
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:827
Int_t FillTree(const std::string &name)
Fill the tree with name.
Definition QwRootFile.h:949
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.
Data handler that extracts values into output trees/files.
Definition QwExtractor.h:22
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