Skip to content

Commit

Permalink
Merge pull request #300 from JeffersonLab/develop
Browse files Browse the repository at this point in the history
Merge the current develop back into the master branch
  • Loading branch information
paulmking authored Jun 5, 2020
2 parents 0c3b9d8 + c08f5f3 commit 688dda4
Show file tree
Hide file tree
Showing 814 changed files with 31,641 additions and 4,730 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ z_*

# setup files
SetupFiles/SET_ME_UP.*

# Max burst indices
Parity/prminput/max_burst_index.*
12 changes: 10 additions & 2 deletions Analysis/prminput/EpicsTable.5275-.map
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,19 @@ FB_C:BPM:N6:pos_asym.VALB slow_controls_data float !
FB_C:BPM:N7:pos_asym.VALA slow_controls_data float !
FB_C:BPM:N7:pos_asym.VALB slow_controls_data float !
CTD673 slow_controls_data float !
!!!
RTPPITA1CNT slow_controls_data float !
RTPPITA2CNT slow_controls_data float !
RTPQWP1CNT slow_controls_data float !
RTPQWP2CNT slow_controls_data float !
RTPAPOSUCNT slow_controls_data float !
RTPAPOSVCNT slow_controls_data float !
RTPDPOSUCNT slow_controls_data float !
RTPDPOSVCNT slow_controls_data float !
!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Composite slow control variables
! These are variables for which there is not an actual EPICS variable,
! but a value is generated internally by the QwEPICSEvent class.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WienMode slow_controls_data String ! This will indicate the spin direction in the hall as defined by the Wien setting + precession
RTPAPOSUCNT slow_controls_data float !
RTPAPOSVCNT slow_controls_data float !
372 changes: 372 additions & 0 deletions Analysis/prminput/EpicsTable.5380-.map

Large diffs are not rendered by default.

21 changes: 17 additions & 4 deletions Analysis/prminput/EpicsTable.map
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ IBC3H00CRCUR4 slow_controls_data float ! Beam Current (Hall C), Hall C Curre
IGL1I00OD16_16 slow_controls_data string ! another HWP, INSERTABLE waveplate
IGL1I00DIOFLRD slow_controls_data float ! Fake Half-Wave Plate (8960=OUT)
APEXPOS slow_controls_data float ! Target encoder position
pcrex90BDSPOS.VAL slow_controls_data float ! Target encoder position
pcrex90BDS_PullString.VAL slow_controls_data float ! Target encoder position
pcrex90BDSPOS.VAL slow_controls_data float ! PREX/CREX Production Target encoder position
pcrex90_PullString.VAL slow_controls_data float ! PREX/CREX Production Target encoder position
pcrex45BDSPOS.VAL slow_controls_data float ! PREX/CREX Optics Target encoder position
pcrex45_PullString.VAL slow_controls_data float ! PREX/CREX Optics Target encoder position
HALLA:dpp slow_controls_data float ! Tiefenbach 6GeV orbit correction (dpp), Hall A momentum orbit correction (dpp)
INJ:p slow_controls_data float ! Injector Measured Energy
ARC1:p slow_controls_data float !
Expand All @@ -67,6 +69,7 @@ EHAR_B_IXPEAK slow_controls_data float ! Fast Raster-B Ix
EHAR_B_IYPEAK slow_controls_data float ! Fast Raster-B Iy
halla_MeV slow_controls_data float ! Hall A energy (halla_MeV), Tiefenbach energy
hallc_MeV slow_controls_data float ! Hall C energy (hallc_MeV)
MQ171LM slow_controls_data float ! Left Arm Q1 readback current
HacL_Q1_P0rb slow_controls_data float ! Left Arm Q1 momentum
HacL_Q1_LS450:FLD_DATA slow_controls_data float ! Left Arm Q1 gauss meter
HacL_Q2_HP3458A:IOUT slow_controls_data float ! Left Arm Q2 power supply current
Expand All @@ -92,6 +95,8 @@ HacR_Q3_P0rb slow_controls_data float ! Right Arm Q3 momentum
HacR_Q3_LS450:FLD_DATA slow_controls_data float ! Right Arm Q3 gauss meter
HacR_VMIC1182:0_Ch26 slow_controls_data string ! Right Arm Q3 power supply polarity
HacR_D_LS450:FLD_DATA slow_controls_data float ! Right Arm B Field Hall Probe (D-G)
MSUPERBIGBITEreadcalc slow_controls_data float ! Septum current 1
hesDipole_current slow_controls_data float ! Septum current 2
HrsH_VDC_rCURTop slow_controls_data float ! Left Arm Top VDC Current
HrsH_VDC_rCURBot slow_controls_data float ! Left Arm Bottom VDC Current
HrsH_VDC_rHVTop slow_controls_data float ! Left Arm Top VDC voltage
Expand Down Expand Up @@ -349,11 +354,19 @@ FB_C:BPM:N6:pos_asym.VALB slow_controls_data float !
FB_C:BPM:N7:pos_asym.VALA slow_controls_data float !
FB_C:BPM:N7:pos_asym.VALB slow_controls_data float !
CTD673 slow_controls_data float !
!!!
RTPPITA1CNT slow_controls_data float !
RTPPITA2CNT slow_controls_data float !
RTPQWP1CNT slow_controls_data float !
RTPQWP2CNT slow_controls_data float !
RTPAPOSUCNT slow_controls_data float !
RTPAPOSVCNT slow_controls_data float !
RTPDPOSUCNT slow_controls_data float !
RTPDPOSVCNT slow_controls_data float !
!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Composite slow control variables
! These are variables for which there is not an actual EPICS variable,
! but a value is generated internally by the QwEPICSEvent class.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WienMode slow_controls_data String ! This will indicate the spin direction in the hall as defined by the Wien setting + precession
RTPAPOSUCNT slow_controls_data float !
RTPAPOSVCNT slow_controls_data float !
23 changes: 17 additions & 6 deletions Analysis/src/QwEPICSEvent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1344,16 +1344,27 @@ void QwEPICSEvent::WriteEPICSStringValues()

