87 "print correlations after determining them");
106 QwWarning <<
"QwCorrelator: expect 0 <= block <= 3 but block = "
140 linReg += std::make_pair(P, Y);
166 QwWarning <<
"QwCorrelator::AccumulateRunningSum "
167 <<
"can only accept other QwCorrelator objects."
175 if (
nP == 0 ||
nY == 0) {
189 <<
"< 1% good events, "
196 QwVerbose <<
" Entries failed due to error flag: "
224 linReg.printSummaryAlphas();
225 linReg.printSummaryMeansWithUnc();
226 linReg.printSummaryMeansWithUncCorrected();
251 std::pair<EQwHandleType,std::string> type_name;
265 if (primary_token ==
"iv") {
270 else if (primary_token ==
"dv") {
275 else if (primary_token ==
"treetype") {
279 QwError <<
"LoadChannelMap in QwCorrelator read invalid primary_token " << primary_token <<
QwLog::endl;
313 QwWarning <<
"QwCorrelator::ConnectChannels(QwSubsystemArrayParity& asym, QwSubsystemArrayParity& diff): "
315 <<
", for asym/diff correlator does not have proper type, type=="
321 QwWarning <<
"QwCombiner::ConnectChannels(QwSubsystemArrayParity& asym, QwSubsystemArrayParity& diff): Dependent variable, "
323 <<
", was not found (fullname=="
351 QwWarning <<
"Independent variable for correlator has unknown type."
382 const std::string& treeprefix,
383 const std::string& branchprefix)
386 if (
nP == 0 ||
nY == 0) {
401 const std::string name = treeprefix +
fTreeName;
405 if (
fTree == NULL)
return;
411 fTree->Branch(TString(branchprefix +
"n"), &(
linReg.fGoodEventNumber));
412 fTree->Branch(TString(branchprefix +
"ErrorFlag"), &(
linReg.fErrorFlag));
414 auto bn = [&](
const TString& n) {
415 return TString(branchprefix + n);
417 auto pm = [](TMatrixD& m) {
418 return m.GetMatrixArray();
420 auto lm = [](TMatrixD& m,
const TString& n) {
421 return Form(
"%s[%d][%d]/D", n.Data(), m.GetNrows(), m.GetNcols());
423 auto branchm = [&](TTree* tree, TMatrixD& m,
const TString& n) {
424 tree->Branch(bn(n),pm(m),lm(m,n));
426 auto pv = [](TVectorD& v) {
427 return v.GetMatrixArray();
429 auto lv = [](TVectorD& v,
const TString& n) {
430 return Form(
"%s[%d]/D", n.Data(), v.GetNrows());
432 auto branchv = [&](TTree* tree, TVectorD& v,
const TString& n) {
433 tree->Branch(bn(n),pv(v),lv(v,n));
474 if (
nP == 0 ||
nY == 0) {
480 name.ReplaceAll(
" ",
"_");
481 folder->mkdir(name)->cd();
485 for (
int i = 0; i <
nP; i++) {
490 fH1iv[i].GetXaxis()->SetNdivisions(4);
496 for (
int i = 0; i <
nP; i++) {
498 for (
int j = i+1; j <
nP; j++) {
501 Form(
"iv correlation P%d_P%d, pass=%s ;P%d=%s (ppm);P%d=%s (ppm) ",
505 fH2iv[i][j].GetXaxis()->SetTitleColor(kBlue);
506 fH2iv[i][j].GetYaxis()->SetTitleColor(kBlue);
507 fH2iv[i][j].GetXaxis()->SetNdivisions(4);
508 fH2iv[i][j].GetYaxis()->SetNdivisions(4);
514 for (
int i = 0; i <
nY; i++) {
519 fH1dv[i].GetXaxis()->SetNdivisions(4);
525 for (
int i = 0; i <
nP; i++) {
527 for (
int j = 0; j <
nY; j++) {
530 Form(
"iv-dv correlation P%d_Y%d, pass=%s ;P%d=%s (ppm);Y%d=%s (ppm) ",
534 fH2dv[i][j].GetXaxis()->SetTitleColor(kBlue);
535 fH2dv[i][j].GetYaxis()->SetTitleColor(kBlue);
536 fH2dv[i][j].GetXaxis()->SetNdivisions(4);
537 fH2dv[i][j].GetYaxis()->SetNdivisions(4);
543 fHnames[0] = TH1D(
"NamesIV",Form(
"IV name list nIV=%d",
nP),
nP,0,1);
544 for (
int i = 0; i <
nP; i++)
546 fHnames[1] = TH1D(
"NamesDV",Form(
"DV name list nIV=%d",
nY),
nY,0,1);
547 for (
int i = 0; i <
nY; i++)
558 if (
nP == 0 ||
nY == 0) {
584 linReg.Axy.Write(
"slopes");
585 linReg.dAxy.Write(
"sigSlopes");
587 linReg.mRPP.Write(
"IV_IV_correlation");
588 linReg.mRPY.Write(
"IV_DV_correlation");
589 linReg.mRYY.Write(
"DV_DV_correlation");
590 linReg.mRYYp.Write(
"DV_DV_correlation_prime");
592 linReg.mMP.Write(
"IV_mean");
593 linReg.mMY.Write(
"DV_mean");
594 linReg.mMYp.Write(
"DV_mean_prime");
598 Mstat(0,0)=
linReg.getUsedEve();
599 Mstat.Write(
"MyStat");
602 TH1D hiv(
"IVname",
"names of IVs",
nP,-0.5,
nP-0.5);
607 TH1D hdv(
"DVname",
"names of IVs",
nY,-0.5,
nY-0.5);
612 linReg.mSP.Write(
"IV_sigma");
613 linReg.mSY.Write(
"DV_sigma");
614 linReg.mSYp.Write(
"DV_sigma_prime");
617 linReg.mVPP.Write(
"IV_IV_rawVariance");
618 linReg.mVPY.Write(
"IV_DV_rawVariance");
619 linReg.mVYY.Write(
"DV_DV_rawVariance");
620 linReg.mVYYp.Write(
"DV_DV_rawVariance_prime");
621 TVectorD mVY2(TMatrixDDiag(
linReg.mVYY));
622 mVY2.Write(
"DV_rawVariance");
623 TVectorD mVP2(TMatrixDDiag(
linReg.mVPP));
624 mVP2.Write(
"IV_rawVariance");
625 TVectorD mVY2prime(TMatrixDDiag(
linReg.mVYYp));
626 mVY2prime.Write(
"DV_rawVariance_prime");
629 linReg.mSPP.Write(
"IV_IV_normVariance");
630 linReg.mSPY.Write(
"IV_DV_normVariance");
631 linReg.mSYY.Write(
"DV_DV_normVariance");
632 linReg.mSYYp.Write(
"DV_DV_normVariance_prime");
633 TVectorD sigY2(TMatrixDDiag(
linReg.mSYY));
634 sigY2.Write(
"DV_normVariance");
635 TVectorD sigX2(TMatrixDDiag(
linReg.mSPP));
636 sigX2.Write(
"IV_normVariance");
637 TVectorD sigY2prime(TMatrixDDiag(
linReg.mSYYp));
638 sigY2prime.Write(
"DV_normVariance_prime");
649 std::string file = path + name;
650 fAlphaOutputFile =
new TFile(TString(file),
"RECREATE",
"correlation coefficients");
663 std::replace(label.begin(), label.end(),
'.',
'_');
667 std::string file = path + name +
".C";
670 fAliasOutputFile << Form(
"void %s(int i = 0) {", name.c_str()) << std::endl;
708 fAliasOutputFile << Form(
" TTree* tree = (TTree*) gDirectory->Get(\"mul\");") << std::endl;
709 for (
int i = 0; i <
nY; i++) {
712 for (
int j = 0; j <
nP; j++) {
An options class which parses command line, config file and environment.
Decoding and management for VQWK ADC channels (6x32-bit datawords)
ROOT file and tree management wrapper classes.
Definition of the pure virtual base class of all data elements.
Parameter file parsing and management.
#define QwVerbose
Predefined log drain for verbose messages.
#define QwError
Predefined log drain for errors.
#define QwWarning
Predefined log drain for warnings.
#define QwMessage
Predefined log drain for regular messages.
Helicity pattern analysis and management.
Correlator data handler using LinRegBlue algorithms.
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...
static std::ostream & endl(std::ostream &)
End of the line.
Command-line and configuration file options processor.
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
Configuration file parser with flexible tokenization and search capabilities.
Bool_t PopValue(const std::string keyname, T &retvalue)
void TrimWhitespace(TString::EStripType head_tail=TString::kBoth)
void TrimComment(const char commentchar)
std::string GetNextToken(const std::string &separatorchars)
Get next token as a string.
A wrapper class for a ROOT file or memory mapped file.
void NewTree(const std::string &name, const std::string &desc)
Create a new tree with name and description.
TTree * GetTree(const std::string &name)
Get the tree with name.
Abstract base for concrete hardware channels implementing dual-operator pattern.
std::vector< std::string > fIndependentName
void OpenAliasFile(const std::string &prefix)
std::string fAlphaOutputPath
void ClearEventData() override
std::string fAliasOutputFileBase
void OpenAlphaFile(const std::string &prefix)
void ProcessData() override
QwCorrelator(const TString &name)
Constructor with name.
std::vector< std::vector< TH2D > > fH2iv
std::vector< Double_t > fIndependentValues
std::string fAlphaOutputFileBase
std::vector< EQwHandleType > fIndependentType
std::string fAliasOutputPath
std::ofstream fAliasOutputFile
Int_t ConnectChannels(QwSubsystemArrayParity &asym, QwSubsystemArrayParity &diff) override
Connect to Channels (asymmetry/difference only)
void ConstructTreeBranches(QwRootFile *treerootfile, const std::string &treeprefix="", const std::string &branchprefix="") override
Construct the tree branches.
void ParseConfigFile(QwParameterFile &file) override
static bool fPrintCorrelations
void ConstructHistograms(TDirectory *folder, TString &prefix) override
Construct the histograms in a folder with a prefix.
std::vector< std::string > fIndependentFull
std::vector< const VQwHardwareChannel * > fIndependentVar
std::string fAlphaOutputFileSuff
std::vector< TH1D > fHnames
std::vector< TH1D > fH1dv
std::string fAliasOutputFileSuff
std::vector< std::vector< TH2D > > fH2dv
std::vector< TH1D > fH1iv
void ProcessOptions(QwOptions &options)
std::vector< int > fErrCounts_DV
void FillHistograms() override
Fill the histograms.
std::vector< int > fErrCounts_IV
static void DefineOptions(QwOptions &options)
Subsystem array container specialized for parity analysis with asymmetry calculations.
const UInt_t * GetEventcutErrorFlagPointer() const
std::vector< std::string > fDependentFull
void AccumulateRunningSum()
void SetEventcutErrorFlagPointer(const UInt_t *errorflagptr)
std::vector< Double_t > fDependentValues
virtual void ParseConfigFile(QwParameterFile &file)
std::vector< const VQwHardwareChannel * > fDependentVar
UInt_t GetEventcutErrorFlag() const
VQwDataHandler(const TString &name)
std::string ParseSeparator
std::pair< EQwHandleType, std::string > ParseHandledVariable(const std::string &variable)
std::vector< EQwHandleType > fDependentType
std::vector< std::string > fDependentName