Commit 3fe4b87e authored by dino's avatar dino
Browse files

TrackiingFilter: replaced keyword 'AcceptanceLimits' with 'OftParams p1 p2 p3' and 'MgtParams p1'

                 added keyword 'DiscardGe 'id' to completely ignore a germanium detector
                 added keyword 'TimeWindow' to restrict the Tgamma-gamma range 

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@1209 170316e4-aea8-4b27-aad4-0380ec0519c9
parent f7bf0067
......@@ -83,8 +83,8 @@ void ChainOfActors::Run()
if(ptrActor->libType == PRODUCER) {
static_cast<NarvalProducer *>(ptrActor->nrvPointer)->process_block(
bufout, size_of_output_buffer, &used_of_output_buffer,
&error_code);
bufout, size_of_output_buffer/2, &used_of_output_buffer, // use only 1/2 of the input buffer as a quite drastic
&error_code); // way of avoiding buffer overflows in later actors
if(error_code)
hasEnded = true;
if(used_of_output_buffer == 0) {
......
# sln2make autogenerated Makefile.ag
# not a real Makefile because it always rebuilds all
DEFINES = -DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1
DEFINES += -DHAVE_VISIBILITY_PRAGMA=1
DEFINES += -DXP_UNIX=1
DEFINES += -D_GNU_SOURCE=1
DEFINES += -DHAVE_FCNTL_FILE_LOCKING=1
DEFINES += -DLINUX=1
DEFINES += -Di386=1
DEFINES += -DHAVE_LCHOWN=1
DEFINES += -DHAVE_STRERROR=1
DEFINES += -D_REENTRANT=1
DEFINES += -DHAVE_EXPAT_CONFIG_H=1
DEFINES += -DTHREADED
DEFINES += -DNRV_OFFLINE
DEFINES += -D_FILE_OFFSET_BITS=64
DEFINES += -D_LARGEFILE64_SOURCE=1
#DEFINES += -DNOT_USING_ADF=1
ifeq ($(OS),Windows_NT)
LDFLAGS= -L.
else
#LDFLAGS= -L/usr/lib -lboost_thread
LDFLAGS= -L/usr/lib -lboost_thread-mt
endif
LDFLAGS += -lskstream-0.3
LFLAGS=
CC=g++
CFLAGS =
CFLAGS += -O3
CFLAGS += $(DEFINES)
CFLAGS += -I../common/
CFLAGS += -I../producers/Crystal/ -I../producers/Crystal/includeATCA
CFLAGS += -I../producers/AncillaryTCP
CFLAGS += -I../producers/Basic
CFLAGS += -I../filters/Preprocessing/ -I../filters/Preprocessing/includePrePSA
CFLAGS += -I../filters/Ancillary -I../filters/Ancillary/includeVME
CFLAGS += -I../filters/PSA/ -I../filters/PSA/includePSA
CFLAGS += -I../filters/Tracking/ -I../filters/Tracking/includeOFT -I../filters/Tracking/includeMGT
CFLAGS += -I../consumers/Basic
CFLAGS += -I../builders/
CFLAGS += -I../myADF0.2/ -I../myADF0.2/standalone/
CFLAGS += -I../PRISMA/src/lib_prisma/include/
CFLAGS += -I/usr/include/boost/
CFLAGS += -I/usr/include/skstream-0.3/ -I/usr/lib/skstream-0.3/include/
#CFLAGS += -fprofile-arcs -ftest-coverage
#CFLAGS += -pg
CFLAGS += -g
#CFLAGS += -funroll-loops -fexceptions -msse4 -ftree-vectorizer-verbose=5 -ffast-math #-pthread
SRCS =
SRCS += femul.cpp
SRCS += ../common/cycleServer.cpp ../common/misc.cpp ../common/mwdlib.cpp ../common/adetParams.cpp
SRCS += ../producers/Crystal/includeATCA/mezzanine.cpp ../producers/Crystal/includeATCA/fileATCA.cpp
SRCS += ../producers/Crystal/CrystalProducer.cpp ../producers/Crystal/CrystalProducerATCA.cpp
SRCS += ../producers/AncillaryTCP/AncillaryProducerTCP.cpp
#SRCS += ../producers/Basic/myBasicAFP.cpp
SRCS += ../filters/Preprocessing/PreprocessingFilter.cpp ../filters/Preprocessing/PreprocessingFilterPSA.cpp
SRCS += ../filters/Ancillary/AncillaryFilter.cpp ../filters/Ancillary/AncillaryFilterVME.cpp ../filters/Ancillary/AncillaryFilterATCA.cpp
SRCS += ../filters/Ancillary/includeVME/Converter.cpp
SRCS += ../filters/PSA/PSAFilter.cpp ../filters/PSA/PSAFilterGridSearch.cpp
SRCS += ../filters/PSA/includePSA/SignalBasis.cpp
SRCS += ../filters/Tracking/TrackingFilter.cpp ../filters/Tracking/TrackingFilterOFT.cpp ../filters/Tracking/TrackingFilterMGT.cpp
SRCS += ../filters/Tracking/includeOFT/tracking_cluster.c ../filters/Tracking/includeOFT/tracking_data_manip.c ../filters/Tracking/includeOFT/tracking_events.c ../filters/Tracking/includeOFT/tracking_physics.c ../filters/Tracking/includeOFT/tracking_utilitaires.c
SRCS += ../filters/Tracking/includeMGT/mgt.c ../filters/Tracking/includeMGT/mgt_eclust.c ../filters/Tracking/includeMGT/mgt_etrack.c ../filters/Tracking/includeMGT/mgt_event.c ../filters/Tracking/includeMGT/mgt_geoagata.c ../filters/Tracking/includeMGT/mgt_vectorlib.c
#SRCS += ../producers/Basic/myBasicAFC.cpp
SRCS += ../builders/EventBuilder.cpp
SRCS += ../myADF0.2/ADFConfig.cpp ../myADF0.2/ADFObjects.cpp ../myADF0.2/AgataConfigurationFrame.cpp ../myADF0.2/AgataFrameFactory.cpp ../myADF0.2/AgataKeyFactory.cpp ../myADF0.2/BaseBuffer.cpp ../myADF0.2/BufferIO.cpp ../myADF0.2/CompositeFrame.cpp ../myADF0.2/ConfAgent.cpp ../myADF0.2/ConfigurationFrame.cpp ../myADF0.2/Counter.cpp ../myADF0.2/DataHandling.cpp ../myADF0.2/DefaultKeyFactory.cpp ../myADF0.2/FactoryItem.cpp ../myADF0.2/Frame.cpp ../myADF0.2/FrameBlock.cpp ../myADF0.2/FrameFactory.cpp ../myADF0.2/GObject.cpp ../myADF0.2/FrameIO.cpp ../myADF0.2/GenericFrame.cpp ../myADF0.2/AgataRawFrame.cpp ../myADF0.2/CrystalFrame.cpp ../myADF0.2/MetaFrame.cpp ../myADF0.2/Hits.cpp ../myADF0.2/Key.cpp ../myADF0.2/KeyFactory.cpp ../myADF0.2/NarvalInterface.cpp ../myADF0.2/Signals.cpp ../myADF0.2/Trigger.cpp ../myADF0.2/Version.cpp ../myADF0.2/standalone/LogCollector.cpp ../myADF0.2/standalone/CentralLog.cpp ../myADF0.2/standalone/LogMessage.cpp ../myADF0.2/BasicAFC.cpp ../myADF0.2/BasicAFP.cpp
SRCS += ../PRISMA/src/lib_prisma/src/prismaManager.cc ../PRISMA/src/lib_prisma/src/banGate.cc ../PRISMA/src/lib_prisma/src/banManager.cc ../PRISMA/src/lib_prisma/src/calCoef.cc ../PRISMA/src/lib_prisma/src/calManager.cc ../PRISMA/src/lib_prisma/src/CGaspBuffer.cc ../PRISMA/src/lib_prisma/src/ConfigurationFile.cc ../PRISMA/src/lib_prisma/src/detData.cc ../PRISMA/src/lib_prisma/src/fastSolver.cc ../PRISMA/src/lib_prisma/src/fullEvent.cc ../PRISMA/src/lib_prisma/src/massCalculator.cc ../PRISMA/src/lib_prisma/src/prismaIonCh.cc ../PRISMA/src/lib_prisma/src/prismaMcp.cc ../PRISMA/src/lib_prisma/src/prismaPPAC.cc ../PRISMA/src/lib_prisma/src/prismaSide.cc ../PRISMA/src/lib_prisma/src/RandomGenerator.cc ../PRISMA/src/lib_prisma/src/Vectors.cc ../PRISMA/src/lib_prisma/src/zedCalculator.cc
PROG=femul
default:
@echo "available targets:"
@echo " plain"
@echo " root"
@echo " clean"
plain:
ifeq ($(OS),Windows_NT)
$(CC) $(CFLAGS) $(SRCS) -o $(PROG) /lib/libboost_thread-mt.a
else
$(CC) $(CFLAGS) $(SRCS) -o $(PROG) -L/usr/lib -lboost_thread-mt -lpthread $(LDFLAGS) -DNRV_OFFLINE
endif
root:
ifeq ($(OS),Windows_NT)
$(CC) $(CFLAGS) $(SRCS) -o $(PROG) /lib/libboost_thread-mt.a -I/usr/include/ $(shell root-config --cflags)
else
$(CC) $(CFLAGS) $(SRCS) -o $(PROG) -L/usr/lib -lboost_thread-mt -lpthread $(LDFLAGS) -I/usr/include/ $(shell root-config --cflags) $(shell root-config --libs) -L/usr/lib -lfreetype -DNRV_OFFLINE
endif
clean:
rm -rf *.o *.core $(PROG) lib$(PROG).a lib$(PROG).so
......@@ -605,4 +605,32 @@ public:
}
};
// helpers
template <typename T>
inline void HistIncr(MultiHist<T> *ptSpe, int i0) {
if(ptSpe)
ptSpe->Incr(i0);
}
template <typename T>
inline void HistIncr(MultiHist<T> *ptSpe, int i0, int i1) {
if(ptSpe)
ptSpe->Incr(i0, i1);
}
template <typename T>
inline void HistIncr(MultiHist<T> *ptSpe, int i0, int i1, int i2) {
if(ptSpe)
ptSpe->Incr(i0, i1, i2);
}
template <typename T>
inline void HistIncr(MultiHist<T> *ptSpe, int i0, int i1, int i2, int i3) {
if(ptSpe)
ptSpe->Incr(i0, i1, i2, i3);
}
template <typename T>
inline void HistIncr(MultiHist<T> *ptSpe, int i0, int i1, int i2, int i3, int i4) {
if(ptSpe)
ptSpe->Incr(i0, i1, i2, i3, i4);
}
#endif // MULTIHIST_H_INCLUDED
......@@ -176,8 +176,6 @@ GlobalFilter::GlobalFilter() :
rVx = rVy = rVz = rVc = 0;
aPx = aPy = aPz = 0;
//fAcceptanceValue1 = 0; // 0 is recognized by the daughter class as default
//fAcceptanceValue2 = 0; // 0 is recognized by the daughter class as default
fGeometrySummary = "235.008 329.202 15 3 6 6 6 6 6 6";
rMapLen = 0;
......
......@@ -296,8 +296,6 @@ protected:
float fSource[3]; // x y z in mm
//float fAcceptanceValue1;
//float fAcceptanceValue2;
std::string fGeometrySummary;
void InitGenStructures();
......
......@@ -790,13 +790,7 @@ bool PreprocessingFilterPSA::ProcessEvent(int &segMult, float &eSumSG1, float
eSumSG1 = eSumSG0;
memcpy(xSegE, SegE, sizeof(xSegE));
#if 0
//da sistemare con una opportuna keyword
if(eSumSG0 < 0.25f*eCore || eSumSG0 > 0.30f*eCore)
return false;
#endif
#if defined(_DEBUG)
#if defined(_DEBUG) // defined in Visual Studio
// to have them (also) just after energy calibration
if( fWriteNumTraces>0 && doWriteTrace ) {
WriteTraces(false); // only SGs and CCs
......@@ -2037,7 +2031,8 @@ void PreprocessingFilterPSA::calcXTspectra(float *pSG_Ener, float *pCC_Ener)
}
}
// FFT of "empty" segments from the energy calibrated short traces
// FFT of "empty" segments from the energy-calibrated short traces
// Warning: this method uses hardcoded values for the 6x6 segmentation of AGATA
int PreprocessingFilterPSA::noiseFFTmake(float sigMax)
{
double FFTreInp[FFTnchan];
......@@ -2052,7 +2047,7 @@ int PreprocessingFilterPSA::noiseFFTmake(float sigMax)
int segmap[FFTnsegs] = {0};
// exclude net charge segments and their neighbours (works only for the 6x6 of AGATA)
// exclude net charge segments and their neighbours
for(int ns = 0; ns < nsg; ns++) {
if( SegE[ns] > CC.pSG[ns].emink ) {
segmap[ns]++; // itself
......
......@@ -13,6 +13,7 @@
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <limits>
#include "TrackingFilter.h"
#include "AgataKeyFactory.h"
......@@ -141,14 +142,19 @@ TrackingFilter::TrackingFilter() :
fNumGeDets = NUMGEDETS;
fGlobalGate.detEnerMin = 20.f; // should be much wider
fGlobalGate.detEnerMax = 20000.f;
fGlobalGate.sumEnerMin = 20.f; // should be much wider
cryst = NULL;
for(int nn = 0; nn < 180; nn++)
KeepCrystal[nn] = true;
fGlobalGate.detEnerMin = 20.f; // should be much wider
fGlobalGate.detEnerMax = 100000.f;
fGlobalGate.sumEnerMin = 20.f; // should be much wider
fGlobalGate.sumEnerMax = fNumGeDets*fGlobalGate.detEnerMax;
fGlobalGate.detFoldMin = 0; // i.e. keep events with no gamma detectors
fGlobalGate.timeWindow = 0; // not defined
fGlobalGate.detFoldMin = 0; // i.e. keep events with no gamma detectors
fGlobalGate.detFoldMax = fNumGeDets;
fGlobalGate.hitFoldMin = 0; // i.e. keep events with no gamma detectors
fGlobalGate.hitFoldMax = 1000000; // big enough
fGlobalGate.hitFoldMin = 0; // i.e. keep events with no gamma detectors
fGlobalGate.hitFoldMax = INT_MAX; // big enough
fEnergyGain = 1.f;
......@@ -174,8 +180,10 @@ TrackingFilter::TrackingFilter() :
rVx = rVy = rVz = rVc = 0;
aPx = aPy = aPz = 0;
fAcceptanceValue1 = 0; // 0 is recognized by the daughter class as default
fAcceptanceValue2 = 0; // 0 is recognized by the daughter class as default
OftValue1 = 0; // 0 is recognized by the daughter class as default
OftValue2 = 0; // 0 is recognized by the daughter class as default
OftValue3 = 0; // 0 is recognized by the daughter class as default
MgtValue1 = 0; // 0 is recognized by the daughter class as default
fGeometrySummary = "235.008 329.202 180 3 6 6 6 6 6 6"; // defaults to full AGATA
fp_conf = NULL;
......@@ -378,7 +386,7 @@ void TrackingFilter::process_initialise (UInt_t *error_code)
return;
}
cryst = new crystdata[fNumGeDets];
cryst = new crystdata[fNumGeDets]; // double the defined number to try avoiding overflows
cout << endl;
DefineTriggers(error_code);
......@@ -798,8 +806,7 @@ UInt_t TrackingFilter::ProcessBlock(ADF::FrameBlock &inBlock, ADF::FrameBlock &o
}
}
#endif
//
//continue; // UNCOMMENT THIS LINE TO AVOID PASSING THESE EVENTS TO THE POST-PROCESSING AND TO THE OUTPUT
continue; // UNCOMMENT THIS LINE TO AVOID PASSING THESE EVENTS TO THE POST-PROCESSING AND TO THE OUTPUT
}
// Analysis after tracking (writing the root tree and various histograms)
......@@ -979,22 +986,28 @@ Int_t TrackingFilter::SetInput()
}
// select common references
// (should take the oldest timestamp not simply that of Ancillary)
if(number_of_crystals>0) {
timestampEvt = min(timestampEvt, timestampCry);
evnumberEvt = evnumberCry;
}
if(hasAncillary) {
timestampEvt = timestampAnc;
timestampEvt = min(timestampEvt, timestampAnc);
evnumberEvt = evnumberAnc;
}
else {
timestampEvt = timestampCry;
evnumberEvt = evnumberCry;
}
// correct the time information of the hits to refer to timestampEvt (?????)
exyzHit *pt = pEXYZ;
for(UShort_t nh = 0; nh < number_of_hits; nh++, pt++) {
pt->T += cryst[pt->Ind].tstamp - timestampEvt;
// correct the time information of the crystals tEvt and hits to refer to timestampEvt
if(number_of_crystals>0) {
for(int ncr = 0; ncr < number_of_crystals; ncr++) {
cryst[ncr].tEvt = cryst[ncr].CCT0 + Float_t(cryst[ncr].tstamp-timestampEvt);
}
exyzHit *pt = pEXYZ;
for(UShort_t nh = 0; nh < number_of_hits; nh++, pt++) {
pt->T += cryst[pt->Ind].tstamp - timestampEvt;
}
}
// should we do something also for the ancillary ??
if(hasAncillary)
timestampAnc += timestampAnc-timestampEvt;
return 0;
}
......@@ -1046,7 +1059,7 @@ void TrackingFilter::GetDataPSA()
return;
// should not happen;
if(crystal_id >= 180) {
if(crystal_id >= 180 || !KeepCrystal[crystal_id]) {
crystal_status = 1;
return;
}
......@@ -1094,7 +1107,7 @@ void TrackingFilter::GetDataPSA()
CC3D_BefAftRT ->Fill( pt->X, pt->Y, pt->Z);
#endif
TransformToGlobalFrame(pt, crystal_id);
//TransformToGlobalFrame(pt, crystal_id);
#ifdef TRF_FromGRU
CC3D_BefAftRT ->Fill(pt->X, pt->Y, pt->Z);
......@@ -1274,12 +1287,17 @@ Int_t TrackingFilter::SetOutput()
int TrackingFilter::PreProcessEvent()
{
if(number_of_hits < fGlobalGate.hitFoldMin || number_of_hits > fGlobalGate.hitFoldMax) {
return 1;
if(fGlobalGate.timeWindow > 0 && number_of_crystals > 1) {
if( !CheckTimeWindow() )
return 1;
}
if(number_of_crystals < fGlobalGate.detFoldMin || number_of_crystals > fGlobalGate.detFoldMax) {
return 1;
}
if(number_of_hits < fGlobalGate.hitFoldMin || number_of_hits > fGlobalGate.hitFoldMax) {
return 1;
}
if(fCoreSumEnergy < fGlobalGate.sumEnerMin || fCoreSumEnergy > fGlobalGate.sumEnerMax) {
return 1;
}
......@@ -1383,6 +1401,85 @@ int TrackingFilter::PreProcessEvent()
return 0;
}
int TrackingFilter::CheckTimeWindow()
{
if(number_of_crystals < 2)
return number_of_crystals;
int TimeOrder[180];
float tWin = fGlobalGate.timeWindow/tScale;
if(number_of_crystals == 2) {
Float_t tRel = cryst[1].tEvt - cryst[0].tEvt;
if(tRel > tWin || tRel < -tWin) {
number_of_crystals = 0; // discard both
number_of_hits = 0; // and all hits
}
return number_of_crystals;
}
// time ordered crystals
TimeOrder[0] = 0; // start with the first
int ordered = 1;
Float_t tLast = cryst[0].tEvt;
for(int nc = 1; nc < number_of_crystals; nc++) {
Float_t tNext = cryst[nc].tEvt;
if(tNext >= tLast) { // data should be essentially ordered
TimeOrder[ordered++] = nc;
tLast = tNext;
}
else { // find insertion point
for(int nn = ordered-2; nn >= 0; nn--) {
if(tNext >= cryst[TimeOrder[nn]].tEvt) {
for(int ii = ordered; ii > nn+1; ii--) // insert after nn
TimeOrder[ii] = TimeOrder[ii-1];
TimeOrder[nn+1] = nc;
ordered++;
break;
}
}
}
if(tNext<cryst[TimeOrder[0]].tEvt) { // the other extreme
for(int ii = ordered; ii > 0; ii--)
TimeOrder[ii] = TimeOrder[ii-1];
TimeOrder[0] = nc;
ordered++;
}
}
// kill old singles
int killed = 0;
tLast = cryst[TimeOrder[0]].tEvt;
int indx = 1;
for( ; indx < ordered; indx++) {
Float_t tNext = cryst[TimeOrder[indx]].tEvt;
if(tNext <= tLast + tWin)
break;
tLast = tNext;
cryst[TimeOrder[indx-1]].valid = false;
killed++;
}
// keep until possible
for( ; indx < ordered; indx++) {
Float_t tNext = cryst[TimeOrder[indx]].tEvt;
if(tNext > tLast + tWin)
break;
tLast = tNext;
}
// kill young singles
for( ; indx < ordered; indx++) {
cryst[TimeOrder[indx]].valid = false;
killed++;
}
if(killed)
RemoveInvalidCrystals();
return number_of_crystals;
}
// crystdata cryst
// exyzHit pEXYZ
// int fIDtoCryst[180]
......@@ -1422,6 +1519,7 @@ UInt_t TrackingFilter::GetParameters(const std::string& confFile, Bool_t doList)
int rGeID(0), rAxis(0); float rAngle(0);
int sGeID(0); float sMove[3] = {0};
int gId(0), sId(0);
int discardID(-1);
int geIDs[180] = {0};
int grId;
float grSumEnerMin(0), grSumEnerMax(0);
......@@ -1437,19 +1535,25 @@ UInt_t TrackingFilter::GetParameters(const std::string& confFile, Bool_t doList)
ConfReader conf;
conf.Add("ActualClass", "name of daughter class", &gActualClass);
conf.Add("SaveDataDir", "where to write data and spectra", &fOdirPrefix);
conf.Add("AcceptanceValue", "quality of tracking", &fAcceptanceValue1, &fAcceptanceValue2); // ??
conf.Add("OftParams", "minprobtrack minprobsing sigma_thet (0==default)", &OftValue1, &OftValue2, &OftValue3);
conf.Add("MgtParams", "max value of Chi2 to accept a tracked gamma (0==default)", &MgtValue1);
conf.Add("ExcludeTracking", "skip the real tracking", &fExcludeTracking);
conf.Add("AcceptAllHits", "all hits accepted as individual gammas", &fAcceptAllHits);
conf.Add("Recoiling", "process events using recoil vector from data:ranc1", &fRecoiling);
conf.Add("RecoilBeta", "recoil velocity of emitter", &fRecoilVc);
conf.Add("RecoilDirection", "cx cy cz (renormalized internally to |1|)", &fRecoil[0], &fRecoil[1], &fRecoil[2]);
conf.Add("SourcePosition", "x y z of source", &fSource[0], &fSource[1], &fSource[2]);
conf.Add("Ancillary", "process events with ancillary data", &fAncillary);
conf.Add("AncillaryRawFrame", "data:rawanc[01] 0=raw 1=preprocessd (LNL)", &fAncRawFrameNum);
conf.Add("Recoiling", "process events using recoil vector from data:ranc1", &fRecoiling);
conf.Add("TimeWindowGeAnc", "time gate for ge-ancillary", &fTsGeAnc_min, &fTsGeAnc_max);
conf.Add("RotoTranslations", "file to transform coordinates from intrinsic to space", &fWhichRotoTranslations);
conf.Add("GeometrySummary", "for the header of the Mgt_Hits.txt file of input hits", &fGeometrySummary);
conf.Add("GeAxRot", "rotate crystal(ID) around global axis [X(0) Y(1) Z(2)] by given angle (deg)", &rGeID, &rAxis, &rAngle);
conf.Add("GeShift", "shift the given crystal (ID) by the given dx, dy, dz (mm) in the global frame", &sGeID, sMove);
conf.Add("GeometrySummary", "for the header of the Mgt_Hits.txt file of input hits", &fGeometrySummary);
conf.Add("RecoilBeta", "recoil velocity of emitter", &fRecoilVc);
conf.Add("RecoilDirection", "cx cy cz (renormalized internally to |1|)", &fRecoil[0], &fRecoil[1], &fRecoil[2]);
conf.Add("SourcePosition", "x y z of source", &fSource[0], &fSource[1], &fSource[2]);
conf.Add("DiscardEmpty", "discard events with no gamma", &fDiscardEmpty);
conf.Add("DontDiscardEmpty", "don't discard events with no gamma", &fDiscardEmpty);
conf.Add("TriggerMask", "string of 1/0 to selectively register the 6 triggers ["+fTriggerMask+"]", &fTriggerMask);
......@@ -1459,6 +1563,9 @@ UInt_t TrackingFilter::GetParameters(const std::string& confFile, Bool_t doList)
conf.Add("SumEnergyGate", "gate on the sum-energy of the crystals", &fGlobalGate.sumEnerMin, &fGlobalGate.sumEnerMax);
conf.Add("NumDetsGate", "event selection based on number of fired detectors", &fGlobalGate.detFoldMin, &fGlobalGate.detFoldMax);
conf.Add("NumHitsGate", "event selection based on total number of hits", &fGlobalGate.hitFoldMin, &fGlobalGate.hitFoldMax);
conf.Add("TimeWindow", "acceptance window on gamma-gamma time", &fGlobalGate.timeWindow);
conf.Add("DiscardGe", "ID of germaium detector to discard (can be given more than once)", &discardID);
conf.Add("GeGroup", "define a group of germanium detectors containing the listed IDs (can be given multiple times)", geIDs);
conf.Add("GroupSumEnergyGate", "group and gate on the sum-energy of its crystals", &grId, &grSumEnerMin, &grSumEnerMax);
......@@ -1471,24 +1578,28 @@ UInt_t TrackingFilter::GetParameters(const std::string& confFile, Bool_t doList)
conf.Add("WriteRootTree", "write root tree file with input and tracked stuff", &strWriteRootHits);
conf.Add("WriteGsortData", "write gsort formatted data, give PRISMA as parameter to include the PRISMA stuff", &strWritePRISMA);
conf.Add("WriteTracked", "write file of input hits for analysis with OFT", &fWriteTracked);
conf.Add("TimeWindowGeAnc", "time gate for ge-ancillary", &fTsGeAnc_min, &fTsGeAnc_max);
conf.Add("Matrixgg1", "gamma-gamma matrix before tracking (using CC energies)", &fSizeMatr_gg1, &fGainMatr_gg1);
conf.Add("Matrixgg2", "gamma-gamma matrix before tracking (using CC energies)", &fSizeMatr_gg2, &fGainMatr_gg2);
conf.Add("MatrixG0G1", "gamma-gamma matrices of detectors in the first 2 groups", &fSizeMatr_G0G1, &fGainMatr_G0G1);
conf.Add("MatrixZYX", "hits and intercepts: zOffset and zScale for hits; range and scale of z-planes", &fMatrZYX_zOffset, &fMatrZYX_zScale1, &fMatrZYX_zRange, &fMatrZYX_zScale2);
conf.Add("Details", "list input events in symbolic form (very slow and incomplete)", &fDetails);
conf.Add("EnergyGain", "scaling factor for binary energy spectra", &fEnergyGain);
conf.Add("NumGeDets", "Overrides the default number of Ge Crystals [20]", &fNumGeDets);
conf.Add("SpecMap", "geID -> SubSpec mapping of crystalID to spectrum SubSpec (given multiple times)", &gId, &sId);
conf.Add("NoMultiHist", "exclude flat binary spectra", &fUseMultiHist);
conf.Add("Details", "list input events in symbolic form (very slow and incomplete)", &fDetails);
conf.Add("Verbose", "verbosity of printouts", &fVerbose);
conf.Info("Keyword 'AcceptanceLimit' has been replaced by 'OftParams' or 'MgtParams'");
// refine behaviour
conf.Require("OftParams", 1); // at least one parameter
conf.SetSize("GeShift", 1, 3);
conf.SetSize("GeGroup", 0, 180); conf.Require("GeGroup", 1);
conf.Require("WriteGsortData", 0); // PRISMA has to be included explicitly
conf.Require("WriteMgtData", 0); // these two guys do exactly the same job,
conf.Require("WriteOftData", 0); // ==> there should be only one command
conf.Require("WriteGsortData", 0); // PRISMA has to be included explicitly
conf.Require("WriteMgtData", 0); // these two guys do exactly the same job,
conf.Require("WriteOftData", 0); // ==> there should be only one command
conf.Require("WriteRootTree", 0);
if(doList) {conf.Show(gMotherClass); return 0;}
......@@ -1536,7 +1647,7 @@ UInt_t TrackingFilter::GetParameters(const std::string& confFile, Bool_t doList)
gid.push_back(geIDs[cc]);
}
GeGroups.push_back(gid);
parGate tmp = {0, 1000000.f, 0, 1000000, 0, 1000000, 0, 1000000};
parGate tmp = {FLT_MIN, FLT_MAX, FLT_MIN, FLT_MAX, FLT_MAX, 0, INT_MAX, 0, INT_MAX};
fGroupGate.push_back(tmp); // load default values (should be in the constructor)
fGroupRemove.push_back(false); // default is not to remove the detectors upon applying the group-gates
}
......@@ -1600,11 +1711,21 @@ UInt_t TrackingFilter::GetParameters(const std::string& confFile, Bool_t doList)
rv = 200;
}
else {
fGroupRemove[grId] = true;
fGroupRemove[grRemove] = true;
}
}
}
if( conf.Seen("DiscardGe") ) {
int which = conf.Find("DiscardGe");
int times = conf.Times(which);
for(int nn = 0; nn < times; nn++) {
conf.Restore(which, nn);
if(discardID>=0 && discardID <180)
KeepCrystal[discardID] = false;
}
}
fMatrZYX = conf.Seen("MatrixZYX");
if(conf.Seen("OutputModel")) {
......
......@@ -92,6 +92,7 @@ protected:
Float_t CCE1; // energy of the other core (keV)
Float_t CCT0; // trigger time (samples) of the core relative to the timestamp, possibly corrected in the PSA
Float_t CCT1; // "" of the other core (usually the same)
Float_t tEvt; // time relative to the smallest timestamp in the event
Float_t Esum; // sum of segment energies (value not forced to CoreE[0])
Bool_t valid; // ok to use it
} crystdata;
......@@ -132,6 +133,7 @@ protected:
Float_t detEnerMax;
Float_t sumEnerMin;
Float_t sumEnerMax;
Float_t timeWindow;
Int_t detFoldMin;
Int_t detFoldMax;
Int_t hitFoldMin;
......@@ -140,6 +142,7 @@ protected:
crystdata *cryst;
int number_of_crystals;
bool KeepCrystal[180]; // to manage time ordere of crystals
exyzHit *pEXYZ;
int number_of_hits;
......@@ -324,8 +327,10 @@ protected:
float fSource[3]; // x y z in mm
float fAcceptanceValue1;
float fAcceptanceValue2;
float OftValue1; // minprobtrack
float OftValue2; // minprobsing
float OftValue3; // sigma_the
float MgtValue1; // maxChi2
std::string fGeometrySummary;
void InitGenStructures();
......@@ -443,6 +448,7 @@ private:
private:
int PreProcessEvent();
int PostProcessEvent();
int CheckTimeWindow();
int RemoveInvalidCrystals();
bool AnalysisOfGroups(int type);
bool AnalysisOfCrystals();
......
......@@ -70,7 +70,7 @@ Int_t TrackingFilterMGT::AlgoInitialise()
// As c_str() gives back a const char*, g++ complains of passing a const to a C function that does
// have this signature (even if we know that mgt_initialize does not modify it).
// It can be done also by explicit copy to a char* (see csummary) but const_cast does it better
mgt_initialize(fAcceptanceValue1, const_cast<char *>(("SUMMARY " + fGeometrySummary).c_str()));
mgt_initialize(MgtValue1, const_cast<char *>(("SUMMARY " + fGeometrySummary).c_str()));
//delete [] csummary;
......
......@@ -12,17 +12,17 @@ using namespace ADF;
#ifdef _MSC_VER // *.c stuff compiled using C
extern "C" {
void oft_process_event(OftStruct *mydata, unsigned int *error_code);
void oft_initialize(double probLimit1, double probLimit2, double inner_r, double outer_r);
void oft_initialize(double probLimit1, double probLimit2, double s_thet, double inner_r, double outer_r);
}