Int_t QwEPICSEvent::DetermineIHWPPolarity() const{
Int_t ihwppolarity = 0;
if (GetDataString("IGL1I00DI24_24M")=="OUT"
|| GetDataString("IGL1I00DI24_24M")=="1"){
if (GetDataString("IGL1I00OD16_16")=="OUT"
|| GetDataString("IGL1I00OD16_16")=="0"){
ihwppolarity = 1;
} else if (GetDataString("IGL1I00DI24_24M")=="IN"
|| GetDataString("IGL1I00DI24_24M")=="0"){
} else if (GetDataString("IGL1I00OD16_16")=="IN"
|| GetDataString("IGL1I00OD16_16")=="1"){
ihwppolarity = -1;
} else {
QwWarning << "IHWP state is not well defined: '"
<< GetDataString("IGL1I00DI24_24M") << "'"
<< QwLog::endl;
<< GetDataString("IGL1I00OD16_16") << "'"
<< QwLog::endl;
if (GetDataString("IGL1I00DI24_24M")=="OUT"
|| GetDataString("IGL1I00DI24_24M")=="1"){
ihwppolarity = 1;
} else if (GetDataString("IGL1I00DI24_24M")=="IN"
|| GetDataString("IGL1I00DI24_24M")=="0"){
ihwppolarity = -1;
} else {
QwWarning << "IHWP state is not well defined: '"
<< GetDataString("IGL1I00DI24_24M") << "'"
<< QwLog::endl;
}
}
QwDebug << "QwEPICSEvent::DetermineIHWPPolarity: "
<< "raw IHWP polarity is: "
Expand Down
2 changes: 1 addition & 1 deletion Analysis/src/QwParameterFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ std::pair<int,int> QwParameterFile::ParseIntRange(const std::string& separatorch
QwError << "The first value must not be negative!" << QwLog::endl;
return std::pair<int,int>(INT_MAX,INT_MAX);
} else if (mypair.first > mypair.second){
QwError << "The first value must not be larger than the second value"
QwError << "The first value ("<< mypair.first<< ") must not be larger than the second value (" << mypair.second <<")"
<< QwLog::endl;
return std::pair<int,int>(INT_MAX,INT_MAX);
}
Expand Down
7 changes: 6 additions & 1 deletion Parity/include/QwBlinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,12 @@ class QwBlinder {
void SetWienState(EQwWienMode wienmode);
void SetIHWPPolarity(Int_t ihwppolarity);

Bool_t fUseCREXPositions;
// Target position look-up index for PREX/CREX.
// Index value of -1 is for the PREX positons
// CREX index values in date order go from "min" to "Max" and must correspond to cases in the QwBlinder::Update(const QwEPICSEvent& epics) function.
Int_t fCREXTargetIndex;
Int_t kCREXTgtIndexMin = 1;
Int_t kCREXTgtIndexMax = 2;

Double_t fBeamCurrentThreshold;
Bool_t fBeamIsPresent;
Expand Down
36 changes: 33 additions & 3 deletions Parity/include/QwHelicityPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

// System headers
#include <vector>
#include <iostream>
#include <fstream>

// ROOT headers
#include <TTree.h>
Expand Down Expand Up @@ -61,9 +63,29 @@ class QwHelicityPattern {

Bool_t IsCompletePattern() const;

void PrintIndexMapFile(Int_t runNum){
if ( fPrintIndexFile && (fGoodPatterns < fBurstMinGoodPatterns) ) {
// Print a text map file to max_burst_index.####.conf
Int_t maxBurst = 0;
if (fBurstCounter==0) {
// It's a single burst run anyway
maxBurst = 0;
}
else {
// It's a multi burst run and we want to merge the final two bursts
maxBurst = fBurstCounter-1;
}
QwWarning << "Printing max_burst_index." << runNum << ".conf file with " << maxBurst << " max burst number" << QwLog::endl;
std::ofstream output;
output.open(Form("max_burst_index.%d.conf",runNum));
output<< "max-burst-index=" << maxBurst << std::endl; // Print the current index before incrementing further, this will be the max index and the next pass will overflow this one instead of having another
output.close();
}
}

Bool_t IsEndOfBurst(){
// Is this the end of a burst?
return (fBurstLength > 0 && fGoodPatterns >= fBurstLength);
// Is this the end of a burst? And is this not the final burst?
return (( fBurstLength > 0 && fGoodPatterns >= fBurstLength ) && ( fBurstCounter<fMaxBurstIndex ));
}

void CalculateAsymmetry();
Expand Down Expand Up @@ -168,7 +190,12 @@ class QwHelicityPattern {
};

Bool_t HasBurstData(){return fGoodPatterns>0;};
void IncrementBurstCounter(){fBurstCounter++;}
void IncrementBurstCounter(){
if (fBurstCounter < fMaxBurstIndex) {
fBurstCounter++;
}
// Else we just park here and don't try to increment any more. This is a parameter from command line or map file
}
Short_t GetBurstCounter() const {return fBurstCounter;}
void ClearEventData();

Expand Down Expand Up @@ -211,6 +238,9 @@ class QwHelicityPattern {

// Burst sum/difference of the yield and asymmetry
Int_t fBurstLength;
Int_t fMaxBurstIndex;
Bool_t fPrintIndexFile;
Int_t fBurstMinGoodPatterns;
Int_t fGoodPatterns;
Short_t fBurstCounter;
Bool_t fEnableBurstSum;
Expand Down
4 changes: 3 additions & 1 deletion Parity/main/QwParity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ Int_t main(Int_t argc, Char_t* argv[])
// QwPromptSummary promptsummary;

/// Start loop over all runs
Int_t run_number = 0;
while (eventbuffer.OpenNextStream() == CODA_OK) {

/// Begin processing for the first run

Int_t run_number = eventbuffer.GetRunNumber();
run_number = eventbuffer.GetRunNumber();
TString run_label = eventbuffer.GetRunLabel();

/// Set the current event number for parameter file lookup
Expand Down Expand Up @@ -460,6 +461,7 @@ Int_t main(Int_t argc, Char_t* argv[])

// Fill data handler tree branches
datahandlerarray_burst.FillTreeBranches(burstrootfile);
patternsum_per_burst.PrintIndexMapFile(run_number);
}

// Perform actions at the end of the event loop on the
Expand Down
4 changes: 4 additions & 0 deletions Parity/prminput/0.5pass.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
disable-trees = 1
disable-histos = 1
print-burst-index-map = 1
min-burstlength = 9000
1 change: 1 addition & 0 deletions Parity/prminput/2pass.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add-config = max_burst_index.conf
18 changes: 18 additions & 0 deletions Parity/prminput/blinder.3433.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Blinder parameter

# strategy = Disabled | Additive | Multiplicative | AdditiveMultiplicative (case insensitive)
strategy = additive

# seed = unquoted string without starting or ending spaces
seed = Roadkill stew sounds mighty good right NOW. --- Unspecified collaborator

# max_asymmetry = positive float in ppm such that additive blinding asymmetry is between 0 +/- (this value)
max_asymmetry = 0.150

# max_factor = positive float fraction such that multiplicative blinding asymmetry is between 1 +/- (this value)
max_factor = 0.0

###### Super dangerous options... to be ONLY used when no other solution can work.
###### Do not just copy these elsewhere
force-target-type = target-blindable
force-spin-direction = spin-forward
18 changes: 18 additions & 0 deletions Parity/prminput/blinder.3571.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Blinder parameter

# strategy = Disabled | Additive | Multiplicative | AdditiveMultiplicative (case insensitive)
strategy = additive

# seed = unquoted string without starting or ending spaces
seed = Roadkill stew sounds mighty good right NOW. --- Unspecified collaborator

# max_asymmetry = positive float in ppm such that additive blinding asymmetry is between 0 +/- (this value)
max_asymmetry = 0.150

# max_factor = positive float fraction such that multiplicative blinding asymmetry is between 1 +/- (this value)
max_factor = 0.0

###### Super dangerous options... to be ONLY used when no other solution can work.
###### Do not just copy these elsewhere
force-target-type = target-blindable
force-spin-direction = spin-forward
2 changes: 1 addition & 1 deletion Parity/prminput/blinder.5104-5274.map
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ max_asymmetry = 0.900
# max_factor = positive float fraction such that multiplicative blinding asymmetry is between 1 +/- (this value)
max_factor = 0.0

use_crex_target_position = true
crex_target_index = 1
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ max_asymmetry = 0.900
# max_factor = positive float fraction such that multiplicative blinding asymmetry is between 1 +/- (this value)
max_factor = 0.0

use_crex_target_position = true
crex_target_index = 1
15 changes: 15 additions & 0 deletions Parity/prminput/blinder.5858-.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Blinder parameter

# strategy = Disabled | Additive | Multiplicative | AdditiveMultiplicative (case insensitive)
strategy = additive

# seed = unquoted string without starting or ending spaces
seed = It is a capital mistake to theorize before one has data. Insensibly one begins to twist facts to suit theories, instead of theories to suit facts.---A Scandal in Bohemia, Arthur Conan Doyle.

# max_asymmetry = positive float in ppm such that additive blinding asymmetry is between 0 +/- (this value)
max_asymmetry = 0.900

# max_factor = positive float fraction such that multiplicative blinding asymmetry is between 1 +/- (this value)
max_factor = 0.0

crex_target_index = 2
3 changes: 3 additions & 0 deletions Parity/prminput/eventNumberCut.6852.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Cuts to keep only evnts with Ca-48 target in position
event=20000:
blinder.force-target-blindable=1
Empty file.
15 changes: 10 additions & 5 deletions Parity/prminput/prexCH_beamline.2721-.map
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ sample_size=4084
VQWK, 4, 1, bpmstripline, BPM1xm
VQWK, 4, 2, bpmstripline, BPM1yp
VQWK, 4, 3, bpmstripline, BPM1ym
VQWK, 4, 4, bpmstripline, BPM8xp
VQWK, 4, 5, bpmstripline, BPM8xm
VQWK, 4, 6, bpmstripline, BPM8yp
VQWK, 4, 7, bpmstripline, BPM8ym
VQWK, 4, 4, bpmstripline, BPM8yp
VQWK, 4, 5, bpmstripline, BPM8ym
VQWK, 4, 6, bpmstripline, BPM8xp
VQWK, 4, 7, bpmstripline, BPM8xm

!ADC5
VQWK, 5, 0, bcm, ch_tsettle
Expand Down Expand Up @@ -90,6 +90,11 @@ sample_size=4084
VQWK, 7, 6, bpmstripline, BPM4ecYM
VQWK, 7, 7, bpmstripline, BPM4ecYP

begin=combinedbcm
name=bcm_target
bcm_an_us, bcm, 2.0
bcm_an_ds, bcm, 1.0
end=combinedbcm

!! bank=0x2
!!
Expand All @@ -115,4 +120,4 @@ sample_size=4084

[PUBLISH]
! new.tree.variable.name, analysis.class, old.tree.variable.name, element.to.store
q_targ, bcm, bcm_an_ds3, c
q_targ, combinedbcm, bcm_target, c
15 changes: 10 additions & 5 deletions Parity/prminput/prexCH_beamline.2844-.map
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ sample_size=4084
VQWK, 4, 1, bpmstripline, BPM1xm
VQWK, 4, 2, bpmstripline, BPM1yp
VQWK, 4, 3, bpmstripline, BPM1ym
VQWK, 4, 4, bpmstripline, BPM8xp
VQWK, 4, 5, bpmstripline, BPM8xm
VQWK, 4, 6, bpmstripline, BPM8yp
VQWK, 4, 7, bpmstripline, BPM8ym
VQWK, 4, 4, bpmstripline, BPM8yp
VQWK, 4, 5, bpmstripline, BPM8ym
VQWK, 4, 6, bpmstripline, BPM8xp
VQWK, 4, 7, bpmstripline, BPM8xm

!ADC5
VQWK, 5, 0, bcm, ch_tsettle
Expand Down Expand Up @@ -90,6 +90,11 @@ sample_size=4084
VQWK, 7, 6, bpmstripline, BPM4ecYM
VQWK, 7, 7, bpmstripline, BPM4ecYP

begin=combinedbcm
name=bcm_target
bcm_an_us, bcm, 2.0
bcm_an_ds, bcm, 1.0
end=combinedbcm

!! bank=0x2
!!
Expand All @@ -115,4 +120,4 @@ sample_size=4084

[PUBLISH]
! new.tree.variable.name, analysis.class, old.tree.variable.name, element.to.store
q_targ, bcm, bcm_an_ds3, c
q_targ, combinedbcm, bcm_target, c
Loading

0 comments on commit 688dda4

Please sign in to comment.