Commit d95f47ce authored by dino's avatar dino
Browse files

Removed a bug in PSAFilter when forcing the sum-of-segments to the energy of the core

Added more comments and generalized GeDataBase in gen_conf.py

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@997 170316e4-aea8-4b27-aad4-0380ec0519c9
parent 83213c6a
......@@ -433,7 +433,7 @@ void getparams(int argc, char *argv[])
numparams(cmd, argc-argn-1);
maxTurn = abs(atoi(argv[argn++]));
}
else if(!strcmp(cmd, "-nothr")) {
else if(!strcmp(cmd, "-nothr") || !strcmp(cmd, "-nothreads")) {
runThreaded = false;
}
else {
......
......@@ -41,7 +41,6 @@ PSAFilter::PSAFilter() :
fWriteNumTraces = 0;
fPsaMinSegMult = 1;
fPsaMaxSegMult = CrystalInterface::kNbSegments;
fPsaSegCenter = false;
fVerbose = false;
fWritePsaHits = false;
fEnergyGain = 1.f;
......@@ -66,8 +65,10 @@ PSAFilter::PSAFilter() :
fPsaSlots = 1;
#endif
fUseAdaptive = true;
fCoarseOnly = false;
fUseAdaptive = true;
fCoarseOnly = false;
fPsaSegCenter = false;
fFullSearch = false;
fBlockIn.SetModeIO(ConfAgent::kRead);
fBlockOut.SetModeIO(ConfAgent::kWrite);
......@@ -257,15 +258,21 @@ void PSAFilter::GetParameters(UInt_t *error_code)
fVerbose = true;
ok = true;
}
else if( stringEq(keyw, "GridSearch") ) {
else if( stringEq(keyw, "GridSearch") || stringEq(keyw, "GridSearchType") ) {
if( stringEq(data, "SegCenter") ) {
fUseAdaptive = false; fCoarseOnly = false; fPsaSegCenter = true; fFullSearch = false;
}
if( stringEq(data, "Full") ) {
fUseAdaptive = false; fCoarseOnly = false;
fUseAdaptive = false; fCoarseOnly = false; fPsaSegCenter = false; fFullSearch = true;
}
if( stringEq(data, "Adaptive") ) {
fUseAdaptive = true; fCoarseOnly = false; fPsaSegCenter = false; fFullSearch = false;
}
else if(stringEq(data, "CoarseOnly") ) {
fUseAdaptive = true; fCoarseOnly = true;
fUseAdaptive = true; fCoarseOnly = true; fPsaSegCenter = false; fFullSearch = false;
}
else {
fUseAdaptive = true; fCoarseOnly = false;
fUseAdaptive = true; fCoarseOnly = false; fPsaSegCenter = false; fFullSearch = false; // Adaptive
}
ok = true;
}
......@@ -305,8 +312,8 @@ void PSAFilter::GetParameters(UInt_t *error_code)
else if( stringEq(keyw, "SegmentFoldGate") ) {
ok = 2 == sscanf(data.c_str(), "%d %d", &fPsaMinSegMult, &fPsaMaxSegMult);
}
else if( stringEq(keyw, "PlaceAtSegCenter") ) {
fPsaSegCenter = true;
else if( stringEq(keyw, "PlaceAtSegCenter") ) { // keyword to be removed be removed
fUseAdaptive = false; fCoarseOnly = false; fPsaSegCenter = true; fFullSearch = false;
ok = true;
}
else if( stringEq(keyw, "DeadSegment") ) {
......
......@@ -185,6 +185,9 @@ public:
Bool_t fUseAdaptive;
Bool_t fCoarseOnly;
Bool_t fPsaSegCenter;
Bool_t fFullSearch;
Float_t fTauSlice[7];
Bool_t fTauGiven;
......@@ -207,7 +210,6 @@ protected:
Int_t fWriteNumTraces;
Int_t fPsaMinSegMult;
Int_t fPsaMaxSegMult;
Bool_t fPsaSegCenter;
Bool_t fVerbose;
Bool_t fWritePsaHits; //
......
......@@ -52,8 +52,10 @@ PSAFilterGridSearch::PSAFilterGridSearch()
fpPsaHits = NULL;
fPsaIndex = 0;
gUseAdaptive = true;
gCoarseOnly = false;
gUseAdaptive = true;
gCoarseOnly = false;
gPsaSegCenter = false;
gFullSearch = false;
memset(hmask, ' ', sizeof(hmask));
for(int nn = 0; nn < NSEGS; nn++) { // segments and core
......@@ -127,8 +129,10 @@ Int_t PSAFilterGridSearch::AlgoSpecificInitialise()
cout << endl;
gUseAdaptive = fUseAdaptive;
gCoarseOnly = fCoarseOnly;
gUseAdaptive = fUseAdaptive;
gCoarseOnly = fCoarseOnly;
gPsaSegCenter = fPsaSegCenter;
gFullSearch = fFullSearch;
SegmentMapMake(2);
......@@ -149,7 +153,7 @@ Int_t PSAFilterGridSearch::AlgoSpecificInitialise()
}
int rval = 0;
if(fPsaSegCenter) {
if(gPsaSegCenter) {
rval = fBasis.ReadSegmentCenters(fBasisFile);
if(rval != 0)
return rval;
......@@ -314,7 +318,7 @@ Int_t PSAFilterGridSearch::AlgoSpecificInitialise()
specStat->setComment ("Distribution of hits");
hGroup.add(specStat);
if(!fPsaSegCenter) {
if(!gPsaSegCenter) {
//specTzero = new nDhist<unsigned int>(NSEGS+4, specLenT);
//specTzero->setFileName(fOdirPrefix+"Psa?Tzero.spec");
//specTzero->setComment ("T90 and best dt (if relevant)");
......@@ -374,7 +378,7 @@ Int_t PSAFilterGridSearch::AlgoSpecificInitialise()
fPsaMaxSegMult = min(12, fPsaMaxSegMult);
// The result of the first fWriteNumTraces decompositions
if(fWriteNumTraces>0 && !fPsaSegCenter) {
if(fWriteNumTraces>0 && !gPsaSegCenter) {
std::ostringstream filename;
filename << "Psa__" << fWriteNumTraces << "-2-" << WCHAN << "-" << WSAMP << "-F__Traces.samp";
fnPsaTraces = fOdirPrefix+filename.str();
......@@ -392,7 +396,7 @@ Int_t PSAFilterGridSearch::AlgoSpecificInitialise()
}
// Psa-hits file to determine the neutron-damage correction parameters
if(fWritePsaHits && !fPsaSegCenter) {
if(fWritePsaHits && !gPsaSegCenter) {
std::ostringstream filename;
filename << "Psa__0-" << nPsaHitsValues << "-F__Hits.fdat";
fnPsaHits = fOdirPrefix+filename.str();
......@@ -482,7 +486,7 @@ const int locEvts = 3;
Int_t PSAFilterGridSearch::Process(int slot, int nslots)
{
if(fPsaSegCenter) {
if(gPsaSegCenter) {
// a fake PSA that places the inteaction points at the center of their net-charge segment
pointFull pS;
for(int nn = 0; nn < nslots; nn++) {
......@@ -1451,6 +1455,12 @@ Int_t PSAFilterGridSearch::PostProcess(int slot)
// A problem to solve is that sometime (pileup, overrange, ??) the two values are very very different.
if(fForceSegmentsToCore) {
PsaOut_t * pOut = pD->PsaOut;
etotSegm = 0; // recalculated so as to be independent from fTrapping
for(int nnh = 0; nnh < numHits; nnh++, pOut++) {
etotSegm += pOut->enerSG;
}
etotCore = pD->CoreE[0];
pOut = pD->PsaOut;
float factor = etotCore/etotSegm;
for(int nnh = 0; nnh < numHits; nnh++, pOut++) {
pOut->enerSG *= factor;
......
......@@ -75,6 +75,8 @@ private:
bool gUseAdaptive;
bool gCoarseOnly;
bool gPsaSegCenter;
bool gFullSearch;
Float_t tauSlice[7];
......
......@@ -742,9 +742,10 @@ UInt_t TrackingFilter::ProcessBlock(ADF::FrameBlock &in, ADF::FrameBlock &out)
// analysis before tracking
if( !PreProcessEvent() ) {
// no hits or something wrong in preprocessing them
#ifdef TF_ROOTTREE
if(fWriteRootTree)
t->Fill(); //fill also for events that will not be tracked (???)
t->Fill(); // fill also for events that will not be tracked
#endif
#ifdef TF_LOCALSPECTRA
if(fAncillary) {
......@@ -1275,7 +1276,6 @@ void TrackingFilter::process_initialise (UInt_t *error_code)
#else
if(fWriteRootTree)
cout << "\nWriteRootTree --> IGNORED (Program built without TF_ROOTTREE)\n" << endl;
#endif
#ifdef WRITE_TRACKED
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment