 |
Belle II Software
release-05-02-19
|
14 #define TRGCDC_SHORT_NAMES
17 #include "G4RunManager.hh"
19 #include "trg/cdc/modules/trgcdc/TRGCDCModule.h"
20 #include "trg/trg/Debug.h"
22 #include <framework/datastore/StoreArray.h>
23 #include <mdst/dataobjects/MCParticle.h>
24 #include <cdc/dataobjects/CDCHit.h>
25 #include <trg/cdc/dataobjects/CDCTriggerSegmentHit.h>
26 #include <trg/cdc/dataobjects/CDCTriggerTrack.h>
27 #include <trg/trg/dataobjects/TRGTiming.h>
29 #include <cdc/geometry/CDCGeometryPar.h>
43 TRGCDCModule::version()
const
45 return string(
"TRGCDCModule 5.07");
48 TRGCDCModule::TRGCDCModule()
51 _configFilename(
"TRGCDCConfig.dat"),
52 _innerTSLUTFilename(
"undefined"),
53 _outerTSLUTFilename(
"undefined"),
54 _rootTRGCDCFilename(
"undefined"),
55 _rootFitter3DFilename(
"undefined"),
58 _fastSimulationMode(0),
59 _firmwareSimulationMode(0),
60 _firmwareSimulationStart(0),
61 _firmwareSimulationStop(32 * 32 - 1),
63 _perfect2DFinder(false),
64 _perfect3DFinder(false),
66 _hFinderMappingFilePlus(
"HoughMappingPlus20160223.dat"),
67 _hFinderMappingFileMinus(
"HoughMappingMinus20160223.dat"),
73 _fFitter3Ds2DFitDrift(0),
74 _wireHitInefficiency(0.),
82 _fXtSimpleFitter3D(0),
83 _trgCDCDataInputMode(0),
88 string desc =
"TRGCDCModule(" +
version() +
")";
92 vector<string> emptyvector;
97 "The filename of CDC trigger config file",
100 "Chooses modules for return value. Can be a list of [TSF, ETF, 2DFind, 2DFit, 3DFind, 3DFit]. If empty list then returnValue will be for all modules.",
104 "The filename of LUT for inner-most track segments",
108 "The filename of LUT for outer track segments",
112 "The filename of root file for TRGCDC",
113 string(
"TRGCDC.root"));
116 "The filename of root file for Fitter3D",
117 string(
"Fitter3D.root"));
120 "Curl back stop parameter",
124 "TRGCDC simulation switch",
128 "TRGCDC fast simulation mode",
132 "TRGCDC firmware simulation mode",
136 "TRGCDC firmware simulation start clock of CDC FE",
140 "TRGCDC firmware simulation stop clock of CDC FE",
144 "Flag for making TRGCDC.root",
148 "Use logic or LUT for TSF",
152 "2D finder perfect option",
156 "3D finder perfect option",
160 "Hough finder min. peak height",
162 addParam(
"HoughFinderMappingFilePlus",
164 "Hough finder cell mapping file for charge plus",
166 addParam(
"HoughFinderMappingFileMinus",
168 "Hough finder cell mapping file for charge minus",
172 "Hough finder doit() version",
176 "Using L/R LUT in fitter3D",
180 "Using MC L/R information for Fitter3D",
184 "Using 1: 2D fit or 0: Hough Finder results for Fitter3D",
188 "Using 1: drift 2D fit or 0: wire 2D fit for Fitter3D",
192 "wire hit inefficiency",
196 "Flag for making TSF.root",
200 "Flag for making ETF.root",
204 "Select ETF ver, 0:histogram, 1:old Version, 2:True T0",
208 "Flag for printing Firmware inputs for ETF",
212 "Flag for making Hough3D.root",
220 "Flag for making Fitter3D.root",
224 "0: Use simple xt curve table. 1: use non-linear xt curve table.",
228 "Flag for TRG CDC input mode",
231 "Name of the CDCHit StoreArray to be used as input.",
234 "Name of the StoreArray holding the tracks made by the 2D finder.",
235 string(
"Trg2DFinderTracks"));
237 "Name of the StoreArray holding the tracks made by the 2D fitter.",
238 string(
"Trg2DFitterTracks"));
240 "Name of the StoreArray holding the tracks made by the 3D fitter.",
241 string(
"Trg3DFitterTracks"));
245 cout <<
"TRGCDCModule ... created" << endl;
254 cout <<
"TRGCDCModule ... destructed " << endl;
263 G4RunManager* g4rm = G4RunManager::GetRunManager();
265 if (g4rm->GetUserPhysicsList() != 0) {
266 _sa =
new TCSAction();
267 g4rm->SetUserAction(
_sa);
274 cout <<
"TRGCDCModule::initialize ... options" << endl;
287 segmentHits.registerInDataStore();
289 cdcHits.isRequired();
308 eventTime.registerInDataStore(
"CDCTriggerEventTime");
347 cdc.getTdcBinWidth(),
357 cout <<
"TRGCDCModule ... beginRun called " << endl;
379 string const& moduleName = *it;
380 if (moduleName ==
"TSF") mask |= TRGCDC::EReturnValueType::TSF;
381 else if (moduleName ==
"ETF") mask |= TRGCDC::EReturnValueType::ETF;
382 else if (moduleName ==
"find2D") mask |= TRGCDC::EReturnValueType::find2D;
383 else if (moduleName ==
"fit2D") mask |= TRGCDC::EReturnValueType::fit2D;
384 else if (moduleName ==
"find3D") mask |= TRGCDC::EReturnValueType::find3D;
385 else if (moduleName ==
"fit3D") mask |= TRGCDC::EReturnValueType::fit3D;
387 if (mask != 0) returnValue &= mask;
395 cout <<
"TRGCDCModule ... endRun called " << endl;
405 cout <<
"TRGCDCModule ... terminate called " << endl;
int _trgCDCDataInputMode
Switch for TRG CDC input mode.
bool _fFitter3Ds2DFitDrift
Switch to us wire 2D fit or drift 2D fit.
int _firmwareSimulationMode
Switch for the firmware simulation. 0:do nothing, 1:do everything.
bool _fLRLUT
Switch for the LR LUT in Fitter3D.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
int _hFinderDoit
Hough finder doit version.
virtual ~TRGCDCModule()
Destructor.
void setDescription(const std::string &description)
Sets the description of the module.
static int level(void)
returns the debug level.
void storeSimulationResults(std::string collection2Dfinder, std::string collection2Dfitter, std::string collection3Dfitter)
Save results of fast simulation to data store (segment hits & tracks).
bool _fLogicLUTTSF
Switch for the Logic/LUT TSF.
std::string m_inputCollectionName
Name of the CDCHit StoreArray used as input.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
void simulate(void)
fast trigger simulation.
bool _perfect2DFinder
Switch to activate perfect 2D finder.
int _curlBackStop
Curl back stop parameter. 0:do nothing, 1:stop curling. Default is 0.
double _wireHitInefficiency
Parameter for Hit inefficiency.
std::vector< std::string > _returnValueModuleNames
returnValue module's name. Can be ["", "TSF", "ETF", "find2D", "fit2D", "find3D", "fit3D"]....
int _fverETF
Switch for selecting ETF version.
int _fastSimulationMode
Switch for the fast simulation. 0:do everything, 1:stop after the track segment simulation....
std::string version(void) const
returns version of TRGCDCModule.
bool _fileTSF
Switch for TSF.root file.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
std::string m_2DfinderCollectionName
Name of the StoreArray holding the tracks made by the 2D finder.
std::string _rootFitter3DFilename
The filename of root file for Fitter3D.
The Class for CDC Geometry Parameters.
int getReturnValue(void) const
gets return value for trg cdc module.
std::string m_2DfitterCollectionName
Name of the StoreArray holding the tracks made by the 2D fitter.
virtual void initialize() override
Initilizes TRGCDCModule.
std::string _configFilename
Config. file name.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
virtual void terminate() override
Called when processing ended.
Abstract base class for different kinds of events.
int _debugLevel
Debug level.
bool _fileFitter3D
Switch for Fitter3D.root file.
Type-safe access to single objects in the data store.
std::string _rootTRGCDCFilename
The filename of root file for TRGCDC.
static TRGCDC * getTRGCDC(void)
returns TRGCDC object.
TRGCDC * _cdc
A pointer to a TRGCDC;.
std::string m_3DfitterCollectionName
Name of the StoreArray holding the tracks made by the 3D fitter.
TRGCDCSteppingAction * _sa
A pointer to a TRGCDCSteppingAction which stops curl backs.
bool _fileTRGCDC
Switch for TRGCDC.root file.
void setReturnValue(int value)
Sets the return value for this module as integer.
void setReturnValue(EReturnValueType const &moduleName, bool flag)
sets return value for trg cdc module.
std::string _hFinderMappingFileMinus
Hough mapping file for charge minus.
virtual void endRun() override
Called when run ended.
void update()
updates TRGCDC wire information. clear() is called in this function.
bool _fXtSimpleFitter3D
Switch for using simple x-t curve or non-linear x-t curve. 0: non-linear 1: simple.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
bool _perfect3DFinder
Switch to activate perfect 3D finder.
bool _fprintFirmETF
Switch for printing Firmware inputs for ETF.
bool _fileETF
Switch for ETF.root file.
static std::string tab(void)
returns tab spaces.
bool _fFitter3Dsmclr
Switch for Fitter3D's MC L/R information.
std::string _innerTSLUTFilename
The filename of LUT for the inner-most track segments.(tmp)
std::string _hFinderMappingFilePlus
Hough mapping file for charge plus.
int _firmwareSimulationStop
Stop clock for the firmware simultion. (clock=cdcfe)
Accessor to arrays stored in the data store.
void terminate(void)
terminates when run is finished
std::string _outerTSLUTFilename
The filename of LUT for outer track segments.(tmp)
bool _fileHough3D
Switch for Hough3D.root file.
virtual void beginRun() override
Called when new run started.
int _firmwareSimulationStart
Start clock for the firmware simultion. (clock=cdcfe)
virtual void event() override
Called event by event.
int _finder3DMode
Sets mode of 3DFinder.
int _hFinderPeakMin
Min. peak height for the Hough finder.
bool _fFitter3Ds2DFit
Switch to us 2D fit or Hough finder results.
int _simulationMode
Mode for TRGCDC simulation. 0th bit : fast simulation switch, 1st bit : firmware simulation switch.