16#define TRGCDC_UNDEFINED 999999
19#include "trg/trg/Clock.h"
20#include "trg/trg/Signal.h"
47 class TRGCDCWireHitMC;
49 class TRGCDCSegmentHit;
53 class TRGCDCTracker2D;
54 class TRGCDCTrackSegmentFinder;
55 class TRGCDCPerfectFinder;
56 class TRGCDCHoughFinder;
57 class TRGCDCHough3DFinder;
61 class TRGCDCEventTime;
80 any =
TSF | ETF | find2D | fit2D | find3D | fit3D
85 unsigned simulationMode = 0,
86 unsigned fastSimulationMode = 0,
91 bool perfect2DFinder =
false,
93 const std::string& innerTSLUTFile =
"?",
94 const std::string& outerTSLUTFile =
"?",
95 const std::string& rootTRGCDCFile =
"?",
96 const std::string& rootFitter3DFile =
"?",
97 unsigned houghFinderPeakMin = 5,
98 const std::string& houghMappingFilePlus =
"?",
99 const std::string& houghMappingFileMinus =
"?",
100 unsigned houghDoit = 2,
101 bool fLogicLUTTSF = 0,
103 bool fFitter3Dsmclr = 0,
104 bool fFitter3Ds2DFit = 1,
105 bool fFitter3Ds2DFitDrift = 0,
106 double inefficiency = 0,
110 bool fprintFirmETF = 0,
111 bool fileHough3D = 0,
112 int finder3DMode = 0,
113 bool fileFitter3D = 0,
114 bool fXtSimpleFitter3D = 0,
115 double TdcBinWidth = 1.,
116 int trgCDCDataInputMode = 0,
117 const std::string& cdchitCollectionName =
"");
126 TRGCDC(
const std::string& configFile,
127 unsigned simulationMode,
128 unsigned fastSimulationMode,
133 bool perfect2DFinder,
135 const std::string& innerTSLUTFile,
136 const std::string& outerTSLUTFile,
137 const std::string& rootTRGCDCFile,
138 const std::string& rootFitter3DFile,
139 unsigned houghFinderPeakMin,
140 const std::string& houghMappingFilePlus,
141 const std::string& houghMappingFileMinus,
146 bool fFitter3Ds2DFit,
147 bool fFitter3Ds2DFitDrift,
156 bool fXtSimpleFitter3D,
158 int trgCDCDataInputMode,
159 const std::string& cdchitCollectionName);
166 const std::string& houghMappingFilePlus,
167 const std::string& houghMappingFileMinus,
182 std::string collection2Dfitter,
183 std::string collection3Dfitter);
193 std::string
name(
void)
const;
196 std::string
version(
void)
const;
202 unsigned mode(
void)
const;
205 unsigned mode(
unsigned);
223 void dump(
const std::string& message)
const;
273 const std::vector<TRGCDCLayer*>*
superLayer(
unsigned id)
const;
280 unsigned nWires(
void)
const;
353 std::vector<const TRGCDCWireHit*>
hits(
void)
const;
357 std::vector<const TRGCDCWireHit*>
axialHits(
void)
const;
361 std::vector<const TRGCDCWireHit*>
stereoHits(
void)
const;
365 std::vector<const TRGCDCSegmentHit*>
segmentHits(
void)
const;
369 std::vector<const TRGCDCSegmentHit*>
segmentHits(
unsigned)
const;
381 std::vector<const TRGCDCWireHitMC*>
hitsMC(
void)
const;
392 std::string
wireName(
unsigned wireId)
const;
395 unsigned localId(
unsigned wireId)
const;
398 unsigned layerId(
unsigned wireId)
const;
401 unsigned layerId(
unsigned axialStereoSwitch,
402 unsigned axialStereoLayerId)
const;
412 unsigned axialStereoLayerId)
const;
647 std::vector<TRGCDCSegment*>
_tss;
650 std::vector<TRGCDCSegment*>
_tsSL[9];
834 const std::vector<TRGCDCLayer*>*
942 return *
_tsSL[a * 2][b];
949 return *
_tsSL[a * 2 + 1][b];
995 std::vector<const TRGCDCSegmentHit*>
998 std::vector<const TRGCDCSegmentHit*> t;
1004 std::vector<const TRGCDCSegmentHit*>
1007 std::vector<const TRGCDCSegmentHit*> t;
1013 std::vector<const TRGCDCSegmentHit*>
1016 std::vector<const TRGCDCSegmentHit*> t;
1022 std::vector<const TRGCDCSegmentHit*>
1025 std::vector<const TRGCDCSegmentHit*> t;
This class is the interface between TSim/basf2 TSF module and the firmware simulation core of XSim/IS...
The Class for CDC Geometry Parameters.
A class to fit tracks in 3D.
A class to represent a CDC front-end board.
class of TRGCDCHough3DFinder
A class to find tracks using Hough algorithm.
A class to represent a cell layer.
A class to represent a CDC merger board.
A module to simulate the CDC trigger.
A class to find 2D tracks using MC information.
A class to represent a wire in CDC.
a class of TrackSegmentFinder in TRGCDC
A class to represent a CDC 2D tracker board.
A class to represent a wire in CDC.
The instance of TRGCDC is a singleton.
TClonesArray * m_fitParameters
3D fit
bool _fileFitter3D
Switch for Fitter3D.root file.
std::vector< TRGCDCTrack * > _trackList3D
Track list for 3D fitted tracks.
std::vector< TRGCDCTracker2D * > _tracker2Ds
CDC 2D finder boards.
const double _offset
Timing offset of CDC trigger.
bool _fFitter3Ds2DFitDrift
Switch to us wire 2D fit or drift 2D fit.
int _firmwareSimulationStopDataClock
Firmware simulation stop clock in CDCTRG data clock.
std::vector< TRGCDCWireHit * > _axialHits
CDC hits on axial wires.
bool _fFitter3Ds2DFit
Switch to us 2D fit or Hough finder results.
unsigned _simulationMode
Simulation mode.
TClonesArray * m_rootTRGRawInformation
[0]: iLayer, [1]: iWire, [2]: Timing(CDC), [3]: MatchNumber MatchNumber: 1: Only CDC,...
std::string _configFilename
CDC trigger configuration filename.
TTree * m_tree
root tree for reconstructed 3D tracks
std::vector< std::vector< TRGCDCLayer * > * > _superLayers
Super layers.
unsigned _fastSimulationMode
Fast simulation mode.
TTree * m_treeAllTracks
root tree for MC tracks
std::vector< TRGCDCWire * > _hitWires
Wires with a hit.
std::vector< TRGCDCSegment * > _tsSL[9]
Track Segments.
int _trgCDCDataInputMode
Switch for TRG CDC input mode.
std::string _cdchitCollectionName
name of the CDCHit DataStore array used as input
int _debugLevel
Debug level.
void perfect3DFinder(std::vector< TRGCDCTrack * > trackList) const
fills stereo TSs to tracks using MC info.
std::vector< TRGCDCTrack * > _trackList2DFitted
Track list for 2D fitted tracks.
int _finder3DMode
Sets mode of 3DFinder.
std::vector< TRGCDCTrackSegmentFinder * > _tsfboards
CDC trigger tsf boards.
bool _fXtSimpleFitter3D
Switch for using simple x-t curve or non-linear x-t curve. 0: non-linear 1: simple.
TClonesArray * m_mcParameters
MC.
float _fudgeFactor
Fudge factor for position error.
float * _width
Cell width in radian.
std::string _outerTSLUTFilename
The filename of LUT for outer track segments.
std::string _innerTSLUTFilename
The filename of LUT for the inner-most track segments.
bool _fLogicLUTTSF
Switch for logic or LUT TSF.
int _fverETF
Switch for selecting ETF version.
std::vector< TRGCDCWireHitMC * > _hitsMC
MC info. of CDC hits.
unsigned _firmwareSimulationMode
Firmware simulation mode.
TClonesArray * m_mcTrackVertexVector
MC vertex.
std::vector< TRGCDCSegment * > _tss
Track Segments.
const bool _perfect2DFinder
Switch to activate perfect 2D finder.
bool _fileHough3D
Switch for Hough3D.root file.
std::vector< TRGCDCLayer * > _stereoLayers
Stereo layers.
const TRGClock _clockD
CDC trigger data clock.
bool _fileTSF
Switch for TSF.root file.
bool _fileETF
Switch for ETF.root file.
std::vector< std::vector< TRGCDCLayer * > * > _stereoSuperLayers
Stereo super layers.
std::string _rootTRGCDCFilename
The filename of root file for TRGCDC.
std::vector< TRGCDCSegmentHit * > _segmentHits
Track Segments with hits.
std::vector< TRGCDCLayer * > _tsLayers
Track Segment layers.
TTree * m_treeROOTInput
Debugging members for firmware ROOT input.
std::vector< TRGCDCWireHit * > _badHits
Bad CDC hits.(not used now)
bool _makeRootFile
Switch for TRGCDC.root file.
std::vector< TRGLink * > _links
All serial links.
EReturnValueType
Enum for returnValue types.
int _returnValue
Return value for trg cdc module;.
std::vector< TRGCDCTrack * > _trackList2D
Track list by 2D finding.
bool _fprintFirmETF
Switch for printing Firmware inputs for ETF.
TRGCDCHoughFinder * _hFinder
Hough finder.
TRGCDCTrackSegmentFinder * _tsFinder
Track Segement Finder.
std::vector< TRGCDCEventTime * > _eventTime
EventTime.
TClonesArray * m_mcTrack4Vector
MC track.
TRGSignal _firmwareSimulationWindow
Firmware simulation time window in FE.
std::vector< TRGCDCWire * > _wires
All wires.
TClonesArray * m_rootTRGHitInformation
[0]: iLayer, [1]: iWire, [2]: window number, [3]: priority timing
std::vector< TRGCDCLayer * > _layers
All layers.
const TRGClock _clock
CDC trigger system clock.
TClonesArray * m_mcTrackStatus
MC track status.
const bool _perfect3DFinder
Switch to activate perfect 3D finder.
double _inefficiency
Hit inefficiency parameter.
TClonesArray * m_evtTime
Event time.
TRGCDCFitter3D * _fitter3D
3D fitter.
std::string getCDCHitCollectionName() const
get name of the CDCHit DataStore array used as input
std::vector< TRGCDCFrontEnd * > _fronts
CDC front-end boards.
std::vector< TRGCDCSegmentHit * > _segmentHitsSL[9]
Track Segments with hits in each super layer.
std::vector< TRGCDCWireHit * > _stereoHits
CDC hits on stereo wires.
const TRGClock & userClock3125(void) const
returns the user clock for Aurora 3.125 Gbps.
int _firmwareSimulationStop
Fimrware simulation stop clock in FE.
int _firmwareSimulationStart
Fimrware simulation start clock in FE.
TRGCDCPerfectFinder * _pFinder
Perfect 2D finder.
std::vector< std::vector< TRGCDCLayer * > * > _axialSuperLayers
Axial super layers.
TClonesArray * _tracks2D
2D track information
std::vector< TRGCDCLayer * > _axialLayers
Axial layers.
int m_eventNum
Event number.
TRGCDCPerfectFinder * _p3DFinder
Perfect 3D finder.
CDC::CDCGeometryPar * m_cdcp
returns a pointer to CDCGeometryPar
TRGCDCHough3DFinder * _h3DFinder
Hough 3D finder.
const TRGClock _clockUser3125
CDC trigger user clock for Aurora 3.125 Gbps.
void updateMC(void)
updates TRGCDC information for MC.
std::vector< TRGCDCWireHit * > _hits
CDC hits.
const TRGClock _clockFE
CDC front end clock. Resolution is CDC TdcBinWidth.
std::string _rootFitter3DFilename
The filename of root file for Fitter3D.
bool _fFitter3Dsmclr
Switch for MC L/R information in Fitter3D.
std::vector< TRGCDCMerger * > _mergers
CDC trigger merger boards.
bool _fLRLUT
Switch for the LR LUT in Fitter3D.
const TRGClock _clockUser6250
CDC trigger user clock for Aurora 6.250 Gbps.
TTree * _tree2D
root tree for 2D tracks
const TRGClock _clockTDC
CDC trigger TDC clock.
const std::string _cdcVersion
CDC version.
int _firmwareSimulationStartDataClock
Firmware simulation start clock in CDCTRG data clock.
TClonesArray * m_rootCDCHitInformation
[0]: iLayer, [1]: iWire, [2]: CDCADC, [3]: CDCTDC, [4]: CDC FE TRG timing
A class to represent a digitized signal. Unit is nano second.
A class to represent a digitized signal. Unit is nano second.
const TRGCDCMerger * merger(unsigned id) const
returns a merger board.
std::vector< const TRGCDCSegmentHit * > segmentHits(void) const
returns a list of TRGCDCSegmentHit.
std::vector< TRGCDCTrack * > getTrackList2DFitted(void)
returns 2D fitted track list.
unsigned nAxialLayers(void) const
return # of axial layers.
const TRGClock & systemClock(void) const
calculates corrected drift time.
unsigned localId(unsigned wireId) const
returns local ID in a layer. This function is expensive.
void configure(void)
configures trigger modules for firmware simulation.
int debugLevel(void) const
returns debug level.
std::vector< const TRGCDCSegmentHit * > axialSegmentHits(unsigned) const
returns a list of TRGCDCSegmentHit in a axial super layer N.
unsigned nSegmentLayers(void) const
returns # of track segment layers.
float fudgeFactor(void) const
returns fudge factor for drift time error.
static TRGCDC * getTRGCDC(void)
returns TRGCDC object.
void setReturnValue(EReturnValueType const &moduleName, bool flag)
sets return value for trg cdc module.
int firmwareSimulationStopDataClock(void) const
returns stop clock of the firmware simulation in data clock.
unsigned layerId(unsigned wireId) const
returns layer ID. This function is expensive.
std::string name(void) const
simulates track segment decisions.
unsigned localLayerId(unsigned wireId) const
returns local layer ID in a super layer. This function is expensive.
const TRGClock & TDCClock(void) const
returns the system clock of the trigger TDC after mergers (2 * front-end binwidth)
void fastClear(void)
clears TRGCDC information.
std::vector< const TRGCDCSegmentHit * > stereoSegmentHits(unsigned) const
returns a list of TRGCDCSegmentHit in a stereo super layer N.
std::string wireName(unsigned wireId) const
returns wire name.
const TRGCDCTracker2D * tracker2D(unsigned id) const
returns a 2D tracker board.
float cellWidth(unsigned superLayerId) const
returns cell width in unit of radian.
const TRGCDCSegment & stereoSegment(unsigned lyrId, unsigned id) const
returns a track segment in stereo layers. (lyrId is stereo #)
void terminate(void)
terminates when run is finished
const TRGCDCLayer * segmentLayer(unsigned id) const
returns a pointer to a track segment layer.
const TRGCDCFrontEnd * frontEnd(unsigned id) const
returns a front-end board.
TRGCDCTrackSegmentFinder * tsfboard(unsigned id) const
returns a TSF board.
bool neighbor(const TRGCDCWire &w0, const TRGCDCWire &w1) const
returns true if w0 and w1 are neighbor.
virtual ~TRGCDC()
Destructor.
void saveTRGHitInformation(std::vector< std::vector< int > > &)
Save functions for ROOT.
std::vector< TRGCDCTrack * > getTrackList3D(void)
returns 3D track list (fitted).
unsigned mode(void) const
sets simulation mode.
unsigned nAxialSuperLayers(void) const
return # of axial super layers.
std::vector< const TRGCDCWireHitMC * > hitsMC(void) const
returns a list of TRGCDCWireHitMC.
const TRGClock & dataClock(void) const
returns the data clock.
unsigned nSegments(void) const
returns # of track segments.
unsigned nLocalLayers(unsigned superLayerId) const
returns # of wire layers in a super layer.
float superLayerR(unsigned superLayerId) const
returns inner radius of super layer.
unsigned axialStereoSuperLayerId(unsigned axialStereo, unsigned axialStereoLayerId) const
returns axialStereo super layer ID. This function is expensive.
unsigned firmwareSimulationMode(void) const
returns firmware simulation mode.
unsigned nSuperLayers(void) const
returns # of super layers.
int firmwareSimulationStart(void) const
returns start clock of the firmware simulation in FE clock.
unsigned nStereoLayers(void) const
returns # of stereo layers.
int firmwareSimulationStartDataClock(void) const
returns start clock of the firmware simulation in data clock.
std::string versionCDC(void) const
returns CDC version.
void initialize(unsigned houghFinderPeakMin, const std::string &houghMappingFilePlus, const std::string &houghMappingFileMinus, unsigned houghDoit)
initializes CDC geometry.
const TRGCDCSegment & segment(unsigned id) const
returns a track segment.
void saveTRGRawInformation(std::vector< std::string > &)
Save functions for ROOT.
unsigned nLayers(void) const
return # of layers.
int getEventTime(void) const
returns bad hits(finding invalid hits).
const std::vector< TRGCDCLayer * > * superLayer(unsigned id) const
returns a pointer to a super-layer.
void dump(const std::string &message) const
dumps debug information.
std::vector< const TRGCDCWireHit * > stereoHits(void) const
returns a list of stereo hits.
const TRGCDCSegment & axialSegment(unsigned lyrId, unsigned id) const
returns a track segment in axial layers. (lyrId is axial #)
std::vector< TRGCDCTrack * > getTrackList2D(void)
returns 2D track list (no fit).
std::vector< const TRGCDCWireHit * > axialHits(void) const
returns a list of axial hits.
unsigned superLayerId(unsigned wireId) const
returns super layer ID. This function is expensive.
double systemOffsetMC(void) const
returns the system offset in MC.
std::vector< const TRGCDCWireHit * > hits(void) const
returns a list of TRGCDCWireHit.
int getReturnValue(void) const
gets return value for trg cdc module.
static TRGCDC * _cdc
CDC trigger singleton.
const TRGCDCLayer * layer(unsigned id) const
returns a pointer to a layer. 0 will be returned if 'id' is invalid.
void update()
updates TRGCDC wire information. clear() is called in this function.
unsigned nStereoSuperLayers(void) const
returns # of stereo super layers.
void fastSimulation(void)
Fast simulation.
std::string version(void) const
returns version.
float superLayerR2(unsigned superLayerId) const
returns (inner radius)^2 of super layer.
unsigned nWires(void) const
return # of wires.
void simulate(void)
fast trigger simulation.
void clear(void)
clears all TRGCDC hit information.
void saveCDCHitInformation(std::vector< std::vector< unsigned > > &)
Save functions for ROOT.
void firmwareSimulation(void)
Firmware simulation.
void classification(void)
classify hits.
void updateByData(int inputMode)
updates TRGCDC wire information by Hardware data 0: From CDC FE ASCII file (Implementing) 1: From CDC...
const TRGClock & systemClockFE(void) const
returns the system clock of the front-end
void storeSimulationResults(std::string collection2Dfinder, std::string collection2Dfitter, std::string collection3Dfitter)
Save results of fast simulation to data store (segment hits & tracks).
int firmwareSimulationStop(void) const
returns stop clock of the firmware simulation in FE clock.
const TRGCDCWire * wire(unsigned wireId) const
returns a pointer to a wire.
Abstract base class for different kinds of events.