Commit 186b233a authored by dino's avatar dino
Browse files

Changes to GetParameters and xTalk inversion in PreprocessingFilterPSA

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@1125 170316e4-aea8-4b27-aad4-0380ec0519c9
parent 12123c4f
......@@ -580,7 +580,7 @@ void EventBuilder::ListParameters()
void EventBuilder::GetParameters(UInt_t *error_code)
{
#define KPAR(s1,s2,s3) if(doList) printInfo(s1, s2, s3); else if( !found && stringEq(keyw, s1) ) { found = true;
#define KEND }
bool doList = *error_code == 0xFFFFFFFF;
*error_code = 0;
......@@ -609,19 +609,19 @@ void EventBuilder::GetParameters(UInt_t *error_code)
found = false;
}
KPAR("ActualClass", "%s", "name of daughter class")
KPAR("ActualClass", "%s", "name of daughter class");
ok = data.size() > 0;
gActualClass = data;
//fActualClass = gActualClass = data;
}
KEND;
KPAR("SaveDataDir", "%s", "where to write data and spectra")
KPAR("SaveDataDir", "%s", "where to write data and spectra");
ok = data.size() > 0;
fOdirPrefix = data;
forceTailSlash(fOdirPrefix);
}
KEND;
KPAR("BuilderType", "%s", "builder type (TimeStamp | EventNumber)")
KPAR("BuilderType", "%s", "builder type (TimeStamp | EventNumber)");
stringSplit(data, " \t", keyw, value);
if( stringEq(keyw, "TimeStamp") ) {
useEventNumber = false;
......@@ -639,53 +639,53 @@ void EventBuilder::GetParameters(UInt_t *error_code)
else {
ok = false;
}
}
KEND;
KPAR("KeyIn", "%s", "symbolic_name (e.g. data:psa)")
KPAR("KeyIn", "%s", "symbolic_name (e.g. data:psa)");
ok = (data.length() > 1);
sKeyIn.push_back(data);
}
KEND;
KPAR("KeyOut", "%s", "symbolic_name (e.g. event:data:psa)")
KPAR("KeyOut", "%s", "symbolic_name (e.g. event:data:psa)");
ok = (data.length() > 1);
sKeyOut = data;
}
KEND;
KPAR("MinFold", "%d", "minimum number of detectors for valid events")
KPAR("MinFold", "%d", "minimum number of detectors for valid events");
ok = 1 == sscanf(data.c_str(), "%d", &minFold);
}
KEND;
KPAR("TimestampCorrect", "%d %d", "Queue Value")
KPAR("TimestampCorrect", "%d %d", "Queue Value");
UInt_t ind(nchains);
Int_t val(0);
ok = 2 == sscanf(data.c_str(), "%d %d", &ind, &val);
if(ok && ind < nchains) {
vCorrection[ind] = val;
}
}
KEND;
KPAR("TimestampFixBug24", "%d", "Queue")
KPAR("TimestampFixBug24", "%d", "Queue");
UInt_t ind(nchains);
Int_t val(0);
ok = 1 == sscanf(data.c_str(), "%d", &ind);
if(ok && ind < nchains) {
vCorrection[ind] = 0x7FFFFFFF;
}
}
KEND;
KPAR("Details", "%d", "b1=tstamp_snapshot for all events b2=tstamp_diff for all input queues")
KPAR("Details", "%d", "b1=tstamp_snapshot for all events b2=tstamp_diff for all input queues");
ok = 1 == sscanf(data.c_str(), "%d", &details);
}
KEND;
KPAR("NoMultiHist", "", "exclude flat binary spectra")
KPAR("NoMultiHist", "", "exclude flat binary spectra");
fUseMultiHist = false;
ok = true;
}
KEND;
KPAR("Verbose", "", "verbosity of printouts")
KPAR("Verbose", "", "verbosity of printouts");
verbose = true;
ok = true;
}
KEND;
if(doList)
return;
......
......@@ -214,148 +214,149 @@ void AncillaryFilter::process_initialise ( UInt_t *error_code )
void AncillaryFilter::ListParameters()
{
printInfo("\nKEYWORDS ACCEPTED BY AncillaryFilter");
UInt_t errcode = 0xFFFFFFFF;
GetParameters(&errcode);
printInfo("\nKEYWORDS ACCEPTED BY AncillaryFilter");
UInt_t errcode = 0xFFFFFFFF;
GetParameters(&errcode);
}
void AncillaryFilter::GetParameters(UInt_t *error_code)
{
#define KPAR(s1,s2,s3) if(doList) printInfo(s1, s2, s3); else if( !found && stringEq(keyw, s1) ) { found = true;
bool doList = *error_code == 0xFFFFFFFF;
*error_code = 0;
string configFileName = GetConfPath() + gMotherClass + ".conf";
ifstream configfile( configFileName.c_str() );
if(!doList) {
if(!configfile.good()) {
cout << endl << "Error opening " << configFileName << endl;
*error_code = 102;
return;
}
cout << endl << gMotherClass + "::GetParameters() reading from --> " << configFileName << endl;
}
string line, keyw, data;
#define KPAR(s1,s2,s3) if(doList) printInfo(s1, s2, s3); else if( !found && stringEq(keyw, s1) ) { found = true;
#define KEND }
bool doList = *error_code == 0xFFFFFFFF;
*error_code = 0;
string configFileName = GetConfPath() + gMotherClass + ".conf";
ifstream configfile( configFileName.c_str() );
if(!doList) {
if(!configfile.good()) {
cout << endl << "Error opening " << configFileName << endl;
*error_code = 102;
return;
}
cout << endl << gMotherClass + "::GetParameters() reading from --> " << configFileName << endl;
}
string line, keyw, data;
bool ok = true;
bool found = false;
while(doList || getline(configfile, line)) {
if(!doList) {
if(!stringSplit(line, " \t", keyw, data))
continue; // empty or comment lines
cout << line;
ok = false;
found = false;
}
KPAR("ActualClass", "%s", "name of daughter class")
bool found = false;
while(doList || getline(configfile, line)) {
if(!doList) {
if(!stringSplit(line, " \t", keyw, data))
continue; // empty or comment lines
cout << line;
ok = false;
found = false;
}
KPAR("ActualClass", "%s", "name of daughter class");
ok = data.size() > 0;
gActualClass = data;
}
KPAR("SaveDataDir", "%s", "where to write data and spectra")
KPAR("SaveDataDir", "%s", "where to write data and spectra");
ok = data.size() > 0;
fOdirPrefix = data;
forceTailSlash(fOdirPrefix);
}
KEND;
KPAR("AllPairsMat", "", "generate matrix of all pairs of parameters")
KPAR("AllPairsMat", "", "generate matrix of all pairs of parameters");
fAllPairsMat = true;
ok = true;
}
KEND;
KPAR("PRISMALUTFile", "%s", "lookup table for PRISMA")
KPAR("PRISMALUTFile", "%s", "lookup table for PRISMA");
ok = data.size() > 0;
fPRISMALUTFile = data;
}
KEND;
KPAR("PRISMAManager", "%s", "configuration file for the PRISMA manager")
KPAR("PRISMAManager", "%s", "configuration file for the PRISMA manager");
ok = data.size() > 0;
fPRISMAManager = data;
}
KEND;
KPAR("WriteRootTree", "", "produce root-tree of ancillary data")
KPAR("WriteRootTree", "", "produce root-tree of ancillary data");
#ifdef ANF_ROOTTREE
fWriteRootTree = true;
#else
cout << " --> ANF_ROOTTREE NOT DEFINED --> ignored" << endl;
#endif
ok = true;
}
KEND;
KPAR("TstampFile", "%s %d", "File_with_timestams_to_selct Width_of_selection")
KPAR("TstampFile", "%s %d", "File_with_timestams_to_selct Width_of_selection");
ok = data.size() > 0;
string value1, value2;
stringSplit(data, " \t", value1, value2);
fTstampFile = value1;
if(value2.size())
fTolerance = atoi(value2.c_str());
}
KEND;
KPAR("DanteChan", "%d %d %d", "T X Y channels of DANTE data")
KPAR("DanteChan", "%d %d %d", "T X Y channels of DANTE data");
ok = 3 == sscanf(data.c_str(), "%d %d %d", &fDanteChT, &fDanteChX, &fDanteChY);
}
KEND;
KPAR("DantePos", "%f %f %f %f %f", "DanteDz DanteRz, DanteRy DanteRz2 DanteRx (positioning Dante)")
KPAR("DantePos", "%f %f %f %f %f", "DanteDz DanteRz, DanteRy DanteRz2 DanteRx (positioning Dante)");
ok = 5 == sscanf(data.c_str(), "%f %f %f %f %f", &fDanteDz, &fDanteRz1, &fDanteRy, &fDanteRz2, &fDanteRx);
}
KEND;
KPAR("DanteBeta", "%f", "recoil v/c")
KPAR("DanteBeta", "%f", "recoil v/c");
ok = 1 == sscanf(data.c_str(), "%f", &fDanteVc);
}
KEND;
KPAR("DanteCalX", "%f %f", "x-calibration (offset, gain)")
KPAR("DanteCalX", "%f %f", "x-calibration (offset, gain)");
ok = 2 == sscanf(data.c_str(), "%f %f", &fDanteChXcal0, &fDanteChXcal1);
}
KEND;
KPAR("DanteCalY", "%f %f", "y-calibration (offset, gain)")
KPAR("DanteCalY", "%f %f", "y-calibration (offset, gain)");
ok = 2 == sscanf(data.c_str(), "%f %f", &fDanteChYcal0, &fDanteChYcal1);
}
KEND;
KPAR("ReferenceTDC", "%d %d %f", "TDCModule, TDCIndex, TDCOffset for subsample interpolation")
KPAR("ReferenceTDC", "%d %d %f", "TDCModule, TDCIndex, TDCOffset for subsample interpolation");
ok = 3 == sscanf(data.c_str(), "%d %d %f", &fRefTDCModule, &fRefTDCIndex, &fRefTDCOffset);
if(ok) fRefTDC = true;
}
KEND;
KPAR("DanteTDC", "%d %d %d %d", "DanteTDCModule DanteTDCIndex DanteTDCMin DanteTDCMax")
KPAR("DanteTDC", "%d %d %d %d", "DanteTDCModule DanteTDCIndex DanteTDCMin DanteTDCMax");
ok = 4 == sscanf(data.c_str(), "%d %d %d %d", &fDanteTDCModule, &fDanteTDCIndex, &fDanteTDCMin, &fDanteTDCMax);
if(ok) fDanteTDC = true;
}
KEND;
KPAR("PrismaTDC", "%d %d %d %d", "PrismaTDCModule PrismaTDCIndex PrismaTDCMin PrismaTDCMax")
KPAR("PrismaTDC", "%d %d %d %d", "PrismaTDCModule PrismaTDCIndex PrismaTDCMin PrismaTDCMax");
ok = 4 == sscanf(data.c_str(), "%d %d %d %d", &fPrismaTDCModule, &fPrismaTDCIndex, &fPrismaTDCMin, &fPrismaTDCMax);
if(ok) fPrismaTDC = true;
}
KEND;
KPAR("NoMultiHist", "", "exclude flat binary spectra")
KPAR("NoMultiHist", "", "exclude flat binary spectra");
fUseMultiHist = false;
ok = true;
}
KEND;
KPAR("Verbose", "", "verbosity of printouts")
KPAR("Verbose", "", "verbosity of printouts");
fVerbose = true;
ok = true;
KEND;
if(doList)
return;
if(!found) {
cout << " --> ignored";
cout << endl;
ListParameters();
cout << endl;
ok = true;
}
if(doList)
return;
if(!found) {
cout << " --> ignored";
cout << endl;
ListParameters();
cout << endl;
ok = true;
}
if(!ok) {
cout << " --> missing argument(s)" << endl;
cout << endl;
ListParameters();
cout << endl;
ListParameters();
*error_code = 103;
return;
}
......
......@@ -1017,6 +1017,7 @@ void GlobalFilter::ListParameters()
void GlobalFilter::GetParameters(UInt_t *error_code)
{
#define KPAR(s1,s2,s3) if(doList) printInfo(s1, s2, s3); else if( !found && stringEq(keyw, s1) ) { found = true;
#define KEND }
bool doList = *error_code == 0xFFFFFFFF;
*error_code = 0;
......@@ -1046,74 +1047,74 @@ void GlobalFilter::GetParameters(UInt_t *error_code)
found = false;
}
KPAR("ActualClass", "%s", "name of daughter class")
KPAR("ActualClass", "%s", "name of daughter class");
ok = data.size() > 0;
gActualClass = data;
}
KEND;
KPAR("SaveDataDir", "%s", "where to write data and spectra")
KPAR("SaveDataDir", "%s", "where to write data and spectra");
ok = data.size() > 0;
fOdirPrefix = data;
forceTailSlash(fOdirPrefix);
}
KEND;
KPAR("Ancillary", "", "process events with ancillary data")
KPAR("Ancillary", "", "process events with ancillary data");
fAncillary = true;
ok = true;
}
KEND;
KPAR("Recoiling", "", "process events with rawanc1 containing recoil vector")
KPAR("Recoiling", "", "process events with rawanc1 containing recoil vector");
fRecoiling = true;
fAncillary = true;
ok = true;
}
KEND;
KPAR("RotoTranslations", "%s", "file to transform coordinates from intrinsic to space")
KPAR("RotoTranslations", "%s", "file to transform coordinates from intrinsic to space");
ok = data.size() > 0;
fWhichRotoTranslations = data;
}
KEND;
KPAR("GeometrySummary", "%s", "for the header of the Mgt_Hits.txt file of input hits")
KPAR("GeometrySummary", "%s", "for the header of the Mgt_Hits.txt file of input hits");
ok = data.size() > 0;
fGeometrySummary = data;
}
KEND;
KPAR("RecoilBeta", "%f", "recoil velocity of emitter")
KPAR("RecoilBeta", "%f", "recoil velocity of emitter");
ok = 1 == sscanf(data.c_str(), "%f", &fRecoilVc);
}
KEND;
KPAR("RecoilDirection", "%f %f %f", "cx cy cz (renormalized internally to |1|)")
KPAR("RecoilDirection", "%f %f %f", "cx cy cz (renormalized internally to |1|)");
ok = 3 == sscanf(data.c_str(), "%f %f %f", &fRecoil[0], &fRecoil[1], &fRecoil[2]);
}
KEND;
KPAR("SourcePosition", "%f %f %f", "x y z of source")
KPAR("SourcePosition", "%f %f %f", "x y z of source");
ok = 3 == sscanf(data.c_str(), "%f %f %f", &fSource[0], &fSource[1], &fSource[2]);
}
KEND;
KPAR("KeepEmpty", "", "don't discard no-gammas events")
KPAR("KeepEmpty", "", "don't discard no-gammas events");
fDiscardEmpty = false;
ok = true;
}
KEND;
KPAR("DiscardEmpty", "", "discard no-gammas events")
KPAR("DiscardEmpty", "", "discard no-gammas events");
fDiscardEmpty = true;
ok = true;
}
KEND;
KPAR("CoreEnergyGate", "%f %f", "acceptance window on core energy (keV)")
KPAR("CoreEnergyGate", "%f %f", "acceptance window on core energy (keV)");
ok = 2 == sscanf(data.c_str(), "%f %f", &fDetEnerMin, &fDetEnerMax);
}
KEND;
KPAR("SumEnergyGate", "%f %f", "gate on the sum-energy of the crystals")
KPAR("SumEnergyGate", "%f %f", "gate on the sum-energy of the crystals");
ok = 2 == sscanf(data.c_str(), "%f %f", &fSumEnerMin, &fSumEnerMax);
}
KEND;
KPAR("DetectorFoldGate", "%d %d", "event selection based on number of detectors")
KPAR("DetectorFoldGate", "%d %d", "event selection based on number of detectors");
ok = 2 == sscanf(data.c_str(), "%d %d", &fDetFoldMin, &fDetFoldMax);
}
KEND;
// ???????????
KPAR("WriteMgtData", "%s %s...", "Ancillary &| Timing &| Extended write file of input hits for analysis with mgt")
KPAR("WriteMgtData", "%s %s...", "Ancillary &| Timing &| Extended write file of input hits for analysis with mgt");
#ifdef GLF_WRITE_HITS_MGT
fWriteMgtData = true;
fWriteMgtAncillary = false;
......@@ -1129,10 +1130,10 @@ void GlobalFilter::GetParameters(UInt_t *error_code)
cout << " --> GLF_WRITE_HITS_MGT NOT DEFINED --> ignored" << endl;
#endif
ok = true;
}
KEND;
// ???????????
KPAR("WriteOftData", "%s %s...", "Ancillary &| Timing &| Extended write file of input hits for analysis with OFT")
KPAR("WriteOftData", "%s %s...", "Ancillary &| Timing &| Extended write file of input hits for analysis with OFT");
#ifdef GLF_WRITE_HITS_MGT
fWriteMgtData = true;
fWriteMgtAncillary = false;
......@@ -1148,9 +1149,9 @@ void GlobalFilter::GetParameters(UInt_t *error_code)
cout << " --> GLF_WRITE_HITS_MGT NOT DEFINED --> ignored" << endl;
#endif
ok = true;
}
KEND;
KPAR("WriteRootTree", "", "write root tree file with input and tracked stuff")
KPAR("WriteRootTree", "", "write root tree file with input and tracked stuff");
#ifdef GLF_ROOTTREE
fWriteRootTree = true;
fWriteRootHits = false;
......@@ -1161,56 +1162,56 @@ void GlobalFilter::GetParameters(UInt_t *error_code)
cout << " --> GLF_ROOTTREE NOT DEFINED --> ignored" << endl;
#endif
ok = true;
}
KEND;
KPAR("WriteGsortData", "", "write gsort formatted data")
KPAR("WriteGsortData", "", "write gsort formatted data");
#ifdef GLF_WRITE_GSORT
fWriteGsortData = true;
#else
cout << " --> GLF_WRITE_GSORT NOT DEFINED --> ignored" << endl;
#endif
ok = true;
}
KEND;
KPAR("WriteTracked", "", "write file of input hits for analysis with OFT")
KPAR("WriteTracked", "", "write file of input hits for analysis with OFT");
#ifdef GLF_WRITE_TRACKED
fWriteTracked = true;
#else
cout << " --> GLF_WRITE_TRACKED NOT DEFINED --> ignored" << endl;
#endif
ok = true;
}
KEND;
KPAR("TimeWindowGeAnc", "%d %d", "time gate for ge-ancillary")
KPAR("TimeWindowGeAnc", "%d %d", "time gate for ge-ancillary");
ok = 2 == sscanf(data.c_str(), "%d %d", &fTsGeAnc_min, &fTsGeAnc_max);
}
KEND;
KPAR("Matrixgg1", "", "gamma-gamma matrix before tracking (using CC energies)")
KPAR("Matrixgg1", "", "gamma-gamma matrix before tracking (using CC energies)");
ok = 2 == sscanf(data.c_str(), "%d %f", &fSizeMatr_gg1, &fGainMatr_gg1);
}
KEND;
KPAR("Matrixgg2", "", "gamma-gamma matrix of tracked data")
KPAR("Matrixgg2", "", "gamma-gamma matrix of tracked data");
ok = 2 == sscanf(data.c_str(), "%d %f", &fSizeMatr_gg2, &fGainMatr_gg2);
}
KEND;
KPAR("Details", "", "list input events in symbolic form (very slow and incompletee)")
KPAR("Details", "", "list input events in symbolic form (very slow and incompletee)");
fDebug = true;
ok = true;
}
KEND;
KPAR("EnergyGain", "%f", "scaling factor for binary energy spectra")
KPAR("EnergyGain", "%f", "scaling factor for binary energy spectra");
ok = 1 == sscanf(data.c_str(), "%f", &fEnergyGain);
}
KEND;
KPAR("NoMultiHist", "", "exclude flat binary spectra")
KPAR("NoMultiHist", "", "exclude flat binary spectra");
fUseMultiHist = false;
ok = true;
}
KEND;
KPAR("Verbose", "", "verbosity of printouts")
KPAR("Verbose", "", "verbosity of printouts");
fVerbose = true;
ok = true;
}
KEND;
if(doList)
return;
......
This diff is collapsed.
......@@ -37,7 +37,7 @@ PSAFilter::PSAFilter() :
fOdirPrefix.clear();
fBasisFile.clear();
fPsaXtalkFile.clear();
fPsaXtalkFileDir.clear();
fTraceLengthPSA = defTraceLengthPSA;
fWriteNumTraces = 0;
fCoreEnerMin = 10.f;
......@@ -241,75 +241,76 @@ void PSAFilter::process_initialise (UInt_t *error_code)
void PSAFilter::ListParameters()
{
printInfo("\nKEYWORDS ACCEPTED BY PSAFilter");
UInt_t errcode = 0xFFFFFFFF;
GetParameters(&errcode);
printInfo("\nKEYWORDS ACCEPTED BY PSAFilter");
UInt_t errcode = 0xFFFFFFFF;
GetParameters(&errcode);
}
void PSAFilter::GetParameters(UInt_t *error_code)
{
#define KPAR(s1,s2,s3) if(doList) printInfo(s1, s2, s3); else if( !found && stringEq(keyw, s1) ) { found = true;
bool doList = *error_code == 0xFFFFFFFF;
*error_code = 0;
string configFileName = GetConfPath() + gMotherClass + ".conf";
ifstream configfile( configFileName.c_str() );
if(!doList) {
if(!configfile.good()) {
cout << endl << "Error opening " << configFileName << endl;
*error_code = 102;
return;
}
cout << endl << gMotherClass + "::GetParameters() reading from --> " << configFileName << endl;
}
string line, keyw, data;
#define KPAR(s1,s2,s3) if(doList) printInfo(s1, s2, s3); else if( !found && stringEq(keyw, s1) ) { found = true;
#define KEND }
bool doList = *error_code == 0xFFFFFFFF;
*error_code = 0;
string configFileName = GetConfPath() + gMotherClass + ".conf";
ifstream configfile( configFileName.c_str() );
if(!doList) {