Belle II Software development

Modules

 trg data objects
 
 trg modules
 

Namespaces

namespace  Belle2::CDC
 

Classes

class  CDCTrigger2DConfig
 The payload class for delay of GDL input bit. More...
 
class  CDCTriggerDeadch
 The payload class for delay of GDL input bit. More...
 
class  CDCTriggerNeuroConfig
 The payload class for all CDC Neurotrigger information. More...
 
class  TRGCDCCell
 A class to represent a wire in CDC. More...
 
class  TRGCDCCellHit
 A class to represent a wire hit in CDC. More...
 
class  TRGCDCCircle
 A class to represent a circle. More...
 
class  TRGCDCCircleFitter
 A class to fit a TTrackBase object to a circle. More...
 
struct  clustererParams
 
class  SimpleCluster
 Type for found clusters. More...
 
class  Clusterizend
 Clustering module. More...
 
class  TRGCDCEventTime
 A class of TRGCDC Event Time. More...
 
class  TRGCDCEventTimeFinder
 A class of TRGCDC Event Time Finder. More...
 
class  TRGCDCFitter
 A class to fit a TRGCDCTrackBase object. More...
 
class  TRGCDCFitter3D
 A class to fit tracks in 3D. More...
 
class  TRGCDCFrontEnd
 A class to represent a CDC front-end board. More...
 
class  TRGCDCHelix
 TRGCDCHelix parameter class. More...
 
class  TRGCDCHough3DFinder
 class of TRGCDCHough3DFinder More...
 
class  TRGCDCHoughFinder
 A class to find tracks using Hough algorithm. More...
 
class  TRGCDCHoughPlane
 A class to represent a Hough parameter plane. More...
 
class  TRGCDCHoughPlaneBase
 A class to represent a Hough parameter plane. More...
 
class  TRGCDCHoughPlaneBoolean
 A class to represent a Hough parameter plane. More...
 
class  TRGCDCHoughPlaneMulti
 A class to represent a Hough parameter plane. More...
 
class  TRGCDCHoughPlaneMulti2
 A class to represent a Hough parameter plane. More...
 
class  TRGCDCHoughTransformation
 An abstract class to represent a Hough transformation. More...
 
class  TRGCDCHoughTransformationCircle
 A class to represent circle Hough transformation. More...
 
class  TRGCDCJLUT
 A class to use LUTs for TRGCDC. More...
 
class  TRGCDCJSignal
 A class to use Signals for TRGCDC 3D tracker. More...
 
class  TRGCDCJSignalData
 A class to hold common data for JSignals. More...
 
class  TRGCDCLayer
 A class to represent a cell layer. More...
 
class  TRGCDCLink
 A class to relate TRGCDCCellHit and TRGCDCTrack objects. More...
 
class  TRGCDCLpar
 TRGCDCLpar class. More...
 
class  TRGCDCLpav
 TRGCDCLpav class. More...
 
class  TRGCDCLUT
 A class to use LUTs for TRGCDC. More...
 
class  TRGCDCMerger
 A class to represent a CDC merger board. More...
 
struct  cellweight
 
class  NDFinderTrack
 Store track parameters of found tracks. More...
 
class  NDFinder
 Class to represent the CDC NDFinder. More...
 
struct  ndbinning
 Default binning in a (7/32) phi-sector. More...
 
class  NeuroTrigger
 Class to represent the CDC Neurotrigger. More...
 
class  NNTParam< T >
 Class to represent a complete set to describe a Neurotrigger. More...
 
class  NeuroTriggerParameters
 
class  TRGOpticalLinkFrontEnd
 A class to represent a serial link between trigger modules. More...
 
class  TRGCDCPeakFinder
 A class to find peaks in Hough Plane. More...
 
class  TRGCDCPerfectFinder
 A class to find 2D tracks using MC information. More...
 
class  TRGCDCRelation
 A class to represent a wire in CDC. More...
 
class  TRGCDCSegment
 A class to represent a wire in CDC. More...
 
class  TRGCDCSegmentHit
 A class to represent a track segment hit in CDC. More...
 
class  TRGCDCSteppingAction
 A class to control a track in G4. More...
 
class  TRGCDCTrackBase
 A class to represent a track object in TRGCDC. More...
 
class  TRGCDCTracker2D
 A class to represent a CDC 2D tracker board. More...
 
class  TRGCDCTrackMC
 A class to represent a GEN_HEPEVT particle in tracking. More...
 
class  TRGCDCTrackSegmentFinder
 a class of TrackSegmentFinder in TRGCDC More...
 
class  TRGCDC
 The instance of TRGCDC is a singleton. More...
 
class  TRGCDCTrack
 A class to represent a reconstructed charged track in TRGCDC. More...
 
class  TRGCDCWire
 A class to represent a wire in CDC. More...
 
class  TRGCDCWireHit
 A class to represent a wire hit in CDC. More...
 
class  TRGCDCWireHitMC
 A class to represent a MC wire hit in CDC. More...
 
class  TRGECLBadRun
 Raw TC result nefor digitizing. More...
 
class  TrgEclDatabaseImporter
 Database importer of TRGECL. More...
 
class  TRGECLETMPara
 Raw TC result nefor digitizing. More...
 
class  TRGECLFAMPara
 Raw TC result nefor digitizing. More...
 
class  TRGECLTMMPara
 Raw TC result nefor digitizing. More...
 
class  TrgEclBeamBKG
 A Class of ECL Trigger clustering
More...
 
class  TrgEclBhabha
 A Class of ECL Trigger clustering
More...
 
class  TrgEclCluster
 A Class of ECL Trigger clustering
More...
 
class  TrgEclDataBase
 class TrgEclDataBase; More...
 
class  TrgEclDigitizer
 FAM module
More...
 
class  TrgEclFAMFit
 FAM module
More...
 
class  TrgEclMapping
 A class of TC Mapping. More...
 
class  TrgEclMaster
 ETM class. More...
 
class  TrgEclTiming
 A Class of ECL Trigger clustering
More...
 
class  TRGGDLDBAlgs
 The payload class for GDL algorithm. More...
 
class  TRGGDLDBDelay
 The payload class for delay of GDL input bit. More...
 
class  TRGGDLDBUnpacker
 The payload class for PXD cluster charge calibrations. More...
 
class  TrgBit
 A general interface to get a trigger response. More...
 
class  TRGGDL
 The instance of TRGGDL is a singleton. More...
 
class  GRLNeuro
 Class to represent the GRL Neuro. More...
 
class  TRGGRL
 a class for TRGGRL More...
 
class  TRGGRLMatch
 A class to represent a matching candidate in TRGGRL A matching candidate consists of a TRGCDCTrack and TRGECLCluster. More...
 
class  KLMTriggerParameters
 DBObject containing parameters used in KLMTrigger module. More...
 
class  TRGArea2D
 A class to represent an 2D area. More...
 
class  TRGBitStream
 A class to represent a bit stream. More...
 
class  TRGBoard
 A class to represent a trigger board. More...
 
class  TRGChannel
 A class to represent a serial link between trigger hardware modules. More...
 
class  TRGClock
 A class to represent a digitized signal. Unit is nano second. More...
 
class  TRGDebug
 A class for debugging of TSIM. More...
 
class  TRGOpticalLink
 A class to represent a serial link between trigger modules. More...
 
class  TRGPoint2D
 A class to represent a point in 2D. More...
 
class  TRGSignal
 A class to represent a digitized signal. Unit is nano second. More...
 
class  TRGSignalBundle
 A class to represent a bundle of SignalVectors. More...
 
class  TRGSignalVector
 A class to represent a bundle of digitized signals. More...
 
class  TRGState
 A class to represent a state of multi bits. More...
 
class  TRGTime
 A class to represent a signal timing in the trigger system. More...
 
class  TRGUtilities
 A class to provide TRG utility functions. More...
 

Macros

#define TRGCDCFitAlreadyFitted   1;
 parameter to identify fit result
 
#define TRGCDCFitErrorFewHits   -1;
 parameter to identify fit result
 
#define TRGCDCFitFailed   -2;
 parameter to identify fit result
 
#define TRGCDCFitUnavailable   -3;
 parameter to identify fit result
 
#define TFITTER_INLINE_DEFINE_HERE
 
#define N_LAYERS   6
 number of layers
 
#define WireInnerLeft   0
 type of the wire
 
#define WireInnerRight   1
 type of the wire
 
#define WireLeft   2
 type of the wire
 
#define WireRight   3
 type of the wire
 
#define WireOuterLeft   4
 type of the wire
 
#define WireOuterRight   5
 type of the wire
 
#define MaxNeighbors   6
 Max number of neighbors.
 

Typedefs

typedef HepGeom::Point3D< double > Point3D
 3D point
 
typedef HepGeom::Vector3D< double > Vector3D
 3D Vector
 
typedef unsigned short c5elem
 Store hit patterns in a 5D array (hitid, prio, omega, phi, theta)
 
typedef boost::multi_array< c5elem, 5 > c5array
 
typedef c5array::index c5index
 
typedef unsigned short c3elem
 The Hough space is a 3D array (omega, phi, theta)
 
typedef boost::multi_array< c3elem, 3 > c3array
 
typedef c3array::index c3index
 
typedef unsigned short c2elem
 TS-Id to 1/32 phi-sector mapping is stored in a 2D array.
 
typedef boost::multi_array< c2elem, 2 > c2array
 
typedef c2array::index c2index
 
typedef std::vector< c3index > cell_index
 
typedef unsigned short ushort
 

Functions

int intersect (const TRGCDCLpar &lp1, const TRGCDCLpar &lp2, CLHEP::HepVector &v1, CLHEP::HepVector &v2)
 intersection
 
std::ostream & operator<< (std::ostream &o, const TRGCDCLpar &s)
 ostream operator
 
float prob_ (float *, int *)
 prob function
 
static double err_dis_inv (double x, double y, double w, double a, double b)
 distance error
 
std::ostream & operator<< (std::ostream &o, const TRGCDCLpav &a)
 ostream operator
 
TRGCDCLpav operator+ (const TRGCDCLpav &la1, const TRGCDCLpav &la2)
 
bool rlrel (vector< unsigned > a, vector< unsigned > b)
 ...rlrel...
 
bool udrel (vector< unsigned > a, vector< unsigned > b)
 ...udrel...
 
bool mirel (vector< unsigned > a, vector< unsigned > b)
 ...mirel...
 
unsigned short FindCP1 (vector< unsigned > a)
 ...Find center Pattern1 from Pattern 2
 
unsigned FindP1C (vector< unsigned > a)
 ...Pattern1 Center...
 
void ftd_0_01 (bool *b, const bool *i)
 
int doprescale (int f)
 select one event in number of prescale factor events
 
std::ostream & operator<< (std::ostream &, const TRGPoint2D &)
 ostrream operator
 
const HepGeom::Point3D< double > ORIGIN (0, 0, 0)
 Origin 3D point.
 
unsigned id (void) const
 returns id.
 
unsigned localId (void) const
 returns local id in a layer.
 
unsigned layerId (void) const
 returns layer id.
 
unsigned superLayerId (void) const
 returns super layer id.
 
unsigned localLayerId (void) const
 returns local layer id in a super layer.
 
const TRGCDCLayerlayer (void) const
 returns a pointer to a layer.
 
unsigned state (void) const
 returns state.
 
unsigned state (unsigned newState)
 sets state.
 
bool axial (void) const
 returns true if this wire is in an axial layer.
 
bool stereo (void) const
 returns true if this wire is in a stereo layer.
 
unsigned axialStereoLayerId (void) const
 returns id of axial or stereo layer id.
 
unsigned axialStereoSuperLayerId (void) const
 returns id of axial or stereo super layer id.
 
bool innerPart (void) const
 returns true if this wire is in the inner part.
 
bool mainPart (void) const
 returns true if this wire is in the main part.
 
float cellSize (void) const
 calculates position and direction vector with sag correction.
 
virtual void clear (void)
 clears information.
 
const HepGeom::Point3D< double > & forwardPosition (void) const
 returns position in forward endplate.
 
const HepGeom::Point3D< double > & backwardPosition (void) const
 returns position in backward endplate.
 
double * backwardPosition (double p[3]) const
 position in backward endplate.
 
const HepGeom::Point3D< double > & xyPosition (void) const
 returns middle position of a wire. z componet is 0.
 
double * xyPosition (double p[3]) const
 middle position of a wire. z componet is 0.
 
const Vector3Ddirection (void) const
 returns direction vector of the wire.
 
const TRGCDCCellHithit (void) const
 returns a pointer to a TRGCDCCellHit.
 
const TRGCDCCellHithit (const TRGCDCCellHit *)
 sets a pointer to TRGCDCWireHit.
 
virtual bool hasMember (const std::string &a) const
 returns true this has member named a.
 
int mcLR (void) const
 returns mc left/right information
 
virtual const TRGCDCCellcell (void) const
 returns a pointer to a TRGCDCWire.
 
unsigned state (void) const
 returns state.
 
float drift (unsigned) const
 returns drift distance.
 
float dDrift (unsigned) const
 returns drift distance error.
 
float drift (void) const
 returns drift distance.
 
float dDrift (void) const
 returns drift distance error.
 
const HepGeom::Point3D< double > & xyPosition (void) const
 returns position in the middle of wire. z is always zero, however.
 
unsigned state (unsigned newState)
 sets state. Meaning of bits are written below.
 
unsigned state (unsigned newState) const
 sets state. Meaning of bits are written below. (tmp)
 
const void * track (void) const
 assigns a pointer to a TTrack.
 
const void * track (const void *)
 assigns a pointer to a TTrack.
 
const void * track (const void *) const
 assigns a pointer to a TTrack. (tmp)
 
unsigned sequence (void) const
 returns sequential Length in one segment : this parameter is used in TCurlFinder now.
 
unsigned sequence (unsigned) const
 sets sequential length in one segment : this parameter is used in TCurlFinder now.
 
void setDriftTime (double driftTime, unsigned i)
 Sets drift time.
 
unsigned iCDCHit (void) const
 returns an index to CDCHit.
 
unsigned iCDCSimHit (void) const
 returns an index to CDCSimHit.
 
unsigned iMCParticle (void) const
 returns an index to MCParticle.
 
double pt (void) const override
 returns Pt.
 
const TRGPoint2Dcenter (void) const
 returns the circle center.
 
double radius (void) const
 returns radius.
 
virtual unsigned objectType (void) const override
 returns type.
 
void property (double charge, double radius, HepGeom::Point3D< double > center)
 sets circle properties.
 
const std::string & name (void) const
 returns name.
 
const HepGeom::Point3D< double > & center (void) const
 returns position of helix center(z = 0.);
 
const HepGeom::Point3D< double > & pivot (void) const
 returns pivot position.
 
double radius (void) const
 returns radious of helix.
 
CLHEP::Hep3Vector direction (double dPhi=0.) const
 returns direction vector after rotating angle dPhi in phi direction.
 
double dr (void) const
 returns dr.
 
double phi0 (void) const
 returns phi0.
 
double kappa (void) const
 returns kappa.
 
double dz (void) const
 returns dz.
 
double tanl (void) const
 returns tanl.
 
double curv (void) const
 returns curvurture.
 
const CLHEP::HepVector & a (void) const
 returns helix parameters.
 
const CLHEP::HepSymMatrix & Ea (void) const
 returns error matrix.
 
const CLHEP::HepVector & a (const CLHEP::HepVector &newA)
 sets helix parameters.
 
const CLHEP::HepSymMatrix & Ea (const CLHEP::HepSymMatrix &newdA)
 sets helix paramters and error matrix.
 
double bFieldZ (double)
 sets and returns z componet of the magnetic field.
 
double bFieldZ (void) const
 returns z componet of the magnetic field.
 
double sinPhi0 (void) const
 returns sin(phi0).
 
double cosPhi0 (void) const
 return cos(phi0).
 
std::string name (void) const
 returns name.
 
unsigned setEntry (unsigned serialId, unsigned n) override
 Sets entry.
 
void clear (void) override
 clear all entries.
 
void clearCells (void)
 Clears entires only.
 
unsigned entry (unsigned id) const override
 returns entry in a cell.
 
unsigned entry (unsigned x, unsigned y) const override
 returns entry in a cell.
 
int maxEntry (void) const override
 returns max. entry in a plane.
 
virtual unsigned nActiveCellsInPattern (void) const
 returns # of active cells in the pattern.
 
void add (unsigned cellId, int weight) override
 Add to a cell.
 
float charge (void) const
 returns charge for this plane.
 
float charge (float charge)
 sets and returns charge for this plane.
 
std::string name (void) const
 returns name.
 
unsigned nX (void) const
 returns # of x bins.
 
float xMin (void) const
 returns min. of x.
 
float xMin (float newXMin)
 sets and returns min. of x.
 
float xMax (void) const
 returns max. of x.
 
float xMax (float newXMax)
 sets and returns max. of x.
 
float xSize (void) const
 returns size of x bin.
 
unsigned nY (void) const
 return # of y bins.
 
float yMin (void) const
 returns min. of y.
 
float yMin (float newYMin)
 sets and returns min. of y.
 
float yMax (void) const
 returns max. of y.
 
float yMax (float newYMax)
 sets and returns max. of y.
 
float ySize (void) const
 returns size of y bin.
 
unsigned serialId (unsigned x, unsigned y) const
 returns serial ID for position (x, y).
 
unsigned serialId (const TRGPoint2D &p) const
 returns serial ID for position p.
 
TRGPoint2D position (unsigned x, unsigned y) const
 returns position in Hough plain for a cell (x, y)..
 
std::vector< unsigned > neighbors (unsigned serialID, unsigned windowSize=1) const
 returns neighbors.
 
void setRegion (std::vector< unsigned > *)
 Sets region.
 
const std::vector< std::vector< unsigned > * > & regions (void) const
 returns regions.
 
unsigned neighbor (unsigned serialID, unsigned direction) const
 returns neighbor cell.
 
void id (unsigned serialId, unsigned &x, unsigned &y) const
 returns x and y for serialID.
 
void clearRegions (void)
 Clears regions.
 
virtual void clear (void)=0
 Clears all entries.
 
virtual void vote (float rx, float ry, int weight=1)
 Voring.
 
virtual void vote (float xOffset, int weight=1)
 Votes using a pattern.
 
const TRGCDCHoughTransformationtransformation (void) const
 returns Hough transformation object.
 
unsigned setEntry (unsigned serialId, unsigned n) override
 Sets entry.
 
void clear (void) override
 clear all entries.
 
void vote (float rx, float ry, int weight=1) override
 Votes.
 
unsigned entry (unsigned id) const override
 returns entry in a cell.
 
unsigned entry (unsigned x, unsigned y) const override
 returns count of a cell.
 
int maxEntry (void) const override
 returns max. count in a plane.
 
void add (unsigned cellId, int weight) override
 Add to a cell.
 
const std::vector< unsigned > & patternId (unsigned cellId) const
 returns pattern ID which activates specified cell.
 
void clear (void) override
 Clears all entries.
 
void registerPattern (unsigned id) override
 registers a pattern..
 
virtual unsigned nActiveCellsInPattern (unsigned layerId) const
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
 dump debug info
 
void clear (void) override
 Clears all entries and regions.
 
void clearCells (void)
 Clears entires only.
 
void clear (unsigned layerId)
 Clears only specified layer ID.
 
void vote (float rx, float ry, int charge, unsigned layerId, int weight=1)
 Voting.
 
void vote (float rx, float ry, unsigned layerId, int weight=1)
 Voting.
 
void dump (unsigned layerId) const
 Dumps debug information.
 
void vote (unsigned layerId, unsigned localId, int weight=1)
 Voting.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
 Dumps debug information.
 
void registerPattern (unsigned layerId, unsigned id)
 registers a pattern..
 
const std::vector< unsigned > & patternId (unsigned layer, unsigned cellId) const
 returns pattern ID in a layer which activates specified cell.
 
void preparePatterns (unsigned layerId, unsigned nPatterns)
 allocate memory for patterns.
 
unsigned nLayers (void) const
 returns # of Hough Boolean layers.
 
unsigned setEntry (unsigned serialId, unsigned layerId, unsigned n)
 Sets entry.
 
std::string name (void) const
 returns name.
 
std::string name (void) const
 Operators.
 
unsigned id (void) const
 returns id.
 
unsigned superLayerId (void) const
 returns super layer id.
 
unsigned localLayerId (void) const
 returns local layer id in a super layer.
 
float offset (void) const
 returns offset.
 
int nShifts (void) const
 returns shifts. (non-zero for stereo layers)
 
unsigned nCells (void) const
 returns # of cells.
 
bool axial (void) const
 returns true if this is an axial layer.
 
bool stereo (void) const
 returns true if this is a stereo layer.
 
unsigned axialStereoLayerId (void) const
 returns id of axial or stereo id.
 
unsigned axialStereoSuperLayerId (void) const
 returns id of axial or stereo super layer id.
 
float cellSize (void) const
 returns cell size.
 
const std::string stereoType (void) const
 returns "A" or "U" or "V" depending on stereo type.
 
float innerRadius (void) const
 sets and returns inner radius.
 
float outerRadius (void) const
 sets and returns outer radius.
 
const std::string & name (void) const
 return name.
 
const TRGCDCCellHithit (void) const
 returns a pointer to a hit.
 
TRGCDCTracktrack (void) const
 returns a pointer to a track.
 
const TRGCDCCellHithit (const TRGCDCCellHit *)
 sets a pointer to a hit.
 
TRGCDCTracktrack (TRGCDCTrack *)
 sets a pointer to a track.
 
void update (const HepGeom::Point3D< double > &onTrack, const HepGeom::Point3D< double > &onWire, unsigned leftRight, double pull)
 sets results of fitting.
 
double pull (void) const
 returns pull.
 
double pull (double)
 sets pull.
 
const HepGeom::Point3D< double > & positionOnWire (void) const
 returns the closest point on wire to a track.
 
const HepGeom::Point3D< double > & positionOnTrack (void) const
 returns the closest point on track to wire.
 
const HepGeom::Point3D< double > & positionOnWire (const HepGeom::Point3D< double > &)
 sets and returns the closest point on wire to a track.
 
const HepGeom::Point3D< double > & positionOnWire (double p[3])
 sets and returns the closest point on wire to a track.
 
const HepGeom::Point3D< double > & positionOnTrack (const HepGeom::Point3D< double > &)
 sets and returns the closest point on track to wire.
 
const HepGeom::Point3D< double > & positionOnTrack (double p[3])
 sets and returns the closest point on track to wire.
 
unsigned leftRight (void) const
 returns left-right. 0:left, 1:right, 2:wire
 
unsigned leftRight (unsigned)
 sets left-right. 0:left, 1:right, 2:wire
 
double dPhi (void) const
 returns dPhi to the closest point.
 
double dPhi (double)
 sets and returns dPhi to the closest point.
 
const HepGeom::Point3D< double > & position (void) const
 returns position.
 
const HepGeom::Point3D< double > & position (const HepGeom::Point3D< double > &)
 sets and returns position.
 
const HepGeom::Point3D< double > & conf (const HepGeom::Point3D< double > &conf)
 conf 3D point
 
void neighbor (unsigned n, TRGCDCLink *neighbor)
 sets neighbor TRGCDCLink.
 
TRGCDCLinkneighbor (unsigned n) const
 returns neighbor TRGCDCLink.
 
TRGCDCLinklink (void) const
 returns a pointer to a TRGCDCLink.
 
TRGCDCLinklink (TRGCDCLink *)
 sets a pointer to a TRGCDCLink.
 
double distance (void) const
 returns distance between point on wire and on track.
 
const HepGeom::Point3D< double > & xyPosition (void) const
 returns middle position of a wire. z componet is 0.
 
float drift (unsigned) const
 returns drift distance of left or right.
 
float drift (float, unsigned)
 sets and returns drift distance of left or right.
 
float dDrift (unsigned) const
 returns drift distance error of left or right.
 
float dDrift (float, unsigned)
 sets and returns drift distance error of left or right.
 
float drift (void) const
 returns drift distance.
 
float dDrift (void) const
 returns drift distance error.
 
static void clearBufferSL (void)
 clear buffers
 
const TRGCDCCellcell (void) const
 returns a pointer to a cell.
 
 TRGCDCLpar ()
 Constructor.
 
 TRGCDCLpar (const TRGCDCLpar &)
 Constructors and destructor.
 
TRGCDCLparoperator= (const TRGCDCLpar &)
 assignment operator(s)
 
void rotate (double c, double s)
 private member functions
 
void move (double x, double y)
 private member functions
 
double check () const
 private const member functions
 
void neg ()
 member functions
 
double d0 (double x, double y) const
 private const member functions
 
double d (double x, double y) const
 const member functions
 
double dr (double x, double y) const
 const member functions
 
double r_max () const
 private const member functions
 
double arcfun (double xh, double yh) const
 private const member functions
 
int sd (double r, double x, double y, double limit, double &s, double &d) const
 const member functions
 
CLHEP::HepVector Hpar (const HepGeom::Point3D< double > &pivot) const
 const member functions
 
TRGCDCLpavoperator= (const TRGCDCLpav &)
 assignment operator(s)
 
 TRGCDCLpav (const TRGCDCLpav &)
 Constructors and destructor.
 
void clear ()
 member functions for clear
 
std::string name (void) const
 returns name.
 
std::string name (void) const
 returns name.
 
std::string name (void) const
 returns name.
 
const std::vector< int > & trackListMC (void) const
 returns MC track list which contributes to CDC hits.
 
const TRGCDCTrackBasetrack (void) const
 returns a track.
 
unsigned nContributors (void) const
 returns /# of contributors.
 
const std::vector< const TRGCDCWire * > & wires (void) const
 returns a vector containing pointers to a wire.
 
const TRGCDCWireoperator[] (unsigned id) const
 returns a wire.
 
const TRGSignalsignal (void) const override
 returns trigger output. Null will returned if no signal.
 
const TRGSignalsignal_adc (void) const override
 returns trigger output. Null will returned if no signal.
 
const TRGCDCSegmentHithit (const TRGCDCSegmentHit *)
 sets a pointer to a TRGCDCSegmentHit.
 
const TRGCDCSegmentHithit (void) const
 returns a pointer to a TRGCDCSegmentHit.
 
void addStoreHit (const CDCTriggerSegmentHit *)
 sets a pointer to a CDCTriggerSegmentHit.
 
const std::vector< const CDCTriggerSegmentHit * > storeHits (void) const
 returns a pointer to a CDCTriggerSegmentHit.
 
const TRGCDCLUTLUT (void) const
 returns LUT
 
const TRGCDCWirecenter (void) const
 returns a center wire.
 
const TRGSignalsignal (void) const
 returns trigger output. Null will returned if no signal.
 
std::string name (void) const
 returns name.
 
std::string name (const std::string &newName)
 sets and returns name.
 
int status (void) const
 returns status.
 
virtual const CLHEP::Hep3Vector & p (void) const
 returns momentum vector.
 
virtual const CLHEP::Hep3Vector & x (void) const
 returns position vector.
 
virtual double pt (void) const
 returns Pt.
 
bool fitted (void) const
 returns true if fitted.
 
void setFitted (bool fitted)
 set fit status
 
virtual unsigned objectType (void) const
 returns object type.
 
double charge (void) const
 returns charge.
 
double charge (double c)
 sets and returns charge.
 
const TRGCDCFitterfitter (void) const
 returns a pointer to a default fitter.
 
const TRGCDCFitterfitter (const TRGCDCFitter *)
 sets a default fitter.
 
void setTrackID (int trackID)
 set track ID.
 
int getTrackID ()
 get track ID.
 
static unsigned nTSF (void)
 returns # of TSF.
 
static unsigned nTSF (unsigned i)
 returns # of TSF in super layer i. (i=0 to 4)
 
unsigned id (void) const
 returns an id started from 0.
 
int status (void) const
 returns status.
 
int pType (void) const
 returns particle type.
 
const TRGCDCTrackMCmother (void) const
 returns a pointer to a mother.
 
const TRGCDCTrackMCchild (unsigned i) const
 returns a pointer to i'th child.
 
const CLHEP::HepLorentzVector & p (void) const
 returns momentum vector.
 
const CLHEP::Hep3Vector & v (void) const
 returns position vector.
 
std::string name (void) const
 returns name.
 
int debugLevel (void) const
 returns debug level.
 
int debugLevel (int) const
 sets and returns debug level.
 
unsigned nLocalLayers (unsigned superLayerId) const
 returns # of wire layers in a super layer.
 
const TRGCDCLayerlayer (unsigned id) const
 returns a pointer to a layer. 0 will be returned if 'id' is invalid.
 
const std::vector< TRGCDCLayer * > * superLayer (unsigned id) const
 returns a pointer to a super-layer.
 
float fudgeFactor (void) const
 returns fudge factor for drift time error.
 
float fudgeFactor (float)
 sets and returns fudge factor for drift time error.
 
std::string versionCDC (void) const
 returns CDC version.
 
unsigned nWires (void) const
 return # of wires.
 
unsigned nSuperLayers (void) const
 returns # of super layers.
 
unsigned nStereoLayers (void) const
 returns # of stereo layers.
 
unsigned nAxialLayers (void) const
 return # of axial layers.
 
unsigned nAxialSuperLayers (void) const
 return # of axial super layers.
 
unsigned nStereoSuperLayers (void) const
 returns # of stereo super layers.
 
unsigned nLayers (void) const
 return # of layers.
 
float cellWidth (unsigned superLayerId) const
 returns cell width in unit of radian.
 
float superLayerR (unsigned superLayerId) const
 returns inner radius of super layer.
 
float superLayerR2 (unsigned superLayerId) const
 returns (inner radius)^2 of super layer.
 
const TRGCDCSegmentsegment (unsigned id) const
 returns a track segment.
 
const TRGCDCSegmentaxialSegment (unsigned lyrId, unsigned id) const
 returns a track segment in axial layers. (lyrId is axial #)
 
const TRGCDCSegmentstereoSegment (unsigned lyrId, unsigned id) const
 returns a track segment in stereo layers. (lyrId is stereo #)
 
unsigned nSegments (void) const
 returns # of track segments.
 
const TRGClocksystemClock (void) const
 calculates corrected drift time.
 
const TRGClocksystemClockFE (void) const
 returns the system clock of the front-end
 
const TRGClockTDCClock (void) const
 returns the system clock of the trigger TDC after mergers (2 * front-end binwidth)
 
const TRGClockdataClock (void) const
 returns the data clock.
 
double systemOffsetMC (void) const
 returns the system offset in MC.
 
std::vector< const TRGCDCSegmentHit * > segmentHits (void) const
 returns a list of TRGCDCSegmentHit.
 
std::vector< const TRGCDCSegmentHit * > segmentHits (unsigned) const
 returns a list of TRGCDCSegmentHit in a super layer N.
 
std::vector< const TRGCDCSegmentHit * > axialSegmentHits (unsigned) const
 returns a list of TRGCDCSegmentHit in a axial super layer N.
 
std::vector< const TRGCDCSegmentHit * > stereoSegmentHits (unsigned) const
 returns a list of TRGCDCSegmentHit in a stereo super layer N.
 
const TRGCDCFrontEndfrontEnd (unsigned id) const
 returns a front-end board.
 
const TRGCDCMergermerger (unsigned id) const
 returns a merger board.
 
TRGCDCTrackSegmentFindertsfboard (unsigned id) const
 returns a TSF board.
 
const TRGCDCTracker2Dtracker2D (unsigned id) const
 returns a 2D tracker board.
 
const TRGCDCLayersegmentLayer (unsigned id) const
 returns a pointer to a track segment layer.
 
unsigned nSegmentLayers (void) const
 returns # of track segment layers.
 
unsigned mode (void) const
 sets simulation mode.
 
unsigned mode (unsigned)
 sets simulation mode.
 
unsigned firmwareSimulationMode (void) const
 returns firmware simulation mode.
 
int getReturnValue (void) const
 gets return value for trg cdc module.
 
void setReturnValue (int)
 sets return value for trg cdc module.
 
int firmwareSimulationStart (void) const
 returns start clock of the firmware simulation in FE clock.
 
int firmwareSimulationStop (void) const
 returns stop clock of the firmware simulation in FE clock.
 
int firmwareSimulationStartDataClock (void) const
 returns start clock of the firmware simulation in data clock.
 
int firmwareSimulationStopDataClock (void) const
 returns stop clock of the firmware simulation in data clock.
 
const TRGCDCHelixhelix (void) const
 returns helix parameter.
 
void setHelix (const TRGCDCHelix &helix)
 Set helix parameter.
 
virtual const CLHEP::Hep3Vector & p (void) const override
 returns momentum vector.
 
virtual double pt (void) const override
 returns Pt.
 
virtual const CLHEP::Hep3Vector & x (void) const override
 returns position vector.
 
void set2DFitChi2 (double)
 Set 2D fit chi2.
 
double get2DFitChi2 (void) const
 Returns 2D fit chi2.
 
void set3DFitChi2 (double)
 Set 3D fit chi2.
 
double get3DFitChi2 (void) const
 Returns 3D fit chi2.
 
void setDebugValue (EDebugValueType const &moduleName, bool flag)
 Set debug value.
 
int getDebugValue (EDebugValueType const &moduleName) const
 Get debug value.
 
const TRGCDCWireHithit (const TRGCDCWireHit *)
 returns a pointer to a TRGCDCWireHit.
 
const TRGCDCWireHithit (void) const
 returns a pointer to a TRGCDCWireHit.
 
const TRGCDCWireHitMChit (TRGCDCWireHitMC *)
 appends a pointer to TRGCDCWireHitMC.
 
void addSignal (const TRGSignal &newSignal)
 set signal |= newSignal
 
void addSignal_adc (const TRGSignal &newSignal)
 set signal |= newSignal
 
bool consective (const TRGCDCWire &) const
 returns true if a given wire is consective in a layer.
 
bool adjacent (const TRGCDCWire &) const
 returns true if a given wire is adjacent.
 
int localIdForPlus (void) const
 returns localId but if maxLocalId, return -1.
 
int localIdForMinus (void) const
 returns localId but if 0, return maxLocalId + 1.
 
const TRGSignalsignal (void) const override
 returns an input to the trigger. This is sync'ed to 1GHz clock.
 
const TRGSignalsignal_adc (void) const override
 returns an input to the trigger. This is sync'ed to 1GHz clock.
 
const TRGCDCWireHitMCmc (void) const
 This will be removed.
 
const TRGCDCWireHitMCmc (TRGCDCWireHitMC *)
 This will be removed.
 
unsigned iCDCSimHit (void) const
 return index of CDCSimHit
 
float distance (void) const
 returns drift distance.
 
const HepGeom::Point3D< double > & hitPosition (void) const
 returns hit position.
 
const HepGeom::Point3D< double > & entrance (void) const
 returns an entrance point.
 
const HepGeom::Vector3D< double > & direction (void) const
 returns vector from entrance to exit point.
 
int leftRight (void) const
 returns left or right.
 
const TRGCDCWirewire (void) const
 returns a pointer to a TRGCDCWire.
 
const TRGCDCTrackMChep (void) const
 returns a pointer to a GEN_HEPEVT.
 
const TRGCDCWireHithit (void) const
 returns a pointer to a TRGCDCWireHit.
 
const CLHEP::Hep3Vector & momentum (void) const
 returns momentum vector at the entrance.
 
 TRGCDCCell (unsigned id, unsigned localId, const TRGCDCLayer &layer, const HepGeom::Point3D< double > &forwardPosition, const HepGeom::Point3D< double > &backwardPosition)
 Constructor.
 
virtual ~TRGCDCCell ()
 Destructor.
 
virtual void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
int localIdDifference (const TRGCDCCell &) const
 returns local id difference.
 
 TRGCDCCellHit (const TRGCDCCell &, unsigned indexCDCHit=0, unsigned indexCDCSimHit=0, unsigned indexMCParticle=0, float driftLeft=0, float driftLeftError=0, float driftRight=0, float driftRightError=0, int mcLRflag=0, float fudgeFacgtor=1)
 Constructor.
 
virtual ~TRGCDCCellHit ()
 Destructor.
 
virtual void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
HepGeom::Point3D< double > position (unsigned) const
 returns left position. z is always zero.
 
static int sortById (const TRGCDCCellHit **a, const TRGCDCCellHit **b)
 Sort function.
 
const CDCHithit (void) const
 Access to CDCHit.
 
const CDCSimHitsimHit (void) const
 Access to CDCSimHit.
 
const MCParticlemcParticle (void) const
 Access to MCParticle.
 
 TRGCDCCircle (const std::vector< TRGCDCLink * > &links)
 Constructor with links.
 
 TRGCDCCircle (double r, double phi, double charge, const TRGCDCHoughPlane &plane)
 Constructor with a circle center, assuming the origin is on a circle.
 
virtual ~TRGCDCCircle ()
 Destructor.
 
virtual void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
 dumps debug information.
 
int approach2D (TRGCDCLink &) const override
 calculate closest approach. Error was happened if return value is not zero.
 
 TRGCDCCircleFitter (const std::string &name)
 Constructor.
 
virtual ~TRGCDCCircleFitter ()
 Destructor.
 
virtual int fit (TRGCDCTrackBase &) const override
 Fitter.
 
 TRGCDCEventTime (const TRGCDC &, bool makeRootFile)
 constructor of TRGCDCEventTime class
 
virtual ~TRGCDCEventTime ()
 destructor of TRGCDCEventTime class
 
void initialize (void)
 initialize the class
 
void doit (int ver, bool print)
 Calculate T0 based on ver.
 
void hitcount (void)
 hit count of TS
 
void hist (void)
 making hostogram
 
void oldVer (void)
 old version of calculation function
 
void printFirm (void)
 Print info in firmware level.
 
int getT0 (void) const
 Calculate T0.
 
void terminate (void)
 terminate function
 
 TRGCDCEventTimeFinder (const std::string &name, const TRGClock &systemClock, const TRGClock &dataClock, const TRGClock &userClockInput, const TRGClock &userClockOutput)
 Constructor.
 
 ~TRGCDCEventTimeFinder ()
 Destructor.
 
void push_back (const TRGCDCTrackSegmentFinder *)
 push back the TRGCDCTrackSegmentFinder pointer
 
void simulate (void)
 Firmware simulation. yi.
 
 TRGCDCFitter (const std::string &name)
 Constructor.
 
virtual ~TRGCDCFitter ()
 Destructor.
 
void fitDone (TRGCDCTrackBase &) const
 sets the fitted flag. (Bad implementation)
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dump debug info
 
 TRGCDCFitter3D (const std::string &name, const std::string &rootFitter3DFile, const TRGCDC &, const std::map< std::string, bool > &flags)
 Constructor.
 
virtual ~TRGCDCFitter3D ()
 Destructor.
 
void initialize ()
 Initialization.
 
int doit (std::vector< TRGCDCTrack * > &trackList)
 Does track fitting.
 
int doitComplex (std::vector< TRGCDCTrack * > &trackList)
 Does track fitting using JSignals.
 
static double calPhi (TRGCDCSegmentHit const *segmentHit, double eventTime)
 Utility functions.
 
void saveVhdlAndCoe ()
 Functions for saving.
 
void saveAllSignals ()
 Saves all signals for debugging.
 
void saveIoSignals ()
 Saves all I/O signals for debugging.
 
static void getMCValues (const TRGCDC &m_cdc_in, TRGCDCTrack *aTrack, const std::map< std::string, double > &m_mConstD_in, std::map< std::string, double > &m_mDouble_in, std::map< std::string, std::vector< double > > &m_mVector_in)
 Function for mc debugging.
 
bool isAxialTrackFull (const TRGCDCTrack &aTrack)
 Checks if axial track has 5 TSs. One per each superlayer.
 
bool isStereoTrackFull (const TRGCDCTrack &aTrack)
 Checks if stereo track has 4 TSs. One per each superlayer.
 
static void findHitAxialSuperlayers (const TRGCDCTrack &aTrack, std::vector< double > &useAxSL, bool printError)
 Finds which axial superlayers has TSs. useAxSL array indicating hit superlayers.
 
static void findHitStereoSuperlayers (const TRGCDCTrack &aTrack, std::vector< double > &useStSL, bool printError)
 Finds which stereo superlayers has TSs. useStSL array indicating hit superlayers.
 
void removeImpossibleStereoSuperlayers (std::vector< double > &useStSL)
 Removes TSs that are not possible with track Pt.
 
static void selectAxialTSs (const TRGCDCTrack &aTrack, std::vector< int > &bestTSIndex)
 Selects priority TSs when there are multiple candidate TSs for a superlayer.
 
static int do2DFit (TRGCDCTrack &aTrack, const std::map< std::string, bool > &m_mBool_in, const std::map< std::string, double > &m_mConstD_in, std::map< std::string, std::vector< double > > &m_mConstV_in, std::map< std::string, double > &m_mDouble_in, std::map< std::string, std::vector< double > > &m_mVector_in)
 Does 2D fit. Returns 0 if fit is done successfully. m_mBool should have fIsPrintError, fmcLR, fLRLUT, fmcLR, f2DFit, f2DFitDrift. m_mConstD should have Trg_PI. m_mConstV should have nWires, driftPhi2DError, wirePhi2DError, rr, rr2D.
 
void print3DInformation (int iTrack)
 Print's information for debugging 3D.
 
void terminate ()
 Termination.
 
std::string version (void) const
 Gets version of class.
 
std::string name (void) const
 Gets name of class.
 
static void getStereoGeometry (std::map< std::string, std::vector< double > > &stGeometry)
 Get stereo geometry.
 
static void getStereoXt (std::vector< double > const &stPriorityLayer, std::vector< std::vector< double > > &stXts, bool isSimple=0)
 Get stereo Xt.
 
static void getConstants (std::map< std::string, double > &mConstD, std::map< std::string, std::vector< double > > &mConstV, bool isXtSimple=0)
 Get constants for firmwareFit.
 
 TRGCDCFrontEnd (const std::string &name, boardType type, const TRGClock &systemClock, const TRGClock &dataClock, const TRGClock &userClock)
 Constructor.
 
virtual ~TRGCDCFrontEnd ()
 Destructor.
 
static std::string version (void)
 returns version.
 
boardType type (void) const
 returns type.
 
static int implementation (const boardType &type, std::ofstream &)
 make a VHDL component file.
 
static int implementationPort (const boardType &type, std::ofstream &)
 writes a port map.
 
void push_back (const TRGCDCWire *)
 push back TRGCDCWire for this Front-end
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents.
 
void simulate (void)
 simulates firmware.
 
static TRGState packerInnerInside (const TRGState &input)
 Makes bit pattern using input bit pattern for the inner FE.
 
static TRGState packerInnerOutside (const TRGState &input)
 Makes bit pattern using input bit pattern for the outer FE.
 
static TRGState packerOuterInside (const TRGState &input)
 Makes bit pattern using input bit pattern for the inner FE.
 
static TRGState packerOuterOutside (const TRGState &input)
 Makes bit pattern using input bit pattern for the outer FE.
 
static void unpackerInnerInside (const TRGState &input, const TRGState &output)
 Unpacks TRGState.
 
static void unpackerInnerOutside (const TRGState &input, const TRGState &output)
 Unpacks TRGState.
 
static void unpackerOuterInside (const TRGState &input, const TRGState &output)
 Unpacks TRGState.
 
static void unpackerOuterOutside (const TRGState &input, const TRGState &output)
 Unpacks TRGState.
 
void dump_log (void) const
 Dump all the details of _mosb into a .log file, do it in the end of simulate()
 
void dump_log_innerInside (void) const
 Dump all the details of _mosb into a .log file, for innerInside FE.
 
void dump_log_innerOutside (void) const
 Dump all the details of _mosb into a .log file, for innerOutside FE.
 
void dump_log_outerInside (void) const
 Dump all the details of _mosb into a .log file, for outerInside FE.
 
void dump_log_outerOutside (void) const
 Dump all the details of _mosb into a .log file, for outerOutside FE.
 
static bool set_exception (bool)
 set to throw exception or not
 
static bool set_print (bool)
 set to print debug info or not
 
static void set_limits (const CLHEP::HepVector &a_min, const CLHEP::HepVector &a_max)
 set limits for helix parameters
 
 TRGCDCHelix (const HepGeom::Point3D< double > &pivot, const CLHEP::HepVector &a, const CLHEP::HepSymMatrix &Ea)
 Constructor with pivot, helix parameter a, and its error matrix.
 
 TRGCDCHelix (const HepGeom::Point3D< double > &pivot, const CLHEP::HepVector &a)
 Constructor without error matrix.
 
 TRGCDCHelix (const HepGeom::Point3D< double > &position, const CLHEP::Hep3Vector &momentum, double charge)
 Constructor with position, momentum, and charge.
 
virtual ~TRGCDCHelix ()
 Destructor.
 
HepGeom::Point3D< double > x (double dPhi=0.) const
 returns position after rotating angle dPhi in phi direction.
 
double * x (double dPhi, double p[3]) const
 returns position after rotating angle dPhi in phi direction.
 
HepGeom::Point3D< double > x (double dPhi, CLHEP::HepSymMatrix &Ex) const
 returns position and convariance matrix(Ex) after rotation.
 
CLHEP::Hep3Vector momentum (double dPhi=0.) const
 returns momentum vector after rotating angle dPhi in phi direction.
 
CLHEP::Hep3Vector momentum (double dPhi, CLHEP::HepSymMatrix &Em) const
 returns momentum vector after rotating angle dPhi in phi direction.
 
CLHEP::HepLorentzVector momentum (double dPhi, double mass) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
 
CLHEP::HepLorentzVector momentum (double dPhi, double mass, CLHEP::HepSymMatrix &Em) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
 
CLHEP::HepLorentzVector momentum (double dPhi, double mass, HepGeom::Point3D< double > &x, CLHEP::HepSymMatrix &Emx) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
 
const HepGeom::Point3D< double > & pivot (const HepGeom::Point3D< double > &newPivot)
 sets pivot position.
 
void set (const HepGeom::Point3D< double > &pivot, const CLHEP::HepVector &a, const CLHEP::HepSymMatrix &Ea)
 sets helix pivot position, parameters, and error matrix.
 
TRGCDCHelixoperator= (const TRGCDCHelix &)
 Copy operator.
 
void updateCache (void)
 update Caches
 
CLHEP::HepMatrix delApDelA (const CLHEP::HepVector &ap) const
 Mathmatical functions.
 
CLHEP::HepMatrix delXDelA (double phi) const
 Mathmatical functions.
 
CLHEP::HepMatrix delMDelA (double phi) const
 Mathmatical functions.
 
CLHEP::HepMatrix del4MDelA (double phi, double mass) const
 Mathmatical functions.
 
CLHEP::HepMatrix del4MXDelA (double phi, double mass) const
 Mathmatical functions.
 
void ignoreErrorMatrix (void)
 unsets error matrix. Error calculations will be ignored after this function call until an error matrix be set again. 0 matrix will be return as a return value for error matrix when you call functions which returns an error matrix.
 
void debugPrint (void) const
 print debug info
 
void checkValid (void)
 check validity
 
 TRGCDCHough3DFinder (const TRGCDC &, bool makeRootFile, int finderMode)
 Contructor.
 
 ~TRGCDCHough3DFinder ()
 Destructor.
 
void terminate (void)
 Termination method.
 
void doit (std::vector< TRGCDCTrack * > const &trackList2D, std::vector< TRGCDCTrack * > &trackList3D)
 Member functions.
 
void doit (std::vector< TRGCDCTrack * > &trackList)
 Finds tracks using tracklist. Has parameter to choose between perfect and original finder.
 
void doitFind (std::vector< TRGCDCTrack * > &trackList)
 Finds tracks using tracklist.
 
void perfectFinder (std::vector< TRGCDCTrack * > &trackList, unsigned j, std::vector< const TRGCDCSegmentHit * > &mcTSList)
 Perfect 3D finder for a track.
 
void doitPerfectly (std::vector< TRGCDCTrack * > &trackList)
 Perfect 3D finder for a tracklist.
 
void findNumberOfHitSuperlayersForMcParticles (std::vector< std::vector< const TRGCDCSegmentHit * > > &p_stTSs, std::map< unsigned, unsigned > &numberTSsForParticle)
 Finds number of hit superlayers for each mc particle.
 
std::string version (void) const
 returns version.
 
 TRGCDCHoughFinder (const std::string &name, const TRGCDC &, unsigned peakMin, const std::string &mappingFilePlus, const std::string &mappingFileMinus, unsigned doit)
 Contructor.
 
virtual ~TRGCDCHoughFinder ()
 Destructor.
 
int doFindingTrasan (std::vector< unsigned > peaks[], std::vector< TRGCDCTrack * > &trackList2D) const
 do track finding. (trasan version)
 
std::vector< TRGCDCLink * > selectBestHits (const std::vector< TRGCDCLink * > &links) const
 selects the best(fastest) hits in each super layer.
 
int doFittingTrasan (std::vector< unsigned > peaks[], std::vector< TRGCDCTrack * > &trackList2DFitted) const
 do track fitting. (old trasan version)
 
void terminate ()
 termination.
 
static double calPhi (TRGCDCSegmentHit const *segmentHit, double eventTime)
 Utility functions.
 
static void calCosPhi (std::map< std::string, Belle2::TRGCDCJSignal > &mSignalStorage, std::map< std::string, Belle2::TRGCDCJLUT * > &mLutStorage)
 Calculate Cos Sin ?
 
static void calSinPhi (std::map< std::string, Belle2::TRGCDCJSignal > &mSignalStorage, std::map< std::string, Belle2::TRGCDCJLUT * > &mLutStorage)
 Calculate Cos Sin ?
 
static void rPhi (std::map< std::string, Belle2::TRGCDCJSignal > &mSignalStorage, std::map< std::string, Belle2::TRGCDCJLUT * > &mLutStorage)
 Calculate r * phi ?
 
void mappingByFile (const std::string &mappingFilePlus, const std::string &mappingFileMinus)
 creates mappings by a file.
 
int FindAndFit (std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
 do track finding and fitting (wrapper that can choose between different versions).
 
int doFindingAndFittingTrasan (std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
 do track finding and fitting (Trasan version).
 
int doFindingAndFitting (std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
 do track finding and fitting (Kaiyu version).
 
int doFinding (std::vector< std::vector< unsigned > > peaks[], std::vector< TRGCDCTrack * > &trackList2D)
 do track finding. (kaiyu version)
 
int doFitting (std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
 do track fitting. (kaiyu original)
 
TRGCDCTrackmakeTrack (const unsigned serialID, const unsigned pm) const
 Make a track from serial ID in Hough plane.
 
 TRGCDCHoughPlane (const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax)
 Contructor.
 
virtual ~TRGCDCHoughPlane ()
 Destructor.
 
void registerPattern (unsigned id) override
 Registers a pattern on a Hough plane with (r, phi=0).
 
virtual void voteByPattern (float xOffset, int weight=1)
 Votes using a pattern.
 
 TRGCDCHoughPlaneBase (const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax)
 Contructor.
 
virtual ~TRGCDCHoughPlaneBase ()
 Destructor.
 
void locationInPlane (float x0, float y0, float x1, float y1, unsigned &nFound, unsigned &iX0, unsigned &iY0, unsigned &iX1, unsigned &iY1) const
 returns cell positions in the region.
 
int maxEntryInRegion (unsigned id) const
 returns max. count in region.
 
virtual void vote (float rx, float ry, int charge, int weight=1)
 Voring.
 
virtual void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
 TRGCDCHoughPlaneBoolean (const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax)
 Contructor.
 
virtual ~TRGCDCHoughPlaneBoolean ()
 Destructor.
 
void vote (float rx, float ry, float charge, int weight=1)
 Votes with charge decision.
 
void voteUsedInTrasan (float rx, float ry, float charge, int weight=1)
 Votes with charge decision.
 
void registerPattern (unsigned id) override
 registers a pattern..
 
void preparePatterns (unsigned nPatterns)
 allocate memory for patterns.
 
void vote (unsigned patternId, int weight)
 Votes using registered pattern.
 
 TRGCDCHoughPlaneMulti (const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax, unsigned nLayers)
 Contructor.
 
virtual ~TRGCDCHoughPlaneMulti ()
 Destructor.
 
void vote (float rx, float ry, float charge, const TRGCDCHoughTransformation &hough, unsigned weight, unsigned layerId)
 vote
 
void merge (void)
 merge function
 
void vote (float phi, unsigned layerId, int weight)
 vote
 
 TRGCDCHoughPlaneMulti2 (const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax, unsigned nLayers)
 Contructor.
 
virtual ~TRGCDCHoughPlaneMulti2 ()
 Destructor.
 
void merge (void)
 Merge layers into one.
 
void mergeOuters (void)
 Merge outer layers into one.
 
 TRGCDCHoughTransformation (const std::string &name)
 Contructor.
 
virtual ~TRGCDCHoughTransformation ()
 Destructor.
 
virtual TRGPoint2D convert (const TRGPoint2D &) const
 converts Point2D(r, phi) in real plane into Point2D(r, phi) in Hough plane.
 
 TRGCDCHoughTransformationCircle (const std::string &name)
 Contructor.
 
virtual ~TRGCDCHoughTransformationCircle ()
 Destructor.
 
virtual float y (float xReal, float yReal, float x) const override
 returns Y coordinate in a Hough parameter plane.
 
virtual TRGPoint2D circleCenter (const TRGPoint2D &) const
 returns Point2D(phi, r) of a circle in real plane.
 
virtual TRGPoint2D convert (const TRGPoint2D &) const override
 converts Point2D(phi, r) in real plane into Point2D(phi, r) in Hough plane.
 
virtual bool diverge (float xReal, float yReal, float x0, float x1) const override
 returns true if Y diverges in given region.
 
virtual bool positiveDiverge (float xReal, float yReal, float x0, float x1) const override
 returns true if Y diverges in given region.
 
virtual bool negativeDiverge (float xReal, float yReal, float x0, float x1) const override
 returns true if Y diverges in given region.
 
std::string version (void) const
 returns version.
 
 TRGCDCJLUT (const std::string &name="no_name")
 Contructor.
 
 TRGCDCJLUT (const TRGCDCJLUT &in)
 Copy constructor.
 
virtual ~TRGCDCJLUT ()
 Destructor.
 
void setData (int inputBitsize, int outputBitSize, const std::string &filename, bool twoscomplement=0)
 set LookUpTable(LUT) data.
 
void setFunction (std::function< int(int)> function)
 set LUT function directly using int values.
 
int setFloatFunction (std::function< double(double)> function, TRGCDCJSignal const &input, TRGCDCJSignal const &minInv, TRGCDCJSignal const &maxInv, double outputToReal, int lutInputBitwidth, int lutOutputBitwidth)
 set LUT function using JSignals.
 
void setBitsize (int inputBitsize, int outputBitsize)
 set input & output bitsize.
 
void setOutputFlag (int outputFlag)
 set output flag.
 
void setInputBitsize (int inputBitsize)
 set input bitsize.
 
void setOutputBitsize (int outputBitsize)
 set output bitsize.
 
std::string getFileName () const
 get LUT filename
 
int getInputBitsize () const
 get input bitsize
 
int getOutputBitsize () const
 get output bitsize
 
std::function< int(int)> getFunction ()
 get LUT function using int values.
 
std::function< double(double)> getFloatFunction ()
 get LUT function using float values.
 
int getOutputFlag () const
 get output type.
 
int getOutputType () const
 get output type.
 
int getOutput (int) const
 get output using int values.
 
double getFloatOutput (double) const
 get output using float values.
 
void dump ()
 Print variables for LUT.
 
void makeCOE (const std::string &fileName="")
 make COE file.
 
std::string operate (std::string out, std::string in, std::map< std::string, std::map< std::string, double > * > &m_intStorage)
 Operate on LUT. (Will be deprecated.)
 
TRGCDCJSignal const operate (const TRGCDCJSignal &in, TRGCDCJSignal &out)
 Returns LUT value. Out is LUT value + offset. (LUT value + offset do not obey addition bitsize rules.)
 
std::string const lutVhdlCode (std::string const &shiftOffsetInput) const
 Creates vhdlCode for lut.
 
 TRGCDCJSignal ()
 Constructor.
 
 TRGCDCJSignal (TRGCDCJSignalData *)
 Copy constructor.
 
 TRGCDCJSignal (int const &bitwidth, double const &value, double const &min, double const &max, int const &clock, TRGCDCJSignalData *)
 Actual to integer constructor with clock.
 
 TRGCDCJSignal (int const &bitwidth, double const &value, double const &min, double const &max, TRGCDCJSignalData *)
 Actual to integer constructor with clock set to 0.
 
 TRGCDCJSignal (signed long long const &intValue, double const &toReal, signed long long const &minInt, signed long long const &maxInt, double const &actual, double const &minActual, double const &maxActual, int const &finishClock, TRGCDCJSignalData *, bool b_slv=0)
 Integer constructor.
 
 TRGCDCJSignal (double const &value, double const &toReal, TRGCDCJSignalData *)
 Constant constructor.
 
 TRGCDCJSignal (std::vector< bool > const &slvValue, int const &finishClock, TRGCDCJSignalData *)
 Slv constructor.
 
TRGCDCJSignalassignTo (TRGCDCJSignal const &rhs, int targetClock, std::string &finalCode)
 Assign operator with setting target clock with outputing final code.
 
TRGCDCJSignalassignTo (TRGCDCJSignal const &rhs, int targetClock)
 Assign operator with setting target clock.
 
TRGCDCJSignaloperator<= (TRGCDCJSignal const &rhs)
 Assign operator.
 
TRGCDCJSignal const operator- () const
 Unary operator.
 
TRGCDCJSignal const operator+ (TRGCDCJSignal const &rhs) const
 Arithmetic add operator.
 
TRGCDCJSignal const operator- (TRGCDCJSignal const &rhs) const
 Arithmetic minus operator.
 
TRGCDCJSignal const operator* (TRGCDCJSignal const &rhs) const
 Arithmetic multiply operator.
 
void dump () const
 Methods.
 
TRGCDCJSignal const shift (int nBits, int operate=1) const
 Shift signal. Shift direction is right. operate=0 to change m_toReal(unit).
 
TRGCDCJSignal const offset (TRGCDCJSignal const &valueMin) const
 Outputs an offset signal which is an unsigned signal.
 
TRGCDCJSignal const invOffset (TRGCDCJSignal const &valueMin) const
 Outputs a signal that is not offset.
 
static void choose (TRGCDCJSignal &target, TRGCDCJSignal const &targetMin, TRGCDCJSignal const &targetMax, TRGCDCJSignal const &reference, std::vector< std::vector< TRGCDCJSignal > > data, int targetClock)
 Case method.
 
static void choose (TRGCDCJSignal &target, TRGCDCJSignal const &targetMin, TRGCDCJSignal const &targetMax, TRGCDCJSignal const &reference, const std::vector< std::vector< TRGCDCJSignal > > &data)
 Chooes method. Also has input for target min and target max signal.
 
static void choose (TRGCDCJSignal &target, TRGCDCJSignal const &reference, const std::vector< std::vector< TRGCDCJSignal > > &data, int targetClock)
 Choose with target clock.
 
static void choose (TRGCDCJSignal &target, TRGCDCJSignal const &reference, const std::vector< std::vector< TRGCDCJSignal > > &data)
 Choose method.
 
static void ifElse (std::vector< std::pair< TRGCDCJSignal, std::vector< std::pair< TRGCDCJSignal *, TRGCDCJSignal > > > > &data, int targetClock)
 If else implementation with target clock.
 
static void ifElse (std::vector< std::pair< TRGCDCJSignal, std::vector< std::pair< TRGCDCJSignal *, TRGCDCJSignal > > > > &data)
 If else implementation.
 
TRGCDCJSignal const limit (signed long long minInt, signed long long maxInt, double minActual, double maxActual) const
 Limits min and max values using specific integers. Use only for ifElse. Doesn't check overflow, underflow to be used in ifElse.
 
TRGCDCJSignal const limit (TRGCDCJSignal const &min, TRGCDCJSignal const &max) const
 Limits min and max values using JSignal. Use only for ifElse. Doesn't check overflow, underflow to be used in ifElse.
 
TRGCDCJSignal const resize (int bitwidth) const
 Resizes signal.
 
static TRGCDCJSignal const slvToSigned (TRGCDCJSignal const &in, double const &toReal, signed long long const &minInt, signed long long const &maxInt, double const &actual, double const &minActual, double const &maxActual, int const &finishClock)
 Change slv to signed with target clock.
 
static TRGCDCJSignal const slvToSigned (TRGCDCJSignal const &in)
 Change slv to signed.
 
static TRGCDCJSignal const slvToUnsigned (TRGCDCJSignal const &in, double const &toReal, signed long long const &minInt, signed long long const &maxInt, double const &actual, double const &minActual, double const &maxActual, int const &finishClock)
 Change slv to unsigned with target clock.
 
static TRGCDCJSignal const slvToUnsigned (TRGCDCJSignal const &in)
 Change slv to unsigned with target clock.
 
static TRGCDCJSignal const toSlv (TRGCDCJSignal const &in, int test)
 Change signal to std_logic_vector using vector<bool>. (Will be deprecated.)
 
static TRGCDCJSignal const toSlv (TRGCDCJSignal const &)
 Change singal to std_logic_vector.
 
static TRGCDCJSignal comp (TRGCDCJSignal const &lhs, const std::string &operate, TRGCDCJSignal const &rhs)
 Compare two signals.
 
void swap (TRGCDCJSignal &first, TRGCDCJSignal &second) const
 Swaps the TRGCDCJSignals.
 
void matchUnit (TRGCDCJSignal &first, TRGCDCJSignal &second) const
 Utilities.
 
void setName (const std::string &name)
 Setters, Getters Sets name of signal.
 
void setInt (signed long long value)
 Sets integer value of signal.
 
void setActual (double value)
 Sets float value of signal.
 
void setToReal (double value)
 Sets toReal factor of signal.
 
void setType (int type)
 Sets type of signal.
 
void setBitsize (int bitsize)
 Sets bitwidth of signal.
 
void setFinishClock (int finishClock)
 Sets finish clock of signal.
 
void setDebug (bool debug)
 Sets debug flag for signal.
 
void setPrintVhdl (bool printVhdl)
 Sets print flag for signal.
 
void setVhdlOutputFile (const std::string &filename)
 Sets ouptut VHDL filename.
 
void setCommonData (TRGCDCJSignalData *)
 Sets JSignalData to signal.
 
std::string getName () const
 Get name of signal.
 
int getType () const
 Get type of signal.
 
double getBitsize () const
 Get bitwidth of signal.
 
signed long long getInt () const
 Get integer value of signal.
 
signed long long getMinInt () const
 Get minimum integer value of signal.
 
signed long long getMaxInt () const
 Get maximum integer value of signal.
 
double getActual () const
 Get float value of signal.
 
double getMinActual () const
 Get minimum float value of signal.
 
double getMaxActual () const
 Get maximum float value of signal.
 
double getRealInt () const
 Get converted float value of integer.
 
double getRealMinInt () const
 Get converted float value of minimum integer.
 
double getRealMaxInt () const
 Get converted float value of maximum integer.
 
double getToReal () const
 Get toReal value of signal.
 
int getFinishClock () const
 Gets clock tick where signal is make.
 
std::vector< std::pair< std::string, std::vector< int > > > const getArgumentSignals () const
 Gets the signal names and values that made this signal.
 
TRGCDCJSignalDatagetCommonData () const
 Get the sharged JSignalData.
 
int calType () const
 Calculated what type the signal is.
 
int calType (double minValue) const
 Calculated the type using the argument.
 
int calBitwidth () const
 Calculates the bit width.
 
int calBitwidth (int type, signed long long minInt, signed long long maxInt)
 Calculates the bit width using the arguments.
 
int calFinishClock () const
 Claculates the clock tick where the signal is valid.
 
std::string getVhdlCode () const
 Gets the vhdl code for the signal.
 
bool getPrintVhdl () const
 Gets the print vhdl flag from common JSignalData class.
 
std::string getVhdlOutputFile () const
 Gets the vhdl output file name.
 
bool orderLargestBitsize (TRGCDCJSignal &large, TRGCDCJSignal &small) const
 Orders the TRGCDCJSignals by bitsize. Next priority is unsigned, signed, minus unsigned. 1: was swapped. 0: was not swapped.
 
signed long long calMaxInteger () const
 Calculate max value for a binary number.
 
signed long long calMinInteger () const
 Calculate min value for a binary number.
 
static TRGCDCJSignal const absolute (TRGCDCJSignal const &first)
 Absolute TRGCDCJSignal. Removes 1 bit if signed or minus unsigned.
 
static signed long long calInt (double value, TRGCDCJSignal const &mother)
 Calculates integer value with unit of a TRGCDCJSignal.
 
static void calVhdlTypeBitwidth (TRGCDCJSignal const &first, const std::string &operation, TRGCDCJSignal const &second, int &type, int &bitwidth)
 Calculates vhdl bitwidth and type for operation.
 
void initArgumentSignals ()
 Initializes the argument signals for the signal.
 
static void combineArguments (TRGCDCJSignal const &first, TRGCDCJSignal const &second, TRGCDCJSignal &result)
 Combines arguments of signals.
 
void initVhdlCode ()
 Initializes the vhdl code.
 
void toSignedVhdlCode ()
 Changes signal type to signed type in VHDL.
 
void toUnsignedVhdlCode ()
 Changes signal type to unsigned type in VHDL.
 
static void vhdlCode (TRGCDCJSignal const &first, const std::string &operation, TRGCDCJSignal const &second, TRGCDCJSignal const &result, std::string &targtVhdlCode)
 Writes vhdl code using two signals.
 
static void vhdlCode (const std::string &operation, TRGCDCJSignal const &first, TRGCDCJSignal const &result, std::string &targetVhdlCode)
 Writes vhdl code using one signal.
 
static std::string replaceWithSignalNames (std::string const &fromVhdlCode, std::vector< std::pair< std::string, std::vector< int > > > const &fromVhdlSignals, int const &finishClock, std::map< std::string, std::vector< int > > &buffers)
 Writes final vhdl code.
 
static std::string assignVhdlCode (TRGCDCJSignal const &target, TRGCDCJSignal const &from)
 Writes the assign vhdl code.
 
static std::string chooseVhdlCode (TRGCDCJSignal const &target, TRGCDCJSignal const &reference, std::vector< std::vector< TRGCDCJSignal > > const &data)
 Writes the choose vhdl code.
 
static std::string ifElseVhdlCode (std::vector< std::pair< TRGCDCJSignal, std::vector< std::pair< TRGCDCJSignal *, TRGCDCJSignal > > > > const &data)
 Writes the ifElse vhdl code.
 
void printVhdl (const std::string &vhdlCode) const
 Prints vhdl code.
 
void checkInt (const std::string &name) const
 Checks underflow or overflow for TRGCDCJSignal.
 
static bool isSameSignal (TRGCDCJSignal const &lhs, TRGCDCJSignal const &rhs)
 Checks if signal is same signal.
 
static void valuesToMapSignals (std::vector< std::tuple< std::string, double, int, double, double, int > > const &inValues, Belle2::TRGCDCJSignalData *inCommonData, std::map< std::string, Belle2::TRGCDCJSignal > &outMap)
 Values => [name, value, bitwidth, min, max, clock] Changes values to signals.
 
static void mapSignalsToValues (std::map< std::string, Belle2::TRGCDCJSignal >const &inMap, std::vector< std::pair< std::string, int > > const &inChoose, std::vector< std::tuple< std::string, double, int, double, double, int > > &outValues)
 Choose => [signalName, FpgaEffects(=1)/NoFpgaEffects(=0)] Values => [name, value, bitwidth, min, max, clock] Changes signals to values.
 
 TRGCDCJSignalData ()
 Constructor for class.
 
void setVhdlOutputFile (const std::string &)
 Sets the filename for VHDL output.
 
void setPrintVhdl (bool)
 Sets if to print VHDL output.
 
void setPrintedToFile (bool)
 Set to remember that file was printed.
 
void setVhdlInProcess (const std::string &)
 Set the VHDL code that are in a process statement.
 
void setVhdlOutProcess (const std::string &)
 Set the VHDL code that is outside a process statement.
 
std::string getVhdlOutputFile () const
 Get the VHDL output code.
 
bool getPrintVhdl () const
 Gets the status of m_printVhdl.
 
bool getPrintedToFile () const
 Gets the status of m_printedToFile.
 
std::string getVhdlInProcess () const
 Gets the VHDL code that are in a process statement.
 
std::string getVhdlOutProcess () const
 Gets the VHDL code that are outside a process statement.
 
std::string getVhdlDefine () const
 Gets the VHDL code for define statement.
 
std::map< std::string, std::vector< int > > const & getSignals () const
 Gets the signals that were saved for one line of VHDL.
 
void printToFile ()
 Utilities Function to print VHDL code.
 
void buffersVhdlCode ()
 Function to print buffer VHDL code.
 
void signalsVhdlCode ()
 Function to print definition of signal VHDL code.
 
void entryVhdlCode ()
 Function to print entry VHDL code.
 
 TRGCDCLayer (unsigned id, unsigned superLayerId, unsigned localLayerId, unsigned axialStereoLayerId, unsigned axialStereoSuperLayerId, float offset, int nShifts, float cellSize, unsigned nCells, float innerRadius, float outerRadius)
 Constructor.
 
 TRGCDCLayer (unsigned id, const TRGCDCCell &w)
 Constructor for track segments.
 
 TRGCDCLayer ()
 Empty constructor for reduced CDC.
 
virtual ~TRGCDCLayer ()
 Destructor.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
const TRGCDCCellcell (int id) const
 returns a pointer to a cell. 'id' can be negative or 'id' can be greater than 'nCells()'.
 
 TRGCDCLink (TRGCDCTrack *track=0, const TRGCDCCellHit *hit=0, const HepGeom::Point3D< double > &position=Point3D())
 Constructor.
 
 TRGCDCLink (const TRGCDCLink &)
 Copy constructor.
 
virtual ~TRGCDCLink ()
 Destructor.
 
static unsigned nLayers (const std::vector< TRGCDCLink * > &links)
 returns # of layers.
 
static void nHits (const std::vector< TRGCDCLink * > &links, unsigned *nHits)
 returns # of hits per layer.
 
static void nHitsSuperLayer (const std::vector< TRGCDCLink * > &links, unsigned *nHits)
 returns # of hits per super layer.
 
void dump_base (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
static void dump (const std::vector< TRGCDCLink * > &links, const std::string &message=std::string(""), const std::string &prefix=std::string(""))
 dumps TRGCDCLinks.
 
static void dump (const std::vector< const TRGCDCLink * > &links, const std::string &message=std::string(""), const std::string &prefix=std::string(""))
 dumps TRGCDCLinks.
 
static void dump (const TRGCDCLink &link, const std::string &message=std::string(""), const std::string &prefix=std::string(""))
 dumps TRGCDCLinks.
 
static unsigned nStereoHits (const std::vector< TRGCDCLink * > &links)
 returns # of stereo hits.
 
static unsigned nAxialHits (const std::vector< TRGCDCLink * > &links)
 returns # of axial hits.
 
static std::vector< TRGCDCLink * > axialHits (const std::vector< TRGCDCLink * > &links)
 returns axial hits.
 
static std::vector< TRGCDCLink * > stereoHits (const std::vector< TRGCDCLink * > &links)
 returns stereo hits.
 
static TRGCDCLinkinnerMost (const std::vector< TRGCDCLink * > &links)
 returns the inner-most link.
 
static TRGCDCLinkouterMost (const std::vector< TRGCDCLink * > &links)
 returns the outer-most link.
 
static void separateCores (const std::vector< TRGCDCLink * > &input, std::vector< TRGCDCLink * > &cores, std::vector< TRGCDCLink * > &nonCores)
 separate cores and non-cores.
 
static std::vector< TRGCDCLink * > cores (const std::vector< TRGCDCLink * > &input)
 separate cores and non-cores.
 
static bool sortById (const TRGCDCLink *a, const TRGCDCLink *b)
 sorts by ID.
 
static int sortByX (const TRGCDCLink *a, const TRGCDCLink *b)
 sorts by X position.
 
static unsigned width (const std::vector< TRGCDCLink * > &)
 returns width(wire cell unit) of given std::vector<TRGCDCLink *>.
 
static std::vector< TRGCDCLink * > edges (const std::vector< TRGCDCLink * > &)
 returns links which are edges.
 
static std::vector< TRGCDCLink * > sameLayer (const std::vector< TRGCDCLink * > &list, const TRGCDCLink &a)
 returns links which are in the same layer as 'a' or 'id'.
 
static std::vector< TRGCDCLink * > sameSuperLayer (const std::vector< TRGCDCLink * > &list, const TRGCDCLink &a)
 returns links which are in the same super layer as 'a' or 'id'.
 
static std::vector< TRGCDCLink * > sameLayer (const std::vector< TRGCDCLink * > &list, unsigned id)
 returns links which are in the same layer as 'a' or 'id'.
 
static std::vector< TRGCDCLink * > sameSuperLayer (const std::vector< TRGCDCLink * > &list, unsigned id)
 returns links which are in the same super layer as 'a' or 'id'.
 
static std::vector< TRGCDCLink * > inOut (const std::vector< TRGCDCLink * > &)
 returns links which are in the inner most and outer most layer.
 
static unsigned superLayer (const std::vector< TRGCDCLink * > &list)
 returns super layer pattern.
 
static unsigned superLayer (const std::vector< TRGCDCLink * > &list, unsigned minNHits)
 returns super layer pattern.
 
static unsigned nSuperLayers (const std::vector< TRGCDCLink * > &links)
 returns # of layers.
 
static unsigned nSuperLayers (const std::vector< TRGCDCLink * > &links, unsigned minNHits)
 returns # of layers.
 
static unsigned nMissingAxialSuperLayers (const std::vector< TRGCDCLink * > &links)
 returns # of missing axial super layers.
 
static const TRGCDCTrackMClinks2HEP (const std::vector< TRGCDCLink * > &links)
 returns TRGCDCTrackMC
 
static void nHitsSuperLayer (const std::vector< TRGCDCLink * > &links, std::vector< TRGCDCLink * > *list)
 returns hits list per super layer.
 
static std::string layerUsage (const std::vector< TRGCDCLink * > &links)
 usage of each layer
 
static void remove (std::vector< TRGCDCLink * > &list, const std::vector< TRGCDCLink * > &links)
 removes links from list if wire is same
 
static void initializeBuffers (void)
 initialize the Buffers
 
static void separate (const std::vector< TRGCDCLink * > &links, unsigned nLayers, std::vector< TRGCDCLink * > *layers)
 separates into layers.
 
const TRGCDCWirewire (void) const
 returns a pointer to a wire.
 
static void removeAll (void)
 destructs all TRGCDCLink objects. (Called by TRGCDC)
 
static void * operator new (size_t)
 new operator.
 
static void operator delete (void *)
 delete operator.
 
 Cpar (const TRGCDCLpar &)
 constructor of Cpar class
 
virtual ~TRGCDCLpar ()
 Destructor.
 
void circle (double x1, double y1, double x2, double y2, double x3, double y3)
 circle
 
CLHEP::HepMatrix dldc () const
 private const member functions
 
bool xy (double, double &, double &, int dir=0) const
 private const member functions
 
double x (double r) const
 private const member functions
 
double y (double r) const
 private const member functions
 
double phi (double r, int dir=0) const
 const member functions
 
void xhyh (double x, double y, double &xh, double &yh) const
 private const member functions
 
double s (double x, double y) const
 const member functions
 
double s (double r, int dir=0) const
 const member functions
 
CLHEP::HepVector center () const
 const member functions
 
 TRGCDCLpav ()
 Constructor.
 
virtual ~TRGCDCLpav ()
 Destructor.
 
void calculate_average (double x, double y, double w=1)
 member functions for calculation
 
void calculate_average (void)
 member functions for calculation
 
void calculate_average_n (double xxav, double yyav, double xyav, double xrrav, double yrrav, double rrrrav)
 private member function calculate_average_n
 
void calculate_average3 (double x, double y, double w=1)
 member functions for calculation
 
void calculate_average3 (void)
 member functions for calculation
 
double solve_lambda (void)
 private member function solve_lambda
 
double solve_lambda3 (void)
 private member function solve_lambda3
 
double calculate_lpar (void)
 member functions for calculation
 
double calculate_lpar3 (void)
 member functions for calculation
 
double fit (double x, double y, double w=1)
 member functions for fit
 
double fit ()
 member functions for fit
 
CLHEP::HepSymMatrix cov (int=0) const
 const member function cov
 
CLHEP::HepSymMatrix cov_c (int=0) const
 const member function cov_c
 
int extrapolate (double, double &, double &) const
 const member function for extrapolation
 
double similarity (double, double) const
 const member function similarity
 
void add_point (double x, double y, double w=1)
 member functions to add point
 
void add_point_frac (double x, double y, double w, double f)
 member functions to add point
 
void sub (double x, double y, double w=1, double a=0, double b=0)
 private member functions
 
const TRGCDCLpavoperator+= (const TRGCDCLpav &)
 assignment operator(s)
 
double prob () const
 const member function prob
 
double chi_deg () const
 const member function chi_deg
 
double delta_chisq (double x, double y, double w=1) const
 const member function for delta chisq
 
std::string version (void) const
 returns version.
 
 TRGCDCLUT ()
 Contructor.
 
virtual ~TRGCDCLUT ()
 Destructor.
 
int getValue (unsigned) const
 get LUT Values
 
void setDataFile (const std::string &filename, int)
 set LUT data.
 
static TRGCDCLUTgetLUT (const std::string &filename, int)
 get LUT from dictionary, load new LUT if it doesn't exist
 
 TRGCDCMerger (const std::string &name, unitType type, const TRGClock &systemClock, const TRGClock &dataClock, const TRGClock &userClockInput, const TRGClock &userClockOutput)
 Constructor.
 
virtual ~TRGCDCMerger ()
 Destructor.
 
static std::string version (void)
 return version.
 
unitType type (void) const
 return type.
 
static int implementation (const unitType &type, std::ofstream &)
 make a VHDL component file.
 
static int implementationPort (const unitType &type, std::ofstream &)
 writes a port map.
 
void push_back (const TRGCDCFrontEnd *)
 push back TRGCDCFrontEnd of this Merger
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents. "message" is to select information to dump. "pre" will be printed in head of each line.
 
void simulate (void)
 simulates firmware.
 
static TRGState packerInner (const TRGState &input)
 Make bit pattern using input information from inner FEs.
 
static TRGState packerOuter (const TRGState &input)
 Make bit pattern using input information from outer FEs.
 
static void unpackerInner (const TRGState &input, const TRGState &output)
 Unpack TRGState.
 
static void unpackerOuter (const TRGState &input, const TRGState &output)
 Unpack TRGState.
 
void dump_log (void) const
 Dump all the details of _mosb into a .log file, do it in the end of simulate()
 
void dump_log_inner (void) const
 dump_log for inner Merger
 
void dump_log_outer (void) const
 dump_log for outer Merger
 
std::string version (void) const
 returns version.
 
 TRGCDCPeakFinder (const std::string &name)
 Contructor.
 
virtual ~TRGCDCPeakFinder ()
 Destructor.
 
void regions (TRGCDCHoughPlane &hp, const unsigned threshold) const
 Makes regions.
 
void findPeaksTrasan (TRGCDCHoughPlaneMulti2 &hp, const unsigned threshold, const bool centerIsPeak, std::vector< unsigned > &peakSerialIds) const
 do peak finding. This is a copy from "trasan".
 
void findPeaks (const TRGCDCHoughPlaneMulti2 &hp, const unsigned threshold, std::vector< std::vector< unsigned > > &peaks) const
 do peak finding. Kaiyu's version using p1p2Methode.
 
void p1p2Methode (const TRGCDCHoughPlane &hp, const unsigned threshold, std::vector< std::vector< unsigned > > &peaks) const
 Kaiyu's logic. Finds peaks from nested patterns.
 
std::string version (void) const
 returns version.
 
 TRGCDCPerfectFinder (const std::string &name, const TRGCDC &)
 Contructor.
 
virtual ~TRGCDCPerfectFinder ()
 Destructor.
 
int doit (std::vector< TRGCDCTrack * > &trackListClone, std::vector< TRGCDCTrack * > &trackList)
 do track finding.
 
int doitPerfectly (std::vector< TRGCDCTrack * > &trackList)
 do perfect finding.
 
 TRGCDCRelation (const TRGCDCTrackBase &track, const std::map< unsigned, unsigned > &relation)
 Constructor.
 
virtual ~TRGCDCRelation ()
 Destructor.
 
unsigned contributor (unsigned i=0) const
 returns i'th contributor of MCParticle.
 
const MCParticlemcParticle (unsigned i=0) const
 returns i'th contributor.
 
float purity (unsigned i=0) const
 returns i'th purity.
 
float purity3D (unsigned trkID) const
 returns purity for 3D for trkID particle which should be from 2D.
 
float efficiency3D (unsigned trkID, std::map< unsigned, unsigned > &numTSsParticle) const
 returns efficiency of TS for 3D
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 Dumps debug information.
 
 TRGCDCSegment (unsigned id, const TRGCDCLayer &layer, const TRGCDCWire &w, const TRGClock &clock, const std::string &TSLUTFile, const std::vector< const TRGCDCWire * > &wires)
 Constructor.
 
virtual ~TRGCDCSegment ()
 Destructor.
 
void initialize (void)
 initilize variables.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
 dumps debug information.
 
void clear (void) override
 clears information.
 
std::string name (void) const override
 returns name.
 
void simulate (bool clockSimulation, bool logicLUTFlag, const std::string &cdcCollectionName=std::string(""), const std::string &tsCollectionName=std::string(""))
 simulates TF hit using wire information.
 
void simulateWithoutClock (bool logicLUTFlag)
 simulates time-indegrated TF hit
 
void simulateWithClock (std::string cdcCollectionName, std::string tsCollectionName)
 simulates TF hit time-dependently
 
float fastestTime (void) const
 return fastest time in TSHit.
 
float fastestTime (int clk0) const
 fastest time in TSHit that is larger of equal to clk0.
 
float foundTime (void) const
 return found time in TSHit.
 
float priorityTime (void) const
 return priority time in TSHit.
 
int priorityPosition (void) const
 return priority cell position in TSHit. 0: no hit, 3: 1st priority, 1: 2nd right, 2: 2nd left
 
int priorityPosition (int clk0, int clk1) const
 return priority cell position in TSHit for given time window.
 
const TRGCDCWirepriority (void) const
 returns priority wire.
 
unsigned hitPattern (void) const
 returns hit pattern.
 
unsigned hitPattern_adc (void) const
 returns hit pattern with adc cut.
 
unsigned hitPattern (int clk0, int clk1) const
 returns hit pattern for hits in given time window.
 
unsigned lutPattern (void) const
 hit pattern containing bit for priority position
 
unsigned lutPattern (int clk0, int clk1) const
 hit pattern containing bit for priority position for hits in given time window.
 
virtual bool hasMember (const std::string &a) const override
 returns true this has member named a.
 
 TRGCDCSegmentHit (const TRGCDCSegment &)
 Constructor.
 
virtual ~TRGCDCSegmentHit ()
 Destructor.
 
static int sortById (const TRGCDCSegmentHit **a, const TRGCDCSegmentHit **b)
 Sorting funnction.
 
virtual void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
 dumps debug information.
 
const TRGCDCSegmentsegment (void) const
 returns a pointer to a track segment.
 
static void removeAll (void)
 destructs all TRGCDCCellHit objects. (Called by TRGCDC)
 
static void * operator new (size_t)
 new operator.
 
static void operator delete (void *)
 delete operator.
 
 TRGCDCSteppingAction ()
 Constructor.
 
virtual ~TRGCDCSteppingAction ()
 Destructor.
 
virtual void UserSteppingAction (const G4Step *)
 Stepping action to control a step in G4.
 
 TRGCDCTrackBase (const TRGCDCTrackBase &)
 Copy constructor.
 
 TRGCDCTrackBase (const std::string &name, double charge)
 Constructor.
 
virtual ~TRGCDCTrackBase ()
 Destructor.
 
virtual void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
virtual int fit (void)
 fits itself by a default fitter. Error was happened if return value is not zero.
 
void append (TRGCDCLink *)
 appends a link.
 
void append (const std::vector< TRGCDCLink * > &links)
 appends links.
 
const std::vector< TRGCDCLink * > & links (void) const
 returns a vector to track segments.
 
const std::vector< TRGCDCLink * > & links (unsigned layerId) const
 returns a vector to track segments.
 
virtual int approach2D (TRGCDCLink &) const
 calculate closest approach. Error was happened if return value is not zero.
 
const TRGCDCRelation relation (void) const
 returns MC information.
 
const TRGCDCRelation relation2D (void) const
 returns MC information for only axial layers.
 
const TRGCDCRelation relation3D (void) const
 returns MC information for only stereo layers.
 
 TRGCDCTracker2D (const std::string &name, const TRGClock &systemClock, const TRGClock &dataClock, const TRGClock &userClockInput, const TRGClock &userClockOutput)
 Constructor.
 
virtual ~TRGCDCTracker2D ()
 Destructor.
 
static std::string version (void)
 returns version.
 
void push_back (const TRGCDCTrackSegmentFinder *)
 Appends a TSF board.
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents.
 
void simulate (void)
 simulates firmware.
 
static TRGState packer (const TRGState &input, TRGState &registers, bool &logicStillActive)
 Packer for 3D tracker.
 
static void unpacker (const TRGState &input, TRGState &output)
 Unpack TSF output.
 
static void hitInformation (const TRGState &registers)
 Gets TSF hit information for one certin clock from the registers.
 
void setConstants (void)
 Sets constants.
 
static void update (void)
 updates information.
 
 TRGCDCTrackMC ()
 Constructor.
 
virtual ~TRGCDCTrackMC ()
 Destructor.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
static std::vector< const TRGCDCTrackMC * > list (void)
 returns a list of TRGCDCTrackMC's.
 
std::vector< const TRGCDCWireHitMC * > hits (void) const
 returns a list of TRGCDCWireHitMC.
 
 TRGCDCTrackSegmentFinder (const TRGCDC &, bool makeRootFile, bool logicLUTFlag)
 Constructor.
 
 TRGCDCTrackSegmentFinder (const TRGCDC &, const std::string &name, boardType type, const TRGClock &systemClock, const TRGClock &dataClock, const TRGClock &userClockInput, const TRGClock &userClockOutput, const std::vector< TRGCDCSegment * > &tsSL)
 Constructor.
 
 ~TRGCDCTrackSegmentFinder ()
 Destructor.
 
boardType type (void) const
 board type of TSF
 
void terminate (void)
 terminate
 
void doit (std::vector< TRGCDCSegment * > &tss, const bool trackSegmentClockSimulation, std::vector< TRGCDCSegmentHit * > &segmentHits, std::vector< TRGCDCSegmentHit * > *segmentHitsSL)
 Member functions of doing TSF.
 
vector< TRGSignalVector * > findTSHit (TRGSignalVector *eachInput, int)
 Use LUT for find TSHit.
 
TRGSignalVectorpackerOuterTracker (vector< TRGSignalVector * > &, vector< int > &, const unsigned)
 Packing output for tracker.
 
TRGSignalVectorpackerOuterEvt (vector< TRGSignalVector * >, vector< int >, int)
 Packing output for evtTime & Low pT.
 
double mkint (TRGState)
 tranformatoin into integer
 
vector< bool > mkbool (int, int)
 tranformatoin into bool
 
void saveTSInformation (std::vector< TRGCDCSegment * > &tss)
 save the TS info
 
void saveTSFResults (std::vector< TRGCDCSegmentHit * > *segmentHitsSL)
 save result of TSF
 
void saveNNTSInformation (std::vector< TRGCDCSegment * > &tss)
 Saves NNTS information. Only when ts is hit.
 
void push_back (const TRGCDCMerger *)
 push back the Mergers of this TSF
 
void simulateOuter (void)
 Firmware simulation for the outers. yi.
 
vector< TRGSignalVector * > simulateOuter (TRGSignalVector *in, unsigned id)
 Simulate TSF response for the inner.
 
void priorityTiming (unsigned tsfID, const unsigned nTSF, TRGSignalVector &s, const TRGSignal &center, const TRGSignal &right, const TRGSignal &left) const
 Make TRGSignals for the priority timing bits.
 
void fastestTimingOuter (unsigned tsfID, const unsigned nTSF, TRGSignalVector &s) const
 Make TRGSignals for the fastest timing bits.
 
void simulateInner (void)
 Firmware simulation for the outers. yi.
 
void fastestTimingInner (unsigned tsfID, const unsigned nTSF, TRGSignalVector &s) const
 Make TRGSignals for the fastest timing bits.
 
vector< TRGSignalVector * > simulateInner (const TRGSignalVector &in, unsigned id)
 Simulate TSF response for the inner.
 
static void addID (TRGSignalVector &s, unsigned id)
 Add TSF ID to timing signal vector for the output.
 
void simulate (void)
 Firmware simulation. yi.
 
void simulate2 (void)
 Firmware simulation. Unified version of inner and outer : yi.
 
void hitMapInner (void)
 Creates the hit maps for the inner.
 
void hitMapOuter (void)
 Creates the hit maps for the outer.
 
void inputInner (const unsigned id, const unsigned nTSF, TRGSignalVector *s)
 Creates input signals to TSF for the inner.
 
void inputOuter (const unsigned id, const unsigned nTSF, TRGSignalVector *s)
 Creates input signals to TSF for the outer.
 
TRGSignalVectorpackerForTracker (vector< TRGSignalVector * > &, vector< int > &, const unsigned)
 Output packer for tracker.
 
vector< TRGSignalVector * > simulateTSFOld (TRGSignalVector *in, unsigned id)
 Simulate TSF response (unified version)
 
vector< TRGSignalVector * > simulateTSF (TRGSignalVector *in, unsigned id)
 Simulate TSF response (unified version, 2016/07/12)
 
vector< TRGSignalVector * > simulateTSF2 (TRGSignalVector *in, unsigned id)
 Simulate TSF response (unified version, state machine)
 
std::string name (void) const
 simulates track segment decisions.
 
std::string version (void) const
 returns version.
 
static TRGCDCgetTRGCDC (const std::string &configFile, unsigned simulationMode=0, unsigned fastSimulationMode=0, unsigned firmwareSimulationMode=0, int firmwareSimulationStart=0, int firmwareSimulationStop=32 *32 - 1, bool _makeRootFile=0, bool perfect2DFinder=false, bool perfect3DFinder=false, const std::string &innerTSLUTFile="?", const std::string &outerTSLUTFile="?", const std::string &rootTRGCDCFile="?", const std::string &rootFitter3DFile="?", unsigned houghFinderPeakMin=5, const std::string &houghMappingFilePlus="?", const std::string &houghMappingFileMinus="?", unsigned houghDoit=2, bool fLogicLUTTSF=0, bool fLRLUT=1, bool fFitter3Dsmclr=0, bool fFitter3Ds2DFit=1, bool fFitter3Ds2DFitDrift=0, double inefficiency=0, bool fileTSF=0, bool fileETF=0, int fverETF=0, bool fprintFirmETF=0, bool fileHough3D=0, int finder3DMode=0, bool fileFitter3D=0, bool fXtSimpleFitter3D=0, double TdcBinWidth=1., int trgCDCDataInputMode=0, const std::string &cdchitCollectionName="")
 returns TRGCDC object with specific configuration.
 
static TRGCDCgetTRGCDC (void)
 returns TRGCDC object.
 
std::vector< TRGCDCTrack * > getTrackList2D (void)
 returns 2D track list (no fit).
 
std::vector< TRGCDCTrack * > getTrackList2DFitted (void)
 returns 2D fitted track list.
 
std::vector< TRGCDCTrack * > getTrackList3D (void)
 returns 3D track list (fitted).
 
 TRGCDC (const std::string &configFile, unsigned simulationMode, unsigned fastSimulationMode, unsigned firmwareSimulationMode, int firmwareSimulationStart, int firmwareSimulationStop, bool makeRootFile, bool perfect2DFinder, bool perfect3DFinder, const std::string &innerTSLUTFile, const std::string &outerTSLUTFile, const std::string &rootTRGCDCFile, const std::string &rootFitter3DFile, unsigned houghFinderPeakMin, const std::string &houghMappingFilePlus, const std::string &houghMappingFileMinus, unsigned houghDoit, bool fLogicLUTTSF, bool fLRLUT, bool fFitter3Dsmclr, bool fFitter3Ds2DFit, bool fFitter3Ds2DFitDrift, double inefficiecny, bool fileTSF, bool fileETF, int fverETF, bool fprintFirmETF, bool fileHough3D, int finder3DMode, bool fileFitter3D, bool fXtSimpleFitter3D, double TdcBinWidth, int trgCDCDataInputMode, const std::string &cdchitCollectionName)
 Constructor.
 
void initialize (unsigned houghFinderPeakMin, const std::string &houghMappingFilePlus, const std::string &houghMappingFileMinus, unsigned houghDoit)
 initializes CDC geometry.
 
void terminate (void)
 terminates when run is finished
 
void dump (const std::string &message) const
 dumps debug information.
 
const TRGCDCWirewire (unsigned wireId) const
 returns a pointer to a wire.
 
const TRGCDCWirewire (unsigned layerId, int localId) const
 returns a pointer to a wire.
 
const TRGCDCWirewire (float r, float phi) const
 returns a pointer to a wire.
 
void clear (void)
 clears all TRGCDC hit information.
 
void fastClear (void)
 clears TRGCDC information.
 
void update ()
 updates TRGCDC wire information. clear() is called in this function.
 
void updateByData (int inputMode)
 updates TRGCDC wire information by Hardware data 0: From CDC FE ASCII file (Implementing) 1: From CDC FE-DAQ root file (Not implemented) 2: From TSIM root file (Not implemented)
 
void classification (void)
 classify hits.
 
std::vector< const TRGCDCWireHit * > axialHits (void) const
 returns a list of axial hits.
 
std::vector< const TRGCDCWireHit * > stereoHits (void) const
 returns a list of stereo hits.
 
std::vector< const TRGCDCWireHit * > hits (void) const
 returns a list of TRGCDCWireHit.
 
std::vector< const TRGCDCWireHitMC * > hitsMC (void) const
 returns a list of TRGCDCWireHitMC.
 
std::string wireName (unsigned wireId) const
 returns wire name.
 
unsigned localId (unsigned wireId) const
 returns local ID in a layer. This function is expensive.
 
unsigned layerId (unsigned wireId) const
 returns layer ID. This function is expensive.
 
unsigned layerId (unsigned axialStereoSwitch, unsigned axialStereoLayerId) const
 returns layer ID from axialStereoLayerId. This function is expensive.
 
unsigned superLayerId (unsigned wireId) const
 returns super layer ID. This function is expensive.
 
unsigned localLayerId (unsigned wireId) const
 returns local layer ID in a super layer. This function is expensive.
 
unsigned axialStereoSuperLayerId (unsigned axialStereo, unsigned axialStereoLayerId) const
 returns axialStereo super layer ID. This function is expensive.
 
virtual ~TRGCDC ()
 Destructor.
 
bool neighbor (const TRGCDCWire &w0, const TRGCDCWire &w1) const
 returns true if w0 and w1 are neighbor.
 
void simulate (void)
 fast trigger simulation.
 
void fastSimulation (void)
 Fast simulation.
 
void storeSimulationResults (std::string collection2Dfinder, std::string collection2Dfitter, std::string collection3Dfitter)
 Save results of fast simulation to data store (segment hits & tracks).
 
void firmwareSimulation (void)
 Firmware simulation.
 
void configure (void)
 configures trigger modules for firmware simulation.
 
const TRGCDCSegmentsegment (unsigned lyrId, unsigned id) const
 returns a track segment.
 
int getEventTime (void) const
 returns bad hits(finding invalid hits).
 
void setReturnValue (EReturnValueType const &moduleName, bool flag)
 sets return value for trg cdc module.
 
int getReturnValue (EReturnValueType const &moduleName) const
 gets return value for a module in trg cdc module.
 
void saveCDCHitInformation (std::vector< std::vector< unsigned > > &)
 Save functions for ROOT.
 
void saveTRGHitInformation (std::vector< std::vector< int > > &)
 Save functions for ROOT.
 
void saveTRGRawInformation (std::vector< std::string > &)
 Save functions for ROOT.
 
unsigned nSegments (unsigned id) const
 returns # of track segments in a layer.
 
 TRGCDCTrack ()
 Constructor.
 
 TRGCDCTrack (const TRGCDCCircle &)
 Constructor from a Circle.
 
virtual ~TRGCDCTrack ()
 Destructor.
 
static std::vector< const TRGCDCTrack * > list (void)
 returns a list of TRGCDCTrack's.
 
int approach (TRGCDCLink &, bool sagCorrection=false) const
 calculates the closest approach to a wire in real space. Results are stored in TLink. Return value is negative if error happened.
 
std::vector< HepGeom::Point3D< double > > perfectPosition (void) const
 returns perfect position from GEANT.
 
 TRGCDCWire (unsigned id, unsigned localId, const TRGCDCLayer &, const HepGeom::Point3D< double > &forwardPosition, const HepGeom::Point3D< double > &backwardPosition, const TRGClock &clock)
 Constructor.
 
virtual ~TRGCDCWire ()
 Destructor.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
 dumps debug information.
 
const TRGCDCWireneighbor (unsigned) const
 returns a pointer to a neighbor wire. This function is expensive.
 
void clear (void) override
 clears information.
 
std::string name (void) const override
 returns name.
 
 TRGCDCWireHit (const TRGCDCWire &, unsigned indexCDCHit=0, unsigned indexCDCSimHit=0, unsigned indexMCParticle=0, float driftLeft=0, float driftLeftError=0, float driftRight=0, float driftRightError=0, int mcLRflag=1, float fudgeFacgtor=1)
 Constructor.
 
virtual ~TRGCDCWireHit ()
 Destructor.
 
const TRGCDCWirewire (void) const
 returns a pointer to a TRGCDCWire.
 
static int sortByWireId (const TRGCDCWireHit **a, const TRGCDCWireHit **b)
 Sort function. This will be removed.
 
static void removeAll (void)
 destructs all TRGCDCCellHit objects. (Called by TRGCDC)
 
static void * operator new (size_t)
 new operator.
 
static void operator delete (void *)
 delete operator.
 
 TRGCDCWireHitMC (const TRGCDCWire *, const TRGCDCWireHit *)
 Constructor.
 
virtual ~TRGCDCWireHitMC ()
 Destructor.
 
 TrgEclDatabaseImporter ()
 TrgEclDatabaseImporter Constructor.
 
void importFAMParameter (std::string, std::string, std::string)
 Import FAM Parameters.
 
void importTMMParameter (std::string)
 Import TMM Parameters.
 
void importETMParameter (std::string)
 Import ETM Parameters.
 
void importBadRunNumber (std::string)
 Import Bad Run Number.
 
void printTCThreshold ()
 Print TC energy Threshold.
 
int debugLevel (void) const
 returns debug level.
 
int debugLevel (int) const
 sets and returns debug level.
 
const TRGClocksystemClock (void) const
 returns the system clock.
 
double systemOffsetMC (void) const
 returns the system offset in MC.
 
unsigned firmwareSimulationMode (void) const
 returns firmware simulation mode.
 
std::string configFile (void) const
 returns configuration file name.
 
std::string name (void) const
 returns name.
 
std::string version (void) const
 returns version.
 
static TRGGDLgetTRGGDL (const std::string &configFile, unsigned simulationMode=0, unsigned fastSimulationMode=0, unsigned firmwareSimulationMode=0, const std::string &Phase="Phase", bool algFromDB=true, const std::string &algFilePath="ftd.alg", int debugLevel=0, double timquality_threshold_sfin=0, double timquality_threshold_fine=0)
 returns TRGGDL object with specific configuration.
 
static TRGGDLgetTRGGDL (void)
 returns TRGGDL object.
 
 TRGGDL (const std::string &configFile, unsigned simulationMode, unsigned fastSimulationMode, unsigned firmwareSimulationMode, const std::string &Phase, bool algFromDB=true, const std::string &algFilePath="ftd.alg", int debugLevel=0, double timquality_threshold_sfin=0, double timquality_threshold_fine=0)
 Constructor.
 
void initialize (void)
 initializes GDL.
 
void terminate (void)
 terminates when run is finished
 
void dump (const std::string &message) const
 dumps debug information.
 
void clear (void)
 clears all TRGGDL information.
 
void fastClear (void)
 clears TRGGDL information.
 
void update (bool mcAnalysis=true)
 updates TRGGDL information.
 
virtual ~TRGGDL ()
 Destructor.
 
void simulate (void)
 fast trigger simulation.
 
void fastSimulation (void)
 Fast simulation.
 
void dataSimulation (void)
 Data simulation.
 
bool isFiredFTDL (std::vector< bool > input, std::string alg)
 
bool doprescale (int f)
 
void firmwareSimulation (void)
 Firmware simulation.
 
void configure (void)
 configures trigger modules for firmware simulation.
 
void getInput (std::ifstream &ifs)
 Read input data definition.
 
void getOutput (std::ifstream &ifs)
 Read output data definition.
 
void getAlgorithm (std::ifstream &ifs)
 Read algorithm data definition.
 
static TRGState decision (const TRGState &input)
 Makes bit pattern(state) using input bit pattern(state).
 
static TRGState timingDecision (const TRGState &input, TRGState &registers, bool &logicStillActive)
 Makes timing decision.
 
void accumulateInp (TH1I *)
 Accumulate bit info in histogram.
 
void accumulateFtd (TH1I *)
 Accumulate bit info in histogram.
 
void accumulatePsn (TH1I *)
 Accumulate bit info in histogram.
 
void checkDatabase () const
 Check the content of the DBObjects used by this class.
 
int debugLevel (void) const
 returns debug level.
 
int debugLevel (int) const
 sets and returns debug level.
 
const TRGClocksystemClock (void) const
 returns the system clock.
 
unsigned firmwareSimulationMode (void) const
 returns firmware simulation mode.
 
std::string configFile (void) const
 returns configuration file name.
 
std::string name (void) const
 matching function
 
std::string version (void) const
 returns version.
 
static TRGGRLgetTRGGRL (const std::string &configFile, unsigned simulationMode=0, unsigned fastSimulationMode=0, unsigned firmwareSimulationMode=0)
 returns TRGGRL object with specific configuration.
 
static TRGGRLgetTRGGRL (void)
 returns TRGGRL object.
 
 TRGGRL (const std::string &configFile, unsigned simulationMode, unsigned fastSimulationMode, unsigned firmwareSimulationMode)
 Constructor.
 
void initialize (void)
 initializes GRL.
 
void terminate (void)
 terminates when run is finished
 
void dump (const std::string &message) const
 dumps debug information.
 
void clear (void)
 clears all TRGGRL information.
 
void fastClear (void)
 clears TRGGRL information.
 
void update (bool mcAnalysis=true)
 updates TRGGRL information.
 
virtual ~TRGGRL ()
 Destructor.
 
void simulate (void)
 fast trigger simulation.
 
void fastSimulation (void)
 Fast simulation.
 
void firmwareSimulation (void)
 Firmware simulation.
 
void configure (void)
 configures trigger modules for firmware simulation.
 
 TRGGRLMatch (TRGCDCTrack *track, TRGECLCluster *cluster, int flag)
 public member functions of TRGGRLMatch class Private variables can be called by the corresponding get function
 
virtual ~TRGGRLMatch ()
 Destructor.
 
void calculate (void)
 a function to execute calculation of matching
 
void dump (void)
 Unpacker of the TRGGRLMatch.
 
bool inArea (const TRGPoint2D &x) const
 returns true if give point is in the area.
 
const std::string & name (void) const
 returns name.
 
const std::string & name (const std::string &newName)
 sets and returns name.
 
void clear (void)
 clears contents.
 
unsigned size (void) const
 returns size of stream in unit of bit.
 
void append (int)
 appends a bit to a stream.
 
void append (unsigned)
 appends a bit to a stream.
 
unsigned sizeInChar (void) const
 returns size in char's.
 
char c (unsigned positionInChar) const
 returns a pointer to char's.
 
bool bit (unsigned positionInBit) const
 returns true if given position is active.
 
const std::string & name (void) const
 returns name.
 
const TRGClockclockSystem (void) const
 returns system clock.
 
const TRGClockclockData (void) const
 returns data clock.
 
const TRGClockclockUserInput (void) const
 returns Aurora user clock for input.
 
const TRGClockclockUserOutput (void) const
 returns Aurora user clock for output.
 
void appendInput (const TRGChannel *)
 appends an input Aurora channel.
 
void appendOutput (TRGChannel *)
 appends an output Aurora channel.
 
const TRGChannelinput (unsigned i) const
 returns input channel i.
 
TRGChanneloutput (unsigned i) const
 returns output channel i.
 
unsigned nInput (void) const
 returns input channels.
 
unsigned nOutput (void) const
 returns output channels.
 
const std::string & name (void) const
 returns name.
 
TRGSignalBundlesignal (TRGSignalBundle *)
 sets input data.
 
TRGSignalBundlesignal (void) const
 returns signal.
 
const TRGBoardsender (void) const
 sender TRG board
 
double offset (void) const
 returns offset of the clock zero position in nano second.
 
const std::string & name (void) const
 returns name.
 
double minTiming (void) const
 returns min. timing.
 
double maxTiming (void) const
 returns max. timing.
 
int unit (double period) const
 returns min # of clocks to cover given time period.
 
double frequency (void) const
 returns frequency in MHz.
 
int min (void) const
 returns min. clock point.
 
int max (void) const
 returns max. clock point.
 
int positionInSourceClock (double timing) const
 returns clock position in the source clock.
 
const std::string & name (void) const
 returns name.
 
const TRGClockclock (void) const
 returns clock.
 
void appendHeader (const TRGSignal *)
 appends a signal to header data.
 
void appendTrailer (const TRGSignal *)
 appends a signal to trailer data.
 
void append (const TRGSignal *)
 appends a signal to data.
 
double x (void) const
 x of the point
 
double y (void) const
 y of the point
 
double x (double)
 x of the point
 
double y (double)
 y of the point
 
double mag (void) const
 magnitude of the point
 
double mag2 (void) const
 magnitude square of the point
 
double phi (void) const
 phi of the point
 
double dot (const TRGPoint2D &) const
 inner product
 
double cross (const TRGPoint2D &) const
 outer product
 
TRGPoint2D operator+ (const TRGPoint2D &) const
 
TRGPoint2D operator- (const TRGPoint2D &) const
 
TRGPoint2D operator- () const
 
bool operator== (const TRGPoint2D &) const
 equal operator
 
TRGPoint2D unit (void) const
 unit vector
 
const std::string & name (void) const
 returns name.
 
const std::string & name (const std::string &newName)
 sets and returns name.
 
TRGSignal operator& (const TRGTime &) const
 returns AND result.
 
TRGSignaloperator&= (const TRGTime &)
 returns AND result.
 
TRGSignal operator| (const TRGTime &) const
 returns OR result.
 
TRGSignaloperator|= (const TRGTime &)
 returns OR result.
 
unsigned nSignals (void) const
 returns # of signals.
 
unsigned nEdges (void) const
 returns # of edges.
 
void clear (void)
 clears contents.
 
bool active (void) const
 returns true if there is a signal.
 
bool state (int clockPosition) const
 returns true if signal is active in given clock position.
 
bool riseEdge (int clockPosition) const
 returns true if signal is active and rising edge in give clock position.
 
const TRGTimeoperator[] (unsigned i) const
 returns timing of i'th edge.
 
const TRGClockclock (void) const
 returns clock.
 
bool operator!= (const TRGSignal &) const
 returns true if two are the same.
 
bool active (int clk0, int clk1) const
 returns true if there is a signal.
 
const std::string & name (void) const
 returns name.
 
const std::string & name (const std::string &newName)
 sets and returns name.
 
const TRGClockclock (void) const
 returns clock.
 
const std::string & name (void) const
 returns name.
 
const std::string & name (const std::string &newName)
 sets and returns name.
 
const TRGClockclock (void) const
 returns clock.
 
bool operator!= (const TRGSignalVector &) const
 compare two TRGSignalVectors.
 
unsigned size (void) const
 returns bit size.
 
bool active (void) const
 returns true if there are active bits.
 
bool active (unsigned bitPosition) const
 returns true if there are active bits.
 
bool operator[] (unsigned i) const
 returns state of i'th bit.
 
 operator unsigned () const
 Conversion to unsigned.
 
 operator unsigned long long () const
 Conversion to unsigned long long.
 
 operator std::string () const
 Conversion to string.
 
void copy2bool (bool *array) const
 returns a filled array.
 
const TRGStateset (unsigned position, unsigned size, const bool *const array)
 sets state.
 
const TRGStateset (unsigned position, unsigned size, unsigned value)
 sets state.
 
const TRGStateset (unsigned position, bool state=true)
 sets state at bit i.
 
const TRGStateset (unsigned position, const TRGState &)
 sets state.
 
static unsigned toUnsigned (unsigned n, const bool *array)
 Coverts from bool array to unsigned.
 
TRGStateshift (unsigned i)
 shifts bits.
 
void clear (void)
 clears state.
 
const std::string & name (void) const
 returns name.
 
const std::string & name (const std::string &newName)
 sets and returns name.
 
TRGTimereverse (void)
 reverse edge.
 
const TRGClockclock (void) const
 returns clock.
 
bool edge (void) const
 returns edge information.
 
TRGTimeshift (int unit)
 delays by clock unit.
 
int time (void) const
 returns timing in clock position.
 
int time (int newTime)
 sets and returns timing in clock position.
 
bool operator== (const TRGTime &) const
 returns true if two are the same.
 
bool operator!= (const TRGTime &) const
 returns false if two are the same.
 
 TRGArea2D (const TRGPoint2D &leftBottom, const TRGPoint2D &rightUpper)
 Contructor.
 
virtual ~TRGArea2D ()
 Destructor.
 
void cross (const TRGPoint2D &x0, const TRGPoint2D &x1, unsigned &nFound, TRGPoint2D crossPoint[2]) const
 returns cross-points.
 
 TRGBitStream ()
 Default constructor.
 
 TRGBitStream (int size, const std::string &name="unknown")
 Constructor of fixed size.
 
 TRGBitStream (const TRGBitStream &)
 Copy constructor.
 
 TRGBitStream (const char *const, unsigned sizeInBit)
 Constructor with char stream.
 
virtual ~TRGBitStream ()
 Destructor.
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents. "message" is to select information to dump. "pre" will be printed in head of each line.
 
void append (bool)
 appends a bit to a stream.
 
static std::vector< TRGSignalTRGBitStream2TRGSignal (const TRGClock &clock, int initialClockPosition, std::vector< TRGBitStream * > stream)
 Make trigger signals from bit stream.
 
 TRGBoard (const std::string &name, const TRGClock &systemClock, const TRGClock &dataClock, const TRGClock &userClockInput, const TRGClock &userClockOutput)
 Constructor.
 
virtual ~TRGBoard ()
 Destructor.
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents.
 
 TRGChannel (const std::string &name, const TRGBoard &sender, const TRGBoard &receiver)
 Constructor.
 
virtual ~TRGChannel ()
 Destructor.
 
 TRGClock (const std::string &name, double offset, double frequency)
 Constructor. "offset" is in unit of ns. "frequency" is in unit of MHz.
 
 TRGClock (const std::string &name, const TRGClock &, unsigned multiplicationFactor, unsigned divisionFactor=1)
 Constructor with clock source.
 
virtual ~TRGClock ()
 Destructor.
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents.
 
int position (double timing) const
 returns clock position.
 
double absoluteTime (int clockPosition) const
 returns absolute time of clock position
 
double overShoot (double timing) const
 returns over shoot.
 
TRGTime minTRGTime (bool edge) const
 returns min. TRGtime with clock.
 
TRGTime maxTRGTime (bool edge) const
 returns max. TRGtime with clock.
 
double phase (double timing) const
 returns phase of given timing in degree (0 to 360).
 
const TRGSignalVectorclockCounter (void) const
 returns the clock counter.
 
static void enterStage (const std::string &stageName)
 Declare that you enter new stage.
 
static void leaveStage (const std::string &stageName)
 Declare that you leave a stage.
 
static std::string tab (void)
 returns tab spaces.
 
static std::string tab (int extra)
 returns tab spaces with extra spaces
 
static int level (void)
 returns the debug level.
 
static int level (int newLevel, bool thisStageOnly=false)
 sets and returns the debug level.
 
 TRGOpticalLink (const std::string &name, const TRGClock &)
 Constructor.
 
virtual ~TRGOpticalLink ()
 Destructor.
 
 TRGPoint2D ()
 Constructor.
 
 TRGPoint2D (double, double)
 Constructor.
 
 TRGPoint2D (const HepGeom::Point3D< double > &)
 Constructor.
 
 TRGPoint2D (const Vector3D &)
 Constructor.
 
 TRGPoint2D (const CLHEP::Hep3Vector &)
 Constructor.
 
virtual ~TRGPoint2D ()
 Destructor.
 
 TRGSignal (const TRGClock &=Belle2_GDL::GDLSystemClock)
 Constructor.
 
 TRGSignal (const TRGTime &t0, const TRGTime &t1)
 Constructor with clock and timing(t0 leading, t1 trailing).
 
 TRGSignal (const TRGClock &c, int t0, int t1)
 Constructor with clock and timing(t0 leading, t1 trailing).
 
 TRGSignal (const TRGClock &c, double t0, double t1)
 Constructor with clock and timing(t0 leading, t1 trailing).
 
 TRGSignal (const std::string &name, const TRGClock &=Belle2_GDL::GDLSystemClock)
 Constructor with name.
 
 TRGSignal (const TRGSignal &)
 Copy constructor.
 
 TRGSignal (const TRGTime &)
 Constructor.
 
virtual ~TRGSignal ()
 Destructor.
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents.
 
TRGSignal operator& (const TRGSignal &) const
 returns AND result.
 
TRGSignaloperator&= (const TRGSignal &)
 returns AND result.
 
TRGSignal operator| (const TRGSignal &) const
 returns OR result.
 
TRGSignaloperator|= (const TRGSignal &)
 returns OR result.
 
static std::vector< TRGTimeorOperation (const std::vector< TRGTime > &)
 Or operation.
 
TRGSignalwiden (unsigned width)
 returns widen signals. Signals wider than "width" will be untouched.
 
std::vector< int > stateChanges (void) const
 returns a list of clock position of state change.
 
const TRGClockclock (const TRGClock &)
 changes clock.
 
unsigned width (unsigned i=0) const
 returns width of i'th signal (i=0,1,2,...).
 
const TRGSignalset (int t0, int t1, bool state=true)
 makes a pulse with leading edge at clock t0 and with trailing edge at clock t1.
 
const TRGSignalunset (int t0, int t1)
 clear(or unset) with leading edge at clock t0 and with trailing edge at clock t1.
 
void sort (void)
 Sort operation.
 
bool consistencyCheck (void) const
 Self-consitency check. True is return if something wrong.
 
const TRGSignalinvert (void)
 makes signal inverted.
 
bool operator== (const TRGSignal &) const
 returns true if two are the same.
 
 TRGSignalBundle (const TRGClock &)
 Default constructor.
 
 TRGSignalBundle (const std::string &name, const TRGClock &)
 Constructor with name.
 
 TRGSignalBundle (const std::string &name, const TRGClock &clock, const TRGSignalBundle &input, const unsigned outputBitSize, TRGState(*packer)(const TRGState &))
 Constructor with a packer.
 
 TRGSignalBundle (const std::string &name, const TRGClock &clock, const TRGSignalBundle &input, const unsigned outputBitSize, const unsigned registerBitSize, TRGState(*packer)(const TRGState &in, TRGState &registers, bool &logicStillActive))
 Constructor with a packer which can handle multiple clock states.
 
virtual ~TRGSignalBundle ()
 Destructor.
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents.
 
bool active (void) const
 returns true if there is a signal.
 
std::vector< int > stateChanges (void) const
 returns a list of clock position of state change.
 
TRGState state (int clockPosition) const
 returns state at given clock position.
 
const TRGClockclock (const TRGClock &)
 changes clock.
 
TRGSignal ored (void) const
 returns signal of all ORed.
 
void dumpCOE (const std::string &fileName="", int start=0, int stop=0) const
 makes coe output.
 
 TRGSignalVector (const std::string &name, const TRGClock &, unsigned size=0)
 Default constructor.
 
 TRGSignalVector (const TRGSignalVector &)
 Copy constructor.
 
 TRGSignalVector (const TRGSignal &)
 Constructor.
 
virtual ~TRGSignalVector ()
 Destructor.
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents.
 
TRGSignalVectoroperator+= (const TRGSignal &)
 appends TRGSignal.
 
TRGSignalVectoroperator+= (const TRGSignalVector &)
 appends TRGSignalVector.
 
bool active (void) const
 returns true if there is a signal.
 
bool active (int clockPosition) const
 returns true if there is a signal at clock position.
 
std::vector< int > stateChanges (void) const
 returns a list of clock position of state change.
 
TRGState state (int clockPosition) const
 returns state at given clock position.
 
const TRGClockclock (const TRGClock &)
 changes clock.
 
const TRGSignalVectorset (const TRGState &, int clockPosition)
 sets state at given clock.
 
bool operator== (const TRGSignalVector &) const
 compare two TRGSignalVectors.
 
 TRGState (unsigned bitSize=0)
 Default constructor.
 
 TRGState (unsigned bitSize, unsigned value)
 Constructor with unsigned.
 
 TRGState (unsigned bitSize, const bool *const states)
 Constructor.
 
 TRGState (std::vector< bool > states)
 Constructor.
 
 TRGState (std::vector< unsigned > &states, unsigned order)
 Constructor. order: 0=>inVector[0] is lsb. 1=>inVector[0] is msb.
 
 TRGState (const char *, unsigned type)
 Constructor. type: 0-> binary, 1->hex.
 
virtual ~TRGState ()
 Destructor.
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents.
 
TRGStateoperator+= (const TRGState &)
 appends TRGState (as MSB).
 
TRGState subset (unsigned i, unsigned n) const
 returns subset from i with n bits.
 
TRGStateoperator= (const TRGState &)
 Copy operator.
 
bool operator< (const TRGState &) const
 Copy operator.
 
 TRGTime (const TRGTime &)
 Copy constructor.
 
 TRGTime (double timing, bool edge, const TRGClock &clock, const std::string &name="signal")
 Constructor with clock.
 
 TRGTime (int clockPosition, bool edge, const TRGClock &clock, const std::string &name="signal")
 Constructor with clock.
 
virtual ~TRGTime ()
 Destructor.
 
TRGSignal operator& (const TRGTime &) const
 adding two TRGTime. A result is TRGSignal.
 
TRGSignal operator& (const TRGSignal &) const
 adding two TRGTime. A result is TRGSignal.
 
TRGSignal operator| (const TRGTime &) const
 oring two TRGTime. A result is TRGSignal.
 
TRGSignal operator| (const TRGSignal &) const
 oring two TRGTime. A result is TRGSignal.
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents.
 
static bool sortByTime (const TRGTime &a, const TRGTime &b)
 returns true if a is older than b.
 
const TRGClockclock (const TRGClock &)
 changes clock.
 
static std::string dateString (void)
 returns date string.
 
static std::string dateStringF (void)
 returns date string for filename.
 
static std::string itostring (int i)
 converts int to string. (Use boost::lexical_cast)
 
static std::string dtostring (double d, unsigned int precision)
 converts double to string.
 
static std::string carstring (const std::string &s)
 CERNLIB car.
 
static std::string cdrstring (const std::string &s)
 CERNLIB cdr.
 
static void bitDisplay (unsigned)
 Dumps bit contents to cout.
 
static void bitDisplay (unsigned val, unsigned firstDigit, unsigned lastDigit)
 Dumps bit contents to cout.
 
static std::string streamDisplay (unsigned, unsigned firstDigit, unsigned lastDigit)
 Dumps bit stream in string.
 
static std::string streamDisplay (unsigned)
 Dumps bit stream in string.
 

Variables

const double M_PI2 = 2. * M_PI
 2*PI
 
const double M_PI4 = 4. * M_PI
 4*PI
 
const double M_PI8 = 8. * M_PI
 8*PI
 
const TRGCDCLayerTRGCDCUndefinedLayer
 TRGCDCUndefinedLayer declaration.
 
const int ntrgline = 18
 set the total number of trigger lines and prescalefactor
 
double scalef_phase2 [ntrgline] = {1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 1, 1, 1, 1, 1}
 prescale factor for phase2
 
double scalef_phase3 [ntrgline] = {1, 1, 20, 2, 1, 1, 1, 1, 2, 1, 1, 20, 20, 1, 5, 1, 3, 5}
 prescale factor for phase3
 
const HepGeom::Point3D< double > ORIGIN
 Origin 3D point.
 
static const TRGCDCCircleFitter _fitter = TRGCDCCircleFitter("TRGCDCCircle Default Fitter")
 Default fitter.
 
static const double ConstantAlpha = 222.376063
 Constant alpha for uniform field.
 
static const std::string invalidhelix
 string of invalid helix
 
static CLHEP::HepVector ms_amin
 limits for helix parameters
 
static CLHEP::HepVector ms_amax
 limits for helix parameters
 
static bool ms_check_range
 range in checked or not
 
static bool ms_throw_exception
 throw exception or not
 
static bool ms_print_debug
 print debug info or not
 
static bool ms_smallcell
 ms_smallcell
 
static bool ms_superb
 ms_superb
 
static unsigned _nL = 56
 ...Buffers...
 
static unsigned _nSL = 9
 ...Buffers...
 
static unsigned _nSLA = 5
 ...Buffers...
 
static unsigned * _nHitsSL = 0
 ...Buffers...
 
static std::vector< TRGCDCLink * > _all
 Keeps all TRGCDCLinks created by new().
 
static const double BELLE_ALPHA
 belle alpha
 
static std::map< std::string, TRGCDCLUTdictionary
 list of LUTs, to avoid reading LUT data 2336 times
 
static std::vector< TRGCDCSegmentHit * > _all
 Keeps all TRGCDCSegmentHit created by new().
 
static unsigned _nTSF = 0
 # of TSFs.
 
static std::vector< unsigned > _n
 # of TSFs in super layer i.
 
static TRGState _ts
 Keeps TS hit info.
 
static TRGCDCTrackMC_undefined = new TRGCDCTrackMC()
 returns a pointer to gen_hepevt.
 
static std::vector< const TRGCDCTrackMC * > _list = std::vector<const TRGCDCTrackMC*>()
 vector of pointers to TRGCDCTrackMC
 
static TRGCDC_cdc = 0
 CDC trigger singleton.
 
static std::vector< const TRGCDCTrack * > _list = vector<const TRGCDCTrack*>()
 a vector to keep all TRGCDCTrack objects.
 
static std::vector< TRGCDCWireHit * > _all
 Keeps all TRGCDCWireHit created by new().
 
static TRGGDL_gdl = 0
 GDL singleton.
 
static void(* _ftd )(bool *out, const bool *in)
 Function to simulate final trigger decision.
 
static TRGGRL_grl = 0
 GRL singleton.
 
static std::vector< std::string > _stages
 Storage for stages.
 
static int _level = 0
 Debug level. 0:do nothing, 1:show you flow, 2:show you detail, 10:show you very detail.
 
static const unsigned _su = sizeof(unsigned)
 size of unsigned.
 
static const unsigned _bsu = 8 * sizeof(unsigned)
 bit size of unsigned.
 

Detailed Description

Macro Definition Documentation

◆ MaxNeighbors

#define MaxNeighbors   6

Max number of neighbors.

Definition at line 48 of file Wire.h.

◆ N_LAYERS

#define N_LAYERS   6

number of layers

Definition at line 30 of file HoughPlaneMulti.h.

◆ TFITTER_INLINE_DEFINE_HERE

#define TFITTER_INLINE_DEFINE_HERE

Definition at line 75 of file Fitter.h.

◆ TRGCDCFitAlreadyFitted

#define TRGCDCFitAlreadyFitted   1;

parameter to identify fit result

Definition at line 31 of file Fitter.h.

◆ TRGCDCFitErrorFewHits

#define TRGCDCFitErrorFewHits   -1;

parameter to identify fit result

Definition at line 33 of file Fitter.h.

◆ TRGCDCFitFailed

#define TRGCDCFitFailed   -2;

parameter to identify fit result

Definition at line 35 of file Fitter.h.

◆ TRGCDCFitUnavailable

#define TRGCDCFitUnavailable   -3;

parameter to identify fit result

Definition at line 37 of file Fitter.h.

◆ WireInnerLeft

#define WireInnerLeft   0

type of the wire

Definition at line 36 of file Wire.h.

◆ WireInnerRight

#define WireInnerRight   1

type of the wire

Definition at line 38 of file Wire.h.

◆ WireLeft

#define WireLeft   2

type of the wire

Definition at line 40 of file Wire.h.

◆ WireOuterLeft

#define WireOuterLeft   4

type of the wire

Definition at line 44 of file Wire.h.

◆ WireOuterRight

#define WireOuterRight   5

type of the wire

Definition at line 46 of file Wire.h.

◆ WireRight

#define WireRight   3

type of the wire

Definition at line 42 of file Wire.h.

Typedef Documentation

◆ c2array

typedef boost::multi_array<c2elem, 2> c2array

Definition at line 35 of file NDFinderDefs.h.

◆ c2elem

typedef unsigned short c2elem

TS-Id to 1/32 phi-sector mapping is stored in a 2D array.

Definition at line 34 of file NDFinderDefs.h.

◆ c2index

typedef c2array::index c2index

Definition at line 36 of file NDFinderDefs.h.

◆ c3array

typedef boost::multi_array<c3elem, 3> c3array

Definition at line 30 of file NDFinderDefs.h.

◆ c3elem

typedef unsigned short c3elem

The Hough space is a 3D array (omega, phi, theta)

Definition at line 29 of file NDFinderDefs.h.

◆ c3index

typedef c3array::index c3index

Definition at line 31 of file NDFinderDefs.h.

◆ c5array

typedef boost::multi_array<c5elem, 5> c5array

Definition at line 24 of file NDFinderDefs.h.

◆ c5elem

typedef unsigned short c5elem

Store hit patterns in a 5D array (hitid, prio, omega, phi, theta)

Definition at line 23 of file NDFinderDefs.h.

◆ c5index

typedef c5array::index c5index

Definition at line 25 of file NDFinderDefs.h.

◆ cell_index

typedef std::vector<c3index> cell_index

Definition at line 37 of file NDFinderDefs.h.

◆ Point3D

typedef HepGeom::Point3D< double > Point3D

3D point

Definition at line 32 of file Cell.h.

◆ ushort

typedef unsigned short ushort

Definition at line 38 of file NDFinderDefs.h.

◆ Vector3D

typedef HepGeom::Vector3D< double > Vector3D

3D Vector

Definition at line 34 of file Cell.h.

Function Documentation

◆ a() [1/2]

const CLHEP::HepVector & a ( const CLHEP::HepVector &  newA)
inline

sets helix parameters.

Definition at line 327 of file Helix.h.

328 {
329 if (i.num_row() == 5) {
330 m_a = i;
331 m_helixValid = false;
332 updateCache();
333 }
334 return m_a;
335 }
CLHEP::HepVector m_a
a HepVector parameter
Definition: Helix.h:216
bool m_helixValid
helix validity
Definition: Helix.h:208
void updateCache(void)
update Caches
Definition: Helix.cc:436

◆ a() [2/2]

const CLHEP::HepVector & a ( void  ) const
inline

returns helix parameters.

Definition at line 313 of file Helix.h.

314 {
315 return m_a;
316 }

◆ absolute()

TRGCDCJSignal const absolute ( TRGCDCJSignal const &  first)
static

Absolute TRGCDCJSignal. Removes 1 bit if signed or minus unsigned.

Definition at line 1562 of file JSignal.cc.

1563 {
1564
1565 TRGCDCJSignal result(first);
1566
1567 //if(result.m_type==2) cout<<"[Error] TRGCDCJSignal::absolute() => m_type should not be slv"<<endl;
1568
1569 if (result.m_argumentSignals.size() == 0) result.initArgumentSignals();
1570
1571 if (result.m_type != 1) {
1572 result.m_type = 1;
1573 result.m_int = llabs(first.m_int);
1574 if (first.m_minInt < 0 && first.m_maxInt > 0) result.m_minInt = 0;
1575 else result.m_minInt = min(llabs(first.m_maxInt), llabs(first.m_minInt));
1576 result.m_maxInt = max(llabs(first.m_maxInt), llabs(first.m_minInt));
1577 result.m_actual = fabs(first.m_actual);
1578 if (first.m_minActual < 0 && first.m_maxActual > 0) result.m_minActual = 0;
1579 else result.m_minActual = min(fabs(first.m_maxActual), fabs(first.m_minActual));
1580 result.m_maxActual = max(fabs(first.m_maxActual), fabs(first.m_minActual));
1581 result.m_bitsize = first.m_bitsize - 1;
1582 }
1583
1584 result.checkInt("TRGCDCJSignal::absolute()");
1585
1586 // For vhdl code.
1587 if (first.getPrintVhdl() == 1) vhdlCode("abs", first, result, result.m_vhdlCode);
1588
1589 return result;
1590
1591 }
static void vhdlCode(TRGCDCJSignal const &first, const std::string &operation, TRGCDCJSignal const &second, TRGCDCJSignal const &result, std::string &targtVhdlCode)
Writes vhdl code using two signals.
Definition: JSignal.cc:1781
TRGCDCJSignal()
Constructor.
Definition: JSignal.cc:55

◆ absoluteTime()

double absoluteTime ( int  clockPosition) const

returns absolute time of clock position

Definition at line 128 of file Clock.cc.

129 {
130 return double(t) * _cycle + _offset;
131 }
const double _offset
Clock offset in nano second.
Definition: Clock.h:128
const double _cycle
Clock cycle in nano second.
Definition: Clock.h:134

◆ accumulateFtd()

void accumulateFtd ( TH1I *  h)
private

Accumulate bit info in histogram.

Definition at line 986 of file TRGGDL.cc.

987 {
988 for (std::size_t i = 0; i < _ftdBits.size(); i++) {
989 if (_ftdBits[i]) h->Fill(i);
990 }
991 }

◆ accumulateInp()

void accumulateInp ( TH1I *  h)
private

Accumulate bit info in histogram.

Definition at line 978 of file TRGGDL.cc.

979 {
980 for (std::size_t i = 0; i < _inpBits.size(); i++) {
981 if (_inpBits[i]) h->Fill(i);
982 }
983 }

◆ accumulatePsn()

void accumulatePsn ( TH1I *  h)
private

Accumulate bit info in histogram.

Definition at line 994 of file TRGGDL.cc.

995 {
996 for (std::size_t i = 0; i < _psnBits.size(); i++) {
997 if (_psnBits[i]) h->Fill(i);
998 }
999 }

◆ active() [1/7]

bool active ( int  clk0,
int  clk1 
) const
inline

returns true if there is a signal.

Definition at line 345 of file Signal.h.

346 {
347 for (unsigned i = 0; i < _history.size(); i++) {
348 if (! _history[i].edge()) {
349 const int t0 = _history[i - 1].time();
350 const int t1 = _history[i].time();
351
352 if ((c1 > t0) && (c0 < t1))
353 return true;
354 if ((c1 < t0) && (c1 < t1))
355 return false;
356 }
357 }
358 return false;
359 }
std::vector< TRGTime > _history
Timing history.
Definition: Signal.h:181

◆ active() [2/7]

bool active ( int  clockPosition) const

returns true if there is a signal at clock position.

Definition at line 120 of file SignalVector.cc.

121 {
122 TRGState s = state(c);
123 if (s.active())
124 return true;
125 else
126 return false;
127 }
TRGState state(int clockPosition) const
returns state at given clock position.

◆ active() [3/7]

bool active ( unsigned  bitPosition) const
inline

returns true if there are active bits.

Definition at line 166 of file State.h.

167 {
168 const unsigned wp = a / _bsu;
169 const unsigned bp = a % _bsu;
170 if (_state[wp] & (1 << bp))
171 return true;
172 else
173 return false;
174 }
unsigned * _state
bit state.
Definition: State.h:142
static const unsigned _bsu
bit size of unsigned.
Definition: State.h:133

◆ active() [4/7]

bool active ( void  ) const
inline

returns true if there is a signal.

Definition at line 277 of file Signal.h.

278 {
279 if (_history.size())
280 return true;
281 return false;
282 }

◆ active() [5/7]

bool active ( void  ) const

returns true if there is a signal.

Definition at line 202 of file SignalBundle.cc.

203 {
204 for (unsigned i = 0; i < size(); i++)
205 if ((* this)[i]->active())
206 return true;
207 return false;
208 }

◆ active() [6/7]

bool active ( void  ) const

returns true if there is a signal.

Definition at line 111 of file SignalVector.cc.

112 {
113 for (unsigned i = 0; i < size(); i++)
114 if ((* this)[i].active())
115 return true;
116 return false;
117 }

◆ active() [7/7]

bool active ( void  ) const
inline

returns true if there are active bits.

Definition at line 156 of file State.h.

157 {
158 for (unsigned i = 0; i < _n; i++)
159 if (_state[i])
160 return true;
161 return false;
162 }
unsigned _n
bit storage size.
Definition: State.h:139

◆ add() [1/2]

void add ( unsigned  cellId,
int  weight 
)
inlineoverrideprotectedvirtual

Add to a cell.

Implements TRGCDCHoughPlaneBase.

Definition at line 166 of file HoughPlane.h.

167 {
168 _cell[a] += w;
169 if (_cell[a] < 0)
170 _cell[a] = 0;
171 }
int *const _cell
Counters.
Definition: HoughPlane.h:93

◆ add() [2/2]

void add ( unsigned  cellId,
int  weight 
)
inlineoverrideprotectedvirtual

Add to a cell.

Implements TRGCDCHoughPlaneBase.

Definition at line 211 of file HoughPlaneBoolean.h.

212 {
213 if (b > 0)
214 setEntry(a, 1);
215 else
216 setEntry(a, 0);
217 }
unsigned setEntry(unsigned serialId, unsigned n) override
Sets entry.

◆ add_point()

void add_point ( double  x,
double  y,
double  w = 1 
)

member functions to add point

Definition at line 602 of file Lpav.cc.

604 {
605 m_wsum += wi;
606 m_xsum += wi * xi;
607 m_ysum += wi * yi;
608 m_xxsum += wi * xi * xi;
609 m_yysum += wi * yi * yi;
610 m_xysum += wi * xi * yi;
611//double rri = ( xi * xi + yi * yi );
612//double wrri = wi * rri;
613 double rri = (xi * xi + yi * yi);
614 double wrri = wi * rri;
615 m_xrrsum += wrri * xi;
616 m_yrrsum += wrri * yi;
617 m_rrrrsum += wrri * rri;
618 m_nc += 1;
619 }
double m_xsum
data members
Definition: Lpav.h:137
double m_rrrrsum
data members
Definition: Lpav.h:151
double m_wsum
data members
Definition: Lpav.h:135
double m_nc
data members
Definition: Lpav.h:180
double m_xxsum
data members
Definition: Lpav.h:141
double m_ysum
data members
Definition: Lpav.h:139
double m_xrrsum
data members
Definition: Lpav.h:147
double m_yysum
data members
Definition: Lpav.h:143
double m_xysum
data members
Definition: Lpav.h:145
double m_yrrsum
data members
Definition: Lpav.h:149

◆ add_point_frac()

void add_point_frac ( double  x,
double  y,
double  w,
double  f 
)

member functions to add point

Definition at line 621 of file Lpav.cc.

622 {
623//double wi = w * a;
624 double wi = w * a;
625 m_wsum += wi;
626 m_xsum += wi * xi;
627 m_ysum += wi * yi;
628 m_xxsum += wi * xi * xi;
629 m_yysum += wi * yi * yi;
630 m_xysum += wi * xi * yi;
631//double rri = ( xi * xi + yi * yi );
632//double wrri = wi * rri;
633 double rri = (xi * xi + yi * yi);
634 double wrri = wi * rri;
635 m_xrrsum += wrri * xi;
636 m_yrrsum += wrri * yi;
637 m_rrrrsum += wrri * rri;
638 m_nc += a;
639 }

◆ addID()

void addID ( TRGSignalVector s,
unsigned  id 
)
staticprivate

Add TSF ID to timing signal vector for the output.

Definition at line 1937 of file TrackSegmentFinder.cc.

1938 {
1939 const TRGState sid(8, id);
1940 TRGSignalVector idv("TSFid", s.clock(), 8);
1941
1942 //...Encode ID only when s is active...
1943 vector<int> sc = s.stateChanges();
1944 for (unsigned i = 0; i < sc.size(); i++) {
1945 if (s.active(sc[i]))
1946 idv.set(sid, sc[i]);
1947 }
1948
1949 //...Merge ID vectors...
1950 s += idv;
1951 }

◆ addSignal()

void addSignal ( const TRGSignal newSignal)
inline

set signal |= newSignal

Definition at line 169 of file Wire.h.

170 {
171 _signal |= newSignal;
172 }
TRGSignal _signal
Trigger output.
Definition: Wire.h:132

◆ addSignal_adc()

void addSignal_adc ( const TRGSignal newSignal)
inline

set signal |= newSignal

Definition at line 176 of file Wire.h.

177 {
178 _signal_adc |= newSignal;
179 }
TRGSignal _signal_adc
Trigger output. with adc cut.
Definition: Wire.h:135

◆ addStoreHit()

void addStoreHit ( const CDCTriggerSegmentHit h)
inline

sets a pointer to a CDCTriggerSegmentHit.

Definition at line 244 of file Segment.h.

245 {
246 _storeHits.push_back(h);
247 }
std::vector< const CDCTriggerSegmentHit * > _storeHits
list of DataStore hits.
Definition: Segment.h:185

◆ adjacent()

bool adjacent ( const TRGCDCWire w) const
inline

returns true if a given wire is adjacent.

Definition at line 192 of file Wire.h.

193 {
194 for (unsigned i = 0; i < 7; i++)
195 if (neighbor(i) == & w)
196 return true;
197 return false;
198 }
const TRGCDCWire * neighbor(unsigned) const
returns a pointer to a neighbor wire. This function is expensive.
Definition: Wire.cc:75

◆ append() [1/6]

void append ( bool  a)

appends a bit to a stream.

Definition at line 98 of file BitStream.cc.

99 {
100 if (_sizeMax) {
101 if (_size >= _sizeMax) {
102 cout << "TRGBitStream::append !!! stream is full :current size="
103 << _size << ",max size=" << _sizeMax << endl;
104 return;
105 }
106 }
107
108 const unsigned storageSize = sizeof(unsigned) * 8 * _stream.size();
109 ++_size;
110
111 if (_size <= storageSize) {
112 if (a) {
113 // TODO This block does nothing, is it ok?
114 //const unsigned position = _size % (sizeof(unsigned) * 8) - 1;
115 //unsigned& last = * _stream.back();
116 //last |= (1 << position);
117 }
118 } else {
119 if (a)
120 _stream.push_back(new unsigned(1));
121 else
122 _stream.push_back(new unsigned(0));
123 }
124 }
unsigned _size
Bit stream size.
Definition: BitStream.h:119
unsigned _sizeMax
Bit stream max size.
Definition: BitStream.h:116
std::vector< unsigned * > _stream
Bit stream storage.
Definition: BitStream.h:122

◆ append() [2/6]

void append ( const std::vector< TRGCDCLink * > &  links)

appends links.

Definition at line 115 of file TrackBase.cc.

116 {
117 for (unsigned i = 0; i < links.size(); i++) {
118 append(links[i]);
119 }
120 }
const std::vector< TRGCDCLink * > & links(void) const
returns a vector to track segments.
Definition: TrackBase.cc:123
void append(TRGCDCLink *)
appends a link.
Definition: TrackBase.cc:108

◆ append() [3/6]

void append ( const TRGSignal a)
inline

appends a signal to data.

Definition at line 108 of file OpticalLink.h.

109 {
110 _data.push_back(a);
111 }

◆ append() [4/6]

void append ( int  a)
inline

appends a bit to a stream.

Definition at line 157 of file BitStream.h.

158 {
159 if (a)
160 append(true);
161 else
162 append(false);
163 }
void append(bool)
appends a bit to a stream.
Definition: BitStream.cc:98

◆ append() [5/6]

void append ( TRGCDCLink a)

appends a link.

Definition at line 108 of file TrackBase.cc.

109 {
110 _ts[a->cell()->superLayerId()].push_back(a);
111 _tsAll.push_back(a);
112 }
std::vector< TRGCDCLink * > _tsAll
Links for all super layers.
Definition: TrackBase.h:160
std::vector< TRGCDCLink * > * _ts
Links for each super layer.
Definition: TrackBase.h:157

◆ append() [6/6]

void append ( unsigned  a)
inline

appends a bit to a stream.

Definition at line 167 of file BitStream.h.

168 {
169 if (a)
170 append(true);
171 else
172 append(false);
173 }

◆ appendHeader()

void appendHeader ( const TRGSignal a)
inline

appends a signal to header data.

Definition at line 94 of file OpticalLink.h.

95 {
96 _head.push_back(a);
97 }

◆ appendInput()

void appendInput ( const TRGChannel a)
inline

appends an input Aurora channel.

Definition at line 144 of file Board.h.

145 {
146 _inputChannels.push_back(a);
147 }
std::vector< const TRGChannel * > _inputChannels
Input Aurora channel.
Definition: Board.h:99

◆ appendOutput()

void appendOutput ( TRGChannel a)
inline

appends an output Aurora channel.

Definition at line 151 of file Board.h.

152 {
153 _outputChannels.push_back(a);
154 }
std::vector< TRGChannel * > _outputChannels
Output Aurora channel.
Definition: Board.h:102

◆ appendTrailer()

void appendTrailer ( const TRGSignal a)
inline

appends a signal to trailer data.

Definition at line 101 of file OpticalLink.h.

102 {
103 _trail.push_back(a);
104 }

◆ approach()

int approach ( TRGCDCLink link,
bool  sagCorrection = false 
) const

calculates the closest approach to a wire in real space. Results are stored in TLink. Return value is negative if error happened.

Definition at line 94 of file TRGCDCTrack.cc.

95 {
96
97 //...Cal. dPhi to rotate...
98 const Belle2::TRGCDCWire& w = * link.wire();
99 double wp[3]; w.xyPosition(wp);
100 double wb[3]; w.backwardPosition(wb);
101 double v[3];
102 v[0] = w.direction().x();
103 v[1] = w.direction().y();
104 v[2] = w.direction().z();
105
106 //...Sag correction...
107 if (doSagCorrection) {
108 std::cout << "TTrack::approach !!! sag correction is not implemented"
109 << std::endl;
110// Vector3D dir = w.direction();
111// Point3D xw(wp[0], wp[1], wp[2]);
112// Point3D wireBackwardPosition(wb[0], wb[1], wb[2]);
113// w.wirePosition(link.positionOnTrack().z(),
114// xw,
115// wireBackwardPosition,
116// dir);
117// v[0] = dir.x();
118// v[1] = dir.y();
119// v[2] = dir.z();
120// wp[0] = xw.x();
121// wp[1] = xw.y();
122// wp[2] = xw.z();
123// wb[0] = wireBackwardPosition.x();
124// wb[1] = wireBackwardPosition.y();
125// wb[2] = wireBackwardPosition.z();
126 }
127
128 //...Cal. dPhi to rotate...
129 double dPhi;
130 const HepGeom::Point3D<double>& xc = helix().center();
131 double xt[3]; _helix.x(0., xt);
132 double x0 = - xc.x();
133 double y0 = - xc.y();
134 double x1 = wp[0] + x0;
135 double y1 = wp[1] + y0;
136 x0 += xt[0];
137 y0 += xt[1];
138 dPhi = atan2(x0 * y1 - y0 * x1, x0 * x1 + y0 * y1);
139
140 //...Setup...
141 double kappa = _helix.kappa();
142 double phi0 = _helix.phi0();
143
144 //...Axial case...
145 if (w.axial()) {
146 link.positionOnTrack(_helix.x(dPhi));
147 Point3D x(wp[0], wp[1], wp[2]);
148 x.setZ(link.positionOnTrack().z());
149 link.positionOnWire(x);
150 link.dPhi(dPhi);
151 return 0;
152 }
153
154#ifdef TRASAN_DEBUG
155 double firstdfdphi = 0.;
156 static bool first = true;
157 if (first) {
158//cnv extern BelleTupleManager * BASF_Histogram;
159// BelleTupleManager * m = BASF_Histogram;
160// h_nTrial = m->histogram("TTrack::approach nTrial", 100, 0., 100.);
161 }
162#endif
163
164 //...Stereo case...
165 double rho = TCHelix::ConstantAlpha / kappa;
166 double tanLambda = _helix.tanl();
167 static CLHEP::HepVector x(3);
168 double t_x[3];
169 double t_dXdPhi[3];
170 const double convergence = 1.0e-5;
171 double l;
172 unsigned nTrial = 0;
173 while (nTrial < 100) {
174
175 x = link.positionOnTrack(_helix.x(dPhi));
176 t_x[0] = x[0];
177 t_x[1] = x[1];
178 t_x[2] = x[2];
179
180 l = v[0] * t_x[0] + v[1] * t_x[1] + v[2] * t_x[2]
181 - v[0] * wb[0] - v[1] * wb[1] - v[2] * wb[2];
182
183 double rcosPhi = rho * cos(phi0 + dPhi);
184 double rsinPhi = rho * sin(phi0 + dPhi);
185 t_dXdPhi[0] = rsinPhi;
186 t_dXdPhi[1] = - rcosPhi;
187 t_dXdPhi[2] = - rho * tanLambda;
188
189 //...f = d(Distance) / d phi...
190 double t_d2Xd2Phi[2];
191 t_d2Xd2Phi[0] = rcosPhi;
192 t_d2Xd2Phi[1] = rsinPhi;
193
194 //...iw new...
195 double n[3];
196 n[0] = t_x[0] - wb[0];
197 n[1] = t_x[1] - wb[1];
198 n[2] = t_x[2] - wb[2];
199
200 double a[3];
201 a[0] = n[0] - l * v[0];
202 a[1] = n[1] - l * v[1];
203 a[2] = n[2] - l * v[2];
204 double dfdphi = a[0] * t_dXdPhi[0]
205 + a[1] * t_dXdPhi[1]
206 + a[2] * t_dXdPhi[2];
207
208#ifdef TRASAN_DEBUG
209 if (nTrial == 0) {
210// break;
211 firstdfdphi = dfdphi;
212 }
213
214 //...Check bad case...
215 if (nTrial > 3) {
216 std::cout << Tab() << "TTrack::approach:" << w.name() << " "
217 << "dfdphi(0)=" << firstdfdphi
218 << ",(" << nTrial << ")=" << dfdphi << std::endl;
219 }
220#endif
221
222 //...Is it converged?...
223 if (fabs(dfdphi) < convergence)
224 break;
225
226 double dv = v[0] * t_dXdPhi[0]
227 + v[1] * t_dXdPhi[1]
228 + v[2] * t_dXdPhi[2];
229 double t0 = t_dXdPhi[0] * t_dXdPhi[0]
230 + t_dXdPhi[1] * t_dXdPhi[1]
231 + t_dXdPhi[2] * t_dXdPhi[2];
232 double d2fd2phi = t0 - dv * dv
233 + a[0] * t_d2Xd2Phi[0]
234 + a[1] * t_d2Xd2Phi[1];
235// + a[2] * t_d2Xd2Phi[2];
236
237 dPhi -= dfdphi / d2fd2phi;
238
239// std::cout<< "nTrial=" << nTrial << std::endl;
240// std::cout<< "iw f,df,dphi=" << dfdphi << "," << d2fd2phi << "," << dPhi << std::endl;
241
242 ++nTrial;
243 }
244
245 //...Cal. positions...
246 link.positionOnWire(Point3D(wb[0] + l * v[0],
247 wb[1] + l * v[1],
248 wb[2] + l * v[2]));
249 link.dPhi(dPhi);
250
251#ifdef TRASAN_DEBUG
252//cnv h_nTrial->accumulate((float) nTrial + .5);
253#endif
254
255 return nTrial;
256 }
TRGCDCHelix _helix
Helix parameter.
Definition: TRGCDCTrack.h:110
A class to represent a wire in CDC.
Definition: Wire.h:56
const TRGCDCHelix & helix(void) const
returns helix parameter.
Definition: TRGCDCTrack.h:143
HepGeom::Point3D< double > x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
Definition: Helix.cc:135
HepGeom::Point3D< double > Point3D
3D point
Definition: Cell.h:32
const HepGeom::Point3D< double > & center(void) const
returns position of helix center(z = 0.);
Definition: Helix.h:243
double tanl(void) const
returns tanl.
Definition: Helix.h:299
double phi0(void) const
returns phi0.
Definition: Helix.h:278
virtual const CLHEP::Hep3Vector & x(void) const override
returns position vector.
Definition: TRGCDCTrack.h:173
double kappa(void) const
returns kappa.
Definition: Helix.h:285

◆ approach2D() [1/2]

int approach2D ( TRGCDCLink ) const
virtual

calculate closest approach. Error was happened if return value is not zero.

Reimplemented in TRGCDCCircle.

Definition at line 135 of file TrackBase.cc.

136 {
137 cout << "TRGCDCTrackBase::approach2D !!! not implemented" << endl;
138 return -1;
139 }

◆ approach2D() [2/2]

int approach2D ( TRGCDCLink ) const
overridevirtual

calculate closest approach. Error was happened if return value is not zero.

Reimplemented from TRGCDCTrackBase.

Definition at line 73 of file Circle.cc.

74 {
75 HepGeom::Point3D<double> xw = l.cell()->xyPosition();
77
78 xw.setZ(0.);
80 = _charge * _radius * (xw - xc).unit() + xc;
81 l.positionOnTrack(xv);
82 l.positionOnWire(xw);
83 l.dPhi(0.);
84 return 0;
85 }
TRGPoint2D _center
Position of the circle center.
Definition: Circle.h:81
double _radius
Radius multiplied by charge.
Definition: Circle.h:84
double _charge
Charge.
Definition: TrackBase.h:148
double y(void) const
y of the point
Definition: Point2D.h:99
double x(void) const
x of the point
Definition: Point2D.h:92

◆ arcfun()

double arcfun ( double  xh,
double  yh 
) const
inlineprivate

private const member functions

Definition at line 278 of file Lpar.h.

279 {
280 //
281 // Duet way of calculating Sperp.
282 //
283 double r2kap = 2.0 * m_kappa;
284 double xi = std::sqrt(xi2());
285 double xinv = 1.0 / xi;
286 double ar2kap = std::fabs(r2kap);
287 double cross = m_alpha * yh - m_beta * xh;
288 double a1 = ar2kap * cross * xinv;
289 double a2 = r2kap * (m_alpha * xh + m_beta * yh) * xinv + xi;
290 if (a1 >= 0 && a2 > 0 && a1 < 0.3) {
291 double arg2 = a1 * a1;
292 return cross * (1.0 + arg2 * (1. / 6. + arg2 * (3. / 40.))) * xinv;
293 } else {
294 double at2 = std::atan2(a1, a2);
295 if (at2 < 0) at2 += (2 * M_PI);
296 return at2 / ar2kap;
297 }
298 }
double m_beta
data members
Definition: Lpar.h:176
double m_kappa
data members
Definition: Lpar.h:180
double m_alpha
data members
Definition: Lpar.h:174
double xi2() const
private const member functions
Definition: Lpar.h:159

◆ assignTo() [1/2]

TRGCDCJSignal & assignTo ( TRGCDCJSignal const &  rhs,
int  targetClock 
)

Assign operator with setting target clock.

Definition at line 266 of file JSignal.cc.

267 {
268 string finalCode = "printAssignVhdlCode";
269 return assignTo(rhs, targetClock, finalCode);
270 }
TRGCDCJSignal & assignTo(TRGCDCJSignal const &rhs, int targetClock, std::string &finalCode)
Assign operator with setting target clock with outputing final code.
Definition: JSignal.cc:172

◆ assignTo() [2/2]

TRGCDCJSignal & assignTo ( TRGCDCJSignal const &  rhs,
int  targetClock,
std::string &  finalCode 
)

Assign operator with setting target clock with outputing final code.

Definition at line 172 of file JSignal.cc.

173 {
174
175 TRGCDCJSignal t_rhs(rhs);
176 // Calculate result final clock.
177 int t_calFinishClock = t_rhs.calFinishClock();
178 // If t_rhs finish clock is blank or constant, skip.
179 if (!(t_calFinishClock == -2 || t_calFinishClock == -1)) {
180 // If target clock is not set, add 1 to t_rhs finish clock.
181 if (targetClock == -3) t_rhs.m_finishClock = t_calFinishClock + 1;
182 else {
183 if (targetClock < t_calFinishClock) cout << "[Error] TRGCDCJSignal::assign() => targetClock is too small." << endl;
184 else t_rhs.m_finishClock = targetClock;
185 }
186 }
187 //if(m_name!="") cout<<"Signal name: "<<m_name<<" Clock: "<<t_rhs.m_finishClock<<endl;
188
190 if ((*this).m_bitsize != -1 || (*this).m_name != "")
191 //if((*this).m_bitsize != -1)
192 {
193
194 if ((*this).m_bitsize == 1) {
195 // Check if rhs and lhs bitsize is the same.
196 if ((*this).m_bitsize != t_rhs.m_bitsize) {
197 cout << "[Warning] TRGCDCJSignal::operator<=() => rhs and lhs do not have same bitsize." << endl;
198 }
199 // Check if rhs and lhs is same type.
200 if ((*this).m_type != t_rhs.m_type) {
201 cout << "[Warning] TRGCDCJSignal::operator<=() => rhs and lhs do not have same type." << endl;
202 }
203 // Check if rhs and lhs clock is the same.
204 if (m_finishClock != t_rhs.m_finishClock) {
205 cout << "[Warning] TRGCDCJSignal::operator<=() => rhs and lhs do not have same clock." << endl;
206 cout << m_name << " lhs clock: " << m_finishClock << " rhs clock: " << t_rhs.m_finishClock << endl;
207 }
208 }
209
210 //int t_type;
211 //if(t_rhs.m_minInt<0) t_type = -1;
212 //else t_type = 1;
213 //int t_bitsize = ceil(log(max(t_rhs.m_maxInt, abs(t_rhs.m_minInt))+1)/log(2));
214 //if(t_type != 1) t_bitsize++;
216 //if(t_rhs.m_bitsize != t_bitsize){
217 // cout<<"Bitsize and calcualted bitwidth don't match"<<endl;
218 // cout<<"Bitsize: "<<t_rhs.m_bitsize<<" calBitsize: "<<t_bitsize<<endl;
219 // cout<<"LHS"<<endl;
220 // dump();
221 // cout<<"RHS"<<endl;
222 // t_rhs.dump();
223 // cout<<"Bitsize and calcualted bitwidth don't match"<<endl;
224 //}
226 //if(t_rhs.m_type != t_type){
227 // cout<<"Type and calcualted type don't match"<<endl;
228 // cout<<"Type: "<<t_rhs.m_type<<" calType: "<<t_type<<endl;
229 // cout<<"LHS"<<endl;
230 // dump();
231 // cout<<"RHS"<<endl;
232 // t_rhs.dump();
233 // cout<<"Type and calcualted type don't match"<<endl;
234 //}
235
236 // Set arguments if needed.
237 if (t_rhs.m_argumentSignals.size() == 0) t_rhs.initArgumentSignals();
238
239 // Print m_vhdlCode.
240 string t_finalCode(finalCode);
241
242 if (getPrintVhdl() == 1) {
243 finalCode = assignVhdlCode(*this, t_rhs);
244 if (t_finalCode == "printAssignVhdlCode") {
245 //printVhdl(finalCode);
246 m_commonData->m_vhdlInProcess += finalCode + "\n";
247 }
248 }
249
250 } // End of not blank constructor.
251
252 swap(*this, t_rhs);
253 // Operations due to swap.
254 // Keep original name
255 m_name = t_rhs.m_name;
256 // Clear code.
257 m_vhdlCode = "";
258 m_argumentSignals.clear();
259
260 // Don't propagate debug
261 m_debug = 0;
262
263 return *this;
264 }
std::string m_vhdlInProcess
Holds VHDL process code.
Definition: JSignalData.h:85
std::vector< std::pair< std::string, std::vector< int > > > m_argumentSignals
vector<int> is {type, bitwidth, clock} Holds the arguments that made the signal.
Definition: JSignal.h:303
int m_finishClock
Holds the clock tick when the signal is valid.
Definition: JSignal.h:305
bool m_debug
The debug flag.
Definition: JSignal.h:298
TRGCDCJSignalData * m_commonData
The common JSignalData.
Definition: JSignal.h:308
std::string m_name
Memebers.
Definition: JSignal.h:276
std::string m_vhdlCode
Holds the vhdl code.
Definition: JSignal.h:300
bool getPrintVhdl() const
Gets the print vhdl flag from common JSignalData class.
Definition: JSignal.cc:1497
static std::string assignVhdlCode(TRGCDCJSignal const &target, TRGCDCJSignal const &from)
Writes the assign vhdl code.
Definition: JSignal.cc:1948
void swap(TRGCDCJSignal &first, TRGCDCJSignal &second) const
Swaps the TRGCDCJSignals.
Definition: JSignal.cc:1241

◆ assignVhdlCode()

std::string assignVhdlCode ( TRGCDCJSignal const &  target,
TRGCDCJSignal const &  from 
)
static

Writes the assign vhdl code.

Definition at line 1948 of file JSignal.cc.

1949 {
1950
1951 // Check if target has m_commonData.
1952 if (target.m_commonData == 0) {
1953 cout << "[Error] TRGCDCJSignal::assignVhdlCode() => target.m_commonData is not set." << endl;
1954 return "";
1955 }
1956
1957 TRGCDCJSignal t_from(from);
1958
1959 // Set m_vhdlCode if needed.
1960 if (t_from.m_vhdlCode == "") {
1961 t_from.initVhdlCode();
1962 }
1963
1964 // Fill signal map for definition.
1965 {
1966 if (target.m_name == "") cout << "[Error] TRGCDCJSignal::assignVhdlCode() => target.m_name is \"\" " << endl;
1967 map<string, vector<int> >& t_signals = target.m_commonData->m_signals;
1968 if (t_signals.find(target.m_name) == t_signals.end()) {
1969 //t_signals[target.m_name] = {target.m_type, target.m_bitsize};
1970 // From and target should be same.
1971 // cppcheck-suppress stlFindInsert
1972 t_signals[target.m_name] = {from.m_type, from.m_bitsize};
1973 }
1974 }
1975
1976 // Replace names with spaces in from.m_vhdlCode
1977 string t_vhdlCode = replaceWithSignalNames(t_from.m_vhdlCode, t_from.m_argumentSignals, t_from.m_finishClock,
1978 t_from.m_commonData->m_buffers);
1979
1980 return target.m_name + "<=" + t_vhdlCode + ";";
1982 //if(t_vhdlCode != "") {
1983 // return target.m_name + "<=" + t_vhdlCode + ";";
1985 //} else if (from.m_minInt == from.m_maxInt) {
1986 // if(from.m_type == 1) {
1987 // return target.m_name + "<=to_unsigned(" + to_string(from.m_int) + "," + to_string(from.m_bitsize) + ")";
1988 // } else {
1989 // return target.m_name + "<=to_signed(" + to_string(from.m_int) + "," + to_string(from.m_bitsize) + ")";
1990 // }
1992 //} else if (from.m_name=="") {
1993 // if(from.m_type == 1) {
1994 // return target.m_name + "<=to_unsigned(" + to_string(from.m_int) + "," + to_string(from.m_bitsize) + ")";
1995 // } else {
1996 // return target.m_name + "<=to_signed(" + to_string(from.m_int) + "," + to_string(from.m_bitsize) + ")";
1997 // }
1998 //} else {
2000 // return target.m_name + "<=" + from.m_name + ";";
2001 //}
2002 }
static std::string replaceWithSignalNames(std::string const &fromVhdlCode, std::vector< std::pair< std::string, std::vector< int > > > const &fromVhdlSignals, int const &finishClock, std::map< std::string, std::vector< int > > &buffers)
Writes final vhdl code.
Definition: JSignal.cc:1899

◆ axial() [1/2]

bool axial ( void  ) const
inline

returns true if this wire is in an axial layer.

Definition at line 256 of file Cell.h.

257 {
258 return _layer.axial();
259 }
const TRGCDCLayer & _layer
Layer.
Definition: Cell.h:172
bool axial(void) const
returns true if this is an axial layer.
Definition: Layer.h:201

◆ axial() [2/2]

bool axial ( void  ) const
inline

returns true if this is an axial layer.

Definition at line 201 of file Layer.h.

202 {
203 if (! _nShifts) return true;
204 return false;
205 }
const int _nShifts
Stereo angle in cell unit.
Definition: Layer.h:137

◆ axialHits() [1/2]

vector< TRGCDCLink * > axialHits ( const std::vector< TRGCDCLink * > &  links)
static

returns axial hits.

Definition at line 385 of file Link.cc.

386 {
387 vector<TRGCDCLink*> a;
388 unsigned n = links.size();
389 for (unsigned i = 0; i < n; i++) {
390 if (links[i]->cell()->axial())
391 a.push_back(links[i]);
392 }
393 return a;
394 }
const TRGCDCCell * cell(void) const
returns a pointer to a cell.
Definition: Link.h:684

◆ axialHits() [2/2]

vector< const TCWHit * > axialHits ( void  ) const

returns a list of axial hits.

'update()' must be called before calling this function.

Definition at line 1679 of file TRGCDC.cc.

1680 {
1681 vector<const TCWHit*> t;
1682 t.assign(_axialHits.begin(), _axialHits.end());
1683 return t;
1684
1685 // if (! mask) return _axialHits;
1686 // else if (mask == CellHitFindingValid) return _axialHits;
1687 // cout << "TRGCDC::axialHits !!! unsupported mask given" << endl;
1688 // return _axialHits;
1689 }
std::vector< TRGCDCWireHit * > _axialHits
CDC hits on axial wires.
Definition: TRGCDC.h:635

◆ axialSegment()

const TRGCDCSegment & axialSegment ( unsigned  lyrId,
unsigned  id 
) const
inline

returns a track segment in axial layers. (lyrId is axial #)

Definition at line 940 of file TRGCDC.h.

941 {
942 return * _tsSL[a * 2][b];
943 }
std::vector< TRGCDCSegment * > _tsSL[9]
Track Segments.
Definition: TRGCDC.h:650

◆ axialSegmentHits()

std::vector< const TRGCDCSegmentHit * > axialSegmentHits ( unsigned  a) const
inline

returns a list of TRGCDCSegmentHit in a axial super layer N.

'simulate()' must be called before calling this function

Definition at line 1014 of file TRGCDC.h.

1015 {
1016 std::vector<const TRGCDCSegmentHit*> t;
1017 t.assign(_segmentHitsSL[a * 2].begin(), _segmentHitsSL[a * 2].end());
1018 return t;
1019 }
std::vector< TRGCDCSegmentHit * > _segmentHitsSL[9]
Track Segments with hits in each super layer.
Definition: TRGCDC.h:659

◆ axialStereoLayerId() [1/2]

unsigned axialStereoLayerId ( void  ) const
inline

returns id of axial or stereo layer id.

Definition at line 270 of file Cell.h.

271 {
272 return _layer.axialStereoLayerId();
273 }
unsigned axialStereoLayerId(void) const
returns id of axial or stereo id.
Definition: Layer.h:217

◆ axialStereoLayerId() [2/2]

unsigned axialStereoLayerId ( void  ) const
inline

returns id of axial or stereo id.

Definition at line 217 of file Layer.h.

218 {
219 return _axialStereoLayerId;
220 }
const unsigned _axialStereoLayerId
ID in whole CDC counting only axial or stereo.
Definition: Layer.h:128

◆ axialStereoSuperLayerId() [1/3]

unsigned axialStereoSuperLayerId ( unsigned  axialStereo,
unsigned  axialStereoLayerId 
) const

returns axialStereo super layer ID. This function is expensive.

Definition at line 1865 of file TRGCDC.cc.

1866 {
1867 unsigned is = 99;
1868 // cout << "aors,i= " << aors <<" "<< i << std::endl;
1869 if (aors == 0) { //axial
1870 if (i <= 7) {
1871 is = 0;
1872 } else if (i <= 13) {
1873 is = 1;
1874 } else if (i <= 19) {
1875 is = 2;
1876 } else if (i <= 25) {
1877 is = 3;
1878 } else if (i <= 31) {
1879 is = 4;
1880 }
1881 } else if (aors == 1) { //stereo
1882 if (i <= 5) {
1883 is = 0;
1884 } else if (i <= 11) {
1885 is = 1;
1886 } else if (i <= 17) {
1887 is = 2;
1888 } else if (i <= 23) {
1889 is = 3;
1890 }
1891 }
1892
1893 assert(is != 99);
1894 return is;
1895 }

◆ axialStereoSuperLayerId() [2/3]

unsigned axialStereoSuperLayerId ( void  ) const
inline

returns id of axial or stereo super layer id.

Definition at line 277 of file Cell.h.

278 {
280 }
unsigned axialStereoSuperLayerId(void) const
returns id of axial or stereo super layer id.
Definition: Layer.h:224

◆ axialStereoSuperLayerId() [3/3]

unsigned axialStereoSuperLayerId ( void  ) const
inline

returns id of axial or stereo super layer id.

Definition at line 224 of file Layer.h.

225 {
227 }
const unsigned _axialStereoSuperLayerId
Super layer ID counting only axial or stereo.
Definition: Layer.h:131

◆ backwardPosition() [1/2]

double * backwardPosition ( double  p[3]) const
inline

position in backward endplate.

Definition at line 331 of file Cell.h.

332 {
333 p[0] = _backwardPosition.x();
334 p[1] = _backwardPosition.y();
335 p[2] = _backwardPosition.z();
336 return p;
337 }
const HepGeom::Point3D< double > _backwardPosition
Wire backward position.
Definition: Cell.h:181

◆ backwardPosition() [2/2]

const HepGeom::Point3D< double > & backwardPosition ( void  ) const
inline

returns position in backward endplate.

Definition at line 324 of file Cell.h.

325 {
326 return _backwardPosition;
327 }

◆ bFieldZ() [1/2]

double bFieldZ ( double  a)
inline

sets and returns z componet of the magnetic field.

Definition at line 346 of file Helix.h.

347 {
348 m_bField = a;
349 m_alpha = 10000. / 2.99792458 / m_bField;
350 updateCache();
351 return m_bField;
352 }
double m_alpha
alpha parameter
Definition: Helix.h:212
double m_bField
magnetic field
Definition: Helix.h:210
const CLHEP::HepVector & a(void) const
returns helix parameters.
Definition: Helix.h:313

◆ bFieldZ() [2/2]

double bFieldZ ( void  ) const
inline

returns z componet of the magnetic field.

Definition at line 356 of file Helix.h.

357 {
358 return m_bField;
359 }

◆ bit()

bool bit ( unsigned  positionInBit) const
inline

returns true if given position is active.

Definition at line 197 of file BitStream.h.

198 {
199 unsigned p = a / (sizeof(unsigned) * 8);
200 unsigned q = a % (sizeof(unsigned) * 8);
201 unsigned v = * _stream[p];
202 return (v & (1 << q));
203 }

◆ bitDisplay() [1/2]

void bitDisplay ( unsigned  val,
unsigned  firstDigit,
unsigned  lastDigit 
)
static

Dumps bit contents to cout.

Definition at line 115 of file Utilities.cc.

116 {
117 unsigned i;
118 for (i = 0; i < f - l; i++) {
119 if ((i % 8) == 0) cout << " ";
120 cout << (val >> (f - i)) % 2;
121 }
122 }

◆ bitDisplay() [2/2]

void bitDisplay ( unsigned  val)
static

Dumps bit contents to cout.

Definition at line 109 of file Utilities.cc.

110 {
111 bitDisplay(val, 31, 0);
112 }
static void bitDisplay(unsigned)
Dumps bit contents to cout.
Definition: Utilities.cc:109

◆ buffersVhdlCode()

void buffersVhdlCode ( )

Function to print buffer VHDL code.

Definition at line 150 of file JSignalData.cc.

151 {
152 // Define.
153 for (map<string, vector<int> >::const_iterator it = m_buffers.begin(); it != m_buffers.end(); ++it) {
154 string const& name = it->first;
155 int const& type = it->second[0];
156 int const& bitwidth = it->second[1];
157 int const& buffer = it->second[2];
158 string arrayName = (type == 1 ? "U" : "S") + to_string(bitwidth) + "D" + to_string(buffer + 1) + "Array";
159 if (m_arrayType.find(arrayName) == m_arrayType.end()) {
160 m_vhdlDefine += "type " + arrayName + " is array(" + to_string(buffer) + " downto 0) of " + (type == 1 ? "unsigned" : "signed") +
161 "(" + to_string(bitwidth - 1) + " downto 0);\n";
162 m_arrayType[arrayName] = 1;
163 }
164 m_vhdlDefine += "signal " + name + "_b : " + arrayName + " := (others=>(others=>'0'));\n";
165 }
166 // Process.
167 for (map<string, vector<int> >::const_iterator it = m_buffers.begin(); it != m_buffers.end(); ++it) {
168 string const& name = it->first;
169 int const& buffer = it->second[2];
170 m_vhdlInProcess += name + "_b(" + to_string(0) + ") <= " + name + ";\n";
171 for (int iBuffer = 0; iBuffer < buffer; iBuffer++) {
172 m_vhdlInProcess += name + "_b(" + to_string(iBuffer + 1) + ") <= " + name + "_b(" + to_string(iBuffer) + ");\n";
173 }
174 }
175
176 }
std::map< std::string, bool > m_arrayType
Holds all the required VHDL types.
Definition: JSignalData.h:98
std::map< std::string, std::vector< int > > m_buffers
vector<int> is {type, bitwidth, buffer} Holds all the requried VHDL buffers.
Definition: JSignalData.h:94
std::string m_vhdlDefine
Holds VHDL define code.
Definition: JSignalData.h:83

◆ c()

char c ( unsigned  positionInChar) const
inline

returns a pointer to char's.

Definition at line 187 of file BitStream.h.

188 {
189 unsigned p = a / sizeof(unsigned);
190 unsigned q = a % sizeof(unsigned);
191 unsigned v = * _stream[p];
192 return (v >> (q * 8)) & 0xff;
193 }

◆ calBitwidth() [1/2]

int calBitwidth ( ) const

Calculates the bit width.

Definition at line 1461 of file JSignal.cc.

1462 {
1463 //int t_bitwidth = ceil(log(max(m_maxInt, llabs(m_minInt))+1)/log(2));
1464 int t_bitwidth = ceil(log1p(max(m_maxInt, llabs(m_minInt))) / log(2));
1465 if (calType() != 1) t_bitwidth++;
1466 return t_bitwidth;
1467 }
signed long long m_minInt
The minimum integer value.
Definition: JSignal.h:286
signed long long m_maxInt
The maximum integer value.
Definition: JSignal.h:288
int calType() const
Calculated what type the signal is.
Definition: JSignal.cc:1447

◆ calBitwidth() [2/2]

int calBitwidth ( int  type,
signed long long  minInt,
signed long long  maxInt 
)

Calculates the bit width using the arguments.

Definition at line 1469 of file JSignal.cc.

1470 {
1471 //int t_bitwidth = ceil(log(max(maxInt, llabs(minInt))+1)/log(2));
1472 int t_bitwidth = ceil(log1p(max(maxInt, llabs(minInt))) / log(2));
1473 if (type != 1) t_bitwidth++;
1474 return t_bitwidth;
1475 }

◆ calCosPhi()

void calCosPhi ( std::map< std::string, Belle2::TRGCDCJSignal > &  mSignalStorage,
std::map< std::string, Belle2::TRGCDCJLUT * > &  mLutStorage 
)
staticprivate

Calculate Cos Sin ?

Calculate phi

Definition at line 412 of file HoughFinder.cc.

414 {
415
417 Belle2::TRGCDCJSignalData* commonData = mSignalStorage.begin()->second.getCommonData();
418 {
419 mSignalStorage["invPhiAxMin"] = Belle2::TRGCDCJSignal(M_PI, mSignalStorage["phi_4"].getToReal(), commonData);
420 mSignalStorage["invPhiAxMax"] = Belle2::TRGCDCJSignal(2 * M_PI, mSignalStorage["phi_4"].getToReal(), commonData);
421 }
422
423 for (unsigned iSt = 0; iSt < 5; iSt++) {
424 string t_inputName = "phi_" + to_string(iSt);
425 string t_outputName = "cosPhi_" + to_string(iSt);
426
427 if (!mLutStorage.count(t_outputName)) {
428 mLutStorage[t_outputName] = new Belle2::TRGCDCJLUT(t_outputName);
429 mLutStorage[t_outputName]->setFloatFunction(
430 [ = ](double aValue) -> double{return cos(aValue);},
431 mSignalStorage[t_inputName],
432 mSignalStorage["invPhiAxMin"], mSignalStorage["invPhiAxMax"], mSignalStorage[t_inputName].getToReal(),
433 12, 12);
434 };//if name
435
436 mLutStorage[t_outputName]->operate(mSignalStorage[t_inputName], mSignalStorage[t_outputName]);
437 } // end for
438 }//calCosPhi
A class to use LUTs for TRGCDC.
Definition: JLUT.h:35
A class to hold common data for JSignals.
Definition: JSignalData.h:33
A class to use Signals for TRGCDC 3D tracker.
Definition: JSignal.h:35

◆ calculate()

void calculate ( void  )
private

a function to execute calculation of matching

Definition at line 38 of file TRGGRLMatch.cc.

39 {
40
41 //-- track/TRGCDC information
42 const TRGCDCHelix& helix = _track->helix();
43 _pt = _track->pt();
44 _center_x = helix.center().x();
45 _center_y = helix.center().y();
46 _center_z = helix.center().z();
47 _r = sqrt(_center_x * _center_x + _center_y * _center_y); //helix.radius();
48 _phi = atan2(_center_y, _center_x) ;
49
50 //-- cluster/TRGECL information
57 _re_scaled_p = _pt * _D / _R;
58
59 //-- calculation
60 double theta0 = acos(_R / (2 * _r)) + _phi;
61 double theta1 = 2 * _phi - theta0;
62
63 double ex_x0 = _R * cos(theta0), ex_y0 = _R * sin(theta0), ex_x1 = _R * cos(theta1), ex_y1 = _R * sin(theta1);
64 double dr0 = sqrt((ex_x0 - _cluster_x) * (ex_x0 - _cluster_x) + (ex_y0 - _cluster_y) * (ex_y0 - _cluster_y));
65 double dr1 = sqrt((ex_x1 - _cluster_x) * (ex_x1 - _cluster_x) + (ex_y1 - _cluster_y) * (ex_y1 - _cluster_y));
66
67 _dr = (dr0 < dr1) ? dr0 : dr1;
68 _ex_x = (dr0 < dr1) ? ex_x0 : ex_x1;
69 _ex_y = (dr0 < dr1) ? ex_y0 : ex_y1;
70
71 //z information
72 if (_match3D == 1) {
73 _z0 = helix.dz();
74 _slope = helix.tanl();
75 _ex_z = _z0 + _slope * 2 * _r * asin(_R / (2 * _r));
76 _pz = _pt * _slope;
77 _p = sqrt(_pz * _pz + _pt * _pt);
79 _poe = _p / _cluster_e;
80
81 }
82
83 }
double getPositionZ() const
Get Energy weighted position Z.
double getEnergyDep() const
The method to get deposited energy.
double getPositionX() const
The method to get hit average time Get Energy weighted position X.
double getPositionY() const
Get Energy weighted position Y.
double _phi
phi of the track center
Definition: TRGGRLMatch.h:110
int _match3D
flag tells 3D information is valid or not
Definition: TRGGRLMatch.h:99
double _cluster_y
y position of cluster
Definition: TRGGRLMatch.h:125
double _center_y
center (y) of track helix
Definition: TRGGRLMatch.h:104
double _cluster_z
z position of cluster
Definition: TRGGRLMatch.h:127
TRGECLCluster * _cluster
a pointer to the TRGECLCluster of the matching candidate
Definition: TRGGRLMatch.h:96
double _slope
z slope (polar angle) of track
Definition: TRGGRLMatch.h:120
double _cluster_e
deposit energy of cluster
Definition: TRGGRLMatch.h:129
double _cluster_x
x position of cluster
Definition: TRGGRLMatch.h:123
double _re_scaled_p
track momentum scaled with 3D information from cluster
Definition: TRGGRLMatch.h:135
double _r
radius of track
Definition: TRGGRLMatch.h:108
double _D
distance of clusterto IP
Definition: TRGGRLMatch.h:133
double _ex_y
y position of the cluster calculated by matching
Definition: TRGGRLMatch.h:144
double _center_x
center (x) of track helix
Definition: TRGGRLMatch.h:102
double _dr
dr between track and cluster
Definition: TRGGRLMatch.h:138
double _center_z
center (z) of track helix
Definition: TRGGRLMatch.h:106
double _ex_z
z position of the cluster calculated by matching
Definition: TRGGRLMatch.h:146
double _poe
calculated p over e
Definition: TRGGRLMatch.h:148
double _R
transverse distance of cluster to IP
Definition: TRGGRLMatch.h:131
TRGCDCTrack * _track
a pointer to the TRGCDCTrack of the matching candidate
Definition: TRGGRLMatch.h:93
double _z0
z0 of track
Definition: TRGGRLMatch.h:118
double _pz
pz of track
Definition: TRGGRLMatch.h:116
double _dz
dz between track and cluster
Definition: TRGGRLMatch.h:140
double _ex_x
x position of the cluster calculated by matching
Definition: TRGGRLMatch.h:142
double _pt
pt of track
Definition: TRGGRLMatch.h:112
double _p
p of track
Definition: TRGGRLMatch.h:114
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
virtual double pt(void) const override
returns Pt.
Definition: TRGCDCTrack.h:165

◆ calculate_average() [1/2]

void calculate_average ( double  x,
double  y,
double  w = 1 
)

member functions for calculation

Definition at line 106 of file Lpav.cc.

107 {
108 if (m_wsum <= 0) return;
109 m_wsum_temp = m_wsum + wi;
110 double rri(xi * xi + yi * yi);
111 double wrri(wi * rri);
112 double wsum_inv(1 / m_wsum_temp);
113 m_xav = (m_xsum + wi * xi) * wsum_inv;
114 m_yav = (m_ysum + wi * yi) * wsum_inv;
115
116 double xxav((m_xxsum + wi * xi * xi) * wsum_inv);
117 double yyav((m_yysum + wi * yi * yi) * wsum_inv);
118 double xyav((m_xysum + wi * xi * yi) * wsum_inv);
119 double xrrav((m_xrrsum + xi * wrri) * wsum_inv);
120 double yrrav((m_yrrsum + yi * wrri) * wsum_inv);
121 double rrrrav((m_rrrrsum + wrri * rri) * wsum_inv);
122
123 calculate_average_n(xxav, yyav, xyav, xrrav, yrrav, rrrrav);
124
125 }
double m_xav
data members
Definition: Lpav.h:156
double m_yav
data members
Definition: Lpav.h:158
double m_wsum_temp
data members
Definition: Lpav.h:154
void calculate_average_n(double xxav, double yyav, double xyav, double xrrav, double yrrav, double rrrrav)
private member function calculate_average_n
Definition: Lpav.cc:145

◆ calculate_average() [2/2]

void calculate_average ( void  )

member functions for calculation

Definition at line 127 of file Lpav.cc.

128 {
129 if (m_wsum <= 0) return;
131 double wsum_inv(1 / m_wsum_temp);
132 m_xav = m_xsum * wsum_inv;
133 m_yav = m_ysum * wsum_inv;
134
135 double xxav(m_xxsum * wsum_inv);
136 double yyav(m_yysum * wsum_inv);
137 double xyav(m_xysum * wsum_inv);
138 double xrrav(m_xrrsum * wsum_inv);
139 double yrrav(m_yrrsum * wsum_inv);
140 double rrrrav(m_rrrrsum * wsum_inv);
141
142 calculate_average_n(xxav, yyav, xyav, xrrav, yrrav, rrrrav);
143 }

◆ calculate_average3() [1/2]

void calculate_average3 ( double  x,
double  y,
double  w = 1 
)

member functions for calculation

Definition at line 215 of file Lpav.cc.

216 {
217 if (m_wsum <= 0) return;
218 m_wsum_temp = m_wsum + wi;
219 double wsum_inv(1 / m_wsum_temp);
220 double rri(xi * xi + yi * yi);
221 m_xav = (m_xsum + wi * xi) * wsum_inv;
222 m_yav = (m_ysum + wi * yi) * wsum_inv;
223
224 m_rscale = 1;
225 m_cosrot = 1;
226 m_sinrot = 0;
227 m_xxavp = (m_xxsum + wi * xi * xi) * wsum_inv;
228 m_xyavp = (m_xysum + wi * xi * yi) * wsum_inv;
229 m_yyavp = (m_yysum + wi * yi * yi) * wsum_inv;
230 double wrri(wi * rri);
231 m_xrravp = (m_xrrsum + xi * wrri) * wsum_inv;
232 m_yrravp = (m_yrrsum + yi * wrri) * wsum_inv;
233 m_rrrravp = (m_rrrrsum + rri * wrri) * wsum_inv;
234 }
double m_xyavp
data members
Definition: Lpav.h:160
double m_rrrravp
data members
Definition: Lpav.h:173
double m_xrravp
data members
Definition: Lpav.h:169
double m_sinrot
data members
Definition: Lpav.h:175
double m_cosrot
data members
Definition: Lpav.h:177
double m_rscale
data members
Definition: Lpav.h:163
double m_yrravp
data members
Definition: Lpav.h:171
double m_xxavp
data members
Definition: Lpav.h:165
double m_yyavp
data members
Definition: Lpav.h:167

◆ calculate_average3() [2/2]

void calculate_average3 ( void  )

member functions for calculation

Definition at line 236 of file Lpav.cc.

237 {
238 if (m_wsum <= 0) return;
240 double wsum_inv(1 / m_wsum_temp);
241 m_xav = m_xsum * wsum_inv;
242 m_yav = m_ysum * wsum_inv;
243
244 m_rscale = 1;
245 m_cosrot = 1;
246 m_sinrot = 0;
247 m_xxavp = m_xxsum * wsum_inv;
248 m_xyavp = m_xysum * wsum_inv;
249 m_yyavp = m_yysum * wsum_inv;
250 m_xrravp = m_xrrsum * wsum_inv;
251 m_yrravp = m_yrrsum * wsum_inv;
252 m_rrrravp = m_rrrrsum * wsum_inv;
253 }

◆ calculate_average_n()

void calculate_average_n ( double  xxav,
double  yyav,
double  xyav,
double  xrrav,
double  yrrav,
double  rrrrav 
)
private

private member function calculate_average_n

Definition at line 145 of file Lpav.cc.

147 {
148 double xxav_p = xxav - m_xav * m_xav;
149 double yyav_p = yyav - m_yav * m_yav;
150 double xyav_p = xyav - m_xav * m_yav;
151 double rrav_p = xxav_p + yyav_p;
152
153 double a = std::fabs(xxav_p - yyav_p);
154 double b = 4 * xyav_p * xyav_p;
155 double asqpb = a * a + b;
156 double rasqpb = std::sqrt(asqpb);
157 double splus = 1 + a / rasqpb;
158 double sminus = b / (asqpb * splus);
159 splus = std::sqrt(0.5 * splus);
160 sminus = std::sqrt(0.5 * sminus);
161//C
162//C== First require : SIGN(C**2 - S**2) = SIGN(XXAV - YYAV)
163//C
164 if (xxav_p <= yyav_p) {
165 m_cosrot = sminus;
166 m_sinrot = splus;
167 } else {
168 m_cosrot = splus;
169 m_sinrot = sminus;
170 }
171//C
172//C== Require : SIGN(S) = SIGN(XYAV)*SIGN(C) (Assuming SIGN(C) > 0)
173//C
174 if (xyav_p < 0) m_sinrot = - m_sinrot;
175//*
176//* We now have the smallest angle that guarantees <X**2> > <Y**2>
177//*
178//* To get the SIGN of the charge right, the new X-AXIS must point
179//* outward from the orgin. We are free to change signs of both
180//* COSROT and SINROT simultaneously to accomplish this.
181//*
182//* Choose SIGN of C wisely to be able to get the sign of the charge
183//*
184 if (m_cosrot * m_xav + m_sinrot * m_yav <= 0) {
185 m_cosrot = - m_cosrot;
186 m_sinrot = - m_sinrot;
187 }
188 m_rscale = std::sqrt(rrav_p);
189 double cos2 = m_cosrot * m_cosrot;
190 double sin2 = m_sinrot * m_sinrot;
191 double cs2 = 2 * m_sinrot * m_cosrot;
192 double rrav_p_inv(1 / rrav_p);
193 m_xxavp = (cos2 * xxav_p + cs2 * xyav_p + sin2 * yyav_p) * rrav_p_inv;
194 m_yyavp = (cos2 * yyav_p - cs2 * xyav_p + sin2 * xxav_p) * rrav_p_inv;
195
196 double xav2 = m_xav * m_xav;
197 double yav2 = m_yav * m_yav;
198 double xrrav_p = (xrrav - 2 * xxav * m_xav + xav2 * m_xav -
199 2 * xyav * m_yav + m_xav * yav2) - m_xav * rrav_p;
200 double yrrav_p = (yrrav - 2 * yyav * m_yav + yav2 * m_yav -
201 2 * xyav * m_xav + m_yav * xav2) - m_yav * rrav_p;
202 m_xrravp = (m_cosrot * xrrav_p + m_sinrot * yrrav_p) * rrav_p_inv / m_rscale;
203 m_yrravp = (- m_sinrot * xrrav_p + m_cosrot * yrrav_p) * rrav_p_inv / m_rscale;
204
205 double rrav = xxav + yyav;
206 double rrrrav_p = rrrrav
207 - 2 * m_yav * yrrav - 2 * m_xav * xrrav
208 + rrav * (xav2 + yav2)
209 - 2 * m_xav * xrrav_p - xav2 * rrav_p
210 - 2 * m_yav * yrrav_p - yav2 * rrav_p;
211 m_rrrravp = rrrrav_p * rrav_p_inv * rrav_p_inv;
212 m_xyavp = 0;
213 }

◆ calculate_lpar()

double calculate_lpar ( void  )

member functions for calculation

Definition at line 343 of file Lpav.cc.

344 {
345 double lambda = solve_lambda();
346// changed on Oct-13-93
347// if (lambda<=0) return -1;
348 if (lambda < 0) return -1;
349 double h11 = m_xxavp - lambda;
350 double h22 = m_yyavp - lambda;
351 if (h11 == 0.0) return -1;
352 double h14 = m_xrravp;
353 double h24 = m_yrravp;
354 double h34 = 1 + 2 * lambda;
355 double rootsq = (h14 * h14 / h11 / h11) + 4 * h34;
356 if (std::fabs(h22) > std::fabs(h24)) {
357 if (h22 == 0.0) return -1;
358 double ratio = h24 / h22;
359 rootsq += ratio * ratio ;
360 m_kappa = 1 / std::sqrt(rootsq);
361 m_beta = - ratio * m_kappa;
362 } else {
363 if (h24 == 0.0) return -1;
364 double ratio = h22 / h24;
365 rootsq = 1 + ratio * ratio * rootsq;
366 m_beta = 1 / std::sqrt(rootsq);
367 m_beta = h24 > 0 ? -m_beta : m_beta;
368 m_kappa = -ratio * m_beta;
369 }
370 m_alpha = - (h14 / h11) * m_kappa;
371 m_gamma = - h34 * m_kappa;
372// if (lambda<0.0001) {
373// std::cout << " lambda=" << lambda << " h34=" << h34
374// << " rootsq=" << rootsq << " h22=" << h22
375// << " h11=" << h11 << " h14=" << h14 << " h24=" << h24 <<
376// " " << *this << std::endl;
377// }
378//
379//C TRANSFORM THESE INTO THE LAB COORDINATE SYSTEM
380//
381//C FIRST GET KAPPA AND GAMMA BACK TO REAL DIMENSIONS
382//
384//
385//C NEXT ROTATE ALPHA AND BETA
386//
388//
389//C THEN TRANSLATE BY (XAV,YAV)
390//
391 move(-m_xav, -m_yav);
392 if (m_yrravp < 0) neg();
393 m_chisq = lambda * m_wsum_temp * m_rscale * m_rscale;
394 return lambda;
395 }
double m_gamma
data members
Definition: Lpar.h:178
void scale(double s)
private member functions
Definition: Lpar.h:132
double m_chisq
data members
Definition: Lpav.h:182
void neg()
member functions
Definition: Lpar.h:242
double solve_lambda(void)
private member function solve_lambda
Definition: Lpav.cc:282
void rotate(double c, double s)
private member functions
Definition: Lpar.h:222
void move(double x, double y)
private member functions
Definition: Lpar.h:230

◆ calculate_lpar3()

double calculate_lpar3 ( void  )

member functions for calculation

Definition at line 397 of file Lpav.cc.

398 {
399 double lambda = solve_lambda3();
400// changed on Oct-13-93
401// if (lambda<=0) return -1;
402 if (lambda < 0) return -1;
403 double h11 = m_xxavp - lambda;
404 double h22 = m_yyavp - lambda;
405 double h14 = m_xrravp;
406 double h24 = m_yrravp;
407 m_gamma = 0;
408 double h12 = m_xyavp;
409 double det = h11 * h22 - h12 * h12;
410 if (det != 0) {
411 double r1 = (h14 * h22 - h24 * h12) / (det);
412 double r2 = (h24 * h11 - h14 * h12) / (det);
413 double kinvsq = r1 * r1 + r2 * r2;
414 m_kappa = std::sqrt(1 / kinvsq);
415 if (h11 != 0) m_alpha = -m_kappa * r1;
416 else m_alpha = 1;
417 if (h22 != 0) m_beta = -m_kappa * r2;
418 else m_beta = 1;
419 } else {
420 m_kappa = 0;
421 if (h11 != 0 && h22 != 0) {
422 m_beta = 1 / std::sqrt(1 + h12 * h12 / h11 / h11);
423 m_alpha = std::sqrt(1 - m_beta * m_beta);
424 } else if (h11 != 0) {
425 m_beta = 1;
426 m_alpha = 0;
427 } else {
428 m_beta = 0;
429 m_alpha = 1;
430 }
431 }
432 if ((m_alpha * m_xav + m_beta * m_yav) *
433 (m_beta * m_xav - m_alpha * m_yav) < 0) neg();
434// if (std::fabs(m_alpha)<0.01 && std::fabs(m_beta)<0.01) {
435// std::cout << " lambda=" << lambda << " " << *this << std::endl;
436// }
437 m_chisq = lambda * m_wsum_temp * m_rscale * m_rscale;
438 return lambda;
439 }
double solve_lambda3(void)
private member function solve_lambda3
Definition: Lpav.cc:319

◆ calFinishClock()

int calFinishClock ( ) const

Claculates the clock tick where the signal is valid.

Definition at line 1477 of file JSignal.cc.

1478 {
1479 // Combined signal?
1480 if (m_argumentSignals.size() != 0) {
1481 int maxClock = -1;
1482 // Find max clock between signals.
1483 for (unsigned iSignals = 0; iSignals < m_argumentSignals.size(); iSignals++) {
1484 if (maxClock < m_argumentSignals[iSignals].second[2]) maxClock = m_argumentSignals[iSignals].second[2];
1485 }
1486 return maxClock;
1487 } else {
1488 return m_finishClock;
1489 }
1490 }

◆ calInt()

signed long long calInt ( double  value,
TRGCDCJSignal const &  mother 
)
static

Calculates integer value with unit of a TRGCDCJSignal.

Definition at line 1662 of file JSignal.cc.

1663 {
1664 return (signed long long) FpgaUtility::roundInt(value / mother.m_toReal);
1665 }
static double roundInt(double value)
Round double value.
Definition: FpgaUtility.cc:38

◆ calMaxInteger()

signed long long calMaxInteger ( ) const

Calculate max value for a binary number.

Definition at line 1535 of file JSignal.cc.

1536 {
1537 signed long long t_maxValue;
1538 if (calType() == 1) {
1539 t_maxValue = pow(2, m_bitsize) - 1;
1540 } else if (calType() == -1) {
1541 t_maxValue = pow(2, m_bitsize - 1) - 1;
1542 } else {
1543 t_maxValue = 0;
1544 }
1545 return t_maxValue;
1546 }
int m_bitsize
+1: unsigned.
Definition: JSignal.h:280

◆ calMinInteger()

signed long long calMinInteger ( ) const

Calculate min value for a binary number.

Definition at line 1548 of file JSignal.cc.

1549 {
1550 //if(m_type==2) cout<<"[Error] TRGCDCJSignal::calMinInteger() => m_type should not be slv"<<endl;
1551 signed long long t_minValue;
1552 if (m_type == 1) {
1553 t_minValue = 0;
1554 } else if (m_type == -1) {
1555 t_minValue = -pow(2, m_bitsize - 1) + 1;
1556 } else {
1557 t_minValue = -pow(2, m_bitsize - 1) + 1;
1558 }
1559 return t_minValue;
1560 }
int m_type
Type of signal.
Definition: JSignal.h:278

◆ calPhi() [1/2]

double calPhi ( TRGCDCSegmentHit const *  segmentHit,
double  eventTime 
)
static

Utility functions.

Definition at line 895 of file Fitter3D.cc.

896 {
897 const CDC::CDCGeometryPar& cdcp = CDC::CDCGeometryPar::Instance();
898 unsigned localId = segmentHit->segment().center().localId();
899 unsigned layerId = segmentHit->segment().center().layerId();
900 int nWires = cdcp.nWiresInLayer(layerId) * 2;
901 double rr = cdcp.senseWireR(layerId);
902 double tdc = segmentHit->segment().priorityTime();
903 int lr = segmentHit->segment().LUT()->getValue(segmentHit->segment().lutPattern());
904 return Fitter3DUtility::calPhi(localId, nWires, tdc, eventTime, rr, lr);
905 }
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
static double calPhi(double wirePhi, double driftLength, double rr, int lr)
Pre 3D fitter functions. rr is in cm scale. driftLength is in cm scale.

◆ calPhi() [2/2]

double calPhi ( TRGCDCSegmentHit const *  segmentHit,
double  eventTime 
)
staticprivate

Utility functions.

Definition at line 400 of file HoughFinder.cc.

401 {
402 const CDC::CDCGeometryPar& cdcp = CDC::CDCGeometryPar::Instance();
403 unsigned localId = segmentHit->segment().center().localId();
404 unsigned layerId = segmentHit->segment().center().layerId();
405 int nWires = cdcp.nWiresInLayer(layerId) * 2;
406 double rr = cdcp.senseWireR(layerId);
407 double driftTime = segmentHit->segment().priorityTime();
408 int lr = segmentHit->segment().LUT()->getValue(segmentHit->segment().lutPattern());
409 return Fitter3DUtility::calPhi(localId, nWires, driftTime, eventTime, rr, lr);
410 }

◆ calSinPhi()

void calSinPhi ( std::map< std::string, Belle2::TRGCDCJSignal > &  mSignalStorage,
std::map< std::string, Belle2::TRGCDCJLUT * > &  mLutStorage 
)
staticprivate

Calculate Cos Sin ?

Definition at line 440 of file HoughFinder.cc.

442 {
443 Belle2::TRGCDCJSignalData* commonData = mSignalStorage.begin()->second.getCommonData();
444 {
445 mSignalStorage["invPhiAxMin"] = Belle2::TRGCDCJSignal(-M_PI / 2, mSignalStorage["phi_4"].getToReal(), commonData);
446 mSignalStorage["invPhiAxMax"] = Belle2::TRGCDCJSignal(M_PI / 2, mSignalStorage["phi_4"].getToReal(), commonData);
447 }
448
449 for (unsigned iSt = 0; iSt < 5; iSt++) {
450 string t_sininputName = "phi_" + to_string(iSt);
451 string t_sinoutputName = "sinPhi_" + to_string(iSt);
452
453 if (!mLutStorage.count(t_sinoutputName)) {
454 mLutStorage[t_sinoutputName] = new Belle2::TRGCDCJLUT(t_sinoutputName);
455
456 mLutStorage[t_sinoutputName]->setFloatFunction(
457 [ = ](double aValue) -> double{return sin(aValue);},
458 mSignalStorage[t_sininputName],
459 mSignalStorage["invPhiAxMin"], mSignalStorage["invPhiAxMax"], mSignalStorage[t_sininputName].getToReal(),
460 12, 12);
461 };//if name
462
463 mLutStorage[t_sinoutputName]->operate(mSignalStorage[t_sininputName], mSignalStorage[t_sinoutputName]);
464 } // end for
465 }//calSinPhi

◆ calType() [1/2]

int calType ( ) const

Calculated what type the signal is.

Definition at line 1447 of file JSignal.cc.

1448 {
1449 //if(m_type==2) cout<<"[Error] TRGCDCJSignal::calType() => m_type should not be slv."<<endl;
1450 if (m_minInt < 0) return -1;
1451 else return 1;
1452 }

◆ calType() [2/2]

int calType ( double  minValue) const

Calculated the type using the argument.

Definition at line 1454 of file JSignal.cc.

1455 {
1456 //if(m_type==2) cout<<"[Error] TRGCDCJSignal::calType() => m_type should not be slv."<<endl;
1457 if (minValue < 0) return -1;
1458 else return 1;
1459 }

◆ calVhdlTypeBitwidth()

void calVhdlTypeBitwidth ( TRGCDCJSignal const &  first,
const std::string &  operation,
TRGCDCJSignal const &  second,
int &  type,
int &  bitwidth 
)
static

Calculates vhdl bitwidth and type for operation.

Definition at line 1667 of file JSignal.cc.

1670 {
1671 if (first.m_type != second.m_type) {
1672 cout << "[Error] TRGCDCJSignal::calVhdlTypeBitwidth() => first and second type are different." << endl;
1673 cout << first.m_name << " " << second.m_name << endl;
1674 cout << first.m_type << " " << second.m_type << endl;
1675 return;
1676 }
1677 int firstBitwidth = first.m_bitsize;
1678 int secondBitwidth = second.m_bitsize;
1679
1680 if (operation == "+" || operation == "-") {
1681 // cppcheck-suppress knownConditionTrueFalse
1682 if (first.m_type != 1 || second.m_type != 1) {
1683 type = -1;
1684 bitwidth = max(firstBitwidth, secondBitwidth);
1685 } else {
1686 type = 1;
1687 bitwidth = max(first.m_bitsize, second.m_bitsize);
1688 }
1689 } else if (operation == "*") {
1690 // cppcheck-suppress knownConditionTrueFalse
1691 if (first.m_type != 1 || second.m_type != 1) {
1692 type = -1;
1693 bitwidth = firstBitwidth + secondBitwidth;
1694 } else {
1695 type = 1;
1696 bitwidth = first.m_bitsize + second.m_bitsize;
1697 }
1698 } else if (operation == "=" || operation == "/=" || operation == "<" || operation == "<=" ||
1699 operation == ">" || operation == ">=" || operation == "and" || operation == "or") {
1700 type = 1;
1701 bitwidth = 1;
1702 } else {
1703 cout << "[Error] TRGCDCJSignal::calVhdlTypeBitwidth() => No operation named " << operation << "." << endl;
1704 }
1705 }

◆ carstring()

std::string carstring ( const std::string &  s)
static

CERNLIB car.

Definition at line 68 of file Utilities.cc.

69 {
70 std::string ret;
71// const char * p = str;
72// while ( *p && isspace(*p) ) p++;
73// while ( *p && !isspace(*p) ) ret += *(p++);
74 int i;
75 int len = s.length();
76 for (i = 0; i < len; i++) {
77 if (!isspace(s[i])) break;
78 }
79 for (; i < len; i++) {
80 if (!isspace(s[i])) {
81 ret += s[i];
82 } else break;
83 }
84 return ret;
85 }

◆ cdrstring()

std::string cdrstring ( const std::string &  s)
static

CERNLIB cdr.

Definition at line 88 of file Utilities.cc.

89 {
90// const char * p = str;
91// while ( *p && isspace(*p) ) p++;
92// while ( *p && !isspace(*p) ) p++;
93// while ( *p && isspace(*p) ) p++;
94 int i;
95 int len = s.length();
96 for (i = 0; i < len; i++) {
97 if (!isspace(s[i])) break;
98 }
99 for (; i < len; i++) {
100 if (isspace(s[i])) break;
101 }
102 for (; i < len; i++) {
103 if (!isspace(s[i])) break;
104 }
105 return s.substr(i);
106 }

◆ cell() [1/3]

const TRGCDCCell & cell ( int  id) const

returns a pointer to a cell. 'id' can be negative or 'id' can be greater than 'nCells()'.

Definition at line 122 of file Layer.cc.

123 {
124 if (_nCells == 0) {
125 cout << "TRGCDCLayer !!! This has no cell member : " << name() << endl;
126 return * dynamic_cast<const TRGCDCCell*>(TRGCDCUndefinedLayer);
127 }
128
129 if (id < 0)
130 while (id < 0)
131 id += _nCells;
132
133 if (id >= (int) _nCells)
134 id %= (int) _nCells;
135
136 return * (* this)[id];
137 }
const unsigned _nCells
# of cells
Definition: Layer.h:143
unsigned id(void) const
returns id.
Definition: Layer.h:159
const TRGCDCLayer * TRGCDCUndefinedLayer
TRGCDCUndefinedLayer declaration.
Definition: Layer.cc:29
const std::string & name(void) const
return name.
Definition: Layer.h:264

◆ cell() [2/3]

const TRGCDCCell & cell ( void  ) const
inlinevirtual

returns a pointer to a TRGCDCWire.

Definition at line 252 of file CellHit.h.

253 {
254 return _cell;
255 }
const TRGCDCCell & _cell
a pointer to a TRGCDCWire
Definition: CellHit.h:187

◆ cell() [3/3]

const TRGCDCCell * cell ( void  ) const
inline

returns a pointer to a cell.

Definition at line 684 of file Link.h.

685 {
686 if (_hit)
687 return & _hit->cell();
688 return 0;
689 }
virtual const TRGCDCCell & cell(void) const
returns a pointer to a TRGCDCWire.
Definition: CellHit.h:252

◆ cellSize() [1/2]

float cellSize ( void  ) const
inline

calculates position and direction vector with sag correction.

returns cell size in phi.

Definition at line 302 of file Cell.h.

303 {
304 return _layer.cellSize();
305 }
float cellSize(void) const
returns cell size.
Definition: Layer.h:231

◆ cellSize() [2/2]

float cellSize ( void  ) const
inline

returns cell size.

Definition at line 231 of file Layer.h.

232 {
233 return _cellSize;
234 }
const float _cellSize
Cell size.
Definition: Layer.h:140

◆ cellWidth()

float cellWidth ( unsigned  superLayerId) const
inline

returns cell width in unit of radian.

Definition at line 912 of file TRGCDC.h.

913 {
914 return _width[a];
915 }
float * _width
Cell width in radian.
Definition: TRGCDC.h:665

◆ center() [1/4]

CLHEP::HepVector center ( void  ) const

const member functions

Definition at line 233 of file Lpar.cc.

236 {
237#else
238 {
239 CLHEP::HepVector v(3);
240#endif
241 v(1) = xc();
242 v(2) = yc();
243 v(3) = 0;
244 return (v);
245 }
double xc() const
private const member functions
Definition: Lpar.h:165
double yc() const
private const member functions
Definition: Lpar.h:167

◆ center() [2/4]

const TRGPoint2D & center ( void  ) const
inline

returns the circle center.

Definition at line 106 of file Circle.h.

107 {
108 return _center;
109 }

◆ center() [3/4]

const HepGeom::Point3D< double > & center ( void  ) const
inline

returns position of helix center(z = 0.);

Definition at line 243 of file Helix.h.

244 {
245 return m_center;
246 }
HepGeom::Point3D< double > m_center
caches
Definition: Helix.h:222

◆ center() [4/4]

const TRGCDCWire & center ( void  ) const
inline

returns a center wire.

Definition at line 265 of file Segment.h.

266 {
267 if (_wires.size() == 15)
268 return * _wires[0];
269 return * _wires[5];
270 }
std::vector< const TRGCDCWire * > _wires
LookUp Table.
Definition: Segment.h:170

◆ charge() [1/4]

double charge ( double  c)
inline

sets and returns charge.

Definition at line 255 of file TrackBase.h.

256 {
257 return _charge = a;
258 }

◆ charge() [2/4]

float charge ( float  charge)
inline

sets and returns charge for this plane.

Definition at line 236 of file HoughPlaneBase.h.

237 {
238 return _charge = a;
239 }
float _charge
Track charge for this plane.

◆ charge() [3/4]

float charge ( void  ) const
inline

returns charge for this plane.

Definition at line 229 of file HoughPlaneBase.h.

230 {
231 return _charge;
232 }

◆ charge() [4/4]

double charge ( void  ) const
inline

returns charge.

Definition at line 248 of file TrackBase.h.

249 {
250 return _charge;
251 }

◆ check()

double check ( ) const
inlineprivate

private const member functions

Definition at line 237 of file Lpar.h.

238 {
239 return m_alpha * m_alpha + m_beta * m_beta - 4 * m_kappa * m_gamma - 1;
240 }

◆ checkDatabase()

void checkDatabase ( ) const

Check the content of the DBObjects used by this class.

Definition at line 1001 of file TRGGDL.cc.

1002 {
1003 // The number of algorithm logics must be equal to the number of output bits.
1004 if (m_AlgsDB->getnalgs() != m_FTDLBitsDB->getnoutbit()) {
1005 B2FATAL("The number of logics in TRGGDLDBAlgs differs from the number of outpit bits in TRGGDLDBFTDLBits. Please check the content of the IoVs of both payloads."
1006 << LogVar("Logics", m_AlgsDB->getnalgs())
1007 << LogVar("Output bits", m_FTDLBitsDB->getnoutbit()));
1008 }
1009 }
Class to store variables with their name which were sent to the logging service.

◆ checkInt()

void checkInt ( const std::string &  name) const

Checks underflow or overflow for TRGCDCJSignal.

Definition at line 2173 of file JSignal.cc.

2174 {
2175 if (m_int > calMaxInteger()) {
2176 cout << "[Error] " << name << " => m_int overflow" << endl;
2177 cout << " Start dumping" << endl;
2178 dump();
2179 cout << " End dumping" << endl;
2180 }
2181 if (m_int < calMinInteger()) {
2182 cout << "[Error] " << name << " => m_int underflow" << endl;
2183 cout << " Start dumping" << endl;
2184 dump();
2185 cout << " End dumping" << endl;
2186 }
2187 if (m_maxInt > calMaxInteger()) {
2188 cout << "[Error] " << name << " => m_maxInt overflow" << endl;
2189 cout << " Start dumping" << endl;
2190 dump();
2191 cout << " End dumping" << endl;
2192 }
2193 if (m_minInt < calMinInteger()) {
2194 cout << "[Error] " << name << " => m_minInt underflow" << endl;
2195 cout << " Start dumping" << endl;
2196 dump();
2197 cout << " End dumping" << endl;
2198 }
2199 }
signed long long m_int
integer value of signal.
Definition: JSignal.h:282
signed long long calMaxInteger() const
Calculate max value for a binary number.
Definition: JSignal.cc:1535
signed long long calMinInteger() const
Calculate min value for a binary number.
Definition: JSignal.cc:1548
void dump() const
Methods.
Definition: JSignal.cc:539

◆ checkValid()

void checkValid ( void  )
private

check validity

Definition at line 815 of file Helix.cc.

816 {
817 if (!ms_check_range) return;
818//cnv const double adr = abs(m_a[0]);
819 const double adr = fabs(m_a[0]);
820//cnv const double acpa = abs(m_a[2]);
821 const double acpa = fabs(m_a[2]);
822 if (!(adr >= ms_amin[0] && adr <= ms_amax[0])) {
823 m_helixValid = false;
824 } else if (!(acpa >= ms_amin[2] && acpa <= ms_amax[2])) {
825 m_helixValid = false;
826 } else {
827 m_helixValid = true;
828 }
829 if (!m_helixValid) {
830 if (m_a[0] != 0.0 || m_a[1] != 0.0 || m_a[2] != 0.0 ||
831 m_a[3] != 0.0 || m_a[4] != 0.0)
832 std::cout << "something wrong" << std::endl;
833 }
834
835 }
static CLHEP::HepVector ms_amax
limits for helix parameters
Definition: Helix.h:165
static bool ms_check_range
range in checked or not
Definition: Helix.h:167
static CLHEP::HepVector ms_amin
limits for helix parameters
Definition: Helix.h:163

◆ chi_deg()

double chi_deg ( ) const

const member function chi_deg

Definition at line 709 of file Lpav.cc.

710 {
711 if (m_nc <= 3) return -1;
712 else return m_chisq / (m_nc - 3);
713 }

◆ child()

const TRGCDCTrackMC * child ( unsigned  i) const
inline

returns a pointer to i'th child.

Definition at line 145 of file TrackMC.h.

146 {
147 return _children[i];
148 }
std::vector< TRGCDCTrackMC * > _children
vector of pointers to children TRGCDCTrackMC
Definition: TrackMC.h:95

◆ choose() [1/4]

void choose ( TRGCDCJSignal target,
TRGCDCJSignal const &  reference,
const std::vector< std::vector< TRGCDCJSignal > > &  data 
)
static

Choose method.

Definition at line 793 of file JSignal.cc.

795 {
796 choose(target, reference, data, -3);
797 }
static void choose(TRGCDCJSignal &target, TRGCDCJSignal const &targetMin, TRGCDCJSignal const &targetMax, TRGCDCJSignal const &reference, std::vector< std::vector< TRGCDCJSignal > > data, int targetClock)
Case method.
Definition: JSignal.cc:621

◆ choose() [2/4]

void choose ( TRGCDCJSignal target,
TRGCDCJSignal const &  reference,
const std::vector< std::vector< TRGCDCJSignal > > &  data,
int  targetClock 
)
static

Choose with target clock.

Definition at line 758 of file JSignal.cc.

761 {
762
763 signed long long t_minInt;
764 signed long long t_maxInt;
765 double t_minActual;
766 double t_maxActual;
767 double t_toReal;
768 // Find targetMin and targetMax between assignments.
769 for (unsigned iCondition = 0; iCondition < data.size(); iCondition++) {
770 const TRGCDCJSignal* assign = &(data[iCondition][0]);
771 if (iCondition == 0) {
772 t_minInt = assign->getMinInt();
773 t_maxInt = assign->getMaxInt();
774 t_minActual = assign->getMinActual();
775 t_maxActual = assign->getMaxActual();
776 t_toReal = assign->getToReal();
777 } else {
778 if (t_minInt > assign->getMinInt()) t_minInt = assign->getMinInt();
779 if (t_maxInt < assign->getMaxInt()) t_maxInt = assign->getMaxInt();
780 if (t_minActual > assign->getMinActual()) t_minActual = assign->getMinActual();
781 if (t_maxActual < assign->getMaxActual()) t_maxActual = assign->getMaxActual();
782 if (t_toReal != assign->getToReal()) cout << "[Error] TRGCDCJSignal::choose() => toReal are not same between assignments in data."
783 << endl;
784 }
785 }
786
787 TRGCDCJSignal t_targetMax(t_maxInt, t_toReal, t_maxInt, t_maxInt, t_maxActual, t_maxActual, t_maxActual, -1, target.m_commonData);
788 TRGCDCJSignal t_targetMin(t_minInt, t_toReal, t_minInt, t_minInt, t_minActual, t_minActual, t_minActual, -1, target.m_commonData);
789
790 choose(target, t_targetMin, t_targetMax, reference, data, targetClock);
791 }
double getMaxActual() const
Get maximum float value of signal.
Definition: JSignal.cc:1402
signed long long getMaxInt() const
Get maximum integer value of signal.
Definition: JSignal.cc:1387

◆ choose() [3/4]

void choose ( TRGCDCJSignal target,
TRGCDCJSignal const &  targetMin,
TRGCDCJSignal const &  targetMax,
TRGCDCJSignal const &  reference,
const std::vector< std::vector< TRGCDCJSignal > > &  data 
)
static

Chooes method. Also has input for target min and target max signal.

Definition at line 752 of file JSignal.cc.

754 {
755 choose(target, targetMin, targetMax, reference, data, -3);
756 }

◆ choose() [4/4]

void choose ( TRGCDCJSignal target,
TRGCDCJSignal const &  targetMin,
TRGCDCJSignal const &  targetMax,
TRGCDCJSignal const &  reference,
std::vector< std::vector< TRGCDCJSignal > >  data,
int  targetClock 
)
static

Case method.

Reference is what is used to determine. Target is what is going to be assigned. Data is (Assignment, From, To)... (Assignment). Last is default. Choose with target clock. Also has input for target min and target max signal.

Definition at line 621 of file JSignal.cc.

623 {
624
625 TRGCDCJSignal t_reference(reference);
626 if (t_reference.m_argumentSignals.size() == 0) t_reference.initArgumentSignals();
627
628 // Handle input errors.
629 if (data.size() == 0 || data.size() == 1) {
630 cout << "[Error] TRGCDCJSignal::choose() => There is not enough data." << endl;
631 return;
632 }
633 if ((*(data.end() - 1)).size() != 1) {
634 cout << "[Error] TRGCDCJSignal::choose() => Last data doesn't contain 1 TRGCDCJSignal." << endl;
635 return;
636 }
637
638 // Calculate result final clock.
639 int t_maxClock = t_reference.m_finishClock;
640 for (unsigned iCondition = 0; iCondition < data.size(); iCondition++) {
641 const TRGCDCJSignal* assign = &(data[iCondition][0]);
642 if (t_maxClock < assign->m_finishClock) t_maxClock = assign->m_finishClock;
643 }
644 // Save final clock.
645 if (targetClock == -3) target.m_finishClock = t_maxClock + 1;
646 else {
647 if (targetClock < t_maxClock) cout << "[Error] TRGCDCJSignal::choose() => targetClock is too small." << endl;
648 else target.m_finishClock = targetClock;
649 }
650
651 // Change assignment black signal constructors to min and max.
652 // Change assignment min, max (int, actual).
653 signed long long t_minInt = targetMin.m_minInt;
654 signed long long t_maxInt = targetMax.m_maxInt;
655 double t_minActual = targetMin.m_minActual;
656 double t_maxActual = targetMax.m_maxActual;
657 for (unsigned iCondition = 0; iCondition < data.size(); iCondition++) {
658 TRGCDCJSignal* from = 0;
659 TRGCDCJSignal* to = 0;
660 TRGCDCJSignal* assign = &(data[iCondition][0]);
661
662 // To keep properties.
663 TRGCDCJSignal t_assign(*assign);
664
665 // To prevent target clock to become constant.
666 //if(assign->m_minInt==assign->m_maxInt) assign->m_finishClock= target.m_finishClock-1;
667 //else assign->m_finishClock= target.m_finishClock;
668 // Change finish clock to target clock.
669 // Init arguments.
670 if (assign->m_argumentSignals.size() == 0) assign->initArgumentSignals();
671 assign->m_finishClock = target.m_finishClock;
672
673 // Change min, max (int, actual), type values.
674 assign->m_minInt = t_minInt;
675 assign->m_maxInt = t_maxInt;
676 assign->m_minActual = t_minActual;
677 assign->m_maxActual = t_maxActual;
678 assign->m_type = assign->calType();
679 assign->m_bitsize = assign->calBitwidth();
680 // Calculated vhdlCode due to above changes.
681 if (reference.getPrintVhdl() == 1) vhdlCode("none", t_assign, *assign, assign->m_vhdlCode);
682
683 // For non-default
684 if (data[iCondition].size() != 1) {
685 // Change blank signal constructors to min and max.
686 from = &(data[iCondition][1]);
687 to = &(data[iCondition][2]);
688 if (from->m_bitsize == -1) {
689 (*from) = TRGCDCJSignal(t_reference.m_minInt, t_reference.m_toReal, t_reference.m_minInt, t_reference.m_minInt,
690 t_reference.m_minActual, t_reference.m_minActual, t_reference.m_minActual, -1, t_reference.m_commonData);
691 }
692 if (to->m_bitsize == -1) {
693 (*to) = TRGCDCJSignal(t_reference.m_maxInt, t_reference.m_toReal, t_reference.m_maxInt, t_reference.m_maxInt,
694 t_reference.m_maxActual, t_reference.m_maxActual, t_reference.m_maxActual, -1, t_reference.m_commonData);
695 }
696 }
697
698 if (from) {
699 if (from->m_argumentSignals.size() == 0) from->initArgumentSignals();
700 }
701 if (to) {
702 if (to->m_argumentSignals.size() == 0) to->initArgumentSignals();
703 }
704 }
705 // For integer case.
706 for (unsigned iCondition = 0; iCondition < data.size(); iCondition++) {
707 TRGCDCJSignal const* assign = &(data[iCondition][0]);
708 // For default case.
709 if (data[iCondition].size() == 1) {
710 string t_string = "";
711 target.assignTo(*assign, target.m_finishClock, t_string);
712 // For non-default cases.
713 } else {
714 TRGCDCJSignal const* from = &(data[iCondition][1]);
715 TRGCDCJSignal const* to = &(data[iCondition][2]);
716 if (t_reference.m_int >= from->m_int && t_reference.m_int <= to->m_int) {
717 string t_string = "";
718 target.assignTo(*assign, target.m_finishClock, t_string);
719 break;
720 }
721 }
722 }
723 // For actual case.
724 for (unsigned iCondition = 0; iCondition < data.size(); iCondition++) {
725 TRGCDCJSignal const* assign = &(data[iCondition][0]);
726 // For default case.
727 if (data[iCondition].size() == 1) {
728 target.m_actual = (*assign).m_actual;
729 // For non-default case.
730 } else {
731 TRGCDCJSignal const* from = &(data[iCondition][1]);
732 TRGCDCJSignal const* to = &(data[iCondition][2]);
733 assign = &(data[iCondition][0]);
734 if (t_reference.m_actual >= from->m_actual && t_reference.m_actual <= to->m_actual) {
735 target.m_actual = (*assign).m_actual;
736 break;
737 }
738 }
739 }
740
741 target.checkInt("TRGCDCJSignal::choose()");
742
743 // Print Vhdl code.
744 if (reference.getPrintVhdl() == 1) {
745 string t_finalCode = chooseVhdlCode(target, t_reference, data);
746 target.m_commonData->m_vhdlInProcess += t_finalCode + "\n";
747 //target.printVhdl(t_finalCode);
748 }
749
750 }
static std::string chooseVhdlCode(TRGCDCJSignal const &target, TRGCDCJSignal const &reference, std::vector< std::vector< TRGCDCJSignal > > const &data)
Writes the choose vhdl code.
Definition: JSignal.cc:2004

◆ chooseVhdlCode()

std::string chooseVhdlCode ( TRGCDCJSignal const &  target,
TRGCDCJSignal const &  reference,
std::vector< std::vector< TRGCDCJSignal > > const &  data 
)
static

Writes the choose vhdl code.

Definition at line 2004 of file JSignal.cc.

2006 {
2007 // Check if target has m_name.
2008 if (target.m_name == "") {
2009 cout << "[Error] TRGCDCJSignal::chooseVhdlCode() => target has no name." << endl;
2010 return "";
2011 }
2012 // Check if reference has m_name or vhdlCode.
2013 if (reference.m_name == "" && reference.m_vhdlCode == "") {
2014 cout << "[Error] TRGCDCJSignal::cooseVhdlCode() => reference has no name or vhdlCode." << endl;
2015 return "";
2016 }
2017
2018 TRGCDCJSignal t_reference(reference);
2019
2020 // Set m_vhdlCode if needed.
2021 if (t_reference.m_vhdlCode == "") t_reference.initVhdlCode();
2022 // Replace names with spaces in reference.m_vhdlCode
2023 string t_referenceVhdlCode = replaceWithSignalNames(t_reference.m_vhdlCode, t_reference.m_argumentSignals, target.m_finishClock,
2024 t_reference.m_commonData->m_buffers);
2025
2026 // Storage for used values.
2027 // map<signed long long, bool> t_used;
2028 // Create string for choice().
2029 stringstream t_vhdlCode;
2030 //t_vhdlCode<<"case to_integer("<<t_referenceVhdlCode<<") is"<<endl;
2031 //for(unsigned iCondition=0; iCondition<data.size()-1; iCondition++){
2032 // TRGCDCJSignal const & from = data[iCondition][1];
2033 // TRGCDCJSignal const & to = data[iCondition][2];
2034 // TRGCDCJSignal const & assign = data[iCondition][0];
2035 // signed long long fromInt = from.m_int;
2036 // signed long long toInt = to.m_int;
2037 // // Don't allow same int numbers for from and to.
2038 // if(t_used.count(fromInt)!=0) fromInt += 1;
2039 // else t_used[fromInt] = 1;
2040 // if(t_used.count(toInt)!=0) {
2041 // // Allow same from and to when in one line.
2042 // if(fromInt!=toInt) toInt -= 1;
2043 // } else t_used[toInt] = 1;
2044 // t_vhdlCode<<" when "<<fromInt<<" to "<<toInt<<"=>"<<assignVhdlCode(target,assign)<<endl;;
2045 //}
2046 //t_vhdlCode<<" when others=>"<<assignVhdlCode(target,(*(data.end()-1))[0])<<endl;
2047 //t_vhdlCode<<"end case;";
2048
2049 // For if
2050 TRGCDCJSignal from = data[0][1];
2051 TRGCDCJSignal to = data[0][2];
2052 TRGCDCJSignal assign = data[0][0];
2053 if (from.m_vhdlCode == "") from.initVhdlCode();
2054 if (to.m_vhdlCode == "") to.initVhdlCode();
2055 string t_fromVhdlCode = replaceWithSignalNames(from.m_vhdlCode, from.m_argumentSignals, target.m_finishClock,
2056 target.m_commonData->m_buffers);
2057 string t_toVhdlCode = replaceWithSignalNames(to.m_vhdlCode, to.m_argumentSignals, target.m_finishClock,
2058 target.m_commonData->m_buffers);
2059 string t_fromPrefixSigned;
2060 string t_fromPostfixSigned;
2061 string t_toPrefixSigned;
2062 string t_toPostfixSigned;
2063 if (reference.m_type == -1 && from.m_type == 1) {
2064 t_fromPrefixSigned = "signed('0'&";
2065 t_fromPostfixSigned = ")";
2066 } else {
2067 t_fromPrefixSigned = "";
2068 t_fromPostfixSigned = "";
2069 }
2070 if (reference.m_type == -1 && to.m_type == 1) {
2071 t_toPrefixSigned = "signed('0'&";
2072 t_toPostfixSigned = ")";
2073 } else {
2074 t_toPrefixSigned = "";
2075 t_toPostfixSigned = "";
2076 }
2077 t_vhdlCode << "if (" << t_referenceVhdlCode << " >= " << t_fromPrefixSigned << t_fromVhdlCode << t_fromPostfixSigned << ") and (" <<
2078 t_referenceVhdlCode << " <= " << t_toPrefixSigned << t_toVhdlCode << t_toPostfixSigned << ") then" << endl;
2079 t_vhdlCode << " " << assignVhdlCode(target, assign) << endl;
2080
2081 // For if else
2082 for (unsigned iCondition = 1; iCondition < data.size() - 1; iCondition++) {
2083 TRGCDCJSignal from1 = data[iCondition][1];
2084 TRGCDCJSignal to1 = data[iCondition][2];
2085 TRGCDCJSignal assign1 = data[iCondition][0];
2086 if (from1.m_vhdlCode == "") from1.initVhdlCode();
2087 if (to1.m_vhdlCode == "") to1.initVhdlCode();
2088 if (reference.m_type == -1 && from1.m_type == 1) {
2089 t_fromPrefixSigned = "signed('0'&";
2090 t_fromPostfixSigned = ")";
2091 } else {
2092 t_fromPrefixSigned = "";
2093 t_fromPostfixSigned = "";
2094 }
2095 if (reference.m_type == -1 && to1.m_type == 1) {
2096 t_toPrefixSigned = "signed('0'&";
2097 t_toPostfixSigned = ")";
2098 } else {
2099 t_toPrefixSigned = "";
2100 t_toPostfixSigned = "";
2101 }
2102 t_fromVhdlCode = replaceWithSignalNames(from1.m_vhdlCode, from1.m_argumentSignals, target.m_finishClock,
2103 target.m_commonData->m_buffers);
2104 t_toVhdlCode = replaceWithSignalNames(to1.m_vhdlCode, to1.m_argumentSignals, target.m_finishClock, target.m_commonData->m_buffers);
2105 t_vhdlCode << "elsif (" << t_referenceVhdlCode << " >= " << t_fromPrefixSigned << t_fromVhdlCode << t_fromPostfixSigned << ") and ("
2106 << t_referenceVhdlCode << " <= " << t_toPrefixSigned << t_toVhdlCode << t_toPostfixSigned << ") then" << endl;
2107 t_vhdlCode << " " << assignVhdlCode(target, assign1) << endl;
2108 }
2109 t_vhdlCode << "else" << endl;
2110 t_vhdlCode << " " << assignVhdlCode(target, (*(data.end() - 1))[0]) << endl;
2111 t_vhdlCode << "end if;";
2112 return t_vhdlCode.str();
2113 }

◆ circle()

void circle ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)

circle

Definition at line 77 of file Lpar.cc.

79 {
80 double delta = (x1 - x2) * (y1 - y3) - (y1 - y2) * (x1 - x3);
81 if (delta == 0) {
82 //
83 // three points are on a line.
84 //
85 m_kappa = 0;
86 double r12sq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
87 if (r12sq > 0) {
88 double r12 = sqrt(r12sq);
89 m_beta = -(x1 - x2) / r12;
90 m_alpha = (y1 - y2) / r12;
91 m_gamma = - (m_alpha * x1 + m_beta * y1);
92 } else {
93 double r13sq = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3);
94 if (r13sq > 0) {
95 double r13 = sqrt(r13sq);
96 m_beta = -(x1 - x3) / r13;
97 m_alpha = (y1 - y3) / r13;
98 m_gamma = - (m_alpha * x3 + m_beta * y3);
99 } else {
100 double r23sq = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3);
101 if (r23sq > 0) {
102 double r23 = sqrt(r23sq);
103 m_beta = -(x2 - x3) / r23;
104 m_alpha = (y2 - y3) / r23;
105 m_gamma = - (m_alpha * x3 + m_beta * y3);
106 } else {
107 m_alpha = 1;
108 m_beta = 0;
109 m_gamma = 0;
110 }
111 }
112 }
113 } else {
114 double r1sq = x1 * x1 + y1 * y1;
115 double r2sq = x2 * x2 + y2 * y2;
116 double r3sq = x3 * x3 + y3 * y3;
117 double a = 0.5 * ((y1 - y3) * (r1sq - r2sq) - (y1 - y2) * (r1sq - r3sq)) / delta;
118 double b = 0.5 * (- (x1 - x3) * (r1sq - r2sq) + (x1 - x2) * (r1sq - r3sq)) / delta;
119 double csq = (x1 - a) * (x1 - a) + (y1 - b) * (y1 - b);
120 double c = sqrt(csq);
121//cnv double csq2 = (x2-a)*(x2-a) + (y2-b)*(y2-b);
122//cnv double csq3 = (x3-a)*(x3-a) + (y3-b)*(y3-b);
123 m_kappa = 1 / (2 * c);
124 m_alpha = - 2 * a * m_kappa;
125 m_beta = - 2 * b * m_kappa;
126 m_gamma = (a * a + b * b - c * c) * m_kappa;
127 }
128 }

◆ circleCenter()

TRGPoint2D circleCenter ( const TRGPoint2D p) const
virtual

returns Point2D(phi, r) of a circle in real plane.

Definition at line 49 of file HoughTransformationCircle.cc.

50 {
51// return TRGPoint2D(pow(10, p.y()), p.x());
52 return TRGPoint2D(p.x(), pow(10, p.y()));
53 }

◆ classification()

void classification ( void  )
private

classify hits.

Definition at line 1604 of file TRGCDC.cc.

1605 {
1606 TRGDebug::enterStage("TRGCDC classification");
1607
1608 unsigned n = _hits.size();
1609
1610 for (unsigned i = 0; i < n; i++) {
1611 TCWHit* h = _hits[i];
1612 const TCWire& w = h->wire();
1613 unsigned state = h->state();
1614
1615 //...Cache pointers to a neighbor...
1616 const TCWire* neighbor[7];
1617 for (unsigned j = 0; j < 7; j++) neighbor[j] = w.neighbor(j);
1618
1619 //...Decide hit pattern...
1620 unsigned pattern = 0;
1621 for (unsigned j = 0; j < 7; j++) {
1622 if (neighbor[j])
1623 if (neighbor[j]->hit())
1624 pattern += (1 << j);
1625 }
1626 state |= (pattern << CellHitNeighborHit);
1627
1628 //...Check isolation...
1629 const TCWHit* hr1 = neighbor[2]->hit();
1630 const TCWHit* hl1 = neighbor[3]->hit();
1631 if ((hr1 == 0) && (hl1 == 0)) {
1632 state |= CellHitIsolated;
1633 } else {
1634 const TCWHit* hr2 = neighbor[2]->neighbor(2)->hit();
1635 const TCWHit* hl2 = neighbor[3]->neighbor(3)->hit();
1636 if (((hr2 == 0) && (hr1 != 0) && (hl1 == 0)) ||
1637 ((hl2 == 0) && (hl1 != 0) && (hr1 == 0)))
1638 state |= CellHitIsolated;
1639 }
1640
1641 //...Check continuation...
1642 // unsigned superLayer = w.superLayerId();
1643 bool previous = false;
1644 bool next = false;
1645 if (neighbor[0] == 0) previous = true;
1646 else {
1647 if ((neighbor[0]->hit()) || neighbor[1]->hit())
1648 previous = true;
1649 // if (m_smallcell && w.layerId() == 3)
1650 // if (neighbor[6]->hit())
1651 // previous = true;
1652 }
1653 if (neighbor[5] == 0) next = true;
1654 else {
1655 if ((neighbor[4]->hit()) || neighbor[5]->hit())
1656 next = true;
1657 }
1658 // if (previous && next) state |= CellHitContinuous;
1659 if (previous || next) state |= CellHitContinuous;
1660
1661 //...Solve LR locally...
1662 if ((pattern == 34) || (pattern == 42) ||
1663 (pattern == 40) || (pattern == 10) ||
1664 (pattern == 35) || (pattern == 50))
1665 state |= CellHitPatternRight;
1666 else if ((pattern == 17) || (pattern == 21) ||
1667 (pattern == 20) || (pattern == 5) ||
1668 (pattern == 19) || (pattern == 49))
1669 state |= CellHitPatternLeft;
1670
1671 //...Store it...
1672 h->state(state);
1673 }
1674
1675 TRGDebug::leaveStage("TRGCDC classification");
1676 }
std::vector< TRGCDCWireHit * > _hits
CDC hits.
Definition: TRGCDC.h:632
static void enterStage(const std::string &stageName)
Declare that you enter new stage.
Definition: Debug.cc:24
bool neighbor(const TRGCDCWire &w0, const TRGCDCWire &w1) const
returns true if w0 and w1 are neighbor.
Definition: TRGCDC.cc:2030
static void leaveStage(const std::string &stageName)
Declare that you leave a stage.
Definition: Debug.cc:34

◆ clear() [1/16]

void clear ( void  )
inline

member functions for clear

Definition at line 252 of file Lpav.h.

253 {
256 m_chisq = -1;
257 }

◆ clear() [2/16]

void clear ( unsigned  layerId)
inline

Clears only specified layer ID.

Definition at line 167 of file HoughPlaneMulti2.h.

168 {
169 _layers[a]->clear();
170 _usage[a] = false;
171 }
TRGCDCHoughPlaneBoolean * _layers[N_LAYERS]
Hough plane for each layer.
bool _usage[N_LAYERS]
Used or not.
void clear(void) override
clear all entries.

◆ clear() [3/16]

void clear ( void  )
inlinevirtual

clears information.

Reimplemented in TRGCDCSegment, and TRGCDCWire.

Definition at line 309 of file Cell.h.

310 {
311 _state = 0;
312 _hit = 0;
313 }
const TRGCDCCellHit * _hit
Cell hit.
Definition: Cell.h:190
unsigned _state
Status in this event.
Definition: Cell.h:187

◆ clear() [4/16]

void clear ( void  )

clears all TRGCDC hit information.

Definition at line 942 of file TRGCDC.cc.

943 {
944 TRGDebug::enterStage("TRGCDC clear");
945
946 TCWHit::removeAll();
947 TCSHit::removeAll();
948 TCLink::removeAll();
949
950 // for (unsigned i = 0; i < _hits.size(); i++)
951 // delete _hits[i];
952 for (unsigned i = 0; i < _hitsMC.size(); i++)
953 delete _hitsMC[i];
954 // for (unsigned i = 0; i < _badHits.size(); i++)
955 // delete _badHits[i];
956 // for (unsigned i = 0; i < _segmentHits.size(); i++)
957 // delete _segmentHits[i];
958
959 for (unsigned i = 0; i < _wires.size(); i++) {
960 TCWire* w = _wires[i];
961 w->clear();
962 }
963 for (unsigned i = 0; i < _tss.size(); i++) {
964 TCSegment* s = _tss[i];
965 s->clear();
966 }
967 _hitWires.clear();
968 _hits.clear();
969 _axialHits.clear();
970 _stereoHits.clear();
971 _badHits.clear();
972 _hitsMC.clear();
973 _segmentHits.clear();
974 for (unsigned i = 0; i < 9; i++)
976
977 TRGDebug::leaveStage("TRGCDC clear");
978 }
std::vector< TRGCDCWire * > _hitWires
Wires with a hit.
Definition: TRGCDC.h:629
std::vector< TRGCDCWireHitMC * > _hitsMC
MC info. of CDC hits.
Definition: TRGCDC.h:644
std::vector< TRGCDCSegment * > _tss
Track Segments.
Definition: TRGCDC.h:647
std::vector< TRGCDCSegmentHit * > _segmentHits
Track Segments with hits.
Definition: TRGCDC.h:656
std::vector< TRGCDCWireHit * > _badHits
Bad CDC hits.(not used now)
Definition: TRGCDC.h:641
std::vector< TRGCDCWire * > _wires
All wires.
Definition: TRGCDC.h:626
std::vector< TRGCDCWireHit * > _stereoHits
CDC hits on stereo wires.
Definition: TRGCDC.h:638
void clear(void)
clears all TRGCDC hit information.
Definition: TRGCDC.cc:942

◆ clear() [5/16]

void clear ( void  )

clears all TRGGDL information.

Definition at line 199 of file TRGGDL.cc.

200 {
201 }

◆ clear() [6/16]

void clear ( void  )

clears all TRGGRL information.

Definition at line 133 of file TRGGRL.cc.

134 {
135 }

◆ clear() [7/16]

void clear ( void  )
inline

clears contents.

Definition at line 143 of file BitStream.h.

144 {
145 _stream.clear();
146 }

◆ clear() [8/16]

void clear ( void  )
inline

clears contents.

Definition at line 265 of file Signal.h.

266 {
267
268#if TRG_DEBUG
270#endif
271
272 _history.clear();
273 }
bool consistencyCheck(void) const
Self-consitency check. True is return if something wrong.
Definition: Signal.cc:452

◆ clear() [9/16]

void clear ( void  )
inline

clears state.

Definition at line 372 of file State.h.

373 {
374 for (unsigned i = 0; i < _n; i++)
375 _state[i] = 0;
376 }

◆ clear() [10/16]

void clear ( void  )
inlineoverridevirtual

clear all entries.

Implements TRGCDCHoughPlaneBase.

Reimplemented in TRGCDCHoughPlaneMulti, and TRGCDCHoughPlaneMulti2.

Definition at line 115 of file HoughPlane.h.

116 {
117 memset(_cell, 0, nX() * nY() * sizeof(int));
119 }
virtual void clear(void)=0
Clears all entries.
unsigned nY(void) const
return # of y bins.
unsigned nX(void) const
returns # of x bins.

◆ clear() [11/16]

void clear ( void  )
inlineoverridevirtual

clear all entries.

Implements TRGCDCHoughPlaneBase.

Definition at line 158 of file HoughPlaneBoolean.h.

159 {
160 memset(_cell, 0, _n * sizeof(unsigned));
162 }
unsigned _n
nX * nY / 32 + 1

◆ clear() [12/16]

void clear ( void  )
inlineoverridevirtual

Clears all entries.

Reimplemented from TRGCDCHoughPlane.

Definition at line 94 of file HoughPlaneMulti.h.

95 {
96 for (unsigned i = 0; i < N_LAYERS; i++)
97 if (_usage[i])
98 _layers[i]->clear();
100 }
TRGCDCHoughPlane * _layers[N_LAYERS]
layers of TRGCDCHoughPlane
bool _usage[N_LAYERS]
usage of each layer
#define N_LAYERS
number of layers

◆ clear() [13/16]

void clear ( void  )
inlineoverridevirtual

Clears all entries and regions.

Reimplemented from TRGCDCHoughPlane.

Definition at line 143 of file HoughPlaneMulti2.h.

144 {
145 for (unsigned i = 0; i < N_LAYERS; i++)
146 if (_usage[i]) {
147 _layers[i]->clear();
148 _usage[i] = false;
149 }
151 }

◆ clear() [14/16]

void clear ( void  )
overridevirtual

clears information.

Reimplemented from TRGCDCCell.

Definition at line 132 of file Segment.cc.

133 {
134 TCCell::clear();
135 _signal.clear();
136 _hits.clear();
137 _storeHits.clear();
138 }
TRGSignal _signal
Trigger signal.
Definition: Segment.h:176
std::vector< const TRGCDCWireHit * > _hits
Wire hits.
Definition: Segment.h:182

◆ clear() [15/16]

void clear ( void  )
overridevirtual

clears information.

Reimplemented from TRGCDCCell.

Definition at line 370 of file Wire.cc.

371 {
372 TCCell::clear();
373
374 for (unsigned i = 0; i < _mcHits.size(); i++)
375 delete _mcHits[i];
376 _mcHits.clear();
377
378 _signal.clear();
379 _signal.name(name());
382 }
std::vector< const TRGCDCWireHitMC * > _mcHits
MC wire hit.
Definition: Wire.h:129
std::string name(void) const override
returns name.
Definition: Wire.cc:385

◆ clear() [16/16]

void clear ( void  )
inlinepure virtual

Clears all entries.

Implemented in TRGCDCHoughPlane, TRGCDCHoughPlaneBoolean, TRGCDCHoughPlaneMulti, and TRGCDCHoughPlaneMulti2.

Definition at line 499 of file HoughPlaneBase.h.

500 {
501 clearRegions();
502 }
void clearRegions(void)
Clears regions.

◆ clearBufferSL()

void clearBufferSL ( void  )
inlinestaticprivate

clear buffers

Definition at line 677 of file Link.h.

678 {
679 bzero(_nHitsSL, sizeof(unsigned) * _nSL);
680 }
static unsigned _nSL
...Buffers...
Definition: Link.h:400
static unsigned * _nHitsSL
...Buffers...
Definition: Link.h:404

◆ clearCells() [1/2]

void clearCells ( void  )
inline

Clears entires only.

Definition at line 123 of file HoughPlane.h.

124 {
125 memset(_cell, 0, nX() * nY() * sizeof(int));
126 }

◆ clearCells() [2/2]

void clearCells ( void  )
inline

Clears entires only.

Definition at line 155 of file HoughPlaneMulti2.h.

156 {
157 for (unsigned i = 0; i < N_LAYERS; i++)
158 if (_usage[i]) {
159 _layers[i]->clear();
160 _usage[i] = false;
161 }
163 }
void clearCells(void)
Clears entires only.
Definition: HoughPlane.h:123

◆ clearRegions()

void clearRegions ( void  )
inline

Clears regions.

Definition at line 491 of file HoughPlaneBase.h.

492 {
493 // HepAListDeleteAll(_regions);
494 _regions.clear();
495 }
std::vector< std::vector< unsigned > * > _regions
Regions.

◆ clock() [1/9]

const TRGClock & clock ( const TRGClock c)

changes clock.

Definition at line 359 of file Signal.cc.

360 {
361 _clock = & c;
362
363 const unsigned n = _history.size();
364 for (unsigned i = 0; i < n; i++)
365 _history[i].clock(c);
366
367 //...Check pulse width...
368 for (unsigned i = 0; i < n; i++) {
369 const bool edge = _history[i].edge();
370
371 if (! edge) {
372 const int t0 = _history[i - 1].time();
373 const int t1 = _history[i].time();
374 const unsigned w = t1 - t0;
375 if (w == 0)
376 _history[i].shift(1);
377 }
378 }
379
380#if TRG_DEBUG
382#endif
383
384 return * _clock;
385 }
const TRGClock * _clock
Clock.
Definition: Signal.h:178
const TRGClock & clock(void) const
returns clock.
Definition: Signal.h:331

◆ clock() [2/9]

const TRGClock & clock ( const TRGClock c)

changes clock.

Definition at line 258 of file SignalBundle.cc.

259 {
260 _clock = & c;
261
262 for (unsigned i = 0; i < size(); i++) {
263 TRGSignalVector& t = * (* this)[i];
264 t.clock(c);
265 }
266
267 return * _clock;
268 }
const TRGClock * _clock
Clock.
Definition: SignalBundle.h:106

◆ clock() [3/9]

const TRGClock & clock ( const TRGClock c)

changes clock.

Definition at line 168 of file SignalVector.cc.

169 {
170 _clock = & c;
171
172 for (unsigned i = 0; i < size(); i++) {
173 TRGSignal& t = (* this)[i];
174 t.clock(c);
175 }
176
177 return * _clock;
178 }
const TRGClock * _clock
Clock.
Definition: SignalVector.h:104

◆ clock() [4/9]

const TRGClock & clock ( const TRGClock c)

changes clock.

Definition at line 121 of file Time.cc.

122 {
123 const double t = _clock->absoluteTime(_time);
124 _clock = & c;
125 _time = c.position(t);
126 return * _clock;
127 }
const TRGClock * _clock
Clock.
Definition: Time.h:117
int _time
Time in clock unit.
Definition: Time.h:111
double absoluteTime(int clockPosition) const
returns absolute time of clock position
Definition: Clock.cc:128

◆ clock() [5/9]

const TRGClock & clock ( void  ) const
inline

returns clock.

Definition at line 87 of file OpticalLink.h.

88 {
89 return * _clock;
90 }

◆ clock() [6/9]

const TRGClock & clock ( void  ) const
inline

returns clock.

Definition at line 331 of file Signal.h.

332 {
333 return * _clock;
334 }

◆ clock() [7/9]

const TRGClock & clock ( void  ) const
inline

returns clock.

Definition at line 127 of file SignalBundle.h.

128 {
129 return * _clock;
130 }

◆ clock() [8/9]

const TRGClock & clock ( void  ) const
inline

returns clock.

Definition at line 125 of file SignalVector.h.

126 {
127 return * _clock;
128 }

◆ clock() [9/9]

const TRGClock & clock ( void  ) const
inline

returns clock.

Definition at line 149 of file Time.h.

150 {
151 return * _clock;
152 }

◆ clockCounter()

const TRGSignalVector & clockCounter ( void  ) const

returns the clock counter.

Definition at line 166 of file Clock.cc.

167 {
168
169 if (_clockCounter)
170 return * _clockCounter;
171
172 _clockCounter = new TRGSignalVector(name() + " counter", * this);
173
174 //...5 bit clock counter...
175 unsigned cicle = 2;
176 for (int i = 0; i < 5; i++) {
177 TRGSignal s("tmp", * this);
178
179 //...From 0 to 1280*5...
180// const int maxN = 1280 * 5;
181 const int maxN = 400;
182 for (int j = 0; j < maxN; j++) {
183 if (((j - cicle / 2) % cicle) == 0)
184 s.set(j, j + cicle / 2);
185 }
186
187 //...Append this bit...
188 s.name("ClockCounterBit" + TRGUtilities::itostring(i));
189 (* _clockCounter) += s;
190
191 //...Double cicle...
192 cicle *= 2;
193 }
194
195 return * _clockCounter;
196 }
TRGSignalVector * _clockCounter
Clock counter.
Definition: Clock.h:143
static std::string itostring(int i)
converts int to string. (Use boost::lexical_cast)
Definition: Utilities.cc:50

◆ clockData()

const TRGClock & clockData ( void  ) const
inline

returns data clock.

Definition at line 123 of file Board.h.

124 {
125 return * _clockData;
126 }
const TRGClock * _clockData
Data clock.
Definition: Board.h:90

◆ clockSystem()

const TRGClock & clockSystem ( void  ) const
inline

returns system clock.

Definition at line 116 of file Board.h.

117 {
118 return * _clockSystem;
119 }
const TRGClock * _clockSystem
System clock.
Definition: Board.h:87

◆ clockUserInput()

const TRGClock & clockUserInput ( void  ) const
inline

returns Aurora user clock for input.

Definition at line 130 of file Board.h.

131 {
132 return * _clockUserInput;
133 }
const TRGClock * _clockUserInput
User clock.
Definition: Board.h:93

◆ clockUserOutput()

const TRGClock & clockUserOutput ( void  ) const
inline

returns Aurora user clock for output.

Definition at line 137 of file Board.h.

138 {
139 return * _clockUserOutput;
140 }
const TRGClock * _clockUserOutput
User clock.
Definition: Board.h:96

◆ combineArguments()

void combineArguments ( TRGCDCJSignal const &  first,
TRGCDCJSignal const &  second,
TRGCDCJSignal result 
)
static

Combines arguments of signals.

Definition at line 1734 of file JSignal.cc.

1735 {
1736 result.m_argumentSignals.clear();
1737 result.m_argumentSignals.insert(result.m_argumentSignals.end(), first.m_argumentSignals.begin(), first.m_argumentSignals.end());
1738 result.m_argumentSignals.insert(result.m_argumentSignals.end(), second.m_argumentSignals.begin(), second.m_argumentSignals.end());
1739 }

◆ comp()

TRGCDCJSignal comp ( TRGCDCJSignal const &  lhs,
const std::string &  operate,
TRGCDCJSignal const &  rhs 
)
static

Compare two signals.

Definition at line 1169 of file JSignal.cc.

1170 {
1171 // Make copies for method.
1172 TRGCDCJSignal t_lhs(lhs);
1173 TRGCDCJSignal t_rhs(rhs);
1174 TRGCDCJSignal t_result(t_lhs);
1175 // Make arguments.
1176 if (t_lhs.m_argumentSignals.size() == 0) t_lhs.initArgumentSignals();
1177 if (t_rhs.m_argumentSignals.size() == 0) t_rhs.initArgumentSignals();
1178 combineArguments(t_lhs, t_rhs, t_result);
1179 // Int Operation.
1180 bool t_bool = false;
1181 if (operate == "=") {
1182 t_bool = (t_lhs.m_int == t_rhs.m_int ? 1 : 0);
1183 } else if (operate == "/=") {
1184 t_bool = (t_lhs.m_int != t_rhs.m_int ? 1 : 0);
1185 } else if (operate == "<") {
1186 t_bool = (t_lhs.m_int < t_rhs.m_int ? 1 : 0);
1187 } else if (operate == "<=") {
1188 t_bool = (t_lhs.m_int <= t_rhs.m_int ? 1 : 0);
1189 } else if (operate == ">") {
1190 t_bool = (t_lhs.m_int > t_rhs.m_int ? 1 : 0);
1191 } else if (operate == ">=") {
1192 t_bool = (t_lhs.m_int >= t_rhs.m_int ? 1 : 0);
1193 } else if (operate == "and") {
1194 t_bool = (t_lhs.m_int && t_rhs.m_int ? 1 : 0);
1195 } else if (operate == "or") {
1196 t_bool = (t_lhs.m_int || t_rhs.m_int ? 1 : 0);
1197 } else {
1198 cout << "[Error] TRGCDCJSignal::comp() => No operator named " << operate << "." << endl;
1199 }
1200 // Actual Operation.
1201 if (operate == "=") {
1202 t_result.m_actual = (t_lhs.m_actual == t_rhs.m_actual ? 1 : 0);
1203 } else if (operate == "/=") {
1204 t_result.m_actual = (t_lhs.m_actual != t_rhs.m_actual ? 1 : 0);
1205 } else if (operate == "<") {
1206 t_result.m_actual = (t_lhs.m_actual < t_rhs.m_actual ? 1 : 0);
1207 } else if (operate == "<=") {
1208 t_result.m_actual = (t_lhs.m_actual <= t_rhs.m_actual ? 1 : 0);
1209 } else if (operate == ">") {
1210 t_result.m_actual = (t_lhs.m_actual > t_rhs.m_actual ? 1 : 0);
1211 } else if (operate == ">=") {
1212 t_result.m_actual = (t_lhs.m_actual >= t_rhs.m_actual ? 1 : 0);
1213 } else if (operate == "and") {
1214 t_result.m_actual = (t_lhs.m_actual && t_rhs.m_actual ? 1 : 0);
1215 } else if (operate == "or") {
1216 t_result.m_actual = (t_lhs.m_actual || t_rhs.m_actual ? 1 : 0);
1217 } else {
1218 cout << "[Error] TRGCDCJSignal::comp() => No operator named " << operate << "." << endl;
1219 }
1220 // Change values.
1221 t_result.m_name = t_lhs.m_name + operate + t_rhs.m_name;
1222 t_result.m_type = 1;
1223 t_result.m_bitsize = 1;
1224 t_result.m_minInt = 0;
1225 t_result.m_maxInt = 1;
1226 t_result.m_minActual = 0;
1227 t_result.m_maxActual = 1;
1228 t_result.m_toReal = 1;
1229 if (t_bool == 1) {
1230 t_result.m_int = 1;
1231 } else {
1232 t_result.m_int = 0;
1233 }
1234
1235 if (t_result.getPrintVhdl() == 1) vhdlCode(t_lhs, operate, t_rhs, t_result, t_result.m_vhdlCode);
1236
1237 return t_result;
1238
1239 }
static void combineArguments(TRGCDCJSignal const &first, TRGCDCJSignal const &second, TRGCDCJSignal &result)
Combines arguments of signals.
Definition: JSignal.cc:1734

◆ conf()

const HepGeom::Point3D< double > & conf ( const HepGeom::Point3D< double > &  conf)
inline

conf 3D point

Definition at line 571 of file Link.h.

572 {
573 return _conf = a;
574 }

◆ configFile() [1/2]

std::string configFile ( void  ) const
inline

returns configuration file name.

Definition at line 334 of file TRGGDL.h.

335 {
336 return _configFilename;
337 }
std::string _configFilename
GDL configuration filename.
Definition: TRGGDL.h:215

◆ configFile() [2/2]

std::string configFile ( void  ) const
inline

returns configuration file name.

Definition at line 227 of file TRGGRL.h.

228 {
229 return _configFilename;
230 }
std::string _configFilename
root file name.
Definition: TRGGRL.h:147

◆ configure() [1/3]

void configure ( void  )
private

configures trigger modules for firmware simulation.

Definition at line 2450 of file TRGCDC.cc.

2451 {
2452 TRGDebug::enterStage("TRGCDC configure");
2453
2454 //...Open configuration file...
2455 ifstream infile(_configFilename.c_str(), ios::in);
2456 if (infile.fail()) {
2457 cout << "TRGCDC !!! can not open file" << endl
2458 << " " << _configFilename << endl;
2459 return;
2460 }
2461
2462 //...Read configuration data...
2463 char b[800];
2464 unsigned lines = 0;
2465 unsigned lastSl = 0;
2466 unsigned lastMergerLocalId = 0;
2467 while (! infile.eof()) {
2468 infile.getline(b, 800);
2469 const string l(b);
2470 string cdr = l;
2471
2472 bool skip = false;
2473 unsigned wid = 0;
2474 unsigned lid = 0;
2475 unsigned fid = 0;
2476 unsigned mid = 0;
2477 unsigned tid = 0;
2478 // cppcheck-suppress knownConditionTrueFalse
2479 if (lid != 0) mid = lid + tid; //jb
2480 for (unsigned i = 0; i < 5; i++) {
2481 const string car = TRGUtil::carstring(cdr);
2482 cdr = TRGUtil::cdrstring(cdr);
2483
2484 if (car == "#") {
2485 skip = true;
2486 break;
2487 } else if (car == "CDC") {
2488 skip = true;
2489 break;
2490 }
2491
2492 if (i == 0) {
2493 wid = atoi(car.c_str());
2494 } else if (i == 1) {
2495 lid = atoi(car.c_str());
2496 } else if (i == 2) {
2497 fid = atoi(car.c_str());
2498 } else if (i == 3) {
2499 mid = atoi(car.c_str());
2500 } else if (i == 4) {
2501 tid = atoi(car.c_str());
2502 }
2503 }
2504
2505 if (skip)
2506 continue;
2507 if (lines != wid)
2508 continue;
2509
2510 //...Super layer ID...
2511 const unsigned sl = _wires[wid]->superLayerId();
2512 if (sl != lastSl)
2513 lastMergerLocalId = 0;
2514
2515 //...Make a front-end board if necessary...
2516 bool newFrontEnd = false;
2517 TCFrontEnd* f = 0;
2518 if (fid < _fronts.size())
2519 f = _fronts[fid];
2520 if (! f) {
2521 newFrontEnd = true;
2522 const string name = "CDCFrontEnd" + TRGUtil::itostring(fid);
2523 TCFrontEnd::boardType t;
2524 if (sl == 0) {
2525 if (_wires[wid]->localLayerId() < 5)
2526 t = TCFrontEnd::innerInside;
2527 else
2528 t = TCFrontEnd::innerOutside;
2529 } else {
2530 if (_wires[wid]->localLayerId() < 3)
2531 t = TCFrontEnd::outerInside;
2532 else
2533 t = TCFrontEnd::outerOutside;
2534 }
2535 f = new TCFrontEnd(name, t, _clock, _clockD, _clockUser3125);
2536
2537 _fronts.push_back(f);
2538 }
2539 f->push_back(_wires[wid]);
2540
2541 //...Make a merger board if necessary... 2013,0908: physjg: I
2542 // think this should be done only when a new frontboard is
2543 // created. i.e., inlcuded in the if(!f) { .... } block.
2544 // Or I can put this part inside the new FrontEnd creation
2545 // part, well, seems not good in coding
2546 //
2547 bool newMerger = false;
2548 TCMerger* m = nullptr;
2549 if (newFrontEnd) {
2550 if (mid != 99999) {
2551 if (mid < _mergers.size())
2552 m = _mergers[mid];
2553 if (! m) {
2554 newMerger = true;
2555 const string name = "CDCMerger" + TRGUtil::itostring(sl) +
2556 "-" + TRGUtil::itostring(lastMergerLocalId);
2557 TCMerger::unitType mt;
2558 if (sl == 0)
2559 mt = TCMerger::innerType;
2560 else
2561 mt = TCMerger::outerType;
2562 m = new TCMerger(name,
2563 mt,
2564 _clock,
2565 _clockD,
2568 _mergers.push_back(m);
2569 ++lastMergerLocalId;
2570 lastSl = sl;
2571 //cout << "new merger : " << name << endl;
2572 }
2573 m->push_back(f);
2574 }
2575
2576 //...Make Aurora channel...
2577 if (f && m) {
2578 const string n = f->name() + string("-") + m->name();
2579 TRGChannel* ch = new TRGChannel(n, *f, *m);
2580 f->appendOutput(ch);
2581 m->appendInput(ch);
2582 }
2583 }
2584
2585 //...Make a TSF board if necessary...
2586 if (newMerger) {
2587 TSFinder* t = 0;
2588 if (tid != 99999) {
2589 if (tid < _tsfboards.size())
2590 t = _tsfboards[tid];
2591 if (!t) {
2592 const string name = "CDCTSFBoard" + TRGUtil::itostring(tid);
2593 TSFinder::boardType tt;
2594 if (_wires[wid]->superLayerId() == 0)
2595 tt = TSFinder::innerType;
2596 else
2597 tt = TSFinder::outerType;
2598 t = new TSFinder(*this,
2599 name,
2600 tt,
2601 _clock,
2602 _clockD,
2605 _tsSL[tid]);
2606 _tsfboards.push_back(t);
2607 }
2608 t->push_back(m);
2609 }
2610
2611 if (m && t) {
2612 const string n = m->name() + string("-") + t->name();
2613 TRGChannel* chmt = new TRGChannel(n, *m, *t);
2614 m->appendOutput(chmt);
2615 t->appendInput(chmt);
2616 }
2617 }
2618
2619 ++lines;
2620 }
2621 infile.close();
2622
2623 //...Make a 2D finder...
2624 for (unsigned i = 0; i < 4; i++) {
2625 const string name = "CDC2DBoard" + TRGUtil::itostring(i);
2626 TCTracker2D* t = new TCTracker2D(name,
2627 _clock,
2628 _clockD,
2631 _tracker2Ds.push_back(t);
2632 for (unsigned j = 0; j < 9; j++) {
2633 TCTSFinder* tsf = _tsfboards[j];
2634 const string n = tsf->name() + string("-") + t->name();
2635 TRGChannel* ch = new TRGChannel(n, *tsf, *t);
2636 tsf->appendOutput(ch);
2637 t->appendInput(ch);
2638 }
2639 const string n = t->name() + string("-") + "CDC3DBoard" + TRGUtil::itostring(i);
2640 TRGChannel* ch = new TRGChannel(n, *t, *t);
2641 // last (* t) should be 3D tracker in future
2642 t->appendOutput(ch);
2643 }
2644
2645 //...For debug...
2646 if (TRGDebug::level()) {
2647 cout << TRGDebug::tab() << "TSF configuration" << endl;
2648 for (unsigned i = 0; i < _tsfboards.size(); i++) {
2649 const TSFinder& t = *_tsfboards[i];
2650 t.dump("detail", TRGDebug::tab() + " ");
2651 }
2652 cout << TRGDebug::tab() << "Tracker2D configuration" << endl;
2653 for (unsigned i = 0; i < _tracker2Ds.size(); i++) {
2654 const TCTracker2D& t = *_tracker2Ds[i];
2655 t.dump("detail", TRGDebug::tab() + " ");
2656 }
2657 }
2658
2659 TRGDebug::leaveStage("TRGCDC configure");
2660 }
std::vector< TRGCDCTracker2D * > _tracker2Ds
CDC 2D finder boards.
Definition: TRGCDC.h:708
std::string _configFilename
CDC trigger configuration filename.
Definition: TRGCDC.h:499
std::vector< TRGCDCTrackSegmentFinder * > _tsfboards
CDC trigger tsf boards.
Definition: TRGCDC.h:705
const TRGClock _clockD
CDC trigger data clock.
Definition: TRGCDC.h:684
const TRGClock _clock
CDC trigger system clock.
Definition: TRGCDC.h:674
std::vector< TRGCDCFrontEnd * > _fronts
CDC front-end boards.
Definition: TRGCDC.h:699
const TRGClock _clockUser3125
CDC trigger user clock for Aurora 3.125 Gbps.
Definition: TRGCDC.h:687
std::vector< TRGCDCMerger * > _mergers
CDC trigger merger boards.
Definition: TRGCDC.h:702
const TRGClock _clockUser6250
CDC trigger user clock for Aurora 6.250 Gbps.
Definition: TRGCDC.h:690
static std::string tab(void)
returns tab spaces.
Definition: Debug.cc:47
std::string name(void) const
simulates track segment decisions.
Definition: TRGCDC.cc:92
unsigned localLayerId(unsigned wireId) const
returns local layer ID in a super layer. This function is expensive.
Definition: TRGCDC.cc:1842
unsigned superLayerId(unsigned wireId) const
returns super layer ID. This function is expensive.
Definition: TRGCDC.cc:1820
static int level(void)
returns the debug level.
Definition: Debug.cc:67

◆ configure() [2/3]

void configure ( void  )
private

configures trigger modules for firmware simulation.

Definition at line 695 of file TRGGDL.cc.

696 {
697
698 //...Open input data definition...
699 const string fni = _configFilename + ".inp";
700 ifstream infile(fni.c_str(), ios::in);
701 if (infile.fail()) {
702 cout << "TRGGDL !!! can not open file : " << fni << endl;
703 return;
704 }
705 getInput(infile);
706 infile.close();
707
708 //...Open output data definition...
709 const string fno = _configFilename + ".oup";
710 ifstream outfile(fno.c_str(), ios::in);
711 if (outfile.fail()) {
712 cout << "TRGGDL !!! can not open file : " << fno << endl;
713 return;
714 }
715 getOutput(outfile);
716 outfile.close();
717
718 //...Open algorithm data definition...
719 const string fna = _configFilename + ".alg";
720 ifstream algfile(fna.c_str(), ios::in);
721 if (algfile.fail()) {
722 cout << "TRGGDL !!! can not open file : " << fna << endl;
723 return;
724 }
725 getAlgorithm(algfile);
726 algfile.close();
727
728 //...FTD function...
729 string ftd = _configFilename;
730 string::size_type s = ftd.find_last_of("/");
731 if (s != string::npos)
732 ftd = ftd.substr(s + 1);
733 if (ftd == "ftd_0.01") {
734 _ftd = ftd_0_01;
735 }
736
737 //...Summary...
738 if (TRGDebug::level()) {
739 cout << "TRGGDL Config file = " << _configFilename << endl;
740 cout << " ftd=" << ftd << endl;
741 cout << "TRGGDL Input Bits" << endl;
742 for (unsigned i = 0; i < _input.size(); i++)
743 cout << TRGDebug::tab(4) << i << " : " << _input[i] << endl;
744 cout << "TRGGDL Output Bits" << endl;
745 for (unsigned i = 0; i < _output.size(); i++)
746 cout << TRGDebug::tab(4) << i << " : " << _output[i]
747 << " : " << _algorithm[i] << endl;
748 }
749 }
std::vector< std::string > _algorithm
Algorithm.
Definition: TRGGDL.h:248
std::vector< std::string > _output
Output names.
Definition: TRGGDL.h:245
std::vector< std::string > _input
Input names.
Definition: TRGGDL.h:242
static void(* _ftd)(bool *out, const bool *in)
Function to simulate final trigger decision.
Definition: TRGGDL.h:145
void getOutput(std::ifstream &ifs)
Read output data definition.
Definition: TRGGDL.cc:776
void getAlgorithm(std::ifstream &ifs)
Read algorithm data definition.
Definition: TRGGDL.cc:801
void getInput(std::ifstream &ifs)
Read input data definition.
Definition: TRGGDL.cc:752

◆ configure() [3/3]

void configure ( void  )
private

configures trigger modules for firmware simulation.

Definition at line 263 of file TRGGRL.cc.

264 {
265 }

◆ consective()

bool consective ( const TRGCDCWire w) const
inline

returns true if a given wire is consective in a layer.

Definition at line 183 of file Wire.h.

184 {
185 if (neighbor(2) == & w) return true;
186 else if (neighbor(3) == & w) return true;
187 return false;
188 }

◆ consistencyCheck()

bool consistencyCheck ( void  ) const
private

Self-consitency check. True is return if something wrong.

Definition at line 452 of file Signal.cc.

453 {
454 const unsigned n = _history.size();
455 if (n % 2) {
456 cout << "TRGSignal::consistencyCheck !!! "
457 << "history has odd number entires : n=" << n << endl;
458 dump("detail", "!!! ");
459 }
460
461 if (n < 2)
462 return true;
463
464 unsigned err = 0;
465 unsigned errTiming = 0;
466 for (unsigned i = 0; i < n; i++) {
467 if (i % 2)
468 continue;
469
470 const TRGTime& t0 = _history[i];
471 const TRGTime& t1 = _history[i + 1];
472
473 if (t0.edge() != true)
474 err |= (1 << i);
475 if (t1.edge() != false)
476 err |= (1 << (i + 1));
477
478 if ((t0.time() == t1.time()) || (t0.time() > t1.time()))
479 errTiming |= (1 << (i + 1));
480 }
481
482 if (err || errTiming) {
483 if (err) {
484 cout << "TRGSignal::consistencyCheck !!! err in edge history"
485 << endl;
486 }
487 if (errTiming) {
488 cout << "TRGSignal::consistencyCheck !!! err in time history"
489 << endl;
490 }
491 dump("detail", "!!! ");
492 return true;
493 }
494
495 return false;
496 }
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
Definition: Signal.cc:139

◆ contributor()

unsigned contributor ( unsigned  i = 0) const

returns i'th contributor of MCParticle.

Definition at line 41 of file Relation.cc.

42 {
43
44 const unsigned n = _relations.size();
45
46 if (n == 0) {
47 return 99999;
48 } else if (n == 1) {
49 return _relations.begin()->first;
50 }
51
52 //...Preparation...
53 if (_pairs == nullptr) {
54 _pairs = new const pair<unsigned, unsigned>* [n];
55 map<unsigned, unsigned>::const_iterator it = _relations.begin();
56 unsigned i = 0;
57 while (it != _relations.end()) {
58 _pairs[i] = new const pair<unsigned, unsigned>(it->first, it->second);
59 ++it;
60 ++i;
61 }
62
63 //...Sorting...
64 for (unsigned k = 0; k < n - 1; k++) {
65 for (unsigned j = i + 1; j < n; j++) {
66 if (_pairs[k]->second < _pairs[j]->second) {
67 const pair<unsigned, unsigned>* tmp = _pairs[k];
68 _pairs[k] = _pairs[j];
69 _pairs[j] = tmp;
70 }
71 }
72 }
73 }
74
75 return _pairs[a]->first;
76 }
const std::pair< unsigned, unsigned > ** _pairs
Pairs.
Definition: Relation.h:83
const std::map< unsigned, unsigned > _relations
Map.
Definition: Relation.h:80

◆ convert() [1/2]

TRGPoint2D convert ( const TRGPoint2D p) const
virtual

converts Point2D(r, phi) in real plane into Point2D(r, phi) in Hough plane.

Reimplemented in TRGCDCHoughTransformationCircle.

Definition at line 34 of file HoughTransformation.cc.

35 {
36 return p;
37 }

◆ convert() [2/2]

TRGPoint2D convert ( const TRGPoint2D p) const
overridevirtual

converts Point2D(phi, r) in real plane into Point2D(phi, r) in Hough plane.

Reimplemented from TRGCDCHoughTransformation.

Definition at line 56 of file HoughTransformationCircle.cc.

57 {
58 return TRGPoint2D(p.x(), log10(p.y()));
59 }

◆ copy2bool()

void copy2bool ( bool *  array) const
inline

returns a filled array.

Definition at line 255 of file State.h.

256 {
257 for (unsigned i = 0; i < _size; i++) {
258 const unsigned wp = i / _bsu;
259 const unsigned bp = i % _bsu;
260 if (_state[wp] & (1 << bp))
261 a[i] = true;
262 else
263 a[i] = false;
264 }
265 }
unsigned _size
bit size.
Definition: State.h:136

◆ cores()

vector< TRGCDCLink * > cores ( const std::vector< TRGCDCLink * > &  input)
static

separate cores and non-cores.

Definition at line 457 of file Link.cc.

458 {
459 vector<TRGCDCLink*> a;
460 unsigned n = input.size();
461 for (unsigned i = 0; i < n; i++) {
462 TRGCDCLink& t = * input[i];
463 const Belle2::TCCHit& h = * t.hit();
464 if (h.state() & CellHitFittingValid)
465 a.push_back(& t);
466 }
467 return a;
468 }
TRGCDCLink(TRGCDCTrack *track=0, const TRGCDCCellHit *hit=0, const HepGeom::Point3D< double > &position=Point3D())
Constructor.
Definition: Link.cc:44

◆ cosPhi0()

double cosPhi0 ( void  ) const
inline

return cos(phi0).

Definition at line 370 of file Helix.h.

371 {
372 return m_cp;
373 }
double m_cp
caches
Definition: Helix.h:224

◆ cov()

CLHEP::HepSymMatrix cov ( int  inv = 0) const

const member function cov

Definition at line 474 of file Lpav.cc.

477 {
478#else
479 {
480 CLHEP::HepSymMatrix vret(4);
481#endif
482 vret(1, 1) = m_xxsum;
483 vret(2, 1) = m_xysum;
484 vret(2, 2) = m_yysum;
485 vret(3, 1) = m_xsum;
486 vret(3, 2) = m_ysum;
487 vret(3, 3) = m_wsum;
488 vret(4, 1) = m_xrrsum;
489 vret(4, 2) = m_yrrsum;
490 vret(4, 3) = m_xxsum + m_yysum;
491 vret(4, 4) = m_rrrrsum;
492 if (inv == 0)
493 {
494// int i=vret.Inv();
495 int i;
496 vret.invert(i);
497 if (i != 0) {
498 std::cout << "TRGCDCLpav::cov:could not invert nc=" << m_nc << vret;
499#ifdef HAVE_EXCEPTION
500 throw new Singular();
501#endif
502 }
503 }
504 return vret;
505 }

◆ cov_c()

CLHEP::HepSymMatrix cov_c ( int  inv = 0) const

const member function cov_c

Definition at line 507 of file Lpav.cc.

510 {
511#else
512 {
513 CLHEP::HepSymMatrix vret(3);
514#endif
515#ifdef HAVE_EXCEPTION
516 try
517 {
518#endif
519 vret = cov(1).similarity(dldc());
520#ifdef HAVE_EXCEPTION
521 } catch (TRGCDCLpav::Singular)
522 {
523 throw new Singular_c();
524 }
525#endif
526 if (inv == 0)
527 {
528// int i = vret.Inv();
529 int i;
530 vret.invert(i);
531 if (i != 0) {
532 std::cout << "TRGCDCLpav::cov_c:could not invert " << vret;
533#ifdef HAVE_EXCEPTION
534 throw new Singular_c();
535#endif
536 }
537 }
538 return vret;
539 }
CLHEP::HepMatrix dldc() const
private const member functions
Definition: Lpar.cc:130
CLHEP::HepSymMatrix cov(int=0) const
const member function cov
Definition: Lpav.cc:474

◆ Cpar()

Cpar ( const TRGCDCLpar l)
explicit

constructor of Cpar class

Definition at line 36 of file Lpar.cc.

37 {
38 m_cu = l.kappa();
39 if (l.alpha() != 0 && l.beta() != 0)
40 m_fi = atan2(l.alpha(), -l.beta());
41 else m_fi = 0;
42 if (m_fi < 0) m_fi += 2 * M_PI;
43 m_da = 2 * l.gamma() / (1 + sqrt(1 + 4 * l.kappa() * l.gamma()));
44 m_cfi = cos(m_fi);
45 m_sfi = sin(m_fi);
46 }
double m_cfi
parameter of Cpar class
Definition: Lpar.h:120
double m_fi
parameter of Cpar class
Definition: Lpar.h:114
double m_sfi
parameter of Cpar class
Definition: Lpar.h:118
double m_cu
parameter of Cpar class
Definition: Lpar.h:112
double m_da
parameter of Cpar class
Definition: Lpar.h:116

◆ cross() [1/2]

double cross ( const TRGPoint2D a) const
inline

outer product

Definition at line 151 of file Point2D.h.

152 {
153 return _p[0] * a.y() - a.x() * _p[1];
154 }
double _p[2]
vector
Definition: Point2D.h:81

◆ cross() [2/2]

void cross ( const TRGPoint2D x0,
const TRGPoint2D x1,
unsigned &  nFound,
TRGPoint2D  crossPoint[2] 
) const

returns cross-points.

Definition at line 29 of file Area2D.cc.

33 {
34
35 //...Parameters...
36 const float xDiff = x1.x() - x0.x();
37 const float yDiff = x1.y() - x0.y();
38 const float a = yDiff / xDiff;
39 const float b = x0.x() - a * x0.x();
40
41 //...Find cross-points...
42 nFound = 0;
43 for (unsigned i = 0; i < 2; i++) {
44
45 TRGPoint2D p(_c[i].x(), a * _c[i].x() + b);
46 if (inArea(p))
47 crossPoint[nFound++] = p;
48 if (nFound == 2) return;
49
50 TRGPoint2D q((_c[i].y() - b) / a, _c[i].y());
51 if (inArea(q))
52 crossPoint[nFound++] = q;
53 if (nFound == 2) return;
54 }
55 }
TRGPoint2D _c[2]
2D points
Definition: Area2D.h:43
bool inArea(const TRGPoint2D &x) const
returns true if give point is in the area.
Definition: Area2D.h:50

◆ curv()

double curv ( void  ) const
inline

returns curvurture.

Definition at line 306 of file Helix.h.

307 {
308 return m_r;
309 }
double m_r
caches
Definition: Helix.h:230

◆ d()

double d ( double  x,
double  y 
) const
inline

const member functions

Definition at line 255 of file Lpar.h.

256 {
257 double dd = d0(x, y);
258 const double approx_limit = 0.2;
259 if (std::fabs(m_kappa * dd) > approx_limit) return -1;
260 return dd * (1 - m_kappa * dd);
261 }
double d0(double x, double y) const
private const member functions
Definition: Lpar.h:250
double x(double r) const
private const member functions
Definition: Lpar.cc:174
double y(double r) const
private const member functions
Definition: Lpar.cc:181

◆ d0()

double d0 ( double  x,
double  y 
) const
inlineprivate

private const member functions

Definition at line 250 of file Lpar.h.

251 {
252 return m_alpha * x + m_beta * y + m_gamma + m_kappa * (x * x + y * y);
253 }

◆ dataClock()

const TRGClock & dataClock ( void  ) const
inline

returns the data clock.

Definition at line 982 of file TRGCDC.h.

983 {
984 return _clockD;
985 }

◆ dataSimulation()

void dataSimulation ( void  )
private

Data simulation.

Definition at line 360 of file TRGGDL.cc.

361 {
362// B2DEBUG(20,"TRGGDL::dataSimulation starts.");
363 StoreObjPtr<EventMetaData> bevt;
364 /*
365 unsigned _exp = bevt->getExperiment();
366 unsigned _run = bevt->getRun();
367 */
368 if (_debugLevel > 9) printf("TRGGDL:dataSimulation Start\n");
369 unsigned _evt = bevt->getEvent();
370// TRGDebug::enterStage("TRGGDL dataSim");
371
372// if (TRGDebug::level())
373// cout << TRGDebug::tab() << name() << " do nothing..." << endl;
374
375 if (!m_InputBitsDB) B2INFO("no database of gdl input bits");
376 int N_InputBits = m_InputBitsDB->getninbit();
377 if (!m_FTDLBitsDB) B2INFO("no database of gdl ftdl bits");
378 int N_OutputBits = m_FTDLBitsDB->getnoutbit();
379 if (!m_PrescalesDB) B2INFO("no database of gdl prescale");
380 int N_AlgsBits = m_AlgsDB->getnalgs();
381 if (!m_AlgsDB) B2INFO("no database of gdl ftdl bit logic");
382 if (N_OutputBits > N_AlgsBits) {
383 B2DEBUG(20, "#Algs and #FTDL is different");
384 N_OutputBits = N_AlgsBits;
385 }
386
387 if (_debugLevel > 19)
388 printf("TRGGDL:N_InputBits(%d), N_OutputBits(%d)\n", N_InputBits, N_OutputBits);
389
390 StoreObjPtr<TRGSummary> GDLResult;
391 if (! GDLResult) {
392 B2WARNING("TRGGDL::dataSimulation(): TRGSummary not found. Check it!!!!");
393 return;
394 } else {
395
396 if (_debugLevel > 89) printf("TRGGDL:TRGSummary Found.\n");
397 _inpBits.clear();
398 _ftdBits.clear();
399 _psnBits.clear();
400 for (int i = 0; i < N_InputBits; i++) {
401 bool inputBit;
402 try { inputBit = GDLResult->testInput(i); }
403 catch (const std::exception&) { inputBit = false; }
404 _inpBits.push_back(inputBit);
405 }
406
407 if (_algFromDB) {
408 for (int i = 0; i < N_OutputBits; i++) {
409 bool ftdl_fired = isFiredFTDL(_inpBits, m_AlgsDB->getalg(i));
410 bool psnm_fired = false;
411 _ftdBits.push_back(ftdl_fired);
412 if (ftdl_fired) {
413 if (doprescale(m_PrescalesDB->getprescales(i))) {
414 psnm_fired = true;
415 }
416 }
417 psnm_fired ? _psnBits.push_back(true) : _psnBits.push_back(false);
418 GDLResult->setPreScale((i / 32), (i % 32), m_PrescalesDB->getprescales(i));
419 if (! strcmp(m_FTDLBitsDB->getoutbitname(i), "hie")) {
420 if (_debugLevel == 971 && ftdl_fired) {
421 int i_ehigh = m_InputBitsDB->getinbitnum("ehigh");
422 int i_bha_veto = m_InputBitsDB->getinbitnum("bha_veto");
423 printf("TRGGDL:hie:i=%d,evt=%u,ps=%d,ehigh=%d,bha_veto=%d,ftdl_fired=%d,psnm_fired=%d,i_ehigh=%d,i_bha_veto=%d,obitname=%s\n",
424 i, _evt, m_PrescalesDB->getprescales(i),
425 _inpBits[i_ehigh] ? 1 : 0,
426 _inpBits[i_bha_veto] ? 1 : 0,
427 ftdl_fired,
428 psnm_fired ? 1 : 0,
429 i_ehigh,
430 i_bha_veto,
431 m_FTDLBitsDB->getoutbitname(i));
432 }
433 }
434 }
435
436 } else {
437 std::string str;
438 std::vector<std::string> algs;
439 std::ifstream isload(_algFilePath.c_str(), std::ios::in);
440 while (std::getline(isload, str)) {
441 algs.push_back(str);
442 }
443 isload.close();
444
445 for (int i = 0; i < N_OutputBits; i++) {
446 bool ftdl_fired = isFiredFTDL(_inpBits, algs[i]);
447 bool psnm_fired = false;
448 _ftdBits.push_back(ftdl_fired);
449 if (ftdl_fired) {
450 if (doprescale(m_PrescalesDB->getprescales(i))) {
451 psnm_fired = true;
452 }
453 }
454 psnm_fired ? _psnBits.push_back(true) : _psnBits.push_back(false);
455 GDLResult->setPreScale((i / 32), (i % 32), m_PrescalesDB->getprescales(i));
456 }
457
458 }
459
460
461 }
462 }
int _debugLevel
Debug level.
Definition: TRGGDL.h:212
DBObjPtr< TRGGDLDBInputBits > m_InputBitsDB
Data base of GDL input bits.
Definition: TRGGDL.h:263

◆ dateString()

string dateString ( void  )
static

returns date string.

Definition at line 26 of file Utilities.cc.

27 {
28 time_t t;
29 time(& t);
30 struct tm* tl;
31 tl = localtime(& t);
32 char ts1[80];
33 strftime(ts1, sizeof(ts1), "%Y/%m/%d %H:%M %Z", tl);
34 return (ts1);
35 }

◆ dateStringF()

string dateStringF ( void  )
static

returns date string for filename.

Definition at line 38 of file Utilities.cc.

39 {
40 time_t t;
41 time(& t);
42 struct tm* tl;
43 tl = localtime(& t);
44 char ts0[80];
45 strftime(ts0, sizeof(ts0), "%Y%m%d_%H%M", tl);
46 return string(ts0);
47 }

◆ dDrift() [1/5]

float dDrift ( float  b,
unsigned  a 
)
inline

sets and returns drift distance error of left or right.

Definition at line 656 of file Link.h.

657 {
658 return _dDrift[a] = b;
659 }

◆ dDrift() [2/5]

float dDrift ( unsigned  i) const
inline

returns drift distance error.

Definition at line 274 of file CellHit.h.

275 {
276 if (i) return _driftError[1];
277 return _driftError[0];
278 }
float _driftError[2]
drift distance error
Definition: CellHit.h:185

◆ dDrift() [3/5]

float dDrift ( unsigned  a) const
inline

returns drift distance error of left or right.

Definition at line 649 of file Link.h.

650 {
651 return _dDrift[a];
652 }

◆ dDrift() [4/5]

float dDrift ( void  ) const
inline

returns drift distance error.

Definition at line 289 of file CellHit.h.

290 {
291 return (_driftError[0] + _driftError[1]) / 2.;
292 }

◆ dDrift() [5/5]

float dDrift ( void  ) const
inline

returns drift distance error.

Definition at line 670 of file Link.h.

671 {
672 return (_dDrift[0] + _dDrift[1]) / 2.;
673 }

◆ debugLevel() [1/6]

int debugLevel ( int  a) const
inline

sets and returns debug level.

Definition at line 812 of file TRGCDC.h.

813 {
814 return _debugLevel = a;
815 }
int _debugLevel
Debug level.
Definition: TRGCDC.h:493

◆ debugLevel() [2/6]

int debugLevel ( int  a) const
inline

sets and returns debug level.

Definition at line 306 of file TRGGDL.h.

307 {
308 return _debugLevel = a;
309 }

◆ debugLevel() [3/6]

int debugLevel ( int  a) const
inline

sets and returns debug level.

Definition at line 206 of file TRGGRL.h.

207 {
208 return _debugLevel = a;
209 }
int _debugLevel
Debug level.
Definition: TRGGRL.h:144

◆ debugLevel() [4/6]

int debugLevel ( void  ) const
inline

returns debug level.

Definition at line 805 of file TRGCDC.h.

806 {
807 return _debugLevel;
808 }

◆ debugLevel() [5/6]

int debugLevel ( void  ) const
inline

returns debug level.

Definition at line 299 of file TRGGDL.h.

300 {
301 return _debugLevel;
302 }

◆ debugLevel() [6/6]

int debugLevel ( void  ) const
inline

returns debug level.

Definition at line 199 of file TRGGRL.h.

200 {
201 return _debugLevel;
202 }

◆ debugPrint()

void debugPrint ( void  ) const
private

print debug info

Definition at line 799 of file Helix.cc.

800 {
801
802 const double dr = m_a[0];
803 const double phi0 = m_a[1];
804 const double cpa = m_a[2];
805 const double dz = m_a[3];
806 const double tnl = m_a[4];
807 if (ms_print_debug) {
808 std::cout << "TRGCDCHelix::dr = " << dr << " phi0 = " << phi0 << " cpa = " << cpa
809 << " dz = " << dz << " tnl = " << tnl << std::endl;
810 std::cout << " pivot = " << m_pivot << std::endl;
811 }
812 }
HepGeom::Point3D< double > m_pivot
pivot
Definition: Helix.h:214
static bool ms_print_debug
print debug info or not
Definition: Helix.h:169
double dr(void) const
returns dr.
Definition: Helix.h:271
double dz(void) const
returns dz.
Definition: Helix.h:292

◆ decision()

TRGState decision ( const TRGState input)
static

Makes bit pattern(state) using input bit pattern(state).

Definition at line 830 of file TRGGDL.cc.

831 {
832
833 //...Prepare states for output...
834 TRGState s(14);
835
836 //...Set up bool array...
837 bool* in = new bool[input.size()];
838 bool* ou = new bool[14];
839 input.copy2bool(in);
840
841 // //...Simulate output bit 4...
842 // s.set(4, in[15] & (! in[18]) & in[33] & (! in[51]));
843
844 // //...Simulate output bit 10...
845 // s.set(10, in[46]);
846
847 //...FTD logic...
848 _ftd(ou, in);
849 bool active = false;
850 for (unsigned i = 0; i < 13; i++) {
851 if (ou[i])
852 active = true;
853 s.set(i, ou[i]);
854 }
855 if (active)
856 s.set(13, true);
857
858 if (TRGDebug::level()) {
859 input.dump("detail", TRGDebug::tab(4) + "GDL in ");
860 s.dump("detail", TRGDebug::tab(4) + "GDL out ");
861 }
862
863 //...Termination...
864 delete[] in;
865 delete[] ou;
866 return s;
867 }

◆ del4MDelA()

CLHEP::HepMatrix del4MDelA ( double  phi,
double  mass 
) const

Mathmatical functions.

Definition at line 671 of file Helix.cc.

672 {
673
674 //
675 // Calculate Jacobian (@4m/@a)
676 // CLHEP::HepVector a is helix parameters and phi is internal parameter.
677 // CLHEP::HepVector 4m is 4 momentum.
678 //
679
680 CLHEP::HepMatrix d4MDA(4, 5, 0);
681
682 double phi0 = m_ac[1];
683 double cpa = m_ac[2];
684 double tnl = m_ac[4];
685
686 double cosf0phi = cos(phi0 + phi);
687 double sinf0phi = sin(phi0 + phi);
688
689 double rho;
690 if (cpa != 0.)rho = 1. / cpa;
691 else rho = (DBL_MAX);
692
693 double charge = 1.;
694 if (cpa < 0.)charge = -1.;
695
696 double E = sqrt(rho * rho * (1. + tnl * tnl) + mass * mass);
697
698 d4MDA[0][1] = -fabs(rho) * cosf0phi;
699 d4MDA[0][2] = charge * rho * rho * sinf0phi;
700
701 d4MDA[1][1] = -fabs(rho) * sinf0phi;
702 d4MDA[1][2] = -charge * rho * rho * cosf0phi;
703
704 d4MDA[2][2] = -charge * rho * rho * tnl;
705 d4MDA[2][4] = fabs(rho);
706
707 if (cpa != 0.0 && E != 0.0) {
708 d4MDA[3][2] = (-1. - tnl * tnl) / (cpa * cpa * cpa * E);
709 d4MDA[3][4] = tnl / (cpa * cpa * E);
710 } else {
711 d4MDA[3][2] = (DBL_MAX);
712 d4MDA[3][4] = (DBL_MAX);
713 }
714 return d4MDA;
715 }
R E
internal precision of FFTW codelets
double m_ac[5]
caches
Definition: Helix.h:232
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44

◆ del4MXDelA()

CLHEP::HepMatrix del4MXDelA ( double  phi,
double  mass 
) const

Mathmatical functions.

Definition at line 719 of file Helix.cc.

720 {
721
722 //
723 // Calculate Jacobian (@4mx/@a)
724 // CLHEP::HepVector a is helix parameters and phi is internal parameter.
725 // CLHEP::HepVector 4xm is 4 momentum and position.
726 //
727
728 CLHEP::HepMatrix d4MXDA(7, 5, 0);
729
730 const double& dr = m_ac[0];
731 const double& phi0 = m_ac[1];
732 const double& cpa = m_ac[2];
733//cnv const double & dz = m_ac[3];
734 const double& tnl = m_ac[4];
735
736 double cosf0phi = cos(phi0 + phi);
737 double sinf0phi = sin(phi0 + phi);
738
739 double rho;
740 if (cpa != 0.)rho = 1. / cpa;
741 else rho = (DBL_MAX);
742
743 double charge = 1.;
744 if (cpa < 0.)charge = -1.;
745
746 double E = sqrt(rho * rho * (1. + tnl * tnl) + mass * mass);
747
748 d4MXDA[0][1] = - fabs(rho) * cosf0phi;
749 d4MXDA[0][2] = charge * rho * rho * sinf0phi;
750
751 d4MXDA[1][1] = - fabs(rho) * sinf0phi;
752 d4MXDA[1][2] = - charge * rho * rho * cosf0phi;
753
754 d4MXDA[2][2] = - charge * rho * rho * tnl;
755 d4MXDA[2][4] = fabs(rho);
756
757 if (cpa != 0.0 && E != 0.0) {
758 d4MXDA[3][2] = (- 1. - tnl * tnl) / (cpa * cpa * cpa * E);
759 d4MXDA[3][4] = tnl / (cpa * cpa * E);
760 } else {
761 d4MXDA[3][2] = (DBL_MAX);
762 d4MXDA[3][4] = (DBL_MAX);
763 }
764
765 d4MXDA[4][0] = m_cp;
766 d4MXDA[4][1] = - dr * m_sp + m_r * (- m_sp + sinf0phi);
767 if (cpa != 0.0) {
768 d4MXDA[4][2] = - (m_r / cpa) * (m_cp - cosf0phi);
769 } else {
770 d4MXDA[4][2] = (DBL_MAX);
771 }
772
773 d4MXDA[5][0] = m_sp;
774 d4MXDA[5][1] = dr * m_cp + m_r * (m_cp - cosf0phi);
775 if (cpa != 0.0) {
776 d4MXDA[5][2] = - (m_r / cpa) * (m_sp - sinf0phi);
777
778 d4MXDA[6][2] = (m_r / cpa) * tnl * phi;
779 } else {
780 d4MXDA[5][2] = (DBL_MAX);
781
782 d4MXDA[6][2] = (DBL_MAX);
783 }
784
785 d4MXDA[6][3] = 1.;
786 d4MXDA[6][4] = - m_r * phi;
787
788 return d4MXDA;
789 }
double m_sp
caches
Definition: Helix.h:226

◆ delApDelA()

CLHEP::HepMatrix delApDelA ( const CLHEP::HepVector &  ap) const

Mathmatical functions.

Definition at line 509 of file Helix.cc.

510 {
511 //
512 // Calculate Jacobian (@ap/@a)
513 // CLHEP::HepVector ap is new helix parameters and a is old helix parameters.
514 //
515
516 CLHEP::HepMatrix dApDA(5, 5, 0);
517
518 const double& dr = m_ac[0];
519 const double& phi0 = m_ac[1];
520 const double& cpa = m_ac[2];
521//cnv const double & dz = m_ac[3];
522 const double& tnl = m_ac[4];
523
524 double drp = ap[0];
525 double phi0p = ap[1];
526//cnv double cpap = ap[2];
527//cnv double dzp = ap[3];
528//cnv double tnlp = ap[4];
529
530 double rdr = m_r + dr;
531 double rdrpr;
532 if ((m_r + drp) != 0.0) {
533 rdrpr = 1. / (m_r + drp);
534 } else {
535 rdrpr = (DBL_MAX);
536 }
537 // double csfd = cos(phi0)*cos(phi0p) + sin(phi0)*sin(phi0p);
538 // double snfd = cos(phi0)*sin(phi0p) - sin(phi0)*cos(phi0p);
539 double csfd = cos(phi0p - phi0);
540 double snfd = sin(phi0p - phi0);
541 double phid = fmod(phi0p - phi0 + M_PI8, M_PI2);
542 if (phid > M_PI) phid = phid - M_PI2;
543
544 dApDA[0][0] = csfd;
545 dApDA[0][1] = rdr * snfd;
546 if (cpa != 0.0) {
547 dApDA[0][2] = (m_r / cpa) * (1.0 - csfd);
548 } else {
549 dApDA[0][2] = (DBL_MAX);
550 }
551
552 dApDA[1][0] = - rdrpr * snfd;
553 dApDA[1][1] = rdr * rdrpr * csfd;
554 if (cpa != 0.0) {
555 dApDA[1][2] = (m_r / cpa) * rdrpr * snfd;
556 } else {
557 dApDA[1][2] = (DBL_MAX);
558 }
559
560 dApDA[2][2] = 1.0;
561
562 dApDA[3][0] = m_r * rdrpr * tnl * snfd;
563 dApDA[3][1] = m_r * tnl * (1.0 - rdr * rdrpr * csfd);
564 if (cpa != 0.0) {
565 dApDA[3][2] = (m_r / cpa) * tnl * (phid - m_r * rdrpr * snfd);
566 } else {
567 dApDA[3][2] = (DBL_MAX);
568 }
569 dApDA[3][3] = 1.0;
570 dApDA[3][4] = - m_r * phid;
571
572 dApDA[4][4] = 1.0;
573
574 return dApDA;
575 }
const double M_PI8
8*PI
Definition: Helix.cc:39
const double M_PI2
2*PI
Definition: Helix.cc:31

◆ delMDelA()

CLHEP::HepMatrix delMDelA ( double  phi) const

Mathmatical functions.

Definition at line 633 of file Helix.cc.

634 {
635 //
636 // Calculate Jacobian (@m/@a)
637 // CLHEP::HepVector a is helix parameters and phi is internal parameter.
638 // CLHEP::HepVector m is momentum.
639 //
640
641 CLHEP::HepMatrix dMDA(3, 5, 0);
642
643 const double& phi0 = m_ac[1];
644 const double& cpa = m_ac[2];
645 const double& tnl = m_ac[4];
646
647 double cosf0phi = cos(phi0 + phi);
648 double sinf0phi = sin(phi0 + phi);
649
650 double rho;
651 if (cpa != 0.)rho = 1. / cpa;
652 else rho = (DBL_MAX);
653
654 double charge = 1.;
655 if (cpa < 0.)charge = -1.;
656
657 dMDA[0][1] = -fabs(rho) * cosf0phi;
658 dMDA[0][2] = charge * rho * rho * sinf0phi;
659
660 dMDA[1][1] = -fabs(rho) * sinf0phi;
661 dMDA[1][2] = -charge * rho * rho * cosf0phi;
662
663 dMDA[2][2] = -charge * rho * rho * tnl;
664 dMDA[2][4] = fabs(rho);
665
666 return dMDA;
667 }

◆ delta_chisq()

double delta_chisq ( double  x,
double  y,
double  w = 1 
) const

const member function for delta chisq

Definition at line 715 of file Lpav.cc.

716 {
717 double sim = similarity(x, y);
718 if (sim < 0) return -1;
719 double d = d0(x, y);
720 double delta = sqr(d) * w / (1 + sim * w);
721 return delta;
722 }
double d(double x, double y) const
const member functions
Definition: Lpar.h:255
double similarity(double, double) const
const member function similarity
Definition: Lpav.cc:575

◆ delXDelA()

CLHEP::HepMatrix delXDelA ( double  phi) const

Mathmatical functions.

Definition at line 578 of file Helix.cc.

579 {
580 //
581 // Calculate Jacobian (@x/@a)
582 // CLHEP::HepVector a is helix parameters and phi is internal parameter
583 // which specifys the point to be calculated for Ex(phi).
584 //
585
586 CLHEP::HepMatrix dXDA(3, 5, 0);
587
588 const double& dr = m_ac[0];
589 const double& phi0 = m_ac[1];
590 const double& cpa = m_ac[2];
591//cnv const double & dz = m_ac[3];
592 const double& tnl = m_ac[4];
593
594 double cosf0phi = cos(phi0 + phi);
595 double sinf0phi = sin(phi0 + phi);
596
597 dXDA[0][0] = m_cp;
598 dXDA[0][1] = - dr * m_sp + m_r * (- m_sp + sinf0phi);
599 if (cpa != 0.0) {
600 dXDA[0][2] = - (m_r / cpa) * (m_cp - cosf0phi);
601 } else {
602 dXDA[0][2] = (DBL_MAX);
603 }
604 // dXDA[0][3] = 0.0;
605 // dXDA[0][4] = 0.0;
606
607 dXDA[1][0] = m_sp;
608 dXDA[1][1] = dr * m_cp + m_r * (m_cp - cosf0phi);
609 if (cpa != 0.0) {
610 dXDA[1][2] = - (m_r / cpa) * (m_sp - sinf0phi);
611 } else {
612 dXDA[1][2] = (DBL_MAX);
613 }
614 // dXDA[1][3] = 0.0;
615 // dXDA[1][4] = 0.0;
616
617 // dXDA[2][0] = 0.0;
618 // dXDA[2][1] = 0.0;
619 if (cpa != 0.0) {
620 dXDA[2][2] = (m_r / cpa) * tnl * phi;
621 } else {
622 dXDA[2][2] = (DBL_MAX);
623 }
624 dXDA[2][3] = 1.0;
625 dXDA[2][4] = - m_r * phi;
626
627 return dXDA;
628 }

◆ direction() [1/3]

CLHEP::Hep3Vector direction ( double  dPhi = 0.) const
inline

returns direction vector after rotating angle dPhi in phi direction.

Definition at line 264 of file Helix.h.

265 {
266 return momentum(phi).unit();
267 }
CLHEP::Hep3Vector momentum(double dPhi=0.) const
returns momentum vector after rotating angle dPhi in phi direction.
Definition: Helix.cc:194

◆ direction() [2/3]

const Vector3D & direction ( void  ) const
inline

returns direction vector of the wire.

Definition at line 358 of file Cell.h.

359 {
360 return _direction;
361 }
const Vector3D _direction
Direction vector.
Definition: Cell.h:184

◆ direction() [3/3]

const HepGeom::Vector3D< double > & direction ( void  ) const
inline

returns vector from entrance to exit point.

Definition at line 121 of file WireHitMC.h.

122 {
123 return _direction;
124 }
HepGeom::Vector3D< double > _direction
direction vector
Definition: WireHitMC.h:81

◆ distance() [1/2]

double distance ( void  ) const
inline

returns distance between point on wire and on track.

Definition at line 609 of file Link.h.

610 {
611 return (_onTrack - _onWire).mag();
612 }

◆ distance() [2/2]

float distance ( void  ) const
inline

returns drift distance.

Definition at line 100 of file WireHitMC.h.

101 {
102 return _distance;
103 }
float _distance
distance
Definition: WireHitMC.h:85

◆ diverge()

bool diverge ( float  xReal,
float  yReal,
float  x0,
float  x1 
) const
overridevirtual

returns true if Y diverges in given region.

Implements TRGCDCHoughTransformation.

Definition at line 62 of file HoughTransformationCircle.cc.

66 {
67 static const float PI2 = 2 * M_PI;
68
69 //...Divergence points...
70 float d0 = atan(- xReal / yReal);
71 if (d0 < 0) d0 += PI2;
72 float d1 = d0 + M_PI;
73 if (d1 > PI2) d1 -= PI2;
74
75 //...In region ?...
76 if ((x0 < d0) && (d0 < x1)) return true;
77 if ((x0 < d1) && (d1 < x1)) return true;
78
79 return false;
80 }
double atan(double a)
atan for double
Definition: beamHelpers.h:34

◆ dldc()

CLHEP::HepMatrix dldc ( ) const
private

private const member functions

Definition at line 130 of file Lpar.cc.

133 {
134#else
135 {
136 CLHEP::HepMatrix vret(3, 4);
137#endif
138 Cpar cp(*this);
139 double xi = cp.xi();
140 double s = cp.sfi();
141 double c = cp.cfi();
142 vret(1, 1) = 2 * cp.da() * s;
143 vret(1, 2) = -2 * cp.da() * c;
144 vret(1, 3) = cp.da() * cp.da();
145 vret(1, 4) = 1;
146 vret(2, 1) = xi * c;
147 vret(2, 2) = xi * s;
148 vret(2, 3) = 0;
149 vret(2, 4) = 0;
150 vret(3, 1) = 2 * cp.cu() * s;
151 vret(3, 2) = -2 * cp.cu() * c;
152 vret(3, 3) = xi;
153 vret(3, 4) = 0;
154 return vret;
155 }
double s(double x, double y) const
const member functions
Definition: Lpar.cc:210

◆ do2DFit()

int do2DFit ( TRGCDCTrack aTrack,
const std::map< std::string, bool > &  m_mBool_in,
const std::map< std::string, double > &  m_mConstD_in,
std::map< std::string, std::vector< double > > &  m_mConstV_in,
std::map< std::string, double > &  m_mDouble_in,
std::map< std::string, std::vector< double > > &  m_mVector_in 
)
static

Does 2D fit. Returns 0 if fit is done successfully. m_mBool should have fIsPrintError, fmcLR, fLRLUT, fmcLR, f2DFit, f2DFitDrift. m_mConstD should have Trg_PI. m_mConstV should have nWires, driftPhi2DError, wirePhi2DError, rr, rr2D.

Definition at line 1259 of file Fitter3D.cc.

1263 {
1264 m_mVector_in["useAxSl"] = vector<double> (5);
1265 //findHitAxialSuperlayers(aTrack, useAxSl, m_mBool_in["fIsPrintError"]);
1266
1267 // Find best TS between links for each SL.
1268 vector<int> bestTSIndex(5);
1269 selectAxialTSs(aTrack, bestTSIndex);
1270 for (unsigned iAx = 0; iAx < 5; iAx++) {
1271 if (bestTSIndex[iAx] != -1) m_mVector_in["useAxSl"][iAx] = 1;
1272 //cout<<"useAxSl["<<iAx<<"]:"<<useAxSl[iAx]<<endl;
1273 }
1274
1275 // Check if number of axial super layer hits is smaller or equal to 1.
1276 m_mDouble_in["nHitAx"] = m_mVector_in["useAxSl"][0] + m_mVector_in["useAxSl"][1] + m_mVector_in["useAxSl"][2] +
1277 m_mVector_in["useAxSl"][3] +
1278 m_mVector_in["useAxSl"][4];
1279 if (m_mDouble_in["nHitAx"] <= 1) {
1280 if (m_mBool_in.at("fVerbose") == 1) cout << "[2DFit] Exiting because nHitAx is " << m_mDouble_in["nHitAx"] << endl;
1281 aTrack.setFitted(0);
1282 return 1;
1283 }
1284
1285 // Fill information for axial layers
1286 m_mVector_in["tsId"] = vector<double> (9);
1287 m_mVector_in["tsId2D"] = vector<double> (5);
1288 m_mVector_in["wirePhi"] = vector<double> (9);
1289 m_mVector_in["lutLR"] = vector<double> (9);
1290 m_mVector_in["LR"] = vector<double> (9);
1291 m_mVector_in["driftLength"] = vector<double> (9);
1292 m_mVector_in["tdc"] = vector<double> (9);
1293 if (!m_mVector_in.count("mcLR")) m_mVector_in["mcLR"] = vector<double> (9);
1294 for (unsigned iAx = 0; iAx < 5; iAx++) {
1295 if (m_mVector_in["useAxSl"][iAx] == 1) {
1296 const vector<TCLink*>& links = aTrack.links(iAx * 2);
1297 //const TCSegment * t_segment = dynamic_cast<const TCSegment *>(& links[0]->hit()->cell());
1298 const TCSegment* t_segment = dynamic_cast<const TCSegment*>(& links[bestTSIndex[iAx]]->hit()->cell());
1299 m_mVector_in["tsId"][iAx * 2] = t_segment->localId();
1300 m_mVector_in["tsId2D"][iAx] = m_mVector_in["tsId"][iAx * 2];
1301 m_mVector_in["wirePhi"][iAx * 2] = (double) t_segment->localId() / m_mConstV_in["nWires"][iAx * 2] * 4 * m_mConstD_in.at("Trg_PI");
1302 m_mVector_in["lutLR"][iAx * 2] = t_segment->LUT()->getValue(t_segment->lutPattern());
1303 // mcLR should be removed.
1304 if (m_mBool_in.at("fMc")) m_mVector_in["mcLR"][iAx * 2] = t_segment->hit()->mcLR() + 1;
1305 m_mVector_in["driftLength"][iAx * 2] = t_segment->hit()->drift();
1306 m_mVector_in["tdc"][iAx * 2] = t_segment->priorityTime();
1307 if (m_mBool_in.at("fmcLR") == 1) m_mVector_in["LR"][iAx * 2] = m_mVector_in["mcLR"][iAx * 2];
1308 else if (m_mBool_in.at("fLRLUT") == 1) m_mVector_in["LR"][iAx * 2] = m_mVector_in["lutLR"][iAx * 2];
1309 else m_mVector_in["LR"][iAx * 2] = 3;
1310 } else {
1311 m_mVector_in["tsId"][iAx * 2] = 9999;
1312 m_mVector_in["wirePhi"][iAx * 2] = 9999;
1313 m_mVector_in["lutLR"][iAx * 2] = 0;
1314 // mcLR should be removed.
1315 if (m_mBool_in.at("fMc")) m_mVector_in["mcLR"][iAx * 2] = 9999;
1316 m_mVector_in["driftLength"][iAx * 2] = 9999;
1317 m_mVector_in["tdc"][iAx * 2] = 9999;
1318 if (m_mBool_in.at("fmcLR") == 1) m_mVector_in["LR"][iAx * 2] = 9999;
1319 else if (m_mBool_in.at("fLRLUT") == 1) m_mVector_in["LR"][iAx * 2] = 9999;
1320 else m_mVector_in["LR"][iAx * 2] = 9999;
1321 }
1322 } // End superlayer loop
1324 //int minTSTdc = 9999;
1325 //for(unsigned iAx=0; iAx<9; iAx++){
1326 // if (minTSTdc > m_mVector_in["tdc"][2*iAx]) minTSTdc = m_mVector_in["tdc"][2*iAx];
1327 //}
1328 //m_mDouble_in["eventTime"] = minTSTdc;
1329
1331 // Get 2D fit values
1332 // Get 2D fit values from IW 2D fitter
1333 m_mDouble_in["phi02D"] = aTrack.helix().phi0();
1334 m_mDouble_in["pt2D"] = aTrack.pt();
1335 if (aTrack.charge() < 0) {
1336 m_mDouble_in["phi02D"] -= m_mConstD_in.at("Trg_PI");
1337 if (m_mDouble_in["phi02D"] < 0) m_mDouble_in["phi02D"] += 2 * m_mConstD_in.at("Trg_PI");
1338 }
1339 m_mDouble_in["dr2D"] = aTrack.helix().dr() * 0.01;
1340 // Get 2D fit values from JB 2D fitter
1341 // Currently using JB fitter for 3D fitting
1342 m_mDouble_in["charge"] = double(aTrack.charge());
1343 // Set phi2DError for 2D fit
1344 m_mVector_in["phi2DError"] = vector<double> (5);
1345 for (unsigned iAx = 0; iAx < 5; iAx++) {
1346 if (m_mVector_in["useAxSl"][iAx] == 1) {
1347 // Check LR.
1348 if (m_mVector_in["LR"][2 * iAx] != 3) m_mVector_in["phi2DError"][iAx] = m_mConstV_in["driftPhi2DError"][iAx];
1349 else m_mVector_in["phi2DError"][iAx] = m_mConstV_in["wirePhi2DError"][iAx];
1350 // Check event time.
1351 if (m_mDouble_in["eventTime"] == 9999) m_mVector_in["phi2DError"][iAx] = m_mConstV_in["wirePhi2DError"][iAx];
1352 } else {
1353 m_mVector_in["phi2DError"][iAx] = 9999;
1354 }
1355 }
1356 // Set invPhi2DError for 2D fit
1357 m_mVector_in["phi2DInvError"] = vector<double> (5);
1358 for (unsigned iAx = 0; iAx < 5; iAx++) {
1359 if (m_mVector_in["useAxSl"][iAx] == 1) {
1360 m_mVector_in["phi2DInvError"][iAx] = 1 / m_mVector_in["phi2DError"][iAx];
1361 } else {
1362 m_mVector_in["phi2DInvError"][iAx] = 0;
1363 }
1364 }
1365 // Calculate phi2D.
1366 m_mVector_in["phi2D"] = vector<double> (5);
1367 if (m_mBool_in.at("f2DFitDrift") == 0 || m_mDouble_in["eventTime"] == 9999) {
1368 for (unsigned iAx = 0; iAx < 5; iAx++) {
1369 m_mVector_in["phi2D"][iAx] = m_mVector_in["wirePhi"][iAx * 2];
1370 }
1371 } else {
1372 for (unsigned iAx = 0; iAx < 5; iAx++) {
1373 if (m_mVector_in["useAxSl"][iAx] == 1) {
1374 // Get drift length from table.
1375 string tableName = "driftLengthTableSL" + to_string(iAx * 2);
1376 double t_driftTime = m_mVector_in["tdc"][iAx * 2] - m_mDouble_in["eventTime"];
1377 if (t_driftTime < 0) t_driftTime = 0;
1378 if (t_driftTime > 511) t_driftTime = 511;
1379 double t_driftLength = m_mConstV_in[tableName][(unsigned)t_driftTime];
1380 m_mVector_in["phi2D"][iAx] = Fitter3DUtility::calPhi(m_mVector_in["wirePhi"][iAx * 2], t_driftLength, m_mConstV_in["rr"][iAx * 2],
1381 m_mVector_in["LR"][iAx * 2]);
1382 } else {
1383 m_mVector_in["phi2D"][iAx] = 9999;
1384 }
1385 }
1386 }
1387 // Fit2D
1388 if (m_mBool_in.at("f2DFit") == 0) {
1389 m_mDouble_in["rho"] = m_mDouble_in["pt2D"] / 0.01 / 1.5 / 0.299792458;
1390 m_mDouble_in["pt"] = 0.299792458 * 1.5 * m_mDouble_in["rho"] / 100;
1391 m_mDouble_in["phi0"] = m_mDouble_in["phi02D"];
1392 m_mDouble_in["fit2DChi2"] = 9999;
1393 } else {
1394 m_mDouble_in["rho"] = 0;
1395 m_mDouble_in["phi0"] = 0;
1396 m_mDouble_in["fit2DChi2"] = 0;
1397 Fitter3DUtility::rPhiFitter(&m_mConstV_in["rr2D"][0], &m_mVector_in["phi2D"][0], &m_mVector_in["phi2DInvError"][0],
1398 m_mDouble_in["rho"],
1399 m_mDouble_in["phi0"], m_mDouble_in["fit2DChi2"]);
1400 m_mDouble_in["pt"] = 0.3 * 1.5 * m_mDouble_in["rho"] / 100;
1401 }
1402
1403 // Find charge of particle.
1404 Fitter3DUtility::chargeFinder(&m_mConstV_in["nTSs2D"][0], &m_mVector_in["tsId2D"][0], &m_mVector_in["useAxSl"][0],
1405 m_mDouble_in["phi0"],
1406 m_mDouble_in["charge"], m_mDouble_in["charge2D"]);
1407
1408 if (m_mBool_in.at("fVerbose")) {
1409 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]f2DFit: " <<
1410 m_mBool_in.at("f2DFit") <<
1411 endl;
1412 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]evtTime: " <<
1413 m_mDouble_in["eventTime"]
1414 << endl;
1415 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]wirePhi: " <<
1416 m_mVector_in["wirePhi"][0]
1417 << " " << m_mVector_in["wirePhi"][1] << " " << m_mVector_in["wirePhi"][2] << " " << m_mVector_in["wirePhi"][3] << " " <<
1418 m_mVector_in["wirePhi"][4] << " " << m_mVector_in["wirePhi"][5] << " " << m_mVector_in["wirePhi"][6] << " " <<
1419 m_mVector_in["wirePhi"][7] << " "
1420 << m_mVector_in["wirePhi"][8] << endl;
1421 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]LR: " << int(
1422 m_mVector_in["LR"][0]) << " " << int(m_mVector_in["LR"][1]) << " " << int(m_mVector_in["LR"][2]) << " " << int(
1423 m_mVector_in["LR"][3]) << " " << int(m_mVector_in["LR"][4]) << " " << int(m_mVector_in["LR"][5]) << " " << int(
1424 m_mVector_in["LR"][6]) << " " << int(m_mVector_in["LR"][7]) << " " << int(m_mVector_in["LR"][8]) << endl;
1425 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]drift: " <<
1426 m_mVector_in["driftLength"][0] << " " << m_mVector_in["driftLength"][1] << " " << m_mVector_in["driftLength"][2] << " " <<
1427 m_mVector_in["driftLength"][3] << " " << m_mVector_in["driftLength"][4] << " " << m_mVector_in["driftLength"][5] << " " <<
1428 m_mVector_in["driftLength"][6] << " " << m_mVector_in["driftLength"][7] << " " << m_mVector_in["driftLength"][8] << endl;
1429 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]tdc: " <<
1430 m_mVector_in["tdc"][0] <<
1431 " " << m_mVector_in["tdc"][1] << " " << m_mVector_in["tdc"][2] << " " << m_mVector_in["tdc"][3] << " " << m_mVector_in["tdc"][4] <<
1432 " " <<
1433 m_mVector_in["tdc"][5] << " " << m_mVector_in["tdc"][6] << " " << m_mVector_in["tdc"][7] << " " << m_mVector_in["tdc"][8] << endl;
1434 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]rr2D: " <<
1435 m_mConstV_in["rr2D"][0] <<
1436 " " << m_mConstV_in["rr2D"][1] << " " << m_mConstV_in["rr2D"][2] << " " << m_mConstV_in["rr2D"][3] << " " << m_mConstV_in["rr2D"][4]
1437 << endl;
1438 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]Phi2D: " <<
1439 m_mVector_in["phi2D"][0]
1440 << " " << m_mVector_in["phi2D"][1] << " " << m_mVector_in["phi2D"][2] << " " << m_mVector_in["phi2D"][3] << " " <<
1441 m_mVector_in["phi2D"][4] <<
1442 endl;
1443 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]Phi2DInvError: " <<
1444 m_mVector_in["phi2DInvError"][0] << " " << m_mVector_in["phi2DInvError"][1] << " " << m_mVector_in["phi2DInvError"][2] << " " <<
1445 m_mVector_in["phi2DInvError"][3] << " " << m_mVector_in["phi2DInvError"][4] << endl;
1446 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]charge: " << int(
1447 m_mDouble_in["charge"]) << endl;
1448 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]charge2D: " << int(
1449 m_mDouble_in["charge2D"]) << endl;
1450 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]pt: " <<
1451 m_mDouble_in["pt"] <<
1452 endl;
1453 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]rho: " <<
1454 m_mDouble_in["rho"] <<
1455 endl;
1456 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]phi0: " <<
1457 m_mDouble_in["phi0"] <<
1458 " " << m_mDouble_in["phi0"] / m_mConstD_in.at("Trg_PI") * 180 << endl;
1459 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]fit2DChi2: " <<
1460 m_mDouble_in["fit2DChi2"]
1461 << endl;
1462 cout << "[E" << int(m_mDouble_in["eventNumber"]) << "][T" << int(m_mDouble_in["trackId"]) << "]useAxSl: " << int(
1463 m_mVector_in["useAxSl"][0]) << " " << int(m_mVector_in["useAxSl"][1]) << " " << int(m_mVector_in["useAxSl"][2]) << " " << int(
1464 m_mVector_in["useAxSl"][3]) << endl;
1465 }
1466
1467 if (std::isnan(m_mDouble_in["rho"]) || std::isnan(m_mDouble_in["phi0"])) {
1468 if (m_mBool_in.at("fVerbose") == 1) cout << "[2Dfit] Exiting because rho or phi0 is nan." << endl;
1469 return 2;
1470 }
1471 return 0;
1472 }
static void rPhiFitter(double *rr, double *phi2, double *invphierror, double &rho, double &myphi0)
A circle fitter with invPhiError without fit chi2 output.
static void chargeFinder(double *nTSs, double *tsIds, double *tsHitmap, double phi0, double inCharge, double &outCharge)
Charge finder using circle fitter output and axial TSs.
static void selectAxialTSs(const TRGCDCTrack &aTrack, std::vector< int > &bestTSIndex)
Selects priority TSs when there are multiple candidate TSs for a superlayer.
Definition: Fitter3D.cc:1204

◆ doFinding()

int doFinding ( std::vector< std::vector< unsigned > >  peaks[],
std::vector< TRGCDCTrack * > &  trackList2D 
)
private

do track finding. (kaiyu version)

Definition at line 800 of file HoughFinder.cc.

802 {
803
804 const string sn = "HoughFinder::doFinding";
806
807 //...Initialization...
808 _plane[0]->clear();
809 _plane[1]->clear();
810
811 //...Voting...
812 unsigned nLayers = _cdc.nAxialSuperLayers();
813 for (unsigned i = 0; i < nLayers; i++) {
814 const vector<const TCSHit*> hits = _cdc.axialSegmentHits(i);
815 for (unsigned j = 0; j < hits.size(); j++) {
816 _plane[0]->vote(i, hits[j]->cell().localId());
817 _plane[1]->vote(i, hits[j]->cell().localId());
818 }
819 }
820 _plane[0]->merge();
821 _plane[1]->merge();
822
823 //...Look for peaks which have 5 hits...
824 _peakFinder.findPeaks(* _plane[0], _peakMin, peaks[0]);
825 _peakFinder.findPeaks(* _plane[1], _peakMin, peaks[1]);
826
827 //...Peak loop to make tracks (no fit, using hough position only)...
828 for (unsigned pm = 0; pm < 2; pm++) {
829 for (unsigned i = 0; i < peaks[pm].size(); i++) {
830 const unsigned peakId = _plane[pm]->serialId(peaks[pm][i][0],
831 peaks[pm][i][1]);
832 TCTrack* t = makeTrack(peakId, pm);
833 trackList2D.push_back(t);
834
835#ifdef TRGCDC_DISPLAY_HOUGH
836 vector<const TCTrack*> cc;
837 cc.push_back(t);
838 const string stg = "doFinding : track made";
839 const string inf = " ";
840 D->clear();
841 D->stage(stg);
842 D->information(inf);
843 D->area().append(cc, Gdk::Color("#FF0066009900"));
844 D->area().append(_cdc.hits());
845 D->area().append(_cdc.segmentHits());
846 D->show();
847 D->run();
848#endif
849 }
850 }
851
853 return 0;
854 }
TRGCDCHoughPlaneMulti2 * _plane[2]
Hough planes, for + and - charges.
Definition: HoughFinder.h:145
const TRGCDC & _cdc
CDCTRG.
Definition: HoughFinder.h:142
TRGCDCPeakFinder _peakFinder
Peak finder.
Definition: HoughFinder.h:154
const unsigned _peakMin
Min. peak height for the peak finder.
Definition: HoughFinder.h:157
std::vector< const TRGCDCSegmentHit * > segmentHits(void) const
returns a list of TRGCDCSegmentHit.
Definition: TRGCDC.h:996
std::vector< const TRGCDCSegmentHit * > axialSegmentHits(unsigned) const
returns a list of TRGCDCSegmentHit in a axial super layer N.
Definition: TRGCDC.h:1014
TRGCDCTrack * makeTrack(const unsigned serialID, const unsigned pm) const
Make a track from serial ID in Hough plane.
unsigned serialId(unsigned x, unsigned y) const
returns serial ID for position (x, y).
void findPeaks(const TRGCDCHoughPlaneMulti2 &hp, const unsigned threshold, std::vector< std::vector< unsigned > > &peaks) const
do peak finding. Kaiyu's version using p1p2Methode.
Definition: PeakFinder.cc:477
unsigned nAxialSuperLayers(void) const
return # of axial super layers.
Definition: TRGCDC.h:891
void merge(void)
Merge layers into one.
std::vector< const TRGCDCWireHit * > hits(void) const
returns a list of TRGCDCWireHit.
Definition: TRGCDC.cc:1705
void vote(float rx, float ry, int charge, unsigned layerId, int weight=1)
Voting.

◆ doFindingAndFitting()

int doFindingAndFitting ( std::vector< TRGCDCTrack * > &  trackList2D,
std::vector< TRGCDCTrack * > &  trackList2DFitted 
)
private

do track finding and fitting (Kaiyu version).

Definition at line 783 of file HoughFinder.cc.

785 {
786
787 const string sn = "HoughFinder::doFindingAndFitting (kaiyu version)";
789
790 vector<vector<unsigned>> peaks[2];
791 doFinding(peaks, trackList2D);
792 doFitting(trackList2D, trackList2DFitted);
793
795
796 return 0;
797 }
int doFitting(std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
do track fitting. (kaiyu original)
Definition: HoughFinder.cc:857
int doFinding(std::vector< std::vector< unsigned > > peaks[], std::vector< TRGCDCTrack * > &trackList2D)
do track finding. (kaiyu version)
Definition: HoughFinder.cc:800

◆ doFindingAndFittingTrasan()

int doFindingAndFittingTrasan ( std::vector< TRGCDCTrack * > &  trackList2D,
std::vector< TRGCDCTrack * > &  trackList2DFitted 
)
private

do track finding and fitting (Trasan version).

Definition at line 766 of file HoughFinder.cc.

768 {
769
770 const string sn = "HoughFinder::doFindingAndFitting (trasan version)";
772
773 vector<unsigned> peaks[2];
774 doFindingTrasan(peaks, trackList2D);
775 doFittingTrasan(peaks, trackList2DFitted);
776
778
779 return 0;
780 }
int doFindingTrasan(std::vector< unsigned > peaks[], std::vector< TRGCDCTrack * > &trackList2D) const
do track finding. (trasan version)
Definition: HoughFinder.cc:196
int doFittingTrasan(std::vector< unsigned > peaks[], std::vector< TRGCDCTrack * > &trackList2DFitted) const
do track fitting. (old trasan version)
Definition: HoughFinder.cc:307

◆ doFindingTrasan()

int doFindingTrasan ( std::vector< unsigned >  peaks[],
std::vector< TRGCDCTrack * > &  trackList2D 
) const
private

do track finding. (trasan version)

Definition at line 196 of file HoughFinder.cc.

198 {
199
200 const string sn = "Hough Finder Finding (trasan version)";
202
203 //...Initialization...
204 _plane[0]->clear();
205 _plane[1]->clear();
206
207 //...Voting...
208 unsigned nLayers = _cdc.nAxialSuperLayers();
209 for (unsigned i = 0; i < nLayers; i++) {
210 const vector<const TCSHit*> hits = _cdc.axialSegmentHits(i);
211 for (unsigned j = 0; j < hits.size(); j++) {
212 _plane[0]->vote(i, hits[j]->cell().localId());
213 _plane[1]->vote(i, hits[j]->cell().localId());
214 }
215 }
216 _plane[0]->merge();
217 _plane[1]->merge();
218
219#ifdef TRGCDC_DISPLAY_HOUGH
220 string stg = "2D : Hough : Results of Peak Finding";
221 string inf = " ";
222 H0->stage(stg);
223 H0->information(inf);
224 H0->clear();
225 H0->area().append(_plane[0]);
226 H0->show();
227 H1->stage(stg);
228 H1->information(inf);
229 H1->clear();
230 H1->area().append(_plane[1]);
231 H1->show();
232#endif
233
234 //...Look for peaks which have 5 hits...
235 _peakFinder.findPeaksTrasan(* _plane[0], _peakMin, false, peaks[0]);
236 _peakFinder.findPeaksTrasan(* _plane[1], _peakMin, false, peaks[1]);
237
238 //...Peak loop to pick up segment hits...
239 // (no fit, using peak position only)
240 for (unsigned pm = 0; pm < 2; pm++) {
241 for (unsigned i = 0; i < peaks[pm].size(); i++) {
242 const unsigned peakId = peaks[pm][i];
243
244 //...Make a track...
245 TCTrack* t = makeTrack(peakId, pm);
246 trackList2D.push_back(t);
247
248#ifdef TRGCDC_DISPLAY_HOUGH
249 vector<const TCTrack*> cc;
250 cc.push_back(t);
251 const string stgNow = "doFinding : track made";
252 const string infNow = " ";
253 D->clear();
254 D->stage(stgNow);
255 D->information(infNow);
256 D->area().append(cc, Gdk::Color("#FF0066009900"));
257 D->area().append(_cdc.hits());
258 D->area().append(_cdc.segmentHits());
259 D->show();
260 D->run();
261#endif
262 }
263 }
264
266 return 0;
267 }
void findPeaksTrasan(TRGCDCHoughPlaneMulti2 &hp, const unsigned threshold, const bool centerIsPeak, std::vector< unsigned > &peakSerialIds) const
do peak finding. This is a copy from "trasan".
Definition: PeakFinder.cc:359

◆ doFitting()

int doFitting ( std::vector< TRGCDCTrack * > &  trackList2D,
std::vector< TRGCDCTrack * > &  trackList2DFitted 
)
private

do track fitting. (kaiyu original)

LUT values

Definition at line 857 of file HoughFinder.cc.

859 {
860
861 const string sn = "Hough Finder Fitting";
863
864 if (_commonData == 0) {
866 }
867
868 //...Event time...
869 bool fEvtTime = true;
870 // cppcheck-suppress knownConditionTrueFalse
871 double eventTime = fEvtTime ? _cdc.getEventTime() : 0;
872
873 // Loop over all tracks
874 for (unsigned int iTrack = 0; iTrack < trackList2D.size(); iTrack++) {
875 TCTrack& aTrack = * new TCTrack(* trackList2D[iTrack]);
876 trackList2DFitted.push_back(& aTrack);
877
878 CDC::CDCGeometryPar& cdcp = CDC::CDCGeometryPar::Instance();
879 vector<double> nWires(9);
880 vector<double> rr(9);
881 vector<double> rr2D;
882 vector<double> wirePhi2DError(5);
883 wirePhi2DError[0] = 0.0085106;
884 wirePhi2DError[1] = 0.0039841;
885 wirePhi2DError[2] = 0.0025806;
886 wirePhi2DError[3] = 0.0019084;
887 wirePhi2DError[4] = 0.001514;
888 vector<double> driftPhi2DError(5);
889 driftPhi2DError[0] = 0.0085106;
890 driftPhi2DError[1] = 0.0039841;
891 driftPhi2DError[2] = 0.0025806;
892 driftPhi2DError[3] = 0.0019084;
893 driftPhi2DError[4] = 0.001514;
894 // Check if all superlayers have one TS
895 bool trackFull = 1;
896 for (unsigned iSL = 0; iSL < _cdc.nSuperLayers(); iSL = iSL + 2) {
897 // Check if all superlayers have one TS
898 const vector<TCLink*>& links = aTrack.links(iSL);
899 const unsigned nSegments = links.size();
900
901 if (TRGDebug::level())
902 cout << TRGDebug::tab() << "#segments in SL" << iSL << " : "
903 << nSegments << endl;
904
905 // Find if there is a TS with a priority hit.
906 // Loop over all TS in same superlayer.
907 bool priorityHitTS = 0;
908 for (unsigned iTS = 0; iTS < nSegments; iTS++) {
909 const TCSegment* _segment = dynamic_cast<const TCSegment*>(& links[iTS]->hit()->cell());
910 if (_segment->center().hit() != 0) priorityHitTS = 1;
911 }
912 if (nSegments != 1) {
913 if (nSegments == 0) {
914 trackFull = 0;
915 if (TRGDebug::level())
916 cout << TRGDebug::tab()
917 << "=> Not enough TS." << endl;
918 } else {
919 if (TRGDebug::level())
920 cout << TRGDebug::tab()
921 << "=> multiple TS are assigned." << endl;
922 }
923 } else {
924 if (priorityHitTS == 0) {
925 trackFull = 0;
926 if (TRGDebug::level())
927 cout << TRGDebug::tab()
928 << "=> There are no priority hit TS" << endl;
929 }
930 }
931 } // End superlayer loop
932 if (trackFull == 0) {
933 TRGCDCHelix helix(ORIGIN, CLHEP::HepVector(5, 0), CLHEP::HepSymMatrix(5, 0));
934 CLHEP::HepVector helixParameters(5);
935 helixParameters = aTrack.helix().a();
936 aTrack.setFitted(0);
937 aTrack.setHelix(helix);
938 continue;
939 }
940
941 for (unsigned iSL = 0; iSL < 9; iSL++) {
942 unsigned _layerId = _cdc.segment(iSL, 0).center().layerId();
943 rr[iSL] = cdcp.senseWireR(_layerId);
944 nWires[iSL] = cdcp.nWiresInLayer(_layerId) * 2;
945 }
946 rr2D = vector<double>({rr[0], rr[2], rr[4], rr[6], rr[8]});
947
948 // Get wirePhi, Drift information
949 vector<double>wirePhi(9);
950 vector<double>driftLength(9);
951 vector<double>LR(9);
952 vector<double>lutLR(9);
953 vector<double>mcLR(9);
954 bool fmcLR = false, fLRLUT = true;
955 for (unsigned iSL = 0; iSL < 9; iSL = iSL + 2) {
956 const vector<TCLink*>& links = aTrack.links(iSL);
957 const TCSegment* _segment = dynamic_cast<const TCSegment*>(& links[0]->hit()->cell());
958 wirePhi[iSL] = _segment->localId() / nWires[iSL] * 4 * M_PI;
959 lutLR[iSL] = _segment->LUT()->getValue(_segment->lutPattern());
960 mcLR[iSL] = _segment->hit()->mcLR();
961 driftLength[iSL] = _segment->hit()->drift();
962 // cppcheck-suppress knownConditionTrueFalse
963 if (fmcLR) LR[iSL] = mcLR[iSL];
964 // cppcheck-suppress knownConditionTrueFalse
965 else if (fLRLUT) LR[iSL] = lutLR[iSL];
966 else LR[iSL] = 3;
967 }//End superlayer loop
968
969 // Get 2D fit values from JB 2D fitter
970 // Set phi2DError for 2D fit
971 vector<double>phi2DError(5);
972 for (unsigned iAx = 0; iAx < 5; iAx++) {
973 if (LR[2 * iAx] != 2) phi2DError[iAx] = driftPhi2DError[iAx];
974 else phi2DError[iAx] = wirePhi2DError[iAx];
975 }
976 // Calculate phi2D using driftTime.
977 vector<double>phi2D(5);
978 for (unsigned iAx = 0; iAx < 5; iAx++) {
979 phi2D[iAx] = Fitter3DUtility::calPhi(wirePhi[iAx * 2],
980 driftLength[iAx * 2],
981 eventTime,
982 rr[iAx * 2],
983 LR[iAx * 2]);
984 if (TRGDebug::level()) {
985 cout << TRGDebug::tab() << "eventTime: " << eventTime << endl;
986 for (int i = 0 ; i < 5 ; i++) {
987 cout << TRGDebug::tab() << "phi2D: : " << phi2D[i] << endl;
988 cout << TRGDebug::tab() << "wirePhi: " << wirePhi[i * 2]
989 << endl;
990 cout << TRGDebug::tab() << "driftLength: " <<
991 driftLength[i * 2] << endl;
992 cout << TRGDebug::tab() << "LR: " << LR[i * 2] << endl;
993 }
994 }
995 }
996 // Fit2D
997 double rho, phi0, pt, chi2;
998 rho = 0;
999 phi0 = 0;
1000 chi2 = 0;
1001 vector<double>phi2DInvError(5);
1002 for (unsigned iAx = 0; iAx < 5; iAx++) {
1003 phi2DInvError[iAx] = 1 / phi2DError[iAx];
1004 }
1005
1006 Fitter3DUtility::rPhiFitter(&rr2D[0], &phi2D[0], &phi2DInvError[0], rho, phi0, chi2); // By JB
1007
1008 pt = 0.3 * 1.5 * rho / 100;
1009
1010 if (TRGDebug::level()) {
1011 cout << TRGDebug::tab() << "rho: " << rho << endl;
1012 cout << TRGDebug::tab() << "pt: " << pt << endl;
1013 }
1014
1015 // update track parameters
1016 TRGCDCHelix helix(ORIGIN, CLHEP::HepVector(5, 0), CLHEP::HepSymMatrix(5, 0));
1017 CLHEP::HepVector a(5);
1018 a = aTrack.helix().a();
1019 a[1] = (aTrack.charge() < 0) ? fmod(phi0 + M_PI, 2 * M_PI) : phi0;
1020 a[2] = 1 / pt * aTrack.charge();
1021 helix.a(a);
1022 aTrack.setFitted(1);
1023 aTrack.setHelix(helix);
1024 aTrack.set2DFitChi2(chi2);
1025
1026 // Change to Signals
1027 {
1029 double rhoMin = 67;
1030 double rhoMax = 1600;
1031 int phiBitSize = 12;
1032 int rhoBitSize = 12;
1033 vector<tuple<string, double, int, double, double, int> > t_values = {
1034 make_tuple("phi_0", phi2D[0], phiBitSize, -2 * M_PI, 2 * M_PI, 0),
1035 make_tuple("phi_1", phi2D[1], phiBitSize, -2 * M_PI, 2 * M_PI, 0),
1036 make_tuple("phi_2", phi2D[2], phiBitSize, -2 * M_PI, 2 * M_PI, 0),
1037 make_tuple("phi_3", phi2D[3], phiBitSize, -2 * M_PI, 2 * M_PI, 0),
1038 make_tuple("phi_4", phi2D[4], phiBitSize, -2 * M_PI, 2 * M_PI, 0),
1039 make_tuple("rho", rho, rhoBitSize, rhoMin, rhoMax, 0),
1040 make_tuple("2Drr_0", rr[0], 12, 18.8, 105.68, 0),
1041 make_tuple("2Drr_1", rr[2], 12, 18.8, 105.68, 0),
1042 make_tuple("2Drr_2", rr[4], 12, 18.8, 105.68, 0),
1043 make_tuple("2Drr_3", rr[6], 12, 18.8, 105.68, 0),
1044 make_tuple("2Drr_4", rr[8], 12, 18.8, 105.68, 0),
1045 };
1047 }
1051 // Name signals only once.
1052 bool updateSecondName = false;
1053 if ((*m_mSignalStorage.begin()).second.getName() == "") {
1054 for (auto it = m_mSignalStorage.begin(); it != m_mSignalStorage.end(); it++) {
1055 (*it).second.setName((*it).first);
1056 }
1057 updateSecondName = true;
1058 }
1059
1060 if (updateSecondName) {
1061 // Print Vhdl
1062 if ((*m_mSignalStorage.begin()).second.getName() != "") {
1063 if (_commonData->getPrintedToFile() == 0) {
1064 if (_commonData->getPrintVhdl() == 0) {
1065 _commonData->setVhdlOutputFile("Fitter2D.vhd");
1067 } else {
1073 // Print LUTs.
1074 for (map<string, TRGCDCJLUT*>::iterator it = m_mLutStorage.begin(); it != m_mLutStorage.end(); ++it) {
1075 it->second->makeCOE(it->first + ".coe");
1076 }
1077 }
1078 }
1079 }
1080 }
1081
1082#ifdef TRGCDC_DISPLAY_HOUGH
1083 vector<const TCTrack*> cc;
1084 cc.push_back(& aTrack);
1085 const string stg = "doFitting : Kaiyu method";
1086 const string inf = " ";
1087 D->clear();
1088 D->stage(stg);
1089 D->information(inf);
1090 D->area().append(_cdc.hits());
1091 D->area().append(_cdc.segmentHits());
1092 D->area().append(cc, Gdk::Color("blue"));
1093 D->show();
1094 D->run();
1095#endif
1096 }
1097
1099
1100 return 0;
1101 }
TRGCDCJSignalData * _commonData
For VHDL code.
Definition: HoughFinder.h:184
std::map< std::string, TRGCDCJLUT * > m_mLutStorage
Map to hold JLuts.
Definition: HoughFinder.h:181
std::map< std::string, TRGCDCJSignal > m_mSignalStorage
Map to hold JSignals.
Definition: HoughFinder.h:178
static void calCosPhi(std::map< std::string, Belle2::TRGCDCJSignal > &mSignalStorage, std::map< std::string, Belle2::TRGCDCJLUT * > &mLutStorage)
Calculate Cos Sin ?
Definition: HoughFinder.cc:412
const TRGCDCWire & center(void) const
returns a center wire.
Definition: Segment.h:265
void printToFile()
Utilities Function to print VHDL code.
Definition: JSignalData.cc:106
static void valuesToMapSignals(std::vector< std::tuple< std::string, double, int, double, double, int > > const &inValues, Belle2::TRGCDCJSignalData *inCommonData, std::map< std::string, Belle2::TRGCDCJSignal > &outMap)
Values => [name, value, bitwidth, min, max, clock] Changes values to signals.
Definition: JSignal.cc:2208
static void calSinPhi(std::map< std::string, Belle2::TRGCDCJSignal > &mSignalStorage, std::map< std::string, Belle2::TRGCDCJLUT * > &mLutStorage)
Calculate Cos Sin ?
Definition: HoughFinder.cc:440
unsigned layerId(void) const
returns layer id.
Definition: Cell.h:214
bool getPrintedToFile() const
Gets the status of m_printedToFile.
Definition: JSignalData.cc:80
unsigned nSuperLayers(void) const
returns # of super layers.
Definition: TRGCDC.h:870
const TRGCDCSegment & segment(unsigned id) const
returns a track segment.
Definition: TRGCDC.h:933
int getEventTime(void) const
returns bad hits(finding invalid hits).
Definition: TRGCDC.cc:2743
static void rPhi(std::map< std::string, Belle2::TRGCDCJSignal > &mSignalStorage, std::map< std::string, Belle2::TRGCDCJLUT * > &mLutStorage)
Calculate r * phi ?
Definition: HoughFinder.cc:467
void entryVhdlCode()
Function to print entry VHDL code.
Definition: JSignalData.cc:195
void signalsVhdlCode()
Function to print definition of signal VHDL code.
Definition: JSignalData.cc:178
void setVhdlOutputFile(const std::string &)
Sets the filename for VHDL output.
Definition: JSignalData.cc:45
const HepGeom::Point3D< double > ORIGIN
Origin 3D point.
void buffersVhdlCode()
Function to print buffer VHDL code.
Definition: JSignalData.cc:150
void setPrintVhdl(bool)
Sets if to print VHDL output.
Definition: JSignalData.cc:50

◆ doFittingTrasan()

int doFittingTrasan ( std::vector< unsigned >  peaks[],
std::vector< TRGCDCTrack * > &  trackList2DFitted 
) const
private

do track fitting. (old trasan version)

Definition at line 307 of file HoughFinder.cc.

309 {
310
311 const string sn = "Hough Finder Fitting (trasan version)";
313
314 //...Peak loop...
315 unsigned nCircles = 0;
316 for (unsigned pm = 0; pm < 2; pm++) {
317 for (unsigned i = 0; i < peaks[pm].size(); i++) {
318 const unsigned peakId = peaks[pm][i];
319
320 //...Get segment hits...
321 vector<TCLink*> links;
322 vector<const TCSegment*> segments;
323 const unsigned nLayers = _plane[pm]->nLayers();
324 for (unsigned j = 0; j < nLayers; j++) {
325 const vector<unsigned>& ptn =
326 _plane[pm]->patternId(j, peakId);
327 for (unsigned k = 0; k < ptn.size(); k++) {
328 const TCSegment& s = _cdc.axialSegment(j, ptn[k]);
329 segments.push_back(& s);
330 if (s.hit()) {
331 TCLink* l = new TCLink(0, s.hit());
332 links.push_back(l);
333 }
334 }
335 }
336
337 //...Select best hits in each layer...
338 const vector<TCLink*> bests = selectBestHits(links);
339
340 //...Make a circle...
341 TCCircle c(bests);
342 c.fit();
343 c.name("CircleFitted_" + TRGUtil::itostring(nCircles));
344 ++nCircles;
345
346 if (TRGDebug::level()) {
347 cout << TRGDebug::tab() << "peak#" << nCircles << ":"
348 << "plane" << pm << ",serialId=" << peakId << endl;
349 cout << TRGDebug::tab() << "segments below" << endl;
350 cout << TRGDebug::tab(4);
351 for (unsigned j = 0; j < segments.size(); j++) {
352 cout << segments[j]->name();
353 if (j != (segments.size() - 1))
354 cout << ",";
355 }
356 cout << endl;
357 cout << TRGDebug::tab() << "best links below" << endl;
358 TCLink::dump(bests, "", TRGDebug::tab(1));
359 c.dump("detail", TRGDebug::tab() + "Circle> ");
360 }
361
362 //...Make a track...
363 TCTrack& t = * new TCTrack(c);
364 t.name("Track_" + TRGUtil::itostring(i));
365 trackList2DFitted.push_back(& t);
366
367 if (TRGDebug::level()) {
368 t.relation().dump("", TRGDebug::tab());
369 t.dump("detail", TRGDebug::tab(1));
370 }
371
372#ifdef TRGCDC_DISPLAY_HOUGH
373 vector<const TCCircle*> cc;
374 cc.push_back(& c);
375 const string stg = "doFitting : trasan method";
376 const string inf = " ";
377 D->clear();
378 D->stage(stg);
379 D->information(inf);
380 D->area().append(_cdc.hits());
381 D->area().append(_cdc.segmentHits());
382 D->area().append(cc, Gdk::Color("blue"));
383 D->show();
384 D->run();
385#endif
386 }
387 }
388
390
391 return 0;
392 }
const std::vector< unsigned > & patternId(unsigned cellId) const
returns pattern ID which activates specified cell.
std::vector< TRGCDCLink * > selectBestHits(const std::vector< TRGCDCLink * > &links) const
selects the best(fastest) hits in each super layer.
Definition: HoughFinder.cc:270
unsigned nLayers(void) const
returns # of Hough Boolean layers.
const TRGCDCSegment & axialSegment(unsigned lyrId, unsigned id) const
returns a track segment in axial layers. (lyrId is axial #)
Definition: TRGCDC.h:940

◆ doit() [1/6]

void doit ( int  ver,
bool  print 
)

Calculate T0 based on ver.

Definition at line 95 of file EventTime.cc.

96 {
97 TRGDebug::enterStage("Event Time");
98 m_eventN += 1;
99 m_ver = ver;
100 if (ver == 1) {
101 oldVer();
102 getT0();
103 } else if (ver == 0) {
104 hitcount();
105 hist();
106 getT0();
107 } else if (ver == 2) {
108 m_histT = 0;
109 m_foundT0 = 1;
110 getT0();
111 } else {
112 cout << "verETF error" << endl;
113 cout << "choose 0:hist, 1:old, 2:trueT0" << endl;
114 }
115 if (print) printFirm();
116 TRGDebug::leaveStage("Event Time");
117 }
int m_eventN
event number
Definition: EventTime.h:100
int m_histT
calculated T0
Definition: EventTime.h:79
bool m_foundT0
T0 is found or not.
Definition: EventTime.h:85
void hist(void)
making hostogram
Definition: EventTime.cc:154
int getT0(void) const
Calculate T0.
Definition: EventTime.cc:242
void oldVer(void)
old version of calculation function
Definition: EventTime.cc:181
void printFirm(void)
Print info in firmware level.
Definition: EventTime.cc:209
void hitcount(void)
hit count of TS
Definition: EventTime.cc:119

◆ doit() [2/6]

void doit ( std::vector< TRGCDCSegment * > &  tss,
const bool  trackSegmentClockSimulation,
std::vector< TRGCDCSegmentHit * > &  segmentHits,
std::vector< TRGCDCSegmentHit * > *  segmentHitsSL 
)

Member functions of doing TSF.

Definition at line 133 of file TrackSegmentFinder.cc.

137 {
138 TRGDebug::enterStage("Track Segment Finder");
139
140 // Saves TS information
141 //saveTSInformation(tss);
142
143 //...Store TS hits...
144 const unsigned n = tss.size();
145 for (unsigned i = 0; i < n; i++) {
146 TCSegment& s = * tss[i];
147 s.simulate(trackSegmentClockSimulation, m_logicLUTFlag,
148 TRGCDC::getTRGCDC()->getCDCHitCollectionName());
149 if (s.signal().active()) {
150 TCSHit* th = new TCSHit(s);
151 s.hit(th);
152 segmentHits.push_back(th);
153 segmentHitsSL[s.layerId()].push_back(th);
154 }
155 }
156
157 // Save TSF results
158 saveTSFResults(segmentHitsSL);
159
160 // Saves NNTS information. Only when ts is hit.
161 //saveNNTSInformation(tss);
162
163 if (TRGDebug::level() > 1) {
164 cout << TRGDebug::tab() << "TS hit list" << endl;
165 string dumpOption = "trigger";
166 if (TRGDebug::level() > 2)
167 dumpOption = "detail";
168 for (unsigned i = 0; i < _cdc.nSegments(); i++) {
169 const TCSegment& s = _cdc.segment(i);
170 if (s.signal().active())
171 s.dump(dumpOption, TRGDebug::tab(4));
172 }
173
174 cout << TRGDebug::tab() << "TS hit list (2)" << endl;
175 if (TRGDebug::level() > 2)
176 dumpOption = "detail";
177 for (unsigned i = 0; i < segmentHits.size(); i++) {
178 const TCSHit& s = * segmentHits[i];
179 s.dump(dumpOption, TRGDebug::tab(4));
180 }
181
182 cout << TRGDebug::tab() << "TS hit list (3)" << endl;
183 if (TRGDebug::level() > 2)
184 dumpOption = "detail";
185 for (unsigned j = 0; j < _cdc.nSuperLayers(); j++) {
186 for (unsigned i = 0; i < segmentHitsSL[j].size(); i++) {
187 const vector<TCSHit*>& s = segmentHitsSL[j];
188 for (unsigned k = 0; k < s.size(); k++)
189 s[k]->dump(dumpOption, TRGDebug::tab(4));
190 }
191 }
192 }
193
194 TRGDebug::leaveStage("Track Segment Finder");
195 }
bool m_logicLUTFlag
0 is Logic. 1 is LUT.
static TRGCDC * getTRGCDC(void)
returns TRGCDC object.
Definition: TRGCDC.cc:192
unsigned nSegments(void) const
returns # of track segments.
Definition: TRGCDC.h:954
void saveTSFResults(std::vector< TRGCDCSegmentHit * > *segmentHitsSL)
save result of TSF

◆ doit() [3/6]

int doit ( std::vector< TRGCDCTrack * > &  trackList)

Does track fitting.

Definition at line 213 of file Fitter3D.cc.

214 {
215
216 TRGDebug::enterStage("Fitter 3D");
217
218 // Set values for saving data.
219 if (m_mBool["fRootFile"]) {
220 m_mDouble["iSave"] = 0;
221 HandleRoot::initializeEvent(m_mTClonesArray);
222 }
223
224 // Get common values for event.
225 m_mDouble["eventTime"] = m_cdc.getEventTime();
226 StoreObjPtr<EventMetaData> eventMetaDataPtr;
227 // Event starts from 0.
228 m_mDouble["eventNumber"] = eventMetaDataPtr->getEvent();
229
230 // Fitter3D
231 // Loop over all tracks
232 for (unsigned iTrack = 0; iTrack < trackList.size(); iTrack++) {
233
234 TCTrack& aTrack = * trackList[iTrack];
235
237 // Get MC values for fitter.
238 if (m_mBool["fMc"]) getMCValues(m_cdc, &aTrack, m_mConstD, m_mDouble, m_mVector);
239 // Get track ID
240 m_mDouble["trackId"] = aTrack.getTrackID();
241
244 int fit2DResult = do2DFit(aTrack, m_mBool, m_mConstD, m_mConstV, m_mDouble, m_mVector);
245 if (fit2DResult != 0) {
246 aTrack.setFitted(0);
247 if (m_mBool["fVerbose"]) cout << "Exit due to 2D fit result:" << fit2DResult << endl;
248 continue;
249 }
250
252 // 3D Fitter
253 // Print input TSs
254 if (m_mBool["fVerbose"]) {
255 for (unsigned iSt = 0; iSt < 4; iSt++) {
256 const vector<TCLink*>& links = aTrack.links(iSt * 2 + 1);
257 const unsigned nSegments = links.size();
258 cout << "iSt:" << iSt << " nSegments:" << nSegments << endl;
259 for (unsigned iTS = 0; iTS < nSegments; iTS++) {
260 const TCSegment* t_segment = dynamic_cast<const TCSegment*>(& links[iTS]->hit()->cell());
261 cout << " tsId:" << t_segment->localId()
262 << " tdc:" << t_segment->priorityTime() << " lr:" << t_segment->LUT()->getValue(t_segment->lutPattern())
263 << " priorityPosition:" << t_segment->priorityPosition() << endl;
264 }
265 }
266 }
267 // Check which stereo super layers should be used.
268 m_mVector["useStSl"] = vector<double> (4);
269 findHitStereoSuperlayers(aTrack, m_mVector["useStSl"], m_mBool["fIsPrintError"]);
271 m_mDouble["nHitStSl"] = m_mVector["useStSl"][0] + m_mVector["useStSl"][1] + m_mVector["useStSl"][2] + m_mVector["useStSl"][3];
272
273 m_mVector["useSl"] = vector<double> (9);
274 for (unsigned iAx = 0; iAx < 5; iAx++) m_mVector["useSl"][2 * iAx] = m_mVector["useAxSl"][iAx];
275 for (unsigned iSt = 0; iSt < 4; iSt++) m_mVector["useSl"][2 * iSt + 1] = m_mVector["useAxSl"][iSt];
276
277 // Fill information for stereo layers
278 for (unsigned iSt = 0; iSt < 4; iSt++) {
279 if (m_mVector["useStSl"][iSt] == 1) {
280 const vector<TCLink*>& links = aTrack.links(iSt * 2 + 1);
281 const TCSegment* t_segment = dynamic_cast<const TCSegment*>(& links[0]->hit()->cell());
282 m_mVector["tsId"][iSt * 2 + 1] = t_segment->localId();
283 m_mVector["wirePhi"][iSt * 2 + 1] = (double) t_segment->localId() / m_mConstV["nWires"][iSt * 2 + 1] * 4 * m_mConstD["Trg_PI"];
284 m_mVector["lutLR"][iSt * 2 + 1] = t_segment->LUT()->getValue(t_segment->lutPattern());
285 if (m_mBool["fMc"]) m_mVector["mcLR"][iSt * 2 + 1] = t_segment->hit()->mcLR() + 1;
286 m_mVector["driftLength"][iSt * 2 + 1] = t_segment->hit()->drift();
287 m_mVector["tdc"][iSt * 2 + 1] = t_segment->priorityTime();
288 if (m_mBool["fmcLR"] == 1) m_mVector["LR"][iSt * 2 + 1] = m_mVector["mcLR"][iSt * 2 + 1];
289 else if (m_mBool["fLRLUT"] == 1) m_mVector["LR"][iSt * 2 + 1] = m_mVector["lutLR"][iSt * 2 + 1];
290 else m_mVector["LR"][iSt * 2 + 1] = 3;
291 } else {
292 m_mVector["tsId"][iSt * 2 + 1] = 9999;
293 m_mVector["wirePhi"][iSt * 2 + 1] = 9999;
294 m_mVector["lutLR"][iSt * 2 + 1] = 0;
295 if (m_mBool["fMc"]) m_mVector["mcLR"][iSt * 2 + 1] = 9999;
296 m_mVector["driftLength"][iSt * 2 + 1] = 9999;
297 m_mVector["tdc"][iSt * 2 + 1] = 9999;
298 if (m_mBool["fmcLR"] == 1) m_mVector["LR"][iSt * 2 + 1] = 9999;
299 else if (m_mBool["fLRLUT"] == 1) m_mVector["LR"][iSt * 2 + 1] = 9999;
300 else m_mVector["LR"][iSt * 2 + 1] = 9999;
301 }
302 } // End superlayer loop
303
304 // Calculate phi3D.
305 m_mVector["phi3D"] = vector<double> (4);
306 if (m_mDouble["eventTime"] == 9999) {
307 for (unsigned iSt = 0; iSt < 4; iSt++) {
308 m_mVector["phi3D"][iSt] = m_mVector["wirePhi"][iSt * 2 + 1];
309 }
310 } else {
311 for (unsigned iSt = 0; iSt < 4; iSt++) {
312 if (m_mVector["useStSl"][iSt] == 1) {
313 // Get drift length from table.
314 string tableName = "driftLengthTableSL" + to_string(iSt * 2 + 1);
315 double t_driftTime = m_mVector["tdc"][iSt * 2 + 1] - m_mDouble["eventTime"];
316 if (t_driftTime < 0) t_driftTime = 0;
317 double t_driftLength = m_mConstV[tableName][(unsigned)t_driftTime];
318 m_mVector["phi3D"][iSt] = Fitter3DUtility::calPhi(m_mVector["wirePhi"][iSt * 2 + 1], t_driftLength, m_mConstV["rr3D"][iSt],
319 m_mVector["LR"][iSt * 2 + 1]);
320 } else {
321 m_mVector["phi3D"][iSt] = 9999;
322 }
323 }
324 }
325 // Get zerror for 3D fit
326 m_mVector["zError"] = vector<double> (4);
327 for (unsigned iSt = 0; iSt < 4; iSt++) {
328 if (m_mVector["useStSl"][iSt] == 1) {
329 // Check LR.
330 if (m_mVector["LR"][2 * iSt + 1] != 3) m_mVector["zError"][iSt] = m_mConstV["driftZError"][iSt];
331 else m_mVector["zError"][iSt] = m_mConstV["wireZError"][iSt];
332 // Check eventTime
333 if (m_mDouble["eventTime"] == 9999) m_mVector["zError"][iSt] = m_mConstV["wireZError"][iSt];
334 } else {
335 m_mVector["zError"][iSt] = 9999;
336 }
337 }
338 // Get inverse zerror ^ 2
339 m_mVector["iZError2"] = vector<double> (4);
340 for (unsigned iSt = 0; iSt < 4; iSt++) {
341 if (m_mVector["useStSl"][iSt] == 1) {
342 m_mVector["iZError2"][iSt] = 1 / pow(m_mVector["zError"][iSt], 2);
343 } else {
344 m_mVector["iZError2"][iSt] = 0;
345 }
346 }
347
348 // Calculate zz
349 m_mVector["zz"] = vector<double> (4);
350 for (unsigned iSt = 0; iSt < 4; iSt++) {
351 if (m_mVector["useStSl"][iSt] == 1) {
352 //m_mVector["zz"][iSt] = Fitter3DUtility::calZ(m_mDouble["charge"], m_mConstV["angleSt"][iSt], m_mConstV["zToStraw"][iSt], m_mConstV["rr3D"][iSt], m_mVector["phi3D"][iSt], m_mDouble["rho"], m_mDouble["phi0"]);
353 m_mVector["zz"][iSt] = Fitter3DUtility::calZ(m_mDouble["charge2D"], m_mConstV["angleSt"][iSt], m_mConstV["zToStraw"][iSt],
354 m_mConstV["rr3D"][iSt], m_mVector["phi3D"][iSt], m_mDouble["rho"], m_mDouble["phi0"]);
355 } else {
356 m_mVector["zz"][iSt] = 0;
357 }
358 }
359 // Calculate arcS
360 m_mVector["arcS"] = vector<double> (4);
361 for (unsigned iSt = 0; iSt < 4; iSt++) {
362 if (m_mVector["useStSl"][iSt] == 1) {
363 m_mVector["arcS"][iSt] = Fitter3DUtility::calS(m_mDouble["rho"], m_mConstV["rr3D"][iSt]);
364 } else {
365 m_mVector["arcS"][iSt] = 0;
366 }
367 }
368 // Fit3D
369 m_mDouble["z0"] = 0;
370 m_mDouble["cot"] = 0;
371 m_mDouble["zChi2"] = 0;
372 Fitter3DUtility::rSFit(&m_mVector["iZError2"][0], &m_mVector["arcS"][0], &m_mVector["zz"][0], m_mDouble["z0"], m_mDouble["cot"],
373 m_mDouble["zChi2"]);
374 // Change to deg
375 m_mDouble["theta"] = m_mConstD["Trg_PI"] / 2 - atan(m_mDouble["cot"]);
376 m_mDouble["theta"] = 180 / m_mConstD["Trg_PI"];
377
378 if (m_mBool["fVerbose"]) print3DInformation(iTrack);
379
380 // For failed fits. When cot is 0 or nan.
381 if (m_mDouble["cot"] == 0 || std::isnan(m_mDouble["cot"])) {
382 aTrack.setFitted(0);
383 aTrack.setDebugValue(TRGCDCTrack::EDebugValueType::fit3D, 1);
384 if (m_mBool["fVerbose"]) cout << "Exit due to 3D fit cot result:" << m_mDouble["cot"] << endl;
385 continue;
386 }
387
388 // Set track in trackList
389 if (m_mBool["fVerbose"]) cout << "Fit was done successfully." << endl;
390 // Set Helix parameters
391 TRGCDCHelix helix(ORIGIN, CLHEP::HepVector(5, 0), CLHEP::HepSymMatrix(5, 0));
392 CLHEP::HepVector a(5);
393 a = aTrack.helix().a();
394 aTrack.setFitted(1);
395 //if(m_mDouble["charge"]<0)
396 if (m_mDouble["charge2D"] < 0) {
397 a[1] = fmod(m_mDouble["phi0"] + m_mConstD["Trg_PI"], 2 * m_mConstD["Trg_PI"]);
398 } else {
399 a[1] = m_mDouble["phi0"];
400 }
401 //a[2] = 1/m_mDouble["pt"]*m_mDouble["charge"];
402 a[2] = 1 / m_mDouble["pt"] * m_mDouble["charge2D"];
403 a[3] = m_mDouble["z0"];
404 a[4] = m_mDouble["cot"];
405 helix.a(a);
406 aTrack.set2DFitChi2(m_mDouble["fit2DChi2"]);
407 aTrack.set3DFitChi2(m_mDouble["zChi2"]);
408 aTrack.setHelix(helix);
409
411 // Save values
412 if (m_mBool["fRootFile"]) {
413 if (m_fileFitter3D == 0) {
414 m_fileFitter3D = new TFile(m_rootFitter3DFileName.c_str(), "RECREATE");
415 HandleRoot::initializeRoot("fitter3D", &m_treeConstantsFitter3D, &m_treeTrackFitter3D,
419 );
420 }
421 HandleRoot::saveTrackValues("fitter3D",
423 );
424 }
425
426 } // End track loop
427
428 // Save values to file
429 // To prevent crash when there are no tracks in first event.
430 // If there is no track in first case then the ROOT saving functions might fail.
431 // This is due to bad software design.
432 // The first event that have tracks will be event 0 in ROOT file.
433 if (m_mBool["fRootFile"]) {
434 if (m_fileFitter3D != 0) m_treeTrackFitter3D->Fill();
435 }
436
437 if (m_mBool["debugFitted"]) {
438 for (unsigned iTrack = 0; iTrack < trackList.size(); iTrack++) {
439 TCTrack& aTrack = * trackList[iTrack];
440 if (aTrack.fitted() == 0) aTrack.setDebugValue(TRGCDCTrack::EDebugValueType::fit3D, 1);
441 }
442 }
443 if (m_mBool["debugLargeZ0"]) {
444 // If 3D fit z0 is larger or smaller than expected.
445 for (unsigned iTrack = 0; iTrack < trackList.size(); iTrack++) {
446 TCTrack& aTrack = *trackList[iTrack];
447 if (aTrack.fitted()) {
448 double fitZ0 = aTrack.helix().dz();
449 if (fitZ0 > 20 || fitZ0 < -20) aTrack.setDebugValue(TRGCDCTrack::EDebugValueType::fit3D, 1);
450 }
451 }
452 }
453
454
455 TRGDebug::leaveStage("Fitter 3D");
456 return 1;
457
458 }
std::map< std::string, TVectorD * > m_mTVectorD
TVectorD map for saving values to root file.
Definition: Fitter3D.h:159
std::map< std::string, std::vector< double > > m_mVector
Map to hold vector values for Fitter3D.
Definition: Fitter3D.h:131
std::map< std::string, bool > m_mBool
Map to hold input options.
Definition: Fitter3D.h:137
std::map< std::string, double > m_mConstD
Map to hold constant values for Fitter3D.
Definition: Fitter3D.h:133
std::map< std::string, std::vector< double > > m_mConstV
Map to hold constant vectcors for Fitter3D.
Definition: Fitter3D.h:135
std::map< std::string, double > m_mDouble
Map to hold double values for Fitter3D.
Definition: Fitter3D.h:129
std::map< std::string, TClonesArray * > m_mTClonesArray
TClonesArray map for saving values to root file.
Definition: Fitter3D.h:161
TFile * m_fileFitter3D
Tfile for Fitter3D root file.
Definition: Fitter3D.h:150
TTree * m_treeTrackFitter3D
TTree for tracks of fitter3D.
Definition: Fitter3D.h:153
TTree * m_treeConstantsFitter3D
TTree for constants of fitter3D.
Definition: Fitter3D.h:156
std::string m_rootFitter3DFileName
Members for saving.
Definition: Fitter3D.h:147
const TRGCDC & m_cdc
CDCTRG.
Definition: Fitter3D.h:126
static double calZ(int charge, double anglest, double ztostraw, double rr, double phi, double rho, double phi0)
Calculates z.
static double calS(double rho, double rr)
Calculates arc length.
static void rSFit(double *iezz2, double *arcS, double *zz, double &z0, double &cot, double &zchi2)
3D fitter functions Fits z and arc S.
void removeImpossibleStereoSuperlayers(std::vector< double > &useStSL)
Removes TSs that are not possible with track Pt.
Definition: Fitter3D.cc:1193
void print3DInformation(int iTrack)
Print's information for debugging 3D.
Definition: Fitter3D.cc:1474
static void findHitStereoSuperlayers(const TRGCDCTrack &aTrack, std::vector< double > &useStSL, bool printError)
Finds which stereo superlayers has TSs. useStSL array indicating hit superlayers.
Definition: Fitter3D.cc:1164
static int do2DFit(TRGCDCTrack &aTrack, const std::map< std::string, bool > &m_mBool_in, const std::map< std::string, double > &m_mConstD_in, std::map< std::string, std::vector< double > > &m_mConstV_in, std::map< std::string, double > &m_mDouble_in, std::map< std::string, std::vector< double > > &m_mVector_in)
Does 2D fit. Returns 0 if fit is done successfully. m_mBool should have fIsPrintError,...
Definition: Fitter3D.cc:1259
static void getMCValues(const TRGCDC &m_cdc_in, TRGCDCTrack *aTrack, const std::map< std::string, double > &m_mConstD_in, std::map< std::string, double > &m_mDouble_in, std::map< std::string, std::vector< double > > &m_mVector_in)
Function for mc debugging.
Definition: Fitter3D.cc:963

◆ doit() [4/6]

void doit ( std::vector< TRGCDCTrack * > &  trackList)

Finds tracks using tracklist. Has parameter to choose between perfect and original finder.

Definition at line 230 of file Hough3DFinder.cc.

231 {
232
233 // Assign track ID's.
234 for (unsigned iTrack = 0; iTrack < trackList.size(); iTrack++) {
235 TCTrack& aTrack = *trackList[iTrack];
236 aTrack.setTrackID(iTrack + 1);
237 }
238
239 if (m_finderMode == 0) doitPerfectly(trackList);
240 if (m_finderMode != 0) doitFind(trackList);
241
242 }
int m_finderMode
0: perfect finder, 1: Hough3DFinder, 2: GeoFinder, 3: VHDL GeoFinder Choose what finder to use.
Definition: Hough3DFinder.h:71
void doitPerfectly(std::vector< TRGCDCTrack * > &trackList)
Perfect 3D finder for a tracklist.
void doitFind(std::vector< TRGCDCTrack * > &trackList)
Finds tracks using tracklist.

◆ doit() [5/6]

int doit ( std::vector< TRGCDCTrack * > &  trackListClone,
std::vector< TRGCDCTrack * > &  trackList 
)

do track finding.

Definition at line 65 of file PerfectFinder.cc.

66 {
67 int result = doitPerfectly(trackList);
68 trackListClone = trackList;
69 return result;
70 }
int doitPerfectly(std::vector< TRGCDCTrack * > &trackList)
do perfect finding.

◆ doit() [6/6]

void doit ( std::vector< TRGCDCTrack * > const &  trackList2D,
std::vector< TRGCDCTrack * > &  trackList3D 
)

Member functions.

Finds tracks using tracklist2D and outputs to trackList3D. Has parameter to choose between perfect and original finder.

Definition at line 220 of file Hough3DFinder.cc.

221 {
222 // Loop over trackList2D and copy to make a new trackList3D. Will delete it at TRGCDC.cc.
223 for (unsigned int iTrack = 0; iTrack < trackList2D.size(); iTrack++) {
224 TCTrack& aTrack = * new TCTrack(* trackList2D[iTrack]);
225 trackList3D.push_back(& aTrack);
226 }
227 doit(trackList3D);
228 }
void doit(std::vector< TRGCDCTrack * > const &trackList2D, std::vector< TRGCDCTrack * > &trackList3D)
Member functions.

◆ doitComplex()

int doitComplex ( std::vector< TRGCDCTrack * > &  trackList)

Does track fitting using JSignals.

Definition at line 460 of file Fitter3D.cc.

461 {
462
463 TRGDebug::enterStage("Fitter 3D");
464
465 // Set values for saving data.
466 if (m_mBool["fRootFile"]) {
467 m_mDouble["iSave"] = 0;
468 HandleRoot::initializeEvent(m_mTClonesArray);
469 }
470 if (m_commonData == 0) {
472 }
473
474 // Get common values for event.
475 m_mDouble["eventTime"] = m_cdc.getEventTime();
476 StoreObjPtr<EventMetaData> eventMetaDataPtr;
477 // Event starts from 0.
478 m_mDouble["eventNumber"] = eventMetaDataPtr->getEvent();
479
480 // Fitter3D
481 // Loop over all tracks
482 for (unsigned iTrack = 0; iTrack < trackList.size(); iTrack++) {
483
484 TCTrack& aTrack = * trackList[iTrack];
485
487 // Get MC values for 3D fitter
488 if (m_mBool["fMc"]) getMCValues(m_cdc, &aTrack, m_mConstD, m_mDouble, m_mVector);
489 // Get input values for 3D fitter
490 // Get event and track ID
491 m_mDouble["trackId"] = aTrack.getTrackID();
492
495 int fit2DResult = do2DFit(aTrack, m_mBool, m_mConstD, m_mConstV, m_mDouble, m_mVector);
496 if (fit2DResult != 0) {
497 aTrack.setFitted(0);
498 continue;
499 }
500
502 // Start of 3D fitter
503 // Print input TSs
504 if (m_mBool["fVerbose"]) {
505 for (unsigned iSt = 0; iSt < 4; iSt++) {
506 const vector<TCLink*>& links = aTrack.links(iSt * 2 + 1);
507 const unsigned nSegments = links.size();
508 cout << "iSt:" << iSt << " nSegments:" << nSegments << endl;
509 for (unsigned iTS = 0; iTS < nSegments; iTS++) {
510 const TCSegment* t_segment = dynamic_cast<const TCSegment*>(& links[iTS]->hit()->cell());
511 cout << " tsId:" << t_segment->localId()
512 << " tdc:" << t_segment->priorityTime() << " lr:" << t_segment->LUT()->getValue(t_segment->lutPattern())
513 << " priorityPosition:" << t_segment->priorityPosition() << endl;
514 }
515 }
516 }
517 m_mVector["useStSl"] = vector<double> (4);
518 findHitStereoSuperlayers(aTrack, m_mVector["useStSl"], m_mBool["fIsPrintError"]);
520 m_mDouble["nHitStSl"] = m_mVector["useStSl"][0] + m_mVector["useStSl"][1] + m_mVector["useStSl"][2] + m_mVector["useStSl"][3];
521
522 // Fill information for stereo layers
523 for (unsigned iSt = 0; iSt < 4; iSt++) {
524 if (m_mVector["useStSl"][iSt] == 1) {
525 const vector<TCLink*>& links = aTrack.links(iSt * 2 + 1);
526 const TCSegment* t_segment = dynamic_cast<const TCSegment*>(& links[0]->hit()->cell());
527 m_mVector["tsId"][iSt * 2 + 1] = t_segment->localId();
528 m_mVector["wirePhi"][iSt * 2 + 1] = (double) t_segment->localId() / m_mConstV["nWires"][iSt * 2 + 1] * 4 * m_mConstD["Trg_PI"];
529 m_mVector["lutLR"][iSt * 2 + 1] = t_segment->LUT()->getValue(t_segment->lutPattern());
530 if (m_mBool["fMc"]) m_mVector["mcLR"][iSt * 2 + 1] = t_segment->hit()->mcLR() + 1;
531 m_mVector["driftLength"][iSt * 2 + 1] = t_segment->hit()->drift();
532 m_mVector["tdc"][iSt * 2 + 1] = t_segment->priorityTime();
533 if (m_mBool["fmcLR"] == 1) m_mVector["LR"][iSt * 2 + 1] = m_mVector["mcLR"][iSt * 2 + 1];
534 else if (m_mBool["fLRLUT"] == 1) m_mVector["LR"][iSt * 2 + 1] = m_mVector["lutLR"][iSt * 2 + 1];
535 else m_mVector["LR"][iSt * 2 + 1] = 3;
536 } else {
537 m_mVector["tsId"][iSt * 2 + 1] = 0;
538 m_mVector["wirePhi"][iSt * 2 + 1] = 9999;
539 m_mVector["lutLR"][iSt * 2 + 1] = 0;
540 if (m_mBool["fMc"]) m_mVector["mcLR"][iSt * 2 + 1] = 9999;
541 m_mVector["driftLength"][iSt * 2 + 1] = 9999;
542 m_mVector["tdc"][iSt * 2 + 1] = 0;
543 if (m_mBool["fmcLR"] == 1) m_mVector["LR"][iSt * 2 + 1] = 9999;
544 else if (m_mBool["fLRLUT"] == 1) m_mVector["LR"][iSt * 2 + 1] = 9999;
545 else m_mVector["LR"][iSt * 2 + 1] = 9999;
546 }
547 } // End superlayer loop
549 //int minTSTdc = 9999;
550 //for(unsigned iSl=0; iSl<9; iSl++){
551 // if (minTSTdc > m_mVector["tdc"][iSl]) minTSTdc = m_mVector["tdc"][iSl];
552 //}
553 //m_mDouble["eventTime"] = minTSTdc;
554
555 // Calculate phi3D.
556 m_mVector["phi3D"] = vector<double> (4);
557 if (m_mDouble["eventTime"] == 9999) {
558 for (unsigned iSt = 0; iSt < 4; iSt++) {
559 m_mVector["phi3D"][iSt] = m_mVector["wirePhi"][iSt * 2 + 1];
560 }
561 } else {
562 for (unsigned iSt = 0; iSt < 4; iSt++) {
563 // Get drift length from table.
564 string tableName = "driftLengthTableSL" + to_string(iSt * 2 + 1);
565 double t_driftTime = m_mVector["tdc"][iSt * 2 + 1] - m_mDouble["eventTime"];
566 if (t_driftTime < 0) t_driftTime = 0;
567 double t_driftLength = m_mConstV[tableName][(unsigned)t_driftTime];
568 m_mVector["phi3D"][iSt] = Fitter3DUtility::calPhi(m_mVector["wirePhi"][iSt * 2 + 1], t_driftLength, m_mConstV["rr3D"][iSt],
569 m_mVector["LR"][iSt * 2 + 1]);
570 }
571 }
572
573 // Get zerror for 3D fit
574 m_mVector["zError"] = vector<double> (4);
575 for (unsigned iSt = 0; iSt < 4; iSt++) {
576 // Check LR.
577 if (m_mVector["LR"][2 * iSt + 1] != 3) m_mVector["zError"][iSt] = m_mConstV["driftZError"][iSt];
578 else m_mVector["zError"][iSt] = m_mConstV["wireZError"][iSt];
579 // Check eventTime
580 if (m_mDouble["eventTime"] == 9999) m_mVector["zError"][iSt] = m_mConstV["wireZError"][iSt];
581 }
582 // Get inverse zerror ^ 2
583 m_mVector["iZError2"] = vector<double> (4);
584 for (unsigned iSt = 0; iSt < 4; iSt++) {
585 if (m_mVector["useStSl"][iSt] == 1) {
586 m_mVector["iZError2"][iSt] = 1 / pow(m_mVector["zError"][iSt], 2);
587 } else {
588 m_mVector["iZError2"][iSt] = 0;
589 }
590 }
591
592 // Simple version of Fitter3D
594 //m_mVector["zz"] = vector<double> (4);
595 //for (unsigned iSt = 0; iSt < 4; iSt++) m_mVector["zz"][iSt] = Fitter3DUtility::calZ(m_mDouble["charge"], m_mConstV["angleSt"][iSt], m_mConstV["zToStraw"][iSt], m_mConstV["rr3D"][iSt], m_mVector["phi3D"][iSt], m_mDouble["rho"], m_mDouble["phi0"]);
597 //m_mVector["arcS"] = vector<double> (4);
598 //for (unsigned iSt = 0; iSt < 4; iSt++) m_mVector["arcS"][iSt] = Fitter3DUtility::calS(m_mDouble["rho"], m_mConstV["rr3D"][iSt]);
600 //m_mDouble["z0"] = 0;
601 //m_mDouble["cot"] = 0;
602 //m_mDouble["zChi2"] = 0;
603 //Fitter3DUtility::rSFit(&m_mVector["iZError2"][0], &m_mVector["arcS"][0], &m_mVector["zz"][0], m_mDouble["z0"], m_mDouble["cot"], m_mDouble["zChi2"]);
605 //m_mDouble["theta"] = m_mConstD["Trg_PI"]/2 - atan(m_mDouble["cot"]);
606 //m_mDouble["theta"] = 180 / m_mConstD["Trg_PI"];
607
608 double phiMax = m_mConstD["Trg_PI"];
609 double phiMin = -m_mConstD["Trg_PI"];
610 int phiBitSize = 13;
611 // pt = 0.3*1.5*rho*0.01;
612 //double rhoMin = 48;
613 /* cppcheck-suppress variableScope */
614 double rhoMin = 20;
615 double rhoMax = 2500;
616 //double rhoMax = 1600;
617 // 5bit (clock counter) + 4 bit (2ns resolution)
618 m_mConstD["tdcBitSize"] = 9;
619 m_mConstD["rhoBitSize"] = 11;
620 m_mConstD["iError2BitSize"] = 8;
621 m_mConstD["iError2Max"] = 1 / pow(m_mConstV["wireZError"][0], 2);
622 // LUT values
623 m_mConstD["JB"] = 0;
624 m_mConstD["driftPhiLUTOutBitSize"] = phiBitSize - 1;
625 m_mConstD["driftPhiLUTInBitSize"] = m_mConstD["tdcBitSize"];
626 m_mConstD["acosLUTOutBitSize"] = phiBitSize - 1;
627 m_mConstD["acosLUTInBitSize"] = m_mConstD["rhoBitSize"];
628 m_mConstD["zLUTInBitSize"] = phiBitSize;
629 m_mConstD["zLUTOutBitSize"] = 9;
630 m_mConstD["iDenLUTInBitSize"] = 13;
631 m_mConstD["iDenLUTOutBitSize"] = 11; // To increase wireZError = 2.5*driftZError
632 // Rotate by quadrants depending on charge and cc(circle center)
633 m_mDouble["relRefPhi"] = 0;
634 int t_quadrant = Fitter3DUtility::findQuadrant(m_mDouble["phi0"]);
635 //if (m_mDouble["charge"] == -1)
636 if (m_mDouble["charge2D"] == -1) {
637 if (t_quadrant == 1) m_mDouble["relRefPhi"] = 0;
638 else if (t_quadrant == 2) m_mDouble["relRefPhi"] = -m_mConstD["Trg_PI"] / 2;
639 else if (t_quadrant == 3) m_mDouble["relRefPhi"] = -m_mConstD["Trg_PI"];
640 else if (t_quadrant == 4) m_mDouble["relRefPhi"] = m_mConstD["Trg_PI"] / 2;
641 } else {
642 if (t_quadrant == 1) m_mDouble["relRefPhi"] = m_mConstD["Trg_PI"] / 2;
643 else if (t_quadrant == 2) m_mDouble["relRefPhi"] = 0;
644 else if (t_quadrant == 3) m_mDouble["relRefPhi"] = -m_mConstD["Trg_PI"] / 2;
645 else if (t_quadrant == 4) m_mDouble["relRefPhi"] = -m_mConstD["Trg_PI"];
646 }
647 // Rotate phi
648 m_mDouble["relPhi0"] = Fitter3DUtility::rotatePhi(m_mDouble["phi0"], m_mDouble["relRefPhi"]);
649 m_mVector["relPhi3D"] = vector<double> (4);
650 for (unsigned iSt = 0; iSt < 4;
651 iSt++) m_mVector["relPhi3D"][iSt] = Fitter3DUtility::rotatePhi(m_mVector["phi3D"][iSt], m_mDouble["relRefPhi"]);
652
653 // Rotate wirePhi
654 m_mVector["relWirePhi3D"] = vector<double> (4);
655 for (unsigned iSt = 0; iSt < 4; iSt++) {
656 double t_relWirePhi = Fitter3DUtility::rotatePhi(m_mVector["wirePhi"][2 * iSt + 1], m_mDouble["relRefPhi"]);
657 bool rangeOk = 0;
658 while (rangeOk == 0) {
659 if (t_relWirePhi < 0) t_relWirePhi += 2 * m_mConstD["Trg_PI"];
660 else if (t_relWirePhi > 2 * m_mConstD["Trg_PI"]) t_relWirePhi -= 2 * m_mConstD["Trg_PI"];
661 else rangeOk = 1;
662 }
663 m_mVector["relWirePhi3D"][iSt] = t_relWirePhi;
664 }
665
666 // Rotate tsId
667 m_mVector["relTsId3D"] = vector<double> (4);
668 for (unsigned iSt = 0; iSt < 4;
669 iSt++) m_mVector["relTsId3D"][iSt] = Fitter3DUtility::rotateTsId(m_mVector["tsId"][2 * iSt + 1],
670 m_mDouble["relRefPhi"] / m_mConstD["Trg_PI"] / 2 * m_mConstV["nTSs"][2 * iSt + 1], m_mConstV["nTSs"][2 * iSt + 1]);
671
672 // Constrain rho to rhoMax. For removing warnings when changing to signals.
673 if (m_mDouble["rho"] > rhoMax) {
674 m_mDouble["rho"] = rhoMax;
675 m_mDouble["pt"] = rhoMax * 0.3 * 1.5 * 0.01;
676 }
677
678 // Constrain event time
679 m_mDouble["eventTimeValid"] = 1;
680 if (m_mDouble["eventTime"] == 9999) m_mDouble["eventTimeValid"] = 0;
681 // Change tdc and eventTime to 9 bit unsigned value. (Ex: -1 => 511, -2 => 510)
682 m_mVector["unsignedTdc"] = vector<double> (9);
683 for (unsigned iSt = 0; iSt < 4; iSt++) {
684 //cout<<"iSt:"<<iSt<<" tdc:"<<m_mVector["tdc"][2*iSt+1]<<" unsignedTdc:"<<Fitter3DUtility::toUnsignedTdc(m_mVector["tdc"][2*iSt+1], 9)<<endl;
685 m_mVector["unsignedTdc"][2 * iSt + 1] = Fitter3DUtility::toUnsignedTdc(m_mVector["tdc"][2 * iSt + 1], m_mConstD["tdcBitSize"]);
686 }
687 m_mDouble["unsignedEventTime"] = Fitter3DUtility::toUnsignedTdc(m_mDouble["eventTime"], m_mConstD["tdcBitSize"]);
688 //cout<<"eventTime:"<<m_mDouble["eventTime"]<<" unsignedEventTime:"<<Fitter3DUtility::toUnsignedTdc(m_mDouble["eventTime"], 9)<<endl;
689
690 // Change to Signals.
691 {
692 vector<tuple<string, double, int, double, double, int> > t_values = {
693 make_tuple("phi0", m_mDouble["relPhi0"], phiBitSize, phiMin, phiMax, 0),
694 make_tuple("rho", m_mDouble["rho"], m_mConstD["rhoBitSize"], rhoMin, rhoMax, 0),
695 //make_tuple("charge",(int) (m_mDouble["charge"]==1 ? 1 : 0), 1, 0, 1.5, 0),
696 make_tuple("charge", (int)(m_mDouble["charge2D"] == 1 ? 1 : 0), 1, 0, 1.5, 0),
697 make_tuple("lr_0", m_mVector["lutLR"][1], 2, 0, 3.5, 0),
698 make_tuple("lr_1", m_mVector["lutLR"][3], 2, 0, 3.5, 0),
699 make_tuple("lr_2", m_mVector["lutLR"][5], 2, 0, 3.5, 0),
700 make_tuple("lr_3", m_mVector["lutLR"][7], 2, 0, 3.5, 0),
701 make_tuple("tsId_0", m_mVector["relTsId3D"][0], ceil(log(m_mConstV["nTSs"][1]) / log(2)), 0, pow(2, ceil(log(m_mConstV["nTSs"][1]) / log(2))) - 0.5, 0),
702 make_tuple("tsId_1", m_mVector["relTsId3D"][1], ceil(log(m_mConstV["nTSs"][3]) / log(2)), 0, pow(2, ceil(log(m_mConstV["nTSs"][3]) / log(2))) - 0.5, 0),
703 make_tuple("tsId_2", m_mVector["relTsId3D"][2], ceil(log(m_mConstV["nTSs"][5]) / log(2)), 0, pow(2, ceil(log(m_mConstV["nTSs"][5]) / log(2))) - 0.5, 0),
704 make_tuple("tsId_3", m_mVector["relTsId3D"][3], ceil(log(m_mConstV["nTSs"][7]) / log(2)), 0, pow(2, ceil(log(m_mConstV["nTSs"][7]) / log(2))) - 0.5, 0),
705 make_tuple("tdc_0", m_mVector["unsignedTdc"][1], m_mConstD["tdcBitSize"], 0, pow(2, m_mConstD["tdcBitSize"]) - 0.5, 0),
706 make_tuple("tdc_1", m_mVector["unsignedTdc"][3], m_mConstD["tdcBitSize"], 0, pow(2, m_mConstD["tdcBitSize"]) - 0.5, 0),
707 make_tuple("tdc_2", m_mVector["unsignedTdc"][5], m_mConstD["tdcBitSize"], 0, pow(2, m_mConstD["tdcBitSize"]) - 0.5, 0),
708 make_tuple("tdc_3", m_mVector["unsignedTdc"][7], m_mConstD["tdcBitSize"], 0, pow(2, m_mConstD["tdcBitSize"]) - 0.5, 0),
709 make_tuple("eventTime", m_mDouble["unsignedEventTime"], m_mConstD["tdcBitSize"], 0, pow(2, m_mConstD["tdcBitSize"]) - 0.5, 0),
710 make_tuple("eventTimeValid", (int) m_mDouble["eventTimeValid"], 1, 0, 1.5, 0),
711 };
713 }
714
721 // Change to values.
722 vector<tuple<string, double, int, double, double, int> > resultValues;
723 {
724 vector<pair<string, int> > t_chooseSignals = {
725 make_pair("z0", 0), make_pair("cot", 0), make_pair("chi2Sum", 0)
726 };
727 TRGCDCJSignal::mapSignalsToValues(m_mSignalStorage, t_chooseSignals, resultValues);
728 }
729
730 // Post handling of signals.
731 // Name all signals.
732 if ((*m_mSignalStorage.begin()).second.getName() == "") {
733 for (auto it = m_mSignalStorage.begin(); it != m_mSignalStorage.end(); ++it) {
734 (*it).second.setName((*it).first);
735 }
736 }
745
746
747 // Takes some time.
748 // Save values.
749 if (m_mBool["fRootFile"]) {
750 // Check if there is a name.
751 if ((*m_mSignalStorage.begin()).second.getName() != "") {
752
753 // Save values to root file.
754 {
755 vector<pair<string, int> > chooseValues = {
756 make_pair("zz_0", m_mBool["fIsIntegerEffect"]),
757 make_pair("zz_1", m_mBool["fIsIntegerEffect"]),
758 make_pair("zz_2", m_mBool["fIsIntegerEffect"]),
759 make_pair("zz_3", m_mBool["fIsIntegerEffect"]),
760 make_pair("arcS_0", m_mBool["fIsIntegerEffect"]),
761 make_pair("arcS_1", m_mBool["fIsIntegerEffect"]),
762 make_pair("arcS_2", m_mBool["fIsIntegerEffect"]),
763 make_pair("arcS_3", m_mBool["fIsIntegerEffect"]),
764 make_pair("z0", m_mBool["fIsIntegerEffect"]),
765 make_pair("cot", m_mBool["fIsIntegerEffect"]),
766 make_pair("zChi2", m_mBool["fIsIntegerEffect"])
767 };
768 // outValues => [name, value, bitwidth, min, max, clock]
769 vector<tuple<string, double, int, double, double, int> > outValues;
770 TRGCDCJSignal::mapSignalsToValues(m_mSignalStorage, chooseValues, outValues);
771 // Changes names with "_" to m_mVector.
772 HandleRoot::convertSignalValuesToMaps(outValues, m_mDouble, m_mVector);
773 }
774 }
775 }
776
777 m_mBool["fVHDLFile"] = 0;
778 if (m_mBool["fVHDLFile"]) {
779 // Check if there is a name.
780 if ((*m_mSignalStorage.begin()).second.getName() != "") {
781 // Saves to file only one time.
783 // Saves values to memory. Wrote to file at terminate().
786 }
787 }
788
790 // Calculate zz
791 m_mVector["float_zz"] = vector<double> (4);
792 //for (unsigned iSt = 0; iSt < 4; iSt++) m_mVector["float_zz"][iSt] = Fitter3DUtility::calZ(m_mDouble["charge"], m_mConstV["angleSt"][iSt], m_mConstV["zToStraw"][iSt], m_mConstV["rr3D"][iSt], m_mVector["phi3D"][iSt], m_mDouble["rho"], m_mDouble["phi0"]);
793 for (unsigned iSt = 0; iSt < 4;
794 iSt++) m_mVector["float_zz"][iSt] = Fitter3DUtility::calZ(m_mDouble["charge2D"], m_mConstV["angleSt"][iSt],
795 m_mConstV["zToStraw"][iSt], m_mConstV["rr3D"][iSt], m_mVector["phi3D"][iSt], m_mDouble["rho"], m_mDouble["phi0"]);
796 // Calculate arcS
797 m_mVector["float_arcS"] = vector<double> (4);
798 for (unsigned iSt = 0; iSt < 4;
799 iSt++) m_mVector["float_arcS"][iSt] = Fitter3DUtility::calS(m_mDouble["rho"], m_mConstV["rr3D"][iSt]);
800 // Fit3D
801 m_mDouble["float_z0"] = 0;
802 m_mDouble["float_cot"] = 0;
803 m_mDouble["float_zChi2"] = 0;
804 Fitter3DUtility::rSFit(&m_mVector["iZError2"][0], &m_mVector["float_arcS"][0], &m_mVector["float_zz"][0], m_mDouble["float_z0"],
805 m_mDouble["float_cot"], m_mDouble["float_zChi2"]);
806
807 if (m_mBool["fVerbose"]) {
808 for (unsigned iSt = 0; iSt < 4; iSt++) cout << "float_zz[" << iSt << "] : " << m_mVector["float_zz"][iSt] << " ";
809 cout << endl;
810 for (unsigned iSt = 0; iSt < 4; iSt++) cout << "float_arcS[" << iSt << "] : " << m_mVector["float_arcS"][iSt] << " ";
811 cout << endl;
812 cout << "float_z0: " << m_mDouble["float_z0"] << endl;
813 cout << "float_zChi2: " << m_mDouble["float_zChi2"] << endl;
814
815 print3DInformation(iTrack);
816 }
817
818 // For failed fits.
819 if (m_mDouble["cot"] == 0) {
820 aTrack.setFitted(0);
821 continue;
822 }
823
824 // Set track in trackListOut.
825 // Set Helix parameters
826 TRGCDCHelix helix(ORIGIN, CLHEP::HepVector(5, 0), CLHEP::HepSymMatrix(5, 0));
827 CLHEP::HepVector a(5);
828 a = aTrack.helix().a();
829 aTrack.setFitted(1);
830 //if(m_mDouble["charge"]<0)
831 if (m_mDouble["charge2D"] < 0) {
832 a[1] = fmod(m_mDouble["phi0"] + m_mConstD["Trg_PI"], 2 * m_mConstD["Trg_PI"]);
833 } else {
834 a[1] = m_mDouble["phi0"];
835 }
836 //a[2] = 1/m_mDouble["pt"]*m_mDouble["charge"];
837 a[2] = 1 / m_mDouble["pt"] * m_mDouble["charge2D"];
838 a[3] = m_mDouble["z0"];
839 a[4] = m_mDouble["cot"];
840 helix.a(a);
841 aTrack.setHelix(helix);
842 aTrack.set2DFitChi2(m_mDouble["fit2DChi2"]);
843 aTrack.set3DFitChi2(m_mDouble["zChi2"]);
844
846 // Save values
847 if (m_mBool["fRootFile"]) {
848 if (m_fileFitter3D == 0) {
849 m_fileFitter3D = new TFile(m_rootFitter3DFileName.c_str(), "RECREATE");
850 HandleRoot::initializeRoot("fitter3D", &m_treeConstantsFitter3D, &m_treeTrackFitter3D,
854 );
855 }
856 HandleRoot::saveTrackValues("fitter3D",
858 );
859 }
860
861 } // End track loop
862
863 // Save values to file
864 // To prevent crash when there are no tracks in first event.
865 // If there is no track in first evnet then the HandleRoot saving functions will fail.
866 // This is due to bad HandleRoot software design.
867 // The first event that have tracks will be event 0 in ROOT file.
868 if (m_mBool["fRootFile"]) {
869 if (m_fileFitter3D != 0) m_treeTrackFitter3D->Fill();
870 }
871
872 if (m_mBool["debugFitted"]) {
873 for (unsigned iTrack = 0; iTrack < trackList.size(); iTrack++) {
874 TCTrack& aTrack = * trackList[iTrack];
875 if (aTrack.fitted() == 0) aTrack.setDebugValue(TRGCDCTrack::EDebugValueType::fit3D, 1);
876 }
877 }
878 if (m_mBool["debugLargeZ0"]) {
879 // If 3D fit z0 is larger or smaller than expected.
880 for (unsigned iTrack = 0; iTrack < trackList.size(); iTrack++) {
881 TCTrack& aTrack = *trackList[iTrack];
882 if (aTrack.fitted()) {
883 double fitZ0 = aTrack.helix().dz();
884 if (fitZ0 > 20 || fitZ0 < -20) aTrack.setDebugValue(TRGCDCTrack::EDebugValueType::fit3D, 1);
885 }
886 }
887 }
888
889 TRGDebug::leaveStage("Fitter 3D");
890
891 return 1;
892
893 }
std::map< std::string, TRGCDCJLUT * > m_mLutStorage
Map to hold JLuts.
Definition: Fitter3D.h:142
std::map< std::string, TRGCDCJSignal > m_mSignalStorage
Map to hold JSignals.
Definition: Fitter3D.h:140
TRGCDCJSignalData * m_commonData
For VHDL code.
Definition: Fitter3D.h:144
static double rotatePhi(double value, double refPhi)
Rotates to range [-pi, pi].
static int findQuadrant(double value)
Finds quadrant of angle. Angle is in rad.
static void setError(std::map< std::string, double > const &mConstD, std::map< std::string, std::vector< double > > const &mConstV, std::map< std::string, Belle2::TRGCDCJSignal > &mSignalStorage)
Sets error using JSignal class.
static int rotateTsId(int value, int refId, int nTSs)
Rotates to range [0, nTSs-1].
static unsigned toUnsignedTdc(int tdc, int nBits)
Changes tdc and event time to unsigned value that has # bits.
static void constrainRPerStSl(std::map< std::string, std::vector< double > > const &mConstV, std::map< std::string, Belle2::TRGCDCJSignal > &mSignalStorage)
Constrains R for each SL differently using JSignal and multiple constants.
void saveVhdlAndCoe()
Functions for saving.
Definition: Fitter3D.cc:912
void saveIoSignals()
Saves all I/O signals for debugging.
Definition: Fitter3D.cc:944
void saveAllSignals()
Saves all signals for debugging.
Definition: Fitter3D.cc:934
static void mapSignalsToValues(std::map< std::string, Belle2::TRGCDCJSignal >const &inMap, std::vector< std::pair< std::string, int > > const &inChoose, std::vector< std::tuple< std::string, double, int, double, double, int > > &outValues)
Choose => [signalName, FpgaEffects(=1)/NoFpgaEffects(=0)] Values => [name, value, bitwidth,...
Definition: JSignal.cc:2225

◆ doitFind()

void doitFind ( std::vector< TRGCDCTrack * > &  trackList)

Finds tracks using tracklist.

Definition at line 244 of file Hough3DFinder.cc.

245 {
246 TRGDebug::enterStage("3D finder");
247
248 // For saving to root file.
249 if (m_makeRootFile) {
250 m_mDouble["iSave"] = 0;
251 HandleRoot::initializeEvent(m_mEventTVectorD, m_mTClonesArray);
252 }
253
254 // Get event number.
255 StoreObjPtr<EventMetaData> eventMetaDataPtr;
256 // Event starts from 0.
257 m_mDouble["eventNumber"] = eventMetaDataPtr->getEvent();;
258
259 // Generate arrays for TS candidates.
260 vector<vector<double> > stTSs(4);
261 vector<vector<int> > stTSDrift(4);
262 vector<vector<const TCSHit*> > p_stTSs(4);
263 for (unsigned iSL = 0; iSL < 4; iSL++) {
264 vector<const TCSHit*> hits = _cdc.stereoSegmentHits(iSL);
265 // Initialize vectors.
266 string slName = "st" + to_string(iSL);
267 m_mEventV[slName + "_hit"] = vector<double> ();
268 m_mEventV[slName + "_driftHit"] = vector<double> ();
269 stTSs[iSL] = vector<double> ();
270 stTSDrift[iSL] = vector<int> ();
271 p_stTSs[iSL] = vector<const TCSHit*> ();
272 // Fill vectors
273 for (unsigned iHit = 0; iHit < hits.size(); iHit++) {
274 if (hits[iHit] == 0) continue;
277 //if(hits[iHit]->segment().priorityPosition() != 3) {
278 // continue;
279 //}
280 double t_wirePhi = ((double)hits[iHit]->cell().localId()) / m_mConstV["nWires"][2 * iSL + 1] * 4 * m_mConstD["Trg_PI"];
281 m_mEventV[slName + "_hit"].push_back(t_wirePhi);
282 m_mEventV[slName + "_driftHit"].push_back(TRGCDCFitter3D::calPhi(hits[iHit], _cdc.getEventTime()));
283 int t_tdc = hits[iHit]->segment().priorityTime();
284 int t_lr = hits[iHit]->segment().LUT()->getValue(hits[iHit]->segment().lutPattern());;
285 int t_priorityPosition = hits[iHit]->segment().priorityPosition();
286 int t_driftInfo = (t_tdc << 4) + (t_lr << 2) + t_priorityPosition;
287 stTSs[iSL].push_back(t_wirePhi);
288 p_stTSs[iSL].push_back(hits[iHit]);
289 stTSDrift[iSL].push_back(t_driftInfo);
290 //cout<<"iSL:"<<iSL<<" iHit:"<<iHit<<" t_tdc:"<<t_tdc<<" t_lr:"<<t_lr<<" t_priorityPosition:"<<t_priorityPosition<<" t_driftInfo:"<<t_driftInfo<<endl;
291 }
292 }
293
294 // Get MC values related with finding
295 // numberTSsForParticle[mcId] = # superlayer hits.
296 map<unsigned, unsigned> numberTSsForParticle;
297 if (m_mBool["fMc"]) findNumberOfHitSuperlayersForMcParticles(p_stTSs, numberTSsForParticle);
298
299 // Loop over all the tracks.
300 m_mEventD["nTracks"] = trackList.size();
301 for (unsigned iTrack = 0; iTrack < m_mEventD["nTracks"]; iTrack++) {
302
303 TCTrack& aTrack = * trackList[iTrack];
304
305 // Get MC values related with fitting
307
308 // Get track ID
309 m_mDouble["trackId"] = aTrack.getTrackID();
310
311 // 2D Fitter
313 if (fit2DResult != 0) continue;
314
315 // Set input of finder
316 //vector<double > trackVariables = { m_mDouble["charge"], m_mDouble["rho"]/100, m_mDouble["phi0"] } ;
317 vector<double > trackVariables = { m_mDouble["charge2D"], m_mDouble["rho"] / 100, m_mDouble["phi0"] } ;
318
319 // Run finder
320 m_Hough3DFinder->runFinder(trackVariables, stTSs, stTSDrift);
321
322 // Get results of finder
323 m_Hough3DFinder->getValues("bestTSIndex", m_mVector["bestTSIndex"]);
324 const TCSHit* p_bestTS[4] = {0, 0, 0, 0};
325 for (int iSt = 0; iSt < 4; iSt++) {
326 if (m_mVector["bestTSIndex"][iSt] == 999) p_bestTS[iSt] = 0;
327 else p_bestTS[iSt] = p_stTSs[iSt][(int)m_mVector["bestTSIndex"][iSt]];
328 }
329 m_Hough3DFinder->getValues("bestTS", m_mVector["bestTS"]);
330 // Find and append TS to track.
331 for (unsigned iSt = 0; iSt < 4; iSt++) {
332 if (m_mVector["bestTS"][iSt] != 999) aTrack.append(new TCLink(0, p_bestTS[iSt], p_bestTS[iSt]->cell().xyPosition()));
333 }
334
335 // For saving values from finder.
336 if (m_Hough3DFinder->getMode() == 1) {
337 m_Hough3DFinder->getValues("bestZ0", m_mVector["bestZ0"]);
338 m_Hough3DFinder->getValues("bestCot", m_mVector["bestCot"]);
339 m_Hough3DFinder->getValues("houghMax", m_mVector["houghMax"]);
340 m_Hough3DFinder->getValues("minDiffHough", m_mVector["minDiffHough"]);
341 }
342 if (m_Hough3DFinder->getMode() == 2) {
343 m_Hough3DFinder->getValues("st0GeoCandidatesPhi", m_mVector["st0GeoCandidatesPhi"]);
344 m_Hough3DFinder->getValues("st1GeoCandidatesPhi", m_mVector["st1GeoCandidatesPhi"]);
345 m_Hough3DFinder->getValues("st2GeoCandidatesPhi", m_mVector["st2GeoCandidatesPhi"]);
346 m_Hough3DFinder->getValues("st3GeoCandidatesPhi", m_mVector["st3GeoCandidatesPhi"]);
347 m_Hough3DFinder->getValues("st0GeoCandidatesDiffStWires", m_mVector["st0GeoCandidatesDiffStWires"]);
348 m_Hough3DFinder->getValues("st1GeoCandidatesDiffStWires", m_mVector["st1GeoCandidatesDiffStWires"]);
349 m_Hough3DFinder->getValues("st2GeoCandidatesDiffStWires", m_mVector["st2GeoCandidatesDiffStWires"]);
350 m_Hough3DFinder->getValues("st3GeoCandidatesDiffStWires", m_mVector["st3GeoCandidatesDiffStWires"]);
351 m_Hough3DFinder->getValues("stAxPhi", m_mVector["stAxPhi"]);
352 }
353
354 // Get MC values.
355 if (m_mBool["fMc"]) {
356 // Call storage array.
357 StoreArray<CDCSimHit> SimHits("CDCSimHits");
358 StoreArray<CDCHit> CDCHits("CDCHits");
359 RelationArray relationCDCHits(SimHits, CDCHits);
360
361 // save performance values (purity, efficiency)
362 const TCRelation& trackRelation3D = aTrack.relation3D();
363 m_mDouble["purity"] = trackRelation3D.purity3D(aTrack.relation2D().contributor(0));
364 m_mDouble["efficiency"] = trackRelation3D.efficiency3D(aTrack.relation2D().contributor(0), numberTSsForParticle);
365 // Find one mc stereo track segment per layer.
366 m_mVector["mcTSs"] = vector<double> (4, 999);
367 vector<const TCSHit*> mcTSList;
368 perfectFinder(trackList, iTrack, mcTSList);
369 for (unsigned iTS = 0; iTS < mcTSList.size(); iTS++) {
370 int iSuperLayer = (int)(double(mcTSList[iTS]->cell().superLayerId()) - 1) / 2;
371 m_mVector["mcTSs"][iSuperLayer] = (double)mcTSList[iTS]->cell().localId() / m_mConstV["nWires"][2 * iSuperLayer + 1] * 4 *
372 m_mConstD["Trg_PI"];
373 }
374 // Save MC ture CDC's hit position
375 m_mVector["mcTSsX"] = vector<double> (4);
376 m_mVector["mcTSsY"] = vector<double> (4);
377 for (unsigned iTS = 0; iTS < mcTSList.size(); iTS++) {
378 unsigned iCDCSimHit = mcTSList[iTS]->iCDCSimHit();
379 CDCSimHit* aCDCSimHit = SimHits[iCDCSimHit];
380 B2Vector3D posWire = aCDCSimHit->getPosWire();
381 m_mVector["mcTSsX"][iTS] = posWire.X();
382 m_mVector["mcTSsY"][iTS] = posWire.Y();
383 }
384 // Calculate diff from perfect
385 m_mVector["perfectWireDiff"] = vector<double> (4);
386 m_mVector["perfectCalZ"] = vector<double> (4);
387 for (unsigned iSt = 0; iSt < 4; iSt++) {
388 if (m_mVector["mcTSs"][iSt] == 999) {
389 m_mVector["perfectWireDiff"][iSt] = 999;
390 m_mVector["perfectCalZ"][iSt] = 999;
391 } else {
392 m_mVector["perfectWireDiff"][iSt] = Fitter3DUtility::calDeltaPhi(m_mDouble["mcCharge"], m_mConstV["angleSt"][iSt],
393 m_mConstV["zToStraw"][iSt] / 100, m_mConstV["rr"][2 * iSt + 1] / 100, m_mVector["mcTSs"][iSt], m_mDouble["rho"] / 100,
394 m_mDouble["phi0"]) / 4 / m_mConstD["Trg_PI"] * m_mConstV["nWires"][2 * iSt + 1];
395 m_mVector["perfectCalZ"][iSt] = Fitter3DUtility::calZ(m_mDouble["mcCharge"], m_mConstV["angleSt"][iSt],
396 m_mConstV["zToStraw"][iSt] / 100, m_mConstV["rr"][2 * iSt + 1] / 100, m_mVector["mcTSs"][iSt], m_mDouble["rho"] / 100,
397 m_mDouble["phi0"]);
398 }
399 }
400 // Find multiple mc stereo track segments per layer.
401 unsigned int mcParticleId = aTrack.relation2D().contributor(0);
402 for (unsigned iSt = 0; iSt < 4; iSt++) {
403 string mcTsName = "mcTsSt" + to_string(iSt);
404 m_mVector[mcTsName] = vector<double> ();
405 vector<const TCSHit*> hits = _cdc.stereoSegmentHits(iSt);
406 // Find TS which match mc index
407 for (unsigned iTS = 0; iTS < hits.size(); iTS++) {
408 if (hits[iTS]->iMCParticle() == mcParticleId) m_mVector[mcTsName].push_back((double)hits[iTS]->cell().localId() /
409 m_mConstV["nWires"][2 * iSt + 1] * 4 * m_mConstD["Trg_PI"]);
410 }
411 }
412
413 //cout<<"----newStart----"<<endl;
414 //cout<<"mcCharge:"<<m_mDouble["mcCharge"]<<endl;
415 //cout<<"rho:"<<m_mDouble["rho"]<<" phi0:"<<m_mDouble["phi0"]<<endl;
416 //cout<<"purity:"<<m_mDouble["purity"]<<" efficiency:"<<m_mDouble["efficiency"]<<endl;
417 //cout<<"mcTSs[0]:"<<m_mVector["mcTSs"][0]<<" mcTSs[1]:"<<m_mVector["mcTSs"][1]<<" mcTSs[2]:"<<m_mVector["mcTSs"][2]<<" mcTSs[3]:"<<m_mVector["mcTSs"][3]<<endl;
418 //cout<<"mcTSsX[0]:"<<m_mVector["mcTSsX"][0]<<" mcTSsX[1]:"<<m_mVector["mcTSsX"][1]<<" mcTSsX[2]:"<<m_mVector["mcTSsX"][2]<<" mcTSsX[3]:"<<m_mVector["mcTSsX"][3]<<endl;
419 //cout<<"mcTSsY[0]:"<<m_mVector["mcTSsY"][0]<<" mcTSsY[1]:"<<m_mVector["mcTSsY"][1]<<" mcTSsY[2]:"<<m_mVector["mcTSsY"][2]<<" mcTSsY[3]:"<<m_mVector["mcTSsY"][3]<<endl;
420 //cout<<"perfectWireDiff[0]:"<<m_mVector["perfectWireDiff"][0]<<" perfectWireDiff[1]:"<<m_mVector["perfectWireDiff"][1]<<" perfectWireDiff[2]:"<<m_mVector["perfectWireDiff"][2]<<" perfectWireDiff[3]:"<<m_mVector["perfectWireDiff"][3]<<endl;
421 //cout<<"perfectCalZ[0]:"<<m_mVector["perfectCalZ"][0]<<" perfectCalZ[1]:"<<m_mVector["perfectCalZ"][1]<<" perfectCalZ[2]:"<<m_mVector["perfectCalZ"][2]<<" perfectCalZ[3]:"<<m_mVector["perfectCalZ"][3]<<endl;
422 //cout<<"----newEnd----"<<endl;
423 }
424
425 if (m_makeRootFile) {
426 if (m_fileFinder3D == 0) {
427 m_fileFinder3D = new TFile("Finder3D.root", "RECREATE");
428 HandleRoot::initializeRoot("hough3D", &m_treeConstantsFinder3D, &m_treeTrackFinder3D,
433 );
434 }
435 HandleRoot::saveTrackValues("hough3D",
437 );
438 }
439
440 } // End of loop over all the tracks.
441
442 // Will ignore events until event has a track.
444 HandleRoot::saveEventValues("hough3D",
446 );
447 m_treeTrackFinder3D->Fill();
448 }
449
450
451 // Set debug values.
452 if (m_mBool["debugEfficiency"]) {
453 // Notify when efficiency is not 1.
454 for (unsigned iTrack = 0; iTrack < trackList.size(); iTrack++) {
455 /* cppcheck-suppress variableScope */
456 TCTrack& aTrack = * trackList[iTrack];
457 // Find number of super layers that have priority layer hit.
458 int nPriorityHitSL = 0;
459 for (unsigned iSt = 0; iSt < 4; iSt++) {
460 int priorityHitSL = 0;
461 for (unsigned iTS = 0; iTS < stTSDrift[iSt].size(); iTS++) {
462 int t_priorityPosition = (stTSDrift[iSt][iTS] & 3);
463 if (t_priorityPosition == 3) priorityHitSL = 1;
464 //cout<<"iSt:"<<iSt<<" iTS:"<<iTS<<" priorityPosition:"<<t_priorityPosition<<" priorityHitSL:"<<priorityHitSL<<endl;
465 }
466 if (priorityHitSL) nPriorityHitSL++;
467 }
468 //cout<<"nPriorityHitSL:"<<nPriorityHitSL<<endl;
469 if (m_mDouble["efficiency"] != 1) {
470 // Remove case when all hits are secondary priority.
471 if (m_mDouble["efficiency"] != nPriorityHitSL * 1. / 4) {
472 aTrack.setDebugValue(TRGCDCTrack::EDebugValueType::find3D, 1);
473 }
474 }
475 }
476 }
477 if (m_mBool["debugNTs"]) {
478 // Notify when not enough TS are found
479 for (unsigned iTrack = 0; iTrack < trackList.size(); iTrack++) {
480 unsigned nHitStSl = 0;
481 for (unsigned iSt = 0; iSt < 4; iSt++) {
482 if (trackList[iTrack]->links(2 * iSt + 1).size() != 0) nHitStSl++;
483 }
484 if (nHitStSl < 2) trackList[iTrack]->setDebugValue(TRGCDCTrack::EDebugValueType::find3D, 1);
485 }
486 }
487
488 TRGDebug::leaveStage("3D finder");
489
490 }
std::map< std::string, std::vector< double > > m_mVector
Map to hold track vector values for Fitter3D.
Definition: Hough3DFinder.h:86
std::map< std::string, TVectorD * > m_mEventTVectorD
TVectorD map for saving event values to root file.
std::map< std::string, bool > m_mBool
Map to hold input options.
Definition: Hough3DFinder.h:96
std::map< std::string, double > m_mConstD
Map to hold run values for Fitter3D.
Definition: Hough3DFinder.h:88
bool m_makeRootFile
Choose whether to save root file.
Definition: Hough3DFinder.h:68
const TRGCDC & _cdc
Members.
Definition: Hough3DFinder.h:66
std::map< std::string, std::vector< double > > m_mConstV
Map to hold run vectcors for Fitter3D.
Definition: Hough3DFinder.h:90
std::map< std::string, double > m_mDouble
Map to hold track double values for Fitter3D.
Definition: Hough3DFinder.h:84
std::map< std::string, double > m_mEventD
Map to hold event values for Fitter3D.
Definition: Hough3DFinder.h:92
std::map< std::string, TClonesArray * > m_mTClonesArray
TClonesArray map for saving track values to root file.
TTree * m_treeConstantsFinder3D
TTree for constants of Hough3D.
Definition: Hough3DFinder.h:82
Hough3DFinder * m_Hough3DFinder
Hough Variables.
Definition: Hough3DFinder.h:74
TFile * m_fileFinder3D
Tfile for Hough3D root file.
Definition: Hough3DFinder.h:78
TTree * m_treeTrackFinder3D
TTree for tracks of Hough3D.
Definition: Hough3DFinder.h:80
std::map< std::string, std::vector< double > > m_mEventV
Map to hold event vectcors for Fitter3D.
Definition: Hough3DFinder.h:94
std::map< std::string, TVectorD * > m_mRunTVectorD
TVectorD map for saving run values to root file.
Definition: Hough3DFinder.h:98
static double calDeltaPhi(int charge, double anglest, double ztostraw, double rr, double phi, double rho, double phi0)
Calculates the phi difference between fitted axial phi and stereo phi.
int getMode(void)
Gets which 3D finder is used.
void runFinder(const std::vector< double > &trackVariables, std::vector< std::vector< double > > &stTSs, const std::vector< std::vector< int > > &stTSDrift)
Track variables.
void getValues(const std::string &input, std::vector< double > &result)
Gets results from the 3D finder.
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:516
static double calPhi(TRGCDCSegmentHit const *segmentHit, double eventTime)
Utility functions.
Definition: Fitter3D.cc:895
std::vector< const TRGCDCSegmentHit * > stereoSegmentHits(unsigned) const
returns a list of TRGCDCSegmentHit in a stereo super layer N.
Definition: TRGCDC.h:1023
void findNumberOfHitSuperlayersForMcParticles(std::vector< std::vector< const TRGCDCSegmentHit * > > &p_stTSs, std::map< unsigned, unsigned > &numberTSsForParticle)
Finds number of hit superlayers for each mc particle.
void perfectFinder(std::vector< TRGCDCTrack * > &trackList, unsigned j, std::vector< const TRGCDCSegmentHit * > &mcTSList)
Perfect 3D finder for a track.

◆ doitPerfectly() [1/2]

void doitPerfectly ( std::vector< TRGCDCTrack * > &  trackList)

Perfect 3D finder for a tracklist.

Definition at line 565 of file Hough3DFinder.cc.

566 {
567
568 TRGDebug::enterStage("Perfect 3D Finder");
569 if (TRGDebug::level())
570 cout << TRGDebug::tab() << "givenTrk#=" << trackList.size() << endl;
571
572
573 //...Track loop....
574 for (unsigned j = 0; j < trackList.size(); j++) {
575 //...G4 trackID...
576 TCTrack* trk = trackList[j];
577
578 vector<const TCSHit*> mcTSList;
579 perfectFinder(trackList, j, mcTSList);
580 for (unsigned iTS = 0; iTS < mcTSList.size(); iTS++) {
581 trk->append(new TCLink(0, mcTSList[iTS], mcTSList[iTS]->cell().xyPosition()));
582 }
583
584 if (TRGDebug::level())
585 trk->dump("", "> ");
586
587 }
588
589 TRGDebug::leaveStage("Perfect 3D Finder");
590
591 }

◆ doitPerfectly() [2/2]

int doitPerfectly ( std::vector< TRGCDCTrack * > &  trackList)
private

do perfect finding.

Definition at line 73 of file PerfectFinder.cc.

74 {
75
76 TRGDebug::enterStage("Perfect Finder");
77
78 //...TS hit loop...
79 _mcList.clear();
80 map<int, vector<const TCSegment*> *> trackMap;
81 const vector<const TCSHit*> hits = _cdc.segmentHits();
82 for (unsigned i = 0; i < hits.size(); i++) {
83 const TCSHit& ts = * hits[i];
84 if (! ts.signal().active()) continue;
85 if (ts.segment().stereo()) continue;
86 //const TCWHit * wh = ts.segment().center().hit();
87 const TCWHit* wh = ts.segment().priority().hit();
88 if (! wh) continue;
89 const CDCSimHit& sh = * wh->simHit();
90 const int trackId = sh.getTrackId();
91 if (! trackMap[trackId]) {
92 trackMap[trackId] = new vector<const TCSegment*>();
93 _mcList.push_back(trackId);
94 }
95 trackMap[trackId]->push_back(& ts.segment());
96 }
97
98 if (TRGDebug::level()) {
99 cout << TRGDebug::tab() << "#tracksInMC=" << trackMap.size() << endl;
100 map<int, vector<const TCSegment*> *>::iterator it = trackMap.begin();
101 while (it != trackMap.end()) {
102 cout << TRGDebug::tab(4) << it->first << ":";
103 const vector<const TCSegment*>& l = * it->second;
104 for (unsigned i = 0; i < l.size(); i++)
105 cout << l[i]->name() << ",";
106 cout << endl;
107 ++it;
108 }
109 }
110
111 //...Make circles...
112 map<int, vector<const TCSegment*> *>::iterator it = trackMap.begin();
113 unsigned n = 0;
114 while (it != trackMap.end()) {
115
116 //...Make links...
117 const vector<const TCSegment*>& l = * it->second;
118 vector<TCLink*> links;
119 for (unsigned i = 0; i < l.size(); i++) {
120 TCLink* link = new TCLink(0,
121 l[i]->hit(),
122 l[i]->hit()->cell().xyPosition());
123 links.push_back(link);
124 }
125
126 //...Requires all axial super layer hits...
127 const unsigned nSuperLayers = TCLink::nSuperLayers(links);
128 if (nSuperLayers < 5) {
129 ++it;
130 continue;
131 }
132
133 //...Check uniquness...
134 vector<TCLink*> layers[9];
135 vector<TCLink*> forCircle;
136 TCLink::separate(links, 9, layers);
137 for (unsigned i = 0; i < 9; i++) {
138 if (layers[i].size() < 1) continue;
139 if (layers[i].size() < 2) {
140 forCircle.push_back(layers[i][0]);
141 continue;
142 }
143 TCLink* best = 0;
144 //int timeMin = 99999;
145 float timeMin = 99999;
146 bool bestCenterHit = 0;
147 for (unsigned j = 0; j < layers[i].size(); j++) {
148 //const TRGTime & t = * (layers[i][j]->cell()->signal())[0];
149 const float tsDrift = layers[i][j]->cell()->hit()->drift();
150 const TRGCDCSegment* t_cell = static_cast<const TRGCDCSegment*>(layers[i][j]->cell());
151 bool centerHit = (t_cell->priorityPosition() == 3);
152 //cout<<"PF2D ["<<layers[i][j]->cell()->superLayerId()<<"-"<<layers[i][j]->cell()->localId()<<"] Tick: "<<t.time()<<" Drift: "<<tsDrift<<endl;
153 //if (t.time() < timeMin) {
154 // timeMin = t.time();
155 if (centerHit == 1 && bestCenterHit == 0) {
156 timeMin = tsDrift;
157 best = layers[i][j];
158 bestCenterHit = 1;
159 } else if (centerHit == 0 && bestCenterHit == 1) {
160 } else {
161 if (tsDrift < timeMin) {
162 timeMin = tsDrift;
163 best = layers[i][j];
164 }
165 }
166 }
167 forCircle.push_back(best);
168 }
169
170 if (TRGDebug::level())
171 TCLink::dump(forCircle,
172 "",
173 TRGDebug::tab() + "track_" + TRGUtil::itostring(n));
174
175 //...Make a circle...
176 TCCircle c = TCCircle(forCircle);
177 c.fit();
178 c.name("CircleFitted_" + TRGUtil::itostring(n));
179
180 //...Make a track...
181 TCTrack& t = * new TCTrack(c);
182 t.name("Track_" + TRGUtil::itostring(n));
183 trackList.push_back(& t);
184
185 if (TRGDebug::level()) {
186 c.dump("detail");
187 t.dump("detail");
188 }
189
190 //...Incriment for next loop...
191 ++it;
192 ++n;
193
194#ifdef TRGCDC_DISPLAY_HOUGH
195 vector<const TCCircle*> cc;
196 cc.push_back(& c);
197 vector<const TCTrack*> tt;
198 tt.push_back(& t);
199 string stg = "2D : Perfect Finder circle fit";
200 string inf = " ";
201 D->clear();
202 D->stage(stg);
203 D->information(inf);
204 D->area().append(cc, Gdk::Color("#FF0066009900"));
205// D->area().append(tt, Gdk::Color("#990066009900"));
206 D->area().append(_cdc.hits());
207 D->area().append(_cdc.segmentHits());
208 D->show();
209 D->run();
210#endif
211
212 }
213
214 if (TRGDebug::level()) {
215 cout << TRGDebug::tab() << "#tracksMade=" << trackList.size() << endl;
216 }
217
218 TRGDebug::leaveStage("Perfect Finder");
219 return 0;
220 }
const TRGCDC & _cdc
CDCTRG.
Definition: PerfectFinder.h:69
std::vector< int > _mcList
MC track ID list.
Definition: PerfectFinder.h:72
std::string name(void) const
returns name.
Definition: PerfectFinder.h:79

◆ doprescale() [1/2]

bool doprescale ( int  f)

Definition at line 567 of file TRGGDL.cc.

568 {
569 if (f == 0) return false;
570 if (f == 1) return true;
571 double ran = gRandom->Uniform(f);
572 return (ceil(ran) == f);
573 }

◆ doprescale() [2/2]

int doprescale ( int  f)

select one event in number of prescale factor events

Definition at line 51 of file L1TriggerMenuv0.cc.

52 {
53
54 int Val = 0;
55 double ran = gRandom->Uniform(f);
56 if (ceil(ran) == f) Val = 1;
57 return Val;
58 }

◆ dot()

double dot ( const TRGPoint2D a) const
inline

inner product

Definition at line 144 of file Point2D.h.

145 {
146 return _p[0] * a.x() + _p[1] * a.y();
147 }

◆ dPhi() [1/2]

double dPhi ( double  a)
inline

sets and returns dPhi to the closest point.

Definition at line 544 of file Link.h.

545 {
546 return _dPhi = a;
547 }

◆ dPhi() [2/2]

double dPhi ( void  ) const
inline

returns dPhi to the closest point.

Definition at line 537 of file Link.h.

538 {
539 return _dPhi;
540 }

◆ dr() [1/2]

double dr ( double  x,
double  y 
) const
inline

const member functions

Definition at line 263 of file Lpar.h.

264 {
265 double dx = xc() - x;
266 double dy = yc() - y;
267 double r = 0.5 / std::fabs(m_kappa);
268 return std::fabs(std::sqrt(dx * dx + dy * dy) - r);
269 }

◆ dr() [2/2]

double dr ( void  ) const
inline

returns dr.

Definition at line 271 of file Helix.h.

272 {
273 return m_ac[0];
274 }

◆ drift() [1/5]

float drift ( float  b,
unsigned  a 
)
inline

sets and returns drift distance of left or right.

Definition at line 642 of file Link.h.

643 {
644 return _drift[a] = b;
645 }

◆ drift() [2/5]

float drift ( unsigned  i) const
inline

returns drift distance.

Definition at line 266 of file CellHit.h.

267 {
268 if (i) return _drift[1];
269 return _drift[0];
270 }
float _drift[2]
drift distance
Definition: CellHit.h:183

◆ drift() [3/5]

float drift ( unsigned  a) const
inline

returns drift distance of left or right.

Definition at line 635 of file Link.h.

636 {
637 return _drift[a];
638 }

◆ drift() [4/5]

float drift ( void  ) const
inline

returns drift distance.

Definition at line 282 of file CellHit.h.

283 {
284 return (_drift[0] + _drift[1]) / 2.;
285 }

◆ drift() [5/5]

float drift ( void  ) const
inline

returns drift distance.

Definition at line 663 of file Link.h.

664 {
665 return (_drift[0] + _drift[1]) / 2.;
666 }

◆ dtostring()

std::string dtostring ( double  d,
unsigned int  precision 
)
static

converts double to string.

Definition at line 60 of file Utilities.cc.

61 {
62 std::ostringstream s;
63 s << std::setprecision(precision) << d;
64 return s.str();
65 }

◆ dump() [1/36]

void dump ( void  )

Print variables for LUT.

Definition at line 413 of file JLUT.cc.

414 {
415 cout << "<<<[LUT] " << m_name << ">>>" << endl;
416 if (m_fileName != "") cout << "LUT filename: " << m_fileName << endl;
417 cout << "In bitsize: " << m_inputBitsize << " Out bitsize: " << m_outputBitsize << endl;
418 cout << "[input] offset: " << m_inputOffset << " toReal: " << m_inputToReal << endl;
419 cout << "[output] offset: " << m_outputOffset << " toReal: " << m_toReal << endl;
420 cout << "[output] type: " << m_outputType << " NBitsWithOffset: " << m_outputNBitsWithOffset << endl;
421 cout << "<<<[LUT] " << m_name << ">>>" << endl;
422 }
double m_toReal
The factor to change integer to float value.
Definition: JLUT.h:173
double m_outputOffset
The float offset of the output for LUT.
Definition: JLUT.h:164
std::string m_fileName
LUT filename.
Definition: JLUT.h:140
double m_outputType
The output type of the LUT. (Will be deprecated.)
Definition: JLUT.h:179
int m_inputBitsize
input bitsize. Number of bits.
Definition: JLUT.h:152
int m_outputBitsize
output bitsize. Number of bits.
Definition: JLUT.h:155
double m_inputOffset
Changing float function to int function variables.
Definition: JLUT.h:161
double m_inputToReal
The factor of the input integer to change to float value.
Definition: JLUT.h:170
std::string m_name
Name.
Definition: JLUT.h:134
double m_outputNBitsWithOffset
The output bit width with offset. (Will be deprecated.)
Definition: JLUT.h:182

◆ dump() [2/36]

void dump ( void  ) const

Methods.

Definition at line 539 of file JSignal.cc.

540 {
541 cout << "-----------------------------------" << endl;
542 cout << "name: " << m_name << endl;
543 cout << "type: " << m_type << endl;
544 cout << "bitsize: " << m_bitsize << endl;
545 int t_org = cout.precision();
546 cout.precision(15);
547 cout << "actual: " << m_actual << endl;
548 cout.precision(t_org);
549 cout << "int: " << m_int << endl;
550 cout << "minInt: " << m_minInt << endl;
551 cout << "maxInt: " << m_maxInt << endl;
552 cout << "minActual: " << m_minActual << endl;
553 cout << "maxActual: " << m_maxActual << endl;
554 cout << "realInt: " << m_int* m_toReal << endl;
555 cout << "toReal: " << m_toReal << endl;
556 cout << "clock: " << m_finishClock << endl;
557 cout << "debug|printVhdl: " << m_debug << "|" << getPrintVhdl() << endl;
558 cout << "-----------------------------------" << endl;
559 }
double m_toReal
The toReal value.
Definition: JSignal.h:296
double m_minActual
The minimum float value.
Definition: JSignal.h:292
double m_maxActual
The maximum float value.
Definition: JSignal.h:294
double m_actual
The float value.
Definition: JSignal.h:290

◆ dump() [3/36]

void dump ( const std::string &  message) const

dumps debug information.

Definition at line 767 of file TRGCDC.cc.

768 {
769 TRGDebug::enterStage("TRGCDC dump");
770
771 if (msg.find("name") != string::npos ||
772 msg.find("version") != string::npos ||
773 msg.find("detail") != string::npos ||
774 msg == "") {
775 cout << name() << "(CDC version=" << versionCDC() << ", "
776 << version() << ") ";
777 }
778 if (msg.find("detail") != string::npos ||
779 msg.find("state") != string::npos) {
780 cout << "Debug Level=" << _debugLevel;
781 }
782 cout << endl;
783
784 string tab(" ");
785
786 if (msg == "" || msg.find("geometry") != string::npos) {
787 //...Get information..."
788 unsigned nLayer = _layers.size();
789 cout << " version : " << version() << endl;
790 cout << " cdc version: " << versionCDC() << endl;
791 cout << " # of wires : " << _wires.size() << endl;
792 cout << " # of layers: " << nLayer << endl;
793 cout << " super layer information" << endl;
794 cout << " # of super layers() = "
795 << nSuperLayers() << endl;
796 cout << " # of Axial super layers = "
797 << nAxialSuperLayers() << endl;
798 cout << " # of Stereo super layers = "
799 << nStereoSuperLayers() << endl;
800
801 if (msg.find("superLayers") != string::npos) {
802 cout << " super layer detail" << endl;
803 cout << " id #layers (stereo type)" << endl;
804 for (unsigned i = 0; i < nSuperLayers(); ++i) {
805 const unsigned n = _superLayers[i]->size();
806 cout << " " << i << " " << n << " (";
807 for (unsigned j = 0; j < n; j++) {
808 cout << (* _superLayers[i])[0]->stereoType();
809 }
810 cout << ")" << endl;
811 }
812 }
813
814 cout << " layer information" << endl;
815 cout << " # of Axial layers = "
816 << nAxialLayers() << endl;
817 cout << " # of Stereo layers = "
818 << nStereoLayers() << endl;
819
820 if (msg.find("layers") != string::npos) {
821 cout << " layer detail" << endl;
822 cout << " id type sId #wires lId asId assId"
823 << endl;
824 for (unsigned int i = 0; i < nLayers(); ++i) {
825 const TRGCDCLayer& l = *_layers[i];
826 cout << " " << i
827 << " " << l.stereoType()
828 << " " << l.superLayerId()
829 << " " << l.nCells()
830 << " " << l.localLayerId()
831 << " " << l.axialStereoLayerId()
832 << " " << l.axialStereoSuperLayerId()
833 << endl;
834 }
835 }
836
837 if (msg.find("wires") != string::npos) {
838 cout << " wire information" << endl;
839 for (unsigned i = 0; i < nWires(); i++)
840 (_wires[i])->dump("neighbor", tab);
841 }
842
843 return;
844 }
845 if (msg.find("hits") != string::npos) {
846 cout << " hits : " << _hits.size() << endl;
847 for (unsigned i = 0; i < (unsigned) _hits.size(); i++)
848 _hits[i]->dump("mc drift", tab);
849 }
850 if (msg.find("axialHits") != string::npos) {
851 cout << " hits : " << _axialHits.size() << endl;
852 for (unsigned i = 0; i < (unsigned) _axialHits.size(); i++)
853 _axialHits[i]->dump("mc drift", tab);
854 }
855 if (msg.find("stereoHits") != string::npos) {
856 cout << " hits : " << _stereoHits.size() << endl;
857 for (unsigned i = 0; i < (unsigned) _stereoHits.size(); i++)
858 _stereoHits[i]->dump("mc drift", tab);
859 }
860 if (msg.find("trgWireHits") != string::npos) {
861 const string dumpOption = "trigger detail";
862 cout << " wire hits" << endl;
863 for (unsigned i = 0; i < nWires(); i++) {
864 const TCWire& w = *wire(i);
865 if (w.signal().active())
866 w.dump(dumpOption, TRGDebug::tab(4));
867 }
868 }
869 if (msg.find("trgWireCentralHits") != string::npos) {
870 const string dumpOption = "trigger detail";
871 cout << " wire hits" << endl;
872 for (unsigned i = 0; i < nSegments(); i++) {
873 const TCSegment& s = segment(i);
874 if (s.wires()[5]->signal().active())
875 s.wires()[5]->dump(dumpOption, TRGDebug::tab(4));
876 }
877 }
878 if (msg.find("trgTSHits") != string::npos) {
879 const string dumpOption = "trigger detail";
880 cout << " TS hits" << endl;
881 for (unsigned i = 0; i < nSegments(); i++) {
882 const TCSegment& s = segment(i);
883 if (s.signal().active())
884 s.dump(dumpOption, TRGDebug::tab(4));
885 }
886 }
887
888 TRGDebug::leaveStage("TRGCDC dump");
889 }
std::vector< std::vector< TRGCDCLayer * > * > _superLayers
Super layers.
Definition: TRGCDC.h:608
std::vector< TRGCDCLayer * > _layers
All layers.
Definition: TRGCDC.h:617
unsigned nAxialLayers(void) const
return # of axial layers.
Definition: TRGCDC.h:884
unsigned nStereoLayers(void) const
returns # of stereo layers.
Definition: TRGCDC.h:877
std::string versionCDC(void) const
returns CDC version.
Definition: TRGCDC.h:856
void dump(const std::string &message) const
dumps debug information.
Definition: TRGCDC.cc:767
unsigned nStereoSuperLayers(void) const
returns # of stereo super layers.
Definition: TRGCDC.h:898
std::string version(void) const
returns version.
Definition: TRGCDC.cc:98
unsigned nWires(void) const
return # of wires.
Definition: TRGCDC.h:863
const TRGCDCWire * wire(unsigned wireId) const
returns a pointer to a wire.
Definition: TRGCDC.cc:892

◆ dump() [4/36]

void dump ( const std::string &  message) const

dumps debug information.

Definition at line 184 of file TRGGDL.cc.

185 {
186 if (msg.find("name") != string::npos ||
187 msg.find("version") != string::npos ||
188 msg.find("detail") != string::npos ||
189 msg == "") {
190 }
191 if (msg.find("detail") != string::npos ||
192 msg.find("state") != string::npos) {
193 cout << "Debug Level=" << _debugLevel;
194 cout << endl;
195 }
196 }

◆ dump() [5/36]

void dump ( const std::string &  message) const

dumps debug information.

Definition at line 125 of file TRGGRL.cc.

126 {
127
128 if (msg != "") B2DEBUG(100, "dump nothing...");
129
130 }

◆ dump() [6/36]

void dump ( const std::string &  message = "",
const std::string &  pre = "" 
) const

dumps contents.

"message" is to select information to dump. "pre" will be printed in head of each line.

Definition at line 146 of file FrontEnd.cc.

147 {
148 TRGBoard::dump(message, pre);
149 }

◆ dump() [7/36]

void dump ( const std::string &  message = "",
const std::string &  pre = "" 
) const

dumps contents. "message" is to select information to dump. "pre" will be printed in head of each line.

Definition at line 149 of file Merger.cc.

150 {
151 TRGBoard::dump(message, pre);
152 }

◆ dump() [8/36]

void dump ( const std::string &  message = "",
const std::string &  pre = "" 
) const

dumps contents.

"message" is to select information to dump. "pre" will be printed in head of each line.

Definition at line 64 of file Tracker2D.cc.

65 {
66 TRGBoard::dump(message, pre);
67 }

◆ dump() [9/36]

void dump ( const std::string &  message = "",
const std::string &  pre = "" 
) const

dumps contents. "message" is to select information to dump. "pre" will be printed in head of each line.

Definition at line 76 of file BitStream.cc.

78 {
79
80 const string tab = " ";
81
82 cout << pre << _name << ":size=" << dec << _size << endl;
83 for (unsigned i = 0; i < _stream.size(); i++) {
84 cout << pre << tab;
85 if (i == _stream.size() - 1) {
86 const unsigned last = _size % (sizeof(unsigned) * 8);
87
88 if (last)
89 cout << TRGUtilities::streamDisplay(* _stream[i], 0, last - 1);
90 } else {
91 cout << TRGUtilities::streamDisplay(* _stream[i], 0, 31);
92 }
93 cout << endl;
94 }
95 }
std::string _name
Name.
Definition: BitStream.h:113
static std::string streamDisplay(unsigned)
Dumps bit stream in string.
Definition: Utilities.cc:136

◆ dump() [10/36]

void dump ( const std::string &  message = "",
const std::string &  pre = "" 
) const

dumps contents.

"message" is to select information to dump. "pre" will be printed in head of each line.

Definition at line 42 of file Board.cc.

43 {
44 cout << pre << _name;
45 const string tab = pre + " ";
46 if (msg.find("detail") != string::npos) {
47 cout << endl;
48 cout << pre << "System clock:" << _clockSystem->name() << endl;
49 cout << pre << "Data clock:" << _clockData->name() << endl;
50 cout << pre << "Input user clock:" << _clockUserInput->name() << endl;
51 cout << pre << "Output user clock:" << _clockUserOutput->name()
52 << endl;
53 cout << pre << "Input channels" << endl;
54 for (unsigned i = 0; i < _inputChannels.size(); i++) {
55 cout << tab << _inputChannels[i]->name() << endl;
56 }
57 cout << pre << "Output channels" << endl;
58 for (unsigned i = 0; i < _outputChannels.size(); i++) {
59 cout << tab << _outputChannels[i]->name() << endl;
60 }
61 }
62 cout << endl;
63 }
const std::string _name
Name of a board.
Definition: Board.h:84

◆ dump() [11/36]

void dump ( const std::string &  message = "",
const std::string &  pre = "" 
) const

dumps contents.

"message" is to select information to dump. "pre" will be printed in head of each line.

Definition at line 88 of file Clock.cc.

90 {
91 cout << pre << _name;
92 if (_source) {
93 cout << ":sync'd to " << _source->name() << endl;
94 cout << pre << " multiplication factor=" << _multi << endl;
95 cout << pre << " division factor =" << _div << endl;
96 } else {
97 cout << endl;
98 }
99
100 cout << pre << " offset :" << _offset << endl
101 << pre << " freq(MHz):" << _frequency << endl
102 << pre << " cycle(ns):" << _cycle << endl
103 << pre << " min pos :" << _min << endl
104 << pre << " max pos :" << _max << endl
105 << pre << " min(ns) :" << minTiming() << endl
106 << pre << " max(ns) :" << maxTiming() << endl;
107
108 cout << pre << " numeric limit of int (min,max="
109 << numeric_limits<int>::min() << ","
110 << numeric_limits<int>::max() << ")" << endl;
111 }
const unsigned _div
Division factor.
Definition: Clock.h:125
const std::string _name
Name.
Definition: Clock.h:116
int _max
Clock max. count.
Definition: Clock.h:140
const double _frequency
Frequency in MHz.
Definition: Clock.h:131
int _min
Clock min. count.
Definition: Clock.h:137
const unsigned _multi
Multiplication factor.
Definition: Clock.h:122
const TRGClock * _source
Clock source.
Definition: Clock.h:119
double maxTiming(void) const
returns max. timing.
Definition: Clock.h:172
double minTiming(void) const
returns min. timing.
Definition: Clock.h:164

◆ dump() [12/36]

void dump ( const std::string &  message = "",
const std::string &  pre = "" 
) const

dumps contents.

"message" is to select information to dump. "pre" will be printed in head of each line.

Definition at line 139 of file Signal.cc.

141 {
142
143 string tmp;
144 tmp.resize(_name.size());
145 transform(_name.cbegin(), _name.cend(), tmp.begin(), ::toupper);
146
147 const bool ctr = tmp.find("CLOCKCOUNTER") != string::npos;
148
149 cout << pre << _name << ":#signal=" << _history.size();
150
151 if (msg.find("clock") != string::npos ||
152 msg.find("detail") != string::npos) {
153 cout << ":clock=" << _clock->name();
154 }
155
156 cout << endl;
157
158 if (_history.size() && (! ctr)) {
159 for (unsigned i = 0; i < _history.size(); i++)
160 _history[i].dump(msg, pre + " ");
161 }
162 }
std::string _name
Name.
Definition: Signal.h:175

◆ dump() [13/36]

void dump ( const std::string &  message = "",
const std::string &  pre = "" 
) const

dumps contents.

"message" is to select information to dump. "pre" will be printed in head of each line.

Definition at line 193 of file SignalBundle.cc.

195 {
196 cout << pre << _name << ":" << size() << " signal vector(s)" << endl;
197 for (unsigned i = 0; i < size(); i++)
198 (* this)[i]->dump(msg, " " + pre);
199 }
std::string _name
Name.
Definition: SignalBundle.h:103

◆ dump() [14/36]

void dump ( const std::string &  message = "",
const std::string &  pre = "" 
) const

dumps contents.

"message" is to select information to dump. "pre" will be printed in head of each line.

Definition at line 64 of file SignalVector.cc.

66 {
67
68 cout << pre << _name << ":" << size() << " signal(s)" << endl;
69
70 const bool det = msg.find("detail") != string::npos;
71 const bool clk = msg.find("clock") != string::npos;
72
73 if (det || clk)
74 cout << pre << ":clock=" << _clock->name();
75
76 if (det)
77 for (unsigned i = 0; i < size(); i++)
78 (* this)[i].dump(msg, " " + pre + "bit" +
79 TRGUtil::itostring(i) + ":");
80 else
81 for (unsigned i = 0; i < size(); i++)
82 if ((* this)[i].active())
83 (* this)[i].dump(msg, " " + pre + "bit" +
84 TRGUtil::itostring(i) + ":");
85 }
std::string _name
Name.
Definition: SignalVector.h:101

◆ dump() [15/36]

void dump ( const std::string &  message = "",
const std::string &  pre = "" 
) const

dumps contents.

"message" is to select information to dump. "pre" will be printed in head of each line.

Definition at line 199 of file State.cc.

201 {
202
203// bool bin = true;
204 bool large = (_size > 60) || msg.find("large") != string::npos;
205
206 if (! large) {
207 cout << pre << "size=" << _size << ",";
208 for (unsigned i = 0; i < _size; i++) {
209 const unsigned j = _size - i - 1;
210 if ((j % 8) == 7)
211 cout << "_";
212 if ((* this)[j])
213 cout << "1";
214 else
215 cout << "0";
216 }
217 cout << dec << endl;
218 } else {
219 cout << pre << "size=" << _size << endl;
220
221 const unsigned nPerLines = 64;
222 const unsigned lines = _size / nPerLines + 1;
223 const unsigned rem = _size % nPerLines;
224
225 cout << "TRGState" <<
226 " +56 +48 +40 +32 +24 +16 +8"
227 << " +0" << endl;
228
229 bool skipLast = false;
230 for (unsigned i = 0; i < lines; i++) {
231 const unsigned n0 = (i == 0) ? rem - 1 : nPerLines - 1;
232 const int n1 = 0;
233 const int os = (lines - i - 1) * nPerLines;
234
235 const string b = TRGUtilities::itostring(os);
236
237 TRGState s = subset(n1 + os, n0 - n1 + 1);
238
239// s.dump("", "*** ");
240
241 bool skip = false;
242 if (! s.active())
243 skip = true;
244
245 if (skip) {
246 if (!skipLast) {
247 cout << "... (all zero)" << endl;
248 }
249
250 skipLast = true;
251 continue;
252 }
253
254 skipLast = false;
255
256 cout.width(5);
257 cout << b;
258 cout << " ";
259
260 if (i == 0) {
261 unsigned n = nPerLines - rem + (nPerLines - rem) / 8;
262 if (rem % 8) ++n;
263 for (unsigned j = 0; j < n; j++)
264 cout << " ";
265 }
266
267 for (int j = n0; j >= n1; --j) {
268 const unsigned v = (* this)[j + os];
269
270 if ((j % 8) == 7)
271 cout << "_";
272 if (v)
273 cout << "1";
274 else
275 cout << "0";
276 }
277 cout << endl;
278 }
279 }
280
281 // else {
282 // cout << pre << "size=" << _size << ",0x";
283 // bool first = true;
284 // for (unsigned i = 0; i < _n; i++) {
285 // const unsigned j = _n - i - 1;
286 // if (((j % 4) == 3) && (! first))
287 // cout << "_";
288 // cout << hex << _state[j];
289 // first = false;
290 // }
291 // cout << dec << endl;
292
293 // cout << pre << "size=" << _size << ",0x";
294 // bool first = true;
295 // for (unsigned i = 0; i < _n; i++) {
296 // const unsigned j = _n - i - 1;
297 // if (! first)
298 // cout << "_";
299 // cout << hex << _state[j];
300 // cout << "(";
301 // for (unsigned k = 0; k < 4; k++) {
302 // unsigned c = ((_state[j] >> (4 - k + 1) * 8) & 0xff);
303 // if (c < 0x10)
304 // cout << ".";
305 // cout << c;
306 // }
307 // cout << ")";
308 // first = false;
309 // }
310 // cout << dec << endl;
311 // }
312 }
TRGState(unsigned bitSize=0)
Default constructor.
Definition: State.cc:30
TRGState subset(unsigned i, unsigned n) const
returns subset from i with n bits.
Definition: State.cc:356

◆ dump() [16/36]

void dump ( const std::string &  message = "",
const std::string &  pre = "" 
) const

dumps contents.

"message" is to select information to dump. "pre" will be printed in head of each line.

Definition at line 87 of file Time.cc.

89 {
90 cout << pre << "time(clock):";
91
92 if (_edge)
93 cout << " o ";
94 else
95 cout << " . ";
96
97 cout << _time;
98 cout << " abs=" << _clock->absoluteTime(_time);
99 if (msg.find("name") != string::npos ||
100 msg.find("detail") != string::npos) {
101 cout << " (" << _name << ")";
102 }
103 cout << endl;
104 }
std::string _name
Name.
Definition: Time.h:120
bool _edge
Edge type. true : rising, false : falling.
Definition: Time.h:114

◆ dump() [17/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
virtual

dumps debug information.

Reimplemented in TRGCDCSegment, and TRGCDCWire.

Definition at line 52 of file Cell.cc.

53 {
54 cout << pre;
55 cout << "w " << _id;
56 cout << ",local " << _localId;
57 cout << ",layer " << layerId();
58 cout << ",super layer " << superLayerId();
59 cout << ",local layer " << localLayerId();
60 cout << endl;
61 if (msg.find("neighbor") != string::npos) {
62// for (unsigned i = 0; i < 7; i++)
63// if (neighbor(i))
64// neighbor(i)->dump("", pre + TRGUtil::itostring(i) + " ");
65 }
66 }
const unsigned _id
ID.
Definition: Cell.h:166
const unsigned _localId
Local ID.
Definition: Cell.h:169
unsigned localLayerId(void) const
returns local layer id in a super layer.
Definition: Cell.h:228
unsigned superLayerId(void) const
returns super layer id.
Definition: Cell.h:221

◆ dump() [18/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
virtual

dumps debug information.

Reimplemented in TRGCDCSegmentHit.

Definition at line 69 of file CellHit.cc.

71 {
72 std::cout << pre;
73 std::cout << _cell.name();
74 if (msg.find("state") != std::string::npos ||
75 msg.find("detail") != std::string::npos) {
76 std::cout << ",state";
77 TRGUtil::bitDisplay(_state);
78 if (track()) std::cout << ",trk ";
79 }
80 if (msg.find("position") != std::string::npos ||
81 msg.find("detail") != std::string::npos) {
82 cout << ",xy=" << _xyPosition;
83 }
84 if (msg.find("drift") != std::string::npos ||
85 msg.find("detail") != std::string::npos) {
86 if (_state & CellHitLeftMask) std::cout << ", L";
87 if (_state & CellHitRightMask) std::cout << ", R";
88 std::cout << ",dl " << _drift[0] << "+-" << _driftError[0];
89 std::cout << ",dr " << _drift[1] << "+-" << _driftError[1];
90 }
91 if (msg.find("mc") != std::string::npos ||
92 msg.find("detail") != std::string::npos) {
93 cout << ",mcpart=" << iMCParticle();
94 cout << ",flightTime=" << simHit()->getFlightTime();
95 cout << ",driftLength=" << simHit()->getDriftLength() << endl;
96 _cell.signal().dump("detail", pre + " ");
97 }
98 std::cout << std::endl;
99 }
double getFlightTime() const
The method to get flight time.
Definition: CDCSimHit.h:184
double getDriftLength() const
The method to get drift length.
Definition: CDCSimHit.h:181
const HepGeom::Point3D< double > & _xyPosition
position in the middle of wire. z is always zero, however.
Definition: CellHit.h:189
unsigned _state
state, defined above
Definition: CellHit.h:181
virtual const TRGSignal & signal(void) const =0
returns trigger output. Null will returned if no signal.
virtual std::string name(void) const =0
returns name.
const CDCSimHit * simHit(void) const
Access to CDCSimHit.
Definition: CellHit.cc:140
unsigned iMCParticle(void) const
returns an index to MCParticle.
Definition: CellHit.h:374
const void * track(void) const
assigns a pointer to a TTrack.
Definition: CellHit.h:317

◆ dump() [19/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const

dump debug info

Definition at line 39 of file Fitter.cc.

40 {
41 }

◆ dump() [20/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
virtual

dumps debug information.

Reimplemented in TRGCDCHoughPlaneMulti, and TRGCDCHoughPlaneMulti2.

Definition at line 223 of file HoughPlaneBase.cc.

225 {
226 std::cout << prefix << "dump of " << name() << ":" << message;
227 if (message != "region") {
228 bool first = true;
229 const unsigned n = _nX * _nY;
230 unsigned nDump = 0;
231 for (unsigned i = 0; i < n; i++) {
232 if (entry(i)) {
233 if (first)
234 first = false;
235 else
236 std::cout << ",";
237 if (!(nDump % 10)) std::cout << std::endl;
238 std::cout << i << "-" << entry(i);
239 ++nDump;
240 }
241 }
242 if (first)
243 std::cout << "no active cell";
244 }
245 std::cout << std::endl;
246// for (unsigned i = 0; i < _regions.length(); i++) {
247 for (unsigned i = 0; i < _regions.size(); i++) {
248 std::cout << prefix << " region " << i << ":";
249// for (unsigned j = 0; j < _regions[i]->length(); j++) {
250 for (unsigned j = 0; j < _regions[i]->size(); j++) {
251// const unsigned id = * (* _regions[i])[j];
252 const unsigned id = (* _regions[i])[j];
253 std::cout << id << "(" << entry(id) << "),";
254 }
255 std::cout << std::endl;
256 }
257// if (_regions.length())
258 if (_regions.size())
259 std::cout << std::endl;
260 }
const unsigned _nX
# of x bins.
virtual unsigned entry(unsigned id) const =0
returns count of a cell.
const unsigned _nY
# of y bins.

◆ dump() [21/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const

dumps debug information.

Definition at line 103 of file Layer.cc.

104 {
105 cout << pre;
106 cout << "layer " << _id;
107 cout << ", " << stereoType();
108 cout << ", super layer " << _superLayerId;
109 cout << ", local layer " << _localLayerId;
110 if (axial()) cout << ", axial ";
111 else cout << ", stereo ";
112 cout << _axialStereoLayerId;
113 if (axial()) cout << ", axial super ";
114 else cout << ", stereo super ";
116 cout << ", " << _nCells << " wires";
117 cout << endl;
118 // for (int i=0;i<_nCells;++i) wire(i)->dump(pre);
119 }
const unsigned _id
ID in whole CDC.
Definition: Layer.h:119
const unsigned _superLayerId
Super layer ID.
Definition: Layer.h:122
const unsigned _localLayerId
ID in a super layer.
Definition: Layer.h:125
const std::string stereoType(void) const
returns "A" or "U" or "V" depending on stereo type.
Definition: Layer.h:238

◆ dump() [22/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const

dumps debug information.

Definition at line 207 of file Link.cc.

208 {
209 dump_base(msg, pre);
210 cout << endl;
211 }
void dump_base(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: Link.cc:145

◆ dump() [23/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const

Dumps debug information.

Definition at line 156 of file Relation.cc.

158 {
159
160 const unsigned n = nContributors();
161 cout << prefix << "#contributions=" << n << endl;
162 const string tab = prefix + " ";
163 for (unsigned i = 0; i < n; i++) {
164 cout << tab << i << ":MCTrkID=" << contributor(i)
165 << ",purity=" << purity(i) * 100 << "%"
166 << " [PDG=" << mcParticle(i).getPDG() << "]" << endl;
167 }
168 }
int getPDG() const
Return PDG code of particle.
Definition: MCParticle.h:112
const MCParticle & mcParticle(unsigned i=0) const
returns i'th contributor.
Definition: Relation.cc:79
unsigned nContributors(void) const
returns /# of contributors.
Definition: Relation.h:97
unsigned contributor(unsigned i=0) const
returns i'th contributor of MCParticle.
Definition: Relation.cc:41
float purity(unsigned i=0) const
returns i'th purity.
Definition: Relation.cc:90

◆ dump() [24/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
virtual

dumps debug information.

Reimplemented in TRGCDCCircle.

Definition at line 65 of file TrackBase.cc.

66 {
67// bool detail = (cmd.find("detail") != string::npos);
68
69 string tab = TRGDebug::tab() + pre;
70 cout << tab << "Dump of " << name() << endl;
71 tab += " ";
72
73 cout << tab << "status=" << status() << ":p=" << p() << ":x=" << x()
74 << endl;
75 cout << tab;
76 for (unsigned i = 0; i < _nTs; i++) {
77 cout << i << ":" << _ts[i].size();
78 for (unsigned j = 0; j < _ts[i].size(); j++) {
79 if (j == 0)
80 cout << "(";
81 else
82 cout << ",";
83 const TCLink& l = * _ts[i][j];
84 cout << l.cell()->name();
85 }
86 if (_ts[i].size())
87 cout << "),";
88 }
89// if (detail) {
90
91// }
92 cout << endl;
93 }
const unsigned _nTs
Size of _ts.
Definition: TrackBase.h:163
int status(void) const
returns status.
Definition: TrackBase.h:199
virtual const CLHEP::Hep3Vector & p(void) const
returns momentum vector.
Definition: TrackBase.h:206
virtual const CLHEP::Hep3Vector & x(void) const
returns position vector.
Definition: TrackBase.h:213

◆ dump() [25/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const

dumps debug information.

Definition at line 81 of file TrackMC.cc.

82 {
83 std::cout << pre;
84 std::cout << id() << ":";
85 std::cout << pType() << ":";
86 if (_mother) std::cout << _mother->id();
87 else std::cout << "-";
88 std::cout << ":";
89 std::cout << _p << ":" << _v;
90 std::cout << std::endl;
91 }
TRGCDCTrackMC * _mother
pointer to mother TRGCDCTrackMC
Definition: TrackMC.h:93
const CLHEP::HepLorentzVector _p
momentum
Definition: TrackMC.h:97
const CLHEP::Hep3Vector _v
vertex
Definition: TrackMC.h:99
int pType(void) const
returns particle type.
Definition: TrackMC.h:130

◆ dump() [26/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
overridevirtual

dumps debug information.

Reimplemented from TRGCDCTrackBase.

Definition at line 61 of file Circle.cc.

62 {
63 cout << pre;
64 cout << "c=" << _center;
65 cout << ":r=" << _radius;
66 if (_plane) cout << ":hp=" << _plane->name();
67 cout << endl;
68 if (cmd.find("detail") != string::npos)
69 TRGCDCTrackBase::dump(cmd, pre);
70 }
const TRGCDCHoughPlane * _plane
Hough plane.
Definition: Circle.h:87
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TrackBase.cc:65

◆ dump() [27/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
inlineoverridevirtual

dump debug info

Reimplemented from TRGCDCHoughPlaneBase.

Definition at line 119 of file HoughPlaneMulti.h.

120 {
122 }

◆ dump() [28/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
inlineoverridevirtual

Dumps debug information.

Reimplemented from TRGCDCHoughPlaneBase.

Definition at line 213 of file HoughPlaneMulti2.h.

214 {
215 if (a == "merged") {
217 } else if (a == "region") {
219 } else {
220 for (unsigned i = 0; i < _nLayers; i++) {
221 std::cout << b << name() << " : layer " << i << std::endl;
222 _layers[i]->dump();
223 }
224 std::cout << b << name() << " : merged plane " << std::endl;
226 }
227 }

◆ dump() [29/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
overridevirtual

dumps debug information.

Reimplemented from TRGCDCCell.

Definition at line 71 of file Segment.cc.

73 {
74 cout << pre << name() << " (ptn=" << hitPattern() << ")" << endl;
75 if ((msg.find("geometry") != string::npos) ||
76 (msg.find("detail") != string::npos)) {
77 cout << pre << "id " << id();
78 cout << ",local " << localId();
79 cout << ",layer " << layerId();
80 cout << ",super layer " << superLayerId();
81 cout << ",local layer " << localLayerId();
82 cout << endl;
83 }
84 if ((msg.find("hit") != string::npos) ||
85 (msg.find("detail") != string::npos)) {
86 cout << pre << "Wires ";
87 for (unsigned i = 0; i < _wires.size(); i++) {
88 cout << _wires[i]->name();
89 if (i < _wires.size() - 1)
90 cout << ",";
91 else
92 cout << endl;
93 }
94 if (_hits.size() == 0) {
95 cout << pre << "no wire hit" << endl;
96 } else {
97 cout << pre << "WHit dump : ";
98 for (unsigned i = 0; i < _hits.size(); i++) {
99 cout << _hits[i]->cell().name();
100 if (i < _hits.size() - 1)
101 cout << ",";
102 else
103 cout << endl;
104 }
105 for (unsigned i = 0; i < _hits.size(); i++) {
106 _hits[i]->dump(msg, pre + " ");
107 }
108 }
109 if (hit()) {
110 cout << pre << "SHit dump" << endl;
111 hit()->dump(msg, pre + " ");
112 } else {
113 cout << pre << "no TSHit" << endl;
114 }
115 }
116// if (msg.find("neighbor") != string::npos ||
117// msg.find("detail") != string::npos) {
118// for (unsigned i = 0; i < 7; i++)
119// if (neighbor(i))
120// neighbor(i)->dump("", pre + TRGCDC::itostring(i) + " ");
121// }
122 if ((msg.find("trigger") != string::npos) ||
123 (msg.find("detail") != string::npos)) {
124 if (_signal.active())
125 _signal.dump(msg, pre + " ");
126 else
127 cout << pre << "no trigger signal" << endl;
128 }
129 }
unsigned hitPattern(void) const
returns hit pattern.
Definition: Segment.cc:535
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
dumps debug information.
Definition: SegmentHit.cc:71
bool active(void) const
returns true if there is a signal.
Definition: Signal.h:277
const TRGCDCSegmentHit * hit(void) const
returns a pointer to a TRGCDCSegmentHit.
Definition: Segment.h:236
unsigned localId(void) const
returns local id in a layer.
Definition: Cell.h:207

◆ dump() [30/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
overridevirtual

dumps debug information.

Reimplemented from TRGCDCCellHit.

Definition at line 71 of file SegmentHit.cc.

73 {
74 TCCHit::dump(message, prefix);
75 }

◆ dump() [31/36]

void dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
overridevirtual

dumps debug information.

Reimplemented from TRGCDCCell.

Definition at line 54 of file Wire.cc.

55 {
56 cout << pre;
57 cout << "w " << id();
58 cout << ",local " << localId();
59 cout << ",layer " << layerId();
60 cout << ",super layer " << superLayerId();
61 cout << ",local layer " << localLayerId();
62 cout << endl;
63 if (msg.find("neighbor") != string::npos) {
64 for (unsigned i = 0; i < 7; i++)
65 if (neighbor(i))
66 neighbor(i)->dump("", pre + TRGUtil::itostring(i) + " ");
67 }
68 if (msg.find("trigger") != string::npos ||
69 msg.find("detail") != string::npos) {
70 signal().dump(msg, pre + " ");
71 }
72 }
const TRGSignal & signal(void) const override
returns an input to the trigger. This is sync'ed to 1GHz clock.
Definition: Wire.h:242

◆ dump() [32/36]

void dump ( const std::vector< const TRGCDCLink * > &  links,
const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
)
static

dumps TRGCDCLinks.

Definition at line 225 of file Link.cc.

228 {
229
230 //...Basic options...
231 bool mc = (msg.find("mc") != string::npos);
232 bool sort = (msg.find("sort") != string::npos);
233 bool flag = (msg.find("flag") != string::npos);
234
235 //...Strong options...
236 bool detail = (msg.find("detail") != string::npos);
237 if (detail)
238 mc = flag = true;
239
240 vector<const TRGCDCLink*> tmp = links;
241 if (sort)
242 std::sort(tmp.begin(), tmp.end(), TRGCDCLink::sortById);
243// sort(tmp.begin(), tmp.end(), TRGCDCLink::sortById);
244 unsigned n = tmp.size();
245 unsigned nForFit = 0;
246#define MCC_MAX 1000
247 unsigned MCC0[MCC_MAX];
248 unsigned MCC1[MCC_MAX];
249 memset((char*) MCC0, 0, sizeof(unsigned) * MCC_MAX);
250 memset((char*) MCC1, 0, sizeof(unsigned) * MCC_MAX);
251 bool MCCOverFlow = false;
252
253 cout << pre;
254 for (unsigned i = 0; i < n; i++) {
255 const TRGCDCLink& l = * tmp[i];
256
257// if (mc) {
258// unsigned mcId = 999;
259// if (l.hit()) {
260// if (l.hit()->mc())
261// if (l.hit()->mc()->hep())
262// mcId = l.hit()->mc()->hep()->id();
263// if (mcId < MCC_MAX) {
264// ++MCC0[mcId];
265// if (l.hit()->state() & WireHitFittingValid) {
266// if (! (l.hit()->state() & WireHitInvalidForFit))
267// ++MCC1[mcId];
268// }
269// }
270// else {
271// MCCOverFlow = true;
272// }
273// }
274// }
275 if (flag) {
276 if (l.hit()) {
277 if (l.hit()->state() & CellHitFittingValid) {
278 if (!(l.hit()->state() & CellHitInvalidForFit))
279 ++nForFit;
280 }
281 }
282 }
283 if (i)
284 cout << ",";
285 l.dump_base(msg);
286 }
287 if (n)
288 cout << ",Total " << n << " links";
289 else
290 cout << "no link";
291 if (flag) cout << ",fv " << nForFit << " l(s)";
292 if (mc) {
293 unsigned nMC = 0;
294 cout << ", mc";
295 for (unsigned i = 0; i < MCC_MAX; i++) {
296 if (MCC0[i] > 0) {
297 ++nMC;
298 cout << i << ":" << MCC0[i] << ",";
299 }
300 }
301 cout << "total " << nMC << " mc contributions";
302 if (flag) {
303 nMC = 0;
304 cout << ", fv mc";
305 for (unsigned i = 0; i < MCC_MAX; i++) {
306 if (MCC1[i] > 0) {
307 ++nMC;
308 cout << i << ":" << MCC1[i] << ",";
309 }
310 }
311 cout << " total " << nMC << " mc fit valid contribution(s)";
312 }
313
314 // cppcheck-suppress knownConditionTrueFalse
315 if (MCCOverFlow)
316 cout << "(counter overflow)";
317 }
318 cout << endl;
319
320 //...Parent...
321 if (mc) {
322 vector<const Belle2::TRGCDCTrackMC*> list = Belle2::TRGCDCTrackMC::list();
323 if (! list.size()) return;
324 cout << pre;
325//cnv unsigned nMC = 0;
326 for (unsigned i = 0; i < MCC_MAX; i++) {
327 if (MCC0[i] > 0) {
328 const Belle2::TRGCDCTrackMC* h = list[i];
329// cout << ", mc" << i << "(" << h->pType() << ")";
330 cout << ", mc" << i << "(";
331 if (h)
332 cout << h->pType() << ")";
333 else
334 cout << "?)";
335 while (h) {
336 const Belle2::TRGCDCTrackMC* m = h->mother();
337 if (m) {
338 cout << "<-mc" << m->id();
339 h = m;
340 } else {
341 break;
342 }
343 }
344 }
345 }
346 if (MCCOverFlow)
347 cout << "(counter overflow)";
348 cout << endl;
349 }
350 }
A class to represent a GEN_HEPEVT particle in tracking.
Definition: TrackMC.h:32
static bool sortById(const TRGCDCLink *a, const TRGCDCLink *b)
sorts by ID.
Definition: Link.cc:471
static std::vector< const TRGCDCTrackMC * > list(void)
returns a list of TRGCDCTrackMC's.
Definition: TrackMC.cc:94

◆ dump() [33/36]

void dump ( const std::vector< TRGCDCLink * > &  links,
const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
)
static

dumps TRGCDCLinks.

Definition at line 214 of file Link.cc.

217 {
218 vector<const TRGCDCLink*> clinks;
219 for (unsigned i = 0; i < links.size(); i++)
220 clinks.push_back(links[i]);
221 TRGCDCLink::dump(clinks, msg, pre);
222 }

◆ dump() [34/36]

void dump ( const TRGCDCLink link,
const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
)
static

dumps TRGCDCLinks.

Definition at line 353 of file Link.cc.

356 {
357 vector<const TRGCDCLink*> tmp;
358 tmp.push_back(& link);
359 dump(tmp, msg, pre);
360 }
TRGCDCLink * link(void) const
returns a pointer to a TRGCDCLink.
Definition: Link.h:595

◆ dump() [35/36]

void dump ( unsigned  layerId) const
inline

Dumps debug information.

Definition at line 198 of file HoughPlaneMulti2.h.

199 {
200 _layers[a]->dump();
201 }

◆ dump() [36/36]

void dump ( void  )

Unpacker of the TRGGRLMatch.

Definition at line 87 of file TRGGRLMatch.cc.

88 {
89
90 cout << "double center_x = " << _center_x << ";" << endl;
91 cout << "double center_y = " << _center_y << ";" << endl;
92 cout << "double center_z = " << _center_z << ";" << endl;
93 cout << "double radius = " << _r << ";" << endl;
94 cout << "double pt = " << _pt << ";" << endl;
95 cout << "double p = " << _p << ";" << endl;
96 cout << "double cluster_x = " << _cluster_x << ";" << endl;
97 cout << "double cluster_y = " << _cluster_y << ";" << endl;
98 cout << "double cluster_z = " << _cluster_z << ";" << endl;
99 cout << "double ex_x = " << _ex_x << ";" << endl;
100 cout << "double ex_y = " << _ex_y << ";" << endl;
101 cout << "double ex_z = " << _ex_z << ";" << endl;
102
103 }

◆ dump_base()

void dump_base ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
private

dumps debug information.

Definition at line 145 of file Link.cc.

146 {
147
148 //...Basic options...
149// bool track = (msg.find("track") != string::npos);
150// bool mc = (msg.find("mc") != string::npos);
151 bool pull = (msg.find("pull") != string::npos);
152 bool flag = (msg.find("flag") != string::npos);
153 bool stereo = (msg.find("stereo") != string::npos);
154 bool pos = (msg.find("position") != string::npos);
155
156 //...Strong options...
157 bool breif = (msg.find("breif") != string::npos);
158 bool detail = (msg.find("detail") != string::npos);
159 if (detail)
160// track = mc = pull = flag = stereo = pos = true;
161 pull = flag = stereo = pos = true;
162 if (breif)
163 pull = flag = true;
164
165 //...Output...
166 cout << pre;
167 if (_hit) {
168 cout << cell()->name();
169 } else {
170 cout << "No hit linked";
171 }
172// if (mc) {
173// if (_hit) {
174// if (_hit->mc()) {
175// if (_hit->mc()->hep())
176// cout << "(mc" << _hit->mc()->hep()->id() << ")";
177// else
178// cout << "(mc?)";
179// }
180// else {
181// cout << "(mc?)";
182// }
183// }
184// }
185 if (pull)
186 cout << "[pul=" << this->pull() << "]";
187 if (flag) {
188 if (_hit) {
189 if (_hit->state() & CellHitFindingValid)
190 cout << "o";
191 if (_hit->state() & CellHitFittingValid)
192 cout << "+";
193 if (_hit->state() & CellHitInvalidForFit)
194 cout << "x";
195 }
196 }
197 if (stereo) {
198 cout << "{" << leftRight() << "," << _zStatus << "}";
199 }
200 if (pos) {
201 cout << ",pos=" << position();
202 cout << ",drift=" << drift(0) << "," << drift(1);
203 }
204 }
float drift(void) const
returns drift distance.
Definition: Link.h:663
const HepGeom::Point3D< double > & position(void) const
returns position.
Definition: Link.h:551
double pull(void) const
returns pull.
Definition: Link.h:461
unsigned leftRight(void) const
returns left-right. 0:left, 1:right, 2:wire
Definition: Link.h:523
unsigned state(void) const
returns state.
Definition: CellHit.h:259

◆ dump_log() [1/2]

void dump_log ( void  ) const

Dump all the details of _mosb into a .log file, do it in the end of simulate()

Definition at line 1600 of file FrontEnd.cc.

1601 {
1602
1603 if (type() == innerInside) dump_log_innerInside();
1604 else if (type() == innerOutside) dump_log_innerOutside();
1605 else if (type() == outerInside) dump_log_outerInside();
1606 else if (type() == outerOutside) dump_log_outerOutside();
1607
1608 }
void dump_log_innerOutside(void) const
Dump all the details of _mosb into a .log file, for innerOutside FE.
Definition: FrontEnd.cc:1668
void dump_log_outerInside(void) const
Dump all the details of _mosb into a .log file, for outerInside FE.
Definition: FrontEnd.cc:1718
boardType type(void) const
returns type.
Definition: FrontEnd.cc:59
void dump_log_innerInside(void) const
Dump all the details of _mosb into a .log file, for innerInside FE.
Definition: FrontEnd.cc:1611
void dump_log_outerOutside(void) const
Dump all the details of _mosb into a .log file, for outerOutside FE.
Definition: FrontEnd.cc:1771

◆ dump_log() [2/2]

void dump_log ( void  ) const

Dump all the details of _mosb into a .log file, do it in the end of simulate()

Definition at line 1092 of file Merger.cc.

1093 {
1094 if (type() == innerType) {
1096 } else {
1098 }
1099 }
void dump_log_outer(void) const
dump_log for outer Merger
Definition: Merger.cc:1173
unitType type(void) const
return type.
Definition: Merger.cc:59
void dump_log_inner(void) const
dump_log for inner Merger
Definition: Merger.cc:1102

◆ dump_log_inner()

void dump_log_inner ( void  ) const

dump_log for inner Merger

Definition at line 1102 of file Merger.cc.

1103 {
1104
1105 const TRGClock& dClock = TRGCDC::getTRGCDC()->dataClock();
1106 ofstream output((name() + ".log").c_str());
1107
1108 output << "Inner Superlayer Merger output dump" << endl << endl;
1109
1110 const std::vector<int> changetime = _mosb->stateChanges();
1111 std::vector<vector<int>> boolvector(changetime.size());
1112 for (unsigned ch_t = 0; ch_t < changetime.size(); ch_t++) {
1113
1114 for (unsigned b = 0; b < (* _mosb)[0]->size(); b++) {
1115 boolvector[ch_t].push_back(((* _mosb)[0]->state(changetime[ch_t])[b]) ? 1 : 0);
1116 }
1117
1118 output << "# of clk: " << changetime[ch_t] << " (" << dClock.absoluteTime(changetime[ch_t]) << " ns), signal vector: " << endl;
1119
1120 output << "Hitmap: " << endl << " ";
1121 for (int b = 0; b < 80; b++) {
1122 output << boolvector[ch_t][79 - b] << " ";
1123 if (b == 15) output << endl;
1124 else if (b == 31) output << endl << " ";
1125 else if (b == 47) output << endl ;
1126 else if (b == 63) output << endl << " ";
1127 }
1128 output << endl;
1129
1130 for (int b = 0; b < 16; b++) {
1131 output << "PT#" << b << ": " << boolvector[ch_t][ 80 + 4 * b + 3 ] << boolvector[ch_t][ 80 + 4 * b + 2 ] << boolvector[ch_t][ 80 + 4
1132 * b + 1 ]
1133 << boolvector[ch_t][ 80 + 4 * b ] << endl;
1134 }
1135 output << endl;
1136
1137 for (int b = 0; b < 16; b++) {
1138 output << "FT#" << b << ": " << boolvector[ch_t][ 144 + 4 * b + 3 ] << boolvector[ch_t][ 144 + 4 * b + 2 ] << boolvector[ch_t][ 144
1139 + 4 * b + 1 ]
1140 << boolvector[ch_t][ 144 + 4 * b ] << endl;
1141 }
1142
1143 output << "Secondary: " << endl;
1144 for (int b = 0; b < 16; b++) {
1145 output << boolvector[ch_t][ 223 - b ] ;
1146 }
1147
1148 output << endl;
1149 output << "ET#0(31): " << endl << boolvector[ch_t][227] << boolvector[ch_t][226] << boolvector[ch_t][225] << boolvector[ch_t][224]
1150 << endl;
1151 output << "ET#1(64(out32)): " << endl << boolvector[ch_t][231] << boolvector[ch_t][230] << boolvector[ch_t][229] <<
1152 boolvector[ch_t][228]
1153 << endl;
1154 output << "ET#2(32, 48, 64, 65(outside 0, 16, 32, 33)): " << endl << boolvector[ch_t][235] << boolvector[ch_t][234] <<
1155 boolvector[ch_t][233]
1156 << boolvector[ch_t][232] << endl;
1157 output << "ET#3(31, 47, 62, 63, 78, 79(inside 31, outside 15, 30, 31, 46, 47)): " << endl << boolvector[ch_t][239] <<
1158 boolvector[ch_t][238]
1159 << boolvector[ch_t][237] << boolvector[ch_t][236] << endl;
1160 output << "ET#4(63, 79(outside 31, 47)): " << endl << boolvector[ch_t][243] << boolvector[ch_t][242] << boolvector[ch_t][241]
1161 << boolvector[ch_t][240] << endl;
1162
1163
1164
1165 output << endl;
1166 }
1167
1168 output.close();
1169
1170 }
TRGSignalBundle * _mosb
outptu signal bundle
Definition: Merger.h:136
std::vector< int > stateChanges(void) const
returns a list of clock position of state change.
const TRGClock & dataClock(void) const
returns the data clock.
Definition: TRGCDC.h:982

◆ dump_log_innerInside()

void dump_log_innerInside ( void  ) const

Dump all the details of _mosb into a .log file, for innerInside FE.

Definition at line 1611 of file FrontEnd.cc.

1612 {
1613
1614 const TRGClock& dClock = TRGCDC::getTRGCDC()->dataClock();
1615 ofstream output((name() + ".log").c_str());
1616
1617 output << "InnerInside FrontEnd output dump" << endl << endl;
1618
1619 const std::vector<int> changetime = _osb->stateChanges();
1620 std::vector<vector<int>> boolvector(changetime.size());
1621 for (unsigned ch_t = 0; ch_t < changetime.size(); ch_t++) {
1622
1623 for (unsigned b = 0; b < (* _osb)[0]->size(); b++) {
1624 boolvector[ch_t].push_back(((* _osb)[0]->state(changetime[ch_t])[b]) ? 1 : 0);
1625 }
1626
1627 output << "# of clk: " << changetime[ch_t] << " (" << dClock.absoluteTime(changetime[ch_t]) << " ns), signal vector: " << endl;
1628
1629 output << "Hitmap: " << endl ;
1630 for (unsigned b = 0; b < 32; b++) {
1631 output << boolvector[ch_t][31 - b] << " " ;
1632 if (b == 15) output << endl << " ";
1633 }
1634 output << endl;
1635
1636 for (unsigned b = 0; b < 16; b++) {
1637 output << "PT#" << b << ": " << boolvector[ch_t][ 32 + 5 * b + 4 ] << boolvector[ch_t][ 32 + 5 * b + 3 ] << boolvector[ch_t][ 32 + 5
1638 * b + 2 ]
1639 << boolvector[ch_t][ 32 + 5 * b + 1 ] << boolvector[ch_t][ 32 + 5 * b] << endl;
1640 }
1641 output << endl;
1642
1643 output << "Secondary: ";
1644 for (int b = 0; b < 16; b++) {
1645 output << boolvector[ch_t][ 127 - b ] ;
1646 }
1647 output << endl;
1648
1649 for (unsigned b = 0; b < 16; b++) {
1650 output << "FT#" << b << ": " << boolvector[ch_t][ 128 + 5 * b + 4 ] << boolvector[ch_t][ 128 + 5 * b + 3 ] << boolvector[ch_t][ 128
1651 + 5 * b + 2 ]
1652 << boolvector[ch_t][ 128 + 5 * b + 1 ] << boolvector[ch_t][ 128 + 5 * b] << endl;
1653 }
1654
1655 output << endl;
1656 output << "ET#0(cell 31): " << endl << boolvector[ch_t][212] << boolvector[ch_t][211] << boolvector[ch_t][210]
1657 << boolvector[ch_t][209] << boolvector[ch_t][208] << endl;
1658
1659 output << endl;
1660 }
1661
1662 output.close();
1663
1664 }
TRGSignalBundle * _osb
Output signal bundle.
Definition: FrontEnd.h:151

◆ dump_log_innerOutside()

void dump_log_innerOutside ( void  ) const

Dump all the details of _mosb into a .log file, for innerOutside FE.

Definition at line 1668 of file FrontEnd.cc.

1669 {
1670
1671 const TRGClock& dClock = TRGCDC::getTRGCDC()->dataClock();
1672 ofstream output((name() + ".log").c_str());
1673
1674 output << "InnerOutside FrontEnd output dump" << endl << endl;
1675
1676 const std::vector<int> changetime = _osb->stateChanges();
1677 std::vector<vector<int>> boolvector(changetime.size());
1678 for (unsigned ch_t = 0; ch_t < changetime.size(); ch_t++) {
1679
1680 for (unsigned b = 0; b < (* _osb)[0]->size(); b++) {
1681 boolvector[ch_t].push_back(((* _osb)[0]->state(changetime[ch_t])[b]) ? 1 : 0);
1682 }
1683
1684 output << "# of clk: " << changetime[ch_t] << " (" << dClock.absoluteTime(changetime[ch_t]) << " ns), signal vector: " << endl;
1685
1686 output << "Hitmap: " << endl << " ";
1687 for (unsigned b = 0; b < 48; b++) {
1688 output << boolvector[ch_t][47 - b] << " ";
1689 if (b == 15) output << endl ;
1690 else if (b == 31) output << endl << " ";
1691 }
1692 output << endl;
1693
1694 for (unsigned b = 0; b < 16; b++) {
1695 output << "FT#" << b << ": " << boolvector[ch_t][ 48 + 5 * b + 4 ] << boolvector[ch_t][ 48 + 5 * b + 3 ] << boolvector[ch_t][ 48 + 5
1696 * b + 2 ]
1697 << boolvector[ch_t][ 48 + 5 * b + 1 ] << boolvector[ch_t][ 48 + 5 * b] << endl;
1698 }
1699
1700 output << endl;
1701 output << "ET#0(cell 32): " << endl << boolvector[ch_t][132] << boolvector[ch_t][131] << boolvector[ch_t][130]
1702 << boolvector[ch_t][129] << boolvector[ch_t][128] << endl;
1703 output << "ET#1(cell 0, 16, 32, 33): " << endl << boolvector[ch_t][137] << boolvector[ch_t][136] << boolvector[ch_t][135]
1704 << boolvector[ch_t][134] << boolvector[ch_t][133] << endl;
1705 output << "ET#0(cell 15, 30, 31, 46, 47): " << endl << boolvector[ch_t][142] << boolvector[ch_t][141] << boolvector[ch_t][140]
1706 << boolvector[ch_t][139] << boolvector[ch_t][138] << endl;
1707 output << "ET#3(cell 31, 47): " << endl << boolvector[ch_t][147] << boolvector[ch_t][146] << boolvector[ch_t][145]
1708 << boolvector[ch_t][144] << boolvector[ch_t][143] << endl;
1709
1710 output << endl;
1711 }
1712
1713 output.close();
1714 }

◆ dump_log_outer()

void dump_log_outer ( void  ) const

dump_log for outer Merger

Definition at line 1173 of file Merger.cc.

1174 {
1175
1176 const TRGClock& dClock = TRGCDC::getTRGCDC()->dataClock();
1177 ofstream output((name() + ".log").c_str());
1178
1179 output << "Outer Superlayer Merger output dump" << endl << endl;
1180
1181 const std::vector<int> changetime = _mosb->stateChanges();
1182 std::vector<vector<int>> boolvector(changetime.size());
1183 for (unsigned ch_t = 0; ch_t < changetime.size(); ch_t++) {
1184
1185 for (unsigned b = 0; b < (* _mosb)[0]->size(); b++) {
1186 boolvector[ch_t].push_back(((* _mosb)[0]->state(changetime[ch_t])[b]) ? 1 : 0);
1187 }
1188
1189 output << "# of clk: " << changetime[ch_t] << " (" << dClock.absoluteTime(changetime[ch_t]) << " ns), signal vector: " << endl;
1190
1191 output << "Hitmap: " << endl << " ";
1192 for (int b = 0; b < 80; b++) {
1193 output << boolvector[ch_t][79 - b] << " ";
1194 if (b == 15) output << endl;
1195 else if (b == 31) output << endl << " ";
1196 else if (b == 47) output << endl ;
1197 else if (b == 63) output << endl << " ";
1198 }
1199 output << endl;
1200
1201 for (int b = 0; b < 16; b++) {
1202 output << "PT#" << b << ": " << boolvector[ch_t][ 80 + 4 * b + 3 ] << boolvector[ch_t][ 80 + 4 * b + 2 ] << boolvector[ch_t][ 80 + 4
1203 * b + 1 ]
1204 << boolvector[ch_t][ 80 + 4 * b ] << endl;
1205 }
1206 output << endl;
1207
1208 for (int b = 0; b < 16; b++) {
1209 output << "FT#" << b << ": " << boolvector[ch_t][ 144 + 4 * b + 3 ] << boolvector[ch_t][ 144 + 4 * b + 2 ] << boolvector[ch_t][ 144
1210 + 4 * b + 1 ]
1211 << boolvector[ch_t][ 144 + 4 * b ] << endl;
1212 }
1213
1214 output << "Secondary: ";
1215 for (int b = 0; b < 16; b++) {
1216 output << boolvector[ch_t][ 223 - b ] ;
1217 }
1218
1219 output << endl;
1220 output << "ET#0(63(outside 15)): " << endl << boolvector[ch_t][227] << boolvector[ch_t][226] << boolvector[ch_t][225] <<
1221 boolvector[ch_t][224]
1222 << endl;
1223 output << "ET#1(0,64(inside 0, out 16)): " << endl << boolvector[ch_t][231] << boolvector[ch_t][230] << boolvector[ch_t][229]
1224 << boolvector[ch_t][228] << endl;
1225 output << "ET#2(15,31,63,79(inside 15, 31, outside 15, 31)): " << endl << boolvector[ch_t][235] << boolvector[ch_t][234]
1226 << boolvector[ch_t][233] << boolvector[ch_t][232] << endl;
1227
1228 output << endl;
1229 }
1230
1231
1232 output.close();
1233
1234 }

◆ dump_log_outerInside()

void dump_log_outerInside ( void  ) const

Dump all the details of _mosb into a .log file, for outerInside FE.

Definition at line 1718 of file FrontEnd.cc.

1719 {
1720
1721 const TRGClock& dClock = TRGCDC::getTRGCDC()->dataClock();
1722 ofstream output((name() + ".log").c_str());
1723
1724 output << "OuterInside FrontEnd output dump" << endl << endl;
1725
1726 const std::vector<int> changetime = _osb->stateChanges();
1727 std::vector<vector<int>> boolvector(changetime.size());
1728 for (unsigned ch_t = 0; ch_t < changetime.size(); ch_t++) {
1729
1730 for (unsigned b = 0; b < (* _osb)[0]->size(); b++) {
1731 boolvector[ch_t].push_back(((* _osb)[0]->state(changetime[ch_t])[b]) ? 1 : 0);
1732 }
1733
1734 output << "# of clk: " << changetime[ch_t] << " (" << dClock.absoluteTime(changetime[ch_t]) << " ns), signal vector: " << endl;
1735
1736 output << "Hitmap: " << endl << " ";
1737 for (unsigned b = 0; b < 48; b++) {
1738 output << boolvector[ch_t][47 - b] << " " ;
1739 if (b == 15) output << endl;
1740 else if (b == 31) output << endl << " ";
1741 }
1742 output << endl;
1743
1744 for (unsigned b = 0; b < 16; b++) {
1745 output << "PT#" << b << ": " << boolvector[ch_t][ 48 + 5 * b + 4 ] << boolvector[ch_t][ 48 + 5 * b + 3 ] << boolvector[ch_t][ 48 + 5
1746 * b + 2 ]
1747 << boolvector[ch_t][ 48 + 5 * b + 1 ] << boolvector[ch_t][ 48 + 5 * b] << endl;
1748 }
1749 output << endl;
1750
1751 for (unsigned b = 0; b < 16; b++) {
1752 output << "FT#" << b << ": " << boolvector[ch_t][ 128 + 5 * b + 4 ] << boolvector[ch_t][ 128 + 5 * b + 3 ] << boolvector[ch_t][ 128
1753 + 5 * b + 2 ]
1754 << boolvector[ch_t][ 128 + 5 * b + 1 ] << boolvector[ch_t][ 128 + 5 * b] << endl;
1755 }
1756
1757 output << endl;
1758 output << "ET#0(cell 0): " << endl << boolvector[ch_t][212] << boolvector[ch_t][211] << boolvector[ch_t][210]
1759 << boolvector[ch_t][209] << boolvector[ch_t][208] << endl;
1760 output << "ET#1(cell 15, 31): " << endl << boolvector[ch_t][217] << boolvector[ch_t][216] << boolvector[ch_t][215]
1761 << boolvector[ch_t][214] << boolvector[ch_t][213] << endl;
1762
1763 output << endl;
1764 }
1765
1766 output.close();
1767
1768 }

◆ dump_log_outerOutside()

void dump_log_outerOutside ( void  ) const

Dump all the details of _mosb into a .log file, for outerOutside FE.

Definition at line 1771 of file FrontEnd.cc.

1772 {
1773
1774 const TRGClock& dClock = TRGCDC::getTRGCDC()->dataClock();
1775 ofstream output((name() + ".log").c_str());
1776
1777 output << "OuterOutside FrontEnd output dump" << endl << endl;
1778 const std::vector<int> changetime = _osb->stateChanges();
1779 std::vector<vector<int>> boolvector(changetime.size());
1780 for (unsigned ch_t = 0; ch_t < changetime.size(); ch_t++) {
1781
1782 for (unsigned b = 0; b < (* _osb)[0]->size(); b++) {
1783 boolvector[ch_t].push_back(((* _osb)[0]->state(changetime[ch_t])[b]) ? 1 : 0);
1784 }
1785
1786 output << "# of clk: " << changetime[ch_t] << " (" << dClock.absoluteTime(changetime[ch_t]) << " ns), signal vector: " << endl;
1787
1788 output << "Hitmap: " << endl;
1789 for (unsigned b = 0; b < 48; b++) {
1790 output << boolvector[ch_t][47 - b] << " ";
1791 if (b == 15) output << endl << " ";
1792 else if (b == 31) output << endl ;
1793 }
1794 output << endl;
1795
1796 for (unsigned b = 0; b < 16; b++) {
1797 output << "PT#" << b << ": " << boolvector[ch_t][ 48 + 5 * b + 4 ] << boolvector[ch_t][ 48 + 5 * b + 3 ] << boolvector[ch_t][ 48 + 5
1798 * b + 2 ]
1799 << boolvector[ch_t][ 48 + 5 * b + 1 ] << boolvector[ch_t][ 48 + 5 * b] << endl;
1800 }
1801 output << endl;
1802
1803 for (unsigned b = 0; b < 16; b++) {
1804 output << "FT#" << b << ": " << boolvector[ch_t][ 128 + 5 * b + 4 ] << boolvector[ch_t][ 128 + 5 * b + 3 ] << boolvector[ch_t][ 128
1805 + 5 * b + 2 ]
1806 << boolvector[ch_t][ 128 + 5 * b + 1 ] << boolvector[ch_t][ 128 + 5 * b] << endl;
1807 }
1808
1809 output << endl;
1810 output << "ET#0(cell 16): " << endl << boolvector[ch_t][212] << boolvector[ch_t][211] << boolvector[ch_t][210]
1811 << boolvector[ch_t][209] << boolvector[ch_t][208] << endl;
1812 output << "ET#1(cell 15, 31): " << endl << boolvector[ch_t][217] << boolvector[ch_t][216] << boolvector[ch_t][215]
1813 << boolvector[ch_t][214] << boolvector[ch_t][213] << endl;
1814
1815
1816 output << endl;
1817 }
1818
1819
1820 output.close();
1821 }

◆ dumpCOE()

void dumpCOE ( const std::string &  fileName = "",
int  start = 0,
int  stop = 0 
) const

makes coe output.

Definition at line 300 of file SignalBundle.cc.

301 {
302
303 string fn = fnIn;
304
305 if (fnIn.size() == 0)
306 fn = name();
307
308 //...Open a file to output...
309 ofstream file(fn + ".coe", ios::out);
310 if (! file.is_open()) {
311 cout << "!!! " << name() << " can not open file : " << fn << endl;
312 return;
313 }
314
315 // //...Determine start clock to output...
316 // int clk0 = _clock->max();
317 // vector<int> sc = stateChanges();
318 // for (unsigned i = 0; i < sc.size(); i++) {
319 // if (state(sc[i]).active()) {
320 // clk0 = sc[i];
321 // break;
322 // }
323 // }
324
325 // //...Determine end clock to output...
326 // int clk1 = _clock->min();
327 // for (unsigned i = 0; i < sc.size(); i++) {
328 // if (sc[i] < clk0)
329 // continue;
330
331 // if (state(sc[i]).active()) {
332 // clk1 = sc[i];
333 // }
334 // }
335
336 // //...No active case...
337 // if (clk0 > clk1) {
338 // clk0 = 0;
339 // clk1 = 1;
340 // }
341
342 // if (TRGDebug::level()) {
343 // cout << TRGDebug::tab() << "SignalBundle::dumpCOE : " << name()
344 // << endl;
345 // cout << TRGDebug::tab() << " clock region to output" << endl;
346 // cout << TRGDebug::tab() << " start=" << clk0 << endl;
347 // cout << TRGDebug::tab() << " end =" << clk1 << endl;
348 // }
349
350 // //...32 clocks as default : 2016/04...
351 // clk0 = 0;
352 // clk1 = 31;
353
354 int clk0 = start;
355 int clk1 = stop;
356
357 TRGState tmp = state(0);
358 const TRGSignalVector& cc = _clock->clockCounter();
359
360 file << "; " << name() << endl;
361 file << "; generated at " << TRGUtil::dateString() << endl;
362 file << "; start clock = " << clk0 << endl;
363 file << "; end clock = " << clk1 << endl;
364 file << "; bit size = " << tmp.size() << " + clock counter(" << cc.size()
365 << ")" << endl;
366 file << ";" << endl;
367 file << "memory_initialization_radix=2;" << endl;
368 file << "memory_initialization_vector=" << endl;
369
370 for (int i = clk0; i <= clk1; i++) {
371 TRGState sd = state(i);
372 TRGState sc = cc.state(i);
373 file << sc;
374 file << sd;
375 if (i == clk1)
376 file << ";" << endl;
377 else
378 file << "," << endl;
379 }
380
381 file.close();
382
383 }
const TRGSignalVector & clockCounter(void) const
returns the clock counter.
Definition: Clock.cc:166

◆ dz()

double dz ( void  ) const
inline

returns dz.

Definition at line 292 of file Helix.h.

293 {
294 return m_ac[3];
295 }

◆ Ea() [1/2]

const CLHEP::HepSymMatrix & Ea ( const CLHEP::HepSymMatrix &  newdA)
inline

sets helix paramters and error matrix.

Definition at line 339 of file Helix.h.

340 {
341 return m_Ea = i;
342 }
CLHEP::HepSymMatrix m_Ea
Ea HepSymMatrix parameter.
Definition: Helix.h:218

◆ Ea() [2/2]

const CLHEP::HepSymMatrix & Ea ( void  ) const
inline

returns error matrix.

Definition at line 320 of file Helix.h.

321 {
322 return m_Ea;
323 }

◆ edge()

bool edge ( void  ) const
inline

returns edge information.

Definition at line 156 of file Time.h.

157 {
158 return _edge;
159 }

◆ edges()

vector< TRGCDCLink * > edges ( const std::vector< TRGCDCLink * > &  list)
static

returns links which are edges.

This function assumes that all TRGCDCLink's are in the same super layer.

Definition at line 527 of file Link.cc.

528 {
529 vector<TRGCDCLink*> a;
530
531 unsigned n = list.size();
532 if (n < 2) return a;
533 else if (n == 2) return list;
534
535 const TCCell* w = list[0]->cell();
536 unsigned nWires = w->layer().nCells();
537 unsigned center = w->localId();
538
539 unsigned left = 0;
540 unsigned right = 0;
541 TRGCDCLink* leftL = list[0];
542 TRGCDCLink* rightL = list[0];
543 for (unsigned i = 1; i < n; i++) {
544 w = list[i]->cell();
545 unsigned id = w->localId();
546
547 unsigned distance0, distance1;
548 if (id > center) {
549 distance0 = id - center;
550 distance1 = nWires - distance0;
551 } else {
552 distance1 = center - id;
553 distance0 = nWires - distance1;
554 }
555
556 if (distance0 < distance1) {
557 if (distance0 > right) {
558 right = distance0;
559 rightL = list[i];
560 }
561 } else {
562 if (distance1 > left) {
563 left = distance1;
564 leftL = list[i];
565 }
566 }
567 }
568
569 a.push_back(leftL);
570 a.push_back(rightL);
571 return a;
572 }

◆ efficiency3D()

float efficiency3D ( unsigned  trkID,
std::map< unsigned, unsigned > &  numTSsParticle 
) const

returns efficiency of TS for 3D

Definition at line 129 of file Relation.cc.

130 {
131
132 // # of found TSs/ # of true TSs
133 unsigned nFoundTS = 0;
134 unsigned nTrueTS = 0;
135
136 // Find number of found TSs. One for each layer.
137 for (unsigned iStereoSuperLayer = 0; iStereoSuperLayer < 4; iStereoSuperLayer++) {
138 if (((this->track()).links(2 * iStereoSuperLayer + 1)).size() > 0) nFoundTS += 1;
139 }
140
141 // Find number of true TSs.
142 map<unsigned, unsigned>::iterator itTSF = numTSsParticle.find(trkID);
143 if (itTSF != numTSsParticle.end()) nTrueTS = itTSF->second;
144 else {
145 //cout<<"[Error] TRGCDCRelation::efficiency3D. No mc stereo TSs for track."<<endl;
146 return -1;
147 }
148
149 //cout<<"[JB] Found TS: "<< nFoundTS <<" nTrue TS: " << nTrueTS << endl;
150
151 return float(nFoundTS) / float(nTrueTS);
152
153 }
const TRGCDCTrackBase & track(void) const
returns a track.
Definition: Relation.h:90

◆ enterStage()

void enterStage ( const std::string &  stageName)
static

Declare that you enter new stage.

Definition at line 24 of file Debug.cc.

25 {
26 if (_level)
27 cout << tab() << "--> ";
28 _stages.push_back(name);
29 if (_level)
30 cout << name << endl;
31 }
static std::vector< std::string > _stages
Storage for stages.
Definition: Debug.h:47
static int _level
Debug level. 0:do nothing, 1:show you flow, 2:show you detail, 10:show you very detail.
Definition: Debug.h:50

◆ entrance()

const HepGeom::Point3D< double > & entrance ( void  ) const
inline

returns an entrance point.

Definition at line 114 of file WireHitMC.h.

115 {
116 return _entrance;
117 }
HepGeom::Point3D< double > _entrance
entrance vector
Definition: WireHitMC.h:79

◆ entry() [1/4]

unsigned entry ( unsigned  id) const
inlineoverridevirtual

returns entry in a cell.

Implements TRGCDCHoughPlaneBase.

Definition at line 130 of file HoughPlane.h.

131 {
132 if (id < nX() * nY()) return _cell[id];
133 return 0;
134 }
void id(unsigned serialId, unsigned &x, unsigned &y) const
returns x and y for serialID.

◆ entry() [2/4]

unsigned entry ( unsigned  id) const
inlineoverridevirtual

returns entry in a cell.

Implements TRGCDCHoughPlaneBase.

Definition at line 175 of file HoughPlaneBoolean.h.

176 {
177 const unsigned b0 = serialId / 32;
178 const unsigned b1 = serialId % 32;
179
180#ifdef TRASAN_DEBUG
181 if (b0 >= _n)
182 std::cout << "TRGCDCHoughPlaneBoolean::entry !!! given serialId is too large"
183 << " : "
184 << "max=" << _n * 32 << ",serialId=" << serialId << std::endl;
185#endif
186
187 return (_cell[b0] >> b1) & 1;
188 }

◆ entry() [3/4]

unsigned entry ( unsigned  x,
unsigned  y 
) const
inlineoverridevirtual

returns entry in a cell.

Implements TRGCDCHoughPlaneBase.

Definition at line 138 of file HoughPlane.h.

139 {
140 if (x < nX())
141 if (y < nY())
142 return _cell[nY() * x + y];
143 return 0;
144 }

◆ entry() [4/4]

unsigned entry ( unsigned  x,
unsigned  y 
) const
inlineoverridevirtual

returns count of a cell.

Implements TRGCDCHoughPlaneBase.

Definition at line 192 of file HoughPlaneBoolean.h.

193 {
194 return entry(nY() * x + y);
195 }
unsigned entry(unsigned id) const override
returns entry in a cell.

◆ entryVhdlCode()

void entryVhdlCode ( )

Function to print entry VHDL code.

Definition at line 195 of file JSignalData.cc.

196 {
197 m_vhdlEntry += "function decimal_string_to_unsigned(decimal_string: string; wanted_bitwidth: integer) return unsigned is\n";
198 m_vhdlEntry += " variable tmp_unsigned: unsigned(wanted_bitwidth-1 downto 0) := (others => '0');\n";
199 m_vhdlEntry += " variable character_value: integer;\n";
200 m_vhdlEntry += "begin\n";
201 m_vhdlEntry += " for string_pos in decimal_string'range loop\n";
202 m_vhdlEntry += " case decimal_string(string_pos) is\n";
203 m_vhdlEntry += " when '0' => character_value := 0;\n";
204 m_vhdlEntry += " when '1' => character_value := 1;\n";
205 m_vhdlEntry += " when '2' => character_value := 2;\n";
206 m_vhdlEntry += " when '3' => character_value := 3;\n";
207 m_vhdlEntry += " when '4' => character_value := 4;\n";
208 m_vhdlEntry += " when '5' => character_value := 5;\n";
209 m_vhdlEntry += " when '6' => character_value := 6;\n";
210 m_vhdlEntry += " when '7' => character_value := 7;\n";
211 m_vhdlEntry += " when '8' => character_value := 8;\n";
212 m_vhdlEntry += " when '9' => character_value := 9;\n";
213 m_vhdlEntry += " when others => report(\"Illegal number\") severity failure;\n";
214 m_vhdlEntry += " end case;\n";
215 m_vhdlEntry += " tmp_unsigned := resize(tmp_unsigned * 10, wanted_bitwidth);\n";
216 m_vhdlEntry += " tmp_unsigned := tmp_unsigned + character_value;\n";
217 m_vhdlEntry += " end loop;\n";
218 m_vhdlEntry += " return tmp_unsigned;\n";
219 m_vhdlEntry += "end decimal_string_to_unsigned;\n";
220 m_vhdlEntry += "function decimal_string_to_signed(decimal_string: string; wanted_bitwidth: positive) return signed is\n";
221 m_vhdlEntry += " variable tmp_signed: signed(wanted_bitwidth-1 downto 0) := (others => '0');\n";
222 m_vhdlEntry += " variable character_value: integer := 0;\n";
223 m_vhdlEntry += " variable sign_value: integer := 1;\n";
224 m_vhdlEntry += "begin\n";
225 m_vhdlEntry += " for string_pos in decimal_string'range loop\n";
226 m_vhdlEntry += " case decimal_string(string_pos) is\n";
227 m_vhdlEntry += " when '-' => sign_value := -1;\n";
228 m_vhdlEntry += " when '0' => character_value := 0;\n";
229 m_vhdlEntry += " when '1' => character_value := 1;\n";
230 m_vhdlEntry += " when '2' => character_value := 2;\n";
231 m_vhdlEntry += " when '3' => character_value := 3;\n";
232 m_vhdlEntry += " when '4' => character_value := 4;\n";
233 m_vhdlEntry += " when '5' => character_value := 5;\n";
234 m_vhdlEntry += " when '6' => character_value := 6;\n";
235 m_vhdlEntry += " when '7' => character_value := 7;\n";
236 m_vhdlEntry += " when '8' => character_value := 8;\n";
237 m_vhdlEntry += " when '9' => character_value := 9;\n";
238 m_vhdlEntry += " when others => report(\"Illegal number\") severity failure;\n";
239 m_vhdlEntry += " end case;\n";
240 m_vhdlEntry += " tmp_signed := resize(tmp_signed * 10, wanted_bitwidth);\n";
241 m_vhdlEntry += " tmp_signed := tmp_signed + sign_value * character_value;\n";
242 m_vhdlEntry += " end loop;\n";
243 m_vhdlEntry += " return tmp_signed;\n";
244 m_vhdlEntry += "end decimal_string_to_signed;\n";
245 }
std::string m_vhdlEntry
Holds VHDL entry code.
Definition: JSignalData.h:81

◆ err_dis_inv()

static double err_dis_inv ( double  x,
double  y,
double  w,
double  a,
double  b 
)
static

distance error

Definition at line 30 of file Lpav.cc.

31 {
32 if (a == 0 && b == 0) {
33 return w;
34 } else {
35 double f = x * b - y * a;
36 double rsq = x * x + y * y;
37 f *= f;
38 return w * rsq / f;
39 }
40 }

◆ extrapolate()

int extrapolate ( double  r,
double &  phi,
double &  dphi 
) const

const member function for extrapolation

Definition at line 541 of file Lpav.cc.

542 {
543 double x, y;
544 if (m_chisq < 0) return -1;
545 if (xy(r, x, y) != 0) return -1;
546 phi = std::atan2(y, x);
547 if (phi < 0) phi += (2 * M_PI);
548 CLHEP::HepVector v(4);
549 v(1) = x;
550 v(2) = y;
551 v(3) = 1;
552 v(4) = r * r;
553// CLHEP::HepSymMatrix l = cov().similarityT(v);
554#ifdef HAVE_EXCEPTION
555 try {
556#endif
557// CLHEP::HepSymMatrix l = cov().similarity(v.T());
558// // std::cout << "delta d^2=" << l(1,1);
559// if (l(1,1)>0) {
560 double l = cov().similarity(v);
561 if (l > 0) {
562 double ls = std::sqrt(l);
563 dphi = ls / r;
564 // std::cout << " delta d=" << ls << " dphi=" << dphi;
565 }
566#ifdef HAVE_EXCEPTION
567 } catch (TRGCDCLpav::Singular) {
568 return -1;
569 }
570#endif
571// std::cout << std::endl;
572 return 0;
573 }
bool xy(double, double &, double &, int dir=0) const
private const member functions
Definition: Lpar.cc:157
double phi(double r, int dir=0) const
const member functions
Definition: Lpar.cc:188

◆ fastClear() [1/3]

void fastClear ( void  )

clears TRGCDC information.

Definition at line 981 of file TRGCDC.cc.

981{}

◆ fastClear() [2/3]

void fastClear ( void  )

clears TRGGDL information.

Definition at line 204 of file TRGGDL.cc.

205 {
206 }

◆ fastClear() [3/3]

void fastClear ( void  )

clears TRGGRL information.

Definition at line 138 of file TRGGRL.cc.

139 {
140 }

◆ fastestTime() [1/2]

float fastestTime ( int  clk0) const

fastest time in TSHit that is larger of equal to clk0.

Definition at line 405 of file Segment.cc.

406 {
407 int fastest = 9999;
408 for (unsigned iw = 0; iw < _wires.size(); ++iw) {
409 if (_wires[iw]->signal().active()) {
410 for (unsigned itdc = 0, edges = _wires[iw]->signal().nEdges(); itdc < edges; itdc += 2) {
411 float dt = _wires[iw]->signal()[itdc]->time();
412 if (dt >= clk0) {
413 if (dt < fastest) fastest = dt;
414 break;
415 }
416 }
417 }
418 }
419 return fastest;
420 }

◆ fastestTime() [2/2]

float fastestTime ( void  ) const

return fastest time in TSHit.

Definition at line 387 of file Segment.cc.

388 {
389 if ((LUT()->getValue(lutPattern()))) {
390 float tmpFastTime = 9999;
391 for (unsigned i = 0; i < _wires.size(); i++) {
392 if (_wires[i]->signal().active()) {
393 float dt = _wires[i]->signal()[0]->time();
394 if (dt < tmpFastTime) {
395 tmpFastTime = dt;
396 }
397 }
398 }
399 return tmpFastTime;
400 } else
401 return -1;
402 }
unsigned lutPattern(void) const
hit pattern containing bit for priority position
Definition: Segment.cc:571
const TRGCDCLUT * LUT(void) const
returns LUT
Definition: Segment.h:258

◆ fastestTimingInner()

void fastestTimingInner ( unsigned  tsfID,
const unsigned  nTSF,
TRGSignalVector s 
) const
private

Make TRGSignals for the fastest timing bits.

Definition at line 1675 of file TrackSegmentFinder.cc.

1678 {
1679
1680 const unsigned rem = t % 16;
1681
1682 if ((rem > 1) && (rem < 14)) {
1683 s.push_back(* _fasMap[t * 4 + 0]);
1684 s.push_back(* _fasMap[t * 4 + 1]);
1685 s.push_back(* _fasMap[t * 4 + 2]);
1686 s.push_back(* _fasMap[t * 4 + 3]);
1687 return;
1688 }
1689
1690 //...Check hit map if there is a hit...
1691 bool hit = false;
1692 for (unsigned i = 0; i < 11; i++) {
1693 if (s[i + 1].active()) {
1694 hit = true;
1695 break;
1696 }
1697 }
1698
1699 //...No hit case...
1700 if (! hit) {
1701 s.push_back(* _fasMap[t * 4 + 0]);
1702 s.push_back(* _fasMap[t * 4 + 1]);
1703 s.push_back(* _fasMap[t * 4 + 2]);
1704 s.push_back(* _fasMap[t * 4 + 3]);
1705 return;
1706 }
1707
1708 const string sn = "TSF fastest timing inner";
1710
1711 //...Prepare timing signal vectors
1712 TRGSignalVector t0("t0", clockData()); // main
1713 t0.push_back(* _fasMap[t * 4 + 0]);
1714 t0.push_back(* _fasMap[t * 4 + 1]);
1715 t0.push_back(* _fasMap[t * 4 + 2]);
1716 t0.push_back(* _fasMap[t * 4 + 3]);
1717
1718 TRGSignalVector t1("t1", clockData()); // edge
1719 TRGSignal ht0("t0 hit", clockData());
1720 TRGSignal ht1("t1 hit", clockData());
1721 if (rem == 0) {
1722 unsigned n = t / 16;
1723 if (n == 0)
1724 n = nTSF / 16 - 1;
1725 else
1726 --n;
1727
1728 t1.push_back(* _edg3Map[n * 4 + 0]);
1729 t1.push_back(* _edg3Map[n * 4 + 1]);
1730 t1.push_back(* _edg3Map[n * 4 + 2]);
1731 t1.push_back(* _edg3Map[n * 4 + 3]);
1732
1733 ht0 = s[0 + 1];
1734 ht0 |= s[2 + 1];
1735 ht0 |= s[4 + 1];
1736 ht0 |= s[5 + 1];
1737 ht0 |= s[8 + 1];
1738 ht0 |= s[9 + 1];
1739 ht0 |= s[12 + 1];
1740 ht0 |= s[13 + 1];
1741
1742 ht1 = s[1 + 1];
1743 ht1 |= s[3 + 1];
1744 ht1 |= s[6 + 1];
1745 ht1 |= s[7 + 1];
1746 ht1 |= s[10 + 1];
1747 ht1 |= s[11 + 1];
1748 } else if (rem == 1) {
1749 unsigned n = t / 16;
1750 if (n == 0)
1751 n = nTSF / 16 - 1;
1752 else
1753 --n;
1754
1755 t1.push_back(* _edg4Map[n * 4 + 0]);
1756 t1.push_back(* _edg4Map[n * 4 + 1]);
1757 t1.push_back(* _edg4Map[n * 4 + 2]);
1758 t1.push_back(* _edg4Map[n * 4 + 3]);
1759
1760 // ht0 = s[0 + 1];
1761 ht0 = s[1 + 1];
1762 ht0 |= s[2 + 1];
1763 ht0 |= s[3 + 1];
1764 ht0 |= s[4 + 1];
1765 ht0 |= s[5 + 1];
1766 ht0 |= s[7 + 1];
1767 ht0 |= s[8 + 1];
1768 ht0 |= s[9 + 1];
1769 ht0 |= s[10 + 1];
1770 ht0 |= s[12 + 1];
1771 ht0 |= s[13 + 1];
1772
1773 ht1 |= s[6 + 1];
1774 ht1 |= s[11 + 1];
1775 } else if (rem == 14) {
1776 unsigned n = t / 16 + 1;
1777 if (n >= nTSF / 16)
1778 n = 0;
1779
1780 t1.push_back(* _edg1Map[n * 4 + 0]);
1781 t1.push_back(* _edg1Map[n * 4 + 1]);
1782 t1.push_back(* _edg1Map[n * 4 + 2]);
1783 t1.push_back(* _edg1Map[n * 4 + 3]);
1784
1785 ht0 = s[0 + 1];
1786 ht0 |= s[1 + 1];
1787 ht0 |= s[2 + 1];
1788 ht0 |= s[3 + 1];
1789 ht0 |= s[4 + 1];
1790 ht0 |= s[5 + 1];
1791 ht0 |= s[6 + 1];
1792 ht0 |= s[7 + 1];
1793 ht0 |= s[8 + 1];
1794 ht0 |= s[9 + 1];
1795 ht0 |= s[10 + 1];
1796 ht0 |= s[11 + 1];
1797 ht0 |= s[12 + 1];
1798
1799 ht1 = s[13 + 1];
1800 } else {
1801 unsigned n = t / 16 + 1;
1802 if (n >= nTSF / 16)
1803 n = 0;
1804
1805 t1.push_back(* _edg2Map[n * 4 + 0]);
1806 t1.push_back(* _edg2Map[n * 4 + 1]);
1807 t1.push_back(* _edg2Map[n * 4 + 2]);
1808 t1.push_back(* _edg2Map[n * 4 + 3]);
1809
1810 ht0 = s[0 + 1];
1811 ht0 |= s[1 + 1];
1812 ht0 |= s[2 + 1];
1813 ht0 |= s[3 + 1];
1814 ht0 |= s[4 + 1];
1815 ht0 |= s[6 + 1];
1816 ht0 |= s[7 + 1];
1817 ht0 |= s[8 + 1];
1818 ht0 |= s[10 + 1];
1819 ht0 |= s[11 + 1];
1820
1821 ht1 = s[5 + 1];
1822 ht1 |= s[9 + 1];
1823 ht1 |= s[12 + 1];
1824 ht1 |= s[13 + 1];
1825 }
1826
1827 //...State changes...
1828 vector<int> sc = t0.stateChanges();
1829 vector<int> tmp = t1.stateChanges();
1830 sc.insert(sc.end(), tmp.begin(), tmp.end());
1831 std::sort(sc.begin(), sc.end());
1832
1833 //...Loop over state changes...
1834 TRGSignalVector tm("fastest", clockData(), 4);
1835 int last = clockData().max();
1836 for (unsigned i = 0; i < sc.size(); i++) {
1837 if (sc[i] == last)
1838 continue;
1839
1840 int clk = sc[i];
1841
1842 TRGState ts0 = t0.state(clk);
1843 TRGState ts1 = t1.state(clk);
1844 unsigned tm0 = unsigned(ts0);
1845 unsigned tm1 = unsigned(ts1);
1846 bool th0 = ht0.state(clk);
1847 bool th1 = ht1.state(clk);
1848
1849 if ((! th0) && (! th1))
1850 continue;
1851 else if (th0 && th1) {
1852 if (tm1 < tm0)
1853 tm.set(ts1, clk);
1854 else
1855 tm.set(ts0, clk);
1856 } else if (th0)
1857 tm.set(ts0, clk);
1858 else if (th1)
1859 tm.set(ts1, clk);
1860
1861 last = clk;
1862 }
1863
1864 //...Store signals...
1865 s.push_back(tm[0]);
1866 s.push_back(tm[1]);
1867 s.push_back(tm[2]);
1868 s.push_back(tm[3]);
1869
1870 if (TRGDebug::level()) {
1871 ht0.name("t0 hit:" + ht0.name());
1872 ht0.dump("", TRGDebug::tab() + " ");
1873 t0.dump("", TRGDebug::tab() + " ");
1874 ht1.name("t1 hit:" + ht1.name());
1875 ht1.dump("", TRGDebug::tab() + " ");
1876 t1.dump("", TRGDebug::tab() + " ");
1877 tm.dump("", TRGDebug::tab() + " ");
1878 s.dump("", TRGDebug::tab() + " ");
1879 }
1880
1882 }
std::vector< TRGSignal * > _edg4Map
Internal data of the edge timing information.
std::vector< TRGSignal * > _edg1Map
Internal data of the edge timing information.
std::vector< TRGSignal * > _edg2Map
Internal data of the edge timing information.
std::vector< TRGSignal * > _edg3Map
Internal data of the edge timing information.
std::vector< TRGSignal * > _fasMap
Internal data of the fastest hit timing.
const TRGClock & clockData(void) const
returns data clock.
Definition: Board.h:123
int max(void) const
returns max. clock point.
Definition: Clock.h:201

◆ fastestTimingOuter()

void fastestTimingOuter ( unsigned  tsfID,
const unsigned  nTSF,
TRGSignalVector s 
) const
private

Make TRGSignals for the fastest timing bits.

Definition at line 1289 of file TrackSegmentFinder.cc.

1292 {
1293
1294 const unsigned rem = t % 16;
1295
1296 if ((rem != 0) && (rem != 15)) {
1297 s.push_back(* _fasMap[t * 4 + 0]);
1298 s.push_back(* _fasMap[t * 4 + 1]);
1299 s.push_back(* _fasMap[t * 4 + 2]);
1300 s.push_back(* _fasMap[t * 4 + 3]);
1301 return;
1302 }
1303
1304 //...Check hit map if there is a hit...
1305 bool hit = false;
1306 for (unsigned i = 0; i < 11; i++) {
1307 if (s[i + 1].active()) {
1308 hit = true;
1309 break;
1310 }
1311 }
1312
1313 //...No hit case...
1314 if (! hit) {
1315 s.push_back(* _fasMap[t * 4 + 0]);
1316 s.push_back(* _fasMap[t * 4 + 1]);
1317 s.push_back(* _fasMap[t * 4 + 2]);
1318 s.push_back(* _fasMap[t * 4 + 3]);
1319 return;
1320 }
1321
1322 const string sn = "TSF fastest timing outer";
1324
1325 //...Prepare timing signal vectors
1326 TRGSignalVector t0("t0", clockData()); // main
1327 t0.push_back(* _fasMap[t * 4 + 0]);
1328 t0.push_back(* _fasMap[t * 4 + 1]);
1329 t0.push_back(* _fasMap[t * 4 + 2]);
1330 t0.push_back(* _fasMap[t * 4 + 3]);
1331
1332 TRGSignalVector t1("t1", clockData()); // edge
1333 TRGSignal ht0("t0 hit", clockData());
1334 TRGSignal ht1("t1 hit", clockData());
1335 if (rem == 0) {
1336 unsigned n = t / 16;
1337 if (n == 0)
1338 n = nTSF / 16 - 1;
1339 else
1340 --n;
1341
1342 t1.push_back(* _edg2Map[n * 4 + 0]);
1343 t1.push_back(* _edg2Map[n * 4 + 1]);
1344 t1.push_back(* _edg2Map[n * 4 + 2]);
1345 t1.push_back(* _edg2Map[n * 4 + 3]);
1346
1347 ht0 = s[2];
1348 ht0 |= s[3];
1349 ht0 |= s[5];
1350 ht0 |= s[6];
1351 ht0 |= s[8];
1352 ht0 |= s[10];
1353 ht0 |= s[11];
1354
1355 ht1 = s[1];
1356 ht1 |= s[4];
1357 ht1 |= s[7];
1358 ht1 |= s[9];
1359 } else {
1360 unsigned n = t / 16 + 1;
1361 if (n >= nTSF / 16)
1362 n = 0;
1363
1364 t1.push_back(* _edg1Map[n * 4 + 0]);
1365 t1.push_back(* _edg1Map[n * 4 + 1]);
1366 t1.push_back(* _edg1Map[n * 4 + 2]);
1367 t1.push_back(* _edg1Map[n * 4 + 3]);
1368
1369 ht0 = s[1];
1370 ht0 |= s[2];
1371 ht0 |= s[4];
1372 ht0 |= s[5];
1373 ht0 |= s[6];
1374 ht0 |= s[7];
1375 ht0 |= s[8];
1376 ht0 |= s[9];
1377 ht0 |= s[10];
1378
1379 ht1 = s[3];
1380 ht1 |= s[11];
1381 }
1382
1383 //...State changes...
1384 vector<int> sc = t0.stateChanges();
1385 vector<int> tmp = t1.stateChanges();
1386 sc.insert(sc.end(), tmp.begin(), tmp.end());
1387 std::sort(sc.begin(), sc.end());
1388
1389 //...Loop over state changes...
1390 TRGSignalVector tm("fastest", clockData(), 4);
1391 int last = clockData().max();
1392 for (unsigned i = 0; i < sc.size(); i++) {
1393 if (sc[i] == last)
1394 continue;
1395
1396 int clk = sc[i];
1397
1398 TRGState ts0 = t0.state(clk);
1399 TRGState ts1 = t1.state(clk);
1400 unsigned tm0 = unsigned(ts0);
1401 unsigned tm1 = unsigned(ts1);
1402 bool th0 = ht0.state(clk);
1403 bool th1 = ht1.state(clk);
1404
1405 if ((! th0) && (! th1))
1406 continue;
1407 else if (th0 && th1) {
1408 if (tm1 < tm0)
1409 tm.set(ts1, clk);
1410 else
1411 tm.set(ts0, clk);
1412 } else if (th0)
1413 tm.set(ts0, clk);
1414 else if (th1)
1415 tm.set(ts1, clk);
1416
1417 last = clk;
1418 }
1419
1420 //...Store signals...
1421 s.push_back(tm[0]);
1422 s.push_back(tm[1]);
1423 s.push_back(tm[2]);
1424 s.push_back(tm[3]);
1425
1426 if (TRGDebug::level()) {
1427 ht0.name("t0 hit:" + ht0.name());
1428 ht0.dump("", TRGDebug::tab() + " ");
1429 t0.dump("", TRGDebug::tab() + " ");
1430 ht1.name("t1 hit:" + ht1.name());
1431 ht1.dump("", TRGDebug::tab() + " ");
1432 t1.dump("", TRGDebug::tab() + " ");
1433 tm.dump("", TRGDebug::tab() + " ");
1434 s.dump("", TRGDebug::tab() + " ");
1435 }
1436
1438 }

◆ fastSimulation() [1/3]

void fastSimulation ( void  )
private

Fast simulation.

Definition at line 2064 of file TRGCDC.cc.

2065 {
2066 TRGDebug::enterStage("TRGCDC fastSimulation");
2067
2068#ifdef TRGCDC_DISPLAY
2069 D->beginningOfEvent();
2070#endif
2071
2072 //...Options...
2073 const bool trackSegmentSimulationOnly = _fastSimulationMode & 1;
2074 const bool trackSegmentClockSimulation = _fastSimulationMode & 2;
2075
2076 //...TSF simulation...
2078 trackSegmentClockSimulation,
2081 _eventTime.back()->doit(_fverETF, _fprintFirmETF);
2082
2083 if (_segmentHits.size() == 0) setReturnValue(TSF, 1);
2084
2085 if (trackSegmentSimulationOnly) {
2086 TRGDebug::leaveStage("TRGCDC fastSimulation");
2087 return;
2088 }
2089
2090#ifdef TRGCDC_DISPLAY
2091 // dump("hits");
2092 string stg = "fast simulation results";
2093 string inf = "#segments=" + TRGUtilities::itostring(segmentHits().size());
2094 D->clear();
2095 D->stage(stg);
2096 D->information(inf);
2097 D->area().append(hits());
2098 D->area().append(segmentHits());
2099 D->show();
2100 D->run();
2101#endif
2102
2103 //...2D finder and fitter...
2104 if (_perfect2DFinder)
2106 else
2108 if (_trackList2D.size() == 0) setReturnValue(find2D, 1);
2109 if (_trackList2DFitted.size() == 0) setReturnValue(fit2D, 1);
2110
2111 //cout<<"s3D"<<endl;
2112 //...Stereo finder...
2114
2115 //...Check tracks...
2116 if (TRGDebug::level()) {
2117 for (unsigned i = 0; i < _trackList3D.size(); i++) {
2118 const TCTrack& t = *_trackList3D[i];
2119 cout << "> links=" << t.links().size() << endl;
2120 t.dump();
2121 }
2122 }
2123
2124 //...Check relations...
2125 if (TRGDebug::level()) {
2126 for (unsigned i = 0; i < _trackList3D.size(); i++) {
2127 // trackList[i]->relation().dump();
2128 _trackList3D[i]->dump();
2129 }
2130 }
2131
2132 //...Event Time... In ns scale.
2133 // [FIXME] This does nothing.
2134 _eventTime.back()->getT0();
2135
2136 //...3D tracker...
2138 //_fitter3D->doitComplex(_trackList3D);
2139 //cout<<"e3D"<<endl;
2140
2141 // Notify if track's debugValue is not 0
2142 {
2143 // For any track
2144 int t_debugValue = 0;
2145 for (unsigned iTrack = 0; iTrack < _trackList3D.size(); iTrack++) {
2146 t_debugValue |= _trackList3D[iTrack]->getDebugValue(TRGCDCTrack::EDebugValueType::any);
2147 }
2149 //int t_debugValue = TRGCDCTrack::EDebugValueType::any;
2150 //for(unsigned iTrack = 0; iTrack<_trackList3D.size(); iTrack++) {
2151 // t_debugValue &= _trackList3D[iTrack]->getDebugValue(TRGCDCTrack::EDebugValueType::any);
2152 //}
2153 setReturnValue(t_debugValue | getReturnValue());
2154 }
2155
2156 if (TRGDebug::level() > 1) {
2157 for (unsigned iTrack = 0; iTrack < _trackList3D.size(); iTrack++) {
2158 const TCTrack& aTrack = *_trackList3D[iTrack];
2159 if (aTrack.fitted()) {
2160 double fitPt = aTrack.pt();
2161 double fitPhi0 = aTrack.helix().phi0();
2162 int fitCharge = aTrack.charge();
2163 if (fitCharge < 0) {
2164 fitPhi0 -= M_PI;
2165 if (fitPhi0 < 0) fitPhi0 += 2 * M_PI;
2166 }
2167 double fitZ0 = aTrack.helix().dz();
2168 double fitCot = aTrack.helix().tanl();
2169 cout << TRGDebug::tab() << "Track[" << iTrack << "]: charge=" << fitCharge
2170 << " pt=" << fitPt << " phi_c=" << fitPhi0
2171 << " z0=" << fitZ0 << " cot=" << fitCot << endl;
2172 const TCRelation& trackRelation = aTrack.relation();
2173 const MCParticle& trackMCParticle = trackRelation.mcParticle(0);
2174 int mcCharge = trackMCParticle.getCharge();
2175 double mcPt = trackMCParticle.getMomentum().Rho();
2176 double mcPhi0 = 0.0;
2177 if (mcCharge > 0) mcPhi0 = trackMCParticle.getMomentum().Phi() - M_PI / 2;
2178 if (mcCharge < 0) mcPhi0 = trackMCParticle.getMomentum().Phi() + M_PI / 2;
2179 // Change range to [0,2pi]
2180 if (mcPhi0 < 0) mcPhi0 += 2 * M_PI;
2181 // Calculated impact position
2182 ROOT::Math::XYZVector vertex = trackMCParticle.getVertex();
2183 ROOT::Math::PxPyPzEVector vector4 = trackMCParticle.get4Vector();
2184 ROOT::Math::XYVector helixCenter;
2185 ROOT::Math::XYZVector impactPosition;
2186 Fitter3DUtility::findImpactPosition(&vertex, &vector4, mcCharge, helixCenter, impactPosition);
2187 double mcZ0 = impactPosition.Z();
2188 double mcCot = trackMCParticle.getMomentum().z() / trackMCParticle.getMomentum().Rho();
2189 cout << TRGDebug::tab() << "Track[" << iTrack << "]: mcCharge=" << mcCharge
2190 << " mcPt=" << mcPt << " mcPhi_c=" << mcPhi0
2191 << " mcZ0=" << mcZ0 << " mcCot=" << mcCot << endl;
2192 }
2193 }
2194 }
2195
2196 if (TRGDebug::level()) {
2197 cout << TRGDebug::tab() << "Number of 2D tracks : "
2198 << _trackList2D.size() << endl;
2199 cout << TRGDebug::tab() << "Number of 2D fitted tracks : "
2200 << _trackList2DFitted.size() << endl;
2201 cout << TRGDebug::tab() << "Number of 3D tracks : "
2202 << _trackList3D.size() << endl;
2203 }
2204
2205#ifdef TRGCDC_DISPLAY
2206 // dump("hits");
2207 vector<const TCTrack*> t2;
2208 t2.assign(_trackList2D.begin(), _trackList2D.end());
2209 vector<const TCTrack*> t2f;
2210 t2f.assign(_trackList2DFitted.begin(), _trackList2DFitted.end());
2211 vector<const TCTrack*> t3;
2212 t3.assign(_trackList3D.begin(), _trackList3D.end());
2213 D->endOfEvent();
2214 stg = "fast simulation results";
2215 inf = "red:2D, blue:2DF, green:3D";
2216 D->clear();
2217 D->stage(stg);
2218 D->information(inf);
2219 D->area().append(hits());
2220 D->area().append(segmentHits());
2221 D->area().append(t2, Gdk::Color("red"));
2222 D->area().append(t2f, Gdk::Color("blue"));
2223 D->area().append(t3, Gdk::Color("green"));
2224 D->show();
2225 D->run();
2226
2227 // unsigned iFront = 0;
2228 // while (const TCFrontEnd * f = _cdc.frontEnd(iFront++)) {
2229 // D->clear();
2230 // D->beginEvent();
2231 // D->area().append(* f);
2232 // D->run();
2233 // }
2234 // unsigned iMerger = 0;
2235 // while (const TCMerger * f = _cdc.merger(iMerger++)) {
2236 // D->clear();
2237 // D->beginEvent();
2238 // D->area().append(* f);
2239 // D->run();
2240 // }
2241#endif
2242
2243 TRGDebug::leaveStage("TRGCDC fastSimulation");
2244 return;
2245 }
This class is the interface between TSim/basf2 TSF module and the firmware simulation core of XSim/IS...
double getCharge(void) const
Returns particle charge.
Definition: Particle.cc:622
std::vector< TRGCDCTrack * > _trackList3D
Track list for 3D fitted tracks.
Definition: TRGCDC.h:542
unsigned _fastSimulationMode
Fast simulation mode.
Definition: TRGCDC.h:505
std::vector< TRGCDCTrack * > _trackList2DFitted
Track list for 2D fitted tracks.
Definition: TRGCDC.h:539
int _fverETF
Switch for selecting ETF version.
Definition: TRGCDC.h:590
const bool _perfect2DFinder
Switch to activate perfect 2D finder.
Definition: TRGCDC.h:548
std::vector< TRGCDCTrack * > _trackList2D
Track list by 2D finding.
Definition: TRGCDC.h:536
bool _fprintFirmETF
Switch for printing Firmware inputs for ETF.
Definition: TRGCDC.h:593
TRGCDCHoughFinder * _hFinder
Hough finder.
Definition: TRGCDC.h:720
TRGCDCTrackSegmentFinder * _tsFinder
Track Segement Finder.
Definition: TRGCDC.h:711
std::vector< TRGCDCEventTime * > _eventTime
EventTime.
Definition: TRGCDC.h:729
TRGCDCFitter3D * _fitter3D
3D fitter.
Definition: TRGCDC.h:726
TRGCDCPerfectFinder * _pFinder
Perfect 2D finder.
Definition: TRGCDC.h:714
TRGCDCHough3DFinder * _h3DFinder
Hough 3D finder.
Definition: TRGCDC.h:723
static void findImpactPosition(ROOT::Math::XYZVector *mcPosition, ROOT::Math::PxPyPzEVector *mcMomentum, int charge, ROOT::Math::XYVector &helixCenter, ROOT::Math::XYZVector &impactPosition)
MC calculation functions Calculates the impact position of track.
void setReturnValue(EReturnValueType const &moduleName, bool flag)
sets return value for trg cdc module.
Definition: TRGCDC.cc:2748
int FindAndFit(std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
do track finding and fitting (wrapper that can choose between different versions).
Definition: HoughFinder.cc:755
int doit(std::vector< TRGCDCTrack * > &trackList)
Does track fitting.
Definition: Fitter3D.cc:213
int doit(std::vector< TRGCDCTrack * > &trackListClone, std::vector< TRGCDCTrack * > &trackList)
do track finding.
void doit(std::vector< TRGCDCSegment * > &tss, const bool trackSegmentClockSimulation, std::vector< TRGCDCSegmentHit * > &segmentHits, std::vector< TRGCDCSegmentHit * > *segmentHitsSL)
Member functions of doing TSF.
int getReturnValue(void) const
gets return value for trg cdc module.
Definition: TRGCDC.h:1098

◆ fastSimulation() [2/3]

void fastSimulation ( void  )
private

Fast simulation.

Definition at line 241 of file TRGGDL.cc.

242 {
243 B2DEBUG(20, "TRGGDL::fastSimulation starts.");
244 TRGDebug::enterStage("TRGGDL fastSim");
245
246 if (TRGDebug::level())
247 cout << TRGDebug::tab() << name() << " do nothing..." << endl;
248
249 TRGDebug::leaveStage("TRGGDL fastSim");
250
251 if (!m_InputBitsDB) B2INFO("no database of gdl input bits");
252 int N_InputBits = m_InputBitsDB->getninbit();
253 if (!m_FTDLBitsDB) B2INFO("no database of gdl ftdl bits");
254 int N_OutputBits = m_FTDLBitsDB->getnoutbit();
255 if (!m_PrescalesDB) B2INFO("no database of gdl prescale");
256 int N_AlgsBits = m_AlgsDB->getnalgs();
257 if (!m_AlgsDB) B2INFO("no global database of gdl ftd logics");
258 if (N_OutputBits > N_AlgsBits) {
259 // Why this? This creates a problem in for loops later.
260 B2DEBUG(20, "#Algs and #Ftdl is different");
261 N_OutputBits = N_AlgsBits;
262 }
263
264 StoreObjPtr<TRGSummary> GDLResult;
265 if (GDLResult) {
266 B2WARNING("TRGGDL::fastSimulation(): TRGSummary exist already, check it!!!!");
267 return;
268 } else {
269 GDLResult.create();
270 StoreObjPtr<TRGGRLInfo> grlinfo("TRGGRLObjects");
271 if (!grlinfo) {
272 B2WARNING("TRGGRLInfo doesn't exist!!!!");
273 return;
274 } else {
275 if (_debugLevel > 89) printf("TRGGDL:TRGGRLInfo found.\n");
276 }
277
278 _inpBits.clear();
279 int input_summary = 0;
280 for (int i = 0; i < N_InputBits; i++) {
281 if (_debugLevel > 89) printf("TRGGDL:ABC:i(%d)\n", i);
282 if ((i % 32) == 0) {
283 if (i > 0) {
284 GDLResult->setInputBits(i / 32 - 1, input_summary);
285 }
286 input_summary = 0;
287 }
288 if (grlinfo->getInputBits(i)) input_summary |= (1 << (i % 32));
289 _inpBits.push_back(grlinfo->getInputBits(i));
290 if (i == N_InputBits - 1) {
291 GDLResult->setInputBits(i / 32, input_summary);
292 }
293 }
294
295 int L1Summary = 0;
296 int L1Summary_psnm = 0;
297 std::string str;
298 std::vector<std::string> algs;
299 std::ifstream isload(_algFilePath.c_str(), std::ios::in);
300 while (std::getline(isload, str)) {
301 algs.push_back(str);
302 }
303 isload.close();
304
305 for (int i = 0; i < N_OutputBits; i++) {
306 if (_debugLevel > 89) printf("TRGGDL:ABB:i(%d)\n", i);
307 if ((i % 32) == 0) {
308 if (i > 0) {
309 GDLResult->setFtdlBits(i / 32 - 1, L1Summary);
310 GDLResult->setPsnmBits(i / 32 - 1, L1Summary_psnm);
311 }
312 L1Summary = 0;
313 L1Summary_psnm = 0;
314 }
315 std::string alg = _algFromDB ? m_AlgsDB->getalg(i) : algs[i];
316 if (_debugLevel > 89) printf("TRGGDL:i(%d), alg(%s)\n", i, m_AlgsDB->getalg(i).c_str());
317 if (isFiredFTDL(_inpBits, alg)) {
318 L1Summary |= (1 << (i % 32));
319 if (doprescale(m_PrescalesDB->getprescales(i))) {
320 L1Summary_psnm |= (1 << (i % 32));
321 }
322 }
323 GDLResult->setPreScale((i / 32), (i % 32), m_PrescalesDB->getprescales(i));
324 if (i == N_OutputBits - 1) {
325 GDLResult->setFtdlBits(i / 32, L1Summary);
326 GDLResult->setPsnmBits(i / 32, L1Summary_psnm);
327 }
328 }
329
330 //set timing qulaity flag based on MC truth jitter, which is NOT simulated by TSIM
331 TRGSummary::ETimingQuality timQuality = TRGSummary::TTYQ_NONE;
332 double jitter = 0;
333
334 //get true jitter if SimClockState is valid
335 if (m_simClockState.isValid() && m_hwClock.isValid()) {
336
337 jitter = m_simClockState->getRelativeBucketNo() / m_hwClock->getAcceleratorRF(); // in ns
338
339 //set timing quality flag with the jitter
340 if (abs(jitter) < _timquality_threshold_sfin)
341 timQuality = TRGSummary::TTYQ_SFIN;
342 else {
343 if (abs(jitter) < _timquality_threshold_fine)
344 timQuality = TRGSummary::TTYQ_FINE;
345 else
346 timQuality = TRGSummary::TTYQ_CORS;
347 }
348 }
349
350 B2DEBUG(20, "TRGGDL::set timing quality, jitter = " << jitter << ": timQuality = " << timQuality << " sfin threshold = " <<
351 _timquality_threshold_sfin << " fine threshold = " <<
353
354 //fill the flag to TRGSummary
355 GDLResult->setTimQuality(timQuality);
356 }
357 }
double _timquality_threshold_sfin
Threshold to determine timing quality flag with MC truth: super fine.
Definition: TRGGDL.h:269
DBObjPtr< HardwareClockSettings > m_hwClock
Hardware Clocks.
Definition: TRGGDL.h:289
double _timquality_threshold_fine
Threshold to determine timing quality flag with MC truth: fine.
Definition: TRGGDL.h:272
StoreObjPtr< SimClockState > m_simClockState
generated hardware clock state
Definition: TRGGDL.h:287
ETimingQuality
trigger timing type quality
Definition: TRGSummary.h:79

◆ fastSimulation() [3/3]

void fastSimulation ( void  )
private

Fast simulation.

Definition at line 253 of file TRGGRL.cc.

254 {
255 }

◆ FindAndFit()

int FindAndFit ( std::vector< TRGCDCTrack * > &  trackList2D,
std::vector< TRGCDCTrack * > &  trackList2DFitted 
)

do track finding and fitting (wrapper that can choose between different versions).

Definition at line 755 of file HoughFinder.cc.

757 {
758
759 if (_doit == 0 || _doit == 1)
760 return doFindingAndFittingTrasan(trackList2D, trackList2DFitted);
761 else
762 return doFindingAndFitting(trackList2D, trackList2DFitted);
763 }
const unsigned _doit
Doit version.
Definition: HoughFinder.h:151
int doFindingAndFitting(std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
do track finding and fitting (Kaiyu version).
Definition: HoughFinder.cc:783
int doFindingAndFittingTrasan(std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
do track finding and fitting (Trasan version).
Definition: HoughFinder.cc:766

◆ FindCP1()

unsigned short FindCP1 ( vector< unsigned >  a)

...Find center Pattern1 from Pattern 2

Definition at line 236 of file PeakFinder.cc.

237 {
238 unsigned center = 0;
239 //...1...
240 //(x on, . off, return O)
241 // . .
242 // . .
243 // O .
244 if (a[0] == 1 && a[1] == 0 && a[2] == 0 && a[3] == 0 && a[4] == 0 && a[5] == 0) {center = 0;}
245 //...2...
246 //(x on, . off, return O)
247 // . . . . . .
248 // . . x . . x
249 // O x O . O .
250 if (a[0] == 1 && a[1] == 1 && a[2] == 0 && a[3] == 0 && a[4] == 0 && a[5] == 0) {center = 0;}
251 if (a[0] == 1 && a[1] == 0 && a[2] == 1 && a[3] == 0 && a[4] == 0 && a[5] == 0) {center = 0;}
252 if (a[0] == 1 && a[1] == 0 && a[2] == 0 && a[3] == 1 && a[4] == 0 && a[5] == 0) {center = 0;}
253 //...3...
254 //(x on, . off, return O)
255 // . . . . . . x . . x x . . x
256 // x . . x O x O . O . . O . O
257 // O x x O x . x . x . x . x .
258 if (a[0] == 1 && a[1] == 1 && a[2] == 1 && a[3] == 0 && a[4] == 0 && a[5] == 0) {center = 0;}
259 if (a[0] == 1 && a[1] == 1 && a[2] == 0 && a[3] == 1 && a[4] == 0 && a[5] == 0) {center = 1;}
260 if (a[0] == 1 && a[1] == 0 && a[2] == 1 && a[3] == 1 && a[4] == 0 && a[5] == 0) {center = 2;}
261 if (a[0] == 1 && a[1] == 0 && a[2] == 1 && a[3] == 0 && a[4] == 1 && a[5] == 0) {center = 2;}
262 if (a[0] == 1 && a[1] == 0 && a[2] == 1 && a[3] == 0 && a[4] == 0 && a[5] == 1) {center = 2;}
263 if (a[0] == 1 && a[1] == 0 && a[2] == 0 && a[3] == 1 && a[4] == 1 && a[5] == 0) {center = 3;}
264 if (a[0] == 1 && a[1] == 0 && a[2] == 0 && a[3] == 1 && a[4] == 0 && a[5] == 1) {center = 3;}
265 //...4...
266 //(x on, . off, return O)
267 // . . x . . x x . . x x . . x x x x x
268 // x x O . O . . O . O O x O x O . . O
269 // O x x x x x x x x x x . x . x . x .
270 if (a[0] == 1 && a[1] == 1 && a[2] == 1 && a[3] == 1 && a[4] == 0 && a[5] == 0) {center = 0;}
271 if (a[0] == 1 && a[1] == 1 && a[2] == 1 && a[3] == 0 && a[4] == 1 && a[5] == 0) {center = 2;}
272 if (a[0] == 1 && a[1] == 1 && a[2] == 1 && a[3] == 0 && a[4] == 0 && a[5] == 1) {center = 2;}
273 if (a[0] == 1 && a[1] == 1 && a[2] == 0 && a[3] == 1 && a[4] == 1 && a[5] == 0) {center = 3;}
274 if (a[0] == 1 && a[1] == 1 && a[2] == 0 && a[3] == 1 && a[4] == 0 && a[5] == 1) {center = 3;}
275 if (a[0] == 1 && a[1] == 0 && a[2] == 1 && a[3] == 1 && a[4] == 1 && a[5] == 0) {center = 2;}
276 if (a[0] == 1 && a[1] == 0 && a[2] == 1 && a[3] == 1 && a[4] == 0 && a[5] == 1) {center = 2;}
277 if (a[0] == 1 && a[1] == 0 && a[2] == 1 && a[3] == 0 && a[4] == 1 && a[5] == 1) {center = 2;}
278 if (a[0] == 1 && a[1] == 0 && a[2] == 0 && a[3] == 1 && a[4] == 1 && a[5] == 1) {center = 3;}
279 //...5...
280 //(x on, . off, return O)
281 // x . . x x x x x x x
282 // O x O x O . . O O x
283 // x x x x x x x x x .
284 if (a[0] == 1 && a[1] == 1 && a[2] == 1 && a[3] == 1 && a[4] == 1 && a[5] == 0) {center = 2;}
285 if (a[0] == 1 && a[1] == 1 && a[2] == 1 && a[3] == 1 && a[4] == 0 && a[5] == 1) {center = 2;}
286 if (a[0] == 1 && a[1] == 1 && a[2] == 1 && a[3] == 0 && a[4] == 1 && a[5] == 1) {center = 2;}
287 if (a[0] == 1 && a[1] == 1 && a[2] == 0 && a[3] == 1 && a[4] == 1 && a[5] == 1) {center = 3;}
288 if (a[0] == 1 && a[1] == 0 && a[2] == 1 && a[3] == 1 && a[4] == 1 && a[5] == 1) {center = 2;}
289 //...6...
290 //(x on, . off, return O)
291 // x x
292 // O x
293 // x x
294 if (a[0] == 1 && a[1] == 1 && a[2] == 1 && a[3] == 1 && a[4] == 1 && a[5] == 1) {center = 2;}
295 return center;
296 }

◆ findHitAxialSuperlayers()

void findHitAxialSuperlayers ( const TRGCDCTrack aTrack,
std::vector< double > &  useAxSL,
bool  printError 
)
static

Finds which axial superlayers has TSs. useAxSL array indicating hit superlayers.

Definition at line 1133 of file Fitter3D.cc.

1134 {
1135 useAxSl.assign(5, 1);
1136 for (unsigned iAx = 0; iAx < 5; iAx++) {
1137 // Check if all superlayers have one TS
1138 const vector<TCLink*>& links = aTrack.links(iAx * 2);
1139 const unsigned nSegments = links.size();
1140 // Find if there is a TS with a priority hit.
1141 // Loop over all TS in same superlayer.
1142 bool priorityHitTS = 0;
1143 //cout<<"iAx:"<<iAx<<" nSegments:"<<nSegments<<endl;
1144 for (unsigned iTS = 0; iTS < nSegments; iTS++) {
1145 const TCSegment* t_segment = dynamic_cast<const TCSegment*>(& links[iTS]->hit()->cell());
1146 if (t_segment->center().hit() != 0) priorityHitTS = 1;
1147 //cout<<" iTS:"<<iTS<<" priority:"<<t_segment->center().hit()<<" tsId:"<<t_segment->localId()<<endl;
1148 }
1149 if (nSegments != 1) {
1150 if (nSegments == 0) {
1151 useAxSl[iAx] = 0;
1152 } else {
1153 if (printError) cout << "Fitter3D::findHitAxialSuperlayers() => multiple TS are assigned." << endl;
1154 }
1155 } else {
1156 if (priorityHitTS == 0) {
1157 useAxSl[iAx] = 0;
1158 if (printError) cout << "Fitter3D::findHitAxialSuperlayers() => There are no priority hit TS" << endl;
1159 }
1160 }
1161 } // End superlayer loop
1162 }

◆ findHitStereoSuperlayers()

void findHitStereoSuperlayers ( const TRGCDCTrack aTrack,
std::vector< double > &  useStSL,
bool  printError 
)
static

Finds which stereo superlayers has TSs. useStSL array indicating hit superlayers.

Definition at line 1164 of file Fitter3D.cc.

1165 {
1166 useStSl.assign(4, 1);
1167 for (unsigned iSt = 0; iSt < 4; iSt++) {
1168 // Check if all superlayers have one TS
1169 const vector<TCLink*>& links = aTrack.links(iSt * 2 + 1);
1170 const unsigned nSegments = links.size();
1171 // Find if there is a TS with a priority hit.
1172 // Loop over all TS in same superlayer.
1173 bool priorityHitTS = 0;
1174 for (unsigned iTS = 0; iTS < nSegments; iTS++) {
1175 const TCSegment* t_segment = dynamic_cast<const TCSegment*>(& links[iTS]->hit()->cell());
1176 if (t_segment->center().hit() != 0) priorityHitTS = 1;
1177 }
1178 if (nSegments != 1) {
1179 if (nSegments == 0) {
1180 useStSl[iSt] = 0;
1181 } else {
1182 if (printError) cout << "Fitter3D::findHitStereoSuperlayers() => multiple TS are assigned." << endl;
1183 }
1184 } else {
1185 if (priorityHitTS == 0) {
1186 useStSl[iSt] = 0;
1187 if (printError) cout << "Fitter3D::findHitStereoSuperlayers() => There are no priority hit TS" << endl;
1188 }
1189 }
1190 } // End superlayer loop
1191 }

◆ findNumberOfHitSuperlayersForMcParticles()

void findNumberOfHitSuperlayersForMcParticles ( std::vector< std::vector< const TRGCDCSegmentHit * > > &  p_stTSs,
std::map< unsigned, unsigned > &  numberTSsForParticle 
)

Finds number of hit superlayers for each mc particle.

Definition at line 593 of file Hough3DFinder.cc.

595 {
596 vector<unsigned> mcParticleList;
597 for (unsigned iLayer = 0; iLayer < 4; iLayer++) {
598 // Find what mc particles there are in a layer
599 mcParticleList.clear();
600 for (unsigned iTS = 0; iTS < p_stTSs[iLayer].size(); iTS++) {
601 unsigned iMCParticle = p_stTSs[iLayer][iTS]->iMCParticle();
602 if (find(mcParticleList.begin(), mcParticleList.end(), iMCParticle) == mcParticleList.end()) {
603 mcParticleList.push_back(iMCParticle);
604 }
605 }
606 // Loop over mcParticleList and add to numberTSsForParticle
607 for (unsigned iMCPart = 0; iMCPart < mcParticleList.size(); iMCPart++) {
608 map<unsigned, unsigned>::iterator it = numberTSsForParticle.find(mcParticleList[iMCPart]);
609 if (it != numberTSsForParticle.end()) ++it->second;
610 else numberTSsForParticle[mcParticleList[iMCPart]] = 1;
611 }
612 }
613 }

◆ FindP1C()

unsigned FindP1C ( vector< unsigned >  a)

...Pattern1 Center...

Definition at line 303 of file PeakFinder.cc.

304 {
305 unsigned hits = 0;
306 unsigned short center = 0;
307 for (unsigned short k = 1; k < a.size(); k++) {
308 if (a[k] == 1) {hits++;}
309 }
310 //...1...
311 //(x on, . off, return O)
312 // . . . . O . . O
313 // O . . O . . . .
314 if (hits == 1) {
315 if (a[1] == 1 && a[2] == 0 && a[3] == 0 && a[4] == 0) {center = 1;}
316 if (a[1] == 0 && a[2] == 1 && a[3] == 0 && a[4] == 0) {center = 2;}
317 if (a[1] == 0 && a[2] == 0 && a[3] == 1 && a[4] == 0) {center = 3;}
318 if (a[1] == 0 && a[2] == 0 && a[3] == 0 && a[4] == 1) {center = 4;}
319
320 }
321 //...2...
322 //(x on, . off, return O)
323 // . . x . . x x . . x O x
324 // O x O . O . . O . O . .
325 if (hits == 2) {
326 if (a[1] == 1 && a[2] == 1 && a[3] == 0 && a[4] == 0) {center = 1;}
327 if (a[1] == 1 && a[2] == 0 && a[3] == 1 && a[4] == 0) {center = 1;}
328 if (a[1] == 1 && a[2] == 0 && a[3] == 0 && a[4] == 1) {center = 1;}
329 if (a[1] == 0 && a[2] == 1 && a[3] == 1 && a[4] == 0) {center = 2;}
330 if (a[1] == 0 && a[2] == 1 && a[3] == 0 && a[4] == 1) {center = 2;}
331 if (a[1] == 0 && a[2] == 0 && a[3] == 1 && a[4] == 1) {center = 3;}
332
333 }
334 //...3...
335 //(x on, . off, return O)
336 // x . . x O x x O
337 // O x x O x . . x
338 if (hits == 3) {
339 if (a[1] == 1 && a[2] == 1 && a[3] == 1 && a[4] == 0) {center = 1;}
340 if (a[1] == 1 && a[2] == 1 && a[3] == 0 && a[4] == 1) {center = 2;}
341 if (a[1] == 1 && a[2] == 0 && a[3] == 1 && a[4] == 1) {center = 3;}
342 if (a[1] == 0 && a[2] == 1 && a[3] == 1 && a[4] == 1) {center = 4;}
343
344
345 }
346 //...4...
347 //(x on, . off, return O)
348 // x x
349 // O x
350 if (hits == 4) {
351 if (a[1] == 1 && a[2] == 1 && a[3] == 1 && a[4] == 1) {center = 1;}
352
353 }
354
355 return center;
356 }

◆ findPeaks()

void findPeaks ( const TRGCDCHoughPlaneMulti2 hp,
const unsigned  threshold,
std::vector< std::vector< unsigned > > &  peaks 
) const

do peak finding. Kaiyu's version using p1p2Methode.

Definition at line 477 of file PeakFinder.cc.

480 {
481
482 const string sn = "Peak Finding";
484
485 if (TRGDebug::level())
486 cout << TRGDebug::tab() << "threshold=" << threshold
487 << ",plane name=[" << hp.name() << "]" << endl;
488
489 // p1p2(hp, threshold, peaks);
490 p1p2Methode(hp, threshold, peaks);
491
493
494 return;
495 }
void p1p2Methode(const TRGCDCHoughPlane &hp, const unsigned threshold, std::vector< std::vector< unsigned > > &peaks) const
Kaiyu's logic. Finds peaks from nested patterns.
Definition: PeakFinder.cc:498

◆ findPeaksTrasan()

void findPeaksTrasan ( TRGCDCHoughPlaneMulti2 hp,
const unsigned  threshold,
const bool  centerIsPeak,
std::vector< unsigned > &  peakSerialIds 
) const

do peak finding. This is a copy from "trasan".

Definition at line 359 of file PeakFinder.cc.

363 {
364
365 TRGDebug::enterStage("Peak Finding (trasan methode)");
366 if (TRGDebug::level())
367 cout << TRGDebug::tab() << "threshold=" << threshold
368 << ",plane name=[" << hp.name() << "]" << endl;
369
370 //...Make ionnected regions (is this the best way???)...
371 regions(hp, threshold);
372
373 //...Determine peaks...
374 const vector<vector<unsigned> *>& regions = hp.regions();
375 for (unsigned i = 0; i < (unsigned) regions.size(); i++) {
376
377 if (TRGDebug::level() > 1)
378 cout << TRGDebug::tab() << "region " << i << " contents" << endl;
379
380 //...Calculate size and center of a region...
381 const vector<unsigned>& r = * regions[i];
382 unsigned minX = hp.nX();
383 unsigned maxX = 0;
384 unsigned minY = hp.nY();
385 unsigned maxY = 0;
386 for (unsigned j = 0; j < (unsigned) r.size(); j++) {
387 const unsigned s = r[j];
388 unsigned x = 0;
389 unsigned y = 0;
390 hp.id(s, x, y);
391 if (x < minX) minX = x;
392 if (x > maxX) maxX = x;
393 if (y < minY) minY = y;
394 if (y > maxY) maxY = y;
395
396 if (TRGDebug::level() > 1)
397 cout << TRGDebug::tab(4) << "x=" << x << ",y=" << y << endl;
398 }
399 const unsigned cX = minX + (maxX - minX) / 2;
400 const unsigned cY = minY + (maxY - minY) / 2;
401
402 //...Determine a center of a region...
403 unsigned ncX = hp.nX() * hp.nY();
404 unsigned ncY = ncX;
405 if (TRGDebug::level() > 1)
406 cout << TRGDebug::tab() << "center of region:x=" << cX << ",y="
407 << cY << endl;
408
409 if (! centerIsPeak) {
410
411 if (TRGDebug::level() > 1)
412 cout << TRGDebug::tab() << "Searching a cell closest to the "
413 << "region center" << endl;
414
415 //...Search for a cell which is the closest to the center...
416 float minDiff2 = float(hp.nX() * hp.nX() + hp.nY() * hp.nY());
417 for (unsigned j = 0; j < (unsigned) r.size(); j++) {
418 const unsigned s = r[j];
419 unsigned x = 0;
420 unsigned y = 0;
421 hp.id(s, x, y);
422
423 const float diff2 = (float(x) - float(cX)) *
424 (float(x) - float(cX))
425 + (float(y) - float(cY)) *
426 (float(y) - float(cY));
427
428 if (diff2 < minDiff2) {
429 minDiff2 = diff2;
430 ncX = x;
431 ncY = y;
432 }
433 if (TRGDebug::level() > 1)
434 cout << TRGDebug::tab(4) << "x=" << ncX << ",y=" << ncY
435 << ":diff2=" << diff2 << endl;
436 }
437 } else {
438
439 //...Search for a peak...
440 float max = 0;
441 for (unsigned j = 0; j < (unsigned) r.size(); j++) {
442 const unsigned s = r[j];
443 const float entry = hp.entry(s);
444 if (max < entry) {
445 max = entry;
446 unsigned x = 0;
447 unsigned y = 0;
448 hp.id(s, x, y);
449 ncX = x;
450 ncY = y;
451 }
452 }
453 }
454
455 //...Store the center cell...
456 const unsigned serialId = hp.serialId(ncX, ncY);
457 peakSerialIds.push_back(serialId);
458
459 if (TRGDebug::level()) {
460 cout << TRGDebug::tab() << "region " << i << " final center:x="
461 << ncX << ",y=" << ncY << endl
462 << TRGDebug::tab(4) << "position in HP:x="
463 << hp.position(ncX, ncY).x() << ",y="
464 << hp.position(ncX, ncY).y() << endl;
465 }
466 }
467
468 if (TRGDebug::level())
469 cout << TRGDebug::tab() << peakSerialIds.size() << " peak(s)"
470 << " found in total" << endl;
471
472 TRGDebug::leaveStage("Peak Finding (trasan methode)");
473 return;
474 }
void regions(TRGCDCHoughPlane &hp, const unsigned threshold) const
Makes regions.
Definition: PeakFinder.cc:53

◆ findTSHit()

vector< TRGSignalVector * > findTSHit ( TRGSignalVector eachInput,
int  tsid 
)

Use LUT for find TSHit.

output for EvtTime & Low pT tracker module

output for Tracker & N.N

Definition at line 199 of file TrackSegmentFinder.cc.

200 {
201
202 //variables for common
203 const string na = "TSCandidate" + TRGUtilities::itostring(
204 tsid) + " in " + name();
205 TCSegment* tsi = _tsSL[tsid];
206 vector <TRGSignalVector*> result;
207
208 //variables for EvtTime & Low pT
209 vector<bool> fTimeVect;
210 // int tmpFTime = 0 ;
211
212 //variables for Tracker & N.N
213 vector <bool> tmpOutBool;
214
215 TRGSignalVector* resultT = new TRGSignalVector(na, eachInput->clock(), 22);
216 TRGSignalVector* resultE = new TRGSignalVector(na, eachInput->clock(), 10);
217 TRGSignalVector* Hitmap = new TRGSignalVector(na + "HitMap",
218 eachInput->clock(), 0);
219 TRGSignalVector pTime(na + "PriorityTime", eachInput->clock(), 0);
220 TRGSignalVector fTime(na + "FastestTime", eachInput->clock(), 0);
221 for (unsigned i = 0; i < 12; i++) {
222 Hitmap->push_back((*eachInput)[i]);
223 (*Hitmap)[i].widen(16);
224 }
225 for (unsigned i = 0; i < 4; i++) {
226 pTime.push_back((*eachInput)[i + 12]);
227 fTime.push_back((*eachInput)[i + 16]);
228 }
229 for (unsigned i = 0; i < 5; i++) {
230 pTime.push_back((*eachInput)[i + 20]);
231 fTime.push_back((*eachInput)[i + 20]);
232 }
233
234 vector <int> changeTime = Hitmap->stateChanges();
235
236 int* LUTValue = new int[changeTime.size()];
237 if (changeTime.size()) {
238 int hitPosition = 0;
239 bool fTimeBool[10];
240 int tmpPTime = 0 ;
241 int tmpCTime = 0 ;
242 int tmpOutInt;
243 fTime.state(changeTime[0]).copy2bool(fTimeBool);
244 fTimeBool[9] = true;
245 fTimeVect.insert(fTimeVect.begin(), fTimeBool, fTimeBool + 10);
246 //tmpFTime = mkint(fTime.state(changeTime[0]));
247 bool eOUT = true;
248 for (unsigned i = 0; i < changeTime.size(); i++) {
249 LUTValue[i] = tsi->LUT()->getValue(mkint(Hitmap->state(changeTime[i])));
250
252 if ((LUTValue[i]) && (eOUT)) {
253 resultE->set(fTimeVect, changeTime[i]);
254 eOUT = false;
255 }
256
257 bool priority1rise = (*Hitmap)[6].riseEdge(changeTime[i]);
258 bool priority2rise = ((*Hitmap)[7].riseEdge(changeTime[i]) or
259 (*Hitmap)[8].riseEdge(changeTime[i]));
260
262 //ready for output
263 if (priority1rise) {
264 hitPosition = 3;
265 tmpPTime = mkint(pTime.state(changeTime[i]));
266 tmpCTime = changeTime[i];
267 } else if (priority2rise) {
268 if (!hitPosition) {
269 tmpPTime = mkint(pTime.state(changeTime[i]));
270 tmpCTime = changeTime[i];
271 if ((*Hitmap)[0].state(changeTime[i])) hitPosition = 2;
272 else hitPosition = 1;
273 }
274 }
275
276 // output selection
277 if ((hitPosition) && (LUTValue[i]) && ((changeTime[i] - tmpCTime) < 16)) {
278 tmpOutInt = tsid * pow(2, 13) + tmpPTime * pow(2, 4) + LUTValue[i] * pow(2,
279 2) + hitPosition;
280 tmpOutBool = mkbool(tmpOutInt, 22);
281 if (hitPosition == 3) {
282 if (priority1rise) resultT->set(tmpOutBool, changeTime[i]);
283 else {
284 if ((LUTValue[i] == 1) | (LUTValue[i] == 2)) {
285 if (!((LUTValue[i - 1] == 1) |
286 (LUTValue[i - 1] == 2)))
287 resultT->set(tmpOutBool, changeTime[i]);
288 } else {
289 if (!(LUTValue[i - 1])) resultT->set(tmpOutBool, changeTime[i]);
290 }
291 }
292 } else {
293 if (priority2rise) resultT->set(tmpOutBool, changeTime[i]);
294 else {
295 if ((LUTValue[i] == 1) | (LUTValue[i] == 2)) {
296 if (!((LUTValue[i - 1] == 1) |
297 (LUTValue[i - 1] == 2)))
298 resultT->set(tmpOutBool, changeTime[i]);
299 } else {
300 if (!(LUTValue[i])) resultT->set(tmpOutBool, changeTime[i]);
301 }
302 }
303 }
304 }
305
306 }
307
308 }
309 result.push_back(resultT);
310 result.push_back(resultE);
311
312 // cppcheck-suppress uninitdata
313 delete[] LUTValue;
314 delete Hitmap;
315
316 return result;
317 }
std::vector< TCSegment * > _tsSL
list of TSF
double mkint(TRGState)
tranformatoin into integer
vector< bool > mkbool(int, int)
tranformatoin into bool

◆ firmwareSimulation() [1/3]

void firmwareSimulation ( void  )
private

Firmware simulation.

Definition at line 2363 of file TRGCDC.cc.

2364 {
2365#ifdef TRGCDC_DISPLAY
2366 D->beginningOfEvent();
2367#endif
2368
2369 TRGDebug::enterStage("TRGCDC firmwareSimulation");
2370
2371 //...Wire level simulation is in update().
2372
2373 //...Front ends...
2374 const unsigned nFronts = _fronts.size();
2375 for (unsigned i = 0; i < nFronts; i++) {
2376 //...Skip inner-most FE because they have no contribution to TRG
2377 if (i < 10)
2378 continue;
2379
2380 //...FE simulation...
2381 _fronts[i]->simulate();
2382 }
2383
2384 //...Mergers...
2385 const unsigned nMergers = _mergers.size();
2386 for (unsigned i = 0; i < nMergers; i++) {
2387 _mergers[i]->simulate();
2388 }
2389
2390 //...TSFs...
2391 const unsigned nTSFBoards = _tsfboards.size();
2392 for (unsigned i = 0; i < nTSFBoards; i++) {
2393 //iw _tsfboards[i]->simulateBoard();
2394 // _tsfboards[i]->simulate();
2395 _tsfboards[i]->simulate2();
2396 }
2397
2398 //...Event Time... In ns scale.
2399 // [FIXME] Not really firmware mode. Just for display.
2400 int t_eventTime = _eventTime.back()->getT0();
2401 // Update WireHit driftTime using eventTime
2402 // [FIXME] This method is a temorary method. Next time change everything inside EventTime class.
2403 //cout<<"Hit timing ";
2404 for (unsigned iHits = 0; iHits < _hits.size(); iHits++) {
2405 //cout<<"["<<_hits[iHits]->wire().layerId()<<"]["<<_hits[iHits]->wire().localId()<<"]: "<<(_hits[iHits]->drift(0))<<" ";
2406 _hits[iHits]->setDriftTime((_hits[iHits]->drift(0) - t_eventTime) / 250, 0);
2407 _hits[iHits]->setDriftTime((_hits[iHits]->drift(1) - t_eventTime) / 250, 1);
2408 }
2409 //cout<< endl;
2410 //cout<<"Event timing: "<<t_eventTime<<endl;
2411
2412 //...Tracker2D...
2413 const unsigned nTracker2Ds = _tracker2Ds.size();
2414 for (unsigned i = 0; i < nTracker2Ds; i++) {
2415 _tracker2Ds[i]->simulate();
2416 }
2417
2418#ifdef TRGCDC_DISPLAY
2419 dump("hits");
2420 D->endOfEvent();
2421 string stg = "Firmware simulation";
2422 string inf = " ";
2423 D->clear();
2424 D->stage(stg);
2425 D->information(inf);
2426 D->area().append(hits());
2427 D->area().append(segmentHits());
2428 D->show();
2429 D->run();
2430 // unsigned iFront = 0;
2431 // while (const TCFrontEnd * f = _cdc.frontEnd(iFront++)) {
2432 // D->clear();
2433 // D->beginEvent();
2434 // D->area().append(* f);
2435 // D->run();
2436 // }
2437 // unsigned iMerger = 0;
2438 // while (const TCMerger * f = _cdc.merger(iMerger++)) {
2439 // D->clear();
2440 // D->beginEvent();
2441 // D->area().append(* f);
2442 // D->run();
2443 // }
2444#endif
2445
2446 TRGDebug::leaveStage("TRGCDC firmwareSimulation");
2447 }

◆ firmwareSimulation() [2/3]

void firmwareSimulation ( void  )
private

Firmware simulation.

Definition at line 577 of file TRGGDL.cc.

578 {
579// TRGDebug::enterStage("TRGGDL firmSim");
580
581// if (TRGDebug::level())
582// cout << TRGDebug::tab() << "Making dummy input signals" << endl;
583
584 //...Clear signal bundles...
585 if (_isb) {
586 for (unsigned i = 0; i < _isb->size(); i++)
587 delete (* _isb)[i];
588 delete _isb;
589 }
590 if (_osb) {
591 for (unsigned i = 0; i < _osb->size(); i++)
592 delete (* _osb)[i];
593 delete _osb;
594 }
595 if (_tsb) {
596 for (unsigned i = 0; i < _tsb->size(); i++)
597 delete (* _tsb)[i];
598 delete _tsb;
599 }
600 if (_tosb) {
601 for (unsigned i = 0; i < _tosb->size(); i++)
602 delete (* _tosb)[i];
603 delete _tosb;
604 }
605
606 //...Input bits...
607 const unsigned nInput = _input.size();
608 TRGSignalVector& input = * new TRGSignalVector(name() + "InputSignals",
609 _clock);
610 TRGSignalVector& timing = * new TRGSignalVector(name() + "TimingSignals",
611 _clock);
612 for (unsigned i = 0; i < nInput; i++) {
613
614 TRGSignal s;
615
616 //...Create dummy timing signal for even number input bits...
617 if ((i % 2) == 0) {
618 int tdcCount = 100;
619 TRGTime rise = TRGTime(tdcCount, true, _clock, _input[i]);
620 TRGTime fall = rise;
621 fall.shift(1).reverse();
622 s = TRGSignal(rise & fall);
623 s.name(_input[i]);
624 }
625
626 //...Create dummy timing signal for odd number input bits...
627 else {
628 int tdcCount = 130;
629 TRGTime rise = TRGTime(tdcCount, true, _clock, _input[i]);
630 TRGTime fall = rise;
631 fall.shift(1).reverse();
632 s = TRGSignal(rise & fall);
633 s.name(_input[i]);
634 }
635
636 //...Add to a signal vector...
637 input += s;
638
639 //...Timing signal...
640 bool t =
641 (i == 14) || (i == 15) || (i == 16) || (i == 17) ||
642 (i == 41) || (i == 42) || (i == 43) || (i == 44) ||
643 (i == 49) || (i == 50) || (i == 51) || (i == 52) || (i == 53);
644 if (t)
645 timing += s;
646 }
647
648 //...Make input signal bundle...
649 const string ni = name() + "InputSignalBundle";
650 _isb = new TRGSignalBundle(ni, _clock);
651 _isb->push_back(& input);
652
653 //...Make output signal bundle...
654 const string no = name() + "OutputSignalBundle";
655 _osb = new TRGSignalBundle(no,
656 _clock,
657 * _isb,
658 14,
660
661 //...Timing signal bundle...
662 TRGSignalVector& ftd = * new TRGSignalVector(name() + "FTD", _clock);
663// ftd += (* ((* _osb)[0])[13]);
664// ftd += * (* _osb)[0][13];
665 TRGSignal ddddd = (* (* _osb)[0])[13];
666 ftd += ddddd;
667
668 const string nt = name() + "TimingSignalBundle";
669 _tsb = new TRGSignalBundle(nt, _clock);
670 _tsb->push_back(& timing);
671 _tsb->push_back(& ftd);
672
673 //...Timing out signal bundle...
674 const string nto = name() + "TimingOutSignalBundle";
675 _tosb = new TRGSignalBundle(nto,
676 _clock,
677 * _tsb,
678 3,
679 7,
681
682 if (TRGDebug::level()) {
683 if (input.active()) {
684 _isb->dump("detail", TRGDebug::tab());
685 _osb->dump("detail", TRGDebug::tab());
686 _tsb->dump("detail", TRGDebug::tab());
687 _tosb->dump("detail", TRGDebug::tab());
688 }
689 }
690
691 TRGDebug::leaveStage("TRGGDL firmSim");
692 }
TRGSignalBundle * _isb
Input signal bundle.
Definition: TRGGDL.h:251
TRGSignalBundle * _tosb
Timing output signal bundle.
Definition: TRGGDL.h:260
const TRGClock & _clock
GDL trigger system clock.
Definition: TRGGDL.h:233
TRGSignalBundle * _tsb
Timing input signal bundle.
Definition: TRGGDL.h:257
TRGSignalBundle * _osb
Output signal bundle.
Definition: TRGGDL.h:254
static TRGState decision(const TRGState &input)
Makes bit pattern(state) using input bit pattern(state).
Definition: TRGGDL.cc:830
static TRGState timingDecision(const TRGState &input, TRGState &registers, bool &logicStillActive)
Makes timing decision.
Definition: TRGGDL.cc:870

◆ firmwareSimulation() [3/3]

void firmwareSimulation ( void  )
private

Firmware simulation.

Definition at line 258 of file TRGGRL.cc.

259 {
260 }

◆ firmwareSimulationMode() [1/3]

unsigned firmwareSimulationMode ( void  ) const
inline

returns firmware simulation mode.

Definition at line 1091 of file TRGCDC.h.

1092 {
1094 }
unsigned _firmwareSimulationMode
Firmware simulation mode.
Definition: TRGCDC.h:515

◆ firmwareSimulationMode() [2/3]

unsigned firmwareSimulationMode ( void  ) const
inline

returns firmware simulation mode.

Definition at line 327 of file TRGGDL.h.

328 {
330 }
unsigned _firmwareSimulationMode
Firmware simulation mode.
Definition: TRGGDL.h:224

◆ firmwareSimulationMode() [3/3]

unsigned firmwareSimulationMode ( void  ) const
inline

returns firmware simulation mode.

Definition at line 220 of file TRGGRL.h.

221 {
223 }
unsigned _firmwareSimulationMode
Firmware simulation mode.
Definition: TRGGRL.h:156

◆ firmwareSimulationStart()

int firmwareSimulationStart ( void  ) const
inline

returns start clock of the firmware simulation in FE clock.

Definition at line 1112 of file TRGCDC.h.

1113 {
1115 }
int _firmwareSimulationStart
Fimrware simulation start clock in FE.
Definition: TRGCDC.h:518

◆ firmwareSimulationStartDataClock()

int firmwareSimulationStartDataClock ( void  ) const
inline

returns start clock of the firmware simulation in data clock.

Definition at line 1126 of file TRGCDC.h.

1127 {
1129 }
int _firmwareSimulationStartDataClock
Firmware simulation start clock in CDCTRG data clock.
Definition: TRGCDC.h:527

◆ firmwareSimulationStop()

int firmwareSimulationStop ( void  ) const
inline

returns stop clock of the firmware simulation in FE clock.

Definition at line 1119 of file TRGCDC.h.

1120 {
1122 }
int _firmwareSimulationStop
Fimrware simulation stop clock in FE.
Definition: TRGCDC.h:521

◆ firmwareSimulationStopDataClock()

int firmwareSimulationStopDataClock ( void  ) const
inline

returns stop clock of the firmware simulation in data clock.

Definition at line 1133 of file TRGCDC.h.

1134 {
1136 }
int _firmwareSimulationStopDataClock
Firmware simulation stop clock in CDCTRG data clock.
Definition: TRGCDC.h:530

◆ fit() [1/4]

double fit ( void  )

member functions for fit

Definition at line 457 of file Lpav.cc.

458 {
459 if (m_nc <= 3) return -1;
460 m_chisq = -1;
461 double q;
462 if (m_nc < 4) {
464 q = calculate_lpar3();
465 if (q > 0) m_chisq = q * m_wsum_temp * m_rscale * m_rscale;
466 } else {
468 q = calculate_lpar();
469 if (q > 0) m_chisq = q * m_wsum_temp * m_rscale * m_rscale;
470 }
471 return m_chisq;
472 }
void calculate_average(void)
member functions for calculation
Definition: Lpav.cc:127
void calculate_average3(void)
member functions for calculation
Definition: Lpav.cc:236
double calculate_lpar(void)
member functions for calculation
Definition: Lpav.cc:343
double calculate_lpar3(void)
member functions for calculation
Definition: Lpav.cc:397

◆ fit() [2/4]

double fit ( double  x,
double  y,
double  w = 1 
)

member functions for fit

Definition at line 441 of file Lpav.cc.

442 {
443 if (m_nc <= 3) return -1;
444 m_chisq = -1;
445 if (m_nc < 4) {
447 double q = calculate_lpar3();
448 if (q > 0) m_chisq = q * m_wsum_temp * m_rscale * m_rscale;
449 } else {
450 calculate_average(x, y, w);
451 double q = calculate_lpar();
452 if (q > 0) m_chisq = q * m_wsum_temp * m_rscale * m_rscale;
453 }
454 return m_chisq;
455 }

◆ fit() [3/4]

int fit ( TRGCDCTrackBase t) const
overridevirtual

Fitter.

Implements TRGCDCFitter.

Definition at line 40 of file CircleFitter.cc.

41 {
42
43 TRGDebug::enterStage("TCCFitter::fit");
44// int oldLevel = TRGDebug::level();
45// TRGDebug::level(10);
46
47 //...Already fitted ?...
48 if (t.fitted()) {
49 if (TRGDebug::level() > 1)
50 cout << TRGDebug::tab() << "Circle is fitted already" << endl;
51 TRGDebug::leaveStage("TCCFitter::fit");
53 }
54
55 //...Check # of hits...
56 if (t.links().size() < 3) {
57 if (TRGDebug::level() > 1)
58 cout << TRGDebug::tab() << "#links is less than 3" << endl;
59 TRGDebug::leaveStage("TCCFitter::fit");
61 }
62
63 //...Hit loop...
64 TCLpav circle;
65 const unsigned n = t.links().size();
66 for (unsigned i = 0; i < n; i++) {
67 const TCLink* l = t.links()[i];
68 const Belle2::TRGCDCCellHit* h = l->hit();
69
70 //...Check next hit...
71 Point3D point;
72 if (h->state() & CellHitPatternLeft)
73 point = h->position(CellHitLeft);
74 else if (h->state() & CellHitPatternRight)
75 point = h->position(CellHitRight);
76 else
77 point = h->xyPosition();
78
79 //...Presently weight is not used.
80 // float weight = 1. / (h->distance() * h->distance());
81 // float weight = 1. / h->distance();
82
83 circle.add_point(point.x(), point.y()); //, weight);
84
85 if (TRGDebug::level() > 2) {
86 cout << TRGDebug::tab() << "point " << i;
87 cout << point << endl;
88 }
89 }
90
91 if (circle.fit() < 0.0 || circle.kappa() == 0.0) {
92 if (TRGDebug::level() > 1)
93 cout << TRGDebug::tab() << "fit failed" << endl;
94 TRGDebug::leaveStage("TCCFitter::fit");
95 return TRGCDCFitFailed;
96 }
97 CLHEP::HepVector v(circle.center());
98 _center.setX(v(1));
99 _center.setY(v(2));
100 _radius = circle.radius();
101
102 //...Determine charge...Better way???
103 int qSum = 0;
104 for (unsigned i = 0; i < n; i++) {
105 const TCLink* l = t.links()[i];
106 if (l == 0) continue;
107
108 const Belle2::TRGCDCCellHit* h = l->hit();
109 if (h == 0) continue;
110
111 float q = (_center.cross(h->xyPosition())).z();
112 if (q > 0.) qSum += 1;
113 else qSum -= 1;
114 }
115 if (qSum >= 0) _charge = +1.;
116 else _charge = -1.;
117 _radius *= _charge;
118
119 if (t.objectType() == TRGCDCCircleType)
120 ((TRGCDCCircle&) t).property(_charge, _radius, _center);
121 fitDone(t);
122
123 //...Update link information...
124 for (unsigned i = 0; i < n; i++) {
125 TCLink* l = t.links()[i];
126 if (l == 0) continue;
127
128 t.approach2D(* l);
129 }
130
131 if (TRGDebug::level() > 1) {
132 cout << TRGDebug::tab() << "fitted successfully" << endl;
133 cout << TRGDebug::tab() << " charge=" << _charge
134 << ",radius=" << _radius << ",center=" << _center << endl;
135 }
136 TRGDebug::leaveStage("TCCFitter::fit");
137
138 return 0;
139 }
A class to represent a wire hit in CDC.
Definition: CellHit.h:74
HepGeom::Point3D< double > _center
center
Definition: CircleFitter.h:55
#define TRGCDCFitAlreadyFitted
parameter to identify fit result
Definition: Fitter.h:31
#define TRGCDCFitFailed
parameter to identify fit result
Definition: Fitter.h:35
#define TRGCDCFitErrorFewHits
parameter to identify fit result
Definition: Fitter.h:33
void fitDone(TRGCDCTrackBase &) const
sets the fitted flag. (Bad implementation)
Definition: Fitter.cc:33

◆ fit() [4/4]

int fit ( void  )
virtual

fits itself by a default fitter. Error was happened if return value is not zero.

Definition at line 97 of file TrackBase.cc.

98 {
99 if (_fitter) {
100 return _fitter->fit(* this);
101 } else {
102 cout << "TRGCDCTrackBase !!! no fitter available" << endl;
103 return -1;
104 }
105 }
virtual int fit(TRGCDCTrackBase &) const =0
Fit functions.
const TRGCDCFitter * _fitter
Fitter.
Definition: TrackBase.h:166

◆ fitDone()

void fitDone ( TRGCDCTrackBase ) const
protected

sets the fitted flag. (Bad implementation)

Definition at line 33 of file Fitter.cc.

34 {
35 t._fitted = true;
36 }

◆ fitted()

bool fitted ( void  ) const
inline

returns true if fitted.

Definition at line 227 of file TrackBase.h.

228 {
229 return _fitted;
230 }
bool _fitted
Fitting status.
Definition: TrackBase.h:169

◆ fitter() [1/2]

const TRGCDCFitter * fitter ( const TRGCDCFitter a)
inline

sets a default fitter.

Definition at line 269 of file TrackBase.h.

270 {
271 _fitted = false;
272 return _fitter = a;
273 }

◆ fitter() [2/2]

const TRGCDCFitter * fitter ( void  ) const
inline

returns a pointer to a default fitter.

Definition at line 262 of file TrackBase.h.

263 {
264 return _fitter;
265 }

◆ forwardPosition()

const HepGeom::Point3D< double > & forwardPosition ( void  ) const
inline

returns position in forward endplate.

Definition at line 317 of file Cell.h.

318 {
319 return _forwardPosition;
320 }
const HepGeom::Point3D< double > _forwardPosition
Wire forward position.
Definition: Cell.h:178

◆ foundTime()

float foundTime ( void  ) const

return found time in TSHit.

Definition at line 423 of file Segment.cc.

424 {
425 if ((LUT()->getValue(lutPattern()))) {
426 float tmpFoundTime[5] = {9999, 9999, 9999, 9999, 9999};
427 for (unsigned i = 0; i < _wires.size(); i++) {
428 if (!_wires[i]->signal().active()) continue;
429 float dt = _wires[i]->signal()[0]->time();
430 if (_wires.size() == 11) {
431 if (i < 3) {
432 if (tmpFoundTime[0] > dt) tmpFoundTime[0] = dt;
433 } else if (i < 5) {
434 if (tmpFoundTime[1] > dt) tmpFoundTime[1] = dt;
435 } else if (i == 5) {
436 if (tmpFoundTime[2] > dt) tmpFoundTime[2] = dt;
437 } else if (i < 8) {
438 if (tmpFoundTime[3] > dt) tmpFoundTime[3] = dt;
439 } else {
440 if (tmpFoundTime[4] > dt) tmpFoundTime[4] = dt;
441 }
442 } else {
443 if (i == 0) {
444 if (tmpFoundTime[0] > dt) tmpFoundTime[0] = dt;
445 } else if (i < 3) {
446 if (tmpFoundTime[1] > dt) tmpFoundTime[1] = dt;
447 } else if (i < 6) {
448 if (tmpFoundTime[2] > dt) tmpFoundTime[2] = dt;
449 } else if (i < 10) {
450 if (tmpFoundTime[3] > dt) tmpFoundTime[3] = dt;
451 } else {
452 if (tmpFoundTime[4] > dt) tmpFoundTime[4] = dt;
453 }
454 }
455 }
456 sort(tmpFoundTime, tmpFoundTime + 5);
457 return tmpFoundTime[3];
458 } else
459 return -1;
460 }

◆ frequency()

double frequency ( void  ) const
inline

returns frequency in MHz.

Definition at line 187 of file Clock.h.

188 {
189 return _frequency;
190 }

◆ frontEnd()

const TRGCDCFrontEnd * frontEnd ( unsigned  id) const
inline

returns a front-end board.

Definition at line 1033 of file TRGCDC.h.

1034 {
1035 return _fronts[a];
1036 }

◆ ftd_0_01()

void ftd_0_01 ( bool *  b,
const bool *  i 
)

Definition at line 14 of file ftd_0.01.cc.

15 {
16 b[0] = (i[1] && i[3] && i[13] && !i[62]) || (i[1] && i[4] && i[13] && !i[62]) || (i[1] && i[5] && i[13] && !i[62]) || (i[2] && i[3]
17 && i[13] && !i[62]) || (i[2] && i[4] && i[13] && !i[62]) || (i[2] && i[5] && i[13] && !i[62]);
18 b[1] = (i[7] && i[9] && i[13] && !i[62]) || (i[7] && i[10] && i[13] && !i[62]) || (i[7] && i[11] && i[13] && !i[62]) || (i[8]
19 && i[9] && i[13] && !i[62]) || (i[8] && i[10] && i[13] && !i[62]) || (i[8] && i[11] && i[13] && !i[62]);
20 b[2] = (i[0] && i[3] && i[13] && !i[21] && !i[62]) || (i[0] && i[4] && i[13] && !i[21] && !i[62]) || (i[0] && i[5] && i[13]
21 && !i[21] && !i[62]) || (i[1] && i[3] && i[13] && !i[21] && !i[62]) || (i[1] && i[4] && i[13] && !i[21] && !i[62]) || (i[1] && i[5]
22 && i[13] && !i[21] && !i[62]) || (i[2] && i[3] && i[13] && !i[21] && !i[62]) || (i[2] && i[4] && i[13] && !i[21] && !i[62])
23 || (i[2] && i[5] && i[13] && !i[21] && !i[62]);
24 b[3] = (i[6] && i[9] && i[13] && !i[21] && !i[62]) || (i[6] && i[10] && i[13] && !i[21] && !i[62]) || (i[6] && i[11] && i[13]
25 && !i[21] && !i[62]) || (i[7] && i[9] && i[13] && !i[21] && !i[62]) || (i[7] && i[10] && i[13] && !i[21] && !i[62]) || (i[7]
26 && i[11] && i[13] && !i[21] && !i[62]) || (i[8] && i[9] && i[13] && !i[21] && !i[62]) || (i[8] && i[10] && i[13] && !i[21]
27 && !i[62]) || (i[8] && i[11] && i[13] && !i[21] && !i[62]);
28 b[4] = (i[18] && !i[21] && !i[62]);
29 b[5] = (i[35] && !i[62]) || (i[36] && !i[62]);
30 b[6] = (i[21] && !i[62]);
31 b[7] = (i[21] && i[67] && i[12]) || (i[21] && i[68] && i[12]);
32 b[8] = (i[18] && !i[66] && !i[67] && !i[68] && !i[63] && !i[64] && !i[65]);
33 b[9] = (i[54] && i[67]) || (i[54] && i[68]) || (i[55] && i[67]) || (i[55] && i[68]) || (i[56] && i[67]) || (i[56] && i[68]);
34 b[10] = (i[57]);
35 b[11] = (i[61]);
36 b[12] = (i[60]);
37 }

◆ fudgeFactor() [1/2]

float fudgeFactor ( float  a)
inline

sets and returns fudge factor for drift time error.

Definition at line 849 of file TRGCDC.h.

850 {
851 return _fudgeFactor = a;
852 }
float _fudgeFactor
Fudge factor for position error.
Definition: TRGCDC.h:662

◆ fudgeFactor() [2/2]

float fudgeFactor ( void  ) const
inline

returns fudge factor for drift time error.

Definition at line 842 of file TRGCDC.h.

843 {
844 return _fudgeFactor;
845 }

◆ get2DFitChi2()

double get2DFitChi2 ( void  ) const
inline

Returns 2D fit chi2.

Definition at line 186 of file TRGCDCTrack.h.

187 {
188 return m_2DFitChi2;
189 }
double m_2DFitChi2
2D fit chi2
Definition: TRGCDCTrack.h:119

◆ get3DFitChi2()

double get3DFitChi2 ( void  ) const
inline

Returns 3D fit chi2.

Definition at line 198 of file TRGCDCTrack.h.

199 {
200 return m_3DFitChi2;
201 }
double m_3DFitChi2
3D fit chi2
Definition: TRGCDCTrack.h:122

◆ getActual()

double getActual ( ) const

Get float value of signal.

Definition at line 1392 of file JSignal.cc.

1393 {
1394 return m_actual;
1395 }

◆ getAlgorithm()

void getAlgorithm ( std::ifstream &  ifs)
private

Read algorithm data definition.

Definition at line 801 of file TRGGDL.cc.

802 {
803
804 if (TRGDebug::level()) {
805 cout << "TRGGDL::getAlgorithm ... reading algorithm data" << endl;
806 }
807
808 char b[800];
809 while (! ifs.eof()) {
810 ifs.getline(b, 800);
811
812 //...The first word should be input bit number...
813 // const string w0 = TRGUtilities::carstring(b);
814
815 //...':'...
816 string cdr = TRGUtilities::cdrstring(b);
817 // const string w1 = TRGUtilities::carstring(cdr);
818
819 //...Algorithm...
820 cdr = TRGUtilities::cdrstring(cdr);
821 const string w2 = cdr;
822
823 if (w2.size())
824 _algorithm.push_back(w2);
825 }
826
827 }
static std::string cdrstring(const std::string &s)
CERNLIB cdr.
Definition: Utilities.cc:88

◆ getArgumentSignals()

std::vector< std::pair< std::string, vector< int > > > const getArgumentSignals ( ) const

Gets the signal names and values that made this signal.

Definition at line 1432 of file JSignal.cc.

1433 {
1434 return m_argumentSignals;
1435 }

◆ getBitsize()

double getBitsize ( ) const

Get bitwidth of signal.

Definition at line 1372 of file JSignal.cc.

1373 {
1374 return m_bitsize;
1375 }

◆ getCommonData()

TRGCDCJSignalData * getCommonData ( ) const

Get the sharged JSignalData.

Definition at line 1437 of file JSignal.cc.

1438 {
1439 if (m_commonData) return m_commonData;
1440 else {
1441 cout << "[Error] TRGCDCJSignal::getCommonData() => m_commonData does not exist." << endl;
1442 return 0;
1443 }
1444 }

◆ getConstants()

void getConstants ( std::map< std::string, double > &  mConstD,
std::map< std::string, std::vector< double > > &  mConstV,
bool  isXtSimple = 0 
)
static

Get constants for firmwareFit.

Definition at line 1596 of file Fitter3D.cc.

1598 {
1599 const CDC::CDCGeometryPar& cdc = CDC::CDCGeometryPar::Instance();
1600 mConstD["Trg_PI"] = M_PI;
1601 mConstV["priorityLayer"] = {3, 10, 16, 22, 28, 34, 40, 46, 52};
1602 mConstV["rr"] = vector<double> (9);
1603 mConstV["nWires"] = vector<double> (9);
1604 mConstV["nTSs"] = vector<double> (9);
1605 for (unsigned iSL = 0; iSL < 9; iSL++) {
1606 unsigned t_layerId = mConstV["priorityLayer"][iSL];
1607 mConstV["rr"][iSL] = cdc.senseWireR(t_layerId);
1608 mConstV["nWires"][iSL] = cdc.nWiresInLayer(t_layerId) * 2;
1609 mConstV["nTSs"][iSL] = cdc.nWiresInLayer(t_layerId);
1610 }
1611 mConstV["nTSs2D"] = vector<double> (5);
1612 for (unsigned iAx = 0; iAx < 5; iAx++) {
1613 mConstV["nTSs2D"][iAx] = mConstV["nTSs"][2 * iAx];
1614 }
1615 mConstV["zToStraw"] = vector<double> (4);
1616 mConstV["zToOppositeStraw"] = vector<double> (4);
1617 mConstV["angleSt"] = vector<double> (4);
1618 mConstV["nShift"] = vector<double> (4);
1619 for (int iSt = 0; iSt < 4; iSt++) {
1620 unsigned t_layerId = mConstV["priorityLayer"][iSt * 2 + 1];
1621 mConstV["zToStraw"][iSt] = cdc.senseWireBZ(t_layerId);
1622 mConstV["zToOppositeStraw"][iSt] = cdc.senseWireFZ(t_layerId);
1623 mConstV["angleSt"][iSt] = 2 * mConstV["rr"][2 * iSt + 1] * sin(mConstD["Trg_PI"] * cdc.nShifts(t_layerId) /
1624 (2 * cdc.nWiresInLayer(t_layerId))) / (cdc.senseWireFZ(t_layerId) - cdc.senseWireBZ(t_layerId));
1625 mConstV["nShift"][iSt] = cdc.nShifts(t_layerId);
1626 }
1627
1628 mConstV["rr2D"] = vector<double> (5);
1629 mConstV["rr3D"] = vector<double> (4);
1630 for (int iAx = 0; iAx < 5; iAx++) mConstV["rr2D"][iAx] = mConstV["rr"][iAx * 2];
1631 for (int iSt = 0; iSt < 4; iSt++) mConstV["rr3D"][iSt] = mConstV["rr"][iSt * 2 + 1];
1632
1633 mConstV["wirePhi2DError"] = vector<double> (5);
1634 mConstV["driftPhi2DError"] = vector<double> (5);
1635 mConstV["wirePhi2DError"][0] = 0.00085106;
1636 mConstV["wirePhi2DError"][1] = 0.00039841;
1637 mConstV["wirePhi2DError"][2] = 0.00025806;
1638 mConstV["wirePhi2DError"][3] = 0.00019084;
1639 mConstV["wirePhi2DError"][4] = 0.0001514;
1640 mConstV["driftPhi2DError"][0] = 0.00085106;
1641 mConstV["driftPhi2DError"][1] = 0.00039841;
1642 mConstV["driftPhi2DError"][2] = 0.00025806;
1643 mConstV["driftPhi2DError"][3] = 0.00019084;
1644 mConstV["driftPhi2DError"][4] = 0.0001514;
1645 mConstV["driftZError"] = vector<double> ({0.7676, 0.9753, 1.029, 1.372});
1646 mConstV["wireZError"] = vector<double> ({0.7676, 0.9753, 1.029, 1.372});
1647
1648 // Make driftLength table for each superlayer. Up to 511 clock ticks.
1649 // driftLengthTableSLX[ tdcCount (~2ns unit) ] = drift length (cm)
1650 for (unsigned iSl = 0; iSl < 9; iSl++) {
1651 string tableName = "driftLengthTableSL" + to_string(iSl);
1652 unsigned tableSize = 512;
1653 mConstV[tableName] = vector<double> (tableSize);
1654 unsigned t_layer = mConstV["priorityLayer"][iSl];
1655 for (unsigned iTick = 0; iTick < tableSize; iTick++) {
1656 double t_driftTime = iTick * 2 * cdc.getTdcBinWidth();
1657 double avgDriftLength = 0;
1658 if (isXtSimple == 1) {
1659 avgDriftLength = cdc.getNominalDriftV() * t_driftTime;
1660 } else {
1661 double driftLength_0 = cdc.getDriftLength(t_driftTime, t_layer, 0);
1662 double driftLength_1 = cdc.getDriftLength(t_driftTime, t_layer, 1);
1663 avgDriftLength = (driftLength_0 + driftLength_1) / 2;
1664 }
1665 mConstV[tableName][iTick] = avgDriftLength;
1666 }
1667 }
1668
1669 mConstD["tdcBitSize"] = 9;
1670 mConstD["rhoBitSize"] = 11;
1671 mConstD["iError2BitSize"] = 8;
1672 mConstD["iError2Max"] = 1 / pow(mConstV["wireZError"][0], 2);
1673 // LUT values
1674 mConstD["JB"] = 0;
1675 mConstD["phiMax"] = mConstD["Trg_PI"];
1676 mConstD["phiMin"] = -mConstD["Trg_PI"];
1677 mConstD["rhoMin"] = 20;
1678 mConstD["rhoMax"] = 2500;
1679 mConstD["phiBitSize"] = 13;
1680 mConstD["driftPhiLUTOutBitSize"] = mConstD["phiBitSize"] - 1;
1681 mConstD["driftPhiLUTInBitSize"] = mConstD["tdcBitSize"];
1682 mConstD["acosLUTOutBitSize"] = mConstD["phiBitSize"] - 1;
1683 mConstD["acosLUTInBitSize"] = mConstD["rhoBitSize"];
1684 mConstD["zLUTInBitSize"] = mConstD["phiBitSize"];
1685 mConstD["zLUTOutBitSize"] = 9;
1686 mConstD["iDenLUTInBitSize"] = 13;
1687 mConstD["iDenLUTOutBitSize"] = 11; // To increase wireZError = 2.5*driftZError
1688 }

◆ getDebugValue()

int getDebugValue ( EDebugValueType const &  moduleName) const
inline

Get debug value.

Definition at line 211 of file TRGCDCTrack.h.

212 {
213 return m_debugValue & moduleName;
214 }
int m_debugValue
Debugging variable.
Definition: TRGCDCTrack.h:125

◆ getEventTime()

int getEventTime ( void  ) const

returns bad hits(finding invalid hits).

returns event time

Definition at line 2743 of file TRGCDC.cc.

2744 {
2745 return _eventTime.back()->getT0();
2746 }

◆ getFileName()

string getFileName ( ) const

get LUT filename

Definition at line 368 of file JLUT.cc.

369 {
370 return m_fileName;
371 }

◆ getFinishClock()

int getFinishClock ( ) const

Gets clock tick where signal is make.

Definition at line 1427 of file JSignal.cc.

1428 {
1429 return m_finishClock;
1430 }

◆ getFloatFunction()

function< double(double)> getFloatFunction ( )

get LUT function using float values.

Definition at line 388 of file JLUT.cc.

389 {
390 return m_floatFunction;
391 }
std::function< double(double)> m_floatFunction
Float LUT function.
Definition: JLUT.h:146

◆ getFloatOutput()

double getFloatOutput ( double  input) const

get output using float values.

Definition at line 408 of file JLUT.cc.

409 {
410 return m_floatFunction(input);
411 }

◆ getFunction()

function< int(int)> getFunction ( )

get LUT function using int values.

Definition at line 383 of file JLUT.cc.

384 {
385 return m_function;
386 }
std::function< int(int)> m_function
LUT function.
Definition: JLUT.h:143

◆ getInput()

void getInput ( std::ifstream &  ifs)
private

Read input data definition.

Definition at line 752 of file TRGGDL.cc.

753 {
754 if (TRGDebug::level()) {
755 cout << "TRGGDL::getInput ... reading input data" << endl;
756 }
757
758 char b[800];
759 while (! ifs.eof()) {
760 ifs.getline(b, 800);
761
762 //...The first word should be input bit number...
763 // const string w0 = TRGUtilities::carstring(b);
764
765 //...Bit name...
766 string cdr = TRGUtilities::cdrstring(b);
767 const string w1 = TRGUtilities::carstring(cdr);
768
769 if (w1.size())
770 _input.push_back(w1);
771 }
772
773 }
static std::string carstring(const std::string &s)
CERNLIB car.
Definition: Utilities.cc:68

◆ getInputBitsize()

int getInputBitsize ( ) const

get input bitsize

Definition at line 373 of file JLUT.cc.

374 {
375 return m_inputBitsize;
376 }

◆ getInt()

signed long long getInt ( ) const

Get integer value of signal.

Definition at line 1377 of file JSignal.cc.

1378 {
1379 return m_int;
1380 }

◆ getLUT()

TRGCDCLUT * getLUT ( const std::string &  filename,
int  nInputBit 
)
static

get LUT from dictionary, load new LUT if it doesn't exist

Definition at line 83 of file LUT.cc.

84 {
85 if (!TRGCDCLUT::dictionary.count(filename)) {
86 TRGCDCLUT::dictionary[filename] = TRGCDCLUT();
87 TRGCDCLUT::dictionary[filename].setDataFile(filename, nInputBit);
88 }
89 return &(TRGCDCLUT::dictionary[filename]);
90 }
TRGCDCLUT()
Contructor.
Definition: LUT.cc:38
static std::map< std::string, TRGCDCLUT > dictionary
list of LUTs, to avoid reading LUT data 2336 times
Definition: LUT.h:64

◆ getMaxActual()

double getMaxActual ( ) const

Get maximum float value of signal.

Definition at line 1402 of file JSignal.cc.

1403 {
1404 return m_maxActual;
1405 }

◆ getMaxInt()

signed long long getMaxInt ( ) const

Get maximum integer value of signal.

Definition at line 1387 of file JSignal.cc.

1388 {
1389 return m_maxInt;
1390 }

◆ getMCValues()

void getMCValues ( const TRGCDC m_cdc_in,
TRGCDCTrack aTrack,
const std::map< std::string, double > &  m_mConstD_in,
std::map< std::string, double > &  m_mDouble_in,
std::map< std::string, std::vector< double > > &  m_mVector_in 
)
static

Function for mc debugging.

Definition at line 963 of file Fitter3D.cc.

965 {
966 // Access to track's MC particle.
967 const TCRelation& trackRelation = aTrack->relation();
968 // Biggest contibutor is 0. Next is 1 and so on.
969 const MCParticle& trackMCParticle = trackRelation.mcParticle(0);
970
971 // Calculated impact position
972 ROOT::Math::XYZVector vertex = trackMCParticle.getVertex();
973 ROOT::Math::PxPyPzEVector vector4 = trackMCParticle.get4Vector();
974 ROOT::Math::XYVector helixCenter;
975 ROOT::Math::XYZVector impactPosition;
976 Fitter3DUtility::findImpactPosition(&vertex, &vector4, int(m_mDouble_in["mcCharge"]), helixCenter, impactPosition);
977 m_mVector_in["mcVertex"] = vector<double> ({vertex.X(), vertex.Y(), vertex.Z()});
978 m_mVector_in["mcMomentum"] = vector<double> ({vector4.Px(), vector4.Py(), vector4.Pz()});
979 m_mVector_in["helixCenter"] = vector<double> ({helixCenter.X(), helixCenter.Y()});
980 m_mVector_in["impactPosition"] = vector<double> ({impactPosition.X(), impactPosition.Y(), impactPosition.Z()});
981
982 // Access track's particle parameters
983 m_mDouble_in["mcPt"] = trackMCParticle.getMomentum().Rho();
984 m_mDouble_in["mcPhi0"] = 0;
985 if (trackMCParticle.getCharge() > 0) m_mDouble_in["mcPhi0"] = trackMCParticle.getMomentum().Phi() - m_mConstD_in.at("Trg_PI") / 2;
986 if (trackMCParticle.getCharge() < 0) m_mDouble_in["mcPhi0"] = trackMCParticle.getMomentum().Phi() + m_mConstD_in.at("Trg_PI") / 2;
987 // Change range to [0,2pi]
988 if (m_mDouble_in["mcPhi0"] < 0) m_mDouble_in["mcPhi0"] += 2 * m_mConstD_in.at("Trg_PI");
989 //m_mDouble["mcZ0"] = trackMCParticle.getVertex().Z();
990 m_mDouble_in["mcZ0"] = impactPosition.Z();
991 m_mDouble_in["mcCot"] = trackMCParticle.getMomentum().z() / trackMCParticle.getMomentum().Rho();
992 m_mDouble_in["mcCharge"] = trackMCParticle.getCharge();
993
994 // mcStatus[0]: statusbit, mcStatus[1]: pdg, mcStatus[2]: charge
995 TVectorD mcStatus(3);
996 m_mDouble_in["mcStatus"] = trackMCParticle.getStatus();
997 m_mDouble_in["pdgId"] = trackMCParticle.getPDG();
998
999 // Find position of track for each super layer
1000 //...G4 trackID...
1001 unsigned id = trackRelation.contributor(0);
1002 vector<const TCSHit*> mcAllTSList[9];
1003 vector<const TCSHit*> mcTSList(9);
1004 //...Segment loop...
1005 const vector<const TCSHit*> hits = m_cdc_in.segmentHits();
1006 for (unsigned i = 0; i < hits.size(); i++) {
1007 const TCSHit& ts = * hits[i];
1008 if (! ts.signal().active()) continue;
1009 const TCWHit* wh = ts.segment().center().hit();
1010 if (! wh) continue;
1011 const unsigned trackId = wh->iMCParticle();
1012 if (id == trackId)
1013 mcAllTSList[wh->wire().superLayerId()].push_back(& ts);
1014 }
1015 //...Select best one in each super layer...
1016 for (unsigned i = 0; i < 9; i++) {
1017 const TCSHit* best = 0;
1018 if (mcAllTSList[i].size() == 0) {
1019 } else if (mcAllTSList[i].size() == 1) {
1020 best = mcAllTSList[i][0];
1021 } else {
1022 int timeMin = 99999;
1023 for (unsigned k = 0; k < mcAllTSList[i].size(); k++) {
1024 const TRGSignal& timing = mcAllTSList[i][k]->signal();
1025 const TRGTime& t = * timing[0];
1026 if (t.time() < timeMin) {
1027 timeMin = t.time();
1028 best = mcAllTSList[i][k];
1029 }
1030 }
1031 }
1032 mcTSList[i] = best;
1033 }
1034
1035
1036 // Get mc track positions. Unit is cm.
1037 m_mVector_in["mcPosX"] = vector<double> ({9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999});
1038 m_mVector_in["mcPosY"] = vector<double> ({9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999});
1039 m_mVector_in["mcPosZ"] = vector<double> ({9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999});
1040 for (unsigned iSL = 0; iSL < 9; iSL++) {
1041 if (mcTSList[iSL] != 0) {
1042 ROOT::Math::XYZVector posTrack = mcTSList[iSL]->simHit()->getPosTrack();
1043 m_mVector_in["mcPosX"][iSL] = posTrack.X();
1044 m_mVector_in["mcPosY"][iSL] = posTrack.Y();
1045 m_mVector_in["mcPosZ"][iSL] = posTrack.Z();
1046 }
1047 }
1048 // Get mc LR
1049 m_mVector_in["simMcLR"] = vector<double> (9);
1050 for (unsigned iSL = 0; iSL < 9; iSL++) {
1051 if (mcTSList[iSL] != 0) {
1052 m_mVector_in["simMcLR"][iSL] = mcTSList[iSL]->simHit()->getPosFlag();
1053 }
1054 }
1055
1057 //for(unsigned iSL=0; iSL<9; iSL++){
1058 // if(mcTSList[iSL]!=0) {
1059 // TVectorD t_helixParameters;
1060 // TVector3 t_positionAtR;
1061 // TVector3 t_momentumAtR;
1062 // Fitter3DUtility::calHelixParameters(mcTSList[iSL]->simHit()->getPosIn(), mcTSList[iSL]->simHit()->getMomentum(),trackMCParticle.getCharge(),t_helixParameters);
1063 // //cout<<"dr: "<<helixParameters[0]<<" phi0: "<<helixParameters[1]<<" R: "<<1/helixParameters[2]/0.3/1.5*100<<" dz: "<<helixParameters[3]<<" tanLambda: "<<helixParameters[4]<<endl;
1064 // //calVectorsAtR(t_helixParameters, trackMCParticle.getCharge(), m_rr[iSL]*100, t_positionAtR, t_momentumAtR);
1065 // //cout<<" x: "<<t_positionAtR.X()<<" y: "<<t_positionAtR.Y()<<" z: "<<t_positionAtR.Z()<<endl;
1066 // //cout<<"Px: "<<t_momentumAtR.X()<<" Py: "<<t_momentumAtR.Y()<<" Pz: "<<t_momentumAtR.Z()<<endl;
1067 // }
1068 //}
1069 }

◆ getMinActual()

double getMinActual ( ) const

Get minimum float value of signal.

Definition at line 1397 of file JSignal.cc.

1398 {
1399 return m_minActual;
1400 }

◆ getMinInt()

signed long long getMinInt ( ) const

Get minimum integer value of signal.

Definition at line 1382 of file JSignal.cc.

1383 {
1384 return m_minInt;
1385 }

◆ getName()

string getName ( ) const

Get name of signal.

Definition at line 1362 of file JSignal.cc.

1363 {
1364 return m_name;
1365 }

◆ getOutput() [1/2]

int getOutput ( int  input) const

get output using int values.

Definition at line 403 of file JLUT.cc.

404 {
405 return m_function(input);
406 }

◆ getOutput() [2/2]

void getOutput ( std::ifstream &  ifs)
private

Read output data definition.

Definition at line 776 of file TRGGDL.cc.

777 {
778
779 if (TRGDebug::level()) {
780 cout << "TRGGDL::getOutput ... reading output data" << endl;
781 }
782
783 char b[800];
784 while (! ifs.eof()) {
785 ifs.getline(b, 800);
786
787 //...The first word should be input bit number...
788 // const string w0 = TRGUtilities::carstring(b);
789
790 //...Bit name...
791 string cdr = TRGUtilities::cdrstring(b);
792 const string w1 = TRGUtilities::carstring(cdr);
793
794 if (w1.size())
795 _output.push_back(w1);
796 }
797
798 }

◆ getOutputBitsize()

int getOutputBitsize ( ) const

get output bitsize

Definition at line 378 of file JLUT.cc.

379 {
380 return m_outputBitsize;
381 }

◆ getOutputFlag()

int getOutputFlag ( ) const

get output type.

Definition at line 393 of file JLUT.cc.

394 {
395 return m_outputFlag;
396 }
int m_outputFlag
Flag for output. 0 is from function. 1 is from LUT file.
Definition: JLUT.h:149

◆ getOutputType()

int getOutputType ( ) const

get output type.

Definition at line 398 of file JLUT.cc.

399 {
400 return m_outputType;
401 }

◆ getPrintedToFile()

bool getPrintedToFile ( ) const

Gets the status of m_printedToFile.

Definition at line 80 of file JSignalData.cc.

81 {
82 return m_printedToFile;
83 }
bool m_printedToFile
Statis if VHDL is printed to file.
Definition: JSignalData.h:91

◆ getPrintVhdl() [1/2]

bool getPrintVhdl ( ) const

Gets the print vhdl flag from common JSignalData class.

Definition at line 1497 of file JSignal.cc.

1498 {
1500 else {
1501 cout << "[Error] TRGCDCJSignal::getPrintVhdl() => m_commonData does not exist." << endl;
1502 return 0;
1503 }
1504 }
bool m_printVhdl
Status if code should be printed.
Definition: JSignalData.h:89

◆ getPrintVhdl() [2/2]

bool getPrintVhdl ( ) const

Gets the status of m_printVhdl.

Definition at line 75 of file JSignalData.cc.

76 {
77 return m_printVhdl;
78 }

◆ getRealInt()

double getRealInt ( ) const

Get converted float value of integer.

Definition at line 1407 of file JSignal.cc.

1408 {
1409 return m_int * m_toReal;
1410 }

◆ getRealMaxInt()

double getRealMaxInt ( ) const

Get converted float value of maximum integer.

Definition at line 1417 of file JSignal.cc.

1418 {
1419 return m_maxInt * m_toReal;
1420 }

◆ getRealMinInt()

double getRealMinInt ( ) const

Get converted float value of minimum integer.

Definition at line 1412 of file JSignal.cc.

1413 {
1414 return m_minInt * m_toReal;
1415 }

◆ getReturnValue() [1/2]

int getReturnValue ( EReturnValueType const &  moduleName) const

gets return value for a module in trg cdc module.

Definition at line 2754 of file TRGCDC.cc.

2755 {
2756 return _returnValue & moduleName;
2757 }
int _returnValue
Return value for trg cdc module;.
Definition: TRGCDC.h:533

◆ getReturnValue() [2/2]

int getReturnValue ( void  ) const
inline

gets return value for trg cdc module.

Definition at line 1098 of file TRGCDC.h.

1099 {
1100 return _returnValue;
1101 }

◆ getSignals()

std::map< std::string, std::vector< int > > const & getSignals ( ) const

Gets the signals that were saved for one line of VHDL.

Definition at line 100 of file JSignalData.cc.

101 {
102 return m_signals;
103 }
std::map< std::string, std::vector< int > > m_signals
Holds all the requried VHDL signals.
Definition: JSignalData.h:96

◆ getStereoGeometry()

void getStereoGeometry ( std::map< std::string, std::vector< double > > &  stGeometry)
static

Get stereo geometry.

Definition at line 1558 of file Fitter3D.cc.

1559 {
1560 stGeometry["priorityLayer"] = {10, 22, 34, 46};
1561 stGeometry["nWires"] = vector<double> (4);
1562 stGeometry["cdcRadius"] = vector<double> (4);
1563 stGeometry["zToStraw"] = vector<double> (4);
1564 stGeometry["nShift"] = vector<double> (4);
1565 stGeometry["angleSt"] = vector<double> (4);
1566 const CDC::CDCGeometryPar& cdc = CDC::CDCGeometryPar::Instance();
1567 for (int iSt = 0; iSt < 4; ++iSt) {
1568 stGeometry["nWires"][iSt] = cdc.nWiresInLayer(stGeometry["priorityLayer"][iSt]) * 2;
1569 stGeometry["cdcRadius"][iSt] = cdc.senseWireR(stGeometry["priorityLayer"][iSt]);
1570 stGeometry["zToStraw"][iSt] = cdc.senseWireBZ(stGeometry["priorityLayer"][iSt]);
1571 stGeometry["nShift"][iSt] = cdc.nShifts(stGeometry["priorityLayer"][iSt]);
1572 stGeometry["angleSt"][iSt] = 2 * stGeometry["cdcRadius"][iSt] * sin(M_PI * stGeometry["nShift"][iSt] /
1573 (stGeometry["nWires"][iSt])) /
1574 (cdc.senseWireFZ(stGeometry["priorityLayer"][iSt]) - stGeometry["zToStraw"][iSt]);
1575 }
1576 }

◆ getStereoXt()

void getStereoXt ( std::vector< double > const &  stPriorityLayer,
std::vector< std::vector< double > > &  stXts,
bool  isSimple = 0 
)
static

Get stereo Xt.

Definition at line 1578 of file Fitter3D.cc.

1579 {
1580 stXts.resize(stPriorityLayer.size(), vector<double> (512));
1581 const CDC::CDCGeometryPar& cdc = CDC::CDCGeometryPar::Instance();
1582 for (unsigned iSt = 0; iSt < stPriorityLayer.size(); ++iSt) {
1583 for (unsigned iTick = 0; iTick < stXts[iSt].size(); ++iTick) {
1584 double t = iTick * 2 * cdc.getTdcBinWidth();
1585 if (isSimple) {
1586 stXts[iSt][iTick] = cdc.getNominalDriftV() * t;
1587 } else {
1588 double driftLength_0 = cdc.getDriftLength(t, stPriorityLayer[iSt], 0);
1589 double driftLength_1 = cdc.getDriftLength(t, stPriorityLayer[iSt], 1);
1590 stXts[iSt][iTick] = (driftLength_0 + driftLength_1) / 2;
1591 }
1592 }
1593 }
1594 }

◆ getT0()

int getT0 ( void  ) const

Calculate T0.

Definition at line 242 of file EventTime.cc.

243 {
244 int et = m_histT;
245 if (m_foundT0 == 0) et = 9999;
246 return et;
247 }

◆ getToReal()

double getToReal ( ) const

Get toReal value of signal.

Definition at line 1422 of file JSignal.cc.

1423 {
1424 return m_toReal;
1425 }

◆ getTrackID()

int getTrackID ( )
inline

get track ID.

Definition at line 284 of file TrackBase.h.

285 {
286 return m_trackID;
287 }
int m_trackID
ID of tracks.
Definition: TrackBase.h:172

◆ getTrackList2D()

vector< TCTrack * > getTrackList2D ( void  )

returns 2D track list (no fit).

Definition at line 200 of file TRGCDC.cc.

201 {
202 return _trackList2D;
203 }

◆ getTrackList2DFitted()

vector< TCTrack * > getTrackList2DFitted ( void  )

returns 2D fitted track list.

Definition at line 206 of file TRGCDC.cc.

207 {
208 return _trackList2DFitted;
209 }

◆ getTrackList3D()

vector< TCTrack * > getTrackList3D ( void  )

returns 3D track list (fitted).

Definition at line 212 of file TRGCDC.cc.

213 {
214 return _trackList3D;
215 }

◆ getTRGCDC() [1/2]

TRGCDC * getTRGCDC ( const std::string &  configFile,
unsigned  simulationMode = 0,
unsigned  fastSimulationMode = 0,
unsigned  firmwareSimulationMode = 0,
int  firmwareSimulationStart = 0,
int  firmwareSimulationStop = 32 * 32 - 1,
bool  _makeRootFile = 0,
bool  perfect2DFinder = false,
bool  perfect3DFinder = false,
const std::string &  innerTSLUTFile = "?",
const std::string &  outerTSLUTFile = "?",
const std::string &  rootTRGCDCFile = "?",
const std::string &  rootFitter3DFile = "?",
unsigned  houghFinderPeakMin = 5,
const std::string &  houghMappingFilePlus = "?",
const std::string &  houghMappingFileMinus = "?",
unsigned  houghDoit = 2,
bool  fLogicLUTTSF = 0,
bool  fLRLUT = 1,
bool  fFitter3Dsmclr = 0,
bool  fFitter3Ds2DFit = 1,
bool  fFitter3Ds2DFitDrift = 0,
double  inefficiency = 0,
bool  fileTSF = 0,
bool  fileETF = 0,
int  fverETF = 0,
bool  fprintFirmETF = 0,
bool  fileHough3D = 0,
int  finder3DMode = 0,
bool  fileFitter3D = 0,
bool  fXtSimpleFitter3D = 0,
double  TdcBinWidth = 1.,
int  trgCDCDataInputMode = 0,
const std::string &  cdchitCollectionName = "" 
)
static

returns TRGCDC object with specific configuration.

Definition at line 107 of file TRGCDC.cc.

141 {
142 if (_cdc) {
143 //delete _cdc;
144 _cdc = 0;
145 }
146
147 if (configFile != "good-bye") {
148 _cdc = new TRGCDC(configFile,
149 simulationMode,
150 fastSimulationMode,
154 makeRootFile,
155 perfect2DFinder,
157 innerTSLUTFile,
158 outerTSLUTFile,
159 rootTRGCDCFile,
160 rootFitter3DFile,
161 houghFinderPeakMin,
162 houghMappingFilePlus,
163 houghMappingFileMinus,
164 houghDoit,
165 fLogicLUTTSF,
166 fLRLUT,
167 fFitter3Dsmclr,
168 fFitter3Ds2DFit,
169 fFitter3Ds2DFitDrift,
170 inefficiency,
171 fileTSF,
172 fileETF,
173 fverETF,
174 fprintFirmETF,
175 fileHough3D,
176 finder3DMode,
177 fileFitter3D,
178 fXtSimpleFitter3D,
179 TdcBinWidth,
180 trgCDCDataInputMode,
181 cdchitCollectionName);
182 } else {
183 cout << "TRGCDC::getTRGCDC ... good-bye" << endl;
184 // delete _cdc;
185 _cdc = 0;
186 }
187
188 return _cdc;
189 }
void perfect3DFinder(std::vector< TRGCDCTrack * > trackList) const
fills stereo TSs to tracks using MC info.
TRGCDC(const std::string &configFile, unsigned simulationMode, unsigned fastSimulationMode, unsigned firmwareSimulationMode, int firmwareSimulationStart, int firmwareSimulationStop, bool makeRootFile, bool perfect2DFinder, bool perfect3DFinder, const std::string &innerTSLUTFile, const std::string &outerTSLUTFile, const std::string &rootTRGCDCFile, const std::string &rootFitter3DFile, unsigned houghFinderPeakMin, const std::string &houghMappingFilePlus, const std::string &houghMappingFileMinus, unsigned houghDoit, bool fLogicLUTTSF, bool fLRLUT, bool fFitter3Dsmclr, bool fFitter3Ds2DFit, bool fFitter3Ds2DFitDrift, double inefficiecny, bool fileTSF, bool fileETF, int fverETF, bool fprintFirmETF, bool fileHough3D, int finder3DMode, bool fileFitter3D, bool fXtSimpleFitter3D, double TdcBinWidth, int trgCDCDataInputMode, const std::string &cdchitCollectionName)
Constructor.
Definition: TRGCDC.cc:217
unsigned firmwareSimulationMode(void) const
returns firmware simulation mode.
Definition: TRGCDC.h:1091
int firmwareSimulationStart(void) const
returns start clock of the firmware simulation in FE clock.
Definition: TRGCDC.h:1112
static TRGCDC * _cdc
CDC trigger singleton.
Definition: TRGCDC.h:490
int firmwareSimulationStop(void) const
returns stop clock of the firmware simulation in FE clock.
Definition: TRGCDC.h:1119

◆ getTRGCDC() [2/2]

TRGCDC * getTRGCDC ( void  )
static

returns TRGCDC object.

TRGCDC should be created with specific configuration before calling this function.

Definition at line 192 of file TRGCDC.cc.

193 {
194 if (! _cdc)
195 cout << "TRGCDC::getTRGCDC !!! TRGCDC is not created yet" << endl;
196 return _cdc;
197 }

◆ getTRGGDL() [1/2]

TRGGDL * getTRGGDL ( const std::string &  configFile,
unsigned  simulationMode = 0,
unsigned  fastSimulationMode = 0,
unsigned  firmwareSimulationMode = 0,
const std::string &  Phase = "Phase",
bool  algFromDB = true,
const std::string &  algFilePath = "ftd.alg",
int  debugLevel = 0,
double  timquality_threshold_sfin = 0,
double  timquality_threshold_fine = 0 
)
static

returns TRGGDL object with specific configuration.

Definition at line 66 of file TRGGDL.cc.

76 {
77 if (_gdl) {
78 //delete _gdl;
79 _gdl = 0;
80 }
81
82 if (configFile != "good-bye") {
84 simulationMode,
85 fastSimulationMode,
87 Phase,
88 algFromDB,
89 algFilePath,
91 timquality_threshold_sfin,
92 timquality_threshold_fine);
93 } else {
94 cout << "TRGGDL::getTRGGDL ... good-bye" << endl;
95 // delete _gdl;
96 _gdl = 0;
97 }
98
99 return _gdl;
100 }
int debugLevel(void) const
returns debug level.
Definition: TRGGDL.h:299
static TRGGDL * _gdl
GDL singleton.
Definition: TRGGDL.h:209
TRGGDL(const std::string &configFile, unsigned simulationMode, unsigned fastSimulationMode, unsigned firmwareSimulationMode, const std::string &Phase, bool algFromDB=true, const std::string &algFilePath="ftd.alg", int debugLevel=0, double timquality_threshold_sfin=0, double timquality_threshold_fine=0)
Constructor.
Definition: TRGGDL.cc:110
std::string configFile(void) const
returns configuration file name.
Definition: TRGGDL.h:334

◆ getTRGGDL() [2/2]

TRGGDL * getTRGGDL ( void  )
static

returns TRGGDL object.

TRGGDL should be created with specific configuration before calling this function.

Definition at line 103 of file TRGGDL.cc.

104 {
105 if (! _gdl)
106 cout << "TRGGDL::getTRGGDL !!! TRGGDL is not created yet" << endl;
107 return _gdl;
108 }

◆ getTRGGRL() [1/2]

TRGGRL * getTRGGRL ( const std::string &  configFile,
unsigned  simulationMode = 0,
unsigned  fastSimulationMode = 0,
unsigned  firmwareSimulationMode = 0 
)
static

returns TRGGRL object with specific configuration.

Definition at line 49 of file TRGGRL.cc.

53 {
54 if (_grl) {
55 //delete _grl;
56 _grl = 0;
57 }
58
59 if (configFile != "good-bye") {
61 simulationMode,
62 fastSimulationMode,
64 } else {
65 B2DEBUG(100, "TRGGRL::getTRGGRL ... good-bye");
66 _grl = 0;
67 }
68
69 return _grl;
70 }
TRGGRL(const std::string &configFile, unsigned simulationMode, unsigned fastSimulationMode, unsigned firmwareSimulationMode)
Constructor.
Definition: TRGGRL.cc:80
static TRGGRL * _grl
GRL singleton.
Definition: TRGGRL.h:141

◆ getTRGGRL() [2/2]

TRGGRL * getTRGGRL ( void  )
static

returns TRGGRL object.

TRGGRL should be created with specific configuration before calling this function.

Definition at line 73 of file TRGGRL.cc.

74 {
75 if (! _grl)
76 B2WARNING("TRGGRL::getTRGGRL !!! TRGGRL is not created yet");
77 return _grl;
78 }

◆ getType()

int getType ( ) const

Get type of signal.

Definition at line 1367 of file JSignal.cc.

1368 {
1369 return m_type;
1370 }

◆ getValue()

int getValue ( unsigned  id) const

get LUT Values

Definition at line 47 of file LUT.cc.

48 {
49 unsigned range = pow(2, m_bitsize);
50 if (id >= range) {
51 return 0;
52 } else {
53 return m_data[id];
54 }
55 }
std::vector< int > m_data
LUT data.
Definition: LUT.h:72
int m_bitsize
Input bit size.
Definition: LUT.h:75

◆ getVhdlCode()

string getVhdlCode ( ) const

Gets the vhdl code for the signal.

Definition at line 1492 of file JSignal.cc.

1493 {
1494 return m_vhdlCode;
1495 }

◆ getVhdlDefine()

std::string getVhdlDefine ( ) const

Gets the VHDL code for define statement.

Definition at line 95 of file JSignalData.cc.

96 {
97 return m_vhdlDefine;
98 }

◆ getVhdlInProcess()

std::string getVhdlInProcess ( ) const

Gets the VHDL code that are in a process statement.

Definition at line 85 of file JSignalData.cc.

86 {
87 return m_vhdlInProcess;
88 }

◆ getVhdlOutProcess()

std::string getVhdlOutProcess ( ) const

Gets the VHDL code that are outside a process statement.

Definition at line 90 of file JSignalData.cc.

91 {
92 return m_vhdlOutProcess;
93 }
std::string m_vhdlOutProcess
Holds VHDL out of process code.
Definition: JSignalData.h:87

◆ getVhdlOutputFile() [1/2]

string getVhdlOutputFile ( ) const

Gets the vhdl output file name.

Definition at line 1506 of file JSignal.cc.

1507 {
1509 else {
1510 cout << "[Error] TRGCDCJSignal::getVhdlOutputFile() => m_commonData does not exist." << endl;
1511 return "";
1512 }
1513 }
std::string m_vhdlOutputFile
Memebers.
Definition: JSignalData.h:79

◆ getVhdlOutputFile() [2/2]

std::string getVhdlOutputFile ( ) const

Get the VHDL output code.

Definition at line 70 of file JSignalData.cc.

71 {
72 return m_vhdlOutputFile;
73 }

◆ hasMember() [1/2]

bool hasMember ( const std::string &  a) const
inlinevirtual

returns true this has member named a.

Reimplemented in TRGCDCSegment.

Definition at line 379 of file Cell.h.

380 {
381 return name() == a;
382 }

◆ hasMember() [2/2]

bool hasMember ( const std::string &  a) const
overridevirtual

returns true this has member named a.

Reimplemented from TRGCDCCell.

Definition at line 591 of file Segment.cc.

592 {
593 const unsigned n = _wires.size();
594 for (unsigned i = 0; i < n; i++) {
595 if (_wires[i]->hasMember(a))
596 return true;
597 }
598 return false;
599 }
virtual bool hasMember(const std::string &a) const override
returns true this has member named a.
Definition: Segment.cc:591

◆ helix()

const TRGCDCHelix & helix ( void  ) const
inline

returns helix parameter.

Definition at line 143 of file TRGCDCTrack.h.

144 {
145 return _helix;
146 }

◆ hep()

const TRGCDCTrackMC * hep ( void  ) const
inline

returns a pointer to a GEN_HEPEVT.

Definition at line 142 of file WireHitMC.h.

143 {
144 return _hep;
145 }
const TRGCDCTrackMC * _hep
pointer to TRGCDCTrackMC
Definition: WireHitMC.h:89

◆ hist()

void hist ( void  )

making hostogram

Definition at line 154 of file EventTime.cc.

155 {
156 TRGDebug::enterStage("Event Time");
157
158 m_foundT0 = 0;
159 threshold = 3;
160 m_histT = 500;
161
162 for (int i = 450; i < 600; i++) {
163 if (h->GetBinContent(i) > threshold) {
164 m_foundT0 = 1;
165 m_histT = i - 500;
166 m_evtOut->Fill();
167 if (m_histT < 0) {
168 m_minusET += 1;
169 }
170 break;
171 }
172 }//end of loop over hist bins
173 if (m_histT == 500) {
174 m_noET += 1;
175 }//if no bin has contents over threshold no evt time
176 h->Reset();
177
178 TRGDebug::leaveStage("Event Time");
179 }//end of TRGCDCEventTime::hist
TTree * m_evtOut
TTree pointer of the TFile.
Definition: EventTime.h:72
int m_noET
no ET bin is looped
Definition: EventTime.h:93
int threshold
Threshold value.
Definition: EventTime.h:97
int m_minusET
minus ET bin
Definition: EventTime.h:91
TH1 * h
TH1 pointer of the TFile.
Definition: EventTime.h:74

◆ hit() [1/11]

const TRGCDCCellHit * hit ( const TRGCDCCellHit a)
inline

sets a pointer to TRGCDCWireHit.

Definition at line 372 of file Cell.h.

373 {
374 return _hit = a;
375 }

◆ hit() [2/11]

const TRGCDCCellHit * hit ( const TRGCDCCellHit a)
inline

sets a pointer to a hit.

Definition at line 434 of file Link.h.

435 {
436 return _hit = a;
437 }

◆ hit() [3/11]

const TRGCDCSegmentHit * hit ( const TRGCDCSegmentHit h)
inline

sets a pointer to a TRGCDCSegmentHit.

Definition at line 228 of file Segment.h.

229 {
230 //TODO only this strong retyping work, is it OK?
231 return reinterpret_cast<const TRGCDCSegmentHit*>(TRGCDCCell::hit(reinterpret_cast<const TRGCDCCellHit*>(h)));
232 }
const TRGCDCCellHit * hit(void) const
returns a pointer to a TRGCDCCellHit.
Definition: Cell.h:365

◆ hit() [4/11]

const TRGCDCWireHit * hit ( const TRGCDCWireHit h)
inline

returns a pointer to a TRGCDCWireHit.

Definition at line 145 of file Wire.h.

146 {
147 //TODO only this strong retyping work, is it OK?
148 return reinterpret_cast<const TRGCDCWireHit*>(TRGCDCCell::hit(reinterpret_cast<const TRGCDCCellHit*>(h)));
149 }

◆ hit() [5/11]

const TRGCDCWireHitMC * hit ( TRGCDCWireHitMC a)
inline

appends a pointer to TRGCDCWireHitMC.

Definition at line 161 of file Wire.h.

162 {
163 _mcHits.push_back(a);
164 return a;
165 }

◆ hit() [6/11]

const TRGCDCCellHit * hit ( void  ) const
inline

returns a pointer to a TRGCDCCellHit.

Definition at line 365 of file Cell.h.

366 {
367 return _hit;
368 }

◆ hit() [7/11]

const CDCHit * hit ( void  ) const

Access to CDCHit.

Definition at line 133 of file CellHit.cc.

134 {
135 StoreArray<CDCHit> CDCHits("CDCHits");
136 return CDCHits[_iCDCHit];
137 }
unsigned _iCDCHit
Index to CDCHit array.
Definition: CellHit.h:196

◆ hit() [8/11]

const TRGCDCCellHit * hit ( void  ) const
inline

returns a pointer to a hit.

Definition at line 420 of file Link.h.

421 {
422 return _hit;
423 }

◆ hit() [9/11]

const TRGCDCSegmentHit * hit ( void  ) const
inline

returns a pointer to a TRGCDCSegmentHit.

Definition at line 236 of file Segment.h.

237 {
238 //TODO only this strong retyping work, is it OK?
239 return reinterpret_cast<const TRGCDCSegmentHit*>(TRGCDCCell::hit());
240 }

◆ hit() [10/11]

const TRGCDCWireHit * hit ( void  ) const
inline

returns a pointer to a TRGCDCWireHit.

Definition at line 153 of file Wire.h.

154 {
155 //TODO only this strong retyping work, is it OK?
156 return reinterpret_cast<const TRGCDCWireHit*>(TRGCDCCell::hit());
157 }

◆ hit() [11/11]

const TRGCDCWireHit * hit ( void  ) const
inline

returns a pointer to a TRGCDCWireHit.

Definition at line 149 of file WireHitMC.h.

150 {
151 return _hit;
152 }
const TRGCDCWireHit * _hit
pointer to TRGCDCWireHit
Definition: WireHitMC.h:75

◆ hitcount()

void hitcount ( void  )

hit count of TS

Definition at line 119 of file EventTime.cc.

120 {
121 TRGDebug::enterStage("Event Time");
122
123 memset(cnt, 0, sizeof cnt);
124 memset(ft, 0, sizeof ft);
125
126 const vector<const TCSHit*> tsh = _cdc.segmentHits();
127
128 for (int iClk = 0; iClk < 64; iClk++) {
129 for (int iTS = 0; iTS < (int)tsh.size(); iTS++) {
130 const TRGCDCSegment& ts = tsh[iTS]->segment();
131 int fndC = ts.foundTime() / 16;
132 m_fastestT = ts.fastestTime();
133 m_foundT = ts.foundTime();
134 m_whdiff = ts.foundTime() - ts.fastestTime();
135 if (m_whdiff <= 256) {
136 if (iClk == fndC + 31) {
137 for (int iSL = 0; iSL < 9; iSL++) {
138 if ((int)ts.layer().id() == iSL) {
139 cnt[iSL][iClk] += 1;
140 if (cnt[iSL][iClk] <= 10) {
141 h->Fill(m_fastestT);
142 m_evtOutputTs->Fill();
143 ft[iSL][iClk][cnt[iSL][iClk] - 1] = ts.fastestTime();
144 }
145 }
146 }
147 }
148 }
149 }
150 }
151 TRGDebug::leaveStage("Event Time");
152 }//end of TRGCEventTime::hitcount
int m_foundT
Found time of TS.
Definition: EventTime.h:87
const TRGCDC & _cdc
TRGCDC class.
Definition: EventTime.h:65
TTree * m_evtOutputTs
TTree pointer of the TFile.
Definition: EventTime.h:70
int ft[9][64][10]
Fastest time array each SL and clock.
Definition: EventTime.h:83
int m_whdiff
Drift time of TS.
Definition: EventTime.h:89
int m_fastestT
The fastest time of TS.
Definition: EventTime.h:77
int cnt[9][64]
TS counter for each SL and clock.
Definition: EventTime.h:81

◆ hitInformation()

void hitInformation ( const TRGState registers)
staticprivate

Gets TSF hit information for one certin clock from the registers.

Definition at line 204 of file Tracker2D.cc.

205 {
206
207 //...Clear info...
208 _ts.clear();
209
210 //...Set TSF hit information...
211 for (unsigned i = 0; i < nTSF() / 2; i++) {
212 bool active = registers.subset(i * 16, 16).active();
213 if (active)
214 _ts.set(i, true);
215 }
216 }
static unsigned nTSF(void)
returns # of TSF.
Definition: Tracker2D.h:115
const TRGState & set(unsigned position, bool state=true)
sets state at bit i.
Definition: State.h:305
static TRGState _ts
Keeps TS hit info.
Definition: Tracker2D.h:108

◆ hitMapInner()

void hitMapInner ( void  )

Creates the hit maps for the inner.

Definition at line 2149 of file TrackSegmentFinder.cc.

2150 {
2151
2152 // dump("detail","??? ");
2153
2154 //...Loop over mergers to create a super layer hit map...
2155 for (unsigned m = 0; m < nInput(); m++) {
2156 TRGSignalBundle* b = input(m)->signal();
2157
2158 // b->dump("", "??? ");
2159
2160 for (unsigned i = 0; i < 16; i++) {
2161 _secMap.push_back(& ((* b)[0][0][208 + i]));
2162 for (unsigned j = 0; j < 5; j++) {
2163 _hitMap[j].push_back(& ((* b)[0][0][j * 16 + i]));
2164
2165 // _hitMap[j][i]->dump("", "??? " + TRGUtilities::itostring(i) + "-" + TRGUtilities::itostring(j));
2166
2167 }
2168 for (unsigned j = 0; j < 4; j++)
2169 _priMap.push_back(& ((* b)[0][0][80 + i * 4 + j]));
2170 for (unsigned j = 0; j < 4; j++)
2171 _fasMap.push_back(& ((* b)[0][0][144 + i * 4 + j]));
2172 }
2173
2174 for (unsigned i = 0; i < 4; i++)
2175 _edg0Map.push_back(& ((* b)[0][0][224 + i]));
2176 for (unsigned i = 0; i < 4; i++)
2177 _edg1Map.push_back(& ((* b)[0][0][224 + 4 + i]));
2178 for (unsigned i = 0; i < 4; i++)
2179 _edg2Map.push_back(& ((* b)[0][0][224 + 8 + i]));
2180 for (unsigned i = 0; i < 4; i++)
2181 _edg3Map.push_back(& ((* b)[0][0][224 + 12 + i]));
2182 for (unsigned i = 0; i < 4; i++)
2183 _edg4Map.push_back(& ((* b)[0][0][224 + 16 + i]));
2184 }
2185 }
std::vector< TRGSignal * > _priMap
Internal data of the priority hit timing.
std::vector< TRGSignal * > _edg0Map
Internal data of the edge timing information.
std::vector< TRGSignal * > _hitMap[5]
Internal data of wire hit map.
std::vector< TRGSignal * > _secMap
Internal data of the priority cell hit position flag.
unsigned nInput(void) const
returns input channels.
Definition: Board.h:172

◆ hitMapOuter()

void hitMapOuter ( void  )

Creates the hit maps for the outer.

Definition at line 2188 of file TrackSegmentFinder.cc.

2189 {
2190
2191 //...Loop over mergers to create a super layer hit map...
2192 for (unsigned m = 0; m < nInput(); m++) {
2193 TRGSignalBundle* b = input(m)->signal();
2194
2195 for (unsigned i = 0; i < 16; i++) {
2196 _secMap.push_back(& ((* b)[0][0][208 + i]));
2197 for (unsigned j = 0; j < 5; j++)
2198 _hitMap[j].push_back(& ((* b)[0][0][j * 16 + i]));
2199 for (unsigned j = 0; j < 4; j++)
2200 _priMap.push_back(& ((* b)[0][0][80 + i * 4 + j]));
2201 for (unsigned j = 0; j < 4; j++)
2202 _fasMap.push_back(& ((* b)[0][0][144 + i * 4 + j]));
2203 }
2204
2205 for (unsigned i = 0; i < 4; i++)
2206 _edg0Map.push_back(& ((* b)[0][0][224 + i]));
2207 for (unsigned i = 0; i < 4; i++)
2208 _edg1Map.push_back(& ((* b)[0][0][224 + 4 + i]));
2209 for (unsigned i = 0; i < 4; i++)
2210 _edg2Map.push_back(& ((* b)[0][0][224 + 8 + i]));
2211 }
2212 }
void push_back(const TRGCDCMerger *)
push back the Mergers of this TSF

◆ hitPattern() [1/2]

unsigned hitPattern ( int  clk0,
int  clk1 
) const

returns hit pattern for hits in given time window.

Definition at line 559 of file Segment.cc.

560 {
561 unsigned ptn = 0;
562 for (unsigned i = 0; i < _wires.size(); i++) {
563 const TRGSignal& s = _wires[i]->signal();
564 if (s.active(clk0, clk1))
565 ptn |= (1 << i);
566 }
567 return ptn;
568 }

◆ hitPattern() [2/2]

unsigned hitPattern ( void  ) const

returns hit pattern.

Definition at line 535 of file Segment.cc.

536 {
537 unsigned ptn = 0;
538 for (unsigned i = 0; i < _wires.size(); i++) {
539 const TRGSignal& s = _wires[i]->signal();
540 if (s.active())
541 ptn |= (1 << i);
542 }
543 return ptn;
544 }

◆ hitPattern_adc()

unsigned hitPattern_adc ( void  ) const

returns hit pattern with adc cut.

Definition at line 547 of file Segment.cc.

548 {
549 unsigned ptn = 0;
550 for (unsigned i = 0; i < _wires.size(); i++) {
551 const TRGSignal& s = _wires[i]->signal_adc();
552 if (s.active())
553 ptn |= (1 << i);
554 }
555 return ptn;
556 }

◆ hitPosition()

const HepGeom::Point3D< double > & hitPosition ( void  ) const
inline

returns hit position.

Definition at line 107 of file WireHitMC.h.

108 {
109 return _position;
110 }
HepGeom::Point3D< double > _position
position vector
Definition: WireHitMC.h:77

◆ hits() [1/2]

std::vector< const TRGCDCWireHitMC * > hits ( void  ) const

returns a list of TRGCDCWireHitMC.

Definition at line 102 of file TrackMC.cc.

103 {
104 std::vector<const TRGCDCWireHitMC*> t;
105 t.assign(_hits.begin(), _hits.end());
106 return t;
107 }
std::vector< TRGCDCWireHitMC * > _hits
vector of pointers to TRGCDCWireHitMC
Definition: TrackMC.h:101

◆ hits() [2/2]

vector< const TCWHit * > hits ( void  ) const

returns a list of TRGCDCWireHit.

'update()' must be called before calling this function.

Definition at line 1705 of file TRGCDC.cc.

1706 {
1707 vector<const TCWHit*> t;
1708 t.assign(_hits.begin(), _hits.end());
1709 return t;
1710
1711 // if (! mask) return _hits;
1712 // else if (mask == CellHitFindingValid) return _hits;
1713 // cout << "TRGCDC::hits !!! unsupported mask given" << endl;
1714 // return _hits;
1715 }

◆ hitsMC()

vector< const TCWHitMC * > hitsMC ( void  ) const

returns a list of TRGCDCWireHitMC.

'updateMC()' must be called before calling this function.

Definition at line 1751 of file TRGCDC.cc.

1752 {
1753 vector<const TCWHitMC*> t;
1754 t.assign(_hitsMC.begin(), _hitsMC.end());
1755 return t;
1756 }

◆ Hpar()

CLHEP::HepVector Hpar ( const HepGeom::Point3D< double > &  pivot) const
inline

const member functions

Definition at line 324 of file Lpar.h.

325 {
326 CLHEP::HepVector a(5);
327 double dd = d0(pivot.x(), pivot.y());
328 a(1) = dd * (m_kappa * dd - 1);
329 a(2) = (m_kappa > 0) ? std::atan2(yc() - pivot.y(), xc() - pivot.x()) + M_PI
330 : std::atan2(pivot.y() - yc(), pivot.x() - xc()) - M_PI;
331 a(3) = -2.0 * BELLE_ALPHA * m_kappa;
332 a(4) = 0;
333 a(5) = 0;
334 return a;
335 }
static const double BELLE_ALPHA
belle alpha
Definition: Lpar.h:183

◆ iCDCHit()

unsigned iCDCHit ( void  ) const
inline

returns an index to CDCHit.

Definition at line 360 of file CellHit.h.

361 {
362 return _iCDCHit;
363 }

◆ iCDCSimHit() [1/2]

unsigned iCDCSimHit ( void  ) const
inline

returns an index to CDCSimHit.

Definition at line 367 of file CellHit.h.

368 {
369 return _iCDCSimHit;
370 }
unsigned _iCDCSimHit
Index to CDCSimHit array.
Definition: CellHit.h:199

◆ iCDCSimHit() [2/2]

unsigned iCDCSimHit ( void  ) const
inline

return index of CDCSimHit

Definition at line 111 of file WireHit.h.

112 {
113 return _iCDCSimHit;
114 }
unsigned _iCDCSimHit
index of CDCSimHit
Definition: WireHit.h:89

◆ id() [1/4]

void id ( unsigned  serialId,
unsigned &  x,
unsigned &  y 
) const
inline

returns x and y for serialID.

Definition at line 483 of file HoughPlaneBase.h.

484 {
485 x = serialId / _nY;
486 y = serialId % _nY;
487 }

◆ id() [2/4]

unsigned id ( void  ) const
inline

returns id.

Definition at line 200 of file Cell.h.

201 {
202 return _id;
203 }

◆ id() [3/4]

unsigned id ( void  ) const
inline

returns id.

Definition at line 159 of file Layer.h.

160 {
161 return _id;
162 }

◆ id() [4/4]

unsigned id ( void  ) const
inline

returns an id started from 0.

Definition at line 114 of file TrackMC.h.

115 {
116//cnv return _hep->m_ID - 1;
117 return 0;
118 }

◆ ifElse() [1/2]

void ifElse ( std::vector< std::pair< TRGCDCJSignal, std::vector< std::pair< TRGCDCJSignal *, TRGCDCJSignal > > > > &  data)
static

If else implementation.

Definition at line 951 of file JSignal.cc.

952 {
953 ifElse(data, -3);
954 }
static void ifElse(std::vector< std::pair< TRGCDCJSignal, std::vector< std::pair< TRGCDCJSignal *, TRGCDCJSignal > > > > &data, int targetClock)
If else implementation with target clock.
Definition: JSignal.cc:800

◆ ifElse() [2/2]

void ifElse ( std::vector< std::pair< TRGCDCJSignal, std::vector< std::pair< TRGCDCJSignal *, TRGCDCJSignal > > > > &  data,
int  targetClock 
)
static

If else implementation with target clock.

Definition at line 800 of file JSignal.cc.

802 {
803 // Handle input errors.
804 if (data.size() == 0) {
805 cout << "[Error] TRGCDCJSignal::ifElse() => There is not enough data." << endl;
806 return;
807 }
808
809 // Init arguments of data.
810 // These errors prevent else case being in between data.
811 // Loop over all cases.
812 for (unsigned iCase = 0; iCase < data.size(); iCase++) {
813 TRGCDCJSignal const& comp = data[iCase].first;
814 if (iCase != (data.size() - 1)) {
815 if (comp.m_argumentSignals.size() == 0) cout << "[Error] TRGCDCJSignal::ifElse() => comp signal has no m_vhdl." << endl;
816 if (comp.m_minInt != 0
817 || comp.m_maxInt != 1) cout << "[Error] TRGCDCJSignal::ifElse() => comp signal m_minInt or m_maxInt is not correct." << endl;
818 }
819 // Loop over all assignments.
820 for (unsigned iAssignment = 0; iAssignment < data[iCase].second.size(); iAssignment++) {
821 TRGCDCJSignal& rhs = data[iCase].second[iAssignment].second;
822 //if(rhs.m_type==2) cout<<"[Error] TRGCDCJSignal::ifElse() => Cannot handle slv in assignments currently. Should be fixed later."<<endl;
823 if (rhs.m_argumentSignals.size() == 0) rhs.initArgumentSignals();
824 }
825 }
826
827 // Calculate final clock.
828 // Loop over all cases.
829 int t_maxClock = data[0].first.calFinishClock();
830 for (unsigned iCase = 0; iCase < data.size(); iCase++) {
831 int t_clock = data[iCase].first.calFinishClock();
832 if (t_maxClock < t_clock) t_maxClock = t_clock;
833 // Loop over all assignments.
834 for (unsigned iAssignment = 0; iAssignment < data[iCase].second.size(); iAssignment++) {
835 TRGCDCJSignal const& rhs = data[iCase].second[iAssignment].second;
836 t_clock = rhs.calFinishClock();
837 if (t_maxClock < t_clock) t_maxClock = t_clock;
838 }
839 }
840 int t_finishClock = 0;
841 if (targetClock == -3) {
842 if (t_maxClock < 0) cout << "[Error] TRGCDCJSignal::ifElse() => t_maxClock is negative. Did not consider this case." << endl;
843 t_finishClock = t_maxClock + 1;
844 } else {
845 if (targetClock < t_maxClock) cout << "[Error] TRGCDCJSignal::ifElse() => targetClock is too small." << endl;
846 else t_finishClock = targetClock;
847 }
848
849 // Change rhs, comp clock to finish clock.
850 for (unsigned iCase = 0; iCase < data.size(); iCase++) {
851 TRGCDCJSignal& comp = data[iCase].first;
852 comp.m_finishClock = t_finishClock;
853 for (unsigned iAssignment = 0; iAssignment < data[iCase].second.size(); iAssignment++) {
854 TRGCDCJSignal& rhs = data[iCase].second[iAssignment].second;
855 rhs.m_finishClock = t_finishClock;
856 }
857 }
858
859 // Find min and max ranges between all rhs.
860 // <minInt, maxInt, minActual, maxActual>
861 map<TRGCDCJSignal*, pair<vector<long long int>, vector<double> > > t_signalsRange;
862 for (unsigned iCase = 0; iCase < data.size(); iCase++) {
863 for (unsigned iAssignment = 0; iAssignment < data[iCase].second.size(); iAssignment++) {
864 TRGCDCJSignal& rhs = data[iCase].second[iAssignment].second;
865 TRGCDCJSignal& lhs = *(data[iCase].second[iAssignment].first);
866 if (t_signalsRange.find(&lhs) == t_signalsRange.end()) {
867 vector<long long int> t_intRange = {rhs.m_minInt, rhs.m_maxInt};
868 vector<double> t_actualRange = {rhs.m_minActual, rhs.m_maxActual};
869 t_signalsRange[&lhs] = make_pair(t_intRange, t_actualRange);
870 } else {
871 long long int& t_minInt = t_signalsRange[&lhs].first[0];
872 long long int& t_maxInt = t_signalsRange[&lhs].first[1];
873 double& t_minActual = t_signalsRange[&lhs].second[0];
874 double& t_maxActual = t_signalsRange[&lhs].second[1];
875 if (t_minInt > rhs.m_minInt) t_minInt = rhs.m_minInt;
876 if (t_maxInt < rhs.m_maxInt) t_maxInt = rhs.m_maxInt;
877 if (t_minActual > rhs.m_minActual) t_minActual = rhs.m_minActual;
878 if (t_maxActual < rhs.m_maxActual) t_maxActual = rhs.m_maxActual;
879 }
880 }
881 }
882 // Change min, max ranges and type, bitwidth for all rhs.
883 for (unsigned iCase = 0; iCase < data.size(); iCase++) {
884 for (unsigned iAssignment = 0; iAssignment < data[iCase].second.size(); iAssignment++) {
885 TRGCDCJSignal& rhs = data[iCase].second[iAssignment].second;
886 TRGCDCJSignal& lhs = *(data[iCase].second[iAssignment].first);
887 TRGCDCJSignal orgRhs(rhs);
888 long long int& t_minInt = t_signalsRange[&lhs].first[0];
889 long long int& t_maxInt = t_signalsRange[&lhs].first[1];
890 double& t_minActual = t_signalsRange[&lhs].second[0];
891 double& t_maxActual = t_signalsRange[&lhs].second[1];
892 rhs.m_minInt = t_minInt;
893 rhs.m_maxInt = t_maxInt;
894 rhs.m_minActual = t_minActual;
895 rhs.m_maxActual = t_maxActual;
896 rhs.m_type = rhs.calType();
897 rhs.m_bitsize = rhs.calBitwidth();
898 if (rhs.getPrintVhdl() == 1) vhdlCode("none", orgRhs, rhs, rhs.m_vhdlCode);
899 }
900 }
901
902 // For integer case.
903 for (unsigned iCase = 0; iCase < data.size(); iCase++) {
904 TRGCDCJSignal const& comp = data[iCase].first;
905 // If comp is 1 or else.
906 if (comp.m_int == 1 || comp.m_bitsize == -1) {
907 for (unsigned iAssignment = 0; iAssignment < data[iCase].second.size(); iAssignment++) {
908 TRGCDCJSignal& lhs = *(data[iCase].second[iAssignment].first);
909 TRGCDCJSignal& rhs = data[iCase].second[iAssignment].second;
910 string t_string = "";
911 lhs.assignTo(rhs, t_finishClock, t_string);
912 // Check ranges.
913 lhs.checkInt("TRGCDCJSignal::ifElse()");
914 }
915 break;
916 }
917 }
918
919 // For actual case.
920 for (unsigned iCase = 0; iCase < data.size(); iCase++) {
921 TRGCDCJSignal const& comp = data[iCase].first;
922 // If comp is 1 or else.
923 if (comp.m_actual == 1 || comp.m_bitsize == -1) {
924 for (unsigned iAssignment = 0; iAssignment < data[iCase].second.size(); iAssignment++) {
925 TRGCDCJSignal& lhs = *(data[iCase].second[iAssignment].first);
926 TRGCDCJSignal& rhs = data[iCase].second[iAssignment].second;
927 lhs.m_actual = rhs.m_actual;
928 }
929 break;
930 }
931 }
932
933 // Print vhdl code.
934 if (data[0].first.getPrintVhdl() == 1) {
935 // Set m_commonData for all lhs signals.
936 for (unsigned iCase = 0; iCase < data.size(); iCase++) {
937 for (unsigned iAssignment = 0; iAssignment < data[iCase].second.size(); iAssignment++) {
938 TRGCDCJSignal& lhs = *(data[iCase].second[iAssignment].first);
939 /* cppcheck-suppress variableScope */
940 TRGCDCJSignal& rhs = data[iCase].second[iAssignment].second;
941 if (lhs.m_commonData == 0) lhs.m_commonData = rhs.m_commonData;
942 }
943 }
944 string t_finalCode = ifElseVhdlCode(data);
945 data[0].first.m_commonData->m_vhdlInProcess += t_finalCode + "\n";
946 }
947
948
949 }
static std::string ifElseVhdlCode(std::vector< std::pair< TRGCDCJSignal, std::vector< std::pair< TRGCDCJSignal *, TRGCDCJSignal > > > > const &data)
Writes the ifElse vhdl code.
Definition: JSignal.cc:2115
static TRGCDCJSignal comp(TRGCDCJSignal const &lhs, const std::string &operate, TRGCDCJSignal const &rhs)
Compare two signals.
Definition: JSignal.cc:1169

◆ ifElseVhdlCode()

std::string ifElseVhdlCode ( std::vector< std::pair< TRGCDCJSignal, std::vector< std::pair< TRGCDCJSignal *, TRGCDCJSignal > > > > const &  data)
static

Writes the ifElse vhdl code.

Definition at line 2115 of file JSignal.cc.

2117 {
2118 // Check if comp and lhs have name
2119 for (unsigned iCase = 0; iCase < data.size(); iCase++) {
2120 TRGCDCJSignal const& comp = data[iCase].first;
2121 if (iCase != data.size() - 1) {
2122 if (comp.m_name == "") {
2123 cout << "[Error] TRGCDCJSignal::ifElseVhdlCode() => comp has no name." << endl;
2124 return "";
2125 }
2126 }
2127 for (unsigned iAssignment = 0; iAssignment < data[iCase].second.size(); iAssignment++) {
2128 TRGCDCJSignal const& lhs = *(data[iCase].second[iAssignment].first);
2129 if (lhs.m_name == "") {
2130 cout << "[Error] TRGCDCJSignal::ifElseVhdlCode() => lhs has no name." << endl;
2131 return "";
2132 }
2133 }
2134 }
2135
2136 // Write vhdl
2137 // Else will be last in data.
2138 stringstream t_vhdlCode;
2139 for (unsigned iCase = 0; iCase < data.size(); iCase++) {
2140 TRGCDCJSignal const& comp = data[iCase].first;
2143 // Choose which if to use.
2144 if (iCase == 0) t_vhdlCode << "if " << t_compVhdlCode << " then" << endl;
2145 else if (comp.m_bitsize == -1) t_vhdlCode << "else" << endl;
2146 else t_vhdlCode << "elsif " << t_compVhdlCode << " then" << endl;
2147 for (unsigned iAssignment = 0; iAssignment < data[iCase].second.size(); iAssignment++) {
2148 TRGCDCJSignal const& lhs = *(data[iCase].second[iAssignment].first);
2149 TRGCDCJSignal const& rhs = data[iCase].second[iAssignment].second;
2150 t_vhdlCode << " " << assignVhdlCode(lhs, rhs) << endl;
2151 }
2152 }
2153 t_vhdlCode << "end if;";
2154
2155 return t_vhdlCode.str();
2156
2157 }

◆ ignoreErrorMatrix()

void ignoreErrorMatrix ( void  )

unsets error matrix. Error calculations will be ignored after this function call until an error matrix be set again. 0 matrix will be return as a return value for error matrix when you call functions which returns an error matrix.

Definition at line 792 of file Helix.cc.

793 {
794 m_matrixValid = false;
795 m_Ea *= 0.;
796 }
bool m_matrixValid
matrix validity
Definition: Helix.h:206

◆ iMCParticle()

unsigned iMCParticle ( void  ) const
inline

returns an index to MCParticle.

Definition at line 374 of file CellHit.h.

375 {
376 return _iMCParticle;
377 }
unsigned _iMCParticle
Index to MCParticle array.
Definition: CellHit.h:202

◆ implementation() [1/2]

int implementation ( const boardType type,
std::ofstream &  outfile 
)
static

make a VHDL component file.

Non-zero value will be returned if errors occured.

Definition at line 65 of file FrontEnd.cc.

67 {
68
69 //string cname = "UNKNOWN";
70 // if (_type == innerInside) {
71 outfile << "-- inner type" << endl;
72 string cname = "TRGCDCFrontEndInnerInside";
73 // }
74 // else {
75 // outfile << "-- outer type" << endl;
76 // cname = "TRGCDCFrontEndOuter";
77 // }
78
79 outfile << "--" << endl;
80 outfile << endl;
81 outfile << " component " << cname << endl;
82 // int err = implementationPort(type, outfile);
83 outfile << " end component;" << endl;
84
85 outfile << "--------------------------------------------------------------"
86 << endl;
87
88 outfile << "entity " << cname << "is" << endl;
89 int err = implementationPort(type, outfile);
90 outfile << "end " << cname << ";" << endl;
91 outfile << endl;
92 outfile << "architecture Behavioral of " << cname << " is" << endl;
93 outfile << " -- local" << endl;
94 outfile << endl;
95 outfile << "begin" << endl;
96 outfile << "end Behavioral;" << endl;
97
98 return err;
99 }
static int implementationPort(const boardType &type, std::ofstream &)
writes a port map.
Definition: FrontEnd.cc:102

◆ implementation() [2/2]

int implementation ( const unitType type,
std::ofstream &  outfile 
)
static

make a VHDL component file.

Non-zero value will be returned if errors occured.

Definition at line 66 of file Merger.cc.

68 {
69
70 // string cname = "UNKNOWN";
71 // if (_type == innerType)
72 outfile << "-- inner type" << endl;
73 string cname = "TRGCDCMergerInner";
74 // }
75 // else {
76 // outfile << "-- outer type" << endl;
77 // cname = "TRGCDCMergerOuter";
78 // }
79
80 outfile << "--" << endl;
81 outfile << endl;
82 outfile << " component " << cname << endl;
83 // int err = implementationPort(type, outfile);
84 outfile << " end component;" << endl;
85
86 outfile << "--------------------------------------------------------------"
87 << endl;
88
89 outfile << "entity " << cname << "is" << endl;
90 int err = implementationPort(type, outfile);
91 outfile << "end " << cname << ";" << endl;
92 outfile << endl;
93 outfile << "architecture Behavioral of " << cname << " is" << endl;
94 outfile << " -- local" << endl;
95 outfile << endl;
96 outfile << "begin" << endl;
97 outfile << "end Behavioral;" << endl;
98
99 return err;
100 }
static int implementationPort(const unitType &type, std::ofstream &)
writes a port map.
Definition: Merger.cc:104

◆ implementationPort() [1/2]

int implementationPort ( const boardType type,
std::ofstream &  outfile 
)
static

writes a port map.

Definition at line 102 of file FrontEnd.cc.

104 {
105 outfile << " port (" << endl;
106
107 //...125MHz clock (TRG system clock)...
108 outfile << " -- 125MHz clock (TRG system clock)" << endl;
109 outfile << " clk : in std_logic;" << endl;
110
111 //...Coarse timing...
112 outfile << " -- Coarse timing (counter with 125MHz clock)" << endl;
113 outfile << " tmc : in std_logic_vector(0 to 12);" << endl;
114
115 //...Hit pattern...
116 outfile << " -- Hit pattern(48 bits for 48 wires)" << endl;
117 outfile << " ptn : in std_logic_vector(0 to 47);" << endl;
118
119 //...Fine timing for each wire...
120 outfile << " -- Fine timing within 125MHz clock" << endl;
121 for (unsigned i = 0; i < 48; i++) {
122 outfile << " w" << TRGUtil::itostring(i)
123 << " : in std_logic_vector(0 to 3);" << endl;
124 }
125
126 //...Hit pattern output...
127 outfile << " -- Hit pattern output" << endl;
128 outfile << " hit : out std_logic_vector(0 to 47);" << endl;
129 outfile << " -- 4 bit fine timing for 16 priority wires" << endl;
130 outfile << " pri : out std_logic_vector(0 to 63);" << endl;
131 outfile << " -- 2 bit fine timing for the fastest hit in 16 TS"
132 << endl;
133 outfile << " fst : out std_logic_vector(0 to 31)" << endl;
134 outfile << " );" << endl;
135
136 return 0;
137 }

◆ implementationPort() [2/2]

int implementationPort ( const unitType type,
std::ofstream &  outfile 
)
static

writes a port map.

Definition at line 104 of file Merger.cc.

106 {
107 outfile << " port (" << endl;
108
109 //...125MHz clock (TRG system clock)...
110 outfile << " -- 127.216MHz clock (TRG system clock)" << endl;
111 outfile << " clk : in std_logic;" << endl;
112
113 //...Coarse timing...
114 outfile << " -- Coarse timing (counter with 127.216MHz clock)" << endl;
115 outfile << " tmc : in std_logic_vector(0 to 7);" << endl;
116
117 //...Hit pattern...
118 outfile << " -- Hit pattern(80 bits for 80 wires)" << endl;
119 outfile << " ptn : in std_logic_vector(0 to 80);" << endl;
120
121 //...Fine timing for each wire...
122 /*
123 outfile << " -- Fine timing within 127.216MHz clock" << endl;
124 for (unsigned i = 0; i < 80; i++) {
125 outfile << " w" << TRGUtil::itostring(i)
126 << " : in std_logic_vector(0 to 3);" << endl;
127 }
128 */
129
130 //...Hit pattern output...
131 outfile << " -- Hit pattern output" << endl;
132 outfile << " hit : out std_logic_vector(0 to 80);" << endl;
133 outfile << " -- 4 bit fine timing for 16 priority wires" << endl;
134 outfile << " pri : out std_logic_vector(0 to 63);" << endl;
135 outfile << " -- 2 bit fine timing for the fastest hit in 16 TS" << endl;
136 outfile << " fst : out std_logic_vector(0 to 31)" << endl;
137 outfile << " );" << endl;
138
139 return 0;
140 }

◆ importBadRunNumber()

void importBadRunNumber ( std::string  InputFileName)

Import Bad Run Number.

Definition at line 293 of file TrgEclDatabaseImporter.cc.

294 {
295 std::ifstream stream;
296 stream.open(InputFileName.c_str());
297 if (!stream) {
298 B2ERROR("openFile: " << InputFileName << " *** failed to open");
299 return;
300 }
301
302 DBImportArray<TRGECLBadRun> badrun;
303
304 int BadRunNumber;
305 while (!stream.eof()) {
306
307 stream >> BadRunNumber ;
308 badrun.appendNew(BadRunNumber);
309 }
310 stream.close();
311 //Import to DB
312 IntervalOfValidity iov(startExp, startRun, endExp, endRun);
313
314 badrun.import(iov);
315
316 B2RESULT("BadRunList are imported to database.");
317
318 }
int startExp
Start Experiment Number.
int endExp
End Experiment Number.

◆ importETMParameter()

void importETMParameter ( std::string  InputFileName)

Import ETM Parameters.

Definition at line 199 of file TrgEclDatabaseImporter.cc.

200 {
201 std::ifstream stream;
202 stream.open(InputFileName.c_str());
203 if (!stream) {
204 B2ERROR("openFile: " << InputFileName << " *** failed to open");
205 return;
206 }
207
208 DBImportArray<TRGECLETMPara> etmpara;
209
210 int FPGAversion;
211 double ADCto100MeV;
212 int ELow;
213 int EHigh;
214 int ELum;
215 int FWD2DBhabha[14];
216 int BWD2DBhabha[14];
217 int Bhabha3DSelectionThreshold[2];
218 int Bhabha3DVetoThreshold[2];
219 int Bhabha3DSelectionAngle[4];
220 int Bhabha3DVetoAngle[4];
221 int mumuThreshold;
222 int mumuAngle[4];
223 int LowMultiThreshold[4];
224 int Prescalefactor[3];
225 int TriggerLatency;
226 int ETMDelay;
227 int n300MeVCluster;
228 int ECLBurstThreshold;
229
230 stream >> FPGAversion
231 >> ADCto100MeV
232 >> ELum
233 >> EHigh
234 >> ELow
235 >> FWD2DBhabha[0] >> BWD2DBhabha[0]
236 >> FWD2DBhabha[1] >> BWD2DBhabha[1]
237 >> FWD2DBhabha[2] >> BWD2DBhabha[2]
238 >> FWD2DBhabha[3] >> BWD2DBhabha[3]
239 >> FWD2DBhabha[4] >> BWD2DBhabha[4]
240 >> FWD2DBhabha[5] >> BWD2DBhabha[5]
241 >> FWD2DBhabha[6] >> BWD2DBhabha[6]
242 >> FWD2DBhabha[7] >> BWD2DBhabha[7]
243 >> FWD2DBhabha[8] >> BWD2DBhabha[8]
244 >> FWD2DBhabha[9] >> BWD2DBhabha[9]
245 >> FWD2DBhabha[10] >> BWD2DBhabha[10]
246 >> FWD2DBhabha[11] >> BWD2DBhabha[11]
247 >> FWD2DBhabha[12] >> BWD2DBhabha[12]
248 >> FWD2DBhabha[13] >> BWD2DBhabha[13]
249 >> Bhabha3DSelectionThreshold[0]
250 >> Bhabha3DSelectionThreshold[1]
251 >> Bhabha3DVetoThreshold[0]
252 >> Bhabha3DVetoThreshold[1]
253 >> Bhabha3DSelectionAngle[0]
254 >> Bhabha3DSelectionAngle[1]
255 >> Bhabha3DSelectionAngle[2]
256 >> Bhabha3DSelectionAngle[3]
257 >> Bhabha3DVetoAngle[0]
258 >> Bhabha3DVetoAngle[1]
259 >> Bhabha3DVetoAngle[2]
260 >> Bhabha3DVetoAngle[3]
261 >> mumuThreshold
262 >> mumuAngle[0]
263 >> mumuAngle[1]
264 >> mumuAngle[2]
265 >> mumuAngle[3]
266 >> LowMultiThreshold[0]
267 >> LowMultiThreshold[1]
268 >> LowMultiThreshold[2]
269 >> LowMultiThreshold[3]
270 >> Prescalefactor[0]
271 >> Prescalefactor[1]
272 >> Prescalefactor[2]
273 >> TriggerLatency
274 >> ETMDelay
275 >> n300MeVCluster
276 >> ECLBurstThreshold;
277
278
279 etmpara.appendNew(FPGAversion, ADCto100MeV, ELow, EHigh, ELum, FWD2DBhabha, BWD2DBhabha, Bhabha3DSelectionThreshold,
280 Bhabha3DVetoThreshold, Bhabha3DSelectionAngle, Bhabha3DVetoAngle, mumuThreshold, mumuAngle, LowMultiThreshold,
281 Prescalefactor, TriggerLatency, ETMDelay, n300MeVCluster, ECLBurstThreshold);
282
283 stream.close();
284 //Import to DB
285 IntervalOfValidity iov(startExp, startRun, endExp, endRun);
286
287 etmpara.import(iov);
288
289 B2RESULT("ETM Parameters are imported to database.");
290
291 }

◆ importFAMParameter()

void importFAMParameter ( std::string  InputFileName,
std::string  InputFileSignalPDF,
std::string  InputFileNoise 
)

Import FAM Parameters.

Definition at line 41 of file TrgEclDatabaseImporter.cc.

43 {
44 std::ifstream stream;
45 stream.open(InputFileName.c_str());
46 if (!stream) {
47 B2ERROR("openFile: " << InputFileName << " *** failed to open");
48 return;
49 }
50 std::ifstream stream1;
51 stream1.open(InputFileSignalPDF.c_str());
52 if (!stream1) {
53 B2ERROR("openFile: " << InputFileSignalPDF << " *** failed to open");
54 return;
55 }
56
57 std::ifstream stream2;
58 stream2.open(InputFileNoise.c_str());
59 if (!stream2) {
60 B2ERROR("openFile: " << InputFileNoise << " *** failed to open");
61 return;
62 }
63
64 TrgEclMapping* _map = new TrgEclMapping();
65
66
67 DBImportArray<TRGECLFAMPara> fampara;
68 // fampara.construct();
69
70 std::vector<int> FPGAversion;
71 std::vector<int> TCId;
72 std::vector<int> FAMId;
73 std::vector<int> ChannelId;
74 std::vector<int> TEreconstruction;
75 std::vector<int> Threshold;
76 std::vector<double> Conversionfactor;
77 std::vector<int> Toffset;
78 std::vector<int> Wavemean;
79 std::vector<int> Wavesigma;
80 FPGAversion.clear();
81 TCId.clear();
82 FAMId.clear();
83 ChannelId.clear();
84 TEreconstruction.clear();
85 Threshold.clear();
86 Conversionfactor.clear();
87 Toffset.clear();
88 Wavemean.clear();
89 Wavesigma.clear();
90
91 FPGAversion.resize(624, 0);
92 TCId.resize(624, 0);
93 FAMId.resize(624, 0);
94 ChannelId.resize(624, 0);
95 TEreconstruction.resize(624, 0);
96 Threshold.resize(624, 0);
97 Conversionfactor.resize(624, 0);
98 Toffset.resize(624, 0);
99
100 Wavemean.resize(624, 0);
101 Wavesigma.resize(624, 0);
102
103
104 std::vector<std::vector<double> > SignalPDF;
105 SignalPDF.clear();
106 std::vector<std::vector<double> > NoiseCovarianceMatrix;
107 NoiseCovarianceMatrix.clear();
108 SignalPDF.resize(624, std::vector<double>(8, 0));
109 NoiseCovarianceMatrix.resize(624, std::vector<double>(78, 0));
110
111 int Id = 0;
112 while (!stream.eof()) {
113 stream >> FAMId[Id] >> ChannelId[Id] >> FPGAversion [Id] >> TEreconstruction[Id] >> Threshold[Id] >> Conversionfactor[Id] >>
114 Toffset[Id] >> Wavemean[Id] >> Wavesigma[Id];
115 TCId[Id] = _map -> getTCIdFromFAMChannel(FAMId[Id], ChannelId[Id]);
116 Id++;
117 }
118 stream.close();
119 Id = 0;
120 int line = 0;
121
122 while (!stream1.eof()) {
123 stream1 >> SignalPDF[Id][line];
124 line++;
125 if (line == 8) {
126 line = 0;
127 Id++;
128 }
129
130 }
131 stream1.close();
132
133 Id = 0;
134 line = 0;
135 while (!stream2.eof()) {
136 stream2 >> NoiseCovarianceMatrix[Id][line];
137 line++;
138 if (line == 78) {
139 line = 0;
140 Id++;
141 }
142
143 }
144 stream2.close();
145
146
147 //Import to DB
148 for (int iTCId = 0; iTCId < 624; iTCId++) {
149 fampara.appendNew(FPGAversion[iTCId],
150 TCId[iTCId],
151 FAMId[iTCId],
152 ChannelId[iTCId],
153 TEreconstruction[iTCId],
154 Conversionfactor[iTCId],
155 Toffset[iTCId],
156 Threshold[iTCId],
157 Wavemean[iTCId],
158 Wavesigma[iTCId],
159 SignalPDF[iTCId],
160 NoiseCovarianceMatrix[iTCId]
161 );
162 }
163
164 IntervalOfValidity iov(startExp, startRun, endExp, endRun);
165
166 fampara.import(iov);
167
168 delete _map ;
169 B2RESULT("FAM parameters are imported to database.");
170
171 }

◆ importTMMParameter()

void importTMMParameter ( std::string  InputFileName)

Import TMM Parameters.

Definition at line 174 of file TrgEclDatabaseImporter.cc.

175 {
176 std::ifstream stream;
177 stream.open(InputFileName.c_str());
178 if (!stream) {
179 B2ERROR("openFile: " << InputFileName << " *** failed to open");
180 return;
181 }
182
183 DBImportArray<TRGECLTMMPara> tmmpara;
184
185 int FPGAversion;
186 stream >> FPGAversion ;
187 tmmpara.appendNew(FPGAversion);
188 stream.close();
189 //Import to DB
190 IntervalOfValidity iov(startExp, startRun, endExp, endRun);
191
192 tmmpara.import(iov);
193
194 B2RESULT("TMM parameters are imported to database.");
195
196 }

◆ inArea()

bool inArea ( const TRGPoint2D x) const
inline

returns true if give point is in the area.

Definition at line 50 of file Area2D.h.

51 {
52 if ((x.x() >= _c[0].x()) && (x.x() <= _c[1].x()))
53 if ((x.y() >= _c[0].y()) && (x.y() <= _c[1].y()))
54 return true;
55 return false;
56 }

◆ initArgumentSignals()

void initArgumentSignals ( )

Initializes the argument signals for the signal.

Definition at line 1707 of file JSignal.cc.

1708 {
1709 string t_name;
1710 if (m_argumentSignals.size() == 0) {
1711 if (m_minInt == m_maxInt && m_type != 2) {
1712 if (m_type == 1) {
1713 //t_name="to_unsigned("+to_string(m_int)+","+to_string(m_bitsize)+")";
1714 t_name = "decimal_string_to_unsigned(\"" + to_string(m_int) + "\"," + to_string(m_bitsize) + ")";
1715 } else {
1716 //t_name="to_signed("+to_string(m_int)+","+to_string(m_bitsize)+")";
1717 t_name = "decimal_string_to_signed(\"" + to_string(m_int) + "\"," + to_string(m_bitsize) + ")";
1718 }
1719 // For non-constant constructor signal.
1720 } else if (m_name == "") {
1721 t_name = "INPUT(" + to_string(m_int) + ")";
1722 // For normal signals.
1723 } else {
1724 t_name = m_name;
1725 }
1726 //m_argumentSignals.push_back(make_pair(t_name,m_finishClock));
1727 vector<int> t_argument = {m_type, m_bitsize, m_finishClock};
1728 m_argumentSignals.push_back(make_pair(t_name, t_argument));
1729 } else {
1730 cout << "[Error] TRGCDCJSignal::initArgumentSignals() => m_argumentSignals.size() is not 0." << endl;
1731 }
1732 }

◆ initialize() [1/6]

void initialize ( void  )

Initialization.

Definition at line 78 of file Fitter3D.cc.

79 {
80
81 StoreObjPtr<EventMetaData> evtMetaData;
82 evtMetaData.isRequired();
83
84 // If we are using Monte Carlo information.
85 m_mBool["fMc"] = 1;
86 m_mBool["fVerbose"] = 0;
87 m_mBool["fIsPrintError"] = 0;
88 m_mBool["fIsIntegerEffect"] = 1;
89 m_mBool["debugFitted"] = 1;
90 m_mBool["debugLargeZ0"] = 0;
91
92 // Init values
93 m_mConstD["Trg_PI"] = M_PI;
94
95 // Get rr,zToStraw,angleSt,nWire
96 const CDC::CDCGeometryPar& cdcp = CDC::CDCGeometryPar::Instance();
97 m_mConstV["rr"] = vector<double> (9);
98 m_mConstV["nWires"] = vector<double> (9);
99 m_mConstV["nTSs"] = vector<double> (9);
100 for (unsigned iSL = 0; iSL < 9; iSL++) {
101 unsigned t_layerId = m_cdc.segment(iSL, 0).center().layerId();
102 m_mConstV["rr"][iSL] = cdcp.senseWireR(t_layerId);
103 m_mConstV["nWires"][iSL] = cdcp.nWiresInLayer(t_layerId) * 2;
104 m_mConstV["nTSs"][iSL] = cdcp.nWiresInLayer(t_layerId);
105 }
106 m_mConstV["nTSs2D"] = vector<double> (5);
107 for (unsigned iAx = 0; iAx < 5; iAx++) {
108 m_mConstV["nTSs2D"][iAx] = m_mConstV["nTSs"][2 * iAx];
109 }
110
111 m_mConstV["zToStraw"] = vector<double> (4);
112 m_mConstV["zToOppositeStraw"] = vector<double> (4);
113 m_mConstV["angleSt"] = vector<double> (4);
114 m_mConstV["nShift"] = vector<double> (4);
115 for (int iSt = 0; iSt < 4; iSt++) {
116 unsigned t_layerId = m_cdc.stereoSegment(iSt, 0).center().layerId();
117 m_mConstV["zToStraw"][iSt] = cdcp.senseWireBZ(t_layerId);
118 m_mConstV["zToOppositeStraw"][iSt] = cdcp.senseWireFZ(t_layerId);
119 m_mConstV["angleSt"][iSt] = 2 * m_mConstV["rr"][2 * iSt + 1] * sin(m_mConstD["Trg_PI"] * cdcp.nShifts(t_layerId) /
120 (2 * cdcp.nWiresInLayer(t_layerId))) / (cdcp.senseWireFZ(t_layerId) - cdcp.senseWireBZ(t_layerId));
121 m_mConstV["nShift"][iSt] = cdcp.nShifts(t_layerId);
122 }
123
124 m_mConstV["rr2D"] = vector<double> (5);
125 m_mConstV["rr3D"] = vector<double> (4);
126 for (int iAx = 0; iAx < 5; iAx++) m_mConstV["rr2D"][iAx] = m_mConstV["rr"][iAx * 2];
127 for (int iSt = 0; iSt < 4; iSt++) m_mConstV["rr3D"][iSt] = m_mConstV["rr"][iSt * 2 + 1];
128
129 m_mConstV["wirePhi2DError"] = vector<double> (5);
130 m_mConstV["driftPhi2DError"] = vector<double> (5);
132 //m_mConstD["driftResolution"] = 2 * 40 * 0.0001; // (cm)
133 //m_mConstV["cellResolution"] = vector<double> (5);
134 //for(unsigned iAx=0; iAx<5; iAx++){
135 // m_mConstV["cellResolution"][iAx] = m_mConstV["rr2D"][iAx] * 2 * m_mConstD["Trg_PI"] / (m_mConstV["nWires"][iAx*2]/2); // (cm)
136 //}
137 //for(unsigned iAx=0; iAx<5; iAx++){
138 // m_mConstV["wirePhi2DError"][iAx] = m_mConstV["cellResolution"][iAx]/m_mConstV["rr2D"][iAx] / sqrt(12);
139 //}
140 //for(unsigned iAx=0; iAx<5; iAx++){
141 // m_mConstV["driftPhi2DError"][iAx] = m_mConstD["driftResolution"]/m_mConstV["rr2D"][iAx] / sqrt(12);
142 //}
143
144 m_mConstV["wirePhi2DError"][0] = 0.00085106;
145 m_mConstV["wirePhi2DError"][1] = 0.00039841;
146 m_mConstV["wirePhi2DError"][2] = 0.00025806;
147 m_mConstV["wirePhi2DError"][3] = 0.00019084;
148 m_mConstV["wirePhi2DError"][4] = 0.0001514;
149 m_mConstV["driftPhi2DError"][0] = 0.00085106;
150 m_mConstV["driftPhi2DError"][1] = 0.00039841;
151 m_mConstV["driftPhi2DError"][2] = 0.00025806;
152 m_mConstV["driftPhi2DError"][3] = 0.00019084;
153 m_mConstV["driftPhi2DError"][4] = 0.0001514;
154
155 // (2016.06.07) study
156 //m_mConstV["wireZError"] = vector<double> ({4.752, 6.393, 6.578, 6.418});
157 //m_mConstV["driftZError"] = vector<double> ({0.4701, 0.7203, 0.8058, 0.9382});
158 m_mConstV["driftZError"] = vector<double> ({0.7676, 0.9753, 1.029, 1.372});
159 m_mConstV["wireZError"] = vector<double> ({0.7676, 0.9753, 1.029, 1.372});
160
161 // Make driftLength table for each superlayer. Up to 511 clock ticks.
162 // driftLengthTableSLX[ tdcCount (~2ns unit) ] = drift length (cm)
163 for (unsigned iSl = 0; iSl < 9; iSl++) {
164 string tableName = "driftLengthTableSL" + to_string(iSl);
165 unsigned tableSize = 512;
166 m_mConstV[tableName] = vector<double> (tableSize);
167 unsigned t_layer = m_cdc.segment(iSl, 0).center().layerId();
168 for (unsigned iTick = 0; iTick < tableSize; iTick++) {
169 double t_driftTime = iTick * 2 * cdcp.getTdcBinWidth();
170 double avgDriftLength = 0;
171 if (m_mBool["fXtSimple"] == 1) {
172 avgDriftLength = cdcp.getNominalDriftV() * t_driftTime;
173 } else {
174 double driftLength_0 = cdcp.getDriftLength(t_driftTime, t_layer, 0);
175 double driftLength_1 = cdcp.getDriftLength(t_driftTime, t_layer, 1);
176 avgDriftLength = (driftLength_0 + driftLength_1) / 2;
177 }
178 m_mConstV[tableName][iTick] = avgDriftLength;
179 }
180 }
181
182 if (m_mBool["fVerbose"]) {
183 cout << "fLRLUT: " << m_mBool["fLRLUT"] << endl;
184 cout << "fMc: " << m_mBool["fMc"] << endl;
185 cout << "fVerbose: " << m_mBool["fVerbose"] << endl;
186 if (m_mBool["fMc"]) cout << "fmcLR: " << m_mBool["fmcLR"] << endl;
187 cout << "fRoot: " << m_mBool["fRootFile"] << endl;
188 cout << "PI: " << m_mConstD["Trg_PI"] << endl;
189 cout << "rr: " << m_mConstV["rr"][0] << " " << m_mConstV["rr"][1] << " " << m_mConstV["rr"][2] << " " <<
190 m_mConstV["rr"][3] << " " << m_mConstV["rr"][4] << " " << m_mConstV["rr"][5] << " " << m_mConstV["rr"][6] << " " <<
191 m_mConstV["rr"][7] << " " << m_mConstV["rr"][8] << endl;
192 cout << "nWires: " << int(m_mConstV["nWires"][0]) << " " << int(m_mConstV["nWires"][1]) << " " << int(
193 m_mConstV["nWires"][2]) << " " << int(m_mConstV["nWires"][3]) << " " << int(m_mConstV["nWires"][4]) << " " << int(
194 m_mConstV["nWires"][5]) << " " << int(m_mConstV["nWires"][6]) << " " << int(m_mConstV["nWires"][7]) << " " << int(
195 m_mConstV["nWires"][8]) << endl;
196 cout << "zToStraw: " << m_mConstV["zToStraw"][0] << " " << m_mConstV["zToStraw"][1] << " " << m_mConstV["zToStraw"][2] << " " <<
197 m_mConstV["zToStraw"][3] << endl;
198 cout << "angleSt: " << m_mConstV["angleSt"][0] << " " << m_mConstV["angleSt"][1] << " " << m_mConstV["angleSt"][2] << " " <<
199 m_mConstV["angleSt"][3] << endl;
200 cout << "wireZError: " << m_mConstV["wireZError"][0] << " " << m_mConstV["wireZError"][1] << " " << m_mConstV["wireZError"][2] <<
201 " " << m_mConstV["wireZError"][3] << endl;
202 cout << "driftZError: " << m_mConstV["driftZError"][0] << " " << m_mConstV["driftZError"][1] << " " << m_mConstV["driftZError"][2]
203 << " " << m_mConstV["driftZError"][3] << endl;
204 cout << "wirePhiError: " << m_mConstV["wirePhi2DError"][0] << " " << m_mConstV["wirePhi2DError"][1] << " " <<
205 m_mConstV["wirePhi2DError"][2] << " " << m_mConstV["wirePhi2DError"][3] << " " << m_mConstV["wirePhi2DError"][4] << endl;
206 cout << "driftPhiError: " << m_mConstV["driftPhi2DError"][0] << " " << m_mConstV["driftPhi2DError"][1] << " " <<
207 m_mConstV["driftPhi2DError"][2] << " " << m_mConstV["driftPhi2DError"][3] << " " << m_mConstV["driftPhi2DError"][4] << endl;
208 }
209
210
211 }
const TRGCDCSegment & stereoSegment(unsigned lyrId, unsigned id) const
returns a track segment in stereo layers. (lyrId is stereo #)
Definition: TRGCDC.h:947

◆ initialize() [2/6]

void initialize ( unsigned  houghFinderPeakMin,
const std::string &  houghMappingFilePlus,
const std::string &  houghMappingFileMinus,
unsigned  houghDoit 
)
private

initializes CDC geometry.

Definition at line 372 of file TRGCDC.cc.

376 {
377
378 TRGDebug::enterStage("TRGCDC initialize");
379
380 //...CDC...
382 const unsigned nLayers = m_cdcp->nWireLayers();
383
384 //...Loop over layers...
385 int superLayerId = -1;
386 vector<TRGCDCLayer*>* superLayer;
387 unsigned lastNWires = 0;
388 int lastShifts = -1000;
389 int ia = -1;
390 int is = -1;
391 int ias = -1;
392 int iss = -1;
393 unsigned nWires = 0;
394 float fwr = 0;
395 unsigned axialStereoSuperLayerId = 0;
396 for (unsigned i = 0; i < nLayers; i++) {
397 const unsigned nWiresInLayer = m_cdcp->nWiresInLayer(i);
398
399 //...Axial or stereo?...
400 int nShifts = m_cdcp->nShifts(i);
401 bool axial = true;
402 if (nShifts != 0)
403 axial = false;
404
405 unsigned axialStereoLayerId = 0;
406 if (axial) {
407 ++ia;
408 axialStereoLayerId = ia;
409 } else {
410 ++is;
411 axialStereoLayerId = is;
412 }
413
414 if (TRGDebug::level() > 1) {
415 cout << TRGDebug::tab() << "No " << i << " nWiresInLayer: "
416 << nWiresInLayer << " axial: " << axial << " nShifts: "
417 << nShifts << endl;
418 }
419
420 //...Is this in a new super layer?...
421 if ((lastNWires != nWiresInLayer) || (lastShifts != nShifts)) {
422 ++superLayerId;
423 superLayer = new vector<TRGCDCLayer*>;
424 _superLayers.push_back(superLayer);
425 if (axial) {
426 ++ias;
428 _axialSuperLayers.push_back(superLayer);
429 } else {
430 ++iss;
433 }
434 lastNWires = nWiresInLayer;
435 lastShifts = nShifts;
436 }
437
438 if (TRGDebug::level() > 1) {
439 cout << TRGDebug::tab() << "(lastNWires,nWiresInLayer) "
440 << lastNWires << " " << nWiresInLayer << endl;
441 cout << TRGDebug::tab() << "(lastShifts,nShifts) " << lastShifts
442 << " " << nShifts << endl;
443 cout << "superLayerId: " << superLayerId << endl;
444 cout << "ia: " << ia << " is: " << is << " ias: " << ias
445 << " iss: " << iss << endl;
446 }
447
448 //...Calculate radius...
449 const float swr = m_cdcp->senseWireR(i);
450 if (i < nLayers - 1)
451 fwr = m_cdcp->fieldWireR(i);
452 else
453 fwr = swr + (swr - m_cdcp->fieldWireR(i - 1));
454 const float innerRadius = swr - (fwr - swr);
455 const float outerRadius = swr + (fwr - swr);
456
457 if (TRGDebug::level() > 1)
458 cout << TRGDebug::tab() << "lyr " << i << ", in=" << innerRadius
459 << ", out=" << outerRadius << ", swr=" << swr << ", fwr"
460 << fwr << endl;
461
462 //...New layer...
463 TRGCDCLayer* layer = new TRGCDCLayer(i,
465 _superLayers[superLayerId]->size(),
466 axialStereoLayerId,
469 nShifts,
470 M_PI * m_cdcp->senseWireR(i)
471 * m_cdcp->senseWireR(i)
472 / double(nWiresInLayer),
473 nWiresInLayer,
474 innerRadius,
475 outerRadius);
476 _layers.push_back(layer);
477 superLayer->push_back(layer);
478 if (axial)
479 _axialLayers.push_back(layer);
480 else
481 _stereoLayers.push_back(layer);
482
483 //...Loop over all wires in a layer...
484 for (unsigned j = 0; j < nWiresInLayer; j++) {
485 const P3D fp = P3D(m_cdcp->wireForwardPosition(i, j).x(),
487 m_cdcp->wireForwardPosition(i, j).z());
488 const P3D bp = P3D(m_cdcp->wireBackwardPosition(i, j).x(),
490 m_cdcp->wireBackwardPosition(i, j).z());
491 TCWire* tw = new TCWire(nWires++, j, *layer, fp, bp, _clockFE);
492 if (_simulationMode & 1)
493 tw->_signal.clock(_clockTDC);
494 _wires.push_back(tw);
495 layer->push_back(tw);
496 }
497 }
498
499 //...event Time...
500 _eventTime.push_back(new TCEventTime(*this, _fileETF));
501 _eventTime.back()->initialize();
502
503 //...Make TSF's...
504 const unsigned nWiresInTS[2] = {15, 11};
505 const int shape[2][30] = {
506 {
507 -2, 0, // relative layer id, relative wire id
508 -1, -1, // assuming layer offset 0.0, not 0.5
509 -1, 0,
510 0, -1,
511 0, 0,
512 0, 1,
513 1, -2,
514 1, -1,
515 1, 0,
516 1, 1,
517 2, -2,
518 2, -1,
519 2, 0,
520 2, 1,
521 2, 2
522 //-2, 0, // relative layer id, relative wire id
523 //-1, 0, // assuming layer offset 0.5, not 0.0
524 //-1, 1,
525 //0, -1,
526 //0, 0,
527 //0, 1,
528 //1, -1,
529 //1, -0,
530 //1, 1,
531 //1, 2,
532 //2, -2,
533 //2, -1,
534 //2, 0,
535 //2, 1,
536 //2, 2
537 },
538 {
539 -2, -1,
540 -2, 0,
541 -2, 1,
542 -1, -1,
543 -1, 0,
544 0, 0,
545 1, -1,
546 1, 0,
547 2, -1,
548 2, 0,
549 2, 1,
550 0, 0,
551 0, 0,
552 0, 0,
553 0, 0
554 }
555 };
556 const int layerOffset[2] = {5, 2};
557 unsigned id = 0;
558 unsigned idTS = 0;
559 for (unsigned i = 0; i < nSuperLayers(); i++) {
560 unsigned tsType = 0;
561 if (i)
562 tsType = 1;
563
564// const unsigned nLayers = _superLayers[i]->size(); //'nLayers' shadows a previous local
565// if (nLayers < 5) {
566 if (_superLayers[i]->size() < 5) {
567 cout << "TRGCDC !!! can not create TS because "
568 << "#layers is less than 5 in super layer " << i
569 << endl;
570 continue;
571 }
572
573 //...TS layer... w is a central wire
574 const TCCell& ww = *(*_superLayers[i])[layerOffset[tsType]]->front();
575 TRGCDCLayer* layer = new TRGCDCLayer(id++, ww);
576 _tsLayers.push_back(layer);
577
578 //...Loop over all wires in a central wire layer...
579 const unsigned nWiresInLayer = ww.layer().nCells();
580 for (unsigned j = 0; j < nWiresInLayer; j++) {
581 const TCWire& w =
582 *(TCWire*)(*(*_superLayers[i])[layerOffset[tsType]])[j];
583
584 const unsigned localId = w.localId();
585 const unsigned layerId = w.layerId();
586 vector<const TCWire*> cells;
587
588 for (unsigned k = 0; k < nWiresInTS[tsType]; k++) {
589 const unsigned laid = layerId + shape[tsType][k * 2];
590 const unsigned loid = localId + shape[tsType][k * 2 + 1];
591
592 const TCWire* c = wire(laid, loid);
593 if (! c)
594 cout << "TRGCDC !!! no such a wire for TS : "
595 << "layer id=" << laid << ", local id=" << loid
596 << endl;
597
598 cells.push_back(c);
599 }
600
601 TRGCDCSegment* ts;
602 if (w.superLayerId()) {
603 ts = new TRGCDCSegment(idTS++,
604 *layer,
605 w,
606 _clockD,
608 cells);
609 } else {
610 ts = new TRGCDCSegment(idTS++,
611 *layer,
612 w,
613 _clockD,
615 cells);
616 }
617 ts->initialize();
618
619 //...Store it...
620 _tss.push_back(ts);
621 _tsSL[i].push_back(ts);
622 layer->push_back(ts);
623 }
624 }
625
626 //...Fill caches...
627 if (_width) delete [] _width;
628 if (_r) delete [] _r;
629 if (_r2) delete [] _r2;
630 _width = new float[nSuperLayers()];
631 _r = new float[nSuperLayers() + 1];
632 _r2 = new float[nSuperLayers() + 1];
633 for (unsigned i = 0; i < nSuperLayers(); i++) {
634 const vector<TRGCDCLayer*>& slayer = *_superLayers[i];
635 _width[i] = M_PI * 2 / float(slayer.back()->nCells());
636 _r[i] = slayer[0]->innerRadius();
637 _r2[i] = _r[i] * _r[i];
638 if (i == (nSuperLayers() - 1)) {
639 _r[i + 1] = slayer.back()->outerRadius();
640 _r2[i + 1] = _r[i + 1] * _r[i + 1];
641 }
642
643 if (TRGDebug::level() > 9) {
644 const TCCell& wi = *slayer[0]->front();
645 const unsigned layerId = wi.layerId();
646 cout << layerId << "," << m_cdcp->senseWireR(layerId) << ","
647 << m_cdcp->fieldWireR(layerId) << endl;
648 cout << " super layer " << i << " radius=" << _r[i]
649 << "(r^2=" << _r2[i] << ")" << endl;
650 }
651 }
652
653 //...Track Segment Finder...
654 _tsFinder = new TSFinder(*this, _fileTSF, _fLogicLUTTSF);
655
656 //...Perfect 2D Finder...
657 _pFinder = new TCPFinder("Perfect2DFinder", *this);
658
659 //...Perfect 3D Finder...
660 _p3DFinder = 0;
661
662 //...Hough 2D Finder...
663 _hFinder = new TCHFinder("HoughFinder",
664 *this,
665 houghFinderPeakMin,
666 houghMappingFilePlus,
667 houghMappingFileMinus,
668 houghDoit);
669
670 //...Hough 3D Finder...
671 _h3DFinder = new TCH3DFinder(*this, _fileHough3D, _finder3DMode);
672
673 //...3D fitter...
674 map<string, bool> flags = {
675 {"fLRLUT", _fLRLUT},
676 {"fmcLR", _fFitter3Dsmclr},
677 {"f2DFit", _fFitter3Ds2DFit},
678 {"f2DFitDrift", _fFitter3Ds2DFitDrift},
679 {"fRootFile", _fileFitter3D},
680 {"fXtSimple", _fXtSimpleFitter3D}
681 };
682 _fitter3D = new TCFitter3D("Fitter3D",
684 *this,
685 flags);
687
688 //...For module simulation (Front-end)...
689 configure();
690
691 //...Initialize root file...
692 if (_makeRootFile) {
693 m_file = new TFile((char*)_rootTRGCDCFilename.c_str(), "RECREATE");
694 //m_file = new TFile("TRGCDC.root", "RECREATE");
695 m_tree = new TTree("m_tree", "tree");
696 m_treeAllTracks = new TTree("m_treeAllTracks", "treeAllTracks");
697
698 m_fitParameters = new TClonesArray("TVectorD");
699 m_mcParameters = new TClonesArray("TVectorD");
700 m_mcTrack4Vector = new TClonesArray("TLorentzVector");
701 m_mcTrackVertexVector = new TClonesArray("TVector3");
702 m_mcTrackStatus = new TClonesArray("TVectorD");
703 // m_parameters2D = new TClonesArray("TVectorD");
704
705 m_tree->Branch("fitParameters", &m_fitParameters, 32000, 0);
706 m_tree->Branch("mcParameters", &m_mcParameters, 32000, 0);
707 m_treeAllTracks->Branch("mcTrack4Vector", &m_mcTrack4Vector, 32000, 0);
708 m_treeAllTracks->Branch("mcTrackVertexVector", &m_mcTrackVertexVector, 32000, 0);
709 m_treeAllTracks->Branch("mcTrackStatus", &m_mcTrackStatus, 32000, 0);
710
711 m_evtTime = new TClonesArray("TVectorD");
712 m_treeAllTracks->Branch("evtTime", &m_evtTime, 32000, 0);
713
714 _tree2D = new TTree("tree2D", "2D Tracks");
715 _tracks2D = new TClonesArray("TVectorD");
716 _tree2D->Branch("track parameters", & _tracks2D, 32000, 0);
717
718 //...Initialize firmware ROOT input
719 //m_minCDCTdc = 9999;
720 //m_maxCDCTdc = 0;
721 //m_minTRGTdc = 9999;
722 //m_maxTRGTdc = 0;
723
724 m_treeROOTInput = new TTree("m_treeROOTInput", "treeRootInput");
725 //m_CDCTRGTimeMatch = new TClonesArray("TVectorD");
726 m_rootCDCHitInformation = new TClonesArray("TVectorD");
727 m_rootTRGHitInformation = new TClonesArray("TVectorD");
728 m_rootTRGRawInformation = new TClonesArray("TObjString");
729 //m_treeROOTInput->Branch("CDCTRGTimeMatch", &m_CDCTRGTimeMatch,32000,0);
730 m_treeROOTInput->Branch("rootCDCHitInformation", &m_rootCDCHitInformation, 32000, 0);
731 m_treeROOTInput->Branch("rootTRGHitInformation", &m_rootTRGHitInformation, 32000, 0);
732 m_treeROOTInput->Branch("rootTRGRawInformation", &m_rootTRGRawInformation, 32000, 0);
733 }
734
735 TRGDebug::leaveStage("TRGCDC initialize");
736 }
DataType y() const
access variable Y (= .at(1) without boundary check)
Definition: B2Vector3.h:427
DataType z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:429
DataType x() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:425
int nShifts(int layerId) const
Returns number shift.
double fieldWireR(int layerId) const
Returns radius of field wire in each layer.
const B2Vector3D wireForwardPosition(uint layerId, int cellId, EWirePosition set=c_Base) const
Returns the forward position of the input sense wire.
const B2Vector3D wireBackwardPosition(uint layerId, int cellId, EWirePosition set=c_Base) const
Returns the backward position of the input sense wire.
unsigned nWiresInLayer(int layerId) const
Returns wire numbers in a layer.
unsigned nWireLayers() const
Returns a number of wire layers.
double senseWireR(int layerId) const
Returns radius of sense wire in each layer.
double zOffsetWireLayer(unsigned i) const
Returns the offset of z of the wire layer i.
TClonesArray * m_fitParameters
3D fit
Definition: TRGCDC.h:747
bool _fileFitter3D
Switch for Fitter3D.root file.
Definition: TRGCDC.h:602
float * _r
R of cell.
Definition: TRGCDC.h:668
bool _fFitter3Ds2DFitDrift
Switch to us wire 2D fit or drift 2D fit.
Definition: TRGCDC.h:578
bool _fFitter3Ds2DFit
Switch to us 2D fit or Hough finder results.
Definition: TRGCDC.h:575
unsigned _simulationMode
Simulation mode.
Definition: TRGCDC.h:502
TClonesArray * m_rootTRGRawInformation
[0]: iLayer, [1]: iWire, [2]: Timing(CDC), [3]: MatchNumber MatchNumber: 1: Only CDC,...
Definition: TRGCDC.h:788
TTree * m_tree
root tree for reconstructed 3D tracks
Definition: TRGCDC.h:738
TTree * m_treeAllTracks
root tree for MC tracks
Definition: TRGCDC.h:741
int _finder3DMode
Sets mode of 3DFinder.
Definition: TRGCDC.h:599
bool _fXtSimpleFitter3D
Switch for using simple x-t curve or non-linear x-t curve. 0: non-linear 1: simple.
Definition: TRGCDC.h:605
TClonesArray * m_mcParameters
MC.
Definition: TRGCDC.h:750
std::string _outerTSLUTFilename
The filename of LUT for outer track segments.
Definition: TRGCDC.h:557
std::string _innerTSLUTFilename
The filename of LUT for the inner-most track segments.
Definition: TRGCDC.h:554
bool _fLogicLUTTSF
Switch for logic or LUT TSF.
Definition: TRGCDC.h:566
TClonesArray * m_mcTrackVertexVector
MC vertex.
Definition: TRGCDC.h:756
bool _fileHough3D
Switch for Hough3D.root file.
Definition: TRGCDC.h:596
std::vector< TRGCDCLayer * > _stereoLayers
Stereo layers.
Definition: TRGCDC.h:623
bool _fileTSF
Switch for TSF.root file.
Definition: TRGCDC.h:584
bool _fileETF
Switch for ETF.root file.
Definition: TRGCDC.h:587
std::vector< std::vector< TRGCDCLayer * > * > _stereoSuperLayers
Stereo super layers.
Definition: TRGCDC.h:614
std::string _rootTRGCDCFilename
The filename of root file for TRGCDC.
Definition: TRGCDC.h:560
std::vector< TRGCDCLayer * > _tsLayers
Track Segment layers.
Definition: TRGCDC.h:653
TTree * m_treeROOTInput
Debugging members for firmware ROOT input.
Definition: TRGCDC.h:779
bool _makeRootFile
Switch for TRGCDC.root file.
Definition: TRGCDC.h:545
TClonesArray * m_mcTrack4Vector
MC track.
Definition: TRGCDC.h:753
TClonesArray * m_rootTRGHitInformation
[0]: iLayer, [1]: iWire, [2]: window number, [3]: priority timing
Definition: TRGCDC.h:783
TClonesArray * m_mcTrackStatus
MC track status.
Definition: TRGCDC.h:759
TClonesArray * m_evtTime
Event time.
Definition: TRGCDC.h:762
TFile * m_file
root file
Definition: TRGCDC.h:735
float * _r2
R^2 of cell.
Definition: TRGCDC.h:671
std::vector< std::vector< TRGCDCLayer * > * > _axialSuperLayers
Axial super layers.
Definition: TRGCDC.h:611
TClonesArray * _tracks2D
2D track information
Definition: TRGCDC.h:765
std::vector< TRGCDCLayer * > _axialLayers
Axial layers.
Definition: TRGCDC.h:620
TRGCDCPerfectFinder * _p3DFinder
Perfect 3D finder.
Definition: TRGCDC.h:717
CDC::CDCGeometryPar * m_cdcp
returns a pointer to CDCGeometryPar
Definition: TRGCDC.h:252
const TRGClock _clockFE
CDC front end clock. Resolution is CDC TdcBinWidth.
Definition: TRGCDC.h:677
std::string _rootFitter3DFilename
The filename of root file for Fitter3D.
Definition: TRGCDC.h:563
bool _fFitter3Dsmclr
Switch for MC L/R information in Fitter3D.
Definition: TRGCDC.h:572
bool _fLRLUT
Switch for the LR LUT in Fitter3D.
Definition: TRGCDC.h:569
TTree * _tree2D
root tree for 2D tracks
Definition: TRGCDC.h:744
const TRGClock _clockTDC
CDC trigger TDC clock.
Definition: TRGCDC.h:681
TClonesArray * m_rootCDCHitInformation
[0]: iLayer, [1]: iWire, [2]: CDCADC, [3]: CDCTDC, [4]: CDC FE TRG timing
Definition: TRGCDC.h:781
unsigned localId(unsigned wireId) const
returns local ID in a layer. This function is expensive.
Definition: TRGCDC.cc:1773
void configure(void)
configures trigger modules for firmware simulation.
Definition: TRGCDC.cc:2450
unsigned layerId(unsigned wireId) const
returns layer ID. This function is expensive.
Definition: TRGCDC.cc:1793
void initialize()
Initialization.
Definition: Fitter3D.cc:78
unsigned axialStereoSuperLayerId(unsigned axialStereo, unsigned axialStereoLayerId) const
returns axialStereo super layer ID. This function is expensive.
Definition: TRGCDC.cc:1865
const std::vector< TRGCDCLayer * > * superLayer(unsigned id) const
returns a pointer to a super-layer.
Definition: TRGCDC.h:835
const TRGCDCLayer * layer(unsigned id) const
returns a pointer to a layer. 0 will be returned if 'id' is invalid.
Definition: TRGCDC.h:828

◆ initialize() [3/6]

void initialize ( void  )

initialize the class

Definition at line 88 of file EventTime.cc.

89 {
90 m_minusET = 0;
91 m_noET = 0;
92 m_eventN = 0;
93 }

◆ initialize() [4/6]

void initialize ( void  )

initilize variables.

Definition at line 65 of file Segment.cc.

66 {
68 }
std::string m_TSLUTFileName
TS LUT file name.
Definition: Segment.h:188
TRGCDCLUT * m_TSLUT
LookUp Table. 0: no hit, 1: right, 2: left, 3: not determined.
Definition: Segment.h:164
static TRGCDCLUT * getLUT(const std::string &filename, int)
get LUT from dictionary, load new LUT if it doesn't exist
Definition: LUT.cc:83

◆ initialize() [5/6]

void initialize ( void  )
private

initializes GDL.

Definition at line 160 of file TRGGDL.cc.

161 {
162 if (_debugLevel > 19) {
163 for (int i = 0; i < m_InputBitsDB->getninbit(); i++) {
164 B2DEBUG(20, "TRGGDL::initialize, inputBits: " << i << ", " << m_InputBitsDB->getinbitname(i));
165 }
166 for (int i = 0; i < m_FTDLBitsDB->getnoutbit(); i++) {
167 B2DEBUG(20, "TRGGDL::initialize, outputBits: " << i << ", " << m_FTDLBitsDB->getoutbitname(i));
168 }
169 for (int i = 0; i < m_AlgsDB->getnalgs(); i++) {
170 B2DEBUG(20, "TRGGDL::initialize, algs: " << i << ", " << m_AlgsDB->getalg(i));
171 }
172 }
173 //if it is firmware simulation, do the cofigurnation
174 //fastsimulation doesn't use the configuration currently
175 if (_simulationMode == 2) configure();
176 }
unsigned _simulationMode
Simulation mode.
Definition: TRGGDL.h:218

◆ initialize() [6/6]

void initialize ( void  )
private

initializes GRL.

Definition at line 101 of file TRGGRL.cc.

102 {
103
104 m_file = new TFile("trggrl.root", "RECREATE");
105 h1 = new TTree("h1", "h1");
106
107 h1->Branch("3d", &x0, "3d");
108 h1->Branch("dr", &x1, "dr");
109 h1->Branch("dz", &x2, "dz");
110 h1->Branch("poe", &x3, "poe");
111 h1->Branch("z0", &x4, "z0");
112 h1->Branch("pt", &x5, "pt");
113 h1->Branch("pz", &x6, "pz");
114 h1->Branch("e", &x7, "e");
115
116 configure();
117 }
double x5
Temporary variables to make tree in root files.
Definition: TRGGRL.h:178
double x3
Temporary variables to make tree in root files.
Definition: TRGGRL.h:174
TFile * m_file
root file
Definition: TRGGRL.h:162
TTree * h1
root tree
Definition: TRGGRL.h:165
double x7
Temporary variables to make tree in root files.
Definition: TRGGRL.h:182
double x1
Temporary variables to make tree in root files.
Definition: TRGGRL.h:170
double x2
Temporary variables to make tree in root files.
Definition: TRGGRL.h:172
double x6
Temporary variables to make tree in root files.
Definition: TRGGRL.h:180
double x0
Temporary variables to make tree in root files.
Definition: TRGGRL.h:168
double x4
Temporary variables to make tree in root files.
Definition: TRGGRL.h:176

◆ initializeBuffers()

void initializeBuffers ( void  )
static

initialize the Buffers

Definition at line 804 of file Link.cc.

805 {
806 static bool first = true;
807 if (first) {
809 _nL = cdc.nLayers();
810 _nSL = cdc.nSuperLayers();
811 _nSLA = cdc.nAxialSuperLayers();
812 _nHitsSL = new unsigned[_nSL];
813 first = false;
814 }
815 }
The instance of TRGCDC is a singleton.
Definition: TRGCDC.h:69
static unsigned _nL
...Buffers...
Definition: Link.h:398
static unsigned _nSLA
...Buffers...
Definition: Link.h:402

◆ initVhdlCode()

void initVhdlCode ( )

Initializes the vhdl code.

Definition at line 1741 of file JSignal.cc.

1742 {
1743 if (m_vhdlCode != "") {
1744 cout << "[Error] TRGCDCJSignal::initVhdlCode() => m_vhdlCode is not \"\"." << endl;
1745 } else {
1746 m_vhdlCode = " ";
1747 }
1748 }

◆ innerMost()

TRGCDCLink * innerMost ( const std::vector< TRGCDCLink * > &  links)
static

returns the inner-most link.

Definition at line 409 of file Link.cc.

410 {
411 unsigned n = a.size();
412 unsigned minId = 19999;
413 TRGCDCLink* t = 0;
414 for (unsigned i = 0; i < n; i++) {
415 unsigned id = a[i]->cell()->id();
416 if (id < minId) {
417 minId = id;
418 t = a[i];
419 }
420 }
421 return t;
422 }

◆ innerPart()

bool innerPart ( void  ) const
inline

returns true if this wire is in the inner part.

Definition at line 284 of file Cell.h.

285 {
286 std::cout << "TRGCDCCell::innerPart ... position not defined" << std::endl;
287 if (layerId() < 14) return true;
288 return false;
289 }

◆ innerRadius()

float innerRadius ( void  ) const
inline

sets and returns inner radius.

Definition at line 250 of file Layer.h.

251 {
252 return _innerRadius;
253 }
float _innerRadius
Inner radius.
Definition: Layer.h:146

◆ inOut()

vector< TRGCDCLink * > inOut ( const std::vector< TRGCDCLink * > &  list)
static

returns links which are in the inner most and outer most layer.

This function assumes that all TRGCDCLink's are in the same super layer.

Definition at line 621 of file Link.cc.

622 {
623 vector<TRGCDCLink*> inners;
624 vector<TRGCDCLink*> outers;
625 unsigned n = list.size();
626 unsigned innerMostLayer = 999;
627 unsigned outerMostLayer = 0;
628 for (unsigned i = 0; i < n; i++) {
629 unsigned id = list[i]->cell()->layerId();
630 if (id < innerMostLayer) innerMostLayer = id;
631 else if (id > outerMostLayer) outerMostLayer = id;
632 }
633 for (unsigned i = 0; i < n; i++) {
634 unsigned id = list[i]->cell()->layerId();
635 if (id == innerMostLayer) inners.push_back(list[i]);
636 else if (id == outerMostLayer) outers.push_back(list[i]);
637 }
638// inners.push_back(outers);
639 inners.insert(inners.end(), outers.begin(), outers.end());
640 return inners;
641 }

◆ input()

const TRGChannel * input ( unsigned  i) const
inline

returns input channel i.

Definition at line 158 of file Board.h.

159 {
160 return _inputChannels[a];
161 }

◆ inputInner()

void inputInner ( const unsigned  id,
const unsigned  nTSF,
TRGSignalVector s 
)

Creates input signals to TSF for the inner.

Definition at line 2215 of file TrackSegmentFinder.cc.

2218 {
2219 s->push_back(* _secMap[t]);
2220
2221 if (t == 0) {
2222 s->push_back(* (_hitMap[0][0]));
2223 s->push_back(* (_hitMap[1][nTSF - 1]));
2224 s->push_back(* (_hitMap[1][0]));
2225 s->push_back(* (_hitMap[2][nTSF - 1]));
2226 s->push_back(* (_hitMap[2][0]));
2227 s->push_back(* (_hitMap[2][1]));
2228 s->push_back(* (_hitMap[3][nTSF - 2]));
2229 s->push_back(* (_hitMap[3][nTSF - 1]));
2230 s->push_back(* (_hitMap[3][0]));
2231 s->push_back(* (_hitMap[3][1]));
2232 s->push_back(* (_hitMap[4][nTSF - 2]));
2233 s->push_back(* (_hitMap[4][nTSF - 1]));
2234 s->push_back(* (_hitMap[4][0]));
2235 s->push_back(* (_hitMap[4][1]));
2236 s->push_back(* (_hitMap[4][2]));
2237 } else if (t == 1) {
2238 s->push_back(* (_hitMap[0][1]));
2239 s->push_back(* (_hitMap[1][0]));
2240 s->push_back(* (_hitMap[1][1]));
2241 s->push_back(* (_hitMap[2][0]));
2242 s->push_back(* (_hitMap[2][1]));
2243 s->push_back(* (_hitMap[2][2]));
2244 s->push_back(* (_hitMap[3][nTSF - 1]));
2245 s->push_back(* (_hitMap[3][0]));
2246 s->push_back(* (_hitMap[3][1]));
2247 s->push_back(* (_hitMap[3][2]));
2248 s->push_back(* (_hitMap[4][nTSF - 1]));
2249 s->push_back(* (_hitMap[4][0]));
2250 s->push_back(* (_hitMap[4][1]));
2251 s->push_back(* (_hitMap[4][2]));
2252 s->push_back(* (_hitMap[4][3]));
2253 } else if (t == (nTSF - 2)) {
2254 s->push_back(* (_hitMap[0][t]));
2255 s->push_back(* (_hitMap[1][t - 11]));
2256 s->push_back(* (_hitMap[1][t]));
2257 s->push_back(* (_hitMap[2][t - 1]));
2258 s->push_back(* (_hitMap[2][t]));
2259 s->push_back(* (_hitMap[2][0]));
2260 s->push_back(* (_hitMap[3][t - 2]));
2261 s->push_back(* (_hitMap[3][t - 1]));
2262 s->push_back(* (_hitMap[3][t]));
2263 s->push_back(* (_hitMap[3][0]));
2264 s->push_back(* (_hitMap[4][t - 2]));
2265 s->push_back(* (_hitMap[4][t - 1]));
2266 s->push_back(* (_hitMap[4][t]));
2267 s->push_back(* (_hitMap[4][t + 1]));
2268 s->push_back(* (_hitMap[4][0]));
2269 } else if (t == (nTSF - 1)) {
2270 s->push_back(* (_hitMap[0][t]));
2271 s->push_back(* (_hitMap[1][t - 11]));
2272 s->push_back(* (_hitMap[1][t]));
2273 s->push_back(* (_hitMap[2][t - 1]));
2274 s->push_back(* (_hitMap[2][t]));
2275 s->push_back(* (_hitMap[2][0]));
2276 s->push_back(* (_hitMap[3][t - 2]));
2277 s->push_back(* (_hitMap[3][t - 1]));
2278 s->push_back(* (_hitMap[3][t]));
2279 s->push_back(* (_hitMap[3][0]));
2280 s->push_back(* (_hitMap[4][t - 2]));
2281 s->push_back(* (_hitMap[4][t - 1]));
2282 s->push_back(* (_hitMap[4][t]));
2283 s->push_back(* (_hitMap[4][0]));
2284 s->push_back(* (_hitMap[4][1]));
2285 } else {
2286 // _hitMap[1][t - 1]->dump("", "??? " + TRGUtilities::itostring(1) + "-" + TRGUtilities::itostring(t - 1));
2287
2288 TRGSignal& ts = * _hitMap[1][t - 1];
2289
2290 s->push_back(* (_hitMap[0][t]));
2291 // s->push_back(* (_hitMap[1][t - 11])); // Why this makes SegV?
2292 s->push_back(ts);
2293 s->push_back(* (_hitMap[1][t]));
2294 s->push_back(* (_hitMap[2][t - 1]));
2295 s->push_back(* (_hitMap[2][t]));
2296 s->push_back(* (_hitMap[2][0]));
2297 s->push_back(* (_hitMap[3][t - 2]));
2298 s->push_back(* (_hitMap[3][t - 1]));
2299 s->push_back(* (_hitMap[3][t]));
2300 s->push_back(* (_hitMap[3][0]));
2301 s->push_back(* (_hitMap[4][t - 2]));
2302 s->push_back(* (_hitMap[4][t - 1]));
2303 s->push_back(* (_hitMap[4][t]));
2304 s->push_back(* (_hitMap[4][t + 1]));
2305 s->push_back(* (_hitMap[4][t + 2]));
2306 }
2307
2308 //...Priority timing...
2309// s->push_back(* _priMap[t * 4 + 0]);
2310// s->push_back(* _priMap[t * 4 + 1]);
2311// s->push_back(* _priMap[t * 4 + 2]);
2312// s->push_back(* _priMap[t * 4 + 3]);
2313
2314 //...Priority timing...
2315 priorityTiming(t, nTSF, * s, (* s)[1], (* s)[2], (* s)[3]);
2316
2317 //...Fastest timing...
2318 fastestTimingInner(t, nTSF, * s);
2319
2320 //...Clock counter is omitted...
2321 }
void priorityTiming(unsigned tsfID, const unsigned nTSF, TRGSignalVector &s, const TRGSignal &center, const TRGSignal &right, const TRGSignal &left) const
Make TRGSignals for the priority timing bits.
void fastestTimingInner(unsigned tsfID, const unsigned nTSF, TRGSignalVector &s) const
Make TRGSignals for the fastest timing bits.

◆ inputOuter()

void inputOuter ( const unsigned  id,
const unsigned  nTSF,
TRGSignalVector s 
)

Creates input signals to TSF for the outer.

Definition at line 2324 of file TrackSegmentFinder.cc.

2327 {
2328 s->push_back(* _secMap[t]);
2329
2330 if (t == 0) {
2331 s->push_back(* (_hitMap[0][nTSF - 1]));
2332 s->push_back(* (_hitMap[0][0]));
2333 s->push_back(* (_hitMap[0][1]));
2334 s->push_back(* (_hitMap[1][nTSF - 1]));
2335 s->push_back(* (_hitMap[1][0]));
2336 s->push_back(* (_hitMap[2][0]));
2337 s->push_back(* (_hitMap[3][nTSF - 1]));
2338 s->push_back(* (_hitMap[3][0]));
2339 s->push_back(* (_hitMap[4][nTSF - 1]));
2340 s->push_back(* (_hitMap[4][0]));
2341 s->push_back(* (_hitMap[4][1]));
2342 } else if (t == (nTSF - 1)) {
2343 s->push_back(* (_hitMap[0][nTSF - 2]));
2344 s->push_back(* (_hitMap[0][nTSF - 1]));
2345 s->push_back(* (_hitMap[0][0]));
2346 s->push_back(* (_hitMap[1][nTSF - 2]));
2347 s->push_back(* (_hitMap[1][nTSF - 1]));
2348 s->push_back(* (_hitMap[2][nTSF - 1]));
2349 s->push_back(* (_hitMap[3][nTSF - 2]));
2350 s->push_back(* (_hitMap[3][nTSF - 1]));
2351
2352 s->push_back(* (_hitMap[4][nTSF - 2]));
2353 s->push_back(* (_hitMap[4][nTSF - 1]));
2354 s->push_back(* (_hitMap[4][0]));
2355 } else {
2356 s->push_back(* (_hitMap[0][t - 1]));
2357 s->push_back(* (_hitMap[0][t]));
2358 s->push_back(* (_hitMap[0][t + 1]));
2359 s->push_back(* (_hitMap[1][t - 1]));
2360 s->push_back(* (_hitMap[1][t]));
2361 s->push_back(* (_hitMap[2][t]));
2362 s->push_back(* (_hitMap[3][t - 1]));
2363 s->push_back(* (_hitMap[3][t]));
2364 s->push_back(* (_hitMap[4][t - 1]));
2365 s->push_back(* (_hitMap[4][t]));
2366 s->push_back(* (_hitMap[4][t + 1]));
2367 }
2368
2369 //...Priority timing...
2370// s->push_back(* _priMap[t * 4 + 0]);
2371// s->push_back(* _priMap[t * 4 + 1]);
2372// s->push_back(* _priMap[t * 4 + 2]);
2373// s->push_back(* _priMap[t * 4 + 3]);
2374
2375 //...Priority timing...
2376 priorityTiming(t, nTSF, * s, (* s)[6], (* s)[7], (* s)[8]);
2377
2378 //...Fastest timing...
2379 fastestTimingOuter(t, nTSF, * s);
2380
2381 //...Clock counter is omitted...
2382 }
void fastestTimingOuter(unsigned tsfID, const unsigned nTSF, TRGSignalVector &s) const
Make TRGSignals for the fastest timing bits.

◆ intersect()

int intersect ( const TRGCDCLpar lp1,
const TRGCDCLpar lp2,
CLHEP::HepVector &  v1,
CLHEP::HepVector &  v2 
)

intersection

Definition at line 249 of file Lpar.cc.

250 {
251 CLHEP::HepVector cen1(lp1.center());
252 CLHEP::HepVector cen2(lp2.center());
253 double dx = cen1(1) - cen2(1);
254 double dy = cen1(2) - cen2(2);
255 double dc = sqrt(dx * dx + dy * dy);
256 if (dc < fabs(0.5 / lp1.kappa()) + fabs(0.5 / lp2.kappa())) {
257 double a1 = sqr(lp1.alpha()) + sqr(lp1.beta());
258 double a2 = sqr(lp2.alpha()) + sqr(lp2.beta());
259 double a3 = lp1.alpha() * lp2.alpha() + lp1.beta() * lp2.beta();
260 double det = lp1.alpha() * lp2.beta() - lp1.beta() * lp2.alpha();
261 if (fabs(det) > 1e-12) {
262 double c1 = a2 * sqr(lp1.kappa()) + a1 * sqr(lp2.kappa()) -
263 2.0 * a3 * lp1.kappa() * lp2.kappa();
264 if (c1 != 0) {
265 double cinv = 1.0 / c1;
266 double c2 = sqr(a3) - 0.5 * (a1 + a2) - 2.0 * a3 *
267 (lp1.gamma() * lp2.kappa() + lp2.gamma() * lp1.kappa());
268 double c3 = a2 * sqr(lp1.gamma()) + a1 * sqr(lp2.gamma()) -
269 2.0 * a3 * lp1.gamma() * lp2.gamma();
270 double root = sqr(c2) - 4.0 * c1 * c3;
271 if (root >= 0) {
272 root = sqrt(root);
273 double rad2[2];
274 rad2[0] = 0.5 * cinv * (-c2 - root);
275 rad2[1] = 0.5 * cinv * (-c2 + root);
276 double ab1 = -(lp2.beta() * lp1.gamma() - lp1.beta() * lp2.gamma());
277 double ab2 = (lp2.alpha() * lp1.gamma() - lp1.alpha() * lp2.gamma());
278 double ac1 = -(lp2.beta() * lp1.kappa() - lp1.beta() * lp2.kappa());
279 double ac2 = (lp2.alpha() * lp1.kappa() - lp1.alpha() * lp2.kappa());
280 double dinv = 1.0 / det;
281 v1(1) = dinv * (ab1 + ac1 * rad2[0]);
282 v1(2) = dinv * (ab2 + ac2 * rad2[0]);
283 v1(3) = 0;
284 v2(1) = dinv * (ab1 + ac1 * rad2[1]);
285 v2(2) = dinv * (ab2 + ac2 * rad2[1]);
286 v2(3) = 0;
287//cnv double d1 = lp1.d(v1(1),v1(2));
288//cnv double d2 = lp2.d(v1(1),v1(2));
289//cnv double d3 = lp1.d(v2(1),v2(2));
290//cnv double d4 = lp2.d(v2(1),v2(2));
291//cnv double r = sqrt(rad2[0]);
292 TRGCDCLpar::Cpar cp1(lp1);
293 TRGCDCLpar::Cpar cp2(lp2);
294// for(int j=0;j<2;j++) {
295//jb double s1,s2;
296//jb if(j==0) {
297//jb s1 = lp1.s(v1(1),v1(2));
298//jb s2 = lp2.s(v1(1),v1(2));
299//jb } else {
300//jb s1 = lp1.s(v2(1),v2(2));
301//jb s2 = lp2.s(v2(1),v2(2));
302//jb }
303//cnv double phi1 = cp1.fi() + 2 * cp1.cu() * s1;
304//cnv double phi2 = cp2.fi() + 2 * cp2.cu() * s2;
305// double f = (1 + 2 * cp1.cu() * cp1.da()) *
306// (1 + 2 * cp2.cu() * cp2.da()) * cos(cp1.fi()-cp2.fi());
307// f -= 2 * (lp1.gamma() * lp2.kappa() + lp2.gamma() * lp1.kappa());
308//cnv double cosphi12 = f;
309// }
310 return 2;
311 }
312 }
313 }
314 }
315 return 0;
316 }
const std::vector< double > v2
MATLAB generated random vector.
const std::vector< double > v1
MATLAB generated random vector.

◆ invert()

const TRGSignal & invert ( void  )

makes signal inverted.

Definition at line 499 of file Signal.cc.

500 {
501 if (_history.size()) {
502 for (unsigned i = 0; i < _history.size(); i++)
503 _history[i].reverse();
504 if (_history[0].time() > _clock->min()) {
505 TRGTime t0(_clock->min(), true, * _clock);
506 _history.insert(_history.begin(), t0);
507 } else {
508 _history.erase(_history.begin());
509 }
510 if (_history.back().time() < _clock->max()) {
511 TRGTime t0(_clock->max(), false, * _clock);
512 _history.push_back(t0);
513 } else {
514 _history.erase(_history.end());
515 }
516 } else {
517 TRGTime time0(_clock->min(), true, * _clock);
518 TRGTime time1(_clock->max(), false, * _clock);
519 _history.push_back(time0);
520 _history.push_back(time1);
521 }
522
523#if TRG_DEBUG
525#endif
526
527 return * this;
528 }
int min(void) const
returns min. clock point.
Definition: Clock.h:194

◆ invOffset()

TRGCDCJSignal const invOffset ( TRGCDCJSignal const &  valueMin) const

Outputs a signal that is not offset.

Definition at line 606 of file JSignal.cc.

607 {
608 TRGCDCJSignal t_result = *this + valueMin;
609 // Set bitsize and type.
610 t_result.m_type = t_result.calType();
611 t_result.m_bitsize = t_result.calBitwidth();
612
613 // Check if there is overflow or underflow
614 t_result.checkInt("TRGCDCJSignal::invOffset()");
615 // Reset vhdlCode.
616 if (getPrintVhdl() == 1) vhdlCode(*this, "+", valueMin, t_result, t_result.m_vhdlCode);
617 return t_result;
618 }

◆ isAxialTrackFull()

bool isAxialTrackFull ( const TRGCDCTrack aTrack)

Checks if axial track has 5 TSs. One per each superlayer.

Definition at line 1071 of file Fitter3D.cc.

1072 {
1073 bool trackFull = 1;
1074 for (unsigned iAx = 0; iAx < 5; iAx++) {
1075 // Check if all superlayers have one TS
1076 const vector<TCLink*>& links = aTrack.links(iAx * 2);
1077 const unsigned nSegments = links.size();
1078 // Find if there is a TS with a priority hit.
1079 // Loop over all TS in same superlayer.
1080 bool priorityHitTS = 0;
1081 for (unsigned iTS = 0; iTS < nSegments; iTS++) {
1082 const TCSegment* t_segment = dynamic_cast<const TCSegment*>(& links[iTS]->hit()->cell());
1083 if (t_segment->center().hit() != 0) priorityHitTS = 1;
1084 }
1085 if (nSegments != 1) {
1086 if (nSegments == 0) {
1087 trackFull = 0;
1088 if (m_mBool["fIsPrintError"]) cout << "Fitter3D::isAxialTrackFull() => There are no TS." << endl;
1089 } else {
1090 if (m_mBool["fIsPrintError"]) cout << "Fitter3D::isAxialTrackFull() => multiple TS are assigned." << endl;
1091 }
1092 } else {
1093 if (priorityHitTS == 0) {
1094 trackFull = 0;
1095 if (m_mBool["fIsPrintError"]) cout << "Fitter3D::isAxialTrackFull() => There are no priority hit TS" << endl;
1096 }
1097 }
1098 } // End superlayer loop
1099 return trackFull;
1100 }

◆ isFiredFTDL()

bool isFiredFTDL ( std::vector< bool >  input,
std::string  alg 
)

Definition at line 465 of file TRGGDL.cc.

466 {
467 if (alg.length() == 0) return true;
468 const char* cst = alg.c_str();
469 bool reading_word = false;
470 bool result_the_term = true; // init value must be true
471 bool not_flag = false;
472 unsigned begin_word = 0;
473 unsigned word_length = 0;
474 // notation steeing side must follow
475 // no blank between '!' and word
476 for (unsigned i = 0; i < alg.length(); i++) {
477 if (('0' <= cst[i] && cst[i] <= '9') ||
478 ('_' == cst[i]) || ('!' == cst[i])) {
479 if (reading_word) { // must not be '!'
480 word_length++;
481 if (i == alg.length() - 1) {
482 bool fired = input[atoi(alg.substr(begin_word, word_length).c_str())];
483 B2DEBUG(20,
484 alg.substr(begin_word, word_length).c_str()
485 << "(" << fired << ")");
486 if (((!not_flag && fired) || (not_flag && !fired)) && result_the_term) {
487 return true;
488 }
489 }
490 } else {
491 // start of new word
492 reading_word = true;
493 if ('!' == cst[i]) {
494 begin_word = i + 1;
495 not_flag = true;
496 word_length = 0;
497 } else {
498 begin_word = i;
499 not_flag = false;
500 word_length = 1;
501 if (i == alg.length() - 1) {
502 // one char bit ('f',...) comes end of conditions, 'xxx+f'
503 bool fired = input[atoi(alg.substr(begin_word, word_length).c_str())];
504 B2DEBUG(20,
505 alg.substr(begin_word, word_length).c_str()
506 << "(" << fired << ")");
507 // cppcheck-suppress knownConditionTrueFalse
508 if (((!not_flag && fired) || (not_flag && !fired)) && result_the_term) {
509 return true;
510 }
511 }
512 }
513 }
514 } else if ('+' == cst[i] || i == alg.length() - 1) {
515 // End of the term.
516 if (reading_word) { // 'xxx+'
517 if (result_the_term) {
518 bool fired = input[atoi(alg.substr(begin_word, word_length).c_str())];
519 B2DEBUG(20,
520 alg.substr(begin_word, word_length).c_str()
521 << "(" << fired << ")");
522 if ((!not_flag && fired) || (not_flag && !fired)) {
523 return true;
524 } else {
525 // this term is denied by the latest bit
526 }
527 } else {
528 // already false.
529 }
530 reading_word = false;
531 } else {
532 // prior char is blank, 'xxx +'
533 if (result_the_term) {
534 return true;
535 } else {
536 // already false
537 }
538 }
539 result_the_term = true; // go to next term
540 } else {
541 // can be blank (white space) or any delimiter.
542 if (reading_word) {
543 // end of a word, 'xxxx '
544 if (result_the_term) {
545 // worth to try
546 bool fired = input[atoi(alg.substr(begin_word, word_length).c_str())];
547 B2DEBUG(20,
548 alg.substr(begin_word, word_length).c_str()
549 << "(" << fired << ")");
550 if ((!not_flag && fired) || (not_flag && !fired)) {
551 // go to next word
552 } else {
553 result_the_term = false;
554 }
555 } else {
556 // already false
557 }
558 reading_word = false;
559 } else {
560 // 2nd blank 'xx ' or leading blanck '^ '
561 }
562 }
563 }
564 return false;
565 }

◆ isSameSignal()

bool isSameSignal ( TRGCDCJSignal const &  lhs,
TRGCDCJSignal const &  rhs 
)
static

Checks if signal is same signal.

Definition at line 2201 of file JSignal.cc.

2202 {
2203 return lhs.m_int == rhs.m_int && lhs.m_minInt == rhs.m_minInt && lhs.m_maxInt == rhs.m_maxInt
2204 && lhs.m_toReal == rhs.m_toReal && lhs.m_actual == rhs.m_actual && lhs.m_minActual == rhs.m_minActual
2205 && lhs.m_maxActual == rhs.m_maxActual;
2206 }

◆ isStereoTrackFull()

bool isStereoTrackFull ( const TRGCDCTrack aTrack)

Checks if stereo track has 4 TSs. One per each superlayer.

Definition at line 1102 of file Fitter3D.cc.

1103 {
1104 bool trackFull = 1;
1105 for (unsigned iSt = 0; iSt < 4; iSt++) {
1106 // Check if all superlayers have one TS
1107 const vector<TCLink*>& links = aTrack.links(iSt * 2 + 1);
1108 const unsigned nSegments = links.size();
1109 // Find if there is a TS with a priority hit.
1110 // Loop over all TS in same superlayer.
1111 bool priorityHitTS = 0;
1112 for (unsigned iTS = 0; iTS < nSegments; iTS++) {
1113 const TCSegment* t_segment = dynamic_cast<const TCSegment*>(& links[iTS]->hit()->cell());
1114 if (t_segment->center().hit() != 0) priorityHitTS = 1;
1115 }
1116 if (nSegments != 1) {
1117 if (nSegments == 0) {
1118 trackFull = 0;
1119 if (m_mBool["fIsPrintError"]) cout << "Fitter3D::isStereoTrackFull() => There are no TS." << endl;
1120 } else {
1121 if (m_mBool["fIsPrintError"]) cout << "Fitter3D::isStereoTrackFull() => multiple TS are assigned." << endl;
1122 }
1123 } else {
1124 if (priorityHitTS == 0) {
1125 trackFull = 0;
1126 if (m_mBool["fIsPrintError"]) cout << "Fitter3D::isStereoTrackFull() => There are no priority hit TS" << endl;
1127 }
1128 }
1129 } // End superlayer loop
1130 return trackFull;
1131 }

◆ itostring()

std::string itostring ( int  i)
static

converts int to string. (Use boost::lexical_cast)

Definition at line 50 of file Utilities.cc.

51 {
52 // std::ostringstream s;
53 // s << i;
54 // return s.str();
55
56 return std::to_string(i);
57 }

◆ kappa()

double kappa ( void  ) const
inline

returns kappa.

Definition at line 285 of file Helix.h.

286 {
287 return m_ac[2];
288 }

◆ layer() [1/2]

const TRGCDCLayer * layer ( unsigned  id) const
inline

returns a pointer to a layer. 0 will be returned if 'id' is invalid.

Definition at line 828 of file TRGCDC.h.

829 {
830 return _layers[id];
831 }

◆ layer() [2/2]

const TRGCDCLayer & layer ( void  ) const
inline

returns a pointer to a layer.

Definition at line 235 of file Cell.h.

236 {
237 return _layer;
238 }

◆ layerId() [1/3]

unsigned layerId ( unsigned  axialStereoSwitch,
unsigned  axialStereoLayerId 
) const

returns layer ID from axialStereoLayerId. This function is expensive.

Definition at line 1812 of file TRGCDC.cc.

1813 {
1814 cout << "TRGCDC::layerId !!! this function is not implemented yet"
1815 << endl;
1816 return TRGCDC_UNDEFINED;
1817 }

◆ layerId() [2/3]

unsigned layerId ( unsigned  wireId) const

returns layer ID. This function is expensive.

Definition at line 1793 of file TRGCDC.cc.

1794 {
1795 cout << "TRGCDC::layerId !!! this function is not tested yet"
1796 << endl;
1797 unsigned iLayer = 0;
1798 unsigned nW = 0;
1799 bool nextLayer = true;
1800 while (nextLayer) {
1801 nW += layer(iLayer++)->nCells();
1802 if (id < (nW - 1))
1803 return iLayer - 1;
1804 if (nW >= nWires())
1805 nextLayer = false;
1806 }
1807 cout << "TRGCDC::layerId !!! no such a wire (id=" << id << endl;
1808 return TRGCDC_UNDEFINED;
1809 }
unsigned nCells(void) const
returns # of cells.
Definition: Layer.h:194

◆ layerId() [3/3]

unsigned layerId ( void  ) const
inline

returns layer id.

Definition at line 214 of file Cell.h.

215 {
216 return _layer.id();
217 }

◆ layerUsage()

string layerUsage ( const std::vector< TRGCDCLink * > &  links)
static

usage of each layer

Definition at line 769 of file Link.cc.

770 {
771// unsigned n[11];
772 static unsigned* n = new unsigned[Belle2::TRGCDC::getTRGCDC()->nSuperLayers()];
773 nHitsSuperLayer(links, n);
774 string nh = "";
775 for (unsigned i = 0; i < _nSL; i++) {
776 nh += TRGUtil::itostring(n[i]);
777 if (i % 2) nh += ",";
778 else if (i < 10) nh += "-";
779 }
780 return nh;
781 }
static void nHitsSuperLayer(const std::vector< TRGCDCLink * > &links, unsigned *nHits)
returns # of hits per super layer.
Definition: Link.cc:135

◆ leaveStage()

void leaveStage ( const std::string &  stageName)
static

Declare that you leave a stage.

Definition at line 34 of file Debug.cc.

35 {
36 if (name != _stages.back()) {
37 cout << "TRGDebug !!! given stage name(" << name << ") doesn't match"
38 << " to expected stage name(" << _stages.back() << endl;
39 return;
40 }
41 _stages.pop_back();
42 if (_level)
43 cout << tab() << "<-- " << name << endl;
44 }

◆ leftRight() [1/3]

unsigned leftRight ( unsigned  a)
inline

sets left-right. 0:left, 1:right, 2:wire

Definition at line 530 of file Link.h.

531 {
532 return _leftRight = a;
533 }

◆ leftRight() [2/3]

unsigned leftRight ( void  ) const
inline

returns left-right. 0:left, 1:right, 2:wire

Definition at line 523 of file Link.h.

524 {
525 return _leftRight;
526 }

◆ leftRight() [3/3]

int leftRight ( void  ) const
inline

returns left or right.

Definition at line 128 of file WireHitMC.h.

129 {
130 return _leftRight;
131 }
int _leftRight
leftright info
Definition: WireHitMC.h:91

◆ level() [1/2]

int level ( int  newLevel,
bool  thisStageOnly = false 
)
static

sets and returns the debug level.

Definition at line 73 of file Debug.cc.

74 {
75 if (! b)
76 return _level = a;
77 else
78 return _level = a;
79 }

◆ level() [2/2]

int level ( void  )
static

returns the debug level.

Definition at line 67 of file Debug.cc.

68 {
69 return _level;
70 }

◆ limit() [1/2]

TRGCDCJSignal const limit ( signed long long  minInt,
signed long long  maxInt,
double  minActual,
double  maxActual 
) const

Limits min and max values using specific integers. Use only for ifElse. Doesn't check overflow, underflow to be used in ifElse.

Definition at line 957 of file JSignal.cc.

959 {
960 TRGCDCJSignal t_result(*this);
961
962 //if(t_result.m_type==2) {
963 // cout<<"[Error] TRGCDCJSignal::limit() => should not be used with slv type."<<endl;
964 //}
965
966
967 if (t_result.m_argumentSignals.size() == 0) t_result.initArgumentSignals();
968
969 t_result.m_minInt = minInt;
970 t_result.m_maxInt = maxInt;
971 t_result.m_minActual = minActual;
972 t_result.m_maxActual = maxActual;
973 t_result.m_type = t_result.calType();
974 t_result.m_bitsize = t_result.calBitwidth();
976 //t_result.checkInt("TRGCDCJSignal::limit()");
977
978
979 if (getPrintVhdl() == 1) vhdlCode("none", *this, t_result, t_result.m_vhdlCode);
980 //t_result.m_vhdlCode = "resize("+t_result.m_vhdlCode+","+to_string(t_result.m_bitsize)+")";
981 return t_result;
982 }

◆ limit() [2/2]

TRGCDCJSignal const limit ( TRGCDCJSignal const &  min,
TRGCDCJSignal const &  max 
) const

Limits min and max values using JSignal. Use only for ifElse. Doesn't check overflow, underflow to be used in ifElse.

Definition at line 984 of file JSignal.cc.

985 {
986 return limit(min.m_int, max.m_int, min.m_actual, max.m_actual);
987 }
TRGCDCJSignal const limit(signed long long minInt, signed long long maxInt, double minActual, double maxActual) const
Limits min and max values using specific integers. Use only for ifElse. Doesn't check overflow,...
Definition: JSignal.cc:957

◆ link() [1/2]

TRGCDCLink * link ( TRGCDCLink a)
inline

sets a pointer to a TRGCDCLink.

Definition at line 602 of file Link.h.

603 {
604 return _link = a;
605 }

◆ link() [2/2]

TRGCDCLink * link ( void  ) const
inline

returns a pointer to a TRGCDCLink.

Definition at line 595 of file Link.h.

596 {
597 return _link;
598 }

◆ links() [1/2]

const std::vector< TCLink * > & links ( unsigned  layerId) const

returns a vector to track segments.

Definition at line 129 of file TrackBase.cc.

130 {
131 return _ts[layerId];
132 }

◆ links() [2/2]

const std::vector< TCLink * > & links ( void  ) const

returns a vector to track segments.

Definition at line 123 of file TrackBase.cc.

124 {
125 return _tsAll;
126 }

◆ links2HEP()

const Belle2::TRGCDCTrackMC & links2HEP ( const std::vector< TRGCDCLink * > &  links)
static

returns TRGCDCTrackMC

Definition at line 723 of file Link.cc.

724 {
726 const vector<const Belle2::TRGCDCTrackMC*> list =
728 unsigned nHep = list.size();
729
730 if (! nHep) return * best;
731
732 unsigned* N;
733 if (NULL == (N = (unsigned*) malloc(nHep * sizeof(unsigned)))) {
734// perror("$Id: TRGCDCLink.cc 11153 2010-04-28 03:36:53Z yiwasaki $:N:malloc");
735 exit(1);
736 }
737 for (unsigned i = 0; i < nHep; i++) N[i] = 0;
738
739// for (unsigned i = 0; i < (unsigned) links.size(); i++) {
740// const TRGCDCLink & l = * links[i];
741// const Belle2::TRGCDCTrackMC & hep = * l.hit()->mc()->hep();
742// for (unsigned j = 0; j < nHep; j++)
743// if (list[j] == & hep)
744// ++N[j];
745// }
746
747 unsigned nMax = 0;
748 for (unsigned i = 0; i < nHep; i++) {
749 if (N[i] > nMax) {
750 best = list[i];
751 nMax = N[i];
752 }
753 }
754
755 free(N);
756
757 return * best;
758 }
static TRGCDCTrackMC * _undefined
returns a pointer to gen_hepevt.
Definition: TrackMC.h:88

◆ list() [1/2]

std::vector< const TRGCDCTrackMC * > list ( void  )
static

returns a list of TRGCDCTrackMC's.

Definition at line 94 of file TrackMC.cc.

95 {
96 std::vector<const TRGCDCTrackMC*> t;
97 t.assign(_list.begin(), _list.end());
98 return t;
99 }
static std::vector< const TRGCDCTrackMC * > _list
vector of pointers to TRGCDCTrackMC
Definition: TrackMC.h:105

◆ list() [2/2]

vector< const TRGCDCTrack * > list ( void  )
static

returns a list of TRGCDCTrack's.

Definition at line 86 of file TRGCDCTrack.cc.

87 {
88 vector<const TRGCDCTrack*> t;
89 t.assign(_list.begin(), _list.end());
90 return t;
91 }
static std::vector< const TRGCDCTrack * > _list
a vector to keep all TRGCDCTrack objects.
Definition: TRGCDCTrack.h:105

◆ localId() [1/2]

unsigned localId ( unsigned  wireId) const

returns local ID in a layer. This function is expensive.

Definition at line 1773 of file TRGCDC.cc.

1774 {
1775 cout << "TRGCDC::localId !!! this function is not tested yet"
1776 << endl;
1777 unsigned iLayer = 0;
1778 unsigned nW = 0;
1779 bool nextLayer = true;
1780 while (nextLayer) {
1781 unsigned nWLast = nW;
1782 nW += layer(iLayer++)->nCells();
1783 if (id < (nW - 1))
1784 return id - nWLast;
1785 if (nW >= nWires())
1786 nextLayer = false;
1787 }
1788 cout << "TRGCDC::localId !!! no such a wire (id=" << id << endl;
1789 return TRGCDC_UNDEFINED;
1790 }

◆ localId() [2/2]

unsigned localId ( void  ) const
inline

returns local id in a layer.

Definition at line 207 of file Cell.h.

208 {
209 return _localId;
210 }

◆ localIdDifference()

int localIdDifference ( const TRGCDCCell a) const

returns local id difference.

Definition at line 69 of file Cell.cc.

70 {
71
72 if (superLayerId() != a.superLayerId()) {
73 cout << "TRGCDCCell::localIdDifference !!!";
74 cout << "super layer assumption violation" << endl;
75 }
76
77 int diff = int(a.localId()) - int(localId());
78 unsigned nCells = layer().nCells();
79 if (diff > 0) {
80 int difR = nCells - diff;
81 if (diff < difR) return diff;
82 else return - difR;
83 } else {
84 int difR = nCells + diff;
85 if (- diff < difR) return diff;
86 else return difR;
87 }
88 }
const TRGCDCLayer & layer(void) const
returns a pointer to a layer.
Definition: Cell.h:235

◆ localIdForMinus()

int localIdForMinus ( void  ) const
inline

returns localId but if 0, return maxLocalId + 1.

Definition at line 222 of file Wire.h.

223 {
224 //
225 // used in curl finder
226 //
227 // new version by NK
228 //
229 //ho const TRGCDCLayer &l = *layer();
230 //ho const int nw = l.nWires();
231
232 const TRGCDCLayer& l = this->layer();
233 const unsigned nw = l.nCells();
234 if (0 == localId())
235 return nw;
236 else
237 return localId();
238 }

◆ localIdForPlus()

int localIdForPlus ( void  ) const
inline

returns localId but if maxLocalId, return -1.

Definition at line 202 of file Wire.h.

203 {
204 //
205 // used in curl finder
206 //
207 // new version by NK
208 //
209 //ho const TCDCLayer &l = *layer();
210 //ho const int nw = l.nWires();
211
212 const TRGCDCLayer& l = this->layer();
213 const unsigned nw = l.nCells();
214 if (localId() + 1 == nw)
215 return -1;
216 else
217 return localId();
218 }

◆ localLayerId() [1/3]

unsigned localLayerId ( unsigned  wireId) const

returns local layer ID in a super layer. This function is expensive.

Definition at line 1842 of file TRGCDC.cc.

1843 {
1844 unsigned iLayer = 0;
1845 unsigned nW = 0;
1846 bool nextLayer = true;
1847 while (nextLayer) {
1848 const vector<TRGCDCLayer*>& sl = *superLayer(iLayer);
1849 const unsigned nLayers = sl.size();
1850 for (unsigned i = 0; i < nLayers; i++) {
1851 nW += sl[i]->nCells();
1852 if (id < (nW - 1))
1853 return i;
1854 }
1855
1856 if (nW >= nWires())
1857 nextLayer = false;
1858 }
1859 cout << "TRGCDC::localLayerId !!! no such a wire (id=" << id
1860 << endl;
1861 return TRGCDC_UNDEFINED;
1862 }

◆ localLayerId() [2/3]

unsigned localLayerId ( void  ) const
inline

returns local layer id in a super layer.

Definition at line 228 of file Cell.h.

229 {
230 return _layer.localLayerId();
231 }

◆ localLayerId() [3/3]

unsigned localLayerId ( void  ) const
inline

returns local layer id in a super layer.

Definition at line 173 of file Layer.h.

174 {
175 return _localLayerId;
176 }

◆ locationInPlane()

void locationInPlane ( float  x0,
float  y0,
float  x1,
float  y1,
unsigned &  nFound,
unsigned &  iX0,
unsigned &  iY0,
unsigned &  iX1,
unsigned &  iY1 
) const

returns cell positions in the region.

Definition at line 53 of file HoughPlaneBase.cc.

57 {
58
59 const TRGPoint2D p(x0, y0);
60 const TRGPoint2D q(x1, y1);
61
62 //...Boundary check...
63 if (_area.inArea(p) && _area.inArea(q)) {
64 X0 = unsigned((x0 - _xMin) / _xSize);
65 Y0 = unsigned((y0 - _yMin) / _ySize);
66 X1 = unsigned((x1 - _xMin) / _xSize);
67 Y1 = unsigned((y1 - _yMin) / _ySize);
68 nFound = 2;
69 return;
70 }
71
72 nFound = 0;
73 TRGPoint2D c[2];
74 _area.cross(p, q, nFound, c);
75 if (nFound == 2) {
76 X0 = unsigned((c[0].x() - _xMin) / _xSize);
77 Y0 = unsigned((c[0].y() - _yMin) / _ySize);
78 X1 = unsigned((c[1].x() - _xMin) / _xSize);
79 Y1 = unsigned((c[1].y() - _yMin) / _ySize);
80 }
81 }
float _xSize
Size of x bin.
float _ySize
Size of y bin.
const TRGArea2D _area
Area.
void cross(const TRGPoint2D &x0, const TRGPoint2D &x1, unsigned &nFound, TRGPoint2D crossPoint[2]) const
returns cross-points.
Definition: Area2D.cc:29

◆ LUT()

const TRGCDCLUT * LUT ( void  ) const
inline

returns LUT

Definition at line 258 of file Segment.h.

259 {
260 return m_TSLUT;
261 }

◆ lutPattern() [1/2]

unsigned lutPattern ( int  clk0,
int  clk1 
) const

hit pattern containing bit for priority position for hits in given time window.

Definition at line 581 of file Segment.cc.

582 {
583 unsigned outValue = (hitPattern(clk0, clk1)) * 2;
584 if (priorityPosition(clk0, clk1) == 2) {
585 outValue += 1;
586 }
587 return outValue;
588 }
int priorityPosition(void) const
return priority cell position in TSHit. 0: no hit, 3: 1st priority, 1: 2nd right, 2: 2nd left
Definition: Segment.cc:473

◆ lutPattern() [2/2]

unsigned lutPattern ( void  ) const

hit pattern containing bit for priority position

Definition at line 571 of file Segment.cc.

572 {
573 unsigned outValue = (hitPattern()) * 2;
574 if (priorityPosition() == 2) {
575 outValue += 1;
576 }
577 return outValue;
578 }

◆ lutVhdlCode()

std::string const lutVhdlCode ( std::string const &  shiftOffsetInput) const

Creates vhdlCode for lut.

Definition at line 596 of file JLUT.cc.

597 {
598 //cout<<shiftOffsetInput.getFinalCode()<<endl;
599 //cout<<out.getFinalCode()<<endl;
600 stringstream t_vhdlCode;
601 t_vhdlCode << "lut_" << m_name << "_i: entity work.lut_" << m_name << endl;
602 t_vhdlCode << " port map(" << endl;
603 t_vhdlCode << " clka=>CLKIN, " << endl;
604 t_vhdlCode << " addra=>lut_" << m_name << "_in," << endl;
605 t_vhdlCode << " douta=>lut_" << m_name << "_out" << endl;
606 t_vhdlCode << ");" << endl;
607 t_vhdlCode << shiftOffsetInput << endl;
608 return t_vhdlCode.str();
609 }

◆ mag()

double mag ( void  ) const
inline

magnitude of the point

Definition at line 120 of file Point2D.h.

121 {
122 return sqrt(_p[0] * _p[0] + _p[1] * _p[1]);
123 }

◆ mag2()

double mag2 ( void  ) const
inline

magnitude square of the point

Definition at line 127 of file Point2D.h.

128 {
129 return _p[0] * _p[0] + _p[1] * _p[1];
130 }

◆ mainPart()

bool mainPart ( void  ) const
inline

returns true if this wire is in the main part.

Definition at line 293 of file Cell.h.

294 {
295 std::cout << "TRGCDCCell::mainPart ... position not defined" << std::endl;
296 if (layerId() > 13) return true;
297 return false;
298 }

◆ makeCOE()

void makeCOE ( const std::string &  fileName = "")

make COE file.

Definition at line 425 of file JLUT.cc.

426 {
427 m_write = 1;
428 // Check if function is set.
429 if (!m_function.operator bool()) {
430 cout << "[Error] TRGCDCJLUT::makeCOE() => m_function is not set. Aborting." << endl;
431 return;
432 }
433 // Check if m_inputBitsize is set.
434 if (m_inputBitsize == 0) {
435 cout << "[Error] TRGCDCJLUT::makeCOE() => inputBitSize is not set. Aborting." << endl;
436 return;
437 }
438 // Set file name.
439 string t_fileName;
440 if (fileName != "") t_fileName = fileName;
441 else if (name() != "") {
442 t_fileName = name();
443 t_fileName += ".coe";
444 } else t_fileName = "untitled.coe";
445 // Create file.
446 ofstream coeFile;
447 coeFile.open(t_fileName.c_str());
448
449 coeFile << "* [Information for COE " << fileName << " ]" << endl;
450 coeFile << "* in_real = in * " << m_inputMin.getToReal() << endl;
451 coeFile << "* LUT_in = (in - " << m_inputMin.getInt() << ") * 2^" << m_inputShiftBits << endl;
452 coeFile << "* x = (LUT_in + " << m_inputMin.getInt() << " * 2^" << m_inputShiftBits << ") * " << m_inputMin.shift(m_inputShiftBits,
453 0).getToReal() << endl;
454 coeFile << "* y_int = round( f(x) / " << m_shiftOutputMin.getToReal() << " - " << m_shiftOutputMin.getInt() << " )" << endl;
455 coeFile << "* LUT_out = Limit to 0 < y_int < " << m_shiftOffsetOutputMax.getInt() << endl;
456 coeFile << "* out = LUT_out + " << m_shiftOutputMin.getInt() << endl;
457 coeFile << "* out_Real = out * " << m_shiftOutputMin.getToReal() << endl;
458
459 // Meta data for file.
460 coeFile << "memory_initialization_radix=10;" << endl;
461 coeFile << "memory_initialization_vector=" << endl;
462 // Fill content of file.
463 for (unsigned index = 0; index < pow(2, m_inputBitsize) - 1; index++) {
464 //cout<<"Directly: "<<m_function(index)<<endl;
465 //cout<<"Indirect: "<<getOutput(index)<<endl;
466 coeFile << m_function(index) << "," << endl;
467 }
468 coeFile << m_function(pow(2, m_inputBitsize) - 1) << ";" << endl;
469 // Close file.
470 coeFile.close();
471 m_write = 0;
472 }
bool m_write
VHDL write flag for signals. 1: Write is on. 0: Write is off.
Definition: JLUT.h:158
TRGCDCJSignal m_shiftOffsetOutputMax
The maximum output value that is bit shifted.
Definition: JLUT.h:194
TRGCDCJSignal m_shiftOutputMin
The minimum output signal that is bit shifted.
Definition: JLUT.h:191
int m_inputShiftBits
The number of bits to shift to make input the wanted bit width.
Definition: JLUT.h:176
TRGCDCJSignal m_inputMin
The minimum input signal.
Definition: JLUT.h:185
TRGCDCJSignal const shift(int nBits, int operate=1) const
Shift signal. Shift direction is right. operate=0 to change m_toReal(unit).
Definition: JSignal.cc:561
signed long long getInt() const
Get integer value of signal.
Definition: JSignal.cc:1377
double getToReal() const
Get toReal value of signal.
Definition: JSignal.cc:1422

◆ makeTrack()

TCTrack * makeTrack ( const unsigned  serialID,
const unsigned  pm 
) const
private

Make a track from serial ID in Hough plane.

(no fit, segment hit attached)

Definition at line 1104 of file HoughFinder.cc.

1105 {
1106
1107 //...Cal. pt and phi from the cell number...
1108 const TCHTransformationCircle& tc =
1109 (TCHTransformationCircle&) _plane[pm]->transformation();
1110 unsigned x, y;
1111 _plane[pm]->id(peakId, x, y);
1112 const TRGPoint2D hp = _plane[pm]->position(x, y);
1113 const TRGPoint2D cc = tc.circleCenter(hp);
1114 const double r = cc.y();
1115 const double phi = cc.x();
1116
1117 //...Make a circle...
1118 TCCircle c(r, phi, pm ? -1. : 1., * _plane[pm]);
1119 c.name("circle_" + TRGUtil::itostring(int(peakId) * (pm ? -1 : 1)));
1120
1121 if (TRGDebug::level()) {
1122 cout << TRGDebug::tab() << "plane" << pm << ",serialId=" << peakId
1123 << endl;
1124 c.dump("detail", TRGDebug::tab() + "Circle> ");
1125 }
1126
1127 //...Get segment hits...
1128 vector<TCLink*> links;
1129 vector<const TCSegment*> segments;
1130 const unsigned nLayers = _plane[pm]->nLayers();
1131 for (unsigned j = 0; j < nLayers; j++) {
1132 const vector<unsigned>& ptn =
1133 _plane[pm]->patternId(j, peakId);
1134 for (unsigned k = 0; k < ptn.size(); k++) {
1135 const TCSegment& s = _cdc.axialSegment(j, ptn[k]);
1136 segments.push_back(& s);
1137 if (s.hit()) {
1138 TCLink* l = new TCLink(0, s.hit());
1139 links.push_back(l);
1140 }
1141 }
1142 }
1143 c.append(links);
1144
1145 if (TRGDebug::level()) {
1146 cout << TRGDebug::tab() << "attched segments below" << endl;
1147 cout << TRGDebug::tab(4);
1148 for (unsigned j = 0; j < segments.size(); j++) {
1149 cout << segments[j]->name();
1150 if (j != (segments.size() - 1))
1151 cout << ",";
1152 }
1153 cout << endl;
1154 }
1155
1156 //...Make a track...
1157 TCTrack* t = new TCTrack(c);
1158 t->name("track_" + TRGUtil::itostring(int(peakId) * (pm ? -1 : 1)));
1159
1160 if (TRGDebug::level()) {
1161 t->relation().dump("", TRGDebug::tab());
1162 t->dump("detail");
1163 }
1164
1165 return t;
1166 }
TRGPoint2D position(unsigned x, unsigned y) const
returns position in Hough plain for a cell (x, y)..

◆ mappingByFile()

void mappingByFile ( const std::string &  mappingFilePlus,
const std::string &  mappingFileMinus 
)
private

creates mappings by a file.

Definition at line 661 of file HoughFinder.cc.

663 {
664 const string sn = "mappingByFile";
666
667 const string* fMap[2] = {& mappingFilePlus, & mappingFileMinus};
668
669 for (unsigned f = 0; f < 2; f++) {
670
671 const string& fn = * fMap[f];
672 ifstream infile(fn.c_str(), ios::in);
673 if (infile.fail()) {
674 cout << " !!! can not open file" << endl
675 << " " << fn << endl
676 << " Mapping aborted" << endl;
677 return;
678 }
679
680 //...Map data storage...
681 vector<unsigned> x;
682 vector<unsigned> y;
683 vector<vector<unsigned>> tsf;
684
685 //...Ignore lines not starting with a digit...
686 string ignores;
687 while (!isdigit(infile.peek())) {
688 getline(infile, ignores);
689 }
690 //...Skip the first line (read in constructor)...
691 getline(infile, ignores);
692
693 //...Read map file...
694 string car;
695 while (getline(infile, car)) {
696 unsigned i = 0;
697 unsigned b;
698 istringstream in(car);
699 vector<unsigned> slts;
700 while (in >> b) {
701 ++i;
702 unsigned j = i % 2;
703 if (i == 1) // cell position x
704 x.push_back(b);
705 if (i == 2) // cell position y (stored with offset 1)
706 y.push_back(b - 1);
707 if (j != 0 && i != 1) // TSF SL
708 slts.push_back(b);
709 if (j != 1 && i != 2) // TSF local ID
710 slts.push_back(b);
711 }
712 tsf.push_back(slts);
713 }
714 infile.close();
715
716 unsigned axialSuperLayerId = 0;
717 for (unsigned i = 0; i < _cdc.nSegmentLayers(); i++) {
719 const unsigned nWires = l->nCells();
720
721 if (! nWires) continue;
722 if ((* l)[0]->stereo()) continue;
723
724 _plane[f]->preparePatterns(axialSuperLayerId, nWires);
725 for (unsigned j = 0; j < nWires; j++) {
726
727 _plane[f]->clear();
728
729 //...loop over all hp cells...
730 const unsigned n = x.size();
731 for (unsigned k = 0; k < n; k++) {
732 const int ix = x[k];
733 const int iy = y[k];
734 const unsigned sid = _plane[f]->serialId(ix, iy);
735 for (unsigned itsf = 0; itsf < tsf[k].size();) {
736 const unsigned sl = tsf[k][itsf];
737 const unsigned id = tsf[k][itsf + 1];
738 if ((i == sl) && (j == id)) {
739 _plane[f]->setEntry(sid, axialSuperLayerId, 1);
740 }
741 itsf += 2;
742 }
743 }
744
745 _plane[f]->registerPattern(axialSuperLayerId, j);
746 }
747 ++axialSuperLayerId;
748 }
749 }
750
752 }
A class to represent a cell layer.
Definition: Layer.h:33
void preparePatterns(unsigned layerId, unsigned nPatterns)
allocate memory for patterns.
unsigned nSegmentLayers(void) const
returns # of track segment layers.
Definition: TRGCDC.h:1070
const TRGCDCLayer * segmentLayer(unsigned id) const
returns a pointer to a track segment layer.
Definition: TRGCDC.h:1061
unsigned setEntry(unsigned serialId, unsigned layerId, unsigned n)
Sets entry.
void registerPattern(unsigned layerId, unsigned id)
registers a pattern..

◆ mapSignalsToValues()

void mapSignalsToValues ( std::map< std::string, Belle2::TRGCDCJSignal >const &  inMap,
std::vector< std::pair< std::string, int > > const &  inChoose,
std::vector< std::tuple< std::string, double, int, double, double, int > > &  outValues 
)
static

Choose => [signalName, FpgaEffects(=1)/NoFpgaEffects(=0)] Values => [name, value, bitwidth, min, max, clock] Changes signals to values.

Definition at line 2225 of file JSignal.cc.

2228 {
2229 for (unsigned iSignals = 0; iSignals < inChoose.size(); iSignals++) {
2230 int const& b_integerEffect = inChoose[iSignals].second;
2231 string const& t_name = inChoose[iSignals].first;
2232 Belle2::TRGCDCJSignal const& t_signal = inMap.find(t_name)->second;
2233 double t_value = 0, t_min = 0, t_max = 0;
2234 int t_bitwidth = t_signal.getBitsize();
2235 if (b_integerEffect == 1) {
2236 t_value = t_signal.getRealInt();
2237 t_min = t_signal.getRealMinInt();
2238 t_max = t_signal.getRealMaxInt();
2239 } else {
2240 t_value = t_signal.getActual();
2241 t_min = t_signal.getMinActual();
2242 t_max = t_signal.getMaxActual();
2243 }
2244 int t_clock = t_signal.getFinishClock();
2245 tuple<string, double, int, double, double, int> outValue(t_name, t_value, t_bitwidth, t_min, t_max, t_clock);
2246 outValues.push_back(outValue);
2247 }
2248 }
double getActual() const
Get float value of signal.
Definition: JSignal.cc:1392
double getRealMinInt() const
Get converted float value of minimum integer.
Definition: JSignal.cc:1412
int getFinishClock() const
Gets clock tick where signal is make.
Definition: JSignal.cc:1427
double getRealMaxInt() const
Get converted float value of maximum integer.
Definition: JSignal.cc:1417
double getBitsize() const
Get bitwidth of signal.
Definition: JSignal.cc:1372
double getMinActual() const
Get minimum float value of signal.
Definition: JSignal.cc:1397
double getRealInt() const
Get converted float value of integer.
Definition: JSignal.cc:1407

◆ matchUnit()

void matchUnit ( TRGCDCJSignal first,
TRGCDCJSignal second 
) const

Utilities.

Matches unit by shifting bits.

Definition at line 1260 of file JSignal.cc.

1261 {
1262 if (first.m_toReal != second.m_toReal) {
1263 // Find number of bits to shift to match unit.
1264 double t_nBits = log(first.m_toReal / second.m_toReal) / log(2);
1265 // Round to integer
1266 if (t_nBits > 0) {
1267 t_nBits = int(t_nBits + 0.5);
1268 } else {
1269 t_nBits = int(t_nBits - 0.5);
1270 }
1271 // Shift bits to match unit
1272 if (t_nBits > 0) {
1273 first = first.shift(-t_nBits, 0);
1274 //cout<<"mu::shift_left(resize(" + first.m_name + "," + to_string(int(first.m_bitsize+t_nBits)) + ")," + to_string(int(t_nBits)) + ")"<<endl;
1275 //cout<<first.m_vhdlCode<<endl;
1276 } else if (t_nBits < 0) {
1277 second = second.shift(t_nBits, 0);
1278 //cout<<"mu::shift_left(resize(" + second.m_name + "," + to_string(int(second.m_bitsize-t_nBits)) + ")," + to_string(int(-t_nBits)) + ")"<<endl;
1279 //cout<<second.m_vhdlCode<<endl;
1280 }
1281
1282 if (fabs(first.m_toReal - second.m_toReal) > 0.00001 * first.m_toReal) {
1283 cout << "[Warning] TRGCDCJSignal::matchUnit() => in1 and in2 units are still different." << endl;
1284 cout << first.m_toReal << " " << second.m_toReal << endl;
1285 }
1286
1287 if (m_debug == 1) {
1288 cout << "TRGCDCJSignal::matchUnit()" << endl;
1289 if (t_nBits > 0) cout << "lhs was shifted to left by " << t_nBits << endl;
1290 else if (t_nBits < 0) cout << "rhs was shifted to left by " << -t_nBits << endl;
1291 cout << "TRGCDCJSignal::matchUnit()" << endl;
1292 }
1293 } // End of if units are different.
1294 first.checkInt("TRGCDCJSignal::matchUnit()::first");
1295 second.checkInt("TRGCDCJSignal::matchUnit()::second");
1296 }

◆ max()

int max ( void  ) const
inline

returns max. clock point.

Definition at line 201 of file Clock.h.

202 {
203 return _max;
204 }

◆ maxEntry() [1/2]

int maxEntry ( void  ) const
inlineoverridevirtual

returns max. entry in a plane.

Implements TRGCDCHoughPlaneBase.

Definition at line 148 of file HoughPlane.h.

149 {
150 int m = 0;
151 for (unsigned i = 0; i < nX() * nY(); i++)
152 if (_cell[i] > m)
153 m = _cell[i];
154 return m;
155 }

◆ maxEntry() [2/2]

int maxEntry ( void  ) const
inlineoverridevirtual

returns max. count in a plane.

Implements TRGCDCHoughPlaneBase.

Definition at line 199 of file HoughPlaneBoolean.h.

200 {
201#ifdef TRASAN_DEBUG
202 std::cout << "TRGCDCHoughPlaneBoolean::maxEntry !!! "
203 << " this function has no meaning for TRGCDCHoughPlaneBooolean object"
204 << std::endl;
205#endif
206 return 1;
207 }

◆ maxEntryInRegion()

int maxEntryInRegion ( unsigned  id) const

returns max. count in region.

Definition at line 120 of file HoughPlaneBase.cc.

121 {
122#ifdef TRASAN_DEBUG
123 const std::string stage = "THghPlnBase::maxEntryInRegion";
124 EnterStage(stage);
125#endif
126#ifdef TRASAN_DEBUG_DETAIL
127 std::cout << Tab() << "target id=" << targetId << ",#regions="
128 << _regions.length() << std::endl;
129#endif
130// for (unsigned i = 0; i < (unsigned) _regions.length(); i++) {
131 for (unsigned i = 0; i < (unsigned) _regions.size(); i++) {
132 const std::vector<unsigned>& region = * _regions[i];
133 unsigned maxEntry = 0;
134 bool idFound = false;
135// for (unsigned j = 0; j < (unsigned) region.length(); j++) {
136 for (unsigned j = 0; j < (unsigned) region.size(); j++) {
137// const unsigned id = * region[j];
138 const unsigned id = region[j];
139 if (id == targetId) idFound = true;
140 if (maxEntry < entry(id))
141 maxEntry = entry(id);
142 }
143 if (idFound) {
144#ifdef TRASAN_DEBUG
145 LeaveStage(stage);
146#endif
147 return maxEntry;
148 }
149 }
150
151#ifdef TRASAN_DEBUG
152 LeaveStage(stage);
153#endif
154 return 0;
155 }
virtual int maxEntry(void) const =0
returns max. count in a plane.

◆ maxTiming()

double maxTiming ( void  ) const
inline

returns max. timing.

Definition at line 172 of file Clock.h.

173 {
174// return _max * _cycle + _offset;
175 return _max * _cycle;
176 }

◆ maxTRGTime()

TRGTime maxTRGTime ( bool  edge) const

returns max. TRGtime with clock.

Definition at line 147 of file Clock.cc.

148 {
149 TRGTime a(maxTiming(), edge, * this, _name + "_max");
150 return a;
151 }

◆ mc() [1/2]

const TRGCDCWireHitMC * mc ( TRGCDCWireHitMC a)
inline

This will be removed.

Definition at line 104 of file WireHit.h.

105 {
106 return _mc = a;
107 }
const TRGCDCWireHitMC * _mc
This will be removed.
Definition: WireHit.h:86

◆ mc() [2/2]

const TRGCDCWireHitMC * mc ( void  ) const
inline

This will be removed.

Definition at line 97 of file WireHit.h.

98 {
99 return _mc;
100 }

◆ mcLR()

int mcLR ( void  ) const
inline

returns mc left/right information

Definition at line 245 of file CellHit.h.

246 {
247 return _mcLR;
248 }
int _mcLR
mc left/right information
Definition: CellHit.h:178

◆ mcParticle() [1/2]

const MCParticle & mcParticle ( unsigned  i = 0) const

returns i'th contributor.

Definition at line 79 of file Relation.cc.

80 {
81 const unsigned id = contributor(a);
82 StoreArray<MCParticle> mcParticles;
83 const unsigned nMcParticles = mcParticles.getEntries();
84 if (nMcParticles == 0) cout << "[Error] TRGCDCRelation::mcParticle() => There are no mc particles in MCParticle store array." <<
85 endl;
86 return * mcParticles[id];
87 }

◆ mcParticle() [2/2]

const MCParticle * mcParticle ( void  ) const

Access to MCParticle.

Definition at line 147 of file CellHit.cc.

148 {
149 StoreArray<MCParticle> mcParticles("MCParticles");
150 return mcParticles[_iMCParticle];
151 }

◆ merge() [1/2]

void merge ( void  )

merge function

Definition at line 83 of file HoughPlaneMulti.cc.

84 {
85 const unsigned nCells = nX() * nY();
86
87// for (unsigned i = 0; i < nCells; i++) {
88// unsigned n = 0;
89// for (unsigned j = 0; j < _layers.length(); j++)
90// // if (_layers[j]->entry(i))
91// if (_layers[j]->_cell[i])
92// ++n;
93// setEntry(i, n);
94// }
95
96 memset(_cell, 0, nCells * sizeof(unsigned));
97// for (unsigned j = 0; j < _layers.length(); j++) {
98 for (unsigned j = 0; j < _nLayers; j++) {
99// const unsigned a = j / 32;
100// if (! (_usage[a] & (1 << (j % 32)))) continue;
101 if (! _usage[j]) continue;
102 for (unsigned i = 0; i < nCells; i++) {
103 if (_layers[j]->_cell[i])
104 ++_cell[i];
105 }
106 }
107 }
unsigned _nLayers
number of layers

◆ merge() [2/2]

void merge ( void  )

Merge layers into one.

Definition at line 65 of file HoughPlaneMulti2.cc.

66 {
67 const unsigned n = _layers[0]->_n;
68 for (unsigned i = 0; i < _nLayers; i++) {
69
70 //...Use _usage here...
71 if (! _usage[i]) continue;
72
73 for (unsigned j = 0; j < n; j++) {
74 if (! _layers[i]->_cell[j]) continue;
75 for (unsigned k = 0; k < 32; k++) {
76 if ((_layers[i]->_cell[j] >> k) & 1) {
77 add(j * 32 + k, 1);
78 }
79 }
80 }
81 }
82 }
void add(unsigned cellId, int weight) override
Add to a cell.
Definition: HoughPlane.h:166

◆ mergeOuters()

void mergeOuters ( void  )

Merge outer layers into one.

Definition at line 85 of file HoughPlaneMulti2.cc.

86 {
87 const unsigned n = _layers[0]->_n;
88 for (unsigned i = 1; i < _nLayers; i++) {
89
90 //...Use _usage here...
91 if (! _usage[i]) continue;
92
93 for (unsigned j = 0; j < n; j++) {
94 if (! _layers[i]->_cell[j]) continue;
95 for (unsigned k = 0; k < 32; k++) {
96 if ((_layers[i]->_cell[j] >> k) & 1) {
97 add(j * 32 + k, 1);
98 }
99 }
100 }
101 }
102 }

◆ merger()

const TRGCDCMerger * merger ( unsigned  id) const
inline

returns a merger board.

Definition at line 1040 of file TRGCDC.h.

1041 {
1042 return _mergers[a];
1043 }

◆ min()

int min ( void  ) const
inline

returns min. clock point.

Definition at line 194 of file Clock.h.

195 {
196 return _min;
197 }

◆ minTiming()

double minTiming ( void  ) const
inline

returns min. timing.

Definition at line 164 of file Clock.h.

165 {
166// return _min * _cycle + _offset;
167 return _min * _cycle;
168 }

◆ minTRGTime()

TRGTime minTRGTime ( bool  edge) const

returns min. TRGtime with clock.

Definition at line 140 of file Clock.cc.

141 {
142 TRGTime a(minTiming(), edge, * this, _name + "_min");
143 return a;
144 }

◆ mirel()

bool mirel ( vector< unsigned >  a,
vector< unsigned >  b 
)

...mirel...

Definition at line 212 of file PeakFinder.cc.

213 {
214 bool t = true;
215 //case 1
216 if (a[4] == 0 && b[1] == 0) {
217 t = false;
218 }
219 //case 2
220 if (a[2] == 0 && a[4] == 0) {
221 t = false;
222 }
223 //case 3
224 if (b[1] == 0 && b[3] == 0) {
225 t = false;
226 }
227 return t;
228 }

◆ mkbool()

vector< bool > mkbool ( int  N,
int  bitSize 
)

tranformatoin into bool

Definition at line 395 of file TrackSegmentFinder.cc.

396 {
397 vector<bool> boutput;
398 boutput.resize(bitSize);
399 int tmpint = N;
400 for (unsigned i = 0; tmpint; i++) {
401 if (tmpint % 2) boutput[i] = true;
402 else boutput[i] = false;
403 tmpint = tmpint / 2;
404 }
405
406 return boutput;
407 }

◆ mkint()

double mkint ( TRGState  bitInput)

tranformatoin into integer

Definition at line 381 of file TrackSegmentFinder.cc.

382 {
383 double r = 0;
384 bool* binput = new bool[bitInput.size()];
385 bitInput.copy2bool(binput);
386 for (unsigned i = 0; i < bitInput.size(); i++) {
387 if (binput[i])
388 r += pow(2, i);
389 }
390 delete[] binput;
391 return r;
392 }

◆ mode() [1/2]

unsigned mode ( unsigned  a)
inline

sets simulation mode.

Definition at line 1084 of file TRGCDC.h.

1085 {
1086 return _simulationMode = a;
1087 }

◆ mode() [2/2]

unsigned mode ( void  ) const
inline

sets simulation mode.

Definition at line 1077 of file TRGCDC.h.

1078 {
1079 return _simulationMode;
1080 }

◆ momentum() [1/6]

CLHEP::Hep3Vector momentum ( double  dPhi,
CLHEP::HepSymMatrix &  Em 
) const

returns momentum vector after rotating angle dPhi in phi direction.

Definition at line 215 of file Helix.cc.

216 {
217 //
218 // Calculate momentum.
219 //
220 // Pt = | 1/kappa | (GeV/c)
221 //
222 // Px = -Pt * sin(phi0 + phi)
223 // Py = Pt * cos(phi0 + phi)
224 // Pz = Pt * tan(lambda)
225 //
226
227 double pt = fabs(m_pt);
228 double px = - pt * sin(m_ac[1] + phi);
229 double py = pt * cos(m_ac[1] + phi);
230 double pz = pt * m_ac[4];
231
232 if (m_matrixValid) Em = m_Ea.similarity(delMDelA(phi));
233 else Em = m_Ea;
234
235 return CLHEP::Hep3Vector(px, py, pz);
236 }
double m_pt
caches
Definition: Helix.h:228
CLHEP::HepMatrix delMDelA(double phi) const
Mathmatical functions.
Definition: Helix.cc:633

◆ momentum() [2/6]

CLHEP::HepLorentzVector momentum ( double  dPhi,
double  mass 
) const

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 239 of file Helix.cc.

240 {
241 //
242 // Calculate momentum.
243 //
244 // Pt = | 1/kappa | (GeV/c)
245 //
246 // Px = -Pt * sin(phi0 + phi)
247 // Py = Pt * cos(phi0 + phi)
248 // Pz = Pt * tan(lambda)
249 //
250 // E = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
251
252 double pt = fabs(m_pt);
253 double px = - pt * sin(m_ac[1] + phi);
254 double py = pt * cos(m_ac[1] + phi);
255 double pz = pt * m_ac[4];
256 double E = sqrt(pt * pt * (1. + m_ac[4] * m_ac[4]) + mass * mass);
257
258 return CLHEP::HepLorentzVector(px, py, pz, E);
259 }

◆ momentum() [3/6]

CLHEP::HepLorentzVector momentum ( double  dPhi,
double  mass,
CLHEP::HepSymMatrix &  Em 
) const

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 263 of file Helix.cc.

264 {
265 //
266 // Calculate momentum.
267 //
268 // Pt = | 1/kappa | (GeV/c)
269 //
270 // Px = -Pt * sin(phi0 + phi)
271 // Py = Pt * cos(phi0 + phi)
272 // Pz = Pt * tan(lambda)
273 //
274 // E = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
275
276 double pt = fabs(m_pt);
277 double px = - pt * sin(m_ac[1] + phi);
278 double py = pt * cos(m_ac[1] + phi);
279 double pz = pt * m_ac[4];
280 double E = sqrt(pt * pt * (1. + m_ac[4] * m_ac[4]) + mass * mass);
281
282 if (m_matrixValid) Em = m_Ea.similarity(del4MDelA(phi, mass));
283 else Em = m_Ea;
284
285 return CLHEP::HepLorentzVector(px, py, pz, E);
286 }
CLHEP::HepMatrix del4MDelA(double phi, double mass) const
Mathmatical functions.
Definition: Helix.cc:671

◆ momentum() [4/6]

CLHEP::HepLorentzVector momentum ( double  dPhi,
double  mass,
HepGeom::Point3D< double > &  x,
CLHEP::HepSymMatrix &  Emx 
) const

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 289 of file Helix.cc.

293 {
294
295 //
296 // Calculate momentum.
297 //
298 // Pt = | 1/kappa | (GeV/c)
299 //
300 // Px = -Pt * sin(phi0 + phi)
301 // Py = Pt * cos(phi0 + phi)
302 // Pz = Pt * tan(lambda)
303 //
304 // E = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
305
306 double pt = fabs(m_pt);
307 double px = - pt * sin(m_ac[1] + phi);
308 double py = pt * cos(m_ac[1] + phi);
309 double pz = pt * m_ac[4];
310 double E = sqrt(pt * pt * (1. + m_ac[4] * m_ac[4]) + mass * mass);
311
312 x.setX(m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] + phi)));
313 x.setY(m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] + phi)));
314 x.setZ(m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi);
315
316 if (m_matrixValid) Emx = m_Ea.similarity(del4MXDelA(phi, mass));
317 else Emx = m_Ea;
318
319 return CLHEP::HepLorentzVector(px, py, pz, E);
320 }
CLHEP::HepMatrix del4MXDelA(double phi, double mass) const
Mathmatical functions.
Definition: Helix.cc:719

◆ momentum() [5/6]

CLHEP::Hep3Vector momentum ( double  dPhi = 0.) const

returns momentum vector after rotating angle dPhi in phi direction.

Definition at line 194 of file Helix.cc.

195 {
196 //
197 // Calculate momentum.
198 //
199 // Pt = | 1/kappa | (GeV/c)
200 //
201 // Px = -Pt * sin(phi0 + phi)
202 // Py = Pt * cos(phi0 + phi)
203 // Pz = Pt * tan(lambda)
204 //
205
206 double pt = fabs(m_pt);
207 double px = - pt * sin(m_ac[1] + phi);
208 double py = pt * cos(m_ac[1] + phi);
209 double pz = pt * m_ac[4];
210
211 return CLHEP::Hep3Vector(px, py, pz);
212 }

◆ momentum() [6/6]

const CLHEP::Hep3Vector & momentum ( void  ) const
inline

returns momentum vector at the entrance.

Definition at line 156 of file WireHitMC.h.

157 {
158 return _momentum;
159 }
CLHEP::Hep3Vector _momentum
momentum
Definition: WireHitMC.h:83

◆ mother()

const TRGCDCTrackMC * mother ( void  ) const
inline

returns a pointer to a mother.

Definition at line 138 of file TrackMC.h.

139 {
140 return _mother;
141 }

◆ move()

void move ( double  x,
double  y 
)
inlineprivate

private member functions

Definition at line 230 of file Lpar.h.

231 {
232 m_gamma += m_kappa * (x * x + y * y) + m_alpha * x + m_beta * y;
233 m_alpha += 2 * m_kappa * x;
234 m_beta += 2 * m_kappa * y;
235 }

◆ nActiveCellsInPattern() [1/2]

unsigned nActiveCellsInPattern ( unsigned  layerId) const
inlinevirtual

of active cells in the pattern.

Definition at line 111 of file HoughPlaneMulti.h.

112 {
113// return _layers[id]->nActiveCellsInPattern();
114 return 999;
115 }

◆ nActiveCellsInPattern() [2/2]

unsigned nActiveCellsInPattern ( void  ) const
inlinevirtual

returns # of active cells in the pattern.

Reimplemented in TRGCDCHoughPlaneMulti.

Definition at line 159 of file HoughPlane.h.

160 {
161 return _nPatterns;
162 }
unsigned _nPatterns
# of curve patterns.
Definition: HoughPlane.h:99

◆ name() [1/32]

std::string name ( const std::string &  newName)
inline

sets and returns name.

Definition at line 192 of file TrackBase.h.

193 {
194 return _name = a;
195 }
std::string _name
Name.
Definition: TrackBase.h:142

◆ name() [2/32]

const std::string & name ( const std::string &  newName)
inline

sets and returns name.

Definition at line 136 of file BitStream.h.

137 {
138 return _name = newName;
139 }

◆ name() [3/32]

const std::string & name ( const std::string &  newName)
inline

sets and returns name.

Definition at line 195 of file Signal.h.

196 {
197 return _name = newName;
198 }

◆ name() [4/32]

const std::string & name ( const std::string &  newName)
inline

sets and returns name.

Definition at line 120 of file SignalBundle.h.

121 {
122 return _name = newName;
123 }

◆ name() [5/32]

const std::string & name ( const std::string &  newName)
inline

sets and returns name.

Definition at line 118 of file SignalVector.h.

119 {
120 return _name = newName;
121 }

◆ name() [6/32]

const std::string & name ( const std::string &  newName)
inline

sets and returns name.

Definition at line 134 of file Time.h.

135 {
136 return _name = a;
137 }

◆ name() [7/32]

const std::string & name ( void  ) const
inline

returns name.

Definition at line 82 of file Fitter.h.

83 {
84 return _name;
85 }
std::string _name
name
Definition: Fitter.h:66

◆ name() [8/32]

std::string name ( void  ) const

Gets name of class.

Definition at line 1553 of file Fitter3D.cc.

1554 {
1555 return m_name;
1556 }
const std::string m_name
Name.
Definition: Fitter3D.h:123

◆ name() [9/32]

std::string name ( void  ) const
inline

returns name.

Definition at line 191 of file HoughFinder.h.

192 {
193 return _name;
194 }
const std::string _name
Name.
Definition: HoughFinder.h:139

◆ name() [10/32]

std::string name ( void  ) const
inline

returns name.

Definition at line 243 of file HoughPlaneBase.h.

244 {
245 return _name;
246 }
const std::string _name
Name.

◆ name() [11/32]

std::string name ( void  ) const
inline

returns name.

Definition at line 74 of file HoughTransformation.h.

75 {
76 return _name;
77 }

◆ name() [12/32]

std::string name ( void  ) const
inline

Operators.

returns name.

Definition at line 205 of file JLUT.h.

206 {
207 return m_name;
208 }

◆ name() [13/32]

const std::string & name ( void  ) const
inline

return name.

Definition at line 264 of file Layer.h.

265 {
266 return _name;
267 }
const std::string _name
Layer name.
Definition: Layer.h:116

◆ name() [14/32]

std::string name ( void  ) const
inline

returns name.

Definition at line 86 of file LUT.h.

87 {
88 return m_name;
89 }
std::string m_name
LUT name.
Definition: LUT.h:78

◆ name() [15/32]

std::string name ( void  ) const
inline

returns name.

Definition at line 82 of file PeakFinder.h.

83 {
84 return _name;
85 }
const std::string _name
Name.
Definition: PeakFinder.h:75

◆ name() [16/32]

std::string name ( void  ) const
inline

returns name.

Definition at line 79 of file PerfectFinder.h.

80 {
81 return _name;
82 }
const std::string _name
Name.
Definition: PerfectFinder.h:66

◆ name() [17/32]

std::string name ( void  ) const
inline

returns name.

Definition at line 185 of file TrackBase.h.

186 {
187 return _name;
188 }

◆ name() [18/32]

std::string name ( void  ) const
inline

returns name.

Definition at line 166 of file TrackMC.h.

167 {
168 return "mc" + TRGUtilities::itostring(id());
169 }

◆ name() [19/32]

string name ( void  ) const

simulates track segment decisions.

returns name.

Definition at line 92 of file TRGCDC.cc.

93 {
94 return "TRGCDC";
95 }

◆ name() [20/32]

string name ( void  ) const

returns name.

Definition at line 54 of file TRGGDL.cc.

55 {
56 return "TRGGDL";
57 }

◆ name() [21/32]

string name ( void  ) const

matching function

returns name.

Definition at line 37 of file TRGGRL.cc.

38 {
39 return "TRGGRL";
40 }

◆ name() [22/32]

const std::string & name ( void  ) const
inline

returns name.

Definition at line 129 of file BitStream.h.

130 {
131 return _name;
132 }

◆ name() [23/32]

const std::string & name ( void  ) const
inline

returns name.

Definition at line 109 of file Board.h.

110 {
111 return _name;
112 }

◆ name() [24/32]

const std::string & name ( void  ) const
inline

returns name.

Definition at line 78 of file Channel.h.

79 {
80 return _name;
81 }
const std::string _name
Name of a channel.
Definition: Channel.h:62

◆ name() [25/32]

const std::string & name ( void  ) const
inline

returns name.

Definition at line 157 of file Clock.h.

158 {
159 return _name;
160 }

◆ name() [26/32]

const std::string & name ( void  ) const
inline

returns name.

Definition at line 80 of file OpticalLink.h.

81 {
82 return _name;
83 }

◆ name() [27/32]

const std::string & name ( void  ) const
inline

returns name.

Definition at line 188 of file Signal.h.

189 {
190 return _name;
191 }

◆ name() [28/32]

const std::string & name ( void  ) const
inline

returns name.

Definition at line 113 of file SignalBundle.h.

114 {
115 return _name;
116 }

◆ name() [29/32]

const std::string & name ( void  ) const
inline

returns name.

Definition at line 111 of file SignalVector.h.

112 {
113 return _name;
114 }

◆ name() [30/32]

const std::string & name ( void  ) const
inline

returns name.

Definition at line 127 of file Time.h.

128 {
129 return _name;
130 }

◆ name() [31/32]

string name ( void  ) const
overridevirtual

returns name.

Implements TRGCDCCell.

Definition at line 141 of file Segment.cc.

142 {
143 string t;
144 if (axial())
145 t = "-";
146 else
147 t = "=";
148 string n0 = string("TS") + TRGUtil::itostring(layerId());
149 string n1 = TRGUtil::itostring(localId());
150 return n0 + t + n1;
151 }

◆ name() [32/32]

string name ( void  ) const
overridevirtual

returns name.

Implements TRGCDCCell.

Definition at line 385 of file Wire.cc.

386 {
387 if (axial())
388 return string("w") +
389 TRGUtil::itostring(layerId()) +
390 string("-") +
391 TRGUtil::itostring(localId());
392 return string("w") +
393 TRGUtil::itostring(layerId()) +
394 string("=") +
395 TRGUtil::itostring(localId());
396 }

◆ nAxialHits()

unsigned nAxialHits ( const std::vector< TRGCDCLink * > &  links)
static

returns # of axial hits.

Definition at line 374 of file Link.cc.

375 {
376 unsigned nLinks = links.size();
377 unsigned n = 0;
378 for (unsigned i = 0; i < nLinks; i++)
379 if (links[i]->cell()->axial())
380 ++n;
381 return n;
382 }

◆ nAxialLayers()

unsigned nAxialLayers ( void  ) const
inline

return # of axial layers.

Definition at line 884 of file TRGCDC.h.

885 {
886 return _axialLayers.size();
887 }

◆ nAxialSuperLayers()

unsigned nAxialSuperLayers ( void  ) const
inline

return # of axial super layers.

Definition at line 891 of file TRGCDC.h.

892 {
893 return _axialSuperLayers.size();
894 }

◆ nCells()

unsigned nCells ( void  ) const
inline

returns # of cells.

Definition at line 194 of file Layer.h.

195 {
196 return _nCells;
197 }

◆ nContributors()

unsigned nContributors ( void  ) const
inline

returns /# of contributors.

Definition at line 97 of file Relation.h.

98 {
99 return _relations.size();
100 }

◆ nEdges()

unsigned nEdges ( void  ) const
inline

returns # of edges.

Definition at line 258 of file Signal.h.

259 {
260 return _history.size();
261 }

◆ neg()

void neg ( )
inline

member functions

Definition at line 242 of file Lpar.h.

243 {
244 m_alpha = -m_alpha;
245 m_beta = -m_beta;
246 m_gamma = -m_gamma;
247 m_kappa = -m_kappa;
248 }

◆ negativeDiverge()

bool negativeDiverge ( float  xReal,
float  yReal,
float  x0,
float  x1 
) const
overridevirtual

returns true if Y diverges in given region.

Implements TRGCDCHoughTransformation.

Definition at line 92 of file HoughTransformationCircle.cc.

96 {
97 return diverge(xReal, yReal, x0, x1);
98 }
virtual bool diverge(float xReal, float yReal, float x0, float x1) const override
returns true if Y diverges in given region.

◆ neighbor() [1/5]

bool neighbor ( const TRGCDCWire w0,
const TRGCDCWire w1 
) const

returns true if w0 and w1 are neighbor.

Definition at line 2030 of file TRGCDC.cc.

2031 {
2032 const int lyr0 = w0.layerId();
2033 const int lyr1 = w1.layerId();
2034 const int lyr = lyr0 - lyr1;
2035
2036 if (abs(lyr) > 1) return false;
2037 if (w0.superLayerId() != w1.superLayerId()) return false;
2038
2039 for (unsigned i = 0; i < 7; i++) {
2040 if (w0.neighbor(i)) {
2041 if (w0.neighbor(i)->id() == w1.id())
2042 return true;
2043 }
2044 }
2045 return false;
2046 }

◆ neighbor() [2/5]

TRGCDCLink * neighbor ( unsigned  n) const
inline

returns neighbor TRGCDCLink.

Definition at line 586 of file Link.h.

587 {
588 if (n < 7)
589 return _neighbor[n];
590 return NULL;
591 }

◆ neighbor() [3/5]

void neighbor ( unsigned  n,
TRGCDCLink neighbor 
)
inline

sets neighbor TRGCDCLink.

Definition at line 578 of file Link.h.

579 {
580 if (n < 7)
581 _neighbor[n] = neighbor;
582 }
TRGCDCLink * neighbor(unsigned n) const
returns neighbor TRGCDCLink.
Definition: Link.h:586

◆ neighbor() [4/5]

unsigned neighbor ( unsigned  serialID,
unsigned  direction 
) const
inline

returns neighbor cell.

Definition at line 423 of file HoughPlaneBase.h.

424 {
425 const unsigned maxi = _nY * _nX;
426 if (dir == 0) { // top
427 if ((id % _nY) != _nY - 1)
428 return id + 1;
429 } else if (dir == 1) { // top right
430 if ((id % _nY) != _nY - 1) {
431 const unsigned i = id + _nY + 1;
432 if (i < maxi)
433 return i;
434 else
435 return i - maxi;
436 }
437 } else if (dir == 2) { // right
438 const unsigned i = id + _nY;
439 if (i < maxi)
440 return i;
441 else
442 return i - maxi;
443 } else if (dir == 3) { // bottom right
444 if ((id % _nY) != 0) {
445 const unsigned i = id + _nY - 1;
446 if (i < maxi)
447 return i;
448 else
449 return i - maxi;
450 }
451 } else if (dir == 4) { // bottom
452 if ((id % _nY) != 0)
453 return id - 1;
454 } else if (dir == 5) { // bottom left
455 if ((id % _nY) != 0) {
456 const int i = id + _nY - 1;
457 if (i > 0)
458 return (unsigned) i;
459 else
460 return (unsigned) i + maxi;
461 }
462 } else if (dir == 6) { // left
463 const int i = id - _nY;
464 if (i > 0)
465 return (unsigned) i;
466 else
467 return (unsigned) i + maxi;
468 } else if (dir == 7) { // top left
469 if ((id % _nY) != _nY - 1) {
470 const int i = id - _nY + 1;
471 if (i > 0)
472 return (unsigned) i;
473 else
474 return (unsigned) i + maxi;
475 }
476 }
477
478 return id;
479 }

◆ neighbor() [5/5]

const TRGCDCWire * neighbor ( unsigned  i) const

returns a pointer to a neighbor wire. This function is expensive.

Definition at line 75 of file Wire.cc.

76 {
77 static bool first = false;
78 if (first)
79 cout << "TRGCDCWire::neighbor !!! "
80 << "this function is not tested yet"
81 << endl;
82
83 const TRGCDC& cdc = * TRGCDC::getTRGCDC();
84 const unsigned layerId = layer().id();
85 const unsigned superLayerId = layer().superLayerId();
86 const unsigned localLayerId = layer().localLayerId();
87 const unsigned nLayers = cdc.superLayer(superLayerId)->size();
88 const int local = int(localId());
89
90 if (i == WireInnerLeft || i == WireInnerRight) {
91 if (localLayerId == 0)
92 return 0;
93 if (layer().offset() != 0) {
94 if (i == WireInnerLeft)
95 return cdc.wire(layerId - 1, local);
96 else
97 return cdc.wire(layerId - 1, local + 1);
98 } else {
99 if (i == WireInnerLeft)
100 return cdc.wire(layerId - 1, local - 1);
101 else
102 return cdc.wire(layerId - 1, local);
103 }
104 } else if (i == WireLeft || i == WireRight) {
105 if (i == WireLeft)
106 return cdc.wire(layerId, local - 1);
107 else
108 return cdc.wire(layerId, local + 1);
109 } else if (i == WireOuterLeft || i == WireOuterRight) {
110 if (localLayerId == (nLayers - 1))
111 return 0;
112 if (layer().offset() != 0) {
113 if (i == WireOuterLeft)
114 return cdc.wire(layerId + 1, local);
115 else
116 return cdc.wire(layerId + 1, local + 1);
117 } else {
118 if (i == WireOuterLeft)
119 return cdc.wire(layerId + 1, local - 1);
120 else
121 return cdc.wire(layerId + 1, local);
122 }
123 }
124 return 0;
125 }
friend class TRGCDC
Complete access from TRGCDC.
Definition: Wire.h:138
#define WireInnerRight
type of the wire
Definition: Wire.h:38
#define WireLeft
type of the wire
Definition: Wire.h:40
#define WireRight
type of the wire
Definition: Wire.h:42
#define WireInnerLeft
type of the wire
Definition: Wire.h:36
#define WireOuterRight
type of the wire
Definition: Wire.h:46
#define WireOuterLeft
type of the wire
Definition: Wire.h:44

◆ neighbors()

std::vector< unsigned > neighbors ( unsigned  serialID,
unsigned  windowSize = 1 
) const
inline

returns neighbors.

Definition at line 377 of file HoughPlaneBase.h.

378 {
379 const int maxi = _nY * _nX;
380 std::vector<unsigned> tmp;
381
382 const int xmin = - (int) windowSize;
383 const int xmax = (int) windowSize;
384 int ymin = - (int) windowSize;
385 int ymax = (int) windowSize;
386
387 unsigned x = 0;
388 unsigned y = 0;
389 id(a, x, y);
390 if (((int) y + ymin) < 0) ymin = - (int) y;
391 if (((int) y + ymax) >= (int) _nY) ymax = _nY - (int) y;
392
393 for (int i = xmin; i <= xmax; i++) {
394 for (int j = ymin; j <= ymax; j++) {
395 int ii = a + i * _nY + j;
396 if (ii == (int) a) continue;
397 if (ii < 0) ii += maxi;
398 if (ii >= maxi) ii -= maxi;
399// tmp.append(ii);
400 tmp.push_back(ii);
401 }
402 }
403 return tmp;
404 }

◆ nHits()

void nHits ( const std::vector< TRGCDCLink * > &  links,
unsigned *  nHits 
)
static

returns # of hits per layer.

Definition at line 125 of file Link.cc.

126 {
127 for (unsigned i = 0; i < _nL; i++)
128 nHits[i] = 0;
129 unsigned nLinks = links.size();
130 for (unsigned i = 0; i < nLinks; i++)
131 ++nHits[links[i]->cell()->layerId()];
132 }
static void nHits(const std::vector< TRGCDCLink * > &links, unsigned *nHits)
returns # of hits per layer.
Definition: Link.cc:125

◆ nHitsSuperLayer() [1/2]

void nHitsSuperLayer ( const std::vector< TRGCDCLink * > &  links,
std::vector< TRGCDCLink * > *  list 
)
static

returns hits list per super layer.

Definition at line 761 of file Link.cc.

762 {
763 const unsigned nLinks = links.size();
764 for (unsigned i = 0; i < nLinks; i++)
765 list[links[i]->cell()->superLayerId()].push_back(links[i]);
766 }

◆ nHitsSuperLayer() [2/2]

void nHitsSuperLayer ( const std::vector< TRGCDCLink * > &  links,
unsigned *  nHits 
)
static

returns # of hits per super layer.

Definition at line 135 of file Link.cc.

136 {
137 for (unsigned i = 0; i < _nSL; i++)
138 nHits[i] = 0;
139 const unsigned nLinks = links.size();
140 for (unsigned i = 0; i < nLinks; i++)
141 ++nHits[links[i]->cell()->superLayerId()];
142 }

◆ nInput()

unsigned nInput ( void  ) const
inline

returns input channels.

Definition at line 172 of file Board.h.

173 {
174 return _inputChannels.size();
175 }

◆ nLayers() [1/3]

unsigned nLayers ( const std::vector< TRGCDCLink * > &  links)
static

returns # of layers.

Definition at line 105 of file Link.cc.

106 {
107 unsigned l0 = 0;
108 unsigned l1 = 0;
109 unsigned n = list.size();
110 for (unsigned i = 0; i < n; i++) {
111 unsigned id = list[i]->cell()->layerId();
112 if (id < 32) l0 |= (1u << id);
113 else l1 |= (1 << (id - 32));
114 }
115
116 unsigned l = 0;
117 for (unsigned i = 0; i < 32; i++) {
118 if (l0 & (1u << i)) ++l;
119 if (l1 & (1u << i)) ++l;
120 }
121 return l;
122 }

◆ nLayers() [2/3]

unsigned nLayers ( void  ) const
inline

returns # of Hough Boolean layers.

Definition at line 253 of file HoughPlaneMulti2.h.

254 {
255 return _nLayers;
256 }

◆ nLayers() [3/3]

unsigned nLayers ( void  ) const
inline

return # of layers.

Definition at line 905 of file TRGCDC.h.

906 {
907 return _layers.size();
908 }

◆ nLocalLayers()

unsigned nLocalLayers ( unsigned  superLayerId) const
inline

returns # of wire layers in a super layer.

0 will be returned if 'superLayerId' is invalid.

Definition at line 819 of file TRGCDC.h.

820 {
821 std::vector<TRGCDCLayer*>* superLayer = _superLayers[superLayerId];
822 if (! superLayer) return 0;
823 return superLayer->size();
824 }

◆ nMissingAxialSuperLayers()

unsigned nMissingAxialSuperLayers ( const std::vector< TRGCDCLink * > &  links)
static

returns # of missing axial super layers.

Stereo super layers are not taken into accout.

Definition at line 699 of file Link.cc.

700 {
702 const unsigned n = links.size();
703// unsigned nHits[6] = {0, 0, 0, 0, 0, 0};
704 for (unsigned i = 0; i < n; i++)
705 if (links[i]->cell()->axial())
706 ++_nHitsSL[links[i]->cell()->axialStereoSuperLayerId()];
707// ++nHits[links[i]->cell()->superLayerId() / 2];
708 unsigned j = 0;
709 while (_nHitsSL[j] == 0) ++j;
710 unsigned nMissing = 0;
711 unsigned nMax = 0;
712 for (unsigned i = j; i < _nSLA; i++) {
713 if (+_nHitsSL[i] == 0) ++nMissing;
714 else {
715 if (nMax < nMissing) nMax = nMissing;
716 nMissing = 0;
717 }
718 }
719 return nMax;
720 }
static void clearBufferSL(void)
clear buffers
Definition: Link.h:677

◆ nOutput()

unsigned nOutput ( void  ) const
inline

returns output channels.

Definition at line 180 of file Board.h.

181 {
182 return _outputChannels.size();
183 }

◆ nSegmentLayers()

unsigned nSegmentLayers ( void  ) const
inline

returns # of track segment layers.

Definition at line 1070 of file TRGCDC.h.

1071 {
1072 return _tsLayers.size();
1073 }

◆ nSegments() [1/2]

unsigned nSegments ( unsigned  id) const

returns # of track segments in a layer.

Definition at line 2821 of file TRGCDC.cc.

2822 {
2823 if (id < _tsLayers.size())
2824 return _tsLayers[id]->size();
2825 return 0;
2826 }

◆ nSegments() [2/2]

unsigned nSegments ( void  ) const
inline

returns # of track segments.

Definition at line 954 of file TRGCDC.h.

955 {
956 return _tss.size();
957 }

◆ nShifts()

int nShifts ( void  ) const
inline

returns shifts. (non-zero for stereo layers)

Definition at line 187 of file Layer.h.

188 {
189 return _nShifts;
190 }

◆ nSignals()

unsigned nSignals ( void  ) const
inline

returns # of signals.

Definition at line 251 of file Signal.h.

252 {
253 return _history.size() / 2;
254 }

◆ nStereoHits()

unsigned nStereoHits ( const std::vector< TRGCDCLink * > &  links)
static

returns # of stereo hits.

Definition at line 363 of file Link.cc.

364 {
365 unsigned nLinks = links.size();
366 unsigned n = 0;
367 for (unsigned i = 0; i < nLinks; i++)
368 if (links[i]->cell()->stereo())
369 ++n;
370 return n;
371 }

◆ nStereoLayers()

unsigned nStereoLayers ( void  ) const
inline

returns # of stereo layers.

Definition at line 877 of file TRGCDC.h.

878 {
879 return _stereoLayers.size();
880 }

◆ nStereoSuperLayers()

unsigned nStereoSuperLayers ( void  ) const
inline

returns # of stereo super layers.

Definition at line 898 of file TRGCDC.h.

899 {
900 return _stereoSuperLayers.size();
901 }

◆ nSuperLayers() [1/3]

unsigned nSuperLayers ( const std::vector< TRGCDCLink * > &  links)
static

returns # of layers.

Definition at line 668 of file Link.cc.

669 {
670 unsigned l0 = 0;
671 unsigned n = list.size();
672 for (unsigned i = 0; i < n; i++) {
673 unsigned id = list[i]->cell()->superLayerId();
674 l0 |= (1 << id);
675 }
676
677 unsigned l = 0;
678 for (unsigned i = 0; i < _nSL; i++) {
679 if (l0 & (1 << i)) ++l;
680 }
681 return l;
682 }

◆ nSuperLayers() [2/3]

unsigned nSuperLayers ( const std::vector< TRGCDCLink * > &  links,
unsigned  minNHits 
)
static

returns # of layers.

Definition at line 685 of file Link.cc.

686 {
688 unsigned n = links.size();
689 for (unsigned i = 0; i < n; i++)
690 ++_nHitsSL[links[i]->cell()->superLayerId()];
691 unsigned sl = 0;
692 for (unsigned i = 0; i < _nSL; i++)
693 if (_nHitsSL[i] >= minN)
694 ++sl;
695 return sl;
696 }

◆ nSuperLayers() [3/3]

unsigned nSuperLayers ( void  ) const
inline

returns # of super layers.

Definition at line 870 of file TRGCDC.h.

871 {
872 return _superLayers.size();
873 }

◆ nTSF() [1/2]

unsigned nTSF ( unsigned  i)
inlinestatic

returns # of TSF in super layer i. (i=0 to 4)

Definition at line 122 of file Tracker2D.h.

123 {
124 if (i == 0)
125 return 160;
126 else if (i == 1)
127 return 192;
128 else if (i == 2)
129 return 256;
130 else if (i == 3)
131 return 320;
132 else if (i == 4)
133 return 384;
134 else
135 return 0;
136 }

◆ nTSF() [2/2]

unsigned nTSF ( void  )
inlinestatic

returns # of TSF.

Definition at line 115 of file Tracker2D.h.

116 {
117 return 160 + 192 + 256 + 320 + 384;
118 }

◆ nWires()

unsigned nWires ( void  ) const
inline

return # of wires.

Definition at line 863 of file TRGCDC.h.

864 {
865 return _wires.size();
866 }

◆ nX()

unsigned nX ( void  ) const
inline

returns # of x bins.

Definition at line 250 of file HoughPlaneBase.h.

251 {
252 return _nX;
253 }

◆ nY()

unsigned nY ( void  ) const
inline

return # of y bins.

Definition at line 296 of file HoughPlaneBase.h.

297 {
298 return _nY;
299 }

◆ objectType() [1/2]

unsigned objectType ( void  ) const
inlinevirtual

returns object type.

Reimplemented in TRGCDCCircle.

Definition at line 241 of file TrackBase.h.

242 {
243 return TRGCDCTrackBaseType;
244 }

◆ objectType() [2/2]

unsigned objectType ( void  ) const
inlineoverridevirtual

returns type.

Reimplemented from TRGCDCTrackBase.

Definition at line 120 of file Circle.h.

121 {
122 return TRGCDCCircleType;
123 }

◆ offset() [1/3]

TRGCDCJSignal const offset ( TRGCDCJSignal const &  valueMin) const

Outputs an offset signal which is an unsigned signal.

Definition at line 592 of file JSignal.cc.

593 {
594 TRGCDCJSignal t_offset = *this - valueMin;
595 // Need to find minimum bitsize
596 t_offset.m_bitsize = t_offset.calBitwidth();
597 if (t_offset.calType() != 1) cout << "[Error] TRGCDCJSignal::offset() => t_offset min value below 0. " << endl;
598 t_offset.m_type = 1;
599 // Check if there is overflow or underflow
600 t_offset.checkInt("TRGCDCJSignal::offset()");
601 // Reset vhdlCode.
602 if (getPrintVhdl() == 1) vhdlCode(*this, "-", valueMin, t_offset, t_offset.m_vhdlCode);
603 return t_offset;
604 }

◆ offset() [2/3]

float offset ( void  ) const
inline

returns offset.

Definition at line 180 of file Layer.h.

181 {
182 return _offset;
183 }
const float _offset
Cell position offset from X axis in cell unit.
Definition: Layer.h:134

◆ offset() [3/3]

double offset ( void  ) const
inline

returns offset of the clock zero position in nano second.

Definition at line 150 of file Clock.h.

151 {
152 return _offset;
153 }

◆ oldVer()

void oldVer ( void  )

old version of calculation function

Definition at line 181 of file EventTime.cc.

182 {
183 TRGDebug::enterStage("Event Time");
184 m_histT = 65535;
185 for (unsigned i = 0; i < _cdc.nSegmentLayers(); i++) {
187 const unsigned nWires = l->nCells();
188 for (unsigned j = 0; j < nWires; j++) {
189 const TCSegment& s = (TCSegment&) * (*l)[j];
190 const vector<const TCWire*>& wires = s.wires();
191 const TRGSignal& timing = s.signal();
192 if (timing.active()) {
193 for (unsigned k = 0; k < wires.size(); k++) {
194 if (wires[k]->hit()) {
195 int dt = wires[k]->signal()[0]->time();
196 if (m_histT > dt) {
197 m_histT = dt;
198 m_foundT0 = 1;
199 m_evtOut->Fill();
200 }
201 }
202 }
203 }
204 }
205 }
206 TRGDebug::leaveStage("Event Time");
207 }//end of TRTGCDCEventTime::oldVer

◆ operate() [1/2]

TRGCDCJSignal const operate ( const TRGCDCJSignal in,
TRGCDCJSignal out 
)

Returns LUT value. Out is LUT value + offset. (LUT value + offset do not obey addition bitsize rules.)

Definition at line 500 of file JLUT.cc.

501 {
502
503 //cout<<"Operate start"<<endl;
504
505 Belle2::TRGCDCJSignal t_offsetInput;
506 // Offset input. (If needed)
507 if (m_inputMin.getInt() != 0) {
508 //t_offsetInput = in.offset(m_inputMin, m_inputMax);
509 t_offsetInput = in.offset(m_inputMin);
510 } else {
511 t_offsetInput = in;
512 }
513 if (t_offsetInput.getMinInt() != 0) {
514 cout << "[Warning] TRGCDCJLUT::operate() => Offsetted input minInt is not 0." << endl;
515 }
516
517 //cout<<"in"<<endl;
518 //in.dump();
523 //cout<<"m_inputMin"<<endl;
524 //m_inputMin.dump();
525 //cout<<"t_offsetInput"<<endl;
526 //t_offsetInput.dump();
527
528 // Set m_shiftOffsetInput.
529 // [TODO] Change to constructor?
530 m_shiftOffsetInput.setName("lut_" + out.getName() + "_in");
531 // To remove warning of no m_commonData.
533
534 // Shift input (If needed)
535 string t_shiftOffsetInputCode = "";
537 t_offsetInput.calFinishClock(), t_shiftOffsetInputCode);
538 else m_shiftOffsetInput.assignTo(Belle2::TRGCDCJSignal::toSlv(t_offsetInput), t_offsetInput.calFinishClock(),
539 t_shiftOffsetInputCode);
540 m_shiftOffsetInput.setPrintVhdl(in.getPrintVhdl());
541 m_shiftOffsetInput.setVhdlOutputFile(in.getVhdlOutputFile());
542
543 //cout<<"m_inputShiftBits"<<endl;
544 //cout<<m_inputShiftBits<<endl;
545 //cout<<"m_offsetShiftInput"<<endl;
546 //m_shiftOffsetInput.dump();
547
548 // Get output of LUT and invOffset it.
549 signed long long intOutput = getOutput(m_shiftOffsetInput.getInt());
550 //signed long long intOutput = getOutput(in.getInt());
551 int t_finishClock;
552 // Create offsetted output signal.
553 double t_actual = getFloatOutput(in.getActual()) - m_shiftOutputMin.getActual();
554 TRGCDCJSignalData* t_commonData = in.getCommonData();
555 t_finishClock = in.getFinishClock() + 1;
556 Belle2::TRGCDCJSignal t_offsetOutput(intOutput, m_shiftOutputMin.getToReal(), 0, m_shiftOffsetOutputMax.getInt(), t_actual, 0,
557 m_shiftOffsetOutputMax.getActual(), t_finishClock, t_commonData, 1);
558 t_offsetOutput.setName("lut_" + out.getName() + "_out");
559
561 //cout<<"t_offsetOutput"<<endl;
562 //t_offsetOutput.dump();
568
569 //out <= t_offsetOutput.invOffset(m_shiftOutputMin,m_shiftOutputMin+m_shiftOffsetOutputMax);
570 out <= t_offsetOutput.invOffset(m_shiftOutputMin);
571
572 //cout<<"m_shiftOutputMin"<<endl;
573 //m_shiftOutputMin.dump();
574 //cout<<"out"<<endl;
575 //out.dump();
576
577 // Print Vhdl code.
578 if (out.getPrintVhdl() == 1) {
579 string t_finalCode = lutVhdlCode(t_shiftOffsetInputCode);
580 out.getCommonData()->setVhdlOutProcess(out.getCommonData()->getVhdlOutProcess() + t_finalCode);
581 // Fill signal map for definition.
582 {
583 map<string, vector<int> >& t_signals = out.getCommonData()->m_signals;
584 if (!t_signals.count(t_offsetOutput.getName())) {
585 t_signals[t_offsetOutput.getName()] = {t_offsetOutput.getType(), (int)t_offsetOutput.getBitsize()};
586 }
587 }
588 }
589
590 //cout<<"Operate end"<<endl;
591
592 // LUT result value
593 return t_offsetOutput;
594 }
TRGCDCJSignal m_shiftOffsetInput
The bt shifted offset signal of input.
Definition: JLUT.h:197
void setCommonData(TRGCDCJSignalData *)
Sets JSignalData to signal.
Definition: JSignal.cc:1357
TRGCDCJSignal const offset(TRGCDCJSignal const &valueMin) const
Outputs an offset signal which is an unsigned signal.
Definition: JSignal.cc:592
TRGCDCJSignalData * getCommonData() const
Get the sharged JSignalData.
Definition: JSignal.cc:1437
static TRGCDCJSignal const toSlv(TRGCDCJSignal const &in, int test)
Change signal to std_logic_vector using vector<bool>. (Will be deprecated.)
Definition: JSignal.cc:1121
void setVhdlOutputFile(const std::string &filename)
Sets ouptut VHDL filename.
Definition: JSignal.cc:1349
double getFloatOutput(double) const
get output using float values.
Definition: JLUT.cc:408
void setName(const std::string &name)
Setters, Getters Sets name of signal.
Definition: JSignal.cc:1298
int getOutput(int) const
get output using int values.
Definition: JLUT.cc:403
void setPrintVhdl(bool printVhdl)
Sets print flag for signal.
Definition: JSignal.cc:1341
std::string const lutVhdlCode(std::string const &shiftOffsetInput) const
Creates vhdlCode for lut.
Definition: JLUT.cc:596
int calFinishClock() const
Claculates the clock tick where the signal is valid.
Definition: JSignal.cc:1477
signed long long getMinInt() const
Get minimum integer value of signal.
Definition: JSignal.cc:1382

◆ operate() [2/2]

string operate ( std::string  out,
std::string  in,
std::map< std::string, std::map< std::string, double > * > &  m_intStorage 
)

Operate on LUT. (Will be deprecated.)

Definition at line 475 of file JLUT.cc.

477 {
478 double floatInput = (*m_intStorage["int"])[in] + m_inputOffset;
479 floatInput *= m_inputToReal;
480 // Make offset value.
481 stringstream t_offsetName;
482 t_offsetName << out << "_o" << m_outputOffset;
483 (*m_intStorage["type"])[t_offsetName.str()] = 1;
484 (*m_intStorage["bitSize"])[t_offsetName.str()] = m_outputBitsize;
485 (*m_intStorage["toReal"])[t_offsetName.str()] = m_toReal;
486 (*m_intStorage["real"])[t_offsetName.str()] = getFloatOutput(floatInput) - m_outputOffset * m_toReal;
487 (*m_intStorage["int"])[t_offsetName.str()] = getOutput((*m_intStorage["int"])[in]);
488 (*m_intStorage["realInt"])[t_offsetName.str()] = (*m_intStorage["int"])[t_offsetName.str()] * m_toReal;
489 // Make no offset value.
490 (*m_intStorage["type"])[out] = m_outputType;
491 (*m_intStorage["bitSize"])[out] = m_outputNBitsWithOffset;
492 (*m_intStorage["toReal"])[out] = m_toReal;
493 (*m_intStorage["real"])[out] = getFloatOutput(floatInput);
494 (*m_intStorage["int"])[out] = getOutput((*m_intStorage["int"])[in]) + m_outputOffset;
495 (*m_intStorage["realInt"])[out] = (*m_intStorage["int"])[out] * m_toReal;;
496
497 return t_offsetName.str();
498 }

◆ operator delete() [1/3]

void operator delete ( void *  t)
static

delete operator.

Definition at line 869 of file Link.cc.

870 {
871 for (vector<TRGCDCLink*>::iterator it = _all.begin();
872 it != _all.end();
873 ++it) {
874 if ((* it) == static_cast<TRGCDCLink*>(t)) {
875 _all.erase(it);
876 break;
877 }
878 }
879 free(t);
880
881// cout << "<---------------------" << endl;
882// cout << "==> " << t << " erased" << endl;
883// for (unsigned i = 0; i < _all.size(); i++)
884// cout << "< " << i << " " << _all[i] << endl;
885 }
static std::vector< TRGCDCLink * > _all
Keeps all TRGCDCLinks created by new().
Definition: Link.h:348

◆ operator delete() [2/3]

void operator delete ( void *  t)
static

delete operator.

Definition at line 104 of file SegmentHit.cc.

105 {
106 for (vector<TRGCDCSegmentHit*>::iterator it = _all.begin();
107 it != _all.end();
108 ++it) {
109 if ((* it) == static_cast<TRGCDCSegmentHit*>(t)) {
110 _all.erase(it);
111 break;
112 }
113 }
114 free(t);
115
116// cout << "<---------------------" << endl;
117// cout << "==> " << t << " erased" << endl;
118// for (unsigned i = 0; i < _all.size(); i++)
119// cout << "< " << i << " " << _all[i] << endl;
120 }
TRGCDCSegmentHit(const TRGCDCSegment &)
Constructor.
Definition: SegmentHit.cc:32
static std::vector< TRGCDCSegmentHit * > _all
Keeps all TRGCDCSegmentHit created by new().
Definition: SegmentHit.h:73

◆ operator delete() [3/3]

void operator delete ( void *  t)
static

delete operator.

Definition at line 98 of file WireHit.cc.

99 {
100 for (vector<TRGCDCWireHit*>::iterator it = _all.begin();
101 it != _all.end();
102 ++it) {
103 if ((* it) == static_cast<TRGCDCWireHit*>(t)) {
104 _all.erase(it);
105 break;
106 }
107 }
108 free(t);
109
110// cout << "<---------------------" << endl;
111// cout << "==> " << t << " erased" << endl;
112// for (unsigned i = 0; i < _all.size(); i++)
113// cout << "< " << i << " " << _all[i] << endl;
114 }
static std::vector< TRGCDCWireHit * > _all
Keeps all TRGCDCWireHit created by new().
Definition: WireHit.h:83
TRGCDCWireHit(const TRGCDCWire &, unsigned indexCDCHit=0, unsigned indexCDCSimHit=0, unsigned indexMCParticle=0, float driftLeft=0, float driftLeftError=0, float driftRight=0, float driftRightError=0, int mcLRflag=1, float fudgeFacgtor=1)
Constructor.
Definition: WireHit.cc:30

◆ operator new() [1/3]

void * operator new ( size_t  size)
static

new operator.

Definition at line 856 of file Link.cc.

857 {
858 void* p = malloc(size);
859 _all.push_back(static_cast<TRGCDCLink*>(p));
860
861// cout << ">---------------------" << endl;
862// for (unsigned i = 0; i < _all.size(); i++)
863// cout << "> " << i << " " << _all[i] << endl;
864
865 return p;
866 }

◆ operator new() [2/3]

void * operator new ( size_t  size)
static

new operator.

Definition at line 91 of file SegmentHit.cc.

92 {
93 void* p = malloc(size);
94 _all.push_back(static_cast<TRGCDCSegmentHit*>(p));
95
96// cout << ">---------------------" << endl;
97// for (unsigned i = 0; i < _all.size(); i++)
98// cout << "> " << i << " " << _all[i] << endl;
99
100 return p;
101 }

◆ operator new() [3/3]

void * operator new ( size_t  size)
static

new operator.

Definition at line 85 of file WireHit.cc.

86 {
87 void* p = malloc(size);
88 _all.push_back(static_cast<TRGCDCWireHit*>(p));
89
90// cout << ">---------------------" << endl;
91// for (unsigned i = 0; i < _all.size(); i++)
92// cout << "> " << i << " " << _all[i] << endl;
93
94 return p;
95 }

◆ operator std::string()

operator std::string ( ) const
inline

Conversion to string.

Definition at line 235 of file State.h.

236 {
237 unsigned nWords = _size / _bsu;
238 if (_size % _bsu) ++nWords;
239 unsigned lastNHex = (_size % _bsu);
240 if (lastNHex == 0) lastNHex = 8;
241 else {
242 lastNHex = lastNHex / 4;
243 if ((_size % _bsu) % 4) ++lastNHex;
244 }
245 std::stringstream t_stringstream;
246 t_stringstream << std::setw(lastNHex) << std::setfill('0') << std::hex << _state[nWords - 1];
247 for (unsigned iWord = 1; iWord < nWords; iWord++) {
248 t_stringstream << std::setw(8) << std::setfill('0') << std::hex << _state[nWords - 1 - iWord];
249 }
250 return t_stringstream.str();
251 }

◆ operator unsigned()

operator unsigned ( ) const
inline

Conversion to unsigned.

Definition at line 196 of file State.h.

197 {
198#ifdef TRG_DEBUG
199 unsigned n = _size / _bsu;
200 if (_size % _bsu) ++n;
201 if (n > 1)
202 std::cout << "TRGState::operator unsigned() !!! bit size overflow"
203 << ":bit size=" << _size << ",max bit size with unsigned="
204 << _bsu << std::endl;
205#endif
206 return _state[0];
207
208 }

◆ operator unsigned long long()

operator unsigned long long ( ) const
inline

Conversion to unsigned long long.

Definition at line 211 of file State.h.

212 {
213 unsigned n = _size / _bsu;
214 if (_size % _bsu) ++n;
215 const unsigned c = sizeof(unsigned long long);
216 if (n > c)
217#ifdef TRG_DEBUG
218 std::cout << "TRGState::operator unsigned long long() "
219 << "!!! bit size overflow"
220 << ":bit size=" << _size
221 << ",max bit size with unsigned long long="
222 << c << std::endl;
223#endif
224 n = c;
225 unsigned long long a = 0;
226 const unsigned s = _bsu;
227 for (unsigned i = 0; i < n; i++) {
228 const unsigned long long b = _state[i];
229 a += b << (i * s);
230 }
231 return a;
232 }

◆ operator!=() [1/3]

bool operator!= ( const TRGSignal a) const
inline

returns true if two are the same.

Definition at line 338 of file Signal.h.

339 {
340 return (! operator==(a));
341 }

◆ operator!=() [2/3]

bool operator!= ( const TRGSignalVector a) const
inline

compare two TRGSignalVectors.

Definition at line 132 of file SignalVector.h.

133 {
134 return (! operator==(a));
135 }

◆ operator!=() [3/3]

bool operator!= ( const TRGTime a) const
inline

returns false if two are the same.

Definition at line 196 of file Time.h.

197 {
198 return (! operator==(a));
199 }

◆ operator&() [1/4]

TRGSignal operator& ( const TRGSignal left) const

returns AND result.

Definition at line 165 of file Signal.cc.

166 {
167
168 //...Collect state changes...
169 vector<int> sc0 = stateChanges();
170 vector<int> sc1 = left.stateChanges();
171 sc0.insert(sc0.end(), sc1.begin(), sc1.end());
172
173 //...Sorting...
174 std::sort(sc0.begin(), sc0.end());
175
176 //...Remove multiple same clock...
177 vector<int> sc2;
178 int last = _clock->min();
179 for (unsigned i = 0; i < sc0.size(); i++) {
180 const int j = sc0[i];
181 if (j != last) {
182 sc2.push_back(j);
183 last = j;
184 }
185 }
186
187 //...Make a new signal...
188 string name = "(" + _name + ")&(" + left._name + ")";
189 TRGSignal t(name, * _clock);
190 bool active = false;
191 for (unsigned i = 0; i < sc2.size(); i++) {
192 const int j = sc2[i];
193 if ((! active) and state(j) and left.state(j)) {
194 active = true;
195 t._history.push_back(TRGTime(j, true, * _clock));
196 } else if (active and ((! state(j)) or (! left.state(j)))) {
197 active = false;
198 t._history.push_back(TRGTime(j, false, * _clock));
199 }
200 }
201
202#if TRG_DEBUG
204#endif
205
206 return t;
207 }
TRGSignal(const TRGClock &=Belle2_GDL::GDLSystemClock)
Constructor.
Definition: Signal.cc:23
bool state(int clockPosition) const
returns true if signal is active in given clock position.
Definition: Signal.h:286

◆ operator&() [2/4]

TRGSignal operator& ( const TRGSignal left) const

adding two TRGTime. A result is TRGSignal.

Definition at line 65 of file Time.cc.

66 {
67 TRGSignal t0(* this);
68 return t0 & left;
69 }

◆ operator&() [3/4]

TRGSignal operator& ( const TRGTime l) const
inline

returns AND result.

Definition at line 202 of file Signal.h.

203 {
204 TRGSignal t(* this);
205 TRGSignal left(l);
206 return t & left;
207 }

◆ operator&() [4/4]

TRGSignal operator& ( const TRGTime left) const

adding two TRGTime. A result is TRGSignal.

Definition at line 57 of file Time.cc.

58 {
59 TRGSignal t0(* this);
60 TRGSignal t1(left);
61 return t0 & t1;
62 }

◆ operator&=() [1/2]

TRGSignal & operator&= ( const TRGSignal left)

returns AND result.

Definition at line 210 of file Signal.cc.

211 {
212 TRGSignal t = (* this) & left;
213
214 _history.clear();
215 _history = t._history;
216
217#if TRG_DEBUG
219#endif
220
221 return * this;
222 }

◆ operator&=() [2/2]

TRGSignal & operator&= ( const TRGTime l)
inline

returns AND result.

Definition at line 211 of file Signal.h.

212 {
213 TRGSignal left(l);
214
215#if TRG_DEBUG
217#endif
218
219 return (* this) &= left;
220 }

◆ operator*()

TRGCDCJSignal const operator* ( TRGCDCJSignal const &  rhs) const

Arithmetic multiply operator.

Definition at line 432 of file JSignal.cc.

433 {
434
435 // Shift values if input bit size is larger then signed 25 bits * signed 18 bits (unsigned 24 bits * unsigned 17 bits)
436 // Find largest and second bitsize.
437 TRGCDCJSignal t_large(*this);
438 TRGCDCJSignal t_small(rhs);
439
440 //if(t_large.m_type==2 || t_small.m_type==2) {
441 // cout<<"[Error] TRGCDCJSignal::operator*() => should not be used with slv type."<<endl;
442 //}
443
444 if (t_large.m_argumentSignals.size() == 0) t_large.initArgumentSignals();
445 if (t_small.m_argumentSignals.size() == 0) t_small.initArgumentSignals();
446
447 if (m_debug == 1) {
448 cout << "TRGCDCJSignal::operator*=()" << endl;
449 cout << "<<<Input lhs>>>" << endl;
450 t_large.dump();
451 cout << "<<<Input lhs>>>" << endl;
452 cout << "<<<Input rhs>>>" << endl;
453 t_small.dump();
454 cout << "<<<Input rhs>>>" << endl;
455 }
456 bool orderSwap = orderLargestBitsize(t_large, t_small);
457 int nBitsLargeShift = 0;
458 int nBitsSmallShift = 0;
459 // Shift if needed.
460 if (t_large.m_type == 1) {
461 if (t_large.m_bitsize > 24) {
462 nBitsLargeShift = t_large.m_bitsize - 24;
463 t_large = t_large.shift(nBitsLargeShift, 0);
464 }
465 } else {
466 if (t_large.m_bitsize > 25) {
467 nBitsLargeShift = t_large.m_bitsize - 25;
468 t_large = t_large.shift(nBitsLargeShift, 0);
469 }
470 }
471 if (t_small.m_type == 1) {
472 if (t_small.m_bitsize > 17) {
473 nBitsSmallShift = t_small.m_bitsize - 17;
474 t_small = t_small.shift(nBitsSmallShift, 0);
475 }
476 } else {
477 if (t_small.m_bitsize > 18) {
478 nBitsSmallShift = t_small.m_bitsize - 18;
479 t_small = t_small.shift(nBitsSmallShift, 0);
480 }
481 }
482 if (m_debug == 1) {
483 cout << "<<<";
484 if (orderSwap) cout << nBitsSmallShift << " bit right shifted input lhs>>>" << endl;
485 else cout << nBitsLargeShift << " bit right shifted input lhs>>>" << endl;
486 if (orderSwap) t_small.dump();
487 else t_large.dump();
488 cout << "<<<Shifted input lhs>>>" << endl;
489 cout << "<<<";
490 if (orderSwap) cout << nBitsLargeShift << " bit right shifted input rhs>>>" << endl;
491 else cout << nBitsSmallShift << " bit right shifted input rhs>>>" << endl;
492 if (orderSwap) t_large.dump();
493 else t_small.dump();
494 cout << "<<<Shifted input rhs>>>" << endl;
495 }
496
497 // To save debug
498 TRGCDCJSignal t_result(t_large);
499 combineArguments(t_large, t_small, t_result);
500 // Set name
501 t_result.m_name = t_large.m_name + "*" + t_small.m_name;
502 // Multiply values.
503 t_result.m_int = t_large.m_int * t_small.m_int;
504 t_result.m_actual = t_large.m_actual * t_small.m_actual;
505
506 if (isSameSignal(*this, rhs)) {
507 if (t_large.m_minInt >= 0 && t_small.m_minInt >= 0) t_result.m_minInt = t_large.m_minInt * t_small.m_minInt;
508 else t_result.m_minInt = 0;
509 if (t_large.m_minActual >= 0 && t_small.m_minActual >= 0) t_result.m_minActual = t_large.m_minActual * t_small.m_minActual;
510 else t_result.m_minActual = 0;
511 } else {
512 if (t_large.m_minInt >= 0 && t_small.m_minInt >= 0) t_result.m_minInt = t_large.m_minInt * t_small.m_minInt;
513 else t_result.m_minInt = min(t_large.m_minInt * t_small.m_maxInt, t_large.m_maxInt * t_small.m_minInt);
514 if (t_large.m_minActual >= 0 && t_small.m_minActual >= 0) t_result.m_minActual = t_large.m_minActual * t_small.m_minActual;
515 else t_result.m_minActual = min(t_large.m_minActual * t_small.m_maxActual, t_large.m_maxActual * t_small.m_minActual);
516 }
517 t_result.m_maxInt = max(t_large.m_maxInt * t_small.m_maxInt, t_large.m_minInt * t_small.m_minInt);
518 t_result.m_maxActual = max(t_large.m_maxActual * t_small.m_maxActual, t_large.m_minActual * t_small.m_minActual);
519
520 // Set unit
521 t_result.m_toReal = t_large.m_toReal * t_small.m_toReal;
522 // Calculate bitsize and type.
523 t_result.m_type = t_result.calType();
524 t_result.m_bitsize = t_result.calBitwidth();
525 // Check for overflow underflow.
526 t_result.checkInt("TRGCDCJSignal::operator*");
527 if (m_debug == 1) {
528 cout << "<<<Output>>>" << endl;
529 t_result.dump();
530 cout << "<<<Output>>>" << endl;
531 cout << "TRGCDCJSignal::operator*=()" << endl;
532 }
533
534 if (getPrintVhdl() == 1) vhdlCode(t_large, "*", t_small, t_result, t_result.m_vhdlCode);
535
536 return t_result;
537 }
bool orderLargestBitsize(TRGCDCJSignal &large, TRGCDCJSignal &small) const
Orders the TRGCDCJSignals by bitsize. Next priority is unsigned, signed, minus unsigned....
Definition: JSignal.cc:1515
static bool isSameSignal(TRGCDCJSignal const &lhs, TRGCDCJSignal const &rhs)
Checks if signal is same signal.
Definition: JSignal.cc:2201

◆ operator+() [1/3]

TRGCDCLpav operator+ ( const TRGCDCLpav la1,
const TRGCDCLpav la2 
)
  • operator

Definition at line 676 of file Lpav.cc.

679 {
680#else
681 {
682 TRGCDCLpav la;
683#endif
684 la.m_wsum = la1.m_wsum + la2.m_wsum;
685 la.m_xsum = la1.m_xsum + la2.m_xsum;
686 la.m_ysum = la1.m_ysum + la2.m_ysum;
687 la.m_xxsum = la1.m_xxsum + la2.m_xxsum;
688 la.m_yysum = la1.m_yysum + la2.m_yysum;
689 la.m_xysum = la1.m_xysum + la2.m_xysum;
690 la.m_xrrsum = la1.m_xrrsum + la2.m_xrrsum;
691 la.m_yrrsum = la1.m_yrrsum + la2.m_yrrsum;
692 la.m_rrrrsum = la1.m_rrrrsum + la2.m_rrrrsum;
693 la.m_nc = la1.m_nc + la2.m_nc;
694 return la;
695 }

◆ operator+() [2/3]

TRGPoint2D operator+ ( const TRGPoint2D a) const
inline
  • operator

Definition at line 158 of file Point2D.h.

159 {
160 return TRGPoint2D(_p[0] + a.x(), _p[1] + a.y());
161 }
TRGPoint2D()
Constructor.
Definition: Point2D.cc:17

◆ operator+() [3/3]

TRGCDCJSignal const operator+ ( TRGCDCJSignal const &  rhs) const

Arithmetic add operator.

Arithmetic operator.

Definition at line 310 of file JSignal.cc.

311 {
312 TRGCDCJSignal t_lhs(*this);
313 TRGCDCJSignal t_rhs(rhs);
314
315 //if(t_lhs.m_type==2 || t_rhs.m_type==2) {
316 // cout<<"[Error] TRGCDCJSignal::operator+() => should not be used with slv type."<<endl;
317 //}
318
319 if (t_lhs.m_argumentSignals.size() == 0) t_lhs.initArgumentSignals();
320 if (t_rhs.m_argumentSignals.size() == 0) t_rhs.initArgumentSignals();
321
322 if (m_debug == 1) {
323 cout << "TRGCDCJSignal::operator+=()" << endl;
324 cout << "<<<Input lhs>>>" << endl;
325 t_lhs.dump();
326 cout << "<<<Input lhs>>>" << endl;
327 cout << "<<<Input rhs>>>" << endl;
328 t_rhs.dump();
329 cout << "<<<Input rhs>>>" << endl;
330 }
331 // Match m_toReal(unit) by shifting bits.
332 matchUnit(t_lhs, t_rhs);
333
334 // To save toReal, debug
335 TRGCDCJSignal t_result(t_lhs);
336 combineArguments(t_lhs, t_rhs, t_result);
337
338 // Set name
339 t_result.m_name = t_lhs.m_name + "+" + t_rhs.m_name;
340 // Add values.
341 t_result.m_int = t_lhs.m_int + t_rhs.m_int;
342 t_result.m_minInt = t_lhs.m_minInt + t_rhs.m_minInt;
343 t_result.m_maxInt = t_lhs.m_maxInt + t_rhs.m_maxInt;
344 t_result.m_actual = t_lhs.m_actual + t_rhs.m_actual;
345 t_result.m_minActual = t_lhs.m_minActual + t_rhs.m_minActual;
346 t_result.m_maxActual = t_lhs.m_maxActual + t_rhs.m_maxActual;
347 // Calculate bitsize.
348 //int outputBitsize;
349 //int outputType;
350 //calTypeBitwidth(t_lhs, "+", t_rhs, outputType, outputBitsize);
351 //Set output bitsize and type.
352 //t_result.m_type = outputType;
353 //t_result.m_bitsize = outputBitsize;
354 t_result.m_type = t_result.calType();
355 t_result.m_bitsize = t_result.calBitwidth();
356 // Check for overflow underflow.
357 t_result.checkInt("TRGCDCJSignal::operator+");
358 if (m_debug == 1) {
359 cout << "<<<Output>>>" << endl;
360 t_result.dump();
361 cout << "<<<Output>>>" << endl;
362 cout << "TRGCDCJSignal::operator+=()" << endl;
363 }
364
365 //t_result.m_vhdlCode = vhdlCode(t_lhs, "+", t_rhs, t_result);
366 if (getPrintVhdl() == 1) vhdlCode(t_lhs, "+", t_rhs, t_result, t_result.m_vhdlCode);
367
368 return t_result;
369 }
void matchUnit(TRGCDCJSignal &first, TRGCDCJSignal &second) const
Utilities.
Definition: JSignal.cc:1260

◆ operator+=() [1/4]

const TRGCDCLpav & operator+= ( const TRGCDCLpav la1)

assignment operator(s)

Definition at line 661 of file Lpav.cc.

662 {
663 m_wsum += la1.m_wsum;
664 m_xsum += la1.m_xsum;
665 m_ysum += la1.m_ysum;
666 m_xxsum += la1.m_xxsum;
667 m_yysum += la1.m_yysum;
668 m_xysum += la1.m_xysum;
669 m_xrrsum += la1.m_xrrsum;
670 m_yrrsum += la1.m_yrrsum;
671 m_rrrrsum += la1.m_rrrrsum;
672 m_nc += la1.m_nc;
673 return *this;
674 }

◆ operator+=() [2/4]

TRGSignalVector & operator+= ( const TRGSignal left)

appends TRGSignal.

Definition at line 96 of file SignalVector.cc.

97 {
98 push_back(left);
99 return * this;
100 }

◆ operator+=() [3/4]

TRGSignalVector & operator+= ( const TRGSignalVector left)

appends TRGSignalVector.

Definition at line 103 of file SignalVector.cc.

104 {
105 for (unsigned i = 0; i < left.size(); i++)
106 push_back(left[i]);
107 return * this;
108 }

◆ operator+=() [4/4]

TRGState & operator+= ( const TRGState a)

appends TRGState (as MSB).

Definition at line 315 of file State.cc.

316 {
317
318 //...Check final size...
319 const unsigned sizeNew = _size + a.size();
320 const unsigned sizeMax = _n * _bsu;
321 const unsigned oldSize = _size;
322
323 //...Necessary to extend...
324 if (sizeNew > sizeMax) {
325 unsigned nNew = sizeNew / _bsu;
326 if (sizeNew % _bsu) ++nNew;
327 unsigned* tmp = (unsigned*) calloc(nNew, _su);
328 for (unsigned i = 0; i < _n; i++) {
329 tmp[i] = _state[i];
330 }
331 if (_state)
332 free(_state);
333 _state = tmp;
334 _n = nNew;
335 }
336 _size = sizeNew;
337
338 for (unsigned i = 0; i < a.size(); i++) {
339 unsigned j = i + oldSize;
340 const unsigned wp = j / _bsu;
341 const unsigned bp = j % _bsu;
342 if (a[i])
343 _state[wp] |= (1 << bp);
344 else
345 _state[wp] &= ~(1 << bp);
346
347// cout << "size,given,states=" << _size << "," << states[i] << ","
348// << _state[wp] << endl;
349
350 }
351
352 return (* this);
353 }
static const unsigned _su
size of unsigned.
Definition: State.h:130

◆ operator-() [1/4]

TRGCDCJSignal const operator- ( ) const

Unary operator.

Definition at line 279 of file JSignal.cc.

280 {
281
282 TRGCDCJSignal t_signal(*this);
283
284 //if(t_signal.m_type==2) {
285 // cout<<"[Error] TRGCDCJSignal::operator-(void) => should not be used with slv type."<<endl;
286 //}
287
288 if (t_signal.m_argumentSignals.size() == 0) t_signal.initArgumentSignals();
289
290 t_signal.m_int *= -1;
291 t_signal.m_minInt = -(*this).m_maxInt;
292 t_signal.m_maxInt = -(*this).m_minInt;
293 t_signal.m_actual *= -1;
294 t_signal.m_minActual = -m_maxActual;
295 t_signal.m_maxActual = -m_minActual;
296 if (m_type == 1) {
297 t_signal.m_type = -1;
298 t_signal.m_bitsize += 1;
299 }
300
301 //t_signal.m_vhdlCode = vhdlCode("-", *this, t_signal);
302 if (getPrintVhdl() == 1) {
303 vhdlCode("-", *this, t_signal, t_signal.m_vhdlCode);
304 }
305
306 return t_signal;
307 }

◆ operator-() [2/4]

TRGPoint2D operator- ( ) const
inline
  • operator

Definition at line 172 of file Point2D.h.

173 {
174 return TRGPoint2D(- _p[0], - _p[1]);
175 }

◆ operator-() [3/4]

TRGPoint2D operator- ( const TRGPoint2D a) const
inline
  • operator

Definition at line 165 of file Point2D.h.

166 {
167 return TRGPoint2D(_p[0] - a.x(), _p[1] - a.y());
168 }

◆ operator-() [4/4]

TRGCDCJSignal const operator- ( TRGCDCJSignal const &  rhs) const

Arithmetic minus operator.

Definition at line 371 of file JSignal.cc.

372 {
373
374 TRGCDCJSignal t_lhs(*this);
375 TRGCDCJSignal t_rhs(rhs);
376
377 //if(t_lhs.m_type==2 || t_rhs.m_type==2) {
378 // cout<<"[Error] TRGCDCJSignal::operator-() => should not be used with slv type."<<endl;
379 //}
380
381 if (t_lhs.m_argumentSignals.size() == 0) t_lhs.initArgumentSignals();
382 if (t_rhs.m_argumentSignals.size() == 0) t_rhs.initArgumentSignals();
383
384 if (m_debug == 1) {
385 cout << "TRGCDCJSignal::operator-=()" << endl;
386 cout << "<<<Input lhs>>>" << endl;
387 t_lhs.dump();
388 cout << "<<<Input lhs>>>" << endl;
389 cout << "<<<Input rhs>>>" << endl;
390 t_rhs.dump();
391 cout << "<<<Input rhs>>>" << endl;
392 }
393 // Match m_toReal(unit) by shifting bits.
394 matchUnit(t_lhs, t_rhs);
395
396 // To save toReal, debug
397 TRGCDCJSignal t_result(t_lhs);
398 combineArguments(t_lhs, t_rhs, t_result);
399 // Set name
400 t_result.m_name = t_lhs.m_name + "-" + t_rhs.m_name;
401 // Subtract values.
402 t_result.m_int = t_lhs.m_int - t_rhs.m_int;
403 if (isSameSignal(t_lhs, t_rhs)) {
404 t_result.m_minInt = 0;
405 t_result.m_maxInt = 0;
406 t_result.m_minActual = 0;
407 t_result.m_maxActual = 0;
408 } else {
409 t_result.m_minInt = t_lhs.m_minInt - t_rhs.m_maxInt;
410 t_result.m_maxInt = t_lhs.m_maxInt - t_rhs.m_minInt;
411 t_result.m_minActual = t_lhs.m_minActual - t_rhs.m_maxActual;
412 t_result.m_maxActual = t_lhs.m_maxActual - t_rhs.m_minActual;
413 }
414 t_result.m_actual = t_lhs.m_actual - t_rhs.m_actual;
415 // Calculate bitsize.
416 t_result.m_type = t_result.calType();
417 t_result.m_bitsize = t_result.calBitwidth();
418 // Check for overflow underflow.
419 t_result.checkInt("TRGCDCJSignal::operator-");
420 if (m_debug == 1) {
421 cout << "<<<Output>>>" << endl;
422 t_result.dump();
423 cout << "<<<Output>>>" << endl;
424 cout << "TRGCDCJSignal::operator-=()" << endl;
425 }
426 //t_result.m_vhdlCode = vhdlCode(t_lhs, "-", t_rhs, t_result);
427 if (getPrintVhdl() == 1) vhdlCode(t_lhs, "-", t_rhs, t_result, t_result.m_vhdlCode);
428
429 return t_result;
430 }

◆ operator<()

bool operator< ( const TRGState a) const

Copy operator.

Definition at line 383 of file State.cc.

385 {
386 const unsigned long long n0(* this);
387 const unsigned long long n1(a);
388 if (n0 < n1)
389 return true;
390 return false;
391 }

◆ operator<<() [1/3]

std::ostream & operator<< ( std::ostream &  s,
const TRGPoint2D a 
)

ostrream operator

Definition at line 51 of file Point2D.cc.

53 {
54 return s << "(" << a.x() << "," << a.y() << ")";
55 }

◆ operator<<() [2/3]

std::ostream & operator<< ( std::ostream &  o,
const TRGCDCLpar s 
)

ostream operator

Definition at line 327 of file Lpar.cc.

328 {
329 return o << " al=" << s.m_alpha << " be=" << s.m_beta
330 << " ka=" << s.m_kappa << " ga=" << s.m_gamma;
331 }

◆ operator<<() [3/3]

std::ostream & operator<< ( std::ostream &  o,
const TRGCDCLpav a 
)

ostream operator

Definition at line 265 of file Lpav.cc.

266 {
267// o << "wsum=" << a.m_wsum << " xsum=" << a.m_xsum << " ysum=" << a.m_ysum
268// << " xxsum=" << a.m_xxsum << " xysum=" << a.m_xysum
269// << " yysum=" << a.m_yysum
270// << " xrrsum=" << a.m_xrrsum << " yrrsum=" << a.m_yrrsum
271// << " rrrrsum=" << a.m_rrrrsum;
272// o << " rscale=" << a.m_rscale
273// << " xxavp=" << a.m_xxavp << " yyavp=" << a.m_yyavp
274// << " xrravp=" << a.m_xrravp << " yrravp=" << a.m_yrravp
275// << " rrrravp=" << a.m_rrrravp << " cosrot=" << a.m_cosrot
276// << " sinrot=" << a.m_sinrot
277// << std::endl;
278 o << " nc=" << a.m_nc << " chisq=" << a.m_chisq << " " << (TRGCDCLpar&) a;
279 return o;
280 }

◆ operator<=()

TRGCDCJSignal & operator<= ( TRGCDCJSignal const &  rhs)

Assign operator.

Definition at line 272 of file JSignal.cc.

273 {
274 string finalCode = "printAssignVhdlCode";
275 return assignTo(rhs, -3, finalCode);
276 }

◆ operator=() [1/4]

TRGCDCHelix & operator= ( const TRGCDCHelix i)

Copy operator.

Definition at line 409 of file Helix.cc.

410 {
411 if (this == & i) return * this;
412
413 m_bField = i.m_bField;
414 m_alpha = i.m_alpha;
415 m_pivot = i.m_pivot;
416 m_a = i.m_a;
417 m_Ea = i.m_Ea;
418 m_matrixValid = i.m_matrixValid;
419 m_helixValid = i.m_helixValid;
420
421 m_center = i.m_center;
422 m_cp = i.m_cp;
423 m_sp = i.m_sp;
424 m_pt = i.m_pt;
425 m_r = i.m_r;
426 m_ac[0] = i.m_ac[0];
427 m_ac[1] = i.m_ac[1];
428 m_ac[2] = i.m_ac[2];
429 m_ac[3] = i.m_ac[3];
430 m_ac[4] = i.m_ac[4];
431
432 return * this;
433 }

◆ operator=() [2/4]

TRGCDCLpar & operator= ( const TRGCDCLpar l)
inline

assignment operator(s)

Definition at line 211 of file Lpar.h.

212 {
213 if (this != &l) {
214 m_alpha = l.m_alpha;
215 m_beta = l.m_beta;
216 m_gamma = l.m_gamma;
217 m_kappa = l.m_kappa;
218 }
219 return *this;
220 }

◆ operator=() [3/4]

TRGCDCLpav & operator= ( const TRGCDCLpav lp)
inline

assignment operator(s)

inline function definitions

Definition at line 189 of file Lpav.h.

190 {
192 m_wsum = lp.m_wsum;
193 m_xsum = lp.m_xsum;
194 m_ysum = lp.m_ysum;
195 m_xxsum = lp.m_xxsum;
196 m_yysum = lp.m_yysum;
197 m_xysum = lp.m_xysum;
198 m_xrrsum = lp.m_xrrsum;
199 m_yrrsum = lp.m_yrrsum;
200 m_rrrrsum = lp.m_rrrrsum;
201
203 m_xav = lp.m_xav;
204 m_yav = lp.m_yav;
205 m_xyavp = lp.m_xyavp;
206
207 m_rscale = lp. m_rscale;
208 m_xxavp = lp.m_xxavp;
209 m_yyavp = lp.m_yyavp;
210 m_xrravp = lp.m_xrravp;
211 m_yrravp = lp.m_yrravp;
212 m_rrrravp = lp.m_rrrravp;
213 m_sinrot = lp.m_sinrot;
214 m_cosrot = lp.m_cosrot;
215
216 m_nc = lp. m_nc;
217 m_chisq = lp.m_chisq;
218 return *this;
219 }
TRGCDCLpar & operator=(const TRGCDCLpar &)
assignment operator(s)
Definition: Lpar.h:211

◆ operator=() [4/4]

TRGState & operator= ( const TRGState a)

Copy operator.

Definition at line 368 of file State.cc.

369 {
370 if (_state)
371 free(_state);
372
373 _size = a._size;
374 _n = a._n;
375 _state = (unsigned*) calloc(_n, _su);
376 for (unsigned i = 0; i < _n; i++) {
377 _state[i] = a._state[i];
378 }
379
380 return * this;
381 }

◆ operator==() [1/4]

bool operator== ( const TRGPoint2D a) const
inline

equal operator

Definition at line 179 of file Point2D.h.

180 {
181 if (a.x() == _p[0] && a.y() == _p[1]) return true;
182 return false;
183 }

◆ operator==() [2/4]

bool operator== ( const TRGSignal a) const

returns true if two are the same.

Definition at line 531 of file Signal.cc.

532 {
533 if (_history.size() != a._history.size())
534 return false;
535
536 for (unsigned i = 0; i < _history.size(); i++) {
537 if (_history[i] != a._history[i])
538 return false;
539 }
540
541 return true;
542 }

◆ operator==() [3/4]

bool operator== ( const TRGSignalVector a) const

compare two TRGSignalVectors.

Definition at line 192 of file SignalVector.cc.

193 {
194 if (size() != a.size()) {
195 // cout << "TRGSignalVector::operator== : different size:"
196 // << size() << "," << a.size() << endl;
197 return false;
198 }
199 for (unsigned i = 0; i < size(); i++) {
200 if ((* this)[i] != a[i]) {
201 // cout << "TRGSignalVector::operator== : different signal:i="
202 // << i << endl;
203 // (* this)[i].dump();
204 // a[i].dump();
205 return false;
206 }
207 }
208
209 return true;
210 }

◆ operator==() [4/4]

bool operator== ( const TRGTime a) const
inline

returns true if two are the same.

Definition at line 185 of file Time.h.

186 {
187 if (_time != a._time) return false;
188 if (_edge != a._edge) return false;
189 if (_clock != a._clock) return false;
190 // no name check
191 return true;
192 }

◆ operator[]() [1/3]

const TRGTime * operator[] ( unsigned  i) const
inline

returns timing of i'th edge.

Definition at line 324 of file Signal.h.

325 {
326 return & _history[i];
327 }

◆ operator[]() [2/3]

bool operator[] ( unsigned  i) const
inline

returns state of i'th bit.

Definition at line 178 of file State.h.

179 {
180#ifdef TRG_DEBUG
181 if (a >= _size)
182 std::cout << "TRGState::operator[] !!! bit size overflow"
183 << ":bit size=" << _size << ",specified position=" << a
184 << std::endl;
185#endif
186
187 const unsigned wp = a / _bsu;
188 const unsigned bp = a % _bsu;
189 if (_state[wp] & (1 << bp))
190 return true;
191 else
192 return false;
193 }

◆ operator[]() [3/3]

const TRGCDCWire * operator[] ( unsigned  id) const
inline

returns a wire.

Definition at line 205 of file Segment.h.

206 {
207 if (id < _wires.size())
208 return _wires[id];
209 return 0;
210 }

◆ operator|() [1/4]

TRGSignal operator| ( const TRGSignal left) const

returns OR result.

Definition at line 257 of file Signal.cc.

258 {
259 TRGSignal t(* this);
260 t._history.insert(t._history.end(),
261 left._history.begin(),
262 left._history.end());
263 t._name = "(" + t._name + ")|(" + left._name + ")";
264 std::sort(t._history.begin(), t._history.end(), TRGTime::sortByTime);
265
266 //...And operation...
267 t._history = orOperation(t._history);
268
269 return t;
270 }
static std::vector< TRGTime > orOperation(const std::vector< TRGTime > &)
Or operation.
Definition: Signal.cc:292
static bool sortByTime(const TRGTime &a, const TRGTime &b)
returns true if a is older than b.
Definition: Time.cc:107

◆ operator|() [2/4]

TRGSignal operator| ( const TRGSignal left) const

oring two TRGTime. A result is TRGSignal.

Definition at line 80 of file Time.cc.

81 {
82 TRGSignal t0(* this);
83 return t0 | left;
84 }

◆ operator|() [3/4]

TRGSignal operator| ( const TRGTime l) const
inline

returns OR result.

Definition at line 224 of file Signal.h.

225 {
226 TRGSignal t(* this);
227 TRGSignal left(l);
228
229#if TRG_DEBUG
231#endif
232
233 return t | left;
234 }

◆ operator|() [4/4]

TRGSignal operator| ( const TRGTime left) const

oring two TRGTime. A result is TRGSignal.

Definition at line 72 of file Time.cc.

73 {
74 TRGSignal t0(* this);
75 TRGSignal t1(left);
76 return t0 | t1;
77 }

◆ operator|=() [1/2]

TRGSignal & operator|= ( const TRGSignal left)

returns OR result.

Definition at line 273 of file Signal.cc.

274 {
275 _history.insert(_history.end(),
276 left._history.begin(),
277 left._history.end());
278 this->_name = "(" + this->_name + ")&(" + left._name + ")";
279 std::sort(_history.begin(), _history.end(), TRGTime::sortByTime);
280
281 //...And operation...
283
284#if TRG_DEBUG
286#endif
287
288 return * this;
289 }

◆ operator|=() [2/2]

TRGSignal & operator|= ( const TRGTime l)
inline

returns OR result.

Definition at line 238 of file Signal.h.

239 {
240 TRGSignal left(l);
241
242#if TRG_DEBUG
244#endif
245
246 return (* this) |= left;
247 }

◆ orderLargestBitsize()

bool orderLargestBitsize ( TRGCDCJSignal large,
TRGCDCJSignal small 
) const

Orders the TRGCDCJSignals by bitsize. Next priority is unsigned, signed, minus unsigned. 1: was swapped. 0: was not swapped.

Definition at line 1515 of file JSignal.cc.

1516 {
1517 bool result = 0;
1518 if (large.m_bitsize < small.m_bitsize) {
1519 swap(large, small);
1520 result = 1;
1521 } else if (large.m_bitsize == small.m_bitsize) {
1522 if (large.m_type == 1) {;}
1523 else if (large.m_type == -1 && small.m_type == 1) {
1524 swap(large, small);
1525 result = 1;
1526 } else if (large.m_type == 0 && small.m_type != 0) {
1527 swap(large, small);
1528 result = 1;
1529 }
1530 }
1531
1532 return result;
1533 }

◆ ored()

TRGSignal ored ( void  ) const

returns signal of all ORed.

Definition at line 271 of file SignalBundle.cc.

272 {
273
274 //...Get state information...
275 const vector<int> states = stateChanges();
276 const unsigned nStates = states.size();
277
278 //...Output...
279 TRGSignal ored;
280
281 //...Loop over all states...
282 // vector<TRGState *> outputStates;
283 for (unsigned i = 0; i < nStates; i++) {
284 // if (TRGDebug::level())
285 // cout << TRGDebug::tab() << "Clock=" << states[i] << endl;
286
287 // if (active(states[i])) {
288 // TRGSignal p(* _clock,
289
290 // }
291
292
293 cout << "TRGSginalBundle::ored !!! not completed yet" << endl;
294 }
295
296 return TRGSignal();
297 }
TRGSignal ored(void) const
returns signal of all ORed.

◆ orOperation()

vector< TRGTime > orOperation ( const std::vector< TRGTime > &  history)
staticprivate

Or operation.

Definition at line 292 of file Signal.cc.

293 {
294
295 //...And operation...
296 const unsigned n = history.size();
297 vector<TRGTime> tmp;
298 unsigned signal = 0;
299 for (unsigned i = 0; i < n; i++) {
300 const bool edge = history[i].edge();
301
302 if (edge) {
303 if (signal == 0)
304 tmp.push_back(history[i]);
305 ++signal;
306 } else {
307 if (signal == 1)
308 tmp.push_back(history[i]);
309 --signal;
310 }
311
312// cout << "i,time,edge,signal=" << i << "," << history[i].time()
313// << "," << edge << "," << signal << endl;
314
315 }
316
317 return tmp;
318 }

◆ outerMost()

TRGCDCLink * outerMost ( const std::vector< TRGCDCLink * > &  links)
static

returns the outer-most link.

Definition at line 425 of file Link.cc.

426 {
427 unsigned n = a.size();
428 unsigned maxId = 0;
429 TRGCDCLink* t = 0;
430 for (unsigned i = 0; i < n; i++) {
431 unsigned id = a[i]->cell()->id();
432 if (id >= maxId) {
433 maxId = id;
434 t = a[i];
435 }
436 }
437 return t;
438 }

◆ outerRadius()

float outerRadius ( void  ) const
inline

sets and returns outer radius.

Definition at line 257 of file Layer.h.

258 {
259 return _outerRadius;
260 }
float _outerRadius
Outer radius.
Definition: Layer.h:149

◆ output()

TRGChannel * output ( unsigned  i) const
inline

returns output channel i.

Definition at line 165 of file Board.h.

166 {
167 return _outputChannels[a];
168 }

◆ overShoot()

double overShoot ( double  timing) const

returns over shoot.

Definition at line 134 of file Clock.cc.

135 {
136 return (t - _offset) - _cycle * double(position(t));
137 }
int position(double timing) const
returns clock position.
Definition: Clock.cc:114

◆ p() [1/3]

const CLHEP::Hep3Vector & p ( void  ) const
inlinevirtual

returns momentum vector.

Reimplemented in TRGCDCTrack.

Definition at line 206 of file TrackBase.h.

207 {
208 return _p;
209 }
CLHEP::Hep3Vector _p
Momentum.
Definition: TrackBase.h:151

◆ p() [2/3]

const CLHEP::HepLorentzVector & p ( void  ) const
inline

returns momentum vector.

Definition at line 152 of file TrackMC.h.

153 {
154 return _p;
155 }

◆ p() [3/3]

const CLHEP::Hep3Vector & p ( void  ) const
inlineoverridevirtual

returns momentum vector.

Reimplemented from TRGCDCTrackBase.

Definition at line 157 of file TRGCDCTrack.h.

158 {
159 _p = _helix.momentum();
160 return _p;
161 }
CLHEP::Hep3Vector _p
Momentum.
Definition: TRGCDCTrack.h:113

◆ p1p2Methode()

void p1p2Methode ( const TRGCDCHoughPlane hp,
const unsigned  threshold,
std::vector< std::vector< unsigned > > &  peaks 
) const
private

Kaiyu's logic. Finds peaks from nested patterns.

Definition at line 498 of file PeakFinder.cc.

501 {
502 const string sn = "p1p2";
504
505 unsigned nCells = hp.nX() * hp.nY();
506 unsigned nX2 = hp.nX() / 2;
507 unsigned nY2 = hp.nY() / 2;
508
509 //...Search cells above threshold...
510 static unsigned* candidates = (unsigned*) malloc(nCells * sizeof(unsigned));
511 unsigned nActive = 0;
512 for (unsigned j = 0; j < hp.nY(); ++j) {
513 //minus x direction, plus -x direction
514 if ((hp.name()) == "circle hough minus") {
515 for (unsigned i = 0; i < hp.nX(); ++i) {
516 //...Threshold check...
517 const unsigned n = hp.entry(i, j);
518 if (n < threshold) continue;
519 candidates[nActive] = hp.serialId(i, j);
520 ++nActive;
521 }
522 } else {
523 for (unsigned i = 0; i < hp.nX(); ++i) {
524 //...Threshold check...
525 const unsigned n = hp.entry(hp.nX() - i - 1, j);
526 if (n < threshold) continue;
527 candidates[nActive] = hp.serialId(hp.nX() - i - 1, j);
528 ++nActive;
529 }
530 }
531 }
532
533 vector<unsigned> p;
534 vector<vector<unsigned>> p1m;
535 unsigned short no = 0;
536 //...create pattern1...begin
537 // divide the plane into squares of 2x2
538 // outer loop (n x m) goes over the squares,
539 // inner loop (j x k) goes over the cells in each square
540 for (unsigned n = 0; n < nY2; n++) {
541 for (unsigned m = 0; m < nX2; m++) {
542 unsigned a = m * 2;
543 unsigned b = n * 2;
544 bool ot = false;
545 ++no; // numbering starts at 1, not 0
546 p.push_back(no);
547
548 //...find 4 cells...begin
549 for (unsigned j = 0; j < 2; j++) {
550 unsigned yy = b + j;
551 for (unsigned k = 0; k < 2; k++) {
552 unsigned xx = a + k;
553 // Plus plane transform (x axis mirrored compared to minus plane)
554 if ((hp.name()) == "circle hough plus") {
555 xx = hp.nX() - xx - 1;
556 }
557
558 // go over the candidates and look for candidate in current cell
559 // if cell is peak candidate, add 1 to p, else add 0
560 unsigned short t = 0;
561 for (unsigned i = 0; i < nActive; i++) {
562 unsigned id1 = candidates[i];
563 unsigned x1 = 0;
564 unsigned y1 = 0;
565 hp.id(id1, x1, y1);
566 if (xx == x1 && yy == y1) {
567 t = 1;
568 ot = true;
569 break;
570 }
571 }
572 p.push_back(t);
573 }
574 }
575 //...find 4 cells...end
576
577 // p = [n a b c d]
578 // n: number of 2x2 square
579 // a b c d: on/off flag for cells in 2x2 square
580 // shape:
581 // c d
582 // a b
583 if (ot == true) {
584 p1m.push_back(p);
585 }
586
587 p.clear();
588 }
589 }
590 if (TRGDebug::level()) cout << TRGDebug::tab() << "size of p1m=" << p1m.size() << endl;
591 if (TRGDebug::level()) cout << TRGDebug::tab() << "~~~~~~~~~~~~~~~~~~~~~~~~~pattern1~~~~~~~~~~~~~~~~~~~" << endl;
592 //...create pattern1...end (output p1m)
593
594
595 //...Pattern2 & Find Peak...begin
596 if (TRGDebug::level()) cout << TRGDebug::tab() << ">>>>>>>>>>Pattern 2 & Find Peak Begin!!!>>>>>>>>>>" << endl;
597
598 vector<unsigned> p0(5, 0);
599 vector<vector<unsigned>> op2;
600
601 // loop over 2x2 peak candidates
602 for (unsigned short i = 0; i < p1m.size(); i++) {
603 unsigned short j = p1m[i][0]; // 2x2 square number (starting at 1)
604 unsigned short a = 0;
605 bool p1rel = false;
606 if (TRGDebug::level()) cout << TRGDebug::tab() << "no." << j << endl;
607
608 // XYZ (begin)
609 // check for connections to neighboring 2x2 candidates
610 // if connection is found, continue to next candidate
611
612 //X (horizontal connection to the left)
613 if ((j % nX2) == 1) {
614 a = j + nX2 - 1;
615 } else {
616 a = j - 1;
617 }
618 // loop over rest of candidates
619 for (unsigned k = 0; k < p1m.size(); k++) {
620 if (a == p1m[k][0]) {
621 // check connection to left neighbor
622 // by predefined subpattern in 2x2 square
623 if (!rlrel(p1m[k], p1m[i])) {
624 if (TRGDebug::level()) cout << TRGDebug::tab() << "no." << j << " & no." << a << " / X no rel" << endl;
625 p1rel = false;
626 } else {
627 if (TRGDebug::level()) cout << TRGDebug::tab() << "no." << j << " & no." << a << " / X rel" << endl;
628 p1rel = true;
629 }
630 break;
631 }
632 }
633 if (p1rel) {
634 continue;
635 }
636
637 //Y (vertical connection to lower neighbor)
638 if (j > nX2) {
639 a = j - nX2;
640 // loop over rest of candidates
641 for (unsigned k = 0; k < p1m.size(); k++) {
642 if (a == p1m[k][0]) {
643 // check connection to lower neighbor
644 // by predefined subpattern in 2x2 square
645 if (!udrel(p1m[k], p1m[i])) {
646 if (TRGDebug::level()) cout << TRGDebug::tab() << "no." << j << " & no." << a << " / Y no rel" << endl;
647 p1rel = false;
648 } else {
649 if (TRGDebug::level()) cout << TRGDebug::tab() << "no." << j << " & no." << a << " / Y rel" << endl;
650 p1rel = true;
651 }
652 break;
653 }
654 }
655 if (p1rel) {
656 continue;
657 }
658
659
660 //Z (diagonal connection to lower left)
661 if ((j % nX2) == 1) {
662 a = j - 1;
663 } else {
664 a = j - nX2 - 1;
665 }
666 // loop over test of candidates
667 for (unsigned k = 0; k < p1m.size(); k++) {
668 if (a == p1m[k][0]) {
669 // check connection to lower left neighbor
670 // by predefined subpattern in 2x2 square
671 if (!mirel(p1m[k], p1m[i])) {
672 if (TRGDebug::level()) cout << TRGDebug::tab() << "no." << j << " & no." << a << " / Z no rel" << endl;
673 p1rel = false;
674 } else {
675 if (TRGDebug::level()) cout << TRGDebug::tab() << "no." << j << " & no." << a << " / Z rel" << endl;
676 p1rel = true;
677 }
678 break;
679 }
680 }
681 if (p1rel) {
682 continue;
683 }
684 }
685 // XYZ (end)
686
687 // Pattern2 value (begin)
688 // make 3x2 rectangle of 2x2 squares
689 // p2v = [A B C D E F] (numbers of 2x2 squares in 3x2 rectangle)
690 // A: number of current 2x2 candidate
691 // shape of p2v:
692 // E F
693 // C D
694 // A B
695 vector<unsigned> p2v;
696 for (unsigned ip2 = 0; ip2 < 3; ++ip2) {
697 for (unsigned jp2 = 0; jp2 < 2; ++jp2) {
698 p2v.push_back(j + jp2 + ip2 * nX2);
699 }
700 if ((j % nX2) == 0) {
701 p2v[ip2 * 3 + 1] -= nX2;
702 }
703 }
704 // Pattern2 value(End)
705
706 // make Pattern2(begin)
707 // get subpattern for each 2x2 square within 3x2 rectangle
708 // stored in op2
709
710 // loop over 3x2 rectangle
711 for (unsigned short imp2 = 0; imp2 < p2v.size(); imp2++) {
712 unsigned short p2v_i = p2v[imp2];
713 // loop over 2x2 candidates
714 for (unsigned short jmp2 = 0; jmp2 < p1m.size(); jmp2++) {
715 unsigned short p1m_no = p1m[jmp2][0];
716 // if none of match number in p1m then pass this scan
717 if (p2v_i != p1m_no) {
718 if (jmp2 == (p1m.size() - 1)) {
719 // if no match is found use default (0 0 0 0 0)
720 op2.push_back(p0);
721 }
722 continue;
723 }
724 op2.push_back(p1m[jmp2]);
725
726 break;
727 }
728 }
729 // make Pattern2(End)
730
731 // Pattern2 relation(Begin)
732 // go over 3x2 rectangle and keep only cells connected to lower left 2x2 square
733 vector<vector<unsigned>> final_op2;
734 vector<unsigned> p2_state;
735 // A (start point)
736 final_op2.push_back(op2[0]);
737 p2_state.push_back(1);
738 // B (keep if connected to A)
739 if (rlrel(op2[0], op2[1])) {
740 final_op2.push_back(op2[1]);
741 p2_state.push_back(1);
742 } else {
743 final_op2.push_back(p0);
744 p2_state.push_back(0);
745 }
746 // C (keep if connected to A)
747 if (udrel(op2[0], op2[2])) {
748 final_op2.push_back(op2[2]);
749 p2_state.push_back(1);
750 } else {
751 final_op2.push_back(p0);
752 p2_state.push_back(0);
753 }
754 // D (keep connected to A, B or D)
755 if (mirel(op2[0], op2[3]) || udrel(op2[1], op2[3]) || rlrel(op2[2], op2[3])) {
756 final_op2.push_back(op2[3]);
757 p2_state.push_back(1);
758 } else {
759 final_op2.push_back(p0);
760 p2_state.push_back(0);
761 }
762 // E (keep if connected to C)
763 if (udrel(op2[2], op2[4])) {
764 final_op2.push_back(op2[4]);
765 p2_state.push_back(1);
766 } else {
767 final_op2.push_back(p0);
768 p2_state.push_back(0);
769 }
770 // F (keep if connected to C, D or E)
771 if (mirel(op2[2], op2[5]) || udrel(op2[3], op2[5]) || rlrel(op2[4], op2[5])) {
772 final_op2.push_back(op2[5]);
773 p2_state.push_back(1);
774 } else {
775 final_op2.push_back(p0);
776 p2_state.push_back(0);
777 }
778 // TODO: should compare connection to final_op2 instead of op2?
779 // otherwise e.g. op2 = A C-E with connection C-E
780 // would give final_op2 = A . E (should be A . .)
781
782 // Pattern2 relation(End)
783
784 // Find center peak(begin)
785 unsigned short fcpi = 0; // number of peak in 2x2 square (start: 1)
786 unsigned short fcpn = 0; // number of peak 2x2 square (start: 1)
787 unsigned short fcpx = 0; // x index in original hough plane (start: 0)
788 unsigned short fcpxs = 0; // x index in 2x2 square (0, 1)
789 unsigned short fcpy = 0; // y index in original hough plane (start: 0)
790 unsigned short fcpys = 0; // y index in 2x2 square (0, 1)
791
792 // p2_state: vector of on/off flags for 3x3 square
793 // FindCP1(p2_state): peak within 3x3 square by predefined pattern
794 // op2[FindCP1(p2_state)]: 2x2 subpattern of this peak
795 // FindP1C(...): peak within 2x2 square by predefined pattern
796 fcpi = FindP1C(op2[FindCP1(p2_state)]);
797
798 fcpn = op2[FindCP1(p2_state)][0];
799
800 // get x index
801 if (fcpi >= 3) {
802 fcpxs = fcpi - 3;
803 } else {
804 fcpxs = fcpi - 1;
805 }
806 fcpx = ((fcpn - 1) % nX2) * 2 + fcpxs;
807 // Plus plane transform back to original numbering
808 if ((hp.name()) == "circle hough plus") {
809 fcpx = hp.nX() - fcpx - 1;
810 }
811
812 // get y index
813 if (fcpi >= 3) {
814 fcpys = 1;
815 }
816 fcpy = fcpy + ((fcpn - 1) / nX2) * 2 + fcpys;
817
818 if (TRGDebug::level()) cout << TRGDebug::tab() << "center of peak x=" << fcpx << " y=" << fcpy << endl;
819
820 p.push_back(fcpx);
821 p.push_back(fcpy);
822 peak_xy.push_back(p);
823 p.clear();
824 // Find center peak(end)
825
826 if (TRGDebug::level()) cout << TRGDebug::tab() << "~~~~~~~~~~Pattern 2 & Find Peak End!!!~~~~~~~~~~" << endl;
827 p2_state.clear();
828 final_op2.clear();
829 p2v.clear();
830 op2.clear();
831 } // end of loop over 2x2 candidates
832
833 //... Pattern 2...end
834
835 if (TRGDebug::level())
836 cout << TRGDebug::tab() << "total peaks=" << peak_xy.size() << endl;
837
838 p1m.clear();
839
841 }
bool rlrel(vector< unsigned > a, vector< unsigned > b)
...rlrel...
Definition: PeakFinder.cc:157
bool udrel(vector< unsigned > a, vector< unsigned > b)
...udrel...
Definition: PeakFinder.cc:183
bool mirel(vector< unsigned > a, vector< unsigned > b)
...mirel...
Definition: PeakFinder.cc:212
unsigned short FindCP1(vector< unsigned > a)
...Find center Pattern1 from Pattern 2
Definition: PeakFinder.cc:236
unsigned FindP1C(vector< unsigned > a)
...Pattern1 Center...
Definition: PeakFinder.cc:303

◆ packer()

TRGState packer ( const TRGState input,
TRGState registers,
bool &  logicStillActive 
)
static

Packer for 3D tracker.

Definition at line 118 of file Tracker2D.cc.

121 {
122
123 //...Registers...
124 // Storing TSF hit history upto 16 clocks. #TSF is half of all TSF.
125 // reg[15 downto 0] : TSF-0 history (SL0)
126 // reg[31 downto 16] : TSF-1 history (SL0)
127 // ...
128 // reg[1279 downto 1264] : TSF-59 history (SL0)
129 // reg[1295 downto 1280] : TSF-? history (SL1)
130 // ...
131
132 //...Shift registers (TSF hit history pipe)...
133 for (unsigned i = 0; i < nTSF() / 2; i++) {
134 TRGState s = registers.subset(i * 16, 16);
135 s.shift(1);
136 registers.set(i * 16, s);
137 }
138
139 //...Unpack input state...
140 // Get TSF hit information. The drift time information is ignored.
141 unpacker(input, registers);
142
143 //...Make TSF hit...
144 hitInformation(registers);
145
146 //...Do core logic...
147// HoughMappingPlus();
148// HoughMappingMinus();
149
150 //...Make output...
151 logicStillActive = registers.active();
152
153 return TRGState(256);
154 }
static void unpacker(const TRGState &input, TRGState &output)
Unpack TSF output.
Definition: Tracker2D.cc:157
static void hitInformation(const TRGState &registers)
Gets TSF hit information for one certin clock from the registers.
Definition: Tracker2D.cc:204

◆ packerForTracker()

TRGSignalVector * packerForTracker ( vector< TRGSignalVector * > &  hitList,
vector< int > &  cList,
const unsigned  maxHit 
)

Output packer for tracker.

Definition at line 2385 of file TrackSegmentFinder.cc.

2388 {
2389
2390 TRGSignalVector* result =
2391 new TRGSignalVector("", (* hitList[0]).clock(), 21 * maxHit);
2392
2393 for (unsigned ci = 0; ci < cList.size(); ci++) {
2394 unsigned cntHit = 0;
2395 for (unsigned hi = 0; hi < hitList.size(); hi++) {
2396 TRGState s = (* hitList[hi]).state(cList[ci]);
2397 if (s.active()) {
2398 if (cntHit >= maxHit) continue;
2399 for (unsigned j = 0; j < 21; j++) {
2400 if ((* hitList[hi])[j].state(cList[ci])) {
2401 (* result)[21 * (maxHit - 1) - (cntHit * 21) + j]
2402 .set(cList[ci], cList[ci] + 1);
2403 }
2404 }
2405 if (TRGDebug::level()) {
2406 TRGState t = hitList[hi]->state(cList[ci]).subset(13, 8);
2407 cout << TRGDebug::tab() << " hit found : TSF out local ID="
2408 << unsigned(t) << "(" << t << ")" << endl;
2409 }
2410
2411 ++cntHit;
2412 // result->dump("", "??? ");
2413 }
2414 }
2415 }
2416
2417 return result;
2418 }

◆ packerInner()

TRGState packerInner ( const TRGState input)
static

Make bit pattern using input information from inner FEs.

Definition at line 257 of file Merger.cc.

258 {
259
260 //...inputInsdie should be 32 hit pattern and 2x16x5 timing, total 192 bits...
261 // plus edge information
262 //
263 // Wire numbers and TS ID
264 //
265 // outside
266 //
267 // +--+--+--+--+- -+--+--+--+--+--+--+
268 // | 79 | 78 | .... | 66 | 65 | 64 |
269 // +--+--+--+--+--+- -+--+--+--+--+--+--+
270 // | 63 | 62 | ..... | 50 | 49 | 48 |
271 // +--+--+--+--+--+- -+--+--+--+--+--+--+
272 // | 47 | 46 | .... | 34 | 33 | 32 |
273 // +--+--+--+--+- -+--+--+--+--+--+--+
274 //
275 // +--+--+--+--+- -+--+--+--+--+--+--+
276 // | 31 | 30 | .... | 18 | 17 | 16 |
277 // +--+--+--+--+--+- -+--+--+--+--+--+--+
278 // | 15 | 14 | ..... | 2 | 1 | 0 |
279 // +--+--+--+--+--+- -+--+--+--+--+--+--+
280 // | x | x | .... | x | x | x |
281 // +--+--+--+--+- -+--+--+--+--+--+--+
282 //
283 // 15 14 .... 2 1 0 <- partial TS ID, aligned with the 2nd row
284 //
285 // inside
286 //
287 //...Prepare a state for output...
288 // hit map: 80x1
289 // priority hit time: 16x4
290 // fastest hit time: 16x4
291 // 2nd proi. hit flag: 16x1
292 // edge time info: 5x4
293 // cc: 1x9
294 // N/A and reserved: fill to total 256 bits
295
296 TRGState s(80 + 16 * 4 + 16 * 4 + 16 + 5 * 4 + 1 * 9 + 3); // fill to 256 bits
297
298 //...Set up bool array...
299 bool* binput = new bool[input.size()];
300 input.copy2bool(binput);
301 bool* binside = & binput[0];
302 bool* boutside = & binput[256]; // half of the input.size(), should be 256
303
304
305 // ... hitmap ...
306 const bool* const hitptn0 = & binside[0]; // 16x2 = 32 bits
307 const bool* const hitptn1 = & boutside[0]; // 16x3 = 48 bits
308 s.set(0, 32, hitptn0);
309 s.set(32, 48, hitptn1);
310 unsigned p = 80;
311
312 bool PTS_in_hit[16];
313 bool PTS_out_hit[16];
314 for (unsigned i = 0; i < 16; i++) {
315 if (i == 0) {
316 PTS_in_hit[i] = hitptn0[0] || hitptn0[16];
317 PTS_out_hit[i] = hitptn1[0] || hitptn1[1] || hitptn1[16] || hitptn1[17] || hitptn1[32] || hitptn1[33] || hitptn1[34];
318 } else if (i == 1) {
319 PTS_in_hit[i] = hitptn0[1] || hitptn0[16] || hitptn0[17];
320 PTS_out_hit[i] = hitptn1[0] || hitptn1[1] || hitptn1[2] || hitptn1[16] || hitptn1[17] || hitptn1[18] || hitptn1[32] || hitptn1[33]
321 || hitptn1[34] || hitptn1[35];
322 } else if (i == 14) {
323 PTS_in_hit[i] = hitptn0[14] || hitptn0[29] || hitptn0[30];
324 PTS_out_hit[i] = hitptn1[13] || hitptn1[14] || hitptn1[15] || hitptn1[28] || hitptn1[29] || hitptn1[30] || hitptn1[31]
325 || hitptn1[44] || hitptn1[45] || hitptn1[46] || hitptn1[47];
326 } else if (i == 15) {
327 PTS_in_hit[i] = hitptn0[15] || hitptn0[30] || hitptn0[31];
328 PTS_out_hit[i] = hitptn1[14] || hitptn1[15] || hitptn1[29] || hitptn1[30] || hitptn1[31] || hitptn1[45] || hitptn1[46]
329 || hitptn1[47];
330 } else {
331 PTS_in_hit[i] = hitptn0[i] || hitptn0[i + 15] || hitptn0[i + 16];
332 PTS_out_hit[i] = hitptn1[i - 1] || hitptn1[i] || hitptn1[i + 1] || hitptn1[i + 14] || hitptn1[i + 15] || hitptn1[i + 16]
333 || hitptn1[i + 17] || hitptn1[i + 30] || hitptn1[i + 31] || hitptn1[i + 32] || hitptn1[i + 33] || hitptn1[i + 34];
334 }
335 }
336
337
338 // ... priority time ... and 2nd priority location .... already prepared in FrontEnd packer
339 const bool* const pt[16] = {
340 &binside[33], &binside[38], &binside[43], &binside[48],
341 &binside[53], &binside[58], &binside[63], &binside[68],
342 &binside[73], &binside[78], &binside[83], &binside[88],
343 &binside[93], &binside[98], &binside[103], &binside[108]
344 };
345
346 for (unsigned i = 0; i < 16; i++) {
347 s.set(p, 4, pt[i]);
348 p += 4;
349 }
350
351 // ... fastest time ...
352 const bool* const ftinside[16] = {
353 &binside[128], &binside[133], &binside[138], &binside[143],
354 &binside[148], &binside[153], &binside[158], &binside[163],
355 &binside[168], &binside[173], &binside[178], &binside[183],
356 &binside[188], &binside[193], &binside[198], &binside[203]
357 };
358 const bool* const ftoutside[16] = {
359 &boutside[48], &boutside[53], &boutside[58], &boutside[63],
360 &boutside[68], &boutside[73], &boutside[78], &boutside[83],
361 &boutside[88], &boutside[93], &boutside[98], &boutside[103],
362 &boutside[108], &boutside[113], &boutside[118], &boutside[123]
363 };
364
365
366 // need to consider if that area is hit
367 for (unsigned i = 0; i < 16; i++) {
368 TRGState st[2];
369 st[0] = TRGState(5, ftinside[i]);
370 st[1] = TRGState(5, ftoutside[i]);
371 if (!PTS_in_hit[i]) st[0].set(5, true);
372 if (!PTS_out_hit[i]) st[1].set(5, true);
373
374 if (PTS_in_hit[i] || PTS_out_hit[i]) {
375 if (st[0] < st[1]) {
376 s.set(p, 4, &binside[129 + i * 5]);
377 } else {
378 s.set(p, 4, &boutside[49 + i * 5]);
379 }
380 } else {
381 }
382 p += 4;
383 }
384
385 // ... 2nd priority location ...
386 s.set(p, 16, &binside[112]);
387 p += 16;
388
389 // ... edge information ...
390
391 if (hitptn0[31]) {
392 s.set(p, 4, &binside[209]); // 4-bit hit time of cell[31]
393 } else {
394 }
395 p += 4;
396
397
398 if (hitptn1[32]) {
399 s.set(p, 4, &boutside[129]); // 4-bit hit time of cell[64]
400 } else {
401 }
402 p += 4;
403
404
405 if (hitptn1[0] || hitptn1[16] || hitptn1[32] || hitptn1[33]) {
406 s.set(p, 4, &boutside[134]); // edge info. purely from outside FE. cell 32, 48, 64, 65
407 } else {
408 }
409 p += 4;
410
411
412
413 TRGState et[2]; // edge info. from both FE, cell 31 and 47, 62, 63, 78, 79
414 et[0] = TRGState(5, &binside[208]);
415 et[1] = TRGState(5, &boutside[138]);
416
417 if ((!hitptn1[15]) && (!hitptn1[30]) && (!hitptn1[31]) && (!hitptn1[46]) && (!hitptn1[47])) et[1].set(5, true);
418 if ((!hitptn0[31])) et[0].set(5, true);
419
420 if (hitptn0[31] || hitptn1[15] || hitptn1[30] || hitptn1[31] || hitptn1[46] || hitptn1[47]) {
421 if (et[0] < et[1]) {
422 s.set(p, 4, &binside[209]);
423 } else {
424 s.set(p, 4, &boutside[139]);
425 }
426 } else {
427 }
428
429 p += 4;
430
431
432
433 if (hitptn1[31] || hitptn1[47]) {
434 s.set(p, 4, &boutside[144]); // edge info. purely from outside FE. cell 63, 79
435 } else {
436 }
437//p+=4;
438
439 // ...clock counter ...
440 // no process for cc at this moment
441
442 // ...N/A and reserved bit ...
443 // no process for these at this moment
444
445//...Debug...
446 if (TRGDebug::level() > 1) {
447 unpackerInner(input, s);
448 }
449
450//...Termination...
451 delete[] binput;
452
453 return s;
454 }
static void unpackerInner(const TRGState &input, const TRGState &output)
Unpack TRGState.
Definition: Merger.cc:719

◆ packerInnerInside()

TRGState packerInnerInside ( const TRGState input)
static

Makes bit pattern using input bit pattern for the inner FE.

Definition at line 341 of file FrontEnd.cc.

342 {
343
344 //...Input should be 48 hit pattern and 48x5 timing, total 288 bits...
345 //
346 // Wire numbers and TS ID
347 //
348 // outside
349 //
350 // +--+--+--+--+- -+--+--+--+--+--+--+
351 // | 31 | 30 | .... | 18 | 17 | 16 |
352 // +--+--+--+--+--+- -+--+--+--+--+--+--+
353 // | 15 | 14 | .....| 2 | 1 | 0 |
354 // +--+--+--+--+--+- -+--+--+--+--+--+--+
355 // | x | x | .... | x | x | x |
356 // +--+--+--+--+- -+--+--+--+--+--+--+
357 //
358 // 15 14 .... 2 1 0 <- partial TS ID
359 //
360 // inside
361 //
362
363 //...Prepare a state for output...
364 TRGState s(32 + 16 * 5 + 16 + 16 * 5 + 1 * 5 + 43); // 1*5 for missing wire + 43 bits to fill to 256 bits
365
366 //...Set up bool array...
367 bool* b = new bool[input.size()];
368 input.copy2bool(b);
369
370 //...Naming...
371 const bool* const hitptn = & b[16]; // 16x2 = 32 bits
372 const bool* const timing[32] = {
373 & b[128], & b[133], & b[138], & b[143],
374 & b[148], & b[153], & b[158], & b[163],
375 & b[168], & b[173], & b[178], & b[183],
376 & b[188], & b[193], & b[198], & b[203],
377 & b[208], & b[213], & b[218], & b[223],
378 & b[228], & b[233], & b[238], & b[243],
379 & b[248], & b[253], & b[258], & b[263],
380 & b[268], & b[273], & b[278], & b[283]
381 };
382
383 //...Store hit pattern...
384 s.set(0, 32, hitptn);
385 unsigned p = 32;
386
387 //bool true_5[5] = {true, true, true, true, true};
388
389 //...Priority timing...
390 TRGState secondPriority(16);
391 for (unsigned i = 0; i < 16; i++) {
392
393 //...Priority cell...
394 if (hitptn[i]) {
395 s.set(p, 5, timing[i]);
396 }
397
398 //...Second priority cells...
399 else {
400
401 //...Right side edge...
402 if (i == 0) {
403 if (hitptn[16]) {
404 s.set(p, 5, timing[16]);
405 secondPriority.set(i, true);
406 } else {
407 // s.set(p, 5, true_5);
408 secondPriority.set(i, false);
409 }
410 }
411
412 //...Others...
413 else {
414
415 //...Both secondarys have hit...
416 if (hitptn[i + 15] && hitptn[i + 16]) {
417 const unsigned t0 = TRGState::toUnsigned(5, timing[15]);
418 const unsigned t1 = TRGState::toUnsigned(5, timing[16]);
419 if (t0 < t1) {
420 s.set(p, 5, timing[i + 15]);
421 secondPriority.set(i, false);
422 } else {
423 s.set(p, 5, timing[i + 16]);
424 secondPriority.set(i, true);
425 }
426 }
427
428 //...Secondary at right side...
429 else if (hitptn[i + 15]) {
430 s.set(p, 5, timing[i + 15]);
431 secondPriority.set(i, false);
432 }
433
434 //...Secondary at left side...
435 else if (hitptn[i + 16]) {
436 s.set(p, 5, timing[i + 16]);
437 secondPriority.set(i, true);
438 }
439
440 // No secondary case. No action
441 else {
442 //s.set(p, 5, true_5);
443 //secondPriority.set(i, true);
444 }
445 }
446 }
447
448 p += 5;
449 }
450
451 s.set(p, secondPriority);
452 p += 16;
453
454 //...Fastest timing...
455 for (unsigned i = 0; i < 16; i++) {
456
457 //...Right side edge...
458 if (i == 0) {
459 const bool h[2] = {hitptn[0], hitptn[16]};
460 const unsigned hh = TRGState::toUnsigned(2, h);
461 const unsigned t0 = TRGState::toUnsigned(5, timing[0]);
462 const unsigned t1 = TRGState::toUnsigned(5, timing[16]);
463
464 //...No hit case : no action
465 if (hh == 0) {
466 //s.set(p, 5, true_5);
467 }
468
469 //...One hit case...
470 else if (hh == 1) {
471 s.set(p, 5, timing[0]);
472 } else if (hh == 2) {
473 s.set(p, 5, timing[16]);
474 }
475
476 //...Two hit case...
477 else {
478 if (t0 <= t1)
479 s.set(p, 5, timing[0]);
480 else
481 s.set(p, 5, timing[16]);
482 }
483 }
484
485 //...Others...
486 else {
487 const unsigned i0 = i;
488 const unsigned i1 = i + 15;
489 const unsigned i2 = i + 16;
490 const bool h[3] = {hitptn[i0], hitptn[i1], hitptn[i2]};
491 const unsigned hh = TRGState::toUnsigned(3, h);
492 const unsigned t0 = TRGState::toUnsigned(5, timing[i0]);
493 const unsigned t1 = TRGState::toUnsigned(5, timing[i1]);
494 const unsigned t2 = TRGState::toUnsigned(5, timing[i2]);
495
496 //...No hit case : no action
497 if (hh == 0) {
498 //s.set(p, 5, true_5);
499 }
500
501 //...One hit case...
502 else if (hh == 1) {
503 // cout << "p=" << p << endl;
504 // cout << "one hit pri" << endl;
505 // s.dump("detail", "one hit pri ");
506 // s.subset(p, 5).dump("detail", "one hit pri ");
507 s.set(p, 5, timing[i0]);
508 // s.dump("detail", "one hit pri ");
509 // s.subset(p, 5).dump("detail", "one hit pri ");
510 } else if (hh == 2) {
511 // cout << "one hit sec0" << endl;
512 s.set(p, 5, timing[i1]);
513 } else if (hh == 4) {
514 // cout << "one hit sec1" << endl;
515 s.set(p, 5, timing[i2]);
516 }
517
518 //...Two hit case...
519 else if (hh == 3) {
520 if (t0 <= t1)
521 s.set(p, 5, timing[i0]);
522 else
523 s.set(p, 5, timing[i1]);
524 } else if (hh == 5) {
525 if (t0 <= t2)
526 s.set(p, 5, timing[i0]);
527 else
528 s.set(p, 5, timing[i2]);
529 } else if (hh == 6) {
530 if (t1 <= t2)
531 s.set(p, 5, timing[i1]);
532 else
533 s.set(p, 5, timing[i2]);
534 }
535
536 //...Three hit case...
537 else {
538 if ((t0 <= t1) && (t0 <= t2))
539 s.set(p, 5, timing[i0]);
540 else if (t1 <= t2)
541 s.set(p, 5, timing[i1]);
542 else
543 s.set(p, 5, timing[i2]);
544 }
545 }
546
547 p += 5;
548 }
549
550 //...Timing of missing wires on edge TS...
551 if (hitptn[31]) {
552 s.set(p, 5, timing[31]);
553 } else {
554 //s.set(p, 5, true_5);
555 }
556 // p+=5;
557
558 //...Debug...
559#ifdef TRG_DEBUG
560 // input.dump("detail", TRGDebug::tab() + "FrontEnd_II in ");
561 // s.dump("detail", TRGDebug::tab() + "FrontEnd_II out ");
562// unpackerInnerInside(input, s);
563#endif
564
565 //...Termination...
566 delete[] b;
567 return s;
568 }
static unsigned toUnsigned(unsigned n, const bool *array)
Coverts from bool array to unsigned.
Definition: State.h:334

◆ packerInnerOutside()

TRGState packerInnerOutside ( const TRGState input)
static

Makes bit pattern using input bit pattern for the outer FE.

Definition at line 571 of file FrontEnd.cc.

572 {
573
574 //...Input should be 48 hit pattern and 48x5 timing, total 288 bits...
575 //
576 // Wire numbers and TS ID
577 //
578 // outside
579 //
580 // +--+--+--+--+- -+--+--+--+--+--+--+
581 // | 47 | 46 | .... | 34 | 33 | 32 |
582 // +--+--+--+--+--+- -+--+--+--+--+--+--+
583 // | 31 | 30 | ..... | 18 | 17 | 16 |
584 // +--+--+--+--+--+- -+--+--+--+--+--+--+
585 // | 15 | 14 | .... | 2 | 1 | 0 |
586 // +--+--+--+--+- -+--+--+--+--+--+--+
587 //
588 // 15 14 .... 2 1 0 <- partial TS ID
589 //
590 // inside
591 //
592
593 //...Prepare a state for output...
594 TRGState s(48 + 16 * 5 + 4 * 5 + 108); // 4*5 for missing area timings + 108 to fill to 256 bits
595
596 //...Set up bool array...
597 bool* b = new bool[input.size()];
598 input.copy2bool(b);
599
600 //...Naming...
601 const bool* const hitptn = & b[0]; // 16x3 = 48 bits
602 const bool* const timing[48] = {
603 & b[48], & b[53], & b[58], & b[63],
604 & b[68], & b[73], & b[78], & b[83],
605 & b[88], & b[93], & b[98], & b[103],
606 & b[108], & b[113], & b[118], & b[123],
607 & b[128], & b[133], & b[138], & b[143],
608 & b[148], & b[153], & b[158], & b[163],
609 & b[168], & b[173], & b[178], & b[183],
610 & b[188], & b[193], & b[198], & b[203],
611 & b[208], & b[213], & b[218], & b[223],
612 & b[228], & b[233], & b[238], & b[243],
613 & b[248], & b[253], & b[258], & b[263],
614 & b[268], & b[273], & b[278], & b[283]
615 };
616
617 //...Store hit pattern...
618 s.set(0, 48, hitptn);
619 unsigned p = 48;
620
621 //...Fastest timing...
622 const bool dummy[6] = {false, false, false, false, false, true},
623 dummymax[5] = {true, true, true, true, true};
624 const TRGState wtDummy(6, dummy), wtDummymax(5, dummymax);
625 for (unsigned i = 0; i < 20; i++) { // 0 ... 15 for 16 standard ones, 16...19 for four edge areas.
626 TRGState wt[12];
627
628 if (i == 0) { // TS ID 0 has missing wires
629 wt[0] = wtDummy;
630 wt[1] = TRGState(5, timing[0]);
631 wt[2] = TRGState(5, timing[1]);
632 wt[3] = wtDummy;
633 wt[4] = wtDummy;
634 wt[5] = TRGState(5, timing[16]);
635 wt[6] = TRGState(5, timing[17]);
636 wt[7] = wtDummy;
637 wt[8] = wtDummy;
638 wt[9] = TRGState(5, timing[32]);
639 wt[10] = TRGState(5, timing[33]);
640 wt[11] = TRGState(5, timing[34]);
641
642 //...Append 6th bit to indicate hit or not (no hit = 1)...
643 if (! hitptn[0]) wt[1].set(5, true);
644 if (! hitptn[1]) wt[2].set(5, true);
645 if (! hitptn[16]) wt[5].set(5, true);
646 if (! hitptn[17]) wt[6].set(5, true);
647 if (! hitptn[32]) wt[9].set(5, true);
648 if (! hitptn[33]) wt[10].set(5, true);
649 if (! hitptn[34]) wt[11].set(5, true);
650 } else if (i == 1) { // TS ID 1 has missing wires
651 wt[0] = TRGState(5, timing[0]);
652 wt[1] = TRGState(5, timing[1]);
653 wt[2] = TRGState(5, timing[2]);
654 wt[3] = wtDummy;
655 wt[4] = TRGState(5, timing[16]);
656 wt[5] = TRGState(5, timing[17]);
657 wt[6] = TRGState(5, timing[18]);
658 wt[7] = wtDummy;
659 wt[8] = TRGState(5, timing[32]);
660 wt[9] = TRGState(5, timing[33]);
661 wt[10] = TRGState(5, timing[34]);
662 wt[11] = TRGState(5, timing[35]);
663
664 //...Append 6th bit to indicate hit or not (no hit = 1)...
665 if (! hitptn[0]) wt[0].set(5, true);
666 if (! hitptn[1]) wt[1].set(5, true);
667 if (! hitptn[2]) wt[2].set(5, true);
668 if (! hitptn[16]) wt[4].set(5, true);
669 if (! hitptn[17]) wt[5].set(5, true);
670 if (! hitptn[18]) wt[6].set(5, true);
671 if (! hitptn[32]) wt[8].set(5, true);
672 if (! hitptn[33]) wt[9].set(5, true);
673 if (! hitptn[34]) wt[10].set(5, true);
674 if (! hitptn[35]) wt[11].set(5, true);
675 } else if (i == 14) { // TS ID 14 has missing wires
676 wt[0] = TRGState(5, timing[13]);
677 wt[1] = TRGState(5, timing[14]);
678 wt[2] = TRGState(5, timing[15]);
679 wt[3] = TRGState(5, timing[28]);
680 wt[4] = TRGState(5, timing[29]);
681 wt[5] = TRGState(5, timing[30]);
682 wt[6] = TRGState(5, timing[31]);
683 wt[7] = TRGState(5, timing[44]);
684 wt[8] = TRGState(5, timing[45]);
685 wt[9] = TRGState(5, timing[46]);
686 wt[10] = TRGState(5, timing[47]);
687 wt[11] = wtDummy;
688
689 //...Append 6th bit to indicate hit or not (no hit = 1)...
690 if (! hitptn[13]) wt[0].set(5, true);
691 if (! hitptn[14]) wt[1].set(5, true);
692 if (! hitptn[15]) wt[2].set(5, true);
693 if (! hitptn[28]) wt[3].set(5, true);
694 if (! hitptn[29]) wt[4].set(5, true);
695 if (! hitptn[30]) wt[5].set(5, true);
696 if (! hitptn[31]) wt[6].set(5, true);
697 if (! hitptn[44]) wt[7].set(5, true);
698 if (! hitptn[45]) wt[8].set(5, true);
699 if (! hitptn[46]) wt[9].set(5, true);
700 if (! hitptn[47]) wt[10].set(5, true);
701 } else if (i == 15) { // TS ID 15 has missing wires
702 wt[0] = TRGState(5, timing[14]);
703 wt[1] = TRGState(5, timing[15]);
704 wt[2] = wtDummy;
705 wt[3] = TRGState(5, timing[29]);
706 wt[4] = TRGState(5, timing[30]);
707 wt[5] = TRGState(5, timing[31]);
708 wt[6] = wtDummy;
709 wt[7] = TRGState(5, timing[45]);
710 wt[8] = TRGState(5, timing[46]);
711 wt[9] = TRGState(5, timing[47]);
712 wt[10] = wtDummy;
713 wt[11] = wtDummy;
714
715 //...Append 6th bit to indicate hit or not (no hit = 1)...
716 if (! hitptn[14]) wt[0].set(5, true);
717 if (! hitptn[15]) wt[1].set(5, true);
718 if (! hitptn[29]) wt[3].set(5, true);
719 if (! hitptn[30]) wt[4].set(5, true);
720 if (! hitptn[31]) wt[5].set(5, true);
721 if (! hitptn[45]) wt[7].set(5, true);
722 if (! hitptn[46]) wt[8].set(5, true);
723 if (! hitptn[47]) wt[9].set(5, true);
724 } else if (i == 16) { // edge area 1, only cell 32 at position 11
725 wt[0] = wtDummy;
726 wt[1] = wtDummy;
727 wt[2] = wtDummy;
728 wt[3] = wtDummy;
729 wt[4] = wtDummy;
730 wt[5] = wtDummy;
731 wt[6] = wtDummy;
732 wt[7] = wtDummy;
733 wt[8] = wtDummy;
734 wt[9] = wtDummy;
735 wt[10] = wtDummy;
736 wt[11] = TRGState(5, timing[32]);
737
738 //...Append 6th bit to indicate hit or not (no hit = 1)...
739 if (! hitptn[32]) wt[11].set(5, true);
740 } else if (i == 17) { // edge area 1, cell 0, 16, 32, 33 at position 2, 6, 10, 11
741 wt[0] = wtDummy;
742 wt[1] = wtDummy;
743 wt[2] = TRGState(5, timing[0]);
744 wt[3] = wtDummy;
745 wt[4] = wtDummy;
746 wt[5] = wtDummy;
747 wt[6] = TRGState(5, timing[16]);
748 wt[7] = wtDummy;
749 wt[8] = wtDummy;
750 wt[9] = wtDummy;
751 wt[10] = TRGState(5, timing[32]);
752 wt[11] = TRGState(5, timing[33]);
753
754 //...Append 6th bit to indicate hit or not (no hit = 1)...
755 if (! hitptn[0]) wt[2].set(5, true);
756 if (! hitptn[16]) wt[6].set(5, true);
757 if (! hitptn[32]) wt[10].set(5, true);
758 if (! hitptn[33]) wt[11].set(5, true);
759 } else if (i == 18) { // edge area 3, cell 15, 30, 31, 46, 47 at position 0, 3, 4, 7, 8
760 wt[0] = TRGState(5, timing[15]);
761 wt[1] = wtDummy;
762 wt[2] = wtDummy;
763 wt[3] = TRGState(5, timing[30]);
764 wt[4] = TRGState(5, timing[31]);
765 wt[5] = wtDummy;
766 wt[6] = wtDummy;
767 wt[7] = TRGState(5, timing[46]);
768 wt[8] = TRGState(5, timing[47]);
769 wt[9] = wtDummy;
770 wt[10] = wtDummy;
771 wt[11] = wtDummy;
772
773 //...Append 6th bit to indicate hit or not (no hit = 1)...
774 if (! hitptn[15]) wt[0].set(5, true);
775 if (! hitptn[30]) wt[3].set(5, true);
776 if (! hitptn[31]) wt[4].set(5, true);
777 if (! hitptn[46]) wt[7].set(5, true);
778 if (! hitptn[47]) wt[8].set(5, true);
779 } else if (i == 19) { // edge area 4, only cell 31 and 47 at position 3 and 7
780 wt[0] = wtDummy;
781 wt[1] = wtDummy;
782 wt[2] = wtDummy;
783 wt[3] = TRGState(5, timing[31]);
784 wt[4] = wtDummy;
785 wt[5] = wtDummy;
786 wt[6] = wtDummy;
787 wt[7] = TRGState(5, timing[47]);
788 wt[8] = wtDummy;
789 wt[9] = wtDummy;
790 wt[10] = wtDummy;
791 wt[11] = wtDummy;
792
793 //...Append 6th bit to indicate hit or not (no hit = 1)...
794 if (! hitptn[31]) wt[3].set(5, true);
795 if (! hitptn[47]) wt[7].set(5, true);
796 } else {
797 wt[0] = TRGState(5, timing[i - 1]);
798 wt[1] = TRGState(5, timing[i]);
799 wt[2] = TRGState(5, timing[i + 1]);
800 wt[3] = TRGState(5, timing[i + 14]);
801 wt[4] = TRGState(5, timing[i + 15]);
802 wt[5] = TRGState(5, timing[i + 16]);
803 wt[6] = TRGState(5, timing[i + 17]);
804 wt[7] = TRGState(5, timing[i + 30]);
805 wt[8] = TRGState(5, timing[i + 31]);
806 wt[9] = TRGState(5, timing[i + 32]);
807 wt[10] = TRGState(5, timing[i + 33]);
808 wt[11] = TRGState(5, timing[i + 34]);
809
810 //...Append 6th bit to indicate hit or not (no hit = 1)...
811 if (! hitptn[i - 1]) wt[0].set(5, true);
812 if (! hitptn[i]) wt[1].set(5, true);
813 if (! hitptn[i + 1]) wt[2].set(5, true);
814 if (! hitptn[i + 14]) wt[3].set(5, true);
815 if (! hitptn[i + 15]) wt[4].set(5, true);
816 if (! hitptn[i + 16]) wt[5].set(5, true);
817 if (! hitptn[i + 17]) wt[6].set(5, true);
818 if (! hitptn[i + 30]) wt[7].set(5, true);
819 if (! hitptn[i + 31]) wt[8].set(5, true);
820 if (! hitptn[i + 32]) wt[9].set(5, true);
821 if (! hitptn[i + 33]) wt[10].set(5, true);
822 if (! hitptn[i + 34]) wt[11].set(5, true);
823 }
824
825 //...Look for the fastest hit...
826 unsigned fastest0 = 0;
827 unsigned fastest1 = 0;
828 unsigned fastest2 = 0;
829 unsigned fastest3 = 0;
830 unsigned fastest4 = 0;
831 unsigned fastest5 = 0;
832 if (wt[0] < wt[1])
833 fastest0 = 0;
834 else
835 fastest0 = 1;
836 if (wt[2] < wt[3])
837 fastest1 = 2;
838 else
839 fastest1 = 3;
840 if (wt[4] < wt[5])
841 fastest2 = 4;
842 else
843 fastest2 = 5;
844 if (wt[6] < wt[7])
845 fastest3 = 6;
846 else
847 fastest3 = 7;
848 if (wt[8] < wt[9])
849 fastest4 = 8;
850 else
851 fastest4 = 9;
852 if (wt[10] < wt[11])
853 fastest5 = 10;
854 else
855 fastest5 = 11;
856
857 unsigned fastest10 = 0;
858 if (wt[fastest0] < wt[fastest1])
859 fastest10 = fastest0;
860 else
861 fastest10 = fastest1;
862
863 unsigned fastest11 = 0;
864 if (wt[fastest2] < wt[fastest3])
865 fastest11 = fastest2;
866 else
867 fastest11 = fastest3;
868
869 unsigned fastest12 = 0;
870 if (wt[fastest4] < wt[fastest5])
871 fastest12 = fastest4;
872 else
873 fastest12 = fastest5;
874
875 unsigned fastest101 = 0;
876 if (wt[fastest10] < wt[fastest11])
877 fastest101 = fastest10;
878 else
879 fastest101 = fastest11;
880
881 unsigned fastest102 = 0;
882 if (wt[fastest101] < wt[fastest12])
883 fastest102 = fastest101;
884 else
885 fastest102 = fastest12;
886
887 TRGState fastest(5);
888 if (! wt[fastest102].active(5))
889 fastest = wt[fastest102].subset(0, 5);
890
891 s.set(p, fastest);
892 p += 5;
893 }
894
896 //s.set(p, 5, timing[0]);
897 //p += 5;
898 //s.set(p, 5, timing[16]);
899 //p += 5;
900 //s.set(p, 5, timing[32]);
901 //p += 5;
902 //s.set(p, 5, timing[33]);
903 //p += 5;
904 //s.set(p, 5, timing[15]);
905 //p += 5;
906 //s.set(p, 5, timing[30]);
907 //p += 5;
908 //s.set(p, 5, timing[31]);
909 //p += 5;
910 //s.set(p, 5, timing[46]);
911 //p += 5;
912 //s.set(p, 5, timing[47]);
913
914#ifdef TRG_DEBUG
915// unpackerInnerOutside(input, s);
916#endif
917
918 delete[] b;
919 return s;
920 }

◆ packerOuter()

TRGState packerOuter ( const TRGState input)
static

Make bit pattern using input information from outer FEs.

Definition at line 460 of file Merger.cc.

461 {
462
463 // packerOuter: for SuperLayer 1 - 8
464 //
465 // inputInsdie should be 48 hit pattern and 1x16x5 + 1x16x5 timing,
466 // plus edge information
467 // total 192 bits... (whole data pack 256 bits)
468 //
469 // inputOutside should be 48 hit pattern and 1x16x5 + 1x16x5 timing,
470 // plus edge information
471 // total 192 bits... (whole data pack 256 bits)
472 //
473 // Wire numbers and TS ID
474 //
475 // Outside
476 //
477 // +--+--+--+--+- -+--+--+--+--+--+--+
478 // | x | x | .... | x | x | x |
479 // +--+--+--+--+--+- -+--+--+--+--+--+--+
480 // | 79 | 78 | ..... | 66 | 65 | 64 |
481 // +--+--+--+--+--+- -+--+--+--+--+--+--+
482 // | 63 | 62 | .... | 50 | 49 | 48 |
483 // +--+--+--+--+--+- -+--+--+--+--+--+
484 //
485 // +--+--+--+--+- -+--+--+--+--+--+--+
486 // | 47 | 46 | .... | 34 | 33 | 32 |
487 // +--+--+--+--+--+- -+--+--+--+--+--+--+
488 // | 31 | 30 | ..... | 18 | 17 | 16 |
489 // +--+--+--+--+--+- -+--+--+--+--+--+--+
490 // | 15 | 14 | .... | 2 | 1 | 0 |
491 // +--+--+--+--+- -+--+--+--+--+--+--+
492 //
493 // 15 14 .... 2 1 0 <- partial TS ID
494 //
495 //...Prepare a state for output...
496 // hit map: 80x1
497 // priority hit time: 16x4
498 // fastest hit time: 16x4
499 // 2nd proi. hit flag: 16x1
500 // edge time info: 3x4
501 // cc: 1x9
502 // N/A and reserved: fill to total 256 bits
503 TRGState s(80 + 16 * 4 + 16 * 4 + 16 + 3 * 4 + 9 + 11);
504
505
506 bool* binput = new bool[input.size()];
507 input.copy2bool(binput);
508 bool* binside = & binput[0];
509 bool* boutside = & binput[256]; // half of the input.size(), should be 256
510
511
512 // ... hitmap ...
513 const bool* const hitptn0 = & binside[0]; // 16x3 = 48 bits
514 const bool* const hitptn1 = & boutside[0]; // 16x2 = 32 bits
515 s.set(0, 48, hitptn0);
516 s.set(48, 32, hitptn1);
517
518 bool PTS_in_hit[16];
519 bool PTS_out_hit[16];
520 for (unsigned i = 0; i < 16; i++) {
521 if (i == 0) {
522 PTS_in_hit[i] = hitptn0[0] || hitptn0[1] || hitptn0[16] || hitptn0[32] ;
523 PTS_out_hit[i] = hitptn1[0] || hitptn1[16] || hitptn1[17];
524 } else if (i == 15) {
525 PTS_in_hit[i] = hitptn0[14] || hitptn0[15] || hitptn0[30] || hitptn0[31] || hitptn0[47] ;
526 PTS_out_hit[i] = hitptn1[14] || hitptn1[15] || hitptn1[30] || hitptn1[31];
527 } else {
528 PTS_in_hit[i] = hitptn0[i - 1] || hitptn0[i] || hitptn0[i + 1] || hitptn0[i + 15] || hitptn0[i + 16] || hitptn0[i + 32];
529 PTS_out_hit[i] = hitptn1[i - 1] || hitptn1[i] || hitptn1[i + 15] || hitptn1[i + 16] || hitptn1[i + 17];
530 }
531 }
532
533 // ... priority time ...
534 /*
535 const bool * const ptinside[16] = {
536 &binside[49], &binside[54], &binside[59], &binside[64],
537 &binside[69], &binside[74], &binside[79], &binside[84],
538 &binside[89], &binside[94], &binside[99], &binside[104],
539 &binside[109], &binside[114], &binside[119], &binside[124]
540 };
541 const bool * const ptoutside[16] = {
542 &boutside[49], &boutside[54], &boutside[59], &boutside[64],
543 &boutside[69], &boutside[74], &boutside[79], &boutside[84],
544 &boutside[89], &boutside[94], &boutside[99], &boutside[104],
545 &boutside[109], &boutside[114], &boutside[119], &boutside[124]
546 };
547 */
548
549 // i = 0...15
550 // inside binside[31+i]
551 // outside boutside[i]
552// const bool scflag[2] = {false, true};
553 const bool dummy[6] = {false, false, false, false, false, true};
554 const TRGState stDummy(6, dummy);
555 unsigned p = 80;
556
557 for (unsigned i = 0; i < 16; i++) {
558 //unsigned sc=0;
559 if (hitptn0[32 + i]) {
560 s.set(p, 4, &binside[49 + 5 * i]);;
561 } else {
562 // decide which 2nd priority time to use if 1st priority cell not hit
563 TRGState st[2];
564 if (i == 0) {
565 if (hitptn1[0]) {
566 s.set(p, 4, &boutside[49]);
567// sc = 1;
568 s.set(208 + i, 1, true);
569 } else {
570// sc = 0;
571// s.set(209+i, 1, &scflag[sc]);
572 }
573 } else {
574 st[0] = TRGState(5, &boutside[43 + i * 5]);
575 st[1] = TRGState(5, &boutside[48 + i * 5]);
576 if (!hitptn1[i - 1]) st[0].set(5, true);
577 if (!hitptn1[i]) st[1].set(5, true);
578
579 if (hitptn1[i] || hitptn1[i - 1]) {
580 if (st[1] < st[0]) {
581 s.set(p, 4, &boutside[49 + i * 5]);
582 s.set(208 + i, 1, true); // only set scflag to true when left is it and also faster
583 } else {
584// sc = 1;
585 s.set(p, 4, &boutside[44 + i * 5]);
586 }
587 } else {
588 }
589
590
591 }
592
593 }
594// s.set(209+i, 1, &scflag[sc]); //the scflag is only consider when (1st not hit) && (2nd is hit)
595 p += 4;
596 }
597
598
599 // ... fastest time ...
600
601
602
603
604 /*
605 const bool * const ftinside[16] = {
606 &binside[129], &binside[134], &binside[139], &binside[144],
607 &binside[149], &binside[154], &binside[159], &binside[164],
608 &binside[169], &binside[174], &binside[179], &binside[184],
609 &binside[189], &binside[194], &binside[199], &binside[204]
610 };
611 const bool * const ftoutside[16] = {
612 &boutside[129], &boutside[134], &boutside[139], &boutside[144],
613 &boutside[149], &boutside[154], &boutside[159], &boutside[164],
614 &boutside[169], &boutside[174], &boutside[179], &boutside[184],
615 &boutside[189], &boutside[194], &boutside[199], &boutside[204]
616 };
617 */
618 // need to consider if those areas are hit
619 p = 144;
620 for (unsigned i = 0; i < 16; i++) {
621 TRGState st[2];
622 st[0] = TRGState(5, &binside[128 + i * 5]);
623 st[1] = TRGState(5, &boutside[128 + i * 5]);
624
625 if (!PTS_in_hit[i]) st[0].set(5, true);
626 if (!PTS_out_hit[i]) st[1].set(5, true);
627
628 if (PTS_in_hit[i] || PTS_out_hit[i]) {
629 if (st[0] < st[1]) {
630 s.set(p, 4, &binside[129 + i * 5]);
631 } else {
632 s.set(p, 4, &boutside[129 + i * 5]);
633 }
634 } else {
635 }
636 /*
637 if ( st[0] < st[1] ) {
638 s.set(p, 4, &binside[129 + i*5]);
639 }
640 else {
641 s.set(p, 4, &boutside[129 + i*5]);
642 }
643 */
644
645 p += 4;
646 }
647
648 // ... edge information ...
649 /*
650 const bool * const etinside[16] = {&binside[209], &binside[214] };
651 const bool * const etoutside[16] = {&boutside[209], &boutside[214] };
652 */
653 p = 224;
654
655 if (hitptn1[15]) {
656 s.set(p, 4, &boutside[124]); // 4-bit hit time of cell[63]
657 }
658
659 for (unsigned i = 0; i < 2; i++) {
660 TRGState et[2];
661 // need to consider if the two areas hit
662 et[0] = TRGState(5, &binside[208 + i * 5]);
663 et[1] = TRGState(5, &boutside[208 + i * 5]);
664
665 if (i == 0) {
666 if (!hitptn0[0]) et[0].set(5, true);
667 if (!hitptn1[16]) et[1].set(5, true);
668 p += 4;
669 if (hitptn0[0] || hitptn1[16]) {
670 if (et[0] < et[1]) {
671 s.set(p, 4, &binside[209 + i * 5]);
672 } else {
673 s.set(p, 4, &boutside[209 + i * 5]);
674 }
675 } else {
676 }
677
678 } else if (i == 1) {
679 if (!hitptn0[15] && !hitptn0[31]) et[0].set(5, true);
680 if (!hitptn1[15] && !hitptn1[31]) et[1].set(5, true);
681 p += 4;
682 if (hitptn0[15] || hitptn0[31] || hitptn1[15] || hitptn1[31]) {
683 if (et[0] < et[1]) {
684 s.set(p, 4, &binside[209 + i * 5]);
685 } else {
686 s.set(p, 4, &boutside[209 + i * 5]);
687 }
688 } else {
689 }
690
691
692 }
693 // p += 4;
694 } // warning, here 'p' is at the beginning position of the last sensible data
695
696
697 // ...clock counter ...
698 // no process for cc at this moment
699
700 // ...N/A and reserved bit ...
701 // no process for these at this moment
702
703
704//...Debug...
705 if (TRGDebug::level() > 1) {
706 unpackerOuter(input, s);
707 }
708
709//...Termination...
710 delete[] binput;
711 return s;
712
713 }
static void unpackerOuter(const TRGState &input, const TRGState &output)
Unpack TRGState.
Definition: Merger.cc:905

◆ packerOuterEvt()

TRGSignalVector * packerOuterEvt ( vector< TRGSignalVector * >  hitList,
vector< int >  cList,
int  maxHit 
)

Packing output for evtTime & Low pT.

Definition at line 355 of file TrackSegmentFinder.cc.

357 {
358
359 //TRGSignalVector * result = new TRGSignalVector("",(*hitList[0]).clock() ,N+9*maxHit);
360 TRGSignalVector* result = new TRGSignalVector("", (*hitList[0]).clock(),
361 hitList.size() + 9 * maxHit);
362
363 for (unsigned ci = 0; ci < cList.size(); ci++) {
364 int cntHit = 0;
365 for (unsigned hi = 0; hi < hitList.size(); hi++) {
366 if ((*hitList[hi]).state(cList[ci]).active()) {
367 (*result)[9 * maxHit + hi].set(cList[ci], cList[ci] + 1);
368 if (cntHit >= maxHit) continue;
369 for (unsigned j = 0; j < (((*hitList[hi])).size() - 1); j++) {
370 if ((*hitList[hi])[j].state(cList[ci]))
371 (*result)[9 * (maxHit - 1) - (cntHit * 9) + j].set(cList[ci], cList[ci] + 1);
372 }
373 cntHit++;
374 }
375 }
376 }
377 return result;
378 }

◆ packerOuterInside()

TRGState packerOuterInside ( const TRGState input)
static

Makes bit pattern using input bit pattern for the inner FE.

Definition at line 923 of file FrontEnd.cc.

924 {
925
926 //...Input should be 48 hit pattern and 48x5 timing, total 288 bits...
927 //
928 // Wire numbers and TS ID
929 //
930 // outside
931 //
932 // +--+--+--+--+- -+--+--+--+--+--+--+
933 // | 47 | 46 | .... | 34 | 33 | 32 | <- priority wire layer
934 // +--+--+--+--+--+- -+--+--+--+--+--+--+
935 // | 31 | 30 | ..... | 18 | 17 | 16 |
936 // +--+--+--+--+--+- -+--+--+--+--+--+--+
937 // | 15 | 14 | .... | 2 | 1 | 0 |
938 // +--+--+--+--+- -+--+--+--+--+--+--+
939 //
940 // 15 14 .... 2 1 0 <- partial TS ID
941 //
942 // inside
943 //
944 //
945
946 //...Prepare a state for output...
947 //TRGState s(48 + 16 * 5 + 16 * 5 + 3 * 5); // 3*5 for missing wires
948 TRGState s(48 + 16 * 5 + 16 * 5 + 2 * 5 + 38); // 2*5 for edge fastest time, 38 dummy bits to fill to 256 bits
949
950 //...Set up bool array...
951 bool* b = new bool[input.size()];
952 input.copy2bool(b);
953
954 //...Naming...
955 const bool* const hitptn = & b[0]; // 16x3 = 48 bits
956 const bool* const timing[48] = {
957 & b[48], & b[53], & b[58], & b[63],
958 & b[68], & b[73], & b[78], & b[83],
959 & b[88], & b[93], & b[98], & b[103],
960 & b[108], & b[113], & b[118], & b[123],
961 & b[128], & b[133], & b[138], & b[143],
962 & b[148], & b[153], & b[158], & b[163],
963 & b[168], & b[173], & b[178], & b[183],
964 & b[188], & b[193], & b[198], & b[203],
965 & b[208], & b[213], & b[218], & b[223],
966 & b[228], & b[233], & b[238], & b[243],
967 & b[248], & b[253], & b[258], & b[263],
968 & b[268], & b[273], & b[278], & b[283]
969 };
970
971 //...Store hit pattern...
972 s.set(0, 48, hitptn);
973 unsigned p = 48;
974
975 //...Priority cell timing...
976 for (unsigned i = 0; i < 16; i++) {
977 s.set(p, 5, timing[32 + i]);
978 p += 5;
979 }
980
981 //...Fastest timing...
982 const bool dummy[6] = {false, false, false, false, false, true};
983 const TRGState wtDummy(6, dummy);
984 for (unsigned i = 0; i < 18; i++) { // 0 ... 15 for 16 standard ones, 16,17 for two edge areas.
985 TRGState wt[6];
986
987 if (i == 0) { // TS ID 0 has missing wires
988 wt[0] = wtDummy;
989 wt[1] = TRGState(5, timing[0]);
990 wt[2] = TRGState(5, timing[1]);
991 wt[3] = wtDummy;
992 wt[4] = TRGState(5, timing[16]);
993 wt[5] = TRGState(5, timing[32]);
994
995 //...Append 6th bit to indicate hit or not (no hit = 1)...
996 if (! hitptn[0]) wt[1].set(5, true);
997 if (! hitptn[1]) wt[2].set(5, true);
998 if (! hitptn[16]) wt[4].set(5, true);
999 if (! hitptn[32]) wt[5].set(5, true);
1000 } else if (i == 15) { // TS ID 15 has missing wires
1001 wt[0] = TRGState(5, timing[14]);
1002 wt[1] = TRGState(5, timing[15]);
1003 wt[2] = wtDummy;
1004 wt[3] = TRGState(5, timing[30]);
1005 wt[4] = TRGState(5, timing[31]);
1006 wt[5] = TRGState(5, timing[47]);
1007
1008 //...Append 6th bit to indicate hit or not (no hit = 1)...
1009 if (! hitptn[14]) wt[0].set(5, true);
1010 if (! hitptn[15]) wt[1].set(5, true);
1011 if (! hitptn[30]) wt[3].set(5, true);
1012 if (! hitptn[31]) wt[4].set(5, true);
1013 if (! hitptn[47]) wt[5].set(5, true);
1014 } else if (i == 16) { // edge area 1 only for cell 0
1015 wt[0] = wtDummy;
1016 wt[1] = wtDummy;
1017 //wt[2] = TRGState(5, timing[16]);
1018 wt[2] = TRGState(5, timing[0]);
1019 wt[3] = wtDummy;
1020 wt[4] = wtDummy;
1021 wt[5] = wtDummy;
1022 //...Append 6th bit to indicate hit or not (no hit = 1)...
1023 if (! hitptn[0]) wt[2].set(5, true);
1024 } else if (i == 17) { // edge area 2 for cell 15 and 31 only
1025 wt[0] = TRGState(5, timing[15]);
1026 wt[1] = wtDummy;
1027 wt[2] = wtDummy;
1028 wt[3] = TRGState(5, timing[31]);
1029 wt[4] = wtDummy;
1030 wt[5] = wtDummy;
1031
1032 //...Append 6th bit to indicate hit or not (no hit = 1)...
1033 if (! hitptn[15]) wt[0].set(5, true);
1034 if (! hitptn[31]) wt[3].set(5, true);
1035 } else {
1036 wt[0] = TRGState(5, timing[i - 1]);
1037 wt[1] = TRGState(5, timing[i]);
1038 wt[2] = TRGState(5, timing[i + 1]);
1039 wt[3] = TRGState(5, timing[i + 15]);
1040 wt[4] = TRGState(5, timing[i + 16]);
1041 wt[5] = TRGState(5, timing[i + 32]);
1042
1043 //...Append 6th bit to indicate hit or not (no hit = 1)...
1044 if (! hitptn[i - 1]) wt[0].set(5, true);
1045 if (! hitptn[i]) wt[1].set(5, true);
1046 if (! hitptn[i + 1]) wt[2].set(5, true);
1047 if (! hitptn[i + 15]) wt[3].set(5, true);
1048 if (! hitptn[i + 16]) wt[4].set(5, true);
1049 if (! hitptn[i + 32]) wt[5].set(5, true);
1050 }
1051
1052 //...Look for the fastest hit...
1053 unsigned fastest0 = 0;
1054 unsigned fastest1 = 0;
1055 unsigned fastest2 = 0;
1056 if (wt[0] < wt[1])
1057 fastest0 = 0;
1058 else
1059 fastest0 = 1;
1060 if (wt[2] < wt[3])
1061 fastest1 = 2;
1062 else
1063 fastest1 = 3;
1064 if (wt[4] < wt[5])
1065 fastest2 = 4;
1066 else
1067 fastest2 = 5;
1068
1069 unsigned fastest3 = 0;
1070 if (wt[fastest0] < wt[fastest1])
1071 fastest3 = fastest0;
1072 else
1073 fastest3 = fastest1;
1074
1075 unsigned fastest4 = 0;
1076 if (wt[fastest2] < wt[fastest3])
1077 fastest4 = fastest2;
1078 else
1079 fastest4 = fastest3;
1080
1081 TRGState fastest(5);
1082 if (! wt[fastest4].active(5))
1083 fastest = wt[fastest4].subset(0, 5);
1084
1085 s.set(p, fastest);
1086 p += 5;
1087 }
1088
1089 //s.set(p, 5, timing[0]);
1090 //p += 5;
1091 //s.set(p, 5, timing[15]);
1092 //p += 5;
1093 //s.set(p, 5, timing[31]);
1094
1095#ifdef TRG_DEBUG
1096// unpackerOuterInside(input, s);
1097#endif
1098
1099 delete[] b;
1100 return s;
1101 }

◆ packerOuterOutside()

TRGState packerOuterOutside ( const TRGState input)
static

Makes bit pattern using input bit pattern for the outer FE.

Definition at line 1104 of file FrontEnd.cc.

1105 {
1106
1107 //...Input should be 48 hit pattern and 48x5 timing, total 288 bits...
1108 //
1109 // Wire numbers and TS ID
1110 //
1111 // outside
1112 //
1113 // +--+--+--+--+- -+--+--+--+--+--+--+
1114 // | 47 | 46 | .... | 34 | 33 | 32 |
1115 // +--+--+--+--+--+- -+--+--+--+--+--+--+
1116 // | 31 | 30 | ..... | 18 | 17 | 16 |
1117 // +--+--+--+--+--+- -+--+--+--+--+--+--+
1118 // | 15 | 14 | .... | 2 | 1 | 0 | <- second priority wire layer
1119 // +--+--+--+--+- -+--+--+--+--+--+--+
1120 //
1121 // 15 14 .... 2 1 0 <- partial TS ID
1122 //
1123 // inside
1124 //
1125 //
1126
1127 //...Prepare a state for output...
1128 //TRGState s(48 + 16 * 5 + 16 * 5 + 3 * 5); // 3*5 for missing wires
1129 TRGState s(48 + 16 * 5 + 16 * 5 + 2 * 5 + 38); // 2*5 for edge fastest time, 38 dummy bits to fill to 256 bits
1130
1131
1132 //...Set up bool array...
1133 bool* b = new bool[input.size()];
1134 input.copy2bool(b);
1135
1136 //...Naming...
1137 const bool* const hitptn = & b[0]; // 16x3 = 48 bits
1138 const bool* const timing[48] = {
1139 & b[48], & b[53], & b[58], & b[63],
1140 & b[68], & b[73], & b[78], & b[83],
1141 & b[88], & b[93], & b[98], & b[103],
1142 & b[108], & b[113], & b[118], & b[123],
1143 & b[128], & b[133], & b[138], & b[143],
1144 & b[148], & b[153], & b[158], & b[163],
1145 & b[168], & b[173], & b[178], & b[183],
1146 & b[188], & b[193], & b[198], & b[203],
1147 & b[208], & b[213], & b[218], & b[223],
1148 & b[228], & b[233], & b[238], & b[243],
1149 & b[248], & b[253], & b[258], & b[263],
1150 & b[268], & b[273], & b[278], & b[283]
1151 };
1152
1153 //...Store hit pattern...
1154 s.set(0, 48, hitptn);
1155 unsigned p = 48;
1156
1157
1158 //...Second priority cell timing...
1159 for (unsigned i = 0; i < 16; i++) {
1160 s.set(p, 5, timing[i]);
1161 p += 5;
1162 }
1163
1164 //...Fastest timing...
1165 const bool dummy[6] = {false, false, false, false, false, true};
1166 const TRGState wtDummy(6, dummy);
1167 for (unsigned i = 0; i < 18; i++) { // 0 ... 15 for 16 standard ones, 16,17 for two edge areas.
1168 TRGState wt[5];
1169
1170 if (i == 0) { // TS ID 0 has missing wires
1171 wt[0] = wtDummy;
1172 wt[1] = TRGState(5, timing[0]);
1173 wt[2] = wtDummy;
1174 wt[3] = TRGState(5, timing[16]);
1175 wt[4] = TRGState(5, timing[17]);
1176
1177 //...Append 6th bit to indicate hit or not (no hit = 1)...
1178 if (! hitptn[0]) wt[1].set(5, true);
1179 if (! hitptn[16]) wt[3].set(5, true);
1180 if (! hitptn[17]) wt[4].set(5, true);
1181 } else if (i == 15) { // TS ID 15 has missing wires
1182 wt[0] = TRGState(5, timing[14]);
1183 wt[1] = TRGState(5, timing[15]);
1184 wt[2] = TRGState(5, timing[30]);
1185 wt[3] = TRGState(5, timing[31]);
1186 wt[4] = wtDummy;
1187
1188 //...Append 6th bit to indicate hit or not (no hit = 1)...
1189 if (! hitptn[14]) wt[0].set(5, true);
1190 if (! hitptn[15]) wt[1].set(5, true);
1191 if (! hitptn[30]) wt[2].set(5, true);
1192 if (! hitptn[31]) wt[3].set(5, true);
1193 } else if (i == 16) { // edge area 1 only for cell 16
1194 wt[0] = wtDummy;
1195 wt[1] = wtDummy;
1196 wt[2] = wtDummy;
1197 wt[3] = wtDummy;
1198 wt[4] = TRGState(5, timing[16]);
1199 //...Append 6th bit to indicate hit or not (no hit = 1)...
1200 if (! hitptn[16]) wt[4].set(5, true);
1201 } else if (i == 17) { // edge area 2 for cell 15 and 31 only
1202 wt[0] = TRGState(5, timing[15]);
1203 wt[1] = wtDummy;
1204 wt[2] = TRGState(5, timing[31]);
1205 wt[3] = wtDummy;
1206 wt[4] = wtDummy;
1207
1208 //...Append 6th bit to indicate hit or not (no hit = 1)...
1209 if (! hitptn[15]) wt[0].set(5, true);
1210 if (! hitptn[31]) wt[2].set(5, true);
1211 } else {
1212 wt[0] = TRGState(5, timing[i - 1]);
1213 wt[1] = TRGState(5, timing[i]);
1214 wt[2] = TRGState(5, timing[i + 15]);
1215 wt[3] = TRGState(5, timing[i + 16]);
1216 wt[4] = TRGState(5, timing[i + 17]);
1217
1218 //...Append 6th bit to indicate hit or not (no hit = 1)...
1219 if (! hitptn[i - 1]) wt[0].set(5, true);
1220 if (! hitptn[i]) wt[1].set(5, true);
1221 if (! hitptn[i + 15]) wt[2].set(5, true);
1222 if (! hitptn[i + 16]) wt[3].set(5, true);
1223 if (! hitptn[i + 17]) wt[4].set(5, true);
1224 }
1225
1226 //...Look for the fastest hit...
1227 unsigned fastest0 = 0;
1228 unsigned fastest1 = 0;
1229 if (wt[0] < wt[1])
1230 fastest0 = 0;
1231 else
1232 fastest0 = 1;
1233 if (wt[2] < wt[3])
1234 fastest1 = 2;
1235 else
1236 fastest1 = 3;
1237
1238 unsigned fastest2 = 0;
1239 if (wt[fastest0] < wt[fastest1])
1240 fastest2 = fastest0;
1241 else
1242 fastest2 = fastest1;
1243
1244 unsigned fastest3 = 0;
1245 if (wt[fastest2] < wt[4])
1246 fastest3 = fastest2;
1247 else
1248 fastest3 = 4;
1249
1250 TRGState fastest(5);
1251 if (! wt[fastest3].active(5))
1252 fastest = wt[fastest3].subset(0, 5);
1253
1254 s.set(p, fastest);
1255 p += 5;
1256 }
1257
1258 //s.set(p, 5, timing[16]);
1259 //p += 5;
1260 //s.set(p, 5, timing[15]);
1261 //p += 5;
1262 //s.set(p, 5, timing[31]);
1263
1264#ifdef TRG_DEBUG
1265// unpackerOuterOutside(input, s);
1266#endif
1267
1268 delete[] b;
1269 return s;
1270 }

◆ packerOuterTracker()

TRGSignalVector * packerOuterTracker ( vector< TRGSignalVector * > &  hitList,
vector< int > &  cList,
const unsigned  maxHit 
)

Packing output for tracker.

Definition at line 320 of file TrackSegmentFinder.cc.

323 {
324 TRGSignalVector* result =
325 new TRGSignalVector("", (* hitList[0]).clock(), 21 * maxHit);
326
327 for (unsigned ci = 0; ci < cList.size(); ci++) {
328 unsigned cntHit = 0;
329 for (unsigned hi = 0; hi < hitList.size(); hi++) {
330 TRGState s = (* hitList[hi]).state(cList[ci]);
331 if (s.active()) {
332 if (cntHit >= maxHit) continue;
333 for (unsigned j = 0; j < 21; j++) {
334 if ((* hitList[hi])[j].state(cList[ci])) {
335 (* result)[21 * (maxHit - 1) - (cntHit * 21) + j]
336 .set(cList[ci], cList[ci] + 1);
337 }
338 }
339 if (TRGDebug::level()) {
340 TRGState t = hitList[hi]->state(cList[ci]).subset(13, 9);
341 cout << TRGDebug::tab() << " hit found : TSF out local ID="
342 << unsigned(t) << "(" << t << ")" << endl;
343 }
344
345 ++cntHit;
346 // result->dump("", "??? ");
347 }
348 }
349 }
350
351 return result;
352 }

◆ patternId() [1/2]

const std::vector< unsigned > & patternId ( unsigned  cellId) const
inline

returns pattern ID which activates specified cell.

Definition at line 221 of file HoughPlaneBoolean.h.

222 {
223 return _reverse[cellId];
224 }
std::vector< unsigned > * _reverse
Pattern ID's for each cell.

◆ patternId() [2/2]

const std::vector< unsigned > & patternId ( unsigned  layer,
unsigned  cellId 
) const
inline

returns pattern ID in a layer which activates specified cell.

Definition at line 238 of file HoughPlaneMulti2.h.

240 {
241 return _layers[layer]->patternId(cellId);
242 }
const std::vector< unsigned > & patternId(unsigned cellId) const
returns pattern ID which activates specified cell.

◆ perfectFinder()

void perfectFinder ( std::vector< TRGCDCTrack * > &  trackList,
unsigned  j,
std::vector< const TRGCDCSegmentHit * > &  mcTSList 
)

Perfect 3D finder for a track.

Definition at line 492 of file Hough3DFinder.cc.

493 {
494
495 //Just a test
496 StoreArray<CDCHit> CDCHits("CDCHits");
497 StoreArray<CDCSimHit> SimHits("CDCSimHits");
498 RelationArray rels(SimHits, CDCHits);
499
500 //...G4 trackID...
501 unsigned id = trackList[j]->relation().contributor(0);
502 vector<const TCSHit*> tsList[9];
503 //cout<<"[JB] id: "<<id<<endl;
504
505 //...Segment loop...
506 const vector<const TCSHit*> hits = _cdc.segmentHits();
507 for (unsigned i = 0; i < hits.size(); i++) {
508 const TCSHit& ts = * hits[i];
509 if (ts.segment().axial()) continue;
510 if (! ts.signal().active()) continue;
511 const TCWHit* wh = ts.segment().center().hit();
512 if (! wh) continue;
513 const unsigned trackId = wh->iMCParticle();
514 // Try to track down the mcParticle another way.
515 //cout<<"[CDCTRG] trackId:"<<trackId<<" "<<ts.cell().name()<<endl;
516//iw commented out because simind is not used
517// int ind=wh->iCDCHit();
518// int simind=rels[ind].getFromIndex();
519 //CDCSimHit &h=*SimHits[simind];
520 //cout<<"[CDCTRG] simTrackId: "<<wh->simHit()->getTrackId()<<endl;;
521 //cout<<"[CDC] simTrackId: "<<h.getTrackId()<<" from CDCHit: "<<CDCHits[ind]->getIWire()<<endl;;
522
523 if (id == trackId)
524 tsList[wh->wire().superLayerId()].push_back(& ts);
525 }
526
527 if (TRGDebug::level()) {
528 for (unsigned k = 0; k < 9; k++) {
529 if (k % 2) {
530 cout << TRGDebug::tab(4) << "superlayer " << k << ":";
531 for (unsigned l = 0; l < tsList[k].size(); l++) {
532 if (l)
533 cout << ",";
534 cout << tsList[k][l]->cell().name();
535 }
536 cout << endl;
537 }
538 }
539 }
540
541 //...Select best one in each super layer...
542 for (unsigned i = 0; i < 9; i++) {
543 const TCSHit* best = 0;
544 if (tsList[i].size() == 0) {
545 continue;
546 } else if (tsList[i].size() == 1) {
547 best = tsList[i][0];
548 } else {
549 int timeMin = 99999;
550 for (unsigned k = 0; k < tsList[i].size(); k++) {
551 const TRGSignal& timing = tsList[i][k]->signal();
552 const TRGTime& t = * timing[0];
553 if (t.time() < timeMin) {
554 timeMin = t.time();
555 best = tsList[i][k];
556 }
557 }
558 }
559 mcTSList.push_back(best);
560 }
561
562 }

◆ perfectPosition()

std::vector< HepGeom::Point3D< double > > perfectPosition ( void  ) const

returns perfect position from GEANT.

Definition at line 259 of file TRGCDCTrack.cc.

260 {
261
262 //...CDC...
263 const TRGCDC& cdc = * TRGCDC::getTRGCDC();
264
265 //...Return value...
266 vector<HepGeom::Point3D<double> > posv;
267
268 //...Super layer loop...
269 for (unsigned i = 0; i < cdc.nSuperLayers(); i++) {
270
271 //...Check links to be one...
272 if ((links(i).size() == 0) || (links(i).size() > 1)) {
273 if (TRGDebug::level() > 1) {
274 cout << TRGDebug::tab() << "TRGCDCTrack::perfectPosition !!! #links in superlayer "
275 << i << " is " << links(i).size() << endl;
276 }
277 continue;
278 }
279
280 //...Track segment hit...
281 const TCSHit* h = dynamic_cast<const TCSHit*>(links(i)[0]->hit());
282 if (! h) {
283 cout << "TRGCDCTrack::perfectPosition !!! hit is not a TCSHit"
284 << endl;
285 continue;
286 }
287
288 //...CDCSimHit...
289 const CDCSimHit* s = h->simHit();
290 if (! s) {
291 cout << "TRGCDCTrack::perfectPosition !!! no CDCSimHit found"
292 << endl;
293 continue;
294 }
295
296 //...Position...
297 posv.push_back(HepGeom::Point3D<double>(s->getPosTrack().x(),
298 s->getPosTrack().y(),
299 s->getPosTrack().z()));
300
301 if (TRGDebug::level() > 1) {
302 cout << TRGDebug::tab() << "Perfect position TSLayer " << i
303 << " : " << posv.back() << endl;
304 }
305 }
306
307 return posv;
308 }

◆ phase()

double phase ( double  timing) const

returns phase of given timing in degree (0 to 360).

Definition at line 154 of file Clock.cc.

155 {
156// return overShoot(a) / _cycle * 360;
157 const double pos = (a - _offset) / _cycle;
158 const double pos0 = double(int(pos));
159 const double dif = pos - pos0;
160 // std::cout << "a,offset,pos,pos0,dif=" << a << "," << _offset << ","
161 // << pos << "," << pos0 << "," << dif << std::endl;
162 return dif * 360;
163 }

◆ phi() [1/2]

double phi ( double  r,
int  dir = 0 
) const

const member functions

Definition at line 188 of file Lpar.cc.

189 {
190 double x, y;
191 if (!xy(r, x, y, dir)) return -1;
192 double p = atan2(y, x);
193 if (p < 0) p += (2 * M_PI);
194 return p;
195 }

◆ phi() [2/2]

double phi ( void  ) const
inline

phi of the point

Definition at line 134 of file Point2D.h.

135 {
136 if (_p[0] == 0.0 && _p[1] == 0.0) return 0.;
137 double a = atan2(_p[1], _p[0]);
138 if (a > 0) return a;
139 return a + 2. * M_PI;
140 }

◆ phi0()

double phi0 ( void  ) const
inline

returns phi0.

Definition at line 278 of file Helix.h.

279 {
280 return m_ac[1];
281 }

◆ pivot() [1/2]

const HepGeom::Point3D< double > & pivot ( const HepGeom::Point3D< double > &  newPivot)

sets pivot position.

Definition at line 324 of file Helix.cc.

325 {
326#if defined(BELLE_DEBUG)
327 try {
328#endif
329 const double& dr = m_ac[0];
330 const double& phi0 = m_ac[1];
331 const double& kappa = m_ac[2];
332 const double& dz = m_ac[3];
333 const double& tanl = m_ac[4];
334
335 double rdr = dr + m_r;
336 double phi = fmod(phi0 + M_PI4, M_PI2);
337 double csf0 = cos(phi);
338 double snf0 = (1. - csf0) * (1. + csf0);
339 snf0 = sqrt((snf0 > 0.) ? snf0 : 0.);
340 if (phi > M_PI) snf0 = - snf0;
341
342 double xc = m_pivot.x() + rdr * csf0;
343 double yc = m_pivot.y() + rdr * snf0;
344 double csf, snf;
345 if (m_r != 0.0) {
346 csf = (xc - newPivot.x()) / m_r;
347 snf = (yc - newPivot.y()) / m_r;
348 double anrm = sqrt(csf * csf + snf * snf);
349 if (anrm != 0.0) {
350 csf /= anrm;
351 snf /= anrm;
352 phi = atan2(snf, csf);
353 } else {
354 csf = 1.0;
355 snf = 0.0;
356 phi = 0.0;
357 }
358 } else {
359 csf = 1.0;
360 snf = 0.0;
361 phi = 0.0;
362 }
363 double phid = fmod(phi - phi0 + M_PI8, M_PI2);
364 if (phid > M_PI) phid = phid - M_PI2;
365 double drp = (m_pivot.x() + dr * csf0 + m_r * (csf0 - csf) - newPivot.x())
366 * csf
367 + (m_pivot.y() + dr * snf0 + m_r * (snf0 - snf) - newPivot.y()) * snf;
368 double dzp = m_pivot.z() + dz - m_r * tanl * phid - newPivot.z();
369
370 CLHEP::HepVector ap(5);
371 ap[0] = drp;
372 ap[1] = fmod(phi + M_PI4, M_PI2);
373 ap[2] = kappa;
374 ap[3] = dzp;
375 ap[4] = tanl;
376
377 // if (m_matrixValid) m_Ea.assign(delApDelA(ap) * m_Ea * delApDelA(ap).T());
378 if (m_matrixValid) m_Ea = m_Ea.similarity(delApDelA(ap));
379
380 m_a = ap;
381 m_pivot = newPivot;
382
383 //...Are these needed?...iw...
384 updateCache();
385 return m_pivot;
386#if defined(BELLE_DEBUG)
387 } catch (...) {
388 m_helixValid = false;
390 }
391#endif
392 return m_pivot;
393 }
static bool ms_throw_exception
throw exception or not
Definition: Helix.h:171
CLHEP::HepMatrix delApDelA(const CLHEP::HepVector &ap) const
Mathmatical functions.
Definition: Helix.cc:509
static const std::string invalidhelix
string of invalid helix
Definition: Helix.h:235
const double M_PI4
4*PI
Definition: Helix.cc:35

◆ pivot() [2/2]

const HepGeom::Point3D< double > & pivot ( void  ) const
inline

returns pivot position.

Definition at line 250 of file Helix.h.

251 {
252 return m_pivot;
253 }

◆ position() [1/5]

const HepGeom::Point3D< double > & position ( const HepGeom::Point3D< double > &  a)
inline

sets and returns position.

Definition at line 558 of file Link.h.

559 {
560 return _position = a;
561 }

◆ position() [2/5]

int position ( double  timing) const

returns clock position.

Definition at line 114 of file Clock.cc.

115 {
116#ifdef TRG_DEBUG
117 if ((t < minTiming()) || (t > maxTiming()))
118 cout << "TRGClock::unit(" << _name
119 << ") !!! out of time window : min=" << minTiming()
120 << ",max=" << maxTiming() << ",given value=" << t << endl;
121// cout << "t,offset,unit=" << t << "," << _offset << "," << int((t
122// - _offset) / _cycle) << endl;
123#endif
124 return floor((t - _offset) / _cycle);
125 }

◆ position() [3/5]

TRGPoint2D position ( unsigned  x,
unsigned  y 
) const
inline

returns position in Hough plain for a cell (x, y)..

Definition at line 363 of file HoughPlaneBase.h.

364 {
365#ifdef TRASAN_DEBUG_DETAIL
366// std::cout << "x,y=" << x << "," << y
367// << ":_xMin,_yMin=" << _xMin << "," << _yMin
368// << ":_xSize,_ySize=" << _xSize << "," << _ySize << std::endl;
369#endif
370
371 return TRGPoint2D(_xMin + (float(x) + 0.5) * _xSize,
372 _yMin + (float(y) + 0.5) * _ySize);
373 }

◆ position() [4/5]

Point3D position ( unsigned  lr) const

returns left position. z is always zero.

Definition at line 102 of file CellHit.cc.

103 {
104 static const HepGeom::Vector3D<double> HepXHat(1.0, 0.0, 0.0);
105 static const HepGeom::Vector3D<double> HepYHat(0.0, 1.0, 0.0);
106 static const HepGeom::Vector3D<double> HepZHat(0.0, 0.0, 1.0);
107
108 //...Left...
109 if (lr == CellHitLeft) {
110 return _xyPosition
111 - _drift[CellHitLeft] * HepZHat.cross(_xyPosition.unit());
112 }
113
114 //...Right case...
115 else {
116 return _xyPosition
117 + _drift[CellHitRight] * HepZHat.cross(_xyPosition.unit());
118 }
119 }

◆ position() [5/5]

const HepGeom::Point3D< double > & position ( void  ) const
inline

returns position.

Definition at line 551 of file Link.h.

552 {
553 return _position;
554 }

◆ positionInSourceClock()

int positionInSourceClock ( double  timing) const
inline

returns clock position in the source clock.

Definition at line 208 of file Clock.h.

209 {
210 return _source->position(a);
211 }

◆ positionOnTrack() [1/3]

const HepGeom::Point3D< double > & positionOnTrack ( const HepGeom::Point3D< double > &  a)
inline

sets and returns the closest point on track to wire.

Definition at line 506 of file Link.h.

507 {
508 return _onTrack = a;
509 }

◆ positionOnTrack() [2/3]

const HepGeom::Point3D< double > & positionOnTrack ( double  p[3])
inline

sets and returns the closest point on track to wire.

Definition at line 513 of file Link.h.

514 {
515 _onTrack.setX(p[0]);
516 _onTrack.setY(p[1]);
517 _onTrack.setZ(p[2]);
518 return _onTrack;
519 }

◆ positionOnTrack() [3/3]

const HepGeom::Point3D< double > & positionOnTrack ( void  ) const
inline

returns the closest point on track to wire.

Definition at line 482 of file Link.h.

483 {
484 return _onTrack;
485 }

◆ positionOnWire() [1/3]

const HepGeom::Point3D< double > & positionOnWire ( const HepGeom::Point3D< double > &  a)
inline

sets and returns the closest point on wire to a track.

Definition at line 489 of file Link.h.

490 {
491 return _onWire = a;
492 }

◆ positionOnWire() [2/3]

const HepGeom::Point3D< double > & positionOnWire ( double  p[3])
inline

sets and returns the closest point on wire to a track.

Definition at line 496 of file Link.h.

497 {
498 _onWire.setX(p[0]);
499 _onWire.setY(p[1]);
500 _onWire.setZ(p[2]);
501 return _onWire;
502 }

◆ positionOnWire() [3/3]

const HepGeom::Point3D< double > & positionOnWire ( void  ) const
inline

returns the closest point on wire to a track.

Definition at line 475 of file Link.h.

476 {
477 return _onWire;
478 }

◆ positiveDiverge()

bool positiveDiverge ( float  xReal,
float  yReal,
float  x0,
float  x1 
) const
overridevirtual

returns true if Y diverges in given region.

Implements TRGCDCHoughTransformation.

Definition at line 83 of file HoughTransformationCircle.cc.

87 {
88 return diverge(xReal, yReal, x0, x1);
89 }

◆ preparePatterns() [1/2]

void preparePatterns ( unsigned  layerId,
unsigned  nPatterns 
)
inline

allocate memory for patterns.

Definition at line 246 of file HoughPlaneMulti2.h.

247 {
248 _layers[layerId]->preparePatterns(nPatterns);
249 }
void preparePatterns(unsigned nPatterns)
allocate memory for patterns.

◆ preparePatterns() [2/2]

void preparePatterns ( unsigned  nPatterns)

allocate memory for patterns.

Definition at line 255 of file HoughPlaneBoolean.cc.

256 {
257 if (_nPatterns) {
258 std::cout << "TRGCDCHoughPlaneBoolean::preparePatterns !!! "
259 << "patterns were already allocated" << std::endl;
260 return;
261 }
262
263 _nPatterns = nPatterns;
264 _patterns = new unsigned * [_nPatterns];
265 _nActive = new unsigned[_nPatterns];
266 memset(_patterns, 0, _nPatterns * sizeof(unsigned*));
267 _reverse = new vector<unsigned>[nX() * nY()];
268 }
unsigned _nPatterns
number of patterns
unsigned * _nActive
number of active cells

◆ print3DInformation()

void print3DInformation ( int  iTrack)

Print's information for debugging 3D.

Definition at line 1474 of file Fitter3D.cc.

1475 {
1476 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]evtTime: " << m_mDouble["eventTime"] << endl;
1477 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]wirePhi: " << m_mVector["wirePhi"][0] << " " <<
1478 m_mVector["wirePhi"][1] << " " << m_mVector["wirePhi"][2] << " " << m_mVector["wirePhi"][3] << " " << m_mVector["wirePhi"][4] << " "
1479 << m_mVector["wirePhi"][5] << " " << m_mVector["wirePhi"][6] << " " << m_mVector["wirePhi"][7] << " " << m_mVector["wirePhi"][8] <<
1480 endl;
1481 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]LR: " << int(m_mVector["LR"][0]) << " " << int(
1482 m_mVector["LR"][1]) << " " << int(m_mVector["LR"][2]) << " " << int(m_mVector["LR"][3]) << " " << int(
1483 m_mVector["LR"][4]) << " " << int(m_mVector["LR"][5]) << " " << int(m_mVector["LR"][6]) << " " << int(
1484 m_mVector["LR"][7]) << " " << int(m_mVector["LR"][8]) << endl;
1485 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]lutLR: " << int(m_mVector["lutLR"][0]) << " " << int(
1486 m_mVector["lutLR"][1]) << " " << int(m_mVector["lutLR"][2]) << " " << int(m_mVector["lutLR"][3]) << " " << int(
1487 m_mVector["lutLR"][4]) << " " << int(m_mVector["lutLR"][5]) << " " << int(m_mVector["lutLR"][6]) << " " << int(
1488 m_mVector["lutLR"][7]) << " " << int(m_mVector["lutLR"][8]) << endl;
1489 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]useStSl: " << int(m_mVector["useStSl"][0]) << " " << int(
1490 m_mVector["useStSl"][1]) << " " << int(m_mVector["useStSl"][2]) << " " << int(m_mVector["useStSl"][3]) << endl;
1491 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]drift: " << m_mVector["driftLength"][0] << " " <<
1492 m_mVector["driftLength"][1] << " " << m_mVector["driftLength"][2] << " " << m_mVector["driftLength"][3] << " " <<
1493 m_mVector["driftLength"][4] << " " << m_mVector["driftLength"][5] << " " << m_mVector["driftLength"][6] << " " <<
1494 m_mVector["driftLength"][7] << " " << m_mVector["driftLength"][8] << endl;
1495 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]tdc: " << m_mVector["tdc"][0] << " " <<
1496 m_mVector["tdc"][1] << " " << m_mVector["tdc"][2] << " " << m_mVector["tdc"][3] << " " << m_mVector["tdc"][4] << " " <<
1497 m_mVector["tdc"][5] << " " << m_mVector["tdc"][6] << " " << m_mVector["tdc"][7] << " " << m_mVector["tdc"][8] << endl;
1498 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]Phi2D: " << m_mVector["phi2D"][0] << " " <<
1499 m_mVector["phi2D"][1] << " " << m_mVector["phi2D"][2] << " " << m_mVector["phi2D"][3] << " " << m_mVector["phi2D"][4] << endl;
1500 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]Phi3D: " << m_mVector["phi3D"][0] << " " <<
1501 m_mVector["phi3D"][1] << " " << m_mVector["phi3D"][2] << " " << m_mVector["phi3D"][3] << endl;
1502 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]zz: " << m_mVector["zz"][0] << " " << m_mVector["zz"][1]
1503 << " " << m_mVector["zz"][2] << " " << m_mVector["zz"][3] << endl;
1504 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]arcS: " << m_mVector["arcS"][0] << " " <<
1505 m_mVector["arcS"][1] << " " << m_mVector["arcS"][2] << " " << m_mVector["arcS"][3] << endl;
1506 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]zerror: " << m_mVector["zError"][0] << " " <<
1507 m_mVector["zError"][1] << " " << m_mVector["zError"][2] << " " << m_mVector["zError"][3] << endl;
1508 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]izerror: " << m_mVector["iZError2"][0] << " " <<
1509 m_mVector["iZError2"][1] << " " << m_mVector["iZError2"][2] << " " << m_mVector["iZError2"][3] << endl;
1510 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]charge: " << int(m_mDouble["charge"]) << endl;
1511 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]pt: " << m_mDouble["pt"] << endl;
1512 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]phi0: " << m_mDouble["phi0"] << endl;
1513 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]z0: " << m_mDouble["z0"] << endl;
1514 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]cot: " << m_mDouble["cot"] << endl;
1515 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]chi2: " << m_mDouble["zChi2"] << endl;
1516 if (m_mBool["fMc"]) {
1517 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]mcCharge: " << int(m_mDouble["mcCharge"]) << endl;
1518 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]mcPosZ: " << m_mVector["mcPosZ"][1] << " " <<
1519 m_mVector["mcPosZ"][3] << " " << m_mVector["mcPosZ"][5] << " " << m_mVector["mcPosZ"][7] << endl;
1520 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]mcPosZ: " << m_mVector["mcPosZ"][1] << " " <<
1521 m_mVector["mcPosZ"][3] << " " << m_mVector["mcPosZ"][5] << " " << m_mVector["mcPosZ"][7] << endl;
1522 cout << "[E" << int(m_mDouble["eventNumber"]) << "][T" << iTrack << "]mcLR: " << int(m_mVector["mcLR"][0]) << " " << int(
1523 m_mVector["mcLR"][1]) << " " << int(m_mVector["mcLR"][2]) << " " << int(m_mVector["mcLR"][3]) << " " << int(
1524 m_mVector["mcLR"][4]) << " " << int(m_mVector["mcLR"][5]) << " " << int(m_mVector["mcLR"][6]) << " " << int(
1525 m_mVector["mcLR"][7]) << " " << int(m_mVector["mcLR"][8]) << endl;
1526 }
1527 }

◆ printFirm()

void printFirm ( void  )

Print info in firmware level.

Definition at line 209 of file EventTime.cc.

210 {
211 TRGDebug::enterStage("Event Time");
212
213 for (int iClk = 0; iClk < 64; iClk++) {
214 for (int iSL = 0; iSL < 9; iSL++) {
215 int hmbw = 160 + 32 * (iSL - 1); //set bit width of hitmap part
216 if (iSL == 0) hmbw = 160;
217 string hs[10];
218 string t[10];
219 char file[30];
220 sprintf(file, "SL%d.coe", iSL);
221 string cnts = string(cnt[iSL][iClk], '1');
222
223 string clk = bitset<9>(iClk + 64 * (m_eventN - 1)).to_string();
224 string clk2 = bitset<5>(iClk).to_string();
225 for (int i = 0; i < 10; i++) {
226 hs[i] = bitset<4>(ft[iSL][iClk][i]).to_string();
227 if (cnt[iSL][iClk] > i) t[i] = clk2 + hs[i];
228 else t[i] = "00000" + hs[i];
229 }
230 ofstream fout;
231 fout.open(file, ios::app);
232 fout << clk;
233 fout << setfill('0') << setw(hmbw) << cnts;
234 fout << t[9] << t[8] << t[7] << t[6] << t[5] << t[4] << t[3] << t[2] << t[1] << t[0] << endl;
235 fout.close();
236 }
237 }
238 TRGDebug::leaveStage("Event Time");
239 }//end of TRGCDCEventTime::printFirm

◆ printTCThreshold()

void printTCThreshold ( )

Print TC energy Threshold.

Definition at line 320 of file TrgEclDatabaseImporter.cc.

321 {
322
323 DBObjPtr<TRGECLFAMPara> para ;
324
325 para->Dump();
326
327 }

◆ printToFile()

void printToFile ( )

Utilities Function to print VHDL code.

Definition at line 106 of file JSignalData.cc.

107 {
108 // Write to file.
109 ofstream outFile;
110 outFile.open(m_vhdlOutputFile);
111 if (outFile.is_open()) {
112 outFile << "library IEEE;" << endl;
113 outFile << "use ieee.std_logic_1164.all;" << endl;
114 outFile << "use ieee.numeric_std.all;" << endl;
115 outFile << endl;
116 outFile << "entity Firmware is" << endl;
117 outFile << " PORT ( CLKIN : in STD_LOGIC;" << endl;
118 outFile << " INPUT : in std_logic_vector(0 downto 0);" << endl;
119 outFile << " OUTPUT : in std_logic_vector(0 downto 0)" << endl;
120 outFile << ");" << endl;
121 outFile << endl;
122 outFile << m_vhdlEntry << endl;
123 outFile << endl;
124 outFile << "end Firmware;" << endl;
125 outFile << endl;
126 outFile << "architecture Behavioral of Firmware is" << endl;
127 outFile << endl;
128 outFile << m_vhdlDefine << endl;
129 outFile << endl;
130 outFile << "begin" << endl;
131 outFile << endl;
132 outFile << "-- Main algorithm" << endl;
133 outFile << "logic: process (CLKIN) is" << endl;
134 outFile << "begin" << endl;
135 outFile << " if CLKIN'event and CLKIN='1' then" << endl;
136 outFile << endl;
137 outFile << m_vhdlInProcess << endl;
138 outFile << endl;
139 outFile << " end if;" << endl;
140 outFile << "end process;" << endl;
141 outFile << endl;
142 outFile << m_vhdlOutProcess << endl;
143 outFile << endl;
144 outFile << "end Behavioral;" << endl;
145 outFile.close();
146 m_printedToFile = 1;
147 }
148 }

◆ printVhdl()

void printVhdl ( const std::string &  vhdlCode) const

Prints vhdl code.

Definition at line 2159 of file JSignal.cc.

2160 {
2161 if (m_commonData) {
2162 ofstream outFile;
2163 outFile.open(m_commonData->m_vhdlOutputFile, ios::app);
2164 if (outFile.is_open()) {
2165 outFile << vhdlCode << endl;
2166 outFile.close();
2167 }
2168 } else {
2169 cout << "[Error] TRGCDCJSignal::printVhdl() => m_commonData doesn't exist." << endl;
2170 }
2171 }

◆ priority()

const TRGCDCWire & priority ( void  ) const

returns priority wire.

Definition at line 525 of file Segment.cc.

526 {
528 int offset = (_wires.size() == 15) ? 0 : 5;
529 if (priority == 1 || priority == 2)
530 return *_wires[offset + priority];
531 return *_wires[offset];
532 }
const TRGCDCWire & priority(void) const
returns priority wire.
Definition: Segment.cc:525

◆ priorityPosition() [1/2]

int priorityPosition ( int  clk0,
int  clk1 
) const

return priority cell position in TSHit for given time window.

Definition at line 499 of file Segment.cc.

500 {
501 if (center().signal().active(clk0, clk1)) {
502 return 3;
503 } else {
504 const TRGCDCWire* priorityL;
505 const TRGCDCWire* priorityR;
506 if (_wires.size() == 15) {
507 priorityL = _wires[2];
508 priorityR = _wires[1];
509 } else {
510 priorityL = _wires[7];
511 priorityR = _wires[6];
512 }
513 if (priorityL->signal().active(clk0, clk1)) {
514 if (priorityR->signal().active(clk0, clk1)) {
515 if ((priorityL->signal()[0]->time()) >= (priorityR->signal()[0]->time())) return 1;
516 else return 2;
517 } else return 2;
518 } else if (priorityR->signal().active(clk0, clk1)) {
519 return 1;
520 } else return 0;
521 }
522 }

◆ priorityPosition() [2/2]

int priorityPosition ( void  ) const

return priority cell position in TSHit. 0: no hit, 3: 1st priority, 1: 2nd right, 2: 2nd left

Definition at line 473 of file Segment.cc.

474 {
475 if (center().signal().active()) {
476 return 3;
477 } else {
478 const TRGCDCWire* priorityL;
479 const TRGCDCWire* priorityR;
480 if (_wires.size() == 15) {
481 priorityL = _wires[2];
482 priorityR = _wires[1];
483 } else {
484 priorityL = _wires[7];
485 priorityR = _wires[6];
486 }
487 if (priorityL->signal().active()) {
488 if (priorityR->signal().active()) {
489 if ((priorityL->signal()[0]->time()) >= (priorityR->signal()[0]->time())) return 1;
490 else return 2;
491 } else return 2;
492 } else if (priorityR->signal().active()) {
493 return 1;
494 } else return 0;
495 }
496 }

◆ priorityTime()

float priorityTime ( void  ) const

return priority time in TSHit.

Definition at line 463 of file Segment.cc.

464 {
465 const TRGSignal& prioritySignal = priority().signal();
466 if (prioritySignal.active()) {
467 return prioritySignal[0]->time();
468 }
469 return -1;
470 }

◆ priorityTiming()

void priorityTiming ( unsigned  tsfID,
const unsigned  nTSF,
TRGSignalVector s,
const TRGSignal center,
const TRGSignal right,
const TRGSignal left 
) const
private

Make TRGSignals for the priority timing bits.

Definition at line 1174 of file TrackSegmentFinder.cc.

1180 {
1181
1182 unsigned rem = t % 16;
1183
1184 if (rem != 0) {
1185 s.push_back(* _priMap[t * 4 + 0]);
1186 s.push_back(* _priMap[t * 4 + 1]);
1187 s.push_back(* _priMap[t * 4 + 2]);
1188 s.push_back(* _priMap[t * 4 + 3]);
1189 return;
1190 }
1191
1192 //...Prepare signal vector for timing cells...
1193 TRGSignalVector tc("timing cell hit", clockData());
1194 tc.push_back(center);
1195 tc.push_back(right);
1196 tc.push_back(left);
1197
1198 //...No timing hit case...
1199 if (! tc.active()) {
1200 s.push_back(* _priMap[t * 4 + 0]);
1201 s.push_back(* _priMap[t * 4 + 1]);
1202 s.push_back(* _priMap[t * 4 + 2]);
1203 s.push_back(* _priMap[t * 4 + 3]);
1204 return;
1205 }
1206
1207 const string sn = "TSF priority timing outer";
1209
1210 //...Prepare signal vector for each timing cells...
1211 TRGSignalVector t0("t0", clockData()); // center
1212 t0.push_back(* _priMap[t * 4 + 0]);
1213 t0.push_back(* _priMap[t * 4 + 1]);
1214 t0.push_back(* _priMap[t * 4 + 2]);
1215 t0.push_back(* _priMap[t * 4 + 3]);
1216
1217 TRGSignalVector t1("t1", clockData()); // left
1218 unsigned p = t / 16;
1219 if (t == 0)
1220 p = nTSF / 16 - 1;
1221 else p = p - 1;
1222 t1.push_back(* _edg0Map[p * 4 + 0]);
1223 t1.push_back(* _edg0Map[p * 4 + 1]);
1224 t1.push_back(* _edg0Map[p * 4 + 2]);
1225 t1.push_back(* _edg0Map[p * 4 + 3]);
1226
1227 //...Loop over state changes...
1228 vector<TRGState*> outputTimingStates;
1229 vector<int> clkStates;
1230 vector<int> sc = tc.stateChanges();
1231 vector<bool> sb;
1232 for (unsigned i = 0; i < sc.size(); i++) {
1233 int clk = sc[i];
1234 TRGState stt = tc.state(clk);
1235
1236 //...Priority cell hit case...
1237 bool sel = true; // true=t0, false=t1
1238 if (stt[0])
1239 sel = true;
1240 else if (stt[1] && (! stt[2]))
1241 sel = false;
1242 else if ((! stt[1]) && stt[2])
1243 sel = true;
1244 else { // (stt[1] && stt[2])
1245 if (unsigned(t0.state(clk)) < unsigned(t1.state(clk)))
1246 sel = true;
1247 else
1248 sel = false;
1249 }
1250
1251 if (sel) {
1252 outputTimingStates.push_back(new TRGState(t0.state(clk)));
1253 sb.push_back(false);
1254 } else {
1255 outputTimingStates.push_back(new TRGState(t1.state(clk)));
1256 sb.push_back(true);
1257 }
1258 clkStates.push_back(clk);
1259 }
1260
1261 //...Create signals...
1262 const unsigned n = outputTimingStates.size();
1263 TRGSignalVector st("pri.timing", clockData(), 4);
1264 for (unsigned i = 0; i < n; i++) {
1265 if (sb[i])
1266 s[0].unset(clkStates[i], clkStates[i] + 1);
1267 st.set(* outputTimingStates[i], clkStates[i]);
1268 delete outputTimingStates[i];
1269 }
1270
1271 //...Store signals...
1272 s.push_back(st[0]);
1273 s.push_back(st[1]);
1274 s.push_back(st[2]);
1275 s.push_back(st[3]);
1276
1277 if (TRGDebug::level()) {
1278 tc.dump("", TRGDebug::tab() + " ");
1279 t0.dump("", TRGDebug::tab() + " ");
1280 t1.dump("", TRGDebug::tab() + " ");
1281 st.dump("", TRGDebug::tab() + " ");
1282 s.dump("", TRGDebug::tab() + " ");
1283 }
1284
1286 }

◆ prob()

double prob ( ) const

const member function prob

Definition at line 697 of file Lpav.cc.

698 {
699 if (m_nc <= 3) return 0;
700 if (m_chisq < 0) return 0;
701//cnv float c = m_chisq;
702//cnv int nci = (int)m_nc - 3;
703 // temporarily commented out
704 // double p = (double) prob_(&c, &nci);
705 double p = 0;
706 return p;
707 }

◆ property()

void property ( double  charge,
double  radius,
HepGeom::Point3D< double >  center 
)
inline

sets circle properties.

Definition at line 127 of file Circle.h.

128 {
129 charge(c);
130 _radius = r;
131 _center = e;
132 }
double charge(void) const
returns charge.
Definition: TrackBase.h:248

◆ pt() [1/3]

double pt ( void  ) const
inlinevirtual

returns Pt.

Reimplemented in TRGCDCCircle, and TRGCDCTrack.

Definition at line 220 of file TrackBase.h.

221 {
222 return _p.perp();
223 }

◆ pt() [2/3]

double pt ( void  ) const
inlineoverridevirtual

returns Pt.

Reimplemented from TRGCDCTrackBase.

Definition at line 98 of file Circle.h.

99 {
100 const double ConstantAlpha = 222.376063; // for 1.5T
101 return _radius / ConstantAlpha;
102 }

◆ pt() [3/3]

double pt ( void  ) const
inlineoverridevirtual

returns Pt.

Reimplemented from TRGCDCTrackBase.

Definition at line 165 of file TRGCDCTrack.h.

166 {
167 _p = _helix.momentum();
168 return _p.perp();
169 }

◆ pType()

int pType ( void  ) const
inline

returns particle type.

Definition at line 130 of file TrackMC.h.

131 {
132// return _hep->m_idhep;
133 return 0;
134 }

◆ pull() [1/2]

double pull ( double  a)
inline

sets pull.

Definition at line 468 of file Link.h.

469 {
470 return _pull = a;
471 }

◆ pull() [2/2]

double pull ( void  ) const
inline

returns pull.

Definition at line 461 of file Link.h.

462 {
463 return _pull;
464 }

◆ purity()

float purity ( unsigned  i = 0) const

returns i'th purity.

Definition at line 90 of file Relation.cc.

91 {
92
93 //...Get target trkID...
94 const unsigned trkID = contributor(a);
95
96 //...Count # of hits...
97 unsigned n = 0;
98 unsigned na = 0;
99 map<unsigned, unsigned>::const_iterator it = _relations.begin();
100 while (it != _relations.end()) {
101 n += it->second;
102 if (it->first == trkID)
103 na = it->second;
104 ++it;
105 }
106
107 return float(na) / float(n);
108 }

◆ purity3D()

float purity3D ( unsigned  trkID) const

returns purity for 3D for trkID particle which should be from 2D.

Definition at line 111 of file Relation.cc.

112 {
113
114 //...Count # of hits...
115 unsigned n = 0;
116 unsigned na = 0;
117 map<unsigned, unsigned>::const_iterator it = _relations.begin();
118 while (it != _relations.end()) {
119 n += it->second;
120 if (it->first == trkID)
121 na = it->second;
122 ++it;
123 }
124
125 return float(na) / float(n);
126 }

◆ push_back() [1/5]

void push_back ( const TRGCDCFrontEnd a)

push back TRGCDCFrontEnd of this Merger

Definition at line 143 of file Merger.cc.

144 {
145 std::vector<const TRGCDCFrontEnd*>::push_back(a);
146 }

◆ push_back() [2/5]

void push_back ( const TRGCDCMerger a)

push back the Mergers of this TSF

Definition at line 865 of file TrackSegmentFinder.cc.

866 {
867 std::vector<const TRGCDCMerger*>::push_back(a);
868 }

◆ push_back() [3/5]

void push_back ( const TRGCDCTrackSegmentFinder a)

push back the TRGCDCTrackSegmentFinder pointer

Definition at line 58 of file EventTimeFinder.cc.

59 {
60 std::vector<const TRGCDCTrackSegmentFinder*>::push_back(a);
61 }

◆ push_back() [4/5]

void push_back ( const TRGCDCTrackSegmentFinder a)

Appends a TSF board.

Definition at line 58 of file Tracker2D.cc.

59 {
60 std::vector<const TRGCDCTrackSegmentFinder*>::push_back(a);
61 }

◆ push_back() [5/5]

void push_back ( const TRGCDCWire a)

push back TRGCDCWire for this Front-end

Definition at line 140 of file FrontEnd.cc.

141 {
142 std::vector<const TRGCDCWire*>::push_back(a);
143 }

◆ r_max()

double r_max ( ) const
inlineprivate

private const member functions

Definition at line 271 of file Lpar.h.

272 {
273 if (m_kappa == 0) return 100000000.0;
274 if (m_gamma == 0) return 1 / std::fabs(m_kappa);
275 return std::fabs(2 * m_gamma / (std::sqrt(1 + 4 * m_gamma * m_kappa) - 1));
276 }

◆ radius() [1/2]

double radius ( void  ) const
inline

returns radius.

Definition at line 113 of file Circle.h.

114 {
115 return _radius;
116 }

◆ radius() [2/2]

double radius ( void  ) const
inline

returns radious of helix.

Definition at line 257 of file Helix.h.

258 {
259 return m_r;
260 }

◆ regions() [1/2]

void regions ( TRGCDCHoughPlane hp,
const unsigned  threshold 
) const
private

Makes regions.

Definition at line 53 of file PeakFinder.cc.

54 {
55
56 TRGDebug::enterStage("Making regions");
57
58 //...Search cells above threshold...
59 unsigned nCells = hp.nX() * hp.nY();
60 static unsigned* candidates =
61 (unsigned*) malloc(nCells * sizeof(unsigned));
62 unsigned nActive = 0;
63 for (unsigned j = 0; j < hp.nY(); j++) {
64 //minus x direction , plus -x direction
65 if ((hp.name()) == "circle hough minus")
66 for (unsigned i = 0; i < hp.nX(); i++) {
67 //...Threshold check...
68 const unsigned n = hp.entry(i, j);
69 if (n < threshold) continue;
70 candidates[nActive] = hp.serialId(i, j);
71 ++nActive;
72 } else
73 for (unsigned z = hp.nX(); z > 0 ; --z) {
74 //...Threshold check...
75 unsigned i = 0;
76 i = z - 1;
77 const unsigned n = hp.entry(i, j);
78 if (n < threshold) continue;
79 candidates[nActive] = hp.serialId(i, j);
80 ++nActive;
81 }
82 }
83
84 if (TRGDebug::level())
85 cout << TRGDebug::tab() << "Active cells=" << nActive << endl;
86
87 //...Loop over active cells...
88 const unsigned used = nCells;
89 for (unsigned i = 0; i < nActive; i++) {
90 if (candidates[i] == used) continue;
91 const unsigned id0 = candidates[i];
92 candidates[i] = used;
93
94 //...Make a new region...
95 vector<unsigned>* region = new vector<unsigned>;
96 region->push_back(id0);
97 if (TRGDebug::level() > 2)
98 cout << TRGDebug::tab(4) << "new region made" << endl;
99
100 //...Search neighbors...
101 for (unsigned j = 0; j < nActive; j++) {
102 if (candidates[j] == used) continue;
103 const unsigned id1 = candidates[j];
104
105 unsigned x1 = 0;
106 unsigned y1 = 0;
107 hp.id(id1, x1, y1);
108 if (TRGDebug::level() > 2)
109 cout << TRGDebug::tab(8) << "cell:x=" << x1 << ",y=" << y1
110 << endl;
111
112 for (unsigned k = 0; k < unsigned(region->size()); k++) {
113 unsigned id2 = (* region)[k];
114 unsigned x2 = 0;
115 unsigned y2 = 0;
116 hp.id(id2, x2, y2);
117 int difx = abs(int(x1) - int(x2));
118 int dify = abs(int(y1) - int(y2));
119 if (difx > (int) hp.nX() / 2) difx = hp.nX() - difx;
120 if (dify > (int) hp.nY() / 2) dify = hp.nY() - dify;
121
122 if (TRGDebug::level() > 2) {
123 cout << TRGDebug::tab(12) << "x=" << x2 << ",y=" << y2
124 << ":difx=" << difx << ",dify=" << dify;
125 if ((difx < 2) && (dify < 3))
126 cout << " ... connected" << endl;
127 else
128 cout << endl;
129 }
130
131 if ((difx < 2) && (dify < 3)) {
132 region->push_back(id1);
133 candidates[j] = used;
134 break;
135 }
136
137 }
138 }
139 hp.setRegion(region);
140 }
141
142 if (TRGDebug::level())
143 cout << TRGDebug::tab() << "Regions=" << hp.regions().size() << endl;
144
145 TRGDebug::leaveStage("Making regions");
146 }

◆ regions() [2/2]

const std::vector< std::vector< unsigned > * > & regions ( void  ) const
inline

returns regions.

Definition at line 416 of file HoughPlaneBase.h.

417 {
418 return _regions;
419 }

◆ registerPattern() [1/4]

void registerPattern ( unsigned  id)
overridevirtual

Registers a pattern on a Hough plane with (r, phi=0).

Implements TRGCDCHoughPlaneBase.

Reimplemented in TRGCDCHoughPlaneMulti, and TRGCDCHoughPlaneMulti2.

Definition at line 202 of file HoughPlane.cc.

203 {
204 if (_patterns) {
205 delete [] _patterns;
206 _nPatterns = 0;
207 }
208 const unsigned n = nX() * nY();
209
210 //...Check # of active cells...
211 for (unsigned i = 0; i < n; i++)
212 if (_cell[i]) ++_nPatterns;
213
214 //...Create array...
215 _patterns = new unsigned[_nPatterns];
216
217 //...Store them...
218 unsigned j = 0;
219 for (unsigned i = 0; i < n; i++)
220 if (_cell[i]) _patterns[j++] = i;
221 }
unsigned * _patterns
Curve patterns.
Definition: HoughPlane.h:96

◆ registerPattern() [2/4]

void registerPattern ( unsigned  id)
overridevirtual

registers a pattern..

Implements TRGCDCHoughPlaneBase.

Definition at line 209 of file HoughPlaneBoolean.cc.

210 {
211
212 //...Check status...
213 if (_patterns[id]) {
214 std::cout << "TRGCDCHoughPlaneBoolean::registerPattern !!! "
215 << "a pattern(id=" << id << ") was already registered"
216 << std::endl;
217 return;
218 }
219 if (id >= _nPatterns) {
220 std::cout << "TRGCDCHoughPlaneBoolean::registerPattern !!! "
221 << "given id(" << id << ") is over range(" << _nPatterns << ")"
222 << std::endl;
223 return;
224 }
225 const unsigned n = nX() * nY();
226
227 //...Check # of active cells...
228 unsigned nActive = 0;
229 for (unsigned i = 0; i < n; i++) {
230 const unsigned j = i / 32;
231 const unsigned k = i % 32;
232 if ((_cell[j] >> k) & 1) {
233 ++nActive;
234 _reverse[i].push_back(id);
235 }
236 }
237 _nActive[id] = nActive;
238
239 //...Create an array...
240 _patterns[id] = new unsigned[nActive];
241
242 //...Store them...
243 unsigned l = 0;
244 for (unsigned i = 0; i < n; i++) {
245 const unsigned j = i / 32;
246 const unsigned k = i % 32;
247 if ((_cell[j] >> k) & 1) {
248 _patterns[id][l] = i;
249 l++;
250 }
251 }
252 }

◆ registerPattern() [3/4]

void registerPattern ( unsigned  id)
inlineoverridevirtual

registers a pattern..

Reimplemented from TRGCDCHoughPlane.

Definition at line 104 of file HoughPlaneMulti.h.

105 {
107 }
void registerPattern(unsigned id) override
Registers a pattern on a Hough plane with (r, phi=0).
Definition: HoughPlane.cc:202

◆ registerPattern() [4/4]

void registerPattern ( unsigned  layerId,
unsigned  id 
)
inline

registers a pattern..

Definition at line 231 of file HoughPlaneMulti2.h.

232 {
233 _layers[layerId]->registerPattern(id);
234 }

◆ relation()

const TRGCDCRelation relation ( void  ) const

returns MC information.

False will be returned if no MC info. available.

Definition at line 142 of file TrackBase.cc.

143 {
144
145 TRGDebug::enterStage("MCInfo");
146
147 map<unsigned, unsigned> relations;
148 for (unsigned i = 0; i < _tsAll.size(); i++) {
149
150 const TCCell& cell = * _tsAll[i]->cell();
151 const TCCHit& hit = * cell.hit();
152 const unsigned iMCParticle = hit.iMCParticle();
153
154 map<unsigned, unsigned>::iterator it = relations.find(iMCParticle);
155 if (it != relations.end())
156 ++it->second;
157 else
158 relations[iMCParticle] = 1;
159
160 if (TRGDebug::level()) {
161 cout << TRGDebug::tab() << cell.name() << ",MCParticle="
162 << iMCParticle << endl;
163 }
164 }
165
166 if (TRGDebug::level()) {
167 map<unsigned, unsigned>::const_iterator it = relations.begin();
168 while (it != relations.end()) {
169 cout << TRGDebug::tab()
170 << it->first << ","
171 << it->second << endl;
172 ++it;
173 }
174 }
175
176 TRGDebug::leaveStage("MCInfo");
177
178 return TCRelation(* this, relations);
179 }

◆ relation2D()

const TRGCDCRelation relation2D ( void  ) const

returns MC information for only axial layers.

Definition at line 182 of file TrackBase.cc.

183 {
184
185 TRGDebug::enterStage("MCInfo");
186
187 map<unsigned, unsigned> relations;
188 for (unsigned i = 0; i < _tsAll.size(); i++) {
189
190
191 const TCCell& cell = * _tsAll[i]->cell();
192
193 // Ignore stereo layers
194 if (cell.superLayerId() % 2 == 1) continue;
195
196 const TCCHit& hit = * cell.hit();
197 const unsigned iMCParticle = hit.iMCParticle();
198
199 map<unsigned, unsigned>::iterator it = relations.find(iMCParticle);
200 if (it != relations.end())
201 ++it->second;
202 else
203 relations[iMCParticle] = 1;
204
205 if (TRGDebug::level()) {
206 cout << TRGDebug::tab() << cell.name() << ",MCParticle="
207 << iMCParticle << endl;
208 }
209 }
210
211 if (TRGDebug::level()) {
212 map<unsigned, unsigned>::const_iterator it = relations.begin();
213 while (it != relations.end()) {
214 cout << TRGDebug::tab()
215 << it->first << ","
216 << it->second << endl;
217 ++it;
218 }
219 }
220
221 TRGDebug::leaveStage("MCInfo");
222
223 return TCRelation(* this, relations);
224 }

◆ relation3D()

const TRGCDCRelation relation3D ( void  ) const

returns MC information for only stereo layers.

Definition at line 232 of file TrackBase.cc.

233 {
234
235 TRGDebug::enterStage("MCInfo");
236
237 map<unsigned, unsigned> relations;
238 for (unsigned i = 0; i < _tsAll.size(); i++) {
239
240 const TCCell& cell = * _tsAll[i]->cell();
241
242 // Ignore axial layers
243 if (cell.superLayerId() % 2 == 0) continue;
244
245 const TCCHit& hit = * cell.hit();
246 const unsigned iMCParticle = hit.iMCParticle();
247
248 map<unsigned, unsigned>::iterator it = relations.find(iMCParticle);
249 if (it != relations.end())
250 ++it->second;
251 else
252 relations[iMCParticle] = 1;
253
254 if (TRGDebug::level()) {
255 cout << TRGDebug::tab() << cell.name() << ",MCParticle="
256 << iMCParticle << endl;
257 }
258 }
259
260 if (TRGDebug::level()) {
261 map<unsigned, unsigned>::const_iterator it = relations.begin();
262 while (it != relations.end()) {
263 cout << TRGDebug::tab()
264 << it->first << ","
265 << it->second << endl;
266 ++it;
267 }
268 }
269
270 TRGDebug::leaveStage("MCInfo");
271
272 return TCRelation(* this, relations);
273 }

◆ remove()

void remove ( std::vector< TRGCDCLink * > &  list,
const std::vector< TRGCDCLink * > &  links 
)
static

removes links from list if wire is same

Definition at line 784 of file Link.cc.

786 {
787 const unsigned n = list.size();
788 const unsigned m = links.size();
789 // vector<TRGCDCLink *> toBeRemoved;
790
791 for (unsigned i = 0; i < n; i++) {
792 for (unsigned j = 0; j < m; j++) {
793 if (list[i]->cell()->id() == links[j]->cell()->id())
794// toBeRemoved.push_back(list[i]);
795
796 cout << "TCLink::remove !!! not implemented yet" << endl;
797 }
798 }
799
800// list.remove(toBeRemoved);
801 }

◆ removeAll() [1/3]

void removeAll ( void  )
static

destructs all TRGCDCLink objects. (Called by TRGCDC)

Definition at line 849 of file Link.cc.

850 {
851 while (_all.size())
852 delete _all.back();
853 }

◆ removeAll() [2/3]

void removeAll ( void  )
static

destructs all TRGCDCCellHit objects. (Called by TRGCDC)

Definition at line 84 of file SegmentHit.cc.

85 {
86 while (_all.size())
87 delete _all.back();
88 }

◆ removeAll() [3/3]

void removeAll ( void  )
static

destructs all TRGCDCCellHit objects. (Called by TRGCDC)

Definition at line 78 of file WireHit.cc.

79 {
80 while (_all.size())
81 delete _all.back();
82 }

◆ removeImpossibleStereoSuperlayers()

void removeImpossibleStereoSuperlayers ( std::vector< double > &  useStSL)

Removes TSs that are not possible with track Pt.

Definition at line 1193 of file Fitter3D.cc.

1194 {
1195 for (unsigned iSt = 0; iSt < 4; iSt++) {
1196 // Check if rho is large enough for stereo super layer.
1197 if (2 * m_mDouble["rho"] < m_mConstV["rr3D"][iSt]) {
1198 useStSl[iSt] = 0;
1199 if (m_mBool["fIsPrintError"]) cout << "Fitter3D::removeImpossibleStereoSuperlayers() => pt is too low for SL." << endl;
1200 }
1201 } // End superlayer loop
1202 }

◆ replaceWithSignalNames()

std::string replaceWithSignalNames ( std::string const &  fromVhdlCode,
std::vector< std::pair< std::string, std::vector< int > > > const &  fromVhdlSignals,
int const &  finishClock,
std::map< std::string, std::vector< int > > &  buffers 
)
static

Writes final vhdl code.

Definition at line 1899 of file JSignal.cc.

1902 {
1903 // Replace names with token(" ") in from.m_vhdlCode
1904 string t_vhdlCode = "";
1905 size_t start = 0;
1906 size_t end = fromVhdlCode.find(" ");
1907 int nIndex = (int)fromArgumentSignals.size();
1908 int index = 0;
1909 while (end != string::npos) {
1910 // Check if there are enough signal names.
1911 if (nIndex - 1 < index) {
1912 cout << "[Error] TRGCDCJSignal::replaceWithSignalNames() => Not enough signal names in m_argumentSignals." << endl;
1913 return "";
1914 }
1915 // Replace token(" ") with name.
1916 //cout<<"Name: "<<fromArgumentSignals[index].first<<" Clock: "<<fromArgumentSignals[index].second[2]<<endl;
1917 int t_buffer = (finishClock - 1) - fromArgumentSignals[index].second[2] - 1;
1918 // No buffer needed or instant assignment or constant.
1919 if (t_buffer == -1 || t_buffer == -2
1920 || fromArgumentSignals[index].second[2] == -1) t_vhdlCode += fromVhdlCode.substr(start,
1921 end - start) + fromArgumentSignals[index].first;
1922 else if (t_buffer > -1) {
1923 t_vhdlCode += fromVhdlCode.substr(start, end - start) + fromArgumentSignals[index].first + "_b(" + to_string(t_buffer) + ")";
1924 // Fill map for buffers.
1925 if (buffers.find(fromArgumentSignals[index].first) == buffers.end()) {
1926 buffers[fromArgumentSignals[index].first] = {fromArgumentSignals[index].second[0], fromArgumentSignals[index].second[1], t_buffer};
1927 } else {
1928 if (buffers[fromArgumentSignals[index].first][2] < t_buffer) buffers[fromArgumentSignals[index].first][2] = t_buffer;
1929 }
1930 } else {
1931 cout << "[Error] TRGCDCJSignal::replaceWithSignalNames() => finishClock is too small." << endl;
1932 t_vhdlCode += fromVhdlCode.substr(start, end - start) + fromArgumentSignals[index].first;
1933 }
1934
1935 index++;
1936 start = end + 1;
1937 end = fromVhdlCode.find(" ", start);
1938 }
1939 t_vhdlCode += fromVhdlCode.substr(start, end - start);
1940 // Check if number of spaces and signal names are same.
1941 if (nIndex != index) {
1942 cout << "[Error] TRGCDCJSignal::replaceWithSignalNames() => Number of signal names and number of " " do not match." << endl;
1943 return "";
1944 }
1945 return t_vhdlCode;
1946 }

◆ resize()

TRGCDCJSignal const resize ( int  bitwidth) const

Resizes signal.

Definition at line 989 of file JSignal.cc.

990 {
991 if (this->m_bitsize == bitwidth) return (*this);
992
993 TRGCDCJSignal t_result(*this);
994 if (t_result.m_argumentSignals.size() == 0) t_result.initArgumentSignals();
995
996 t_result.m_bitsize = bitwidth;
997 // Check if there is overflow or underflow.
998 t_result.checkInt("TRGCDCJSignal::resize()");
999
1000
1001 if (getPrintVhdl() == 1) vhdlCode("resize", *this, t_result, t_result.m_vhdlCode);
1002 //t_result.m_vhdlCode = "resize("+t_result.m_vhdlCode+","+to_string(t_result.m_bitsize)+")";
1003 return t_result;
1004 }

◆ reverse()

TRGTime & reverse ( void  )
inline

reverse edge.

Definition at line 141 of file Time.h.

142 {
143 _edge = ! _edge;
144 return * this;
145 }

◆ riseEdge()

bool riseEdge ( int  clockPosition) const
inline

returns true if signal is active and rising edge in give clock position.

Definition at line 304 of file Signal.h.

305 {
306 if (_history.size()) {
307 bool last = false;
308 for (unsigned i = 0; i < _history.size(); i++) {
309 if (_history[i].time() < a) {
310 continue;
311 } else if (_history[i].time() == a) {
312 last = _history[i].edge();
313 } else if (_history[i].time() > a) {
314 break;
315 }
316 }
317 return last;
318 } else
319 return false;
320 }

◆ rlrel()

bool rlrel ( vector< unsigned >  a,
vector< unsigned >  b 
)

...rlrel...

Definition at line 157 of file PeakFinder.cc.

158 {
159 bool t = true;
160 //case 1
161 if (b[1] == 0 && b[3] == 0) {
162 t = false;
163 }
164 //case 2
165 if (a[2] == 0 && a[4] == 0) {
166 t = false;
167 }
168 return t;
169 }

◆ rotate()

void rotate ( double  c,
double  s 
)
inlineprivate

private member functions

Definition at line 222 of file Lpar.h.

223 {
224 double aTRGCDCLpar = c * m_alpha + s * m_beta;
225 double betar = -s * m_alpha + c * m_beta;
226 m_alpha = aTRGCDCLpar;
227 m_beta = betar;
228 }

◆ rPhi()

void rPhi ( std::map< std::string, Belle2::TRGCDCJSignal > &  mSignalStorage,
std::map< std::string, Belle2::TRGCDCJLUT * > &  mLutStorage 
)
staticprivate

Calculate r * phi ?

Definition at line 467 of file HoughFinder.cc.

469 {
470 Belle2::TRGCDCJSignalData* commonData = mSignalStorage.begin()->second.getCommonData();
471 for (unsigned iSt = 0; iSt < 5; iSt++) {
472 mSignalStorage["cosPhiMul_" + to_string(iSt)] <= mSignalStorage["cosPhi_" + to_string(iSt)] * mSignalStorage["cosPhi_" + to_string(
473 iSt)];
474 }
475
476 for (unsigned iSt = 0; iSt < 5; iSt++) {
477 mSignalStorage["sinPhiMul_" + to_string(iSt)] <= mSignalStorage["sinPhi_" + to_string(iSt)] * mSignalStorage["sinPhi_" + to_string(
478 iSt)];
479 }
480
481 for (unsigned iSt = 0; iSt < 5; iSt++) {
482 mSignalStorage["cossinPhiMul_" + to_string(iSt)] <= mSignalStorage["cosPhi_" + to_string(iSt)] * mSignalStorage["sinPhi_" +
483 to_string(iSt)];
484 }
485
486 for (unsigned iSt = 0; iSt < 5; iSt++) {
487 mSignalStorage["rcosPhiMul_" + to_string(iSt)] <= mSignalStorage["cosPhi_" + to_string(iSt)] * mSignalStorage["2Drr_" + to_string(
488 iSt)];
489 }
490
491 for (unsigned iSt = 0; iSt < 5; iSt++) {
492 mSignalStorage["rsinPhiMul_" + to_string(iSt)] <= mSignalStorage["sinPhi_" + to_string(iSt)] * mSignalStorage["2Drr_" + to_string(
493 iSt)];
494 }
495 mSignalStorage["cossum_p1_0"] <= mSignalStorage["cosPhiMul_0"] + mSignalStorage["cosPhiMul_1"];
496 mSignalStorage["cossum_p1_1"] <= mSignalStorage["cosPhiMul_2"] + mSignalStorage["cosPhiMul_3"];
497 mSignalStorage["cossum_p1_2"] <= mSignalStorage["cosPhiMul_4"] ;
498 mSignalStorage["cossum_p2_0"] <= mSignalStorage["cossum_p1_0"] + mSignalStorage["cossum_p1_1"];
499 mSignalStorage["cossum_p2_1"] <= mSignalStorage["cossum_p1_2"] ;
500 mSignalStorage["cossum"] <= mSignalStorage["cossum_p2_0"] + mSignalStorage["cossum_p2_1"];
501 mSignalStorage["sinsum_p1_0"] <= mSignalStorage["sinPhiMul_0"] + mSignalStorage["sinPhiMul_1"];
502 mSignalStorage["sinsum_p1_1"] <= mSignalStorage["sinPhiMul_2"] + mSignalStorage["sinPhiMul_3"];
503 mSignalStorage["sinsum_p1_2"] <= mSignalStorage["sinPhiMul_4"] ;
504 mSignalStorage["sinsum_p2_0"] <= mSignalStorage["sinsum_p1_0"] + mSignalStorage["sinsum_p1_1"];
505 mSignalStorage["sinsum_p2_1"] <= mSignalStorage["sinsum_p1_2"] ;
506 mSignalStorage["sinsum"] <= mSignalStorage["sinsum_p2_0"] + mSignalStorage["sinsum_p2_1"];
507 mSignalStorage["cossinsum_p1_0"] <= mSignalStorage["cossinPhiMul_0"] + mSignalStorage["cossinPhiMul_1"];
508 mSignalStorage["cossinsum_p1_1"] <= mSignalStorage["cossinPhiMul_2"] + mSignalStorage["cossinPhiMul_3"];
509 mSignalStorage["cossinsum_p1_2"] <= mSignalStorage["cossinPhiMul_4"] ;
510 mSignalStorage["cossinsum_p2_0"] <= mSignalStorage["cossinsum_p1_0"] + mSignalStorage["cossinsum_p1_1"];
511 mSignalStorage["cossinsum_p2_1"] <= mSignalStorage["cossinsum_p1_2"] ;
512 mSignalStorage["cossinsum"] <= mSignalStorage["cossinsum_p2_0"] + mSignalStorage["cossinsum_p2_1"];
513 mSignalStorage["rcossum_p1_0"] <= mSignalStorage["rcosPhiMul_0"] + mSignalStorage["rcosPhiMul_1"];
514 mSignalStorage["rcossum_p1_1"] <= mSignalStorage["rcosPhiMul_2"] + mSignalStorage["rcosPhiMul_3"];
515 mSignalStorage["rcossum_p1_2"] <= mSignalStorage["rcosPhiMul_4"] ;
516 mSignalStorage["rcossum_p2_0"] <= mSignalStorage["rcossum_p1_0"] + mSignalStorage["rcossum_p1_1"];
517 mSignalStorage["rcossum_p2_1"] <= mSignalStorage["rcossum_p1_2"] ;
518 mSignalStorage["rcossum"] <= mSignalStorage["rcossum_p2_0"] + mSignalStorage["rcossum_p2_1"];
519 mSignalStorage["rsinsum_p1_0"] <= mSignalStorage["rsinPhiMul_0"] + mSignalStorage["rsinPhiMul_1"];
520 mSignalStorage["rsinsum_p1_1"] <= mSignalStorage["rsinPhiMul_2"] + mSignalStorage["rsinPhiMul_3"];
521 mSignalStorage["rsinsum_p1_2"] <= mSignalStorage["rsinPhiMul_4"] ;
522 mSignalStorage["rsinsum_p2_0"] <= mSignalStorage["rsinsum_p1_0"] + mSignalStorage["rsinsum_p1_1"];
523 mSignalStorage["rsinsum_p2_1"] <= mSignalStorage["rsinsum_p1_2"] ;
524 mSignalStorage["rsinsum"] <= mSignalStorage["rsinsum_p2_0"] + mSignalStorage["rsinsum_p2_1"];
525 mSignalStorage["hcx_p1_0"] <= mSignalStorage["rcossum"] * mSignalStorage["sinsum"];
526 mSignalStorage["hcx_p1_1"] <= mSignalStorage["rsinsum"] * mSignalStorage["cossinsum"];
527 mSignalStorage["hcx_p2"] <= mSignalStorage["hcx_p1_0"] - mSignalStorage["hcx_p1_1"];
528 mSignalStorage["hcy_p1_0"] <= mSignalStorage["rsinsum"] * mSignalStorage["cossum"];
529 mSignalStorage["hcy_p1_1"] <= mSignalStorage["rcossum"] * mSignalStorage["cossinsum"];
530 mSignalStorage["hcy_p2"] <= mSignalStorage["hcy_p1_0"] - mSignalStorage["hcy_p1_1"];
531 mSignalStorage["den_p1"] <= mSignalStorage["cossum"] * mSignalStorage["sinsum"];
532 mSignalStorage["den_p2"] <= mSignalStorage["cossinsum"] * mSignalStorage["cossinsum"];
533 mSignalStorage["den"] <= mSignalStorage["den_p1"] - mSignalStorage["den_p2"];
534 {
535 mSignalStorage["denMin"] = Belle2::TRGCDCJSignal(0.00315354, mSignalStorage["den"].getToReal(),
536 commonData);//den Min = 0.00630708*0.5
537 mSignalStorage["denMax"] = Belle2::TRGCDCJSignal(1.332705, mSignalStorage["den"].getToReal(), commonData);//den Max = 0.88847*1.5
538 }
539
540 // Constrain den.
541 {
542 // Make ifElse data.
543 vector<pair<Belle2::TRGCDCJSignal, vector<pair<Belle2::TRGCDCJSignal*, Belle2::TRGCDCJSignal> > > > t_data;
544 // Compare
545 Belle2::TRGCDCJSignal t_compare = Belle2::TRGCDCJSignal::comp(mSignalStorage["den"], ">", mSignalStorage["denMax"]);
546 // Assignments
547 vector<pair<Belle2::TRGCDCJSignal*, Belle2::TRGCDCJSignal> > t_assigns = {
548 make_pair(&mSignalStorage["den_c"], mSignalStorage["denMax"])
549 };
550 // Push to data.
551 t_data.push_back(make_pair(t_compare, t_assigns));
552 // Compare
553 t_compare = Belle2::TRGCDCJSignal::comp(mSignalStorage["den"], ">", mSignalStorage["denMin"]);
554 // Assignments
555 t_assigns = {
556 make_pair(&mSignalStorage["den_c"], mSignalStorage["den"].limit(mSignalStorage["denMin"], mSignalStorage["denMax"]))
557 };
558 // Push to data.
559 t_data.push_back(make_pair(t_compare, t_assigns));
560 // Compare
561 t_compare = Belle2::TRGCDCJSignal();
562 // Assignments
563 t_assigns = {
564 make_pair(&mSignalStorage["den_c"], mSignalStorage["denMin"])
565 };
566 // Push to data.
567 t_data.push_back(make_pair(t_compare, t_assigns));
569 }
570
571 {
572 unsigned long long t_int = mSignalStorage["den_c"].getMaxInt();
573 double t_toReal = mSignalStorage["den_c"].getToReal();
574 double t_actual = mSignalStorage["den_c"].getMaxActual();
575 mSignalStorage["iDenMin"] = Belle2::TRGCDCJSignal(t_int, t_toReal, t_int, t_int, t_actual, t_actual, t_actual, -1, commonData);
576 t_int = mSignalStorage["den_c"].getMinInt();
577 t_actual = mSignalStorage["den_c"].getMinActual();
578 mSignalStorage["iDenMax"] = Belle2::TRGCDCJSignal(t_int, t_toReal, t_int, t_int, t_actual, t_actual, t_actual, -1, commonData);
579 }
580
581 if (!mLutStorage.count("iDen")) {
582 mLutStorage["iDen"] = new Belle2::TRGCDCJLUT("iDen");
583 mLutStorage["iDen"]->setFloatFunction(
584 [ = ](double aValue) -> double{return 0.5 / aValue;},
585 mSignalStorage["den_c"],
586 mSignalStorage["iDenMin"], mSignalStorage["iDenMax"], pow(1 / mSignalStorage["cossinsum"].getToReal(), 2),
587 12, 12);
588 }
589
590 //Operate using LUT(iDen = 1/2/den)
591 mLutStorage["iDen"]->operate(mSignalStorage["den_c"], mSignalStorage["iDen"]);
592
593 mSignalStorage["hcx"] <= mSignalStorage["hcx_p2"] * mSignalStorage["iDen"];
594 mSignalStorage["hcy"] <= mSignalStorage["hcy_p2"] * mSignalStorage["iDen"];
595
596 mSignalStorage["hcx2"] <= mSignalStorage["hcx"] * mSignalStorage["hcx"];
597 mSignalStorage["hcy2"] <= mSignalStorage["hcy"] * mSignalStorage["hcy"];
598 mSignalStorage["sumhc"] <= mSignalStorage["hcx2"] + mSignalStorage["hcy2"];
599 {
600 mSignalStorage["sumhcMin"] = Belle2::TRGCDCJSignal(4489, mSignalStorage["sumhc"].getToReal(), commonData);
601 mSignalStorage["sumhcMax"] = Belle2::TRGCDCJSignal(2560000, mSignalStorage["sumhc"].getToReal(), commonData);
602 }
603
604 // Constrain den.
605 {
606 // Make ifElse data.
607 vector<pair<Belle2::TRGCDCJSignal, vector<pair<Belle2::TRGCDCJSignal*, Belle2::TRGCDCJSignal> > > > t_data;
608 // Compare
609 Belle2::TRGCDCJSignal t_compare = Belle2::TRGCDCJSignal::comp(mSignalStorage["sumhc"], ">", mSignalStorage["sumhcMax"]);
610 // Assignments
611 vector<pair<Belle2::TRGCDCJSignal*, Belle2::TRGCDCJSignal> > t_assigns = {
612 make_pair(&mSignalStorage["sumhc_c"], mSignalStorage["sumhcMax"])
613 };
614 // Push to data.
615 t_data.push_back(make_pair(t_compare, t_assigns));
616 // Compare
617 t_compare = Belle2::TRGCDCJSignal::comp(mSignalStorage["sumhc"], ">", mSignalStorage["sumhcMin"]);
618 // Assignments
619 t_assigns = {
620 make_pair(&mSignalStorage["sumhc_c"], mSignalStorage["sumhc"].limit(mSignalStorage["sumhcMin"], mSignalStorage["sumhcMax"]))
621 };
622 // Push to data.
623 t_data.push_back(make_pair(t_compare, t_assigns));
624 // Compare
625 t_compare = Belle2::TRGCDCJSignal();
626 // Assignments
627 t_assigns = {
628 make_pair(&mSignalStorage["sumhc_c"], mSignalStorage["sumhcMin"])
629 };
630 // Push to data.
631 t_data.push_back(make_pair(t_compare, t_assigns));
633 }
634 {
635 unsigned long long t_int = mSignalStorage["sumhc_c"].getMaxInt();
636 double t_toReal = mSignalStorage["sumhc_c"].getToReal();
637 double t_actual = mSignalStorage["sumhc_c"].getMaxActual();
638 mSignalStorage["iRhoMax"] = Belle2::TRGCDCJSignal(t_int, t_toReal, t_int, t_int, t_actual, t_actual, t_actual, -1, commonData);
639 t_int = mSignalStorage["sumhc_c"].getMinInt();
640 t_actual = mSignalStorage["sumhc_c"].getMinActual();
641 mSignalStorage["iRhoMin"] = Belle2::TRGCDCJSignal(t_int, t_toReal, t_int, t_int, t_actual, t_actual, t_actual, -1, commonData);
642 }
643 // Generate sqrt LUT sqrt(hcx*hcx + hcy*hcy)
644 if (!mLutStorage.count("iRho")) {
645 mLutStorage["iRho"] = new Belle2::TRGCDCJLUT("iRho");
646 mLutStorage["iRho"]->setFloatFunction(
647 [ = ](double aValue) -> double{return abs(sqrt(aValue));},
648 mSignalStorage["sumhc_c"],
649 mSignalStorage["iRhoMin"], mSignalStorage["iRhoMax"], mSignalStorage["sumhc"].getToReal(),
650 24, 12);
651 }
652 // Operate using LUT(iRho = sqrt(sumhc))
653 mLutStorage["iRho"]->operate(mSignalStorage["sumhc_c"], mSignalStorage["iRho"]);
654 if (TRGDebug::level()) {
655 cout << "<<<iRho>>>" << endl;
656 mSignalStorage["iRho"].dump();
657 }
658 }//rphi

◆ s() [1/2]

double s ( double  r,
int  dir = 0 
) const

const member functions

Definition at line 223 of file Lpar.cc.

224 {
225 double d0 = da();
226 if (fabs(r) < fabs(d0)) return -1;
227 double b = fabs(kappa()) * sqrt((r * r - d0 * d0) / (1 + 2 * kappa() * d0));
228 if (fabs(b) > 1) return -1;
229 if (dir == 0)return asin(b) / fabs(kappa());
230 return (M_PI - asin(b)) / fabs(kappa());
231 }
double kappa() const
const member functions
Definition: Lpar.h:57
double da() const
private const member functions
Definition: Lpar.h:169

◆ s() [2/2]

double s ( double  x,
double  y 
) const

const member functions

Definition at line 210 of file Lpar.cc.

211 {
212 double xh, yh, xx, yy;
213 xhyh(x, y, xh, yh);
214 double fk = fabs(kappa());
215 if (fk == 0) return 0;
216 yy = 2 * fk * (alpha() * yh - beta() * xh);
217 xx = 2 * kappa() * (alpha() * xh + beta() * yh) + xi2();
218 double sp = atan2(yy, xx);
219 if (sp < 0) sp += (2 * M_PI);
220 return sp / 2 / fk;
221 }
double beta() const
private const member functions
Definition: Lpar.h:141
double alpha() const
private const member functions
Definition: Lpar.h:139
void xhyh(double x, double y, double &xh, double &yh) const
private const member functions
Definition: Lpar.cc:197

◆ sameLayer() [1/2]

vector< TRGCDCLink * > sameLayer ( const std::vector< TRGCDCLink * > &  list,
const TRGCDCLink a 
)
static

returns links which are in the same layer as 'a' or 'id'.

Definition at line 575 of file Link.cc.

576 {
577 vector<TRGCDCLink*> same;
578 unsigned id = a.cell()->layerId();
579 unsigned n = list.size();
580 for (unsigned i = 0; i < n; i++) {
581 if (list[i]->cell()->layerId() == id) same.push_back(list[i]);
582 }
583 return same;
584 }

◆ sameLayer() [2/2]

vector< TRGCDCLink * > sameLayer ( const std::vector< TRGCDCLink * > &  list,
unsigned  id 
)
static

returns links which are in the same layer as 'a' or 'id'.

Definition at line 599 of file Link.cc.

600 {
601 vector<TRGCDCLink*> same;
602 unsigned n = list.size();
603 for (unsigned i = 0; i < n; i++) {
604 if (list[i]->cell()->layerId() == id) same.push_back(list[i]);
605 }
606 return same;
607 }

◆ sameSuperLayer() [1/2]

vector< TRGCDCLink * > sameSuperLayer ( const std::vector< TRGCDCLink * > &  list,
const TRGCDCLink a 
)
static

returns links which are in the same super layer as 'a' or 'id'.

Definition at line 587 of file Link.cc.

588 {
589 vector<TRGCDCLink*> same;
590 unsigned id = a.cell()->superLayerId();
591 unsigned n = list.size();
592 for (unsigned i = 0; i < n; i++) {
593 if (list[i]->cell()->superLayerId() == id) same.push_back(list[i]);
594 }
595 return same;
596 }

◆ sameSuperLayer() [2/2]

vector< TRGCDCLink * > sameSuperLayer ( const std::vector< TRGCDCLink * > &  list,
unsigned  id 
)
static

returns links which are in the same super layer as 'a' or 'id'.

Definition at line 610 of file Link.cc.

611 {
612 vector<TRGCDCLink*> same;
613 unsigned n = list.size();
614 for (unsigned i = 0; i < n; i++) {
615 if (list[i]->cell()->superLayerId() == id) same.push_back(list[i]);
616 }
617 return same;
618 }

◆ saveAllSignals()

void saveAllSignals ( )

Saves all signals for debugging.

Definition at line 934 of file Fitter3D.cc.

935 {
936 // Save all signals to m_mSavedSignals. Limit to 10 times.
937 if ((*m_mSavedSignals.begin()).second.size() < 10 || m_mSavedSignals.empty()) {
938 for (auto it = m_mSignalStorage.begin(); it != m_mSignalStorage.end(); ++it) {
939 m_mSavedSignals[(*it).first].push_back((*it).second.getInt());
940 }
941 }
942 }
std::map< std::string, std::vector< signed long long > > m_mSavedSignals
Array of saved signals.
Definition: Fitter3D.h:163

◆ saveCDCHitInformation()

void saveCDCHitInformation ( std::vector< std::vector< unsigned > > &  hitWiresFromCDC)
private

Save functions for ROOT.

Definition at line 2760 of file TRGCDC.cc.

2761 {
2762 TClonesArray& rootCDCHitInformation = *m_rootCDCHitInformation;
2763 rootCDCHitInformation.Clear();
2764 for (unsigned iHit = 0; iHit < hitWiresFromCDC.size(); iHit++) {
2765 TVectorD t_rootCDCHitInformation(5);
2766 t_rootCDCHitInformation[0] = hitWiresFromCDC[iHit][0];
2767 t_rootCDCHitInformation[1] = hitWiresFromCDC[iHit][1];
2768 t_rootCDCHitInformation[2] = hitWiresFromCDC[iHit][2];
2769 t_rootCDCHitInformation[3] = hitWiresFromCDC[iHit][3];
2770 t_rootCDCHitInformation[4] = hitWiresFromCDC[iHit][4];
2771 new (rootCDCHitInformation[iHit]) TVectorD(t_rootCDCHitInformation);
2772 } // End of hit loop
2773 }

◆ saveIoSignals()

void saveIoSignals ( )

Saves all I/O signals for debugging.

Definition at line 944 of file Fitter3D.cc.

945 {
946 // Save input output signals. Limit to 1024.
947 if ((*m_mSavedIoSignals.begin()).second.size() < 1025 || m_mSavedIoSignals.empty()) {
948 m_mSavedIoSignals["phi0"].push_back(m_mSignalStorage["phi0"].getInt());
949 for (unsigned iSt = 0; iSt < 4;
950 iSt++) m_mSavedIoSignals["phi_" + to_string(iSt)].push_back(m_mSignalStorage["phi_" + to_string(iSt)].getInt());
951 m_mSavedIoSignals["rho"].push_back(m_mSignalStorage["rho"].getInt());
952 for (unsigned iSt = 0; iSt < 4;
953 iSt++) m_mSavedIoSignals["iZError2_" + to_string(iSt)].push_back(m_mSignalStorage["iZError2_" + to_string(iSt)].getInt());
954 //m_mSavedIoSignals["charge"].push_back(m_mSignalStorage["charge"].getInt());
955 m_mSavedIoSignals["charge"].push_back(m_mSignalStorage["charge"].getInt());
956 m_mSavedIoSignals["z0"].push_back(m_mSignalStorage["z0"].getInt());
957 m_mSavedIoSignals["cot"].push_back(m_mSignalStorage["cot"].getInt());
958 m_mSavedIoSignals["chi2Sum"].push_back(m_mSignalStorage["chi2Sum"].getInt());
959 }
960 }
std::map< std::string, std::vector< signed long long > > m_mSavedIoSignals
Array of I/O signals.
Definition: Fitter3D.h:165

◆ saveNNTSInformation()

void saveNNTSInformation ( std::vector< TRGCDCSegment * > &  tss)

Saves NNTS information. Only when ts is hit.

Definition at line 717 of file TrackSegmentFinder.cc.

719 {
720
721 StoreArray<CDCSimHit> SimHits;
722 if (! SimHits) {
723 //cout << "CDCTRGTSF !!! can not access to CDCSimHits" << endl;
724 return;
725 }
726
727 TClonesArray& nnPatternInformation = *m_nnPatternInformation;
728 nnPatternInformation.Clear();
729
730 // Save Timing information in ROOT file. Fill for each TS.
731 // Loop over all TSs. wireHit has only one wireSimHit. Meaning there is a particle overlap hit bug.
732 const unsigned nTSs = tss.size();
733 unsigned indexSaving = 0;
734 for (unsigned iTS = 0; iTS < nTSs; iTS++) {
735 // If TS is hit
736 const TCSegment& ts = * tss[iTS];
737 const TCSHit* tsHit = ts.hit();
738 if (tsHit) {
739 const TRGCDCWire* priority;
740 if (ts.wires().size() == 15) priority = ts.wires()[0];
741 else priority = ts.wires()[5];
742 // If priority wire is hit
743 if (priority->hit()) {
744
745 // Calculate timeWires
746 // Fill wire timing. Not hit = 9999. Unit is ns.
747 vector<float> wireTime;
748 if (ts.superLayerId() == 0)
749 wireTime.resize(15);
750 else
751 wireTime.resize(11);
752 // Loop over all wires
753 //cout<<ts.name();
754 const unsigned nWires = ts.wires().size();
755 for (unsigned iWire = 0; iWire < nWires; iWire++) {
756 const TRGCDCWire* wire = ts.wires()[iWire];
757 const TRGCDCWireHit* wireHit = ts.wires()[iWire]->hit();
758 // If wire is hit
759 if (wireHit) {
760 // Only check first change. This could become a bug.
761 wireTime[iWire] = wire->signal().stateChanges()[0];
762 //cout<<ts.wires()[iWire]->name()<<" Clock: "<< ts.wires()[iWire]->signal().clock().frequency()<<" Drift lenght: "<<wireHit->drift()<<" Drift time: "<<ts.wires()[iWire]->signal().stateChanges()[0]<<endl;
763 } else
764 wireTime[iWire] = 9999;
765 //cout<<" "<<wire->name();
766 } // End loop over all wires
767 //cout<<endl;
769 //for(unsigned iWire = 0; iWire < wireTime.size(); iWire++) {
770 // cout<<"Wire: "<<iWire<<" Time: "<<wireTime[iWire]<<endl;
771 //}
772 // Get additional wire information for 6th layer
773 //cout<<" JB: "<<ts.wires().back()->layerId()<<" "<<ts.wires().back()->localId()<<endl;
774 int lastLayer = ts.wires().back()->layerId();
775 int lastWire = ts.wires().back()->localId();
776 int nWiresLayer = _cdc.layer(lastLayer + 1)->nCells();
777 if (nWires == 15) {
778 for (unsigned iWire = 0; iWire < 6; iWire++) {
779 int wireIndex = lastWire - 4 + iWire;
780 if (wireIndex < 0) wireIndex += nWiresLayer;
781 if (wireIndex >= nWiresLayer) wireIndex -= nWiresLayer;
782 //cout<<"Call: "<<(*_cdc.layer(lastLayer+1))[wireIndex]->localId()<<endl;
783 const TRGCDCCell* wire = (*_cdc.layer(lastLayer + 1))[wireIndex];
784 const TRGCDCCellHit* wireHit = wire->hit();
785 // If wire is hit
786 if (wireHit) {
787 // Only check first change. This could become a bug.
788 wireTime.push_back(wire->signal().stateChanges()[0]);
789 //cout<<ts.wires()[iWire]->name()<<" Clock: "<< ts.wires()[iWire]->signal().clock().frequency()<<" Drift lenght: "<<wireHit->drift()<<" Drift time: "<<ts.wires()[iWire]->signal().stateChanges()[0]<<endl;
790 } else
791 wireTime.push_back(9999);
792 } // Loop over all extra wires
793 } else {
794 for (unsigned iWire = 0; iWire < 5; iWire++) {
795 int wireIndex = lastWire - 3 + iWire;
796 if (wireIndex < 0) wireIndex += nWiresLayer;
797 if (wireIndex >= nWiresLayer) wireIndex -= nWiresLayer;
798 //cout<<"Call: "<<(*_cdc.layer(lastLayer+1))[wireIndex]->localId()<<endl;
799 const TRGCDCCell* wire = (*_cdc.layer(lastLayer + 1))[wireIndex];
800 const TRGCDCCellHit* wireHit = wire->hit();
801 // If wire is hit
802 if (wireHit) {
803 // Only check first change. This could become a bug.
804 wireTime.push_back(wire->signal().stateChanges()[0]);
805 //cout<<ts.wires()[iWire]->name()<<" Clock: "<< ts.wires()[iWire]->signal().clock().frequency()<<" Drift lenght: "<<wireHit->drift()<<" Drift time: "<<ts.wires()[iWire]->signal().stateChanges()[0]<<endl;
806 } else
807 wireTime.push_back(9999);
808 } // Loop over all extra wires
809 }
810 //ts.wires()[14]->layerId(), localId()
811 //_cdc._layers[0][localId]->signal().stateChanges()[0]
812
813
815 //float fastestTime = 9999;
816 //for(unsigned iWire=0; iWire<wireTime.size();iWire++) {
817 // if (fastestTime > wireTime[iWire]) fastestTime = wireTime[iWire];
818 //}
820 //for(unsigned iWire=0; iWire<wireTime.size();iWire++) {
821 // if(wireTime[iWire] != 9999) wireTime[iWire] -= fastestTime;
822 //}
823
825 //for(unsigned iWire = 0; iWire < wireTime.size(); iWire++) {
826 // cout<<"Wire: "<<iWire<<" Time: "<<wireTime[iWire]<<endl;
827 //}
828 //cout<<ts.name()<<" is found and priority wire is hit"<<endl;
829 // Calculate mc result
830 float mcLRDriftTime = priority->signal().stateChanges()[0];
831 if (priority->hit()->mcLR()) mcLRDriftTime *= -1;
832 //cout<<ts.name()<<" LRDriftTime: "<<mcLRDriftTime<<endl;
833
834 // Save timing information in Root
835 TVectorD t_nnPatternInformation;
836 if (ts.superLayerId() == 0) {
837 //t_nnPatternInformation.ResizeTo(17);
838 t_nnPatternInformation.ResizeTo(23);
839 t_nnPatternInformation[0] = ts.superLayerId();
840 t_nnPatternInformation[1] = mcLRDriftTime;
841 //for(unsigned iWire=0; iWire<15; iWire++){
842 for (unsigned iWire = 0; iWire < 21; iWire++)
843 t_nnPatternInformation[iWire + 2] = wireTime[iWire];
844 new (nnPatternInformation[indexSaving++]) TVectorD(t_nnPatternInformation);
845 } else {
846 //t_nnPatternInformation.ResizeTo(13);
847 t_nnPatternInformation.ResizeTo(17);
848 t_nnPatternInformation[0] = ts.superLayerId();
849 t_nnPatternInformation[1] = mcLRDriftTime;
850 //for(unsigned iWire=0; iWire<11; iWire++){
851 for (unsigned iWire = 0; iWire < 15; iWire++)
852 t_nnPatternInformation[iWire + 2] = wireTime[iWire];
853 new (nnPatternInformation[indexSaving++]) TVectorD(t_nnPatternInformation);
854 }
855
856 } // End of if priority cell is hit
857 } // End of if TS is hit
858 } // End loop of all TSs
859
860 if (m_makeRootFile) m_treeNNTSF->Fill();
861
862 } // End of save function
bool m_makeRootFile
make ROOT file or not
TClonesArray * m_nnPatternInformation
[superlayer id, lrDriftTime, timeWire0, timeWire1, ..., ...]
TTree * m_treeNNTSF
ROOT Tree for NNTSF.

◆ saveTRGHitInformation()

void saveTRGHitInformation ( std::vector< std::vector< int > > &  hitWiresFromTRG)
private

Save functions for ROOT.

Definition at line 2775 of file TRGCDC.cc.

2776 {
2777 TClonesArray& rootTRGHitInformation = *m_rootTRGHitInformation;
2778 rootTRGHitInformation.Clear();
2779 for (unsigned iHit = 0; iHit < hitWiresFromTRG.size(); iHit++) {
2780 TVectorD t_rootTRGHitInformation(4);
2781 t_rootTRGHitInformation[0] = hitWiresFromTRG[iHit][0];
2782 t_rootTRGHitInformation[1] = hitWiresFromTRG[iHit][1];
2783 t_rootTRGHitInformation[2] = hitWiresFromTRG[iHit][2];
2784 t_rootTRGHitInformation[3] = hitWiresFromTRG[iHit][3];
2785 new (rootTRGHitInformation[iHit]) TVectorD(t_rootTRGHitInformation);
2786 } // End of hit loop
2787 }

◆ saveTRGRawInformation()

void saveTRGRawInformation ( std::vector< std::string > &  trgInformations)
private

Save functions for ROOT.

Definition at line 2789 of file TRGCDC.cc.

2790 {
2791 TClonesArray& rootTRGRawInformation = *m_rootTRGRawInformation;
2792 rootTRGRawInformation.Clear();
2793 for (unsigned iWindow = 0; iWindow < trgInformations.size(); iWindow++) {
2794 TObjString t_rootTRGRawInformation;
2795 t_rootTRGRawInformation.SetString(trgInformations[iWindow].c_str());
2796 new (rootTRGRawInformation[iWindow]) TObjString(t_rootTRGRawInformation);
2797 } // End of hit loop
2798 }

◆ saveTSFResults()

void saveTSFResults ( std::vector< TRGCDCSegmentHit * > *  segmentHitsSL)

save result of TSF

Definition at line 550 of file TrackSegmentFinder.cc.

552 {
553
554 TClonesArray& particleEfficiency = *m_particleEfficiency;
555 TClonesArray& tsInformation = *m_tsInformation;
556 particleEfficiency.Clear();
557 tsInformation.Clear();
558
559 int mcInformation = 1;
561 StoreArray<CDCSimHit> SimHits;
562 if (! SimHits) {
563 //cout << "CDCTRGTSF !!! can not access to CDCSimHits" << endl;
564 mcInformation = 0;
565 }
566 StoreArray<MCParticle> mcParticles;
567 if (! mcParticles) {
568 //cout << "CDCTRGTSF !!! can not access to MCParticles" << endl;
569 mcInformation = 0;
570 }
571 if (mcInformation) {
572 RelationArray cdcSimHitRel(mcParticles, SimHits);
573 // Make map for hit to mcParticle
574 map<int, int> simHitsMCParticlesMap;
575 // Loop over all particles
576 for (int iPart = 0; iPart < cdcSimHitRel.getEntries(); iPart++) {
577 // Loop over all hits for particle
578 for (unsigned iHit = 0; iHit < cdcSimHitRel[iPart].getToIndices().size();
579 iHit++) {
580 //cout<<"From: "<<cdcSimHitRel[iPart].getFromIndex()<<" To: "<<cdcSimHitRel[iPart].getToIndex(iHit)<<endl;
581 simHitsMCParticlesMap[cdcSimHitRel[iPart].getToIndex(iHit)] =
582 cdcSimHitRel[iPart].getFromIndex();
583 }
584 }
586 //for(map<int, int >::iterator it = simHitsMCParticlesMap.begin(); it != simHitsMCParticlesMap.end(); it++) {
587 // cout<<"SimHit Index: "<<(*it).first<<" MCParticle Index: "<<(*it).second<<endl;
588 //}
589 // Find efficiency for each particle
590 // Find hit TS SuperLayer for particles
591 // particleNHiTS[iMCParticle] = hitTSSL
592 map<int, unsigned> particleNHitTS;
593 // Loop over all hit TSs
594 for (int iSuperLayer = 0; iSuperLayer < 9; iSuperLayer++) {
595 // map<int, bool> particleHitTS;
596 for (unsigned iTS = 0; iTS < segmentHitsSL[iSuperLayer].size(); iTS++) {
597 const TCSegment& ts = segmentHitsSL[iSuperLayer][iTS]->segment();
598 unsigned nWires = ts.wires().size();
599 for (unsigned iWire = 0; iWire < nWires; iWire++) {
600 const TRGCDCWireHit* wireHit = ts.wires()[iWire]->hit();
601 if (wireHit != 0) {
602 int iMCParticle = simHitsMCParticlesMap[wireHit->iCDCSimHit()];
603 if (particleNHitTS[iMCParticle] == 0) {
604 unsigned hitTSSL;
605 hitTSSL = 1 << iSuperLayer;
606 particleNHitTS[iMCParticle] = hitTSSL;
607 } else
608 particleNHitTS[iMCParticle] |= 1 << iSuperLayer;
609 //cout<<ts.name()<<" "<<ts.wires()[iWire]->name()<<" was hit.";
610 //cout<<" Particle was "<<simHitsMCParticlesMap[wireHit->iCDCSimHit()]<<endl;
611 } // If wire is hit
612 } // End of loop over all wires in TS
613 } // End of loop over all TS in super layer
614 } // End of loop over all hit TSs
616 //for( map<int, unsigned>::const_iterator it = particleNHitTS.begin(); it != particleNHitTS.end(); it++) {
617 // bitset<9> printSuperLayers((*it).second);
618 // cout<<"MC particle: "<<(*it).first<<" HitSuperLayers: "<<printSuperLayers<<" nCount: "<<printSuperLayers.count()<<endl;
619 //}
620
621 // Find last CDC hit for each MC particle
622 // tsEfficiency[i][tsEfficiency,particle pT,#MCTS]
623 vector<vector<float>> tsEfficiency;
624 // Loop over all particles
625 for (int iPart = 0; iPart < cdcSimHitRel.getEntries(); iPart++) {
626 int lastWireHit = -1;
627 // Loop over all hits for particle
628 for (unsigned iHit = 0; iHit < cdcSimHitRel[iPart].getToIndices().size();
629 iHit++) {
630 int iSimHit = cdcSimHitRel[iPart].getToIndex(iHit);
631 if (SimHits[iSimHit]->getWireID().getICLayer() > lastWireHit) lastWireHit =
632 SimHits[iSimHit]->getWireID().getICLayer();
633 //cout<<"Particle: "<<cdcSimHitRel[iPart].getFromIndex()<<" CDCSimHit: "<<iSimHit<<endl;
634 //cout<<"SuperLayer: "<<SimHits[iSimHit]->getWireID().getISuperLayer()<<" wireLayer: "<<SimHits[iSimHit]->getWireID().getICLayer()<<endl;
635 }
636 //cout<<"iMCParticle: "<<cdcSimHitRel[iPart].getFromIndex()<<" Last wire Hit: "<<lastWireHit<<endl;
637 // Calculate last superlayer
638 int lastSLHit = 0;
639 if (lastWireHit >= 53) lastSLHit = 9;
640 else if (lastWireHit >= 47) lastSLHit = 8;
641 else if (lastWireHit >= 41) lastSLHit = 7;
642 else if (lastWireHit >= 35) lastSLHit = 6;
643 else if (lastWireHit >= 29) lastSLHit = 5;
644 else if (lastWireHit >= 23) lastSLHit = 4;
645 else if (lastWireHit >= 17) lastSLHit = 3;
646 else if (lastWireHit >= 11) lastSLHit = 2;
647 else if (lastWireHit >= 5) lastSLHit = 1;
648 // Get number of hit TS for particle
649 int iMCParticle = cdcSimHitRel[iPart].getFromIndex();
650 bitset<9> hitSuperLayers(particleNHitTS[iMCParticle]);
651 int numberHitSuperLayers = hitSuperLayers.count();
652 //cout<<"iMCParticle: "<< iMCParticle << " # hit TS: "<<numberHitSuperLayers<<" MC # TS: "<<lastSLHit<<endl;
653 float mcPt = mcParticles[iMCParticle]->getMomentum().Rho();
654 float efficiency;
655 if (lastSLHit == 0) efficiency = -1;
656 else efficiency = float(numberHitSuperLayers) / lastSLHit;
657 //cout<<"Efficiency: "<<float(numberHitSuperLayers)/lastSLHit<<" MC pT: "<<mcPt<<endl;
658 vector<float> tempEfficiency;
659 tempEfficiency.resize(3);
660 tempEfficiency[0] = efficiency;
661 tempEfficiency[1] = mcPt;
662 tempEfficiency[2] = lastSLHit;
663 tsEfficiency.push_back(tempEfficiency);
664 } // End of looping over all particles
666 //for(unsigned iEfficiency=0; iEfficiency<tsEfficiency.size(); iEfficiency++) {
667 // cout<<"Efficiency: "<<tsEfficiency[iEfficiency][0]<<" Pt: "<<tsEfficiency[iEfficiency][1]<<" #MCTS: "<<tsEfficiency[iEfficiency][2]<<endl;
668 //}
669
670 // Save TS efficiency for each particle
671 for (unsigned iEfficiency = 0; iEfficiency < tsEfficiency.size();
672 iEfficiency++) {
673 TVectorD t_particleEfficiency(3);
674 t_particleEfficiency[0] = tsEfficiency[iEfficiency][0];
675 t_particleEfficiency[1] = tsEfficiency[iEfficiency][1];
676 t_particleEfficiency[2] = tsEfficiency[iEfficiency][2];
677 new (particleEfficiency[iEfficiency]) TVectorD(t_particleEfficiency);
678 }
679
680 } // End of no MC information
681
682 // Save TS information
683 // [FIXME] Doesn't work when second only priority is hit.
684 // Loop over all hit TSs
685 int iHitTS = 0;
686 for (int iSuperLayer = 0; iSuperLayer < 9; iSuperLayer++) {
687 for (unsigned iTS = 0; iTS < segmentHitsSL[iSuperLayer].size(); iTS++) {
688 const TCSegment& ts = segmentHitsSL[iSuperLayer][iTS]->segment();
689 //unsigned nWires = ts.wires().size();
690 unsigned iWire = 5;
691 if (iSuperLayer == 0) iWire = 0;
692 const TRGCDCWireHit* wireHit = ts.wires()[iWire]->hit();
693 if (wireHit != 0) {
694 //cout<<"[TSF]: "<<ts.name()<<" was hit at ";
695 unsigned nHits = ts.wires()[iWire]->signal().nSignals();
696 for (unsigned iHit = 0; iHit < nHits; iHit++) {
697 if (iHit % 2 == 1) continue;
698 TVectorD tempTSInformation(3);
699 tempTSInformation[0] = iSuperLayer;
700 tempTSInformation[1] = ts.localId();
701 tempTSInformation[2] = ts.wires()[iWire]->signal().stateChanges()[iHit];
702 new (tsInformation[iHitTS++]) TVectorD(tempTSInformation);
703 //cout<<ts.wires()[iWire]->signal().stateChanges()[iHit]<<", ";
704 //iHit++;
705 }
706 //cout<<endl;
707 } // If wire is hit
708 } // End of loop over all TS in super layer
709 } // End of loop over all hit TSs
710
711 if (m_makeRootFile) m_treeOutputTSF->Fill();
712
713 } // End of saving TSF results
TClonesArray * m_particleEfficiency
[Efficiency, Pt, # MC TS] Efficiency = -1 means that # MC TS is 0.
TTree * m_treeOutputTSF
ROOT TTree for output.
TClonesArray * m_tsInformation
[SuperLayer Id, Wire Id, Priority Timing]

◆ saveTSInformation()

void saveTSInformation ( std::vector< TRGCDCSegment * > &  tss)

save the TS info

Definition at line 411 of file TrackSegmentFinder.cc.

413 {
414
415 TClonesArray& hitPatternInformation = *m_hitPatternInformation;
416 hitPatternInformation.Clear();
417
418 StoreArray<CDCSimHit> SimHits;
419 if (! SimHits.getEntries()) {
420 //cout << "CDCTRGTSF !!! can not access to CDCSimHits" << endl;
421 return;
422 }
423 StoreArray<MCParticle> mcParticles;
424 if (! mcParticles.getEntries()) {
425 //cout << "CDCTRGTSF !!! can not access to MCParticles" << endl;
426 return;
427 }
428
429 //cout<<"Save TS information"<<endl;
430 // Loop over all TSs. wireHit has only one wireSimHit. Meaning there is a particle overlap hit bug.
431 const unsigned nTSs = tss.size();
432 unsigned nHitTSs = 0;
433 for (unsigned iTS = 0; iTS < nTSs; iTS++) {
434 const TCSegment& ts = * tss[iTS];
435 const TRGCDCWire* priority;
436 const TRGCDCWire* secondPriorityL;
437 const TRGCDCWire* secondPriorityR;
438 // Find priority wires
439 if (ts.wires().size() == 15) {
440 priority = ts.wires()[0];
441 secondPriorityR = ts.wires()[1];
442 secondPriorityL = ts.wires()[2];
443 } else {
444 priority = ts.wires()[5];
445 secondPriorityR = ts.wires()[6];
446 secondPriorityL = ts.wires()[7];
447 }
448 // Find L/R, phi of priority wires
449 vector<int> priorityLRs(3);
450 vector<float> priorityPhis(3);
451 B2Vector3D posOnTrack;
452 B2Vector3D posOnWire;
453 if (priority->hit() != 0) {
454 int iSimHit = priority->hit()->iCDCSimHit();
455 priorityLRs[0] = SimHits[iSimHit]->getPosFlag();
456 posOnTrack = SimHits[iSimHit]->getPosTrack();
457 posOnWire = SimHits[iSimHit]->getPosWire();
458 priorityPhis[0] = (posOnTrack - posOnWire).Phi() + M_PI_2 -
459 posOnWire.Phi();
460 //cout<<ts.name()<<endl;
461 //cout<<"Track: "<<posOnTrack.x()<<" "<<posOnTrack.y()<<" "<<posOnTrack.z()<<endl;
462 //cout<<"Wire: "<<posOnWire.x()<<" "<<posOnWire.y()<<" "<<posOnWire.z()<<endl;
463 //cout<<"Before Phi: "<<(posOnTrack - posOnWire).Phi()<<" PosOnWirePhi: "<<posOnWire.Phi()<<" After Phi: "<<priorityPhis[0]<<endl;
464 //cout<<"LR: "<<priorityLRs[0]<<endl;
465 } else {
466 priorityLRs[0] = -1;
467 priorityPhis[0] = 9999;
468 }
469 if (secondPriorityR->hit() != 0) {
470 int iSimHit = secondPriorityR->hit()->iCDCSimHit();
471 priorityLRs[1] = SimHits[iSimHit]->getPosFlag();
472 posOnTrack = SimHits[iSimHit]->getPosTrack();
473 posOnWire = SimHits[iSimHit]->getPosWire();
474 priorityPhis[1] = (posOnTrack - posOnWire).Phi() + M_PI_2 -
475 posOnWire.Phi();
476 } else {
477 priorityLRs[1] = -1;
478 priorityPhis[1] = 9999;
479 }
480 if (secondPriorityL->hit() != 0) {
481 int iSimHit = secondPriorityL->hit()->iCDCSimHit();
482 priorityLRs[2] = SimHits[iSimHit]->getPosFlag();
483 posOnTrack = SimHits[iSimHit]->getPosTrack();
484 posOnWire = SimHits[iSimHit]->getPosWire();
485 priorityPhis[2] = (posOnTrack - posOnWire).Phi() + M_PI_2 -
486 posOnWire.Phi();
487 } else {
488 priorityLRs[2] = -1;
489 priorityPhis[2] = 9999;
490 }
491
492 const unsigned nWires = ts.wires().size();
493 unsigned nHitWires = 0;
494 // Find TSPatternInformation for each particle
495 map<int, unsigned> particleTSPattern;
496 // Loop over wires in TS
497 for (unsigned iWire = 0; iWire < nWires; iWire++) {
498 //...Copy signal from a wire...
499 const TRGSignal& wireSignal = ts.wires()[iWire]->signal();
500 if (wireSignal.active()) ++nHitWires;
501 // Find MC particle of hit wire
502 const TRGCDCWireHit* wireHit = ts.wires()[iWire]->hit();
503 if (wireHit != 0) {
504 MCParticle* particle = SimHits[wireHit->iCDCSimHit()]->getRelatedFrom<MCParticle>();
505 int iMCParticle = (particle) ? particle->getArrayIndex() : mcParticles.getEntries();
506 // If new particle
507 if (particleTSPattern[iMCParticle] == 0) {
508 particleTSPattern[iMCParticle] = 1 << iWire;
509 } else {
510 particleTSPattern[iMCParticle] |= 1 << iWire;
511 }
512 }
513 } // Loop over wires in TS
514
515 // Print pattern for each particle
516 //for(map<int, unsigned >::const_iterator it = particleTSPattern.begin(); it != particleTSPattern.end(); it++ ) {
517 // bitset<15> printPattern((*it).second);
518 // cout<<ts.name()<<" MC Particle: "<< (*it).first <<" pattern: "<<printPattern<<endl;
519 //}
520
521 if (nHitWires != 0) {
522 // Ignore TSPatterns that have 2 particles passing TS.
523 if (particleTSPattern.size() == 1) {
524 map<int, unsigned>::const_iterator it = particleTSPattern.begin();
525 bitset<15> printPattern((*it).second);
526 //cout<<ts.name()<<" MC Particle: "<< (*it).first <<" pattern: "<<printPattern<<endl;
527 //cout<<(*it).first<<" "<<ts.superLayerId()<<" "<<printPattern<<endl;
528 // Save TS Pattern information
529 TVectorD tsPatternInformation(9);
530 tsPatternInformation[0] = (*it).first;
531 tsPatternInformation[1] = ts.superLayerId();
532 tsPatternInformation[2] = double((*it).second);
533 tsPatternInformation[3] = priorityLRs[0];
534 tsPatternInformation[4] = priorityPhis[0];
535 tsPatternInformation[5] = priorityLRs[1];
536 tsPatternInformation[6] = priorityPhis[1];
537 tsPatternInformation[7] = priorityLRs[2];
538 tsPatternInformation[8] = priorityPhis[2];
539 new (hitPatternInformation[nHitTSs++]) TVectorD(tsPatternInformation);
540 }
541 //cout<<ts.name()<<" has "<<nHitWires<<" hit wires."<<endl;
542 }
543 } // End of loop over all TSs
544 if (m_makeRootFile) m_treeInputTSF->Fill();
545 //cout<<"End saving TS information"<<endl;
546 } // End of save function
DataType Phi() const
The azimuth angle.
Definition: B2Vector3.h:151
TClonesArray * m_hitPatternInformation
Stores hitpattern information.
TTree * m_treeInputTSF
ROOT TTree for input.

◆ saveVhdlAndCoe()

void saveVhdlAndCoe ( )

Functions for saving.

Save VHDL and code files.

Definition at line 912 of file Fitter3D.cc.

913 {
914 // Print Vhdl
915 if (m_commonData->getPrintedToFile() == 0) {
916 if (m_commonData->getPrintVhdl() == 0) {
917 m_commonData->setVhdlOutputFile("Fitter3D.vhd");
919 } else {
925 // Print LUTs.
926 for (map<string, TRGCDCJLUT*>::iterator it = m_mLutStorage.begin(); it != m_mLutStorage.end(); ++it) {
927 //it->second->makeCOE("./VHDL/LutData/"+it->first+".coe");
928 it->second->makeCOE(it->first + ".coe");
929 }
930 }
931 }
932 }

◆ sd()

int sd ( double  r,
double  x,
double  y,
double  limit,
double &  s,
double &  d 
) const
inline

const member functions

Definition at line 300 of file Lpar.h.

302 {
303 if ((x * yc() - y * xc())*m_kappa < 0) return 0;
304 double dd = d0(x, y);
305 d = dd * (1 - m_kappa * dd);
306 double d_cross_limit = d * limit;
307 if (d_cross_limit < 0 || d_cross_limit > limit * limit) return 0;
308 double rc = std::sqrt(m_alpha * m_alpha + m_beta * m_beta) / (2 * m_kappa);
309 double rho = 1. / (-2 * m_kappa);
310 double cosPhi = (rc * rc + rho * rho - r * r) / (-2 * rc * rho);
311 cosPhi = cosPhi > 1.0 ? 1.0 : cosPhi;
312 cosPhi = cosPhi < -1.0 ? -1.0 : cosPhi;
313 double phi = std::acos(cosPhi);
314 s = std::fabs(rho) * phi;
315 if (0.0 == phi)return 0;
316 d *= r / (std::fabs(rc) * std::sin(phi));
317//cnv if (abs(d) > abs(limit)) return 0;
318 if (fabs(d) > fabs(limit)) return 0;
319 d_cross_limit = d * limit;
320 if (d_cross_limit > limit * limit) return 0;
321 return 1;
322 }

◆ segment() [1/3]

const TRGCDCSegment & segment ( unsigned  id) const
inline

returns a track segment.

Definition at line 933 of file TRGCDC.h.

934 {
935 return * _tss[id];
936 }

◆ segment() [2/3]

const TRGCDCSegment & segment ( unsigned  lyrId,
unsigned  id 
) const

returns a track segment.

Definition at line 2663 of file TRGCDC.cc.

2664 {
2665 return *(const TRGCDCSegment*)(* _tsLayers[lid])[id];
2666 }

◆ segment() [3/3]

const TRGCDCSegment & segment ( void  ) const

returns a pointer to a track segment.

Definition at line 78 of file SegmentHit.cc.

79 {
80 return dynamic_cast<const TRGCDCSegment&>(cell());
81 }

◆ segmentHits() [1/2]

std::vector< const TRGCDCSegmentHit * > segmentHits ( unsigned  a) const
inline

returns a list of TRGCDCSegmentHit in a super layer N.

'simulate()' must be called before calling this function

Definition at line 1005 of file TRGCDC.h.

1006 {
1007 std::vector<const TRGCDCSegmentHit*> t;
1008 t.assign(_segmentHitsSL[a].begin(), _segmentHitsSL[a].end());
1009 return t;
1010 }

◆ segmentHits() [2/2]

std::vector< const TRGCDCSegmentHit * > segmentHits ( void  ) const
inline

returns a list of TRGCDCSegmentHit.

'simulate()' must be called before calling this function

Definition at line 996 of file TRGCDC.h.

997 {
998 std::vector<const TRGCDCSegmentHit*> t;
999 t.assign(_segmentHits.begin(), _segmentHits.end());
1000 return t;
1001 }

◆ segmentLayer()

const TRGCDCLayer * segmentLayer ( unsigned  id) const
inline

returns a pointer to a track segment layer.

0 will be returned if 'id' is invalid.

Definition at line 1061 of file TRGCDC.h.

1062 {
1063 if (id < _tsLayers.size())
1064 return _tsLayers[id];
1065 return 0;
1066 }

◆ selectAxialTSs()

void selectAxialTSs ( const TRGCDCTrack aTrack,
std::vector< int > &  bestTSIndex 
)
static

Selects priority TSs when there are multiple candidate TSs for a superlayer.

Definition at line 1204 of file Fitter3D.cc.

1205 {
1206 bestTSIndex.resize(5);
1207 std::fill_n(bestTSIndex.begin(), 5, -1);
1208 for (unsigned iAx = 0; iAx < 5; iAx++) {
1209 // Check if all superlayers have one TS
1210 const vector<TCLink*>& links = aTrack.links(iAx * 2);
1211 const unsigned nSegments = links.size();
1212 //cout<<"iAx:"<<iAx<<" nSegments:"<<nSegments<<endl;
1213 // tsCandiateInfo[iTS] = 1st priority, tdc
1214 vector<tuple<int, double> > tsCandiateInfo(nSegments);
1215 // Get information from candidates.
1216 for (unsigned iTS = 0; iTS < nSegments; iTS++) {
1217 const TCSegment* t_segment = dynamic_cast<const TCSegment*>(& links[iTS]->hit()->cell());
1218 int firstPriority = 0;
1219 if (t_segment->center().hit() != 0) firstPriority = 1;
1220 double tdc = t_segment->priorityTime();
1221 std::get<0>(tsCandiateInfo[iTS]) = firstPriority;
1222 std::get<1>(tsCandiateInfo[iTS]) = tdc;
1223 //cout<<"Ax:"<<iAx<<" iTS:"<<iTS<<" firstPriority:"<<firstPriority<<" tdc:"<<tdc<<endl;
1224 }
1225 // Select best candidate.
1226 // bestTS => tsIndex, { 1st priority, tdc }
1227 pair<int, tuple<int, double> > bestTS = make_pair(-1, make_tuple(-1, 9999));
1228 // If there is a candidate.
1229 if (tsCandiateInfo.size() != 0) {
1231 //if (std::get<0>(tsCandiateInfo[0]) == 1) {
1232 // bestTS.first = 0;
1233 // bestTS.second = tsCandiateInfo[0];
1234 //}
1236 //int randomIndex = gRandom->Integer(nSegments);
1237 //if (std::get<0>(tsCandiateInfo[randomIndex]) == 1) {
1238 // bestTS.first = randomIndex;
1239 // bestTS.second = tsCandiateInfo[randomIndex];
1240 //}
1241 // Selection type 1st priority.
1242 for (unsigned iTS = 0; iTS < nSegments; iTS++) {
1243 if (std::get<0>(tsCandiateInfo[iTS]) == 1) {
1244 bool select = 0;
1245 if (bestTS.first == -1) select = 1;
1246 else if (std::get<1>(bestTS.second) > std::get<1>(tsCandiateInfo[iTS])) select = 1;
1247 if (select) {
1248 bestTS.first = iTS;
1249 bestTS.second = tsCandiateInfo[iTS];
1250 }
1251 }
1252 }
1253 }
1254 //cout<<"Ax:"<<iAx<<" best: iTS:"<<bestTS.first<<" firstPriority:"<<std::get<0>(bestTS.second)<<" tdc:"<<std::get<1>(bestTS.second)<<endl;
1255 bestTSIndex[iAx] = bestTS.first;
1256 } // End superlayer loop
1257 }

◆ selectBestHits()

vector< TCLink * > selectBestHits ( const std::vector< TRGCDCLink * > &  links) const
private

selects the best(fastest) hits in each super layer.

Definition at line 270 of file HoughFinder.cc.

271 {
272 vector<TCLink*> bests;
273 vector<TCLink*> layers[9];
274 TCLink::separate(links, 9, layers);
275
276 if (TRGDebug::level()) {
277 for (unsigned i = 0; i < 9; i++) {
278 cout << TRGDebug::tab() << "layer " << i << endl;
279 TCLink::dump(layers[i], "", TRGDebug::tab(4));
280 }
281 }
282
283 //...Select links to be removed...
284 for (unsigned i = 0; i < 9; i++) {
285 if (layers[i].size() == 0) continue;
286 if (layers[i].size() == 1) {
287 bests.push_back(layers[i][0]);
288 continue;
289 }
290
291 TCLink* best = layers[i][0];
292 int timeMin = (layers[i][0]->cell()->signal())[0]->time();
293 for (unsigned j = 1; j < layers[i].size(); j++) {
294 const TRGTime& t = * (layers[i][j]->cell()->signal())[0];
295 if (t.time() < timeMin) {
296 timeMin = t.time();
297 best = layers[i][j];
298 }
299 }
300
301 bests.push_back(best);
302 }
303 return bests;
304 }

◆ sender()

const TRGBoard & sender ( void  ) const
inline

sender TRG board

Definition at line 100 of file Channel.h.

101 {
102 return _sender;
103 }
const TRGBoard & _sender
Sender.
Definition: Channel.h:65

◆ separate()

void separate ( const std::vector< TRGCDCLink * > &  links,
unsigned  nLayers,
std::vector< TRGCDCLink * > *  layers 
)
static

separates into layers.

Definition at line 818 of file Link.cc.

821 {
822 for (unsigned i = 0; i < links.size(); i++) {
823 const TCCell* c = links[i]->cell();
824 if (c) {
825 unsigned lid = c->layer().id();
826 if (lid < nLayers)
827 layers[lid].push_back(links[i]);
828 }
829 }
830 }
static unsigned nLayers(const std::vector< TRGCDCLink * > &links)
returns # of layers.
Definition: Link.cc:105

◆ separateCores()

void separateCores ( const std::vector< TRGCDCLink * > &  input,
std::vector< TRGCDCLink * > &  cores,
std::vector< TRGCDCLink * > &  nonCores 
)
static

separate cores and non-cores.

Definition at line 441 of file Link.cc.

444 {
445 unsigned n = input.size();
446 for (unsigned i = 0; i < n; i++) {
447 TRGCDCLink& t = * input[i];
448 const Belle2::TCCHit& h = * t.hit();
449 if (h.state() & CellHitFittingValid)
450 cores.push_back(& t);
451 else
452 nonCores.push_back(& t);
453 }
454 }
static std::vector< TRGCDCLink * > cores(const std::vector< TRGCDCLink * > &input)
separate cores and non-cores.
Definition: Link.cc:457

◆ sequence() [1/2]

unsigned sequence ( unsigned  a) const
inline

sets sequential length in one segment : this parameter is used in TCurlFinder now.

Definition at line 345 of file CellHit.h.

346 {
347 return _sequentialLength = a;
348 }
unsigned _sequentialLength
sequential Length in one segment
Definition: CellHit.h:193

◆ sequence() [2/2]

unsigned sequence ( void  ) const
inline

returns sequential Length in one segment : this parameter is used in TCurlFinder now.

Definition at line 338 of file CellHit.h.

339 {
340 return _sequentialLength;
341 }

◆ serialId() [1/2]

unsigned serialId ( const TRGPoint2D p) const
inline

returns serial ID for position p.

Definition at line 349 of file HoughPlaneBase.h.

350 {
351 static const unsigned invalidPoint = _nX * _nY;
352 if ((p.x() < _xMin) || (p.x() > _xMax)) return invalidPoint;
353 if ((p.y() < _yMin) || (p.y() > _yMax)) return invalidPoint;
354// unsigned x = (p.x() - _xMin) / _xSize;
355// unsigned y = (p.y() - _yMin) / _ySize;
356 unsigned x = unsigned((p.x() - _xMin) / _xSize);
357 unsigned y = unsigned((p.y() - _yMin) / _ySize);
358 return serialId(x, y);
359 }

◆ serialId() [2/2]

unsigned serialId ( unsigned  x,
unsigned  y 
) const
inline

returns serial ID for position (x, y).

Definition at line 342 of file HoughPlaneBase.h.

343 {
344 return _nY * x + y;
345 }

◆ set() [1/7]

void set ( const HepGeom::Point3D< double > &  pivot,
const CLHEP::HepVector &  a,
const CLHEP::HepSymMatrix &  Ea 
)

sets helix pivot position, parameters, and error matrix.

Definition at line 396 of file Helix.cc.

399 {
400 m_pivot = pivot;
401 m_a = a;
402 m_Ea = Ea;
403 m_matrixValid = true;
404 m_helixValid = false;
405 updateCache();
406 }
const CLHEP::HepSymMatrix & Ea(void) const
returns error matrix.
Definition: Helix.h:320
const HepGeom::Point3D< double > & pivot(void) const
returns pivot position.
Definition: Helix.h:250

◆ set() [2/7]

const TRGSignalVector & set ( const TRGState s,
int  clockPosition 
)

sets state at given clock.

Definition at line 181 of file SignalVector.cc.

182 {
183 const unsigned n = s.size();
184 for (unsigned i = 0; i < n; i++) {
185 TRGSignal& signal = (* this)[i];
186 signal.set(cp, cp + 1, s[i]);
187 }
188 return * this;
189 }

◆ set() [3/7]

const TRGSignal & set ( int  t0,
int  t1,
bool  state = true 
)

makes a pulse with leading edge at clock t0 and with trailing edge at clock t1.

Definition at line 409 of file Signal.cc.

410 {
411 if (! state)
412 return unset(t0, t1);
413
414 TRGSignal s(clock(), t0, t1);
415 (* this) |= s;
416
417#if TRG_DEBUG
418 if (consistencyCheck())
419 cout << "TRGSignal::set ... t0, t1=" << t0 << "," << t1 << endl;
420#endif
421
422 return * this;
423 }
const TRGSignal & unset(int t0, int t1)
clear(or unset) with leading edge at clock t0 and with trailing edge at clock t1.
Definition: Signal.cc:426

◆ set() [4/7]

const TRGState & set ( unsigned  position,
bool  state = true 
)
inline

sets state at bit i.

Definition at line 305 of file State.h.

306 {
307 const unsigned wp = n / _bsu;
308 const unsigned bp = n % _bsu;
309 if (a)
310 _state[wp] |= (1 << bp);
311 else
312 _state[wp] &= ~(1 << bp);
313 return * this;
314 }

◆ set() [5/7]

const TRGState & set ( unsigned  position,
const TRGState s 
)
inline

sets state.

Definition at line 318 of file State.h.

319 {
320 const unsigned n = s.size();
321 for (unsigned i = 0; i < n; i++) {
322 const unsigned wp = (p + i) / _bsu;
323 const unsigned bp = (p + i) % _bsu;
324 if (s[i])
325 _state[wp] |= (1 << bp);
326 else
327 _state[wp] &= ~(1 << bp);
328 }
329 return * this;
330 }

◆ set() [6/7]

const TRGState & set ( unsigned  position,
unsigned  size,
const bool *const  array 
)
inline

sets state.

Definition at line 269 of file State.h.

270 {
271 if (a) {
272 for (unsigned i = 0; i < n; i++) {
273 const unsigned wp = (p + i) / _bsu;
274 const unsigned bp = (p + i) % _bsu;
275 if (a[i])
276 _state[wp] |= (1 << bp);
277 else
278 _state[wp] &= ~(1 << bp);
279 }
280 }
281#ifdef TRG_DEBUG
282 else std::cout << "NULL pointer found in TRGState::set"
283 << std::endl;
284#endif
285 return * this;
286 }

◆ set() [7/7]

const TRGState & set ( unsigned  position,
unsigned  size,
unsigned  value 
)
inline

sets state.

Definition at line 290 of file State.h.

291 {
292 for (unsigned i = 0; i < n; i++) {
293 const unsigned wp = (p + i) / _bsu;
294 const unsigned bp = (p + i) % _bsu;
295 if (a & (1 << i))
296 _state[wp] |= (1 << bp);
297 else
298 _state[wp] &= ~(1 << bp);
299 }
300 return * this;
301 }

◆ set2DFitChi2()

void set2DFitChi2 ( double  in2DFitChi2)
inline

Set 2D fit chi2.

Definition at line 180 of file TRGCDCTrack.h.

181 {
182 m_2DFitChi2 = in2DFitChi2;
183 }

◆ set3DFitChi2()

void set3DFitChi2 ( double  in3DFitChi2)
inline

Set 3D fit chi2.

Definition at line 192 of file TRGCDCTrack.h.

193 {
194 m_3DFitChi2 = in3DFitChi2;
195 }

◆ set_exception()

bool set_exception ( bool  t)
static

set to throw exception or not

Definition at line 50 of file Helix.cc.

51 {
52 return ms_throw_exception = t;
53 }

◆ set_limits()

void set_limits ( const CLHEP::HepVector &  a_min,
const CLHEP::HepVector &  a_max 
)
static

set limits for helix parameters

Definition at line 61 of file Helix.cc.

62 {
63 if (a_min.num_row() != 5 || a_max.num_row() != 5) return;
64 ms_amin = a_min;
65 ms_amax = a_max;
66 ms_check_range = true;
67 }

◆ set_print()

bool set_print ( bool  t)
static

set to print debug info or not

Definition at line 55 of file Helix.cc.

56 {
57 return ms_print_debug = t;
58 }

◆ setActual()

void setActual ( double  value)

Sets float value of signal.

Definition at line 1308 of file JSignal.cc.

1309 {
1310 m_actual = value;
1311 }

◆ setBitsize() [1/2]

void setBitsize ( int  bitsize)

Sets bitwidth of signal.

Definition at line 1323 of file JSignal.cc.

1324 {
1325 m_bitsize = bitsize;
1326
1327 // Check if there is overflow or underflow.
1328 checkInt("TRGCDCJSignal::setBitsize()");
1329 }
void checkInt(const std::string &name) const
Checks underflow or overflow for TRGCDCJSignal.
Definition: JSignal.cc:2173

◆ setBitsize() [2/2]

void setBitsize ( int  inputBitsize,
int  outputBitsize 
)

set input & output bitsize.

Definition at line 347 of file JLUT.cc.

348 {
349 setInputBitsize(inputBitsize);
350 setOutputBitsize(outputBitsize);
351 }
void setOutputBitsize(int outputBitsize)
set output bitsize.
Definition: JLUT.cc:363
void setInputBitsize(int inputBitsize)
set input bitsize.
Definition: JLUT.cc:358

◆ setCommonData()

void setCommonData ( TRGCDCJSignalData commonData)

Sets JSignalData to signal.

Definition at line 1357 of file JSignal.cc.

1358 {
1359 m_commonData = commonData;
1360 }

◆ setConstants()

void setConstants ( void  )
private

Sets constants.

Definition at line 219 of file Tracker2D.cc.

220 {
221
222 //...# of TSFs...
223 const TRGCDC& cdc = * TRGCDC::getTRGCDC();
224 _nTSF = 0;
225 for (unsigned i = 0; i < 5; i++) { // Ax only
226 const unsigned n = cdc.nSegments(i * 2);
227 _n.push_back(n);
228 _nTSF += n;
229 }
230
231 //...Consistency check...
232 if (_nTSF != nTSF()) {
233 cout << "TRGCDCTracker2D !!! # of TSF is inconsistent internally"
234 << endl;
235 cout << " _nTSF,nTSF()=" << _nTSF << "," << nTSF()
236 << endl;
237 }
238 for (unsigned i = 0; i < 5; i++) {
239 if (_n[i] != nTSF(i)) {
240 cout << "TRGCDCTracker2D !!! # of TSF is inconsistent internally"
241 << endl;
242 cout << " i,_n[i],nTSF(i)=" << i << ","
243 << _n[i] << "," << nTSF(i) << endl;
244 }
245
246 }
247 if (_nTSF != _ts.size()) {
248 cout << "TRGCDCTracker2D !!! # of TSF is inconsistent internally"
249 << endl;
250 cout << " _nTSF,_ts.size()=" << _nTSF << ","
251 << _ts.size() << endl;
252 }
253 }
unsigned size(void) const
returns bit size.
Definition: State.h:149
static std::vector< unsigned > _n
# of TSFs in super layer i.
Definition: Tracker2D.h:105
static unsigned _nTSF
# of TSFs.
Definition: Tracker2D.h:102

◆ setData()

void setData ( int  inputBitsize,
int  outputBitSize,
const std::string &  filename,
bool  twoscomplement = 0 
)

set LookUpTable(LUT) data.

Definition at line 86 of file JLUT.cc.

87 {
88 ifstream coeFile;
89 coeFile.open(filename.c_str());
90 if (coeFile.fail()) {
91 cout << "TRGCDCJLUT !!! can not open file : " << filename << endl;
92 cout << " LUT is not initialized yet" << endl;
93 return;
94 } else {
95 // Set values
96 setInputBitsize(inputBitsize);
97 setOutputBitsize(outputBitsize);
98 m_fileName = filename;
100 int inputSize = pow(2, inputBitsize);
101 m_data.resize(inputSize);
102 // Read file
103 string t_line;
104 stringstream reformatCoeFile;
105 // Reformat file.
106 while (getline(coeFile, t_line)) {
107 // Remove all spaces
108 t_line.erase(remove_if(t_line.begin(), t_line.end(), ::isspace), t_line.end());
109 // Remove blank lines
110 if (t_line.size() == 0) continue;
111 // Remove all characters after ';'
112 size_t t_iFind = t_line.find(";");
113 if (t_iFind != string::npos) {
114 t_line.erase(t_iFind + 1, string::npos);
115 }
116 // Remove lines for comments
117 if (t_line == ";") continue;
118 // Combine lines until ';'
119 if (t_line.find(";") == string::npos) reformatCoeFile << t_line;
120 // Replace ';' with endl
121 else reformatCoeFile << t_line.substr(0, t_line.size() - 1) << endl;
122 }
123 // Process reformatted file.
124 // vector<string> keywords = {"memory_initialization_radix", "memory_initialization_vector"};
125 int t_radix = 0;
126 vector<string> t_rawData;
127 while (getline(reformatCoeFile, t_line)) {
128 //cout<<t_line<<endl;
129 // Find keywords
130 size_t t_iFind = t_line.find("=");
131 if (t_iFind != string::npos) {
132 // Find values for keywords
133 // Find radix
134 if (t_line.substr(0, t_iFind) == "memory_initialization_radix") {
135 t_radix = atoi(t_line.substr(t_iFind + 1, string::npos).c_str());
136 } else if (t_line.substr(0, t_iFind) == "memory_initialization_vector") {
137 // Find data values
138 string t_dataLine = t_line.substr(t_iFind + 1, string::npos);
139 while (1) {
140 t_iFind = t_dataLine.find(",");
141 if (t_iFind != string::npos) {
142 t_rawData.push_back(t_dataLine.substr(0, t_iFind));
143 t_dataLine.erase(0, t_iFind + 1);
144 } else {
145 // last entry
146 t_rawData.push_back(t_dataLine);
147 break;
148 }
149 } // Finding data values loop
150 } else {
151 cout << "[Error] TRGCDCJLUT::setData() => .coe format keyword is wrong. Aborting" << endl;
152 break;
153 } // End of finding values for keywords
154 } else {
155 cout << "[Error] TRGCDCJLUT::setData() => .coe format is wrong. Needs keywords. Aborting" << endl;
156 break;
157 } // End of finding keywords
158 }
160 //for(auto it=t_rawData.begin(); it!=t_rawData.end(); it++){
161 // cout<<(*it)<<endl;
162 //}
163 if (!twosComplement) {
164 for (int iData = 0; iData < int(t_rawData.size()); iData++) {
165 // Change string to float octal.
166 m_data[iData] = FpgaUtility::arbToDouble(t_rawData[iData], t_radix);
167 }
168 } else {
169 // Find number of bits in binary for data.
170 int nBits = t_rawData[0].size();
171 // Calculate max value.
172 int t_max = pow(t_radix, nBits) - 1;
173 // Calculate number of bits
174 nBits = floor(log(t_max) / log(2)) + 1;
175 for (int iData = 0; iData < int(t_rawData.size()); iData++) {
176 // Change to binary.
177 string t_binary = FpgaUtility::arbToArb(t_rawData[iData], t_radix, 2, nBits);
178 // Change to signed.
179 string t_signedBinary = FpgaUtility::twosComplementToSigned(t_binary);
180 // Change to float octal.
181 m_data[iData] = FpgaUtility::arbToDouble(t_signedBinary, 2);
182 }
183 } // End filling m_data.
184 // Print all values of LUT
185 cout << "LUT(" << m_name << ") data" << endl;
186 for (int iData = 0; iData < int(m_data.size()); iData++) {
187 cout << "[" << iData << "] " << m_data[iData] << endl;
188 }
189 cout << "TTRGCDCJLUT ... LUT(" << m_name << ") initilized with " << filename << endl;
190 }
191 coeFile.close();
192 }
std::vector< int > m_data
LUT data.
Definition: JLUT.h:137
static double arbToDouble(std::string in, int inRadix)
Radix changing functions.
Definition: FpgaUtility.cc:60
static std::string arbToArb(const std::string &in, int inRadix, int outRadix, int numberOfDigits=-1)
Change string number to another string number depending on radix.
Definition: FpgaUtility.cc:114
static std::string twosComplementToSigned(std::string in)
Changes string two complements to string signed binary(-sign).
Definition: FpgaUtility.cc:163
void setOutputFlag(int outputFlag)
set output flag.
Definition: JLUT.cc:353

◆ setDataFile()

void setDataFile ( const std::string &  filename,
int  nInputBit 
)

set LUT data.

Definition at line 57 of file LUT.cc.

58 {
59 m_bitsize = nInputBit;
60 m_name = filename;
61
62 ifstream openFile;
63 string tmpstr;
64 int tmpint;
65 int i = 0;
66 int range = pow(2, nInputBit);
67 openFile.open(filename.c_str());
68 m_data.resize(range);
69 while (getline(openFile, tmpstr) && i < range) {
70 if (!(tmpstr.size() == 0)) {
71 if (tmpstr[0] >= '0' && tmpstr[0] <= '9') {
72 tmpint = atoi(tmpstr.c_str());
73 m_data[i] = tmpint;
74 i++;
75 } else {
76 continue;
77 }
78 }
79 }
80 openFile.close();
81 }

◆ setDebug()

void setDebug ( bool  debug)

Sets debug flag for signal.

Definition at line 1336 of file JSignal.cc.

1337 {
1338 m_debug = debug;
1339 }

◆ setDebugValue()

void setDebugValue ( EDebugValueType const &  moduleName,
bool  flag 
)
inline

Set debug value.

Definition at line 204 of file TRGCDCTrack.h.

205 {
206 if (flag) m_debugValue |= moduleName;
207 else m_debugValue &= ~moduleName;
208 }

◆ setDriftTime()

void setDriftTime ( double  driftTime,
unsigned  i 
)
inline

Sets drift time.

Definition at line 352 of file CellHit.h.

353 {
354 if (i) _drift[1] = driftTime;
355 else _drift[0] = driftTime;
356 }

◆ setEntry() [1/3]

unsigned setEntry ( unsigned  serialId,
unsigned  layerId,
unsigned  n 
)
inline

Sets entry.

Definition at line 260 of file HoughPlaneMulti2.h.

263 {
264 _usage[layerId] = true;
265 _layers[layerId]->setEntry(serialId, n);
266 return n;
267 }

◆ setEntry() [2/3]

unsigned setEntry ( unsigned  serialId,
unsigned  n 
)
inlineoverridevirtual

Sets entry.

Implements TRGCDCHoughPlaneBase.

Reimplemented in TRGCDCHoughPlaneMulti2.

Definition at line 108 of file HoughPlane.h.

109 {
110 return _cell[serialId] = n;
111 }

◆ setEntry() [3/3]

unsigned setEntry ( unsigned  serialId,
unsigned  n 
)
inlineoverridevirtual

Sets entry.

Implements TRGCDCHoughPlaneBase.

Definition at line 137 of file HoughPlaneBoolean.h.

138 {
139 const unsigned b0 = serialId / 32;
140 const unsigned b1 = serialId % 32;
141
142#ifdef TRASAN_DEBUG
143 if (b0 >= _n)
144 std::cout << "TRGCDCHoughPlaneBoolean !!! given serialId is too large : "
145 << "max=" << _n * 32 << ",serialId=" << serialId << std::endl;
146#endif
147
148 if (n > 0)
149 _cell[b0] |= (1 << b1);
150 else
151 _cell[b0] &= (~(1 << b1));
152
153 return (_cell[b0] >> b1) & 1;
154 }

◆ setFinishClock()

void setFinishClock ( int  finishClock)

Sets finish clock of signal.

Definition at line 1331 of file JSignal.cc.

1332 {
1333 m_finishClock = finishClock;
1334 }

◆ setFitted()

void setFitted ( bool  fitted)
inline

set fit status

Definition at line 234 of file TrackBase.h.

235 {
236 _fitted = fitted;
237 }
bool fitted(void) const
returns true if fitted.
Definition: TrackBase.h:227

◆ setFloatFunction()

int setFloatFunction ( std::function< double(double)>  function,
TRGCDCJSignal const &  input,
TRGCDCJSignal const &  minInv,
TRGCDCJSignal const &  maxInv,
double  outputToReal,
int  lutInputBitwidth,
int  lutOutputBitwidth 
)

set LUT function using JSignals.

Definition at line 200 of file JLUT.cc.

205 {
206
207 signed long long t_int;
208 double t_toReal;
209 double t_actual;
210 TRGCDCJSignalData* t_commonData;
211
212 // Save values.
213 m_inputBitsize = lutInputBitwidth;
214 m_outputBitsize = lutOutputBitwidth;
215 m_floatFunction = function;
216 // Create input min and max.
217 t_int = input.getMinInt();
218 t_toReal = input.getToReal();;
219 t_actual = input.getMinActual();
220 t_commonData = input.getCommonData();
221 m_inputMin = Belle2::TRGCDCJSignal(t_int, t_toReal, t_int, t_int, t_actual, t_actual, t_actual, -1, t_commonData);
222 t_int = input.getMaxInt();
223 t_actual = input.getMaxActual();
224 m_inputMax = Belle2::TRGCDCJSignal(t_int, t_toReal, t_int, t_int, t_actual, t_actual, t_actual, -1, t_commonData);
225
226 //cout<<"<<<m_inputMin>>>"<<endl; m_inputMin.dump();
227 //cout<<"<<<m_inputMax>>>"<<endl; m_inputMin.dump();
228
229 // Calculates number of bits to shift for input.
230 //int t_offsetNBits = m_inputMax.offset(m_inputMin, m_inputMax).getBitsize();
231 int t_offsetNBits = m_inputMax.offset(m_inputMin).getBitsize();
232 m_inputShiftBits = t_offsetNBits - lutInputBitwidth;
233 if (m_inputShiftBits < 0) {
235 //cout<<"[Warning] TRGCDCJLUT::setFloatFunction() => Changing m_inputBitsize from "<<lutInputBitwidth<<" to optimal bitwidth "<<t_offsetNBits<<". "<<endl;
236 m_inputBitsize = t_offsetNBits;
237 }
238
239 // Calculates number of bits to shift for lut output bitwidth to be lutOutputBitwidth.
240 //cout<<"<<<minInv>>>"<<endl; minInv.dump();
241 //cout<<"<<<maxInv>>>"<<endl; maxInv.dump();
242 double t_outputRealMinInt = function(minInv.getRealInt());
243 double t_outputRealMaxInt = function(maxInv.getRealInt());
244 if (std::isnan(t_outputRealMinInt)) {
245 cout << "[Error] TRGCDCJLUT::setFloatFunction() => t_outputRealMinInt is nan. Please change minInv signal so that function(minInv.getRealInt()) does not give nan."
246 << endl;
247 }
248 if (std::isnan(t_outputRealMaxInt)) {
249 cout << "[Error] TRGCDCJLUT::setFloatFunction() => t_outputRealMaxInt is nan. Please change maxInv so that function(maxInv.getRealInt()) does not give nan"
250 << endl;
251 }
252 if (t_outputRealMaxInt < t_outputRealMinInt) {
253 cout << "[Error] TRGCDCJLUT::setFloatFunction() => t_outputRealMaxInt is smaller than t_outputRealMinInt." << endl;
254 return 0;
255 }
256 double t_outputMinActual = function(minInv.getActual());
257 double t_outputMaxActual = function(maxInv.getActual());
258 double t_outputToReal;
259 t_outputToReal = outputToReal;
260 double tt_factor = log((max(t_outputRealMaxInt, abs(t_outputRealMinInt)) - t_outputRealMinInt) / ((pow(2,
261 lutOutputBitwidth) - 0.5) * t_outputToReal)) / log(2);
262 tt_factor = ceil(tt_factor);
263 // Create outputMin.
264 //cout<<"t_outputRealMinInt:"<<t_outputRealMinInt<<" t_outputToReal:"<<t_outputToReal<<" tt_factor:"<<tt_factor<<endl;
265 //cout<<"rountInt:"<<t_outputRealMinInt / t_outputToReal / pow(2, tt_factor)<<endl;
266 t_int = FpgaUtility::roundInt(t_outputRealMinInt / t_outputToReal / pow(2, tt_factor));
267 t_toReal = t_outputToReal * pow(2, tt_factor);
268 t_actual = t_outputMinActual;
269 //cout<<"t_int:"<<t_int<<" t_toReal:"<<t_toReal<<" t_actual:"<<t_actual<<endl;
270 Belle2::TRGCDCJSignal t_shiftOutputMin = Belle2::TRGCDCJSignal(t_int, t_toReal, t_int, t_int, t_actual, t_actual, t_actual, -1,
271 t_commonData);
272 //cout<<"<<<t_shiftOutputMin>>>"<<endl; t_shiftOutputMin.dump();
273 //cout<<"minInvRealInt: "<<minInv.getRealInt()<<" RealMinInt: "<<t_outputRealMinInt<<" int: "<<t_int<<endl;
274 //cout<<"minInvActual: "<<minInv.getActual()<<" minActual: "<<t_outputMinActual<<endl;
275 // Create outputMax.
276 t_int = FpgaUtility::roundInt(t_outputRealMaxInt / t_shiftOutputMin.getToReal()) - t_shiftOutputMin.getInt();
277 t_toReal = t_shiftOutputMin.getToReal();
278 t_actual = t_outputMaxActual - t_shiftOutputMin.getActual();
279 Belle2::TRGCDCJSignal t_shiftOffsetOutputMax = Belle2::TRGCDCJSignal(t_int, t_toReal, t_int, t_int, t_actual, t_actual, t_actual,
280 -1, t_commonData);
281 //cout<<"maxInv: "<<maxInv.getRealInt()<<" RealMaxInt: "<<t_outputRealMaxInt<<" int: "<<FpgaUtility::roundInt(t_outputRealMaxInt/t_shiftOutputMin.getToReal())<<endl;
282 //cout<<"maxInvActual: "<<maxInv.getActual()<<" maxActual: "<<t_outputMaxActual<<endl;
283 //cout<<"<<<t_shiftOffsetOutputMax>>>"<<endl; t_shiftOffsetOutputMax.dump();
284
286 m_shiftOutputMin = t_shiftOutputMin;
287 m_shiftOffsetOutputMax = t_shiftOffsetOutputMax;
288
289 // Save value for operator function.
290 //cout<<"actual_range: "<<max(outputActualMax, abs(outputActualMin)) - outputActualMin<<endl;
291 //cout<<"int_range: "<<(pow(2,requiredNBits)-0.5)<<endl;
292 //cout<<"intReal_range: "<<(pow(2,requiredNBits)-0.5)*outputToReal<<endl;
293 //cout<<"outputToReal: "<<outputToReal<<endl;
294 //cout<<"actual/int: "<<(max(outputActualMax, abs(outputActualMin)) - outputActualMin)/((pow(2,requiredNBits)-0.5)*outputToReal)<<endl;
295 //cout<<"t_factor_raw: "<<log((max(outputActualMax, abs(outputActualMin)) - outputActualMin)/((pow(2,requiredNBits)-0.5)*outputToReal))/log(2)<<endl;
296 //cout<<"t_factor: "<<t_factor<<endl;
297 //cout<<"m_outputOffset: "<<m_outputOffset<<endl;
298 //cout<<"m_outputType: "<<m_outputType<<endl;
299 //cout<<"m_outputNBits: "<<m_outputNBitsWithOffset<<endl;
300 //cout<<"m_toReal: "<<m_toReal<<endl;
301 // Set integer function.
302 m_function = [&](int anInt) ->
303 int{
304 // Limit input
305 if (anInt < 0)
306 {
307 if (m_write != 1) cout << "[Warning] TRGCDCJLUT::m_function => input is smaller then 0. Changed to 0." << endl;
308 anInt = 0;
309 }
310 double t_input = (anInt + m_inputMin.shift(m_inputShiftBits, 0).getInt()) * m_inputMin.shift(m_inputShiftBits, 0).getToReal();
311 double t_realResult = m_floatFunction(t_input);
312 double result = FpgaUtility::roundInt(t_realResult / m_shiftOutputMin.getToReal() - m_shiftOutputMin.getInt());
313 // Limit output according to requiredNBits
314 if (result < 0)
315 {
316 result = 0;
317 }
318 if (result > m_shiftOffsetOutputMax.getInt())
319 {
321 }
322 // Warnings. Use ideal result for checking output.
323 double t_inputActual = anInt * m_inputMin.shift(m_inputShiftBits, 0).getToReal() + m_inputMin.getActual();
324 double t_outputActual = m_floatFunction(t_inputActual);
325 if (t_outputActual < m_shiftOutputMin.getActual())
326 {
327 if (m_write != 1) {
328 cout << "[Warning] TRGCDCJLUT::m_function => output is smaller then 0. Changed to 0." << endl;
329 cout << "Could happen if invY_min and invY_max are inside x range." << endl;
330 }
331 }
333 {
334 if (m_write != 1) {
335 cout << "[Warning] TRGCDCJLUT::m_function => output is larger then allowed max value. Changed to " <<
336 m_shiftOffsetOutputMax.getInt() << "." << endl;
337 cout << "Could happen if invY_min and invY_max are inside x range." << endl;
338 }
339 }
340 return result;
341 };
342
343 return 1;
344 }
TRGCDCJSignal m_inputMax
The maximum input signal.
Definition: JLUT.h:188

◆ setFunction()

void setFunction ( std::function< int(int)>  function)

set LUT function directly using int values.

Definition at line 194 of file JLUT.cc.

195 {
196 m_function = function;
197 }

◆ setHelix()

void setHelix ( const TRGCDCHelix helix)
inline

Set helix parameter.

Definition at line 150 of file TRGCDCTrack.h.

151 {
152 _helix = helix;
153 }

◆ setInputBitsize()

void setInputBitsize ( int  inputBitsize)

set input bitsize.

Definition at line 358 of file JLUT.cc.

359 {
360 m_inputBitsize = inputBitsize;
361 }

◆ setInt()

void setInt ( signed long long  value)

Sets integer value of signal.

Definition at line 1303 of file JSignal.cc.

1304 {
1305 m_int = value;
1306 }

◆ setName()

void setName ( const std::string &  name)

Setters, Getters Sets name of signal.

Definition at line 1298 of file JSignal.cc.

1299 {
1300 m_name = name;
1301 }

◆ setOutputBitsize()

void setOutputBitsize ( int  outputBitsize)

set output bitsize.

Definition at line 363 of file JLUT.cc.

364 {
365 m_outputBitsize = outputBitsize;
366 }

◆ setOutputFlag()

void setOutputFlag ( int  outputFlag)

set output flag.

Definition at line 353 of file JLUT.cc.

354 {
355 m_outputFlag = outputFlag;
356 }

◆ setPrintedToFile()

void setPrintedToFile ( bool  printedToFile)

Set to remember that file was printed.

Definition at line 55 of file JSignalData.cc.

56 {
57 m_printedToFile = printedToFile;
58 }

◆ setPrintVhdl() [1/2]

void setPrintVhdl ( bool  printVhdl)

Sets print flag for signal.

Definition at line 1341 of file JSignal.cc.

1342 {
1344 else {
1345 cout << "[Error] TRGCDCJSignal::setPrintVhdl() => m_commonData does not exist." << endl;
1346 }
1347 }
void printVhdl(const std::string &vhdlCode) const
Prints vhdl code.
Definition: JSignal.cc:2159

◆ setPrintVhdl() [2/2]

void setPrintVhdl ( bool  printVhdl)

Sets if to print VHDL output.

Definition at line 50 of file JSignalData.cc.

51 {
52 m_printVhdl = printVhdl;
53 }

◆ setRegion()

void setRegion ( std::vector< unsigned > *  a)
inline

Sets region.

Definition at line 408 of file HoughPlaneBase.h.

409 {
410// _regions.append(a);
411 _regions.push_back(a);
412 }

◆ setReturnValue() [1/2]

void setReturnValue ( EReturnValueType const &  moduleName,
bool  flag 
)

sets return value for trg cdc module.

Definition at line 2748 of file TRGCDC.cc.

2749 {
2750 if (flag) _returnValue |= moduleName;
2751 else _returnValue &= ~moduleName;
2752 }

◆ setReturnValue() [2/2]

void setReturnValue ( int  returnValue)
inline

sets return value for trg cdc module.

Definition at line 1105 of file TRGCDC.h.

1106 {
1107 _returnValue = returnValue;
1108 }

◆ setToReal()

void setToReal ( double  value)

Sets toReal factor of signal.

Definition at line 1313 of file JSignal.cc.

1314 {
1315 m_toReal = value;
1316 }

◆ setTrackID()

void setTrackID ( int  trackID)
inline

set track ID.

Definition at line 277 of file TrackBase.h.

278 {
279 m_trackID = trackID;
280 }

◆ setType()

void setType ( int  type)

Sets type of signal.

Definition at line 1318 of file JSignal.cc.

1319 {
1320 m_type = type;
1321 }

◆ setVhdlInProcess()

void setVhdlInProcess ( const std::string &  vhdlInProcess)

Set the VHDL code that are in a process statement.

Definition at line 60 of file JSignalData.cc.

61 {
62 m_vhdlInProcess = vhdlInProcess;
63 }

◆ setVhdlOutProcess()

void setVhdlOutProcess ( const std::string &  vhdlOutProcess)

Set the VHDL code that is outside a process statement.

Definition at line 65 of file JSignalData.cc.

66 {
67 m_vhdlOutProcess = vhdlOutProcess;
68 }

◆ setVhdlOutputFile() [1/2]

void setVhdlOutputFile ( const std::string &  vhdlOutputFile)

Sets the filename for VHDL output.

Definition at line 45 of file JSignalData.cc.

46 {
47 m_vhdlOutputFile = vhdlOutputFile;
48 }

◆ setVhdlOutputFile() [2/2]

void setVhdlOutputFile ( const std::string &  filename)

Sets ouptut VHDL filename.

Definition at line 1349 of file JSignal.cc.

1350 {
1352 else {
1353 cout << "[Error] TRGCDCJSignal::setVhdlOutputFile() => m_commonData does not exist." << endl;
1354 }
1355 }

◆ shift() [1/3]

TRGCDCJSignal const shift ( int  nBits,
int  operate = 1 
) const

Shift signal. Shift direction is right. operate=0 to change m_toReal(unit).

Definition at line 561 of file JSignal.cc.

562 {
563 TRGCDCJSignal t_signal(*this);
564
565 if (t_signal.m_argumentSignals.size() == 0) t_signal.initArgumentSignals();
566
567 t_signal.m_bitsize -= nBits;
568 t_signal.m_int = floor(this->m_int / pow(2, nBits));
569 t_signal.m_minInt = floor(this->m_minInt / pow(2, nBits));
570 t_signal.m_maxInt = floor(this->m_maxInt / pow(2, nBits));
571 if (operate == 0) {
572 t_signal.m_toReal = this->m_toReal * pow(2, nBits);
573 } else {
574 t_signal.m_actual = this->m_actual / pow(2, nBits);
575 t_signal.m_minActual = this->m_minActual / pow(2, nBits);
576 t_signal.m_maxActual = this->m_maxActual / pow(2, nBits);
577 }
578
579 t_signal.checkInt("TRGCDCJSignal::shift()");
580
581 if (getPrintVhdl() == 1) {
582 if (nBits < 0) {
583 vhdlCode("shift_left", *this, t_signal, t_signal.m_vhdlCode);
584 } else if (nBits != 0) {
585 vhdlCode("shift_right", *this, t_signal, t_signal.m_vhdlCode);
586 }
587 }
588
589 return t_signal;
590 }

◆ shift() [2/3]

TRGTime & shift ( int  unit)
inline

delays by clock unit.

Definition at line 163 of file Time.h.

164 {
165 _time += u;
166 return * this;
167 }

◆ shift() [3/3]

TRGState & shift ( unsigned  i)
inline

shifts bits.

Definition at line 353 of file State.h.

354 {
355
356 if (! active()) return * this;
357
358 if (a == 0) return * this;
359
360 for (int i = _size - 1; i >= 0; --i) {
361 if (i < int(a))
362 set(i, false);
363 else
364 set(i, active(i - a));
365 }
366
367 return * this;
368 }

◆ signal() [1/5]

TRGSignalBundle * signal ( TRGSignalBundle a)
inline

sets input data.

Definition at line 85 of file Channel.h.

86 {
87 _data = a;
88 return _data;
89 }
TRGSignalBundle * _data
Input data.
Definition: Channel.h:71

◆ signal() [2/5]

const TRGSignal & signal ( void  ) const
inline

returns trigger output. Null will returned if no signal.

Definition at line 81 of file SegmentHit.h.

82 {
83 return cell().signal();
84 }

◆ signal() [3/5]

TRGSignalBundle * signal ( void  ) const
inline

returns signal.

Definition at line 93 of file Channel.h.

94 {
95 return _data;
96 }

◆ signal() [4/5]

const TRGSignal & signal ( void  ) const
inlineoverridevirtual

returns trigger output. Null will returned if no signal.

Implements TRGCDCCell.

Definition at line 214 of file Segment.h.

215 {
216 return _signal;
217 }

◆ signal() [5/5]

const TRGSignal & signal ( void  ) const
inlineoverridevirtual

returns an input to the trigger. This is sync'ed to 1GHz clock.

Implements TRGCDCCell.

Definition at line 242 of file Wire.h.

243 {
244 return _signal;
245 }

◆ signal_adc() [1/2]

const TRGSignal & signal_adc ( void  ) const
inlineoverridevirtual

returns trigger output. Null will returned if no signal.

Implements TRGCDCCell.

Definition at line 221 of file Segment.h.

222 {
223 return _signal_adc;
224 }
TRGSignal _signal_adc
Trigger signal.
Definition: Segment.h:179

◆ signal_adc() [2/2]

const TRGSignal & signal_adc ( void  ) const
inlineoverridevirtual

returns an input to the trigger. This is sync'ed to 1GHz clock.

Implements TRGCDCCell.

Definition at line 249 of file Wire.h.

250 {
251 return _signal_adc;
252 }

◆ signalsVhdlCode()

void signalsVhdlCode ( )

Function to print definition of signal VHDL code.

Definition at line 178 of file JSignalData.cc.

179 {
180 for (map<string, vector<int> >::const_iterator it = m_signals.begin(); it != m_signals.end(); ++it) {
181 string const& name = it->first;
182 int const& type = it->second[0];
183 int const& bitwidth = it->second[1];
184 string typeName;
185 if (type == 1) typeName = "unsigned";
186 else if (type == -1) typeName = "signed";
187 else if (type == 2) typeName = "std_logic_vector";
188 else {
189 cout << "[Error] TRGCDCJSignalData::signalsVhdlCode() => signal type is unknown." << endl;
190 }
191 m_vhdlDefine += "signal " + name + " : " + typeName + "(" + to_string(bitwidth - 1) + " downto 0) := (others=>'0');\n";
192 }
193 }

◆ simHit()

const CDCSimHit * simHit ( void  ) const

Access to CDCSimHit.

Definition at line 140 of file CellHit.cc.

141 {
142 StoreArray<CDCSimHit> CDCHits("CDCSimHits");
143 return CDCHits[_iCDCSimHit];
144 }

◆ similarity()

double similarity ( double  x,
double  y 
) const

const member function similarity

Definition at line 575 of file Lpav.cc.

576 {
577 if (m_nc <= 3) return -1;
578 CLHEP::HepVector v(4);
579 v(1) = x;
580 v(2) = y;
581 v(3) = 1;
582 v(4) = x * x + y * y;
583 double l;
584#ifdef HAVE_EXCEPTION
585 try {
586#endif
587 l = cov().similarity(v);
588#ifdef HAVE_EXCEPTION
589 } catch (TRGCDCLpav::Singular) {
590 return -1;
591 }
592#endif
593 return l;
594 }

◆ simulate() [1/9]

void simulate ( bool  clockSimulation,
bool  logicLUTFlag,
const std::string &  cdcCollectionName = std::string(""),
const std::string &  tsCollectionName = std::string("") 
)

simulates TF hit using wire information.

Definition at line 154 of file Segment.cc.

156 {
157 //...Get wire informtion for speed-up...
158 unsigned nHits = 0;
159 for (unsigned i = 0, n = _wires.size(); i < n; i++) {
160 if (_wires[i]->signal().active())
161 ++nHits;
162 }
163
164 //..No wire hit case...
165 if (nHits == 0)
166 return;
167
168 if (clockSimulation) {
169 simulateWithClock(cdcCollectionName, tsCollectionName);
170 } else {
171 simulateWithoutClock(logicLUTFlag);
172 }
173 }
void simulateWithoutClock(bool logicLUTFlag)
simulates time-indegrated TF hit
Definition: Segment.cc:176
void simulateWithClock(std::string cdcCollectionName, std::string tsCollectionName)
simulates TF hit time-dependently
Definition: Segment.cc:291

◆ simulate() [2/9]

void simulate ( void  )

Firmware simulation. yi.

Definition at line 64 of file EventTimeFinder.cc.

65 {
66
67 const string sn = "ETF::simulate : " + name();
69
70 //...Delete old objects...
71 for (unsigned i = 0; i < nOutput(); i++) {
72 if (output(i))
73 if (output(i)->signal())
74 delete output(i)->signal();
75 }
77 }
unsigned nOutput(void) const
returns output channels.
Definition: Board.h:180

◆ simulate() [3/9]

void simulate ( void  )

simulates firmware.

Definition at line 152 of file FrontEnd.cc.

153 {
154
155
156 //...Clear input signal bundle...
157 if (_isb) {
158 for (unsigned i = 0; i < _isb->size(); i++)
159 delete (* _isb)[i];
160 delete _isb;
161 }
162 if (_osb) {
163 for (unsigned i = 0; i < _osb->size(); i++)
164 delete (* _osb)[i];
165 delete _osb;
166 }
167
168 //...Clock...
169 const TRGClock& dClock = clockData();
170
171 //...Input from wires...
172 const unsigned nWires = size();
173 TRGSignalVector input(name() + "inputSignals", dClock);
174 for (unsigned i = 0; i < nWires; i++) {
175
176 //...This may be too expensive. There must be a class to hold pointers.
177 input += (* this)[i]->signal();
178 }
179
180 //...Make input signal bundle...
181 const string ni = name() + "InputSignalBundle";
182 _isb = new TRGSignalBundle(ni, dClock);
183
184 //...Create hit pattern bits...
185 TRGSignalVector* pattern = new TRGSignalVector(input);
186 pattern->clock(dClock);
187 pattern->name(name() + "@dataClock");
188 _isb->push_back(pattern);
189
190 // if (TRGDebug::level() > 1) {
191 // if (input.active()) {
192 // input.dump("", TRGDebug::tab());
193 // pattern->dump("", TRGDebug::tab());
194 // }
195 // }
196
197 // output wire hit info into a .log file
198 // ofstream wireinfo((name()+"_wireinfo.log").c_str());
199
200
201 //...Create Wire timing bits...
202 for (unsigned i = 0; i < nWires; i++) {
203
204 const TRGSignal& s = input[i];
205 const string n = s.name() + ":5bits";
206 TRGSignalVector* bit5 = new TRGSignalVector(n, dClock);
207
208 //...No hit case : only dummy data...
209 if (!(* pattern)[i].active()) {
210 TRGSignal sig0(n + "-0", dClock);
211 TRGSignal sig1(n + "-1", dClock);
212 TRGSignal sig2(n + "-2", dClock);
213 TRGSignal sig3(n + "-3", dClock);
214 TRGSignal sig4(n + "-4", dClock);
215 bit5->push_back(sig0);
216 bit5->push_back(sig1);
217 bit5->push_back(sig2);
218 bit5->push_back(sig3);
219 bit5->push_back(sig4);
220 }
221
222 //...Hit case...
223 else {
224
225 // wire hit info -> .log
226 /*
227 if (type() == innerInside) { wireinfo << endl << " #" << (i > 15 ? i - 16 : 99999 ) << " wire is hit" << endl; }
228 else { wireinfo << endl << " #" << i << " wire is hit" << endl; }
229 output << endl;
230 */
231
232 // s is wire signal which is hit.
233 const std::vector<int> timing = s.stateChanges();
234 const unsigned nStates = timing.size();
235 // Loop over all the changing timing.
236 for (unsigned j = 0; j < nStates; j++) {
237 const int pos = timing[j];
238
239 //...Look at leading edges only...
240 if (s.state(pos)) {
241 const double at = s.clock().absoluteTime(pos);
242 const int pos1 = dClock.position(at);
243 const double phase = dClock.phase(at);
244 const unsigned bits = unsigned(phase / (360. / 32.));
245
246 // cout << "at,phase,bits,pos1=" << at << "," << phase << ","
247 // << bits <<","<<pos1<< endl;
248
249 // Change priority timing from unsigned into SignalVector.
250 if (bit5->active()) {
251 for (unsigned k = 0; k < 5; k++) {
252 if ((bits >> k) & 1)
253 (*bit5)[k].set(pos1, pos1 + 1);
254 }
255 } else {
256 for (unsigned k = 0; k < 5; k++) {
257 const string n1 = n + "-" + TRGUtilities::itostring(k);
258 TRGSignal sig(n1, dClock);
259 if ((bits >> k) & 1)
260 sig.set(pos1, pos1 + 1);
261 (* bit5) += sig;
262 }
263 }
264
265
266 //wire info -> .log
267 /*
268 //timing = 00000 case:
269 if ( !(bit5->stateChanges()).size() ) {
270 output << "# of clk: " << pos1 << " (" << pos1*32 << " ns), signal vector: 0 0 0 0 0" << endl;
271 }
272
273 const std::vector<int> bit5_changetime = bit5->stateChanges();
274 std::vector<vector<int>> bit5_boolvector(bit5_changetime.size());
275 for (unsigned ch_t = 0; ch_t < bit5_changetime.size(); ch_t++) {
276
277 for (unsigned b = 0; b < bit5->size(); b++){
278 bit5_boolvector[ch_t].push_back( (bit5->state( bit5_changetime[ch_t])[b]) ? 1 : 0 );
279 }
280
281 wireinfo << "# of clk: " << bit5_changetime[ch_t] << " (" << dClock.absoluteTime(bit5_changetime[ch_t]) << " ns), signal vector: " ;
282
283 for (unsigned b = 0; b < bit5->size(); b++){
284 wireinfo << bit5_boolvector[ch_t][ bit5->size() - b - 1] << " " ;
285 }
286
287 wireinfo << endl;
288 }
289 */
290
291
292#ifdef TRG_DEBUG
293// bit5->dump("detail", TRGDebug::tab());
294#endif
295 }
296 }
297 }
298
299 _isb->push_back(bit5);
300 }
301
302 //...Data clock...
303 // Data clock position data is omitted. Is this problem?
304
305 //...Make output signal bundle...
306 const string no = name() + "OutputSignalBundle";
307 if (type() == innerInside)
308 _osb = new TRGSignalBundle(no,
309 dClock,
310 * _isb,
311 256,
312 TCFrontEnd::packerInnerInside);
313 else if (type() == innerOutside)
314 _osb = new TRGSignalBundle(no,
315 dClock,
316 * _isb,
317 256,
318 TCFrontEnd::packerInnerOutside);
319 else if (type() == outerInside)
320 _osb = new TRGSignalBundle(no,
321 dClock,
322 * _isb,
323 256,
324 TCFrontEnd::packerOuterInside);
325 else if (type() == outerOutside)
326 _osb = new TRGSignalBundle(no,
327 dClock,
328 * _isb,
329 256,
330 TCFrontEnd::packerOuterOutside);
331
332 if (TRGDebug::level() > 1) {
333 cout << TRGDebug::tab() << name() << " input bundle" << endl;
334 _isb->dump("", TRGDebug::tab() + " ");
335 cout << TRGDebug::tab() << name() << " output bundle" << endl;
336 _osb->dump("", TRGDebug::tab() + " ");
337 }
338 }
TRGSignalBundle * _isb
Input signal bundle.
Definition: FrontEnd.h:148

◆ simulate() [4/9]

void simulate ( void  )

simulates firmware.

Definition at line 155 of file Merger.cc.

156 {
157
158 TRGDebug::enterStage("Merger simulattion");
159
160 //...Clear input signal bundle...
161 if (_misb) {
162 for (unsigned i = 0; i < _misb->size(); i++)
163 delete (* _misb)[i];
164 delete _misb;
165 }
166 if (_mosb) {
167 for (unsigned i = 0; i < _mosb->size(); i++)
168 delete (* _mosb)[i];
169 delete _mosb;
170 }
171
172 //...Clock...
173 const TRGClock& dClock = clockData();
174
175 // ... Make input signal bundle .... ???
176 TRGSignalVector input(name() + "inputFrontEnds", dClock);
177 const string ni = name() + "InputSignalBundle";
178 _misb = new TRGSignalBundle(ni, dClock);
179
180
181 // Input from FrontEnds
182 // const unsigned nFrontEnds = size();
183
184 // TRGSignalBundle* testin = ((*this)[0])->_osb;
185 // TRGSignalBundle testin2 = new TRGSignalBundle( ((*this)[0])->output() );
186 //TRGSignalBundle * testin = new TRGSignalBundle * ((*this)[0]->output());
187 //TRGSignalVector * input1 = new TRGSignalVector ( *(((*this)[0]->_osb)[0])[0] ),
188 // * input2 = new TRGSignalVector ( *(((*this)[1]->_osb)[0])[0] );
189
190
191 // _osb in FrontEnd.h is private, use getOSB() to get input bundle.
192 TRGSignalVector* input1 = new TRGSignalVector(*((*(*this)[0]->getOSB())[0]));
193 TRGSignalVector* input2 = new TRGSignalVector(*((*(*this)[1]->getOSB())[0]));
194
195
196 for (unsigned s = 0; s < input1->size(); s++) {
197 TRGSignal ws = (*input1)[s];
198 input += ws;
199 }
200 for (unsigned s = 0; s < input2->size(); s++) {
201 TRGSignal ws = (*input2)[s];
202 input += ws;
203 }
204
205 //...Create FrontEnd output data
206 TRGSignalVector* fedata = new TRGSignalVector(input);
207 fedata->clock(dClock);
208 fedata->name(name() + "@dataClock");
209 _misb->push_back(fedata);
210
211// cout<<"Merger input start"<<endl;
212// _misb->dump("detail", TRGDebug::tab());
213// cout<<"Merger input end"<<endl;
214
215 //...Data clock...
216 // Data clock position data is omitted. Is this problem?
217
218 //...Make output signal bundle...
219 const string no = name() + "OutSigBundle";
220 if (type() == innerType) {
221 _mosb = new TRGSignalBundle(no,
222 dClock,
223 * _misb,
224 256,
225 TCMerger::packerInner);
226 } else if (type() == outerType) {
227 _mosb = new TRGSignalBundle(no,
228 dClock,
229 * _misb,
230 256,
231 TCMerger::packerOuter);
232 }
233 mosb = _mosb;
234
235 if (TRGCDC::getTRGCDC()->firmwareSimulationMode() & 0x2)
236 mosb->dumpCOE("",
237 TRGCDC::getTRGCDC()->firmwareSimulationStartDataClock(),
238 TRGCDC::getTRGCDC()->firmwareSimulationStopDataClock());
239
240 //...Output to a channel...
241 output(0)->signal(_mosb);
242
243 // Terminate
244 delete input1;
245 delete input2;
246
247 if (TRGDebug::level() > 1) {
248 _misb->dump("", TRGDebug::tab());
249 _mosb->dump("", TRGDebug::tab());
250 }
251
252 TRGDebug::leaveStage("Merger simulattion");
253 }
TRGSignalBundle * _misb
Input single bundle.
Definition: Merger.h:133
TRGSignalBundle * mosb
Output signal bundle. not the best way to do this though.
Definition: Merger.h:80
void dumpCOE(const std::string &fileName="", int start=0, int stop=0) const
makes coe output.

◆ simulate() [5/9]

void simulate ( void  )

simulates firmware.

Definition at line 70 of file Tracker2D.cc.

71 {
72
73 const string sn = "TRGCDC 2D simulate : " + name();
75
76 static bool first = true;
77 if (first) {
79 first = false;
80 }
81
82 //...Delete old objects...
83 if (nOutput())
84 for (unsigned i = 0; i < nOutput(); i++)
85 if (output(i)->signal())
86 delete output(i)->signal();
87
88 //...Create a combined input signal bundle from 5 TSF boards...
89 TRGSignalBundle isb = TRGSignalBundle(name() +
90 "-InputSignalBundle",
91 clockData());
92 for (unsigned i = 0; i < 5; i++) {
93 TRGSignalBundle* b = input(i)->signal();
94 if (! b)
95 continue;
96 for (unsigned j = 0; j < b->size(); j++) {
97 isb.push_back((* b)[j]);
98 }
99 }
100
101 if (TRGDebug::level())
102 isb.dump("", TRGDebug::tab());
103
104 //...Output signal bundle...
105 const string no = name() + "OutputSignalBundle";
106 TRGSignalBundle* osb = new TRGSignalBundle(no,
107 clockData(),
108 isb,
109 256,
110 _nTSF / 2 * 16,
111 TCTracker2D::packer);
112 output(0)->signal(osb);
113
115 }
void setConstants(void)
Sets constants.
Definition: Tracker2D.cc:219

◆ simulate() [6/9]

void simulate ( void  )

Firmware simulation. yi.

Definition at line 1954 of file TrackSegmentFinder.cc.

1955 {
1956
1957 //...Delete old objects...
1958 for (unsigned i = 0; i < nOutput(); i++) {
1959 if (output(i))
1960 if (output(i)->signal())
1961 delete output(i)->signal();
1962 }
1963 for (unsigned i = 0; i < _tsfIn.size(); i++)
1964 delete _tsfIn[i];
1965 _tsfIn.clear();
1966 for (unsigned i = 0; i < _tsfOut.size(); i++)
1967 delete _tsfOut[i];
1968 _tsfOut.clear();
1969 for (unsigned i = 0; i < _toBeDeleted.size(); i++)
1970 delete _toBeDeleted[i];
1971 _toBeDeleted.clear();
1972
1973 //...Clear old pointers...
1974 for (unsigned i = 0; i < 5; i++)
1975 _hitMap[i].clear();
1976 _priMap.clear();
1977 _fasMap.clear();
1978 _secMap.clear();
1979 _edg0Map.clear();
1980 _edg1Map.clear();
1981 _edg2Map.clear();
1982 _edg3Map.clear();
1983 _edg4Map.clear();
1984
1985 if (_type == innerType)
1986 simulateInner();
1987 else
1988 simulateOuter();
1989 }
std::vector< TRGSignalVector * > _toBeDeleted
One time info. to be deleted in next event;.
std::vector< TRGSignalVector * > _tsfOut
TSF response storeage.
std::vector< TRGSignalVector * > _tsfIn
TSF input storage.
void simulateOuter(void)
Firmware simulation for the outers. yi.
void simulateInner(void)
Firmware simulation for the outers. yi.

◆ simulate() [7/9]

void simulate ( void  )
private

fast trigger simulation.

Definition at line 2049 of file TRGCDC.cc.

2050 {
2051 TRGDebug::enterStage("TRGCDC simulate");
2052
2053 const bool fast = (_simulationMode & 1);
2054 const bool firm = (_simulationMode & 2);
2055 if (fast)
2057 if (firm)
2059
2060 TRGDebug::leaveStage("TRGCDC simulate");
2061 }
void fastSimulation(void)
Fast simulation.
Definition: TRGCDC.cc:2064
void firmwareSimulation(void)
Firmware simulation.
Definition: TRGCDC.cc:2363

◆ simulate() [8/9]

void simulate ( void  )
private

fast trigger simulation.

Definition at line 227 of file TRGGDL.cc.

228 {
229 const bool fast = (_simulationMode == 1);
230 const bool firm = (_simulationMode == 2);
231 const bool data = (_simulationMode == 3);
232 if (fast)
234 if (firm)
236 if (data)
238 }
void dataSimulation(void)
Data simulation.
Definition: TRGGDL.cc:360

◆ simulate() [9/9]

void simulate ( void  )
private

fast trigger simulation.

Definition at line 162 of file TRGGRL.cc.

163 {
164
165 TRGCDC* _cdc = Belle2::TRGCDC::getTRGCDC();
166 vector<TRGCDCTrack*> trackList = _cdc->getTrackList2D();
167 vector<TRGCDCTrack*> trackList3D = _cdc->getTrackList3D();
168 StoreArray<TRGECLCluster> ClusterArray;
169
170 unsigned n_track = trackList.size();
171 unsigned n_track3D = trackList3D.size();
172 unsigned n_cluster = ClusterArray.getEntries();
173
174// if (TRGDebug::level() > 2) cout <<"yt_grl "<< n_cluster << " " << n_track << endl;
175
176 for (unsigned i = 0; i < n_track; i++) {
177 // vector<TRGGRLMatch *> match_i;
178 if (n_cluster == 0) break;
179 else if (n_cluster == 1) {
180 TRGGRLMatch* match = new TRGGRLMatch(trackList[i], ClusterArray[0], 0);
181 matchList.push_back(match);
182 } else {
183 int best_j = 0; double old_dr = 99999;
184 for (unsigned j = 0; j < n_cluster; j++) {
185 TRGGRLMatch* match = new TRGGRLMatch(trackList[i], ClusterArray[j], 0);
186 if (match->getDr() < old_dr) {best_j = j; old_dr = match->getDr();}
187 delete match;
188 }
189 TRGGRLMatch* match = new TRGGRLMatch(trackList[i], ClusterArray[best_j], 0);
190 matchList.push_back(match);
191 }
192 }
193
194 for (unsigned i = 0; i < n_track3D; i++) {
195 // vector<TRGGRLMatch *> match_i;
196 if (n_cluster == 0) break;
197 else if (n_cluster == 1) {
198 TRGGRLMatch* match = new TRGGRLMatch(trackList3D[i], ClusterArray[0], 1);
199 matchList.push_back(match);
200 } else {
201 int best_j = 0; double old_dr = 99999;
202 for (unsigned j = 0; j < n_cluster; j++) {
203 TRGGRLMatch* match = new TRGGRLMatch(trackList3D[i], ClusterArray[j], 0);
204 if (match->getDr() < old_dr) {best_j = j; old_dr = match->getDr();}
205 delete match;
206 }
207 TRGGRLMatch* match = new TRGGRLMatch(trackList3D[i], ClusterArray[best_j], 0);
208 matchList3D.push_back(match);
209 }
210 }
211
212 //-----Fill tree
213 for (unsigned i = 0; i < matchList.size(); i++) {
214 TRGGRLMatch& match = * matchList[i];
215
216 x0 = match.getMatch3D();
217 x1 = match.getDr();
218 x2 = match.getDz();
219 x3 = match.getPoe();
220 x4 = match.getCenter_z0();
221 x5 = match.getCenter_pt();
222 x6 = match.getCenter_pz();
223 x7 = match.getCluster_e();
224 h1->Fill();
225 }
226
227 for (unsigned i = 0; i < matchList3D.size(); i++) {
228 TRGGRLMatch& match = * matchList3D[i];
229
230 x0 = match.getMatch3D();
231 x1 = match.getDr();
232 x2 = match.getDz();
233 x3 = match.getPoe();
234 x4 = match.getCenter_z0();
235 x5 = match.getCenter_pt();
236 x6 = match.getCenter_pz();
237 x7 = match.getCluster_e();
238 h1->Fill();
239 }
240
241 //--------------------------------------
242
243
244 const bool fast = (_simulationMode & 1);
245 const bool firm = (_simulationMode & 2);
246 if (fast)
248 if (firm)
250 }
unsigned _simulationMode
Simulation mode.
Definition: TRGGRL.h:150
std::vector< TRGGRLMatch * > matchList
Vector which stores list of TRGGRLMatch without 3D information.
Definition: TRGGRL.h:188
std::vector< TRGGRLMatch * > matchList3D
Vector which stores list of TRGGRLMatch with 3D information.
Definition: TRGGRL.h:190

◆ simulate2()

void simulate2 ( void  )

Firmware simulation. Unified version of inner and outer : yi.

Definition at line 1992 of file TrackSegmentFinder.cc.

1993 {
1994
1995 const string sn = "TSF::simulate2 : " + name();
1997
1998 // if (_type == innerType) {
1999 // cout << "??? tmp skip" << endl;
2000 // TRGDebug::leaveStage(sn);
2001 // return;
2002 // }
2003
2004 //...Delete old objects...
2005 for (unsigned i = 0; i < nOutput(); i++) {
2006 if (output(i))
2007 if (output(i)->signal())
2008 delete output(i)->signal();
2009 }
2010 for (unsigned i = 0; i < _tsfIn.size(); i++)
2011 delete _tsfIn[i];
2012 _tsfIn.clear();
2013 for (unsigned i = 0; i < _tsfOut.size(); i++)
2014 delete _tsfOut[i];
2015 _tsfOut.clear();
2016 for (unsigned i = 0; i < _toBeDeleted.size(); i++)
2017 delete _toBeDeleted[i];
2018 _toBeDeleted.clear();
2019
2020 //...Clear old pointers...
2021 for (unsigned i = 0; i < 5; i++)
2022 _hitMap[i].clear();
2023 _priMap.clear();
2024 _fasMap.clear();
2025 _secMap.clear();
2026 _edg0Map.clear();
2027 _edg1Map.clear();
2028 _edg2Map.clear();
2029 _edg3Map.clear();
2030 _edg4Map.clear();
2031
2032 //...Storage preparation...
2033 const unsigned nTSF = nInput() * 16;
2034 vector<TRGSignalVector*> trker[4];
2035 vector<int> tsfStateChanges;
2036
2037 //...Creates hit maps...
2038 if (_type == innerType)
2039 hitMapInner();
2040 else
2041 hitMapOuter();
2042
2043 //...Form a TSF...
2044 for (unsigned t = 0; t < nTSF; t++) {
2045
2046 const string n = name() + "-" + TRGUtilities::itostring(t);
2047 TRGSignalVector* s = new TRGSignalVector(n, clockData());
2048 _tsfIn.push_back(s);
2049
2050 //...Make input signals...
2051 if (_type == innerType)
2052 inputInner(t, nTSF, s);
2053 else
2054 inputOuter(t, nTSF, s);
2055
2056 //...Simulate TSF...
2057 vector<TRGSignalVector*> result = simulateTSF(s, t);
2058 vector<TRGSignalVector*> result2 = simulateTSF2(s, t);
2059 _toBeDeleted.push_back(result[1]); // Event timing omitted now
2060
2061 if (TRGDebug::level()) {
2062 if (result.size() != result2.size()) {
2063 cout << "TSF::simulateTSF2 has different response(size)"
2064 << endl;
2065 } else {
2066 for (unsigned i = 0; i < result.size(); i++) {
2067 if ((* result[i]) != (* result2[i]))
2068 cout << "TSF::simulateTSF2 has different response"
2069 << "(contents)" << endl;
2070 }
2071 }
2072 }
2073
2074 TRGSignalVector* forTracker0 = result[0];
2075 TRGSignalVector* forTracker1 = new TRGSignalVector(* forTracker0);
2076
2077 _tsfOut.push_back(forTracker0);
2078 _tsfOut.push_back(forTracker1);
2079
2080 //...State change list...
2081 vector<int> sc = forTracker0->stateChanges();
2082 for (unsigned i = 0; i < sc.size(); i++) {
2083 bool skip = false;
2084 for (unsigned j = 0; j < tsfStateChanges.size(); j++) {
2085 if (tsfStateChanges[j] == sc[i]) {
2086 skip = true;
2087 break;
2088 }
2089 }
2090 if (! skip) tsfStateChanges.push_back(sc[i]);
2091 }
2092
2093 //...Store it for each tracker division...
2094 const unsigned pos = t / (nTSF / 4);
2095 if (pos == 0) {
2096 addID(* forTracker0, t - 3 * (nTSF / 4));
2097 addID(* forTracker1, t);
2098 trker[3].push_back(forTracker0);
2099 trker[0].push_back(forTracker1);
2100 } else if (pos == 1) {
2101 addID(* forTracker0, t);
2102 addID(* forTracker1, t - 1 * (nTSF / 4));
2103 trker[0].push_back(forTracker0);
2104 trker[1].push_back(forTracker1);
2105 } else if (pos == 2) {
2106 addID(* forTracker0, t - 1 * (nTSF / 4));
2107 addID(* forTracker1, t - 2 * (nTSF / 4));
2108 trker[1].push_back(forTracker0);
2109 trker[2].push_back(forTracker1);
2110 } else {
2111 addID(* forTracker0, t - 2 * (nTSF / 4));
2112 addID(* forTracker1, t - 3 * (nTSF / 4));
2113 trker[2].push_back(forTracker0);
2114 trker[3].push_back(forTracker1);
2115 }
2116
2117 if (TRGDebug::level())
2118 if (forTracker0->active())
2119 cout << TRGDebug::tab() << name() << " : TSF out="
2120 << t << endl;
2121 }
2122
2123 //...Sort state changes...
2124 std::sort(tsfStateChanges.begin(), tsfStateChanges.end());
2125
2126 //...Output for 2D...
2127 for (unsigned i = 0; i < 4; i++) {
2128 string n = name() + "-trker" + TRGUtilities::itostring(i);
2129 TRGSignalVector* tOut = packerForTracker(trker[i],
2130 tsfStateChanges,
2131 20);
2132 tOut->name(n);
2133 TRGSignalBundle* b = new TRGSignalBundle(n, clockData());
2134 b->push_back(tOut);
2135 output(i)->signal(b);
2136 _toBeDeleted.push_back(tOut);
2137
2138 if (TRGCDC::getTRGCDC()->firmwareSimulationMode() & 0x4)
2139 b->dumpCOE("",
2140 TRGCDC::getTRGCDC()->firmwareSimulationStartDataClock(),
2141 TRGCDC::getTRGCDC()->firmwareSimulationStopDataClock());
2142 // b->dump();
2143 }
2144
2146 }
TRGSignalVector * packerForTracker(vector< TRGSignalVector * > &, vector< int > &, const unsigned)
Output packer for tracker.
vector< TRGSignalVector * > simulateTSF(TRGSignalVector *in, unsigned id)
Simulate TSF response (unified version, 2016/07/12)
void inputOuter(const unsigned id, const unsigned nTSF, TRGSignalVector *s)
Creates input signals to TSF for the outer.
static void addID(TRGSignalVector &s, unsigned id)
Add TSF ID to timing signal vector for the output.
void hitMapOuter(void)
Creates the hit maps for the outer.
void inputInner(const unsigned id, const unsigned nTSF, TRGSignalVector *s)
Creates input signals to TSF for the inner.
vector< TRGSignalVector * > simulateTSF2(TRGSignalVector *in, unsigned id)
Simulate TSF response (unified version, state machine)
void hitMapInner(void)
Creates the hit maps for the inner.

◆ simulateInner() [1/2]

vector< TRGSignalVector * > simulateInner ( const TRGSignalVector in,
unsigned  id 
)

Simulate TSF response for the inner.

Definition at line 1885 of file TrackSegmentFinder.cc.

1886 {
1887
1888 // This is just a simple coincidence logic. Should be replaced by
1889 // real logic.
1890
1891 //const int width = 10;
1892
1893 //...Layer hit...
1894 //TRGSignal l0 = s[0 + 1].widen(width);
1895 //TRGSignal l1 = s[1 + 1].widen(width) | s[2 + 1].widen(width);
1896 //TRGSignal l2 = s[3 + 1].widen(width) | s[4 + 1].widen(width) |
1897 // s[5 + 1].widen(width);
1898 //TRGSignal l3 = s[6 + 1].widen(width) | s[7 + 1].widen(width) |
1899 // s[8 + 1].widen(width) | s[9 + 1].widen(width);
1900 //TRGSignal l4 = s[10 + 1].widen(width) | s[11 + 1].widen(width) |
1901 // s[12 + 1].widen(width) | s[13 + 1].widen(width);
1902
1903 //...Layer coincidence...
1904 //TRGSignal a0 = l1 & l2 & l3 & l4;
1905 //TRGSignal a1 = l0 & l2 & l3 & l4;
1906 //TRGSignal a2 = l0 & l1 & l3 & l4;
1907 //TRGSignal a3 = l0 & l1 & l2 & l4;
1908 //TRGSignal a4 = l0 & l1 & l2 & l3;
1909
1910 //...Final hit... (detail hit pattern changes are ignored here)
1911 //TRGSignal a = a0 | a1 | a2 | a3 | a4; TODO should it be used somewhere?
1912
1913 //...Check timing cells...
1914 vector<int> sc = s.stateChanges();
1915 for (unsigned i = 0; i < sc.size(); i++) {
1916 int clk = sc[i];
1917 TRGState st = s.state(clk).subset(1, 3);
1918
1919 if (st[0]) {
1920 } else {
1921 if (st[1] && st[2]) {
1922 } else if (st[1]) {
1923 } else if (st[2]) {
1924 }
1925 }
1926 }
1927
1928 TRGSignalVector* r0 = new TRGSignalVector("tmp0", clockData(), 21);
1929 TRGSignalVector* r1 = new TRGSignalVector("tmp0", clockData(), 21);
1930 vector<TRGSignalVector*> v;
1931 v.push_back(r0);
1932 v.push_back(r1);
1933 return v;
1934 }

◆ simulateInner() [2/2]

void simulateInner ( void  )
private

Firmware simulation for the outers. yi.

Definition at line 1441 of file TrackSegmentFinder.cc.

1442 {
1443
1444 const string sn = "TSF::simulateInner : " + name();
1446
1447 //...Output for 2D : empty bundle temporary...
1448 for (unsigned i = 0; i < 4; i++) {
1449 string n = name() + "-trker" + TRGUtilities::itostring(i);
1450 TRGSignalVector* dummy = new TRGSignalVector(n, clockData(), 420);
1451 TRGSignalBundle* b = new TRGSignalBundle(n, clockData());
1452 b->push_back(dummy);
1453 output(i)->signal(b);
1454 _toBeDeleted.push_back(dummy);
1455
1456 if (TRGCDC::getTRGCDC()->firmwareSimulationMode() & 0x4)
1457 b->dumpCOE("",
1458 TRGCDC::getTRGCDC()->firmwareSimulationStartDataClock(),
1459 TRGCDC::getTRGCDC()->firmwareSimulationStopDataClock());
1460 }
1461
1463 return;
1464
1465
1466 //...Loop over mergers to create a super layer hit map...
1467 for (unsigned m = 0; m < nInput(); m++) {
1468 TRGSignalBundle* b = input(m)->signal();
1469
1470 for (unsigned i = 0; i < 16; i++) {
1471 _secMap.push_back(& ((* b)[0][0][208 + i]));
1472 for (unsigned j = 0; j < 5; j++)
1473 _hitMap[j].push_back(& ((* b)[0][0][j * 16 + i]));
1474 for (unsigned j = 0; j < 4; j++)
1475 _priMap.push_back(& ((* b)[0][0][80 + i * 4 + j]));
1476 for (unsigned j = 0; j < 4; j++)
1477 _fasMap.push_back(& ((* b)[0][0][144 + i * 4 + j]));
1478 }
1479
1480 for (unsigned i = 0; i < 4; i++)
1481 _edg0Map.push_back(& ((* b)[0][0][224 + i]));
1482 for (unsigned i = 0; i < 4; i++)
1483 _edg1Map.push_back(& ((* b)[0][0][224 + 4 + i]));
1484 for (unsigned i = 0; i < 4; i++)
1485 _edg2Map.push_back(& ((* b)[0][0][224 + 8 + i]));
1486 for (unsigned i = 0; i < 4; i++)
1487 _edg3Map.push_back(& ((* b)[0][0][224 + 12 + i]));
1488 for (unsigned i = 0; i < 4; i++)
1489 _edg4Map.push_back(& ((* b)[0][0][224 + 16 + i]));
1490 }
1491
1492 //...Storage preparation...
1493 const unsigned nTSF = nInput() * 16;
1494 vector<TRGSignalVector*> trker[4];
1495 vector<int> tsfStateChanges;
1496
1497 //...Form a TSF...
1498 for (unsigned t = 0; t < nTSF; t++) {
1499
1500 const string n = name() + "-" + TRGUtilities::itostring(t);
1501 TRGSignalVector* s = new TRGSignalVector(n, clockData());
1502 _tsfIn.push_back(s);
1503
1504 s->push_back(* _secMap[t]);
1505
1506 if (t == 0) {
1507 s->push_back(* (_hitMap[0][0]));
1508 s->push_back(* (_hitMap[1][nTSF - 1]));
1509 s->push_back(* (_hitMap[1][0]));
1510 s->push_back(* (_hitMap[2][nTSF - 1]));
1511 s->push_back(* (_hitMap[2][0]));
1512 s->push_back(* (_hitMap[2][1]));
1513 s->push_back(* (_hitMap[3][nTSF - 2]));
1514 s->push_back(* (_hitMap[3][nTSF - 1]));
1515 s->push_back(* (_hitMap[3][0]));
1516 s->push_back(* (_hitMap[3][1]));
1517 s->push_back(* (_hitMap[4][nTSF - 2]));
1518 s->push_back(* (_hitMap[4][nTSF - 1]));
1519 s->push_back(* (_hitMap[4][0]));
1520 s->push_back(* (_hitMap[4][1]));
1521 s->push_back(* (_hitMap[4][2]));
1522 } else if (t == 1) {
1523 s->push_back(* (_hitMap[0][1]));
1524 s->push_back(* (_hitMap[1][0]));
1525 s->push_back(* (_hitMap[1][1]));
1526 s->push_back(* (_hitMap[2][0]));
1527 s->push_back(* (_hitMap[2][1]));
1528 s->push_back(* (_hitMap[2][2]));
1529 s->push_back(* (_hitMap[3][nTSF - 1]));
1530 s->push_back(* (_hitMap[3][0]));
1531 s->push_back(* (_hitMap[3][1]));
1532 s->push_back(* (_hitMap[3][2]));
1533 s->push_back(* (_hitMap[4][nTSF - 1]));
1534 s->push_back(* (_hitMap[4][0]));
1535 s->push_back(* (_hitMap[4][1]));
1536 s->push_back(* (_hitMap[4][2]));
1537 s->push_back(* (_hitMap[4][3]));
1538 } else if (t == (nTSF - 2)) {
1539 s->push_back(* (_hitMap[0][t]));
1540 s->push_back(* (_hitMap[1][t - 11]));
1541 s->push_back(* (_hitMap[1][t]));
1542 s->push_back(* (_hitMap[2][t - 1]));
1543 s->push_back(* (_hitMap[2][t]));
1544 s->push_back(* (_hitMap[2][0]));
1545 s->push_back(* (_hitMap[3][t - 2]));
1546 s->push_back(* (_hitMap[3][t - 1]));
1547 s->push_back(* (_hitMap[3][t]));
1548 s->push_back(* (_hitMap[3][0]));
1549 s->push_back(* (_hitMap[4][t - 2]));
1550 s->push_back(* (_hitMap[4][t - 1]));
1551 s->push_back(* (_hitMap[4][t]));
1552 s->push_back(* (_hitMap[4][t + 1]));
1553 s->push_back(* (_hitMap[4][0]));
1554 } else if (t == (nTSF - 1)) {
1555 s->push_back(* (_hitMap[0][t]));
1556 s->push_back(* (_hitMap[1][t - 11]));
1557 s->push_back(* (_hitMap[1][t]));
1558 s->push_back(* (_hitMap[2][t - 1]));
1559 s->push_back(* (_hitMap[2][t]));
1560 s->push_back(* (_hitMap[2][0]));
1561 s->push_back(* (_hitMap[3][t - 2]));
1562 s->push_back(* (_hitMap[3][t - 1]));
1563 s->push_back(* (_hitMap[3][t]));
1564 s->push_back(* (_hitMap[3][0]));
1565 s->push_back(* (_hitMap[4][t - 2]));
1566 s->push_back(* (_hitMap[4][t - 1]));
1567 s->push_back(* (_hitMap[4][t]));
1568 s->push_back(* (_hitMap[4][0]));
1569 s->push_back(* (_hitMap[4][1]));
1570 } else {
1571 s->push_back(* (_hitMap[0][t]));
1572 s->push_back(* (_hitMap[1][t - 11]));
1573 s->push_back(* (_hitMap[1][t]));
1574 s->push_back(* (_hitMap[2][t - 1]));
1575 s->push_back(* (_hitMap[2][t]));
1576 s->push_back(* (_hitMap[2][0]));
1577 s->push_back(* (_hitMap[3][t - 2]));
1578 s->push_back(* (_hitMap[3][t - 1]));
1579 s->push_back(* (_hitMap[3][t]));
1580 s->push_back(* (_hitMap[3][0]));
1581 s->push_back(* (_hitMap[4][t - 2]));
1582 s->push_back(* (_hitMap[4][t - 1]));
1583 s->push_back(* (_hitMap[4][t]));
1584 s->push_back(* (_hitMap[4][t + 1]));
1585 s->push_back(* (_hitMap[4][t + 2]));
1586 }
1587
1588 //...Priority timing...
1589 s->push_back(* _priMap[t * 4 + 0]);
1590 s->push_back(* _priMap[t * 4 + 1]);
1591 s->push_back(* _priMap[t * 4 + 2]);
1592 s->push_back(* _priMap[t * 4 + 3]);
1593
1594 //...Priority timing...
1595 priorityTiming(t, nTSF, * s, (* s)[1], (* s)[2], (* s)[3]);
1596
1597 //...Fastest timing...
1598 fastestTimingInner(t, nTSF, * s);
1599
1600 //...Clock counter is omitted...
1601
1602 //...Simulate TSF...
1603 vector<TRGSignalVector*> result = simulateInner(* s, t);
1604
1605 TRGSignalVector* forTracker = result[0];
1606 _tsfOut.push_back(forTracker);
1607 _toBeDeleted.push_back(result[1]);
1608
1609 //...State change list...
1610 vector<int> sc = forTracker->stateChanges();
1611 for (unsigned i = 0; i < sc.size(); i++) {
1612 bool skip = false;
1613 for (unsigned j = 0; j < tsfStateChanges.size(); j++) {
1614 if (tsfStateChanges[j] == sc[i]) {
1615 skip = true;
1616 break;
1617 }
1618 }
1619 if (! skip) tsfStateChanges.push_back(sc[i]);
1620 }
1621
1622 //...Store it for each tracker division...
1623 const unsigned pos = t / (nTSF / 4);
1624 if (pos == 0) {
1625 trker[0].push_back(forTracker);
1626 trker[1].push_back(forTracker);
1627 } else if (pos == 1) {
1628 trker[1].push_back(forTracker);
1629 trker[2].push_back(forTracker);
1630 } else if (pos == 2) {
1631 trker[2].push_back(forTracker);
1632 trker[3].push_back(forTracker);
1633 } else {
1634 trker[3].push_back(forTracker);
1635 trker[0].push_back(forTracker);
1636 }
1637
1638 //...Test...
1639 // if (TRGDebug::level() && t < 16) {
1640 // bool ok = ((* result[0]) == (* dbgOut[t])); // track part only
1641
1642 // if (ok) {
1643 // cout << TRGDebug::tab() << name() << "...Comparison OK"
1644 // << endl;
1645 // }
1646 // else {
1647 // cout << TRGDebug::tab() << name()
1648 // << "...Comparison is not OK" << endl;
1649 // dbgOut[t]->dump("", "kt :");
1650 // result[0]->dump("", "2d :");
1651 // dbgIn[t]->dump("", "kt i:");
1652 // s->dump("", "2d i:");
1653 // }
1654 // }
1655 }
1656
1657 //...Sort state changes...
1658 std::sort(tsfStateChanges.begin(), tsfStateChanges.end());
1659
1660 //...Output for 2D...
1661 for (unsigned i = 0; i < 4; i++) {
1662 TRGSignalVector* tOut = packerOuterTracker(trker[i],
1663 tsfStateChanges,
1664 20);
1665 string n = name() + "trker" + TRGUtilities::itostring(i);
1666 TRGSignalBundle* b = new TRGSignalBundle(n, clockData());
1667 b->push_back(tOut);
1668 output(i)->signal(b);
1669 }
1670
1672 }
TRGSignalVector * packerOuterTracker(vector< TRGSignalVector * > &, vector< int > &, const unsigned)
Packing output for tracker.

◆ simulateOuter() [1/2]

vector< TRGSignalVector * > simulateOuter ( TRGSignalVector in,
unsigned  id 
)

Simulate TSF response for the inner.

output for EvtTime & Low pT tracker module

output for Tracker & N.N

Definition at line 1048 of file TrackSegmentFinder.cc.

1049 {
1050
1051 //variables for common
1052 const string na = "TSCandidate" + TRGUtilities::itostring(tsid) + " in " +
1053 name();
1054 TCSegment* tsi = _tsSL[tsid];
1055 vector <TRGSignalVector*> result;
1056
1057 //variables for EvtTime & Low pT
1058 vector<bool> fTimeVect;
1059 // int tmpFTime = 0 ;
1060
1061 //variables for Tracker & N.N
1062 vector <bool> tmpOutBool;
1063
1064 //iwTRGSignalVector* resultT = new TRGSignalVector(na, in->clock(),22);
1065 TRGSignalVector* resultT = new TRGSignalVector(na, in->clock(), 13);
1066 TRGSignalVector* resultE = new TRGSignalVector(na, in->clock(), 10);
1067 TRGSignalVector* Hitmap = new TRGSignalVector(na + "HitMap", in->clock(), 0);
1068 TRGSignalVector pTime(na + "PriorityTime", in->clock(), 0);
1069 TRGSignalVector fTime(na + "FastestTime", in->clock(), 0);
1070 for (unsigned i = 0; i < 12; i++) {
1071 Hitmap->push_back((*in)[i]);
1072 (*Hitmap)[i].widen(16);
1073 }
1074 for (unsigned i = 0; i < 4; i++) {
1075 pTime.push_back((*in)[i + 12]);
1076 fTime.push_back((*in)[i + 16]);
1077 }
1078
1079 //...Clock counter...
1080 const TRGSignalVector& cc = in->clock().clockCounter();
1081 for (unsigned i = 0; i < 5; i++) {
1082 pTime.push_back(cc[i]);
1083 fTime.push_back(cc[i]);
1084 }
1085
1086 vector <int> changeTime = Hitmap->stateChanges();
1087
1088 int* LUTValue = new int[changeTime.size()];
1089 if (changeTime.size()) {
1090 int hitPosition = 0;
1091 bool fTimeBool[10];
1092 int tmpPTime = 0 ;
1093 int tmpCTime = 0 ;
1094 int tmpOutInt;
1095 fTime.state(changeTime[0]).copy2bool(fTimeBool);
1096 fTimeBool[9] = true;
1097 fTimeVect.insert(fTimeVect.begin(), fTimeBool, fTimeBool + 10);
1098 //tmpFTime = mkint(fTime.state(changeTime[0]));
1099 bool eOUT = true;
1100 for (unsigned i = 0; i < changeTime.size(); i++) {
1101 LUTValue[i] = tsi->LUT()->getValue(mkint(Hitmap->state(changeTime[i])));
1102
1104 if ((LUTValue[i]) && (eOUT)) {
1105 resultE->set(fTimeVect, changeTime[i]);
1106 eOUT = false;
1107 }
1108
1109 bool priority1rise = (*Hitmap)[6].riseEdge(changeTime[i]);
1110 bool priority2rise = ((*Hitmap)[7].riseEdge(changeTime[i]) or
1111 (*Hitmap)[8].riseEdge(changeTime[i]));
1112
1114 //ready for output
1115 if (priority1rise) {
1116 hitPosition = 3;
1117 tmpPTime = mkint(pTime.state(changeTime[i]));
1118 tmpCTime = changeTime[i];
1119 } else if (priority2rise) {
1120 if (!hitPosition) {
1121 tmpPTime = mkint(pTime.state(changeTime[i]));
1122 tmpCTime = changeTime[i];
1123 if ((*Hitmap)[0].state(changeTime[i])) hitPosition = 2;
1124 else hitPosition = 1;
1125 }
1126 }
1127
1128 // output selection
1129 if ((hitPosition) && (LUTValue[i]) && ((changeTime[i] - tmpCTime) < 16)) {
1130 //iw tmpOutInt = tsid * pow(2, 13) + tmpPTime * pow(2, 4) +
1131 //iw LUTValue[i] * pow(2,2) + hitPosition;
1132 tmpOutInt = tmpPTime * pow(2, 4) +
1133 LUTValue[i] * pow(2, 2) + hitPosition;
1134 tmpOutBool = mkbool(tmpOutInt, 13); // ID removed : iw
1135 if (hitPosition == 3) {
1136 if (priority1rise) resultT->set(tmpOutBool, changeTime[i]);
1137 else {
1138 if ((LUTValue[i] == 1) | (LUTValue[i] == 2)) {
1139 if (!((LUTValue[i - 1] == 1) |
1140 (LUTValue[i - 1] == 2)))
1141 resultT->set(tmpOutBool, changeTime[i]);
1142 } else {
1143 if (!(LUTValue[i - 1])) resultT->set(tmpOutBool, changeTime[i]);
1144 }
1145 }
1146 } else {
1147 if (priority2rise) resultT->set(tmpOutBool, changeTime[i]);
1148 else {
1149 if ((LUTValue[i] == 1) | (LUTValue[i] == 2)) {
1150 if (!((LUTValue[i - 1] == 1) |
1151 (LUTValue[i - 1] == 2)))
1152 resultT->set(tmpOutBool, changeTime[i]);
1153 } else {
1154 if (!(LUTValue[i])) resultT->set(tmpOutBool, changeTime[i]);
1155 }
1156 }
1157 }
1158 }
1159
1160 }
1161
1162 }
1163 result.push_back(resultT);
1164 result.push_back(resultE);
1165
1166 // cppcheck-suppress uninitdata
1167 delete[] LUTValue;
1168 delete Hitmap;
1169
1170 return result;
1171 }

◆ simulateOuter() [2/2]

void simulateOuter ( void  )
private

Firmware simulation for the outers. yi.

Definition at line 872 of file TrackSegmentFinder.cc.

873 {
874
875 const string sn = "TSF::simulateOuter : " + name();
877
878 //...Loop over mergers to create a super layer hit map...
879 for (unsigned m = 0; m < nInput(); m++) {
880 TRGSignalBundle* b = input(m)->signal();
881
882 for (unsigned i = 0; i < 16; i++) {
883 _secMap.push_back(& ((* b)[0][0][208 + i]));
884 for (unsigned j = 0; j < 5; j++)
885 _hitMap[j].push_back(& ((* b)[0][0][j * 16 + i]));
886 for (unsigned j = 0; j < 4; j++)
887 _priMap.push_back(& ((* b)[0][0][80 + i * 4 + j]));
888 for (unsigned j = 0; j < 4; j++)
889 _fasMap.push_back(& ((* b)[0][0][144 + i * 4 + j]));
890 }
891
892 for (unsigned i = 0; i < 4; i++)
893 _edg0Map.push_back(& ((* b)[0][0][224 + i]));
894 for (unsigned i = 0; i < 4; i++)
895 _edg1Map.push_back(& ((* b)[0][0][224 + 4 + i]));
896 for (unsigned i = 0; i < 4; i++)
897 _edg2Map.push_back(& ((* b)[0][0][224 + 8 + i]));
898 }
899
900 //...Storage preparation...
901 const unsigned nTSF = nInput() * 16;
902 vector<TRGSignalVector*> trker[4];
903 vector<int> tsfStateChanges;
904
905 //...Form a TSF...
906 for (unsigned t = 0; t < nTSF; t++) {
907
908 const string n = name() + "-" + TRGUtilities::itostring(t);
909 TRGSignalVector* s = new TRGSignalVector(n, clockData());
910 _tsfIn.push_back(s);
911
912 s->push_back(* _secMap[t]);
913
914 if (t == 0) {
915 s->push_back(* (_hitMap[0][nTSF - 1]));
916 s->push_back(* (_hitMap[0][0]));
917 s->push_back(* (_hitMap[0][1]));
918 s->push_back(* (_hitMap[1][nTSF - 1]));
919 s->push_back(* (_hitMap[1][0]));
920 s->push_back(* (_hitMap[2][0]));
921 s->push_back(* (_hitMap[3][nTSF - 1]));
922 s->push_back(* (_hitMap[3][0]));
923 s->push_back(* (_hitMap[4][nTSF - 1]));
924 s->push_back(* (_hitMap[4][0]));
925 s->push_back(* (_hitMap[4][1]));
926 } else if (t == (nTSF - 1)) {
927 s->push_back(* (_hitMap[0][nTSF - 2]));
928 s->push_back(* (_hitMap[0][nTSF - 1]));
929 s->push_back(* (_hitMap[0][0]));
930 s->push_back(* (_hitMap[1][nTSF - 2]));
931 s->push_back(* (_hitMap[1][nTSF - 1]));
932 s->push_back(* (_hitMap[2][nTSF - 1]));
933 s->push_back(* (_hitMap[3][nTSF - 2]));
934 s->push_back(* (_hitMap[3][nTSF - 1]));
935
936 s->push_back(* (_hitMap[4][nTSF - 2]));
937 s->push_back(* (_hitMap[4][nTSF - 1]));
938 s->push_back(* (_hitMap[4][0]));
939 } else {
940 s->push_back(* (_hitMap[0][t - 1]));
941 s->push_back(* (_hitMap[0][t]));
942 s->push_back(* (_hitMap[0][t + 1]));
943 s->push_back(* (_hitMap[1][t - 1]));
944 s->push_back(* (_hitMap[1][t]));
945 s->push_back(* (_hitMap[2][t]));
946 s->push_back(* (_hitMap[3][t - 1]));
947 s->push_back(* (_hitMap[3][t]));
948 s->push_back(* (_hitMap[4][t - 1]));
949 s->push_back(* (_hitMap[4][t]));
950 s->push_back(* (_hitMap[4][t + 1]));
951 }
952
953 //...Priority timing...
954 s->push_back(* _priMap[t * 4 + 0]);
955 s->push_back(* _priMap[t * 4 + 1]);
956 s->push_back(* _priMap[t * 4 + 2]);
957 s->push_back(* _priMap[t * 4 + 3]);
958
959 //...Priority timing...
960 priorityTiming(t, nTSF, * s, (* s)[6], (* s)[7], (* s)[8]);
961
962 //...Fastest timing...
963 fastestTimingOuter(t, nTSF, * s);
964
965 //...Clock counter is omitted...
966
967 //...Simulate TSF...
968 vector<TRGSignalVector*> result = simulateOuter(s, t);
969 _toBeDeleted.push_back(result[1]); // Event timing omitted now
970
971 TRGSignalVector* forTracker0 = result[0];
972 TRGSignalVector* forTracker1 = new TRGSignalVector(* forTracker0);
973
974 _tsfOut.push_back(forTracker0);
975 _tsfOut.push_back(forTracker1);
976
977
978 //...State change list...
979 vector<int> sc = forTracker0->stateChanges();
980 for (unsigned i = 0; i < sc.size(); i++) {
981 bool skip = false;
982 for (unsigned j = 0; j < tsfStateChanges.size(); j++) {
983 if (tsfStateChanges[j] == sc[i]) {
984 skip = true;
985 break;
986 }
987 }
988 if (! skip) tsfStateChanges.push_back(sc[i]);
989 }
990
991 //...Store it for each tracker division...
992 const unsigned pos = t / (nTSF / 4);
993 if (pos == 0) {
994 addID(* forTracker0, t + (nTSF / 4));
995 addID(* forTracker1, t);
996 trker[3].push_back(forTracker0);
997 trker[0].push_back(forTracker1);
998 } else if (pos == 1) {
999 addID(* forTracker0, t);
1000 addID(* forTracker1, t - 1 * (nTSF / 4));
1001 trker[0].push_back(forTracker0);
1002 trker[1].push_back(forTracker1);
1003 } else if (pos == 2) {
1004 addID(* forTracker0, t - 1 * (nTSF / 4));
1005 addID(* forTracker1, t - 2 * (nTSF / 4));
1006 trker[1].push_back(forTracker0);
1007 trker[2].push_back(forTracker1);
1008 } else {
1009 addID(* forTracker0, t - 2 * (nTSF / 4));
1010 addID(* forTracker1, t - 3 * (nTSF / 4));
1011 trker[2].push_back(forTracker0);
1012 trker[3].push_back(forTracker1);
1013 }
1014
1015 if (TRGDebug::level())
1016 if (forTracker0->active())
1017 cout << TRGDebug::tab() << "hit found : TSF out="
1018 << t << endl;
1019 }
1020
1021 //...Sort state changes...
1022 std::sort(tsfStateChanges.begin(), tsfStateChanges.end());
1023
1024 //...Output for 2D...
1025 for (unsigned i = 0; i < 4; i++) {
1026 string n = name() + "-trker" + TRGUtilities::itostring(i);
1027 TRGSignalVector* tOut = packerOuterTracker(trker[i],
1028 tsfStateChanges,
1029 20);
1030 tOut->name(n);
1031 TRGSignalBundle* b = new TRGSignalBundle(n, clockData());
1032 b->push_back(tOut);
1033 output(i)->signal(b);
1034 _toBeDeleted.push_back(tOut);
1035
1036 if (TRGCDC::getTRGCDC()->firmwareSimulationMode() & 0x4)
1037 b->dumpCOE("",
1038 TRGCDC::getTRGCDC()->firmwareSimulationStartDataClock(),
1039 TRGCDC::getTRGCDC()->firmwareSimulationStopDataClock());
1040
1041 // b->dump();
1042 }
1043
1045 }

◆ simulateTSF()

vector< TRGSignalVector * > simulateTSF ( TRGSignalVector in,
unsigned  id 
)

Simulate TSF response (unified version, 2016/07/12)

output for EvtTime & Low pT tracker module

output for Tracker & N.N

Definition at line 2587 of file TrackSegmentFinder.cc.

2588 {
2589
2590 //variables for common
2591 const string na = "TSF" + TRGUtilities::itostring(tsid) + " in " +
2592 name();
2593 TCSegment* tsi = _tsSL[tsid];
2594 vector <TRGSignalVector*> result;
2595
2596 //variables for EvtTime & Low pT
2597 vector<bool> fTimeVect;
2598 // int tmpFTime = 0 ;
2599
2600 //variables for Tracker & N.N
2601 vector <bool> tmpOutBool;
2602
2603 TRGSignalVector* resultT = new TRGSignalVector(na, in->clock(), 13);
2604 TRGSignalVector* resultE = new TRGSignalVector(na, in->clock(), 10);
2605 TRGSignalVector* Hitmap = new TRGSignalVector(na + "HitMap",
2606 in->clock(),
2607 0);
2608 TRGSignalVector pTime(na + "PriorityTime", in->clock(), 0);
2609 TRGSignalVector fTime(na + "FastestTime", in->clock(), 0);
2610 TRGSignal* pri0 = 0;
2611 TRGSignal* pri1 = 0;
2612 TRGSignal* pri2 = 0;
2613 if (_type == innerType) {
2614 for (unsigned i = 0; i < 16; i++) {
2615 Hitmap->push_back((* in)[i]);
2616 (* Hitmap)[i].widen(16);
2617 }
2618 for (unsigned i = 0; i < 4; i++) {
2619 pTime.push_back((* in)[i + 16]);
2620 fTime.push_back((* in)[i + 20]);
2621 }
2622 pri0 = & (*Hitmap)[1];
2623 pri1 = & (*Hitmap)[2];
2624 pri2 = & (*Hitmap)[3];
2625 } else {
2626 for (unsigned i = 0; i < 12; i++) {
2627 Hitmap->push_back((* in)[i]);
2628 (* Hitmap)[i].widen(16);
2629 }
2630 for (unsigned i = 0; i < 4; i++) {
2631 pTime.push_back((* in)[i + 12]);
2632 fTime.push_back((* in)[i + 16]);
2633 }
2634 pri0 = & (*Hitmap)[6];
2635 pri1 = & (*Hitmap)[7];
2636 pri2 = & (*Hitmap)[8];
2637 }
2638
2639 //...Clock counter...
2640 const TRGSignalVector& cc = in->clock().clockCounter();
2641 for (unsigned i = 0; i < 5; i++) {
2642 pTime.push_back(cc[i]);
2643 fTime.push_back(cc[i]);
2644 }
2645
2646 vector<int> changeTime = Hitmap->stateChanges();
2647
2648 int* LUTValue = new int[changeTime.size()];
2649 //int oldLUT = 0;
2650 int lastFastHit = in->clock().min();
2651 if (changeTime.size()) {
2652
2653 int oldLUT = 0; // 2019/07/31 by ytlai, moved to here to reduce scope
2654 const string fn = "TSF::simulateTSF:tsid=" + to_string(tsid);
2656
2657 int hitPosition = 0;
2658 int tmpPTime = 0 ;
2659 int tmpCTime = 0 ;
2660 int tmpOutInt;
2661 //TRGState ft(10); //TODO variable not used at all
2662 bool eOut = false;
2663 for (unsigned i = 0; i < changeTime.size(); i++) {
2664
2665 int ct = changeTime[i];
2666 TRGState st = Hitmap->state(ct);
2667
2668 //...LUT...
2669 // 0:no hit, 1:right, 2:left, 3:LR unknown hit
2670 LUTValue[i] = tsi->LUT()->getValue(unsigned(st));
2671
2672 //...Any wire hit (for the fastest timing)...
2673 bool active = st.active();
2674 if (active) {
2675 const int timeCounter = ct - lastFastHit;
2676
2677 //...Record as the fastest timing hit...
2678 if (timeCounter > 15) {
2679 lastFastHit = ct;
2680 TRGState ftnow = fTime.state(ct);
2681 ftnow += TRGState(1, 1);
2682 //ft = ftnow;
2683 eOut = true;
2684 }
2685 }
2686
2688 if ((LUTValue[i])) {
2689 if (eOut) {
2690 resultE->set(fTimeVect, ct);
2691 eOut = false;
2692 }
2693 }
2694
2695 bool priority1rise = pri0->riseEdge(ct);
2696 bool priority2rise = pri1->riseEdge(ct) or pri2->riseEdge(ct);
2697
2699 //ready for output
2700 if (priority1rise) {
2701 hitPosition = 3;
2702 tmpPTime = unsigned(pTime.state(ct));
2703 tmpCTime = ct;
2704 } else if (priority2rise) {
2705 if (!hitPosition) {
2706 tmpPTime = unsigned(pTime.state(ct));
2707 tmpCTime = ct;
2708 if ((*Hitmap)[0].state(ct)) hitPosition = 2;
2709 else hitPosition = 1;
2710 }
2711 }
2712
2713 // output selection
2714 if ((ct - tmpCTime) < 16) {
2715 if ((hitPosition) && (LUTValue[i])) {
2716 //iw tmpOutInt = tsid * pow(2, 13) + tmpPTime * pow(2, 4) +
2717 //iw LUTValue[i] * pow(2,2) + hitPosition;
2718 tmpOutInt = tmpPTime * pow(2, 4) +
2719 LUTValue[i] * pow(2, 2) + hitPosition;
2720 tmpOutBool = mkbool(tmpOutInt, 13); // ID removed : iw
2721
2722 if (hitPosition == 3) {
2723 if (priority1rise) {
2724 resultT->set(tmpOutBool, ct);
2725 oldLUT = LUTValue[i];
2726 } else {
2727 if ((LUTValue[i] == 1) | (LUTValue[i] == 2)) {
2728 if (!((oldLUT == 1) |
2729 (oldLUT == 2))) {
2730 resultT->set(tmpOutBool, ct);
2731 oldLUT = LUTValue[i];
2732 }
2733 } else {
2734 if (!(LUTValue[i - 1])) {
2735 resultT->set(tmpOutBool, ct);
2736 oldLUT = LUTValue[i];
2737 }
2738 }
2739 }
2740 } else {
2741 if ((priority2rise) && (!oldLUT)) resultT->set(tmpOutBool, ct);
2742 else {
2743 if ((LUTValue[i] == 1) | (LUTValue[i] == 2)) {
2744 if (!((oldLUT == 1) |
2745 (oldLUT == 2))) {
2746 resultT->set(tmpOutBool, ct);
2747 oldLUT = LUTValue[i];
2748 }
2749 } else {
2750 if (!(oldLUT)) {
2751 resultT->set(tmpOutBool, ct);
2752 oldLUT = LUTValue[i];
2753 }
2754 }
2755 }
2756 }
2757 }
2758 } else {
2759 oldLUT = 0;
2760 hitPosition = 0;
2761 }
2762
2763 if (TRGDebug::level() > 1) {
2764 cout << TRGDebug::tab() << "clk=" << ct
2765 << ", pattern=" << st
2766 << ", LUT=" << LUTValue[i]
2767 << ", pri=" << priority1rise
2768 << ", sec=" << priority2rise
2769 << ", hitPos=" << hitPosition
2770 << ", (clk-tmpCTime)=" << (ct - tmpCTime)
2771 << endl;
2772 }
2773 }
2775 }
2776
2777 if (TRGDebug::level()) {
2778 vector<int> sc = resultT->stateChanges();
2779 vector<unsigned> lv;
2780 for (unsigned i = 0; i < sc.size(); i++) {
2781 //...LUT value...
2782 unsigned l = unsigned(resultT->state(sc[i]).subset(2, 2));
2783 lv.push_back(l);
2784 cout << "clk=" << sc[i] << " LUT output[" << i << "]=" << l << endl;
2785 }
2786 bool found1or2 = false;
2787 bool found3 = false;
2788 for (unsigned i = 0; i < lv.size(); i++) {
2789 if (found1or2 && (lv[i] > 0))
2790 cout << "!!! simulateTSF something wrong(found1or2)" << endl;
2791 if (found3 && (lv[i] == 3))
2792 cout << "!!! simulateTSF something wrong(found3)" << endl;
2793
2794 if ((lv[i] == 1) or (lv[i] == 2))
2795 found1or2 = true;
2796 else if (lv[i] == 3)
2797 found3 = true;
2798 }
2799 }
2800
2801 result.push_back(resultT);
2802 result.push_back(resultE);
2803
2804 // cppcheck-suppress uninitdata
2805 delete[] LUTValue;
2806 delete Hitmap;
2807
2808 return result;
2809 }

◆ simulateTSF2()

vector< TRGSignalVector * > simulateTSF2 ( TRGSignalVector in,
unsigned  id 
)

Simulate TSF response (unified version, state machine)

Definition at line 2811 of file TrackSegmentFinder.cc.

2812 {
2813
2814 //variables for common
2815 const string na = "TSF" + TRGUtilities::itostring(tsid) + " in " +
2816 name();
2817 TCSegment* tsi = _tsSL[tsid];
2818 vector <TRGSignalVector*> result;
2819
2820 //variables for EvtTime & Low pT
2821 vector<bool> fTimeVect;
2822 // int tmpFTime = 0 ;
2823
2824 //variables for Tracker & N.N
2825 TRGSignalVector* resultT = new TRGSignalVector(na, in->clock(), 13);
2826 TRGSignalVector* resultE = new TRGSignalVector(na, in->clock(), 10);
2827 TRGSignalVector* Hitmap = new TRGSignalVector(na + "HitMap",
2828 in->clock(),
2829 0);
2830 TRGSignalVector pTime(na + "PriorityTime", in->clock(), 0);
2831 TRGSignalVector fTime(na + "FastestTime", in->clock(), 0);
2832 TRGSignal* pri0 = 0;
2833 TRGSignal* pri1 = 0;
2834 TRGSignal* pri2 = 0;
2835
2836 if (_type == innerType) {
2837 for (unsigned i = 0; i < 16; i++) {
2838 Hitmap->push_back((* in)[i]);
2839 (* Hitmap)[i].widen(16);
2840 }
2841 for (unsigned i = 0; i < 4; i++) {
2842 pTime.push_back((* in)[i + 16]);
2843 fTime.push_back((* in)[i + 20]);
2844 }
2845 pri0 = & (*Hitmap)[1];
2846 pri1 = & (*Hitmap)[2];
2847 pri2 = & (*Hitmap)[3];
2848 } else {
2849 for (unsigned i = 0; i < 12; i++) {
2850 Hitmap->push_back((* in)[i]);
2851 (* Hitmap)[i].widen(16);
2852 }
2853 for (unsigned i = 0; i < 4; i++) {
2854 pTime.push_back((* in)[i + 12]);
2855 fTime.push_back((* in)[i + 16]);
2856 }
2857 pri0 = & (*Hitmap)[6];
2858 pri1 = & (*Hitmap)[7];
2859 pri2 = & (*Hitmap)[8];
2860 }
2861
2862 //...Clock counter...
2863 const TRGSignalVector& cc = in->clock().clockCounter();
2864 for (unsigned i = 0; i < 5; i++) {
2865 pTime.push_back(cc[i]);
2866 fTime.push_back(cc[i]);
2867 }
2868
2869 vector<int> changeTime = Hitmap->stateChanges();
2870
2871 vector<unsigned> luts;
2872 int lastFastHit = in->clock().min();
2873
2874 if (changeTime.size()) {
2875
2876 const string fn = "TSF::simulateTSF2:tsid=" + to_string(tsid);
2878
2879 //TRGState ft(10); //not used, should be?
2880 bool eOut = false;
2881
2882 unsigned stateHitPos = 0; // 0:wait, 1:active1st, 2:active2nd
2883 unsigned hitPos = 0;
2884 unsigned timing = 0;
2885 int timePosFound = 0;
2886 int counterPos = 0;
2887
2888 unsigned stateLR = 0; // 0:wait, 1:LUT12, 2:LUT3
2889// int timeLRFound = 0;
2890// int counterLR = 0;
2891
2892 for (unsigned i = 0; i < changeTime.size(); i++) {
2893
2894 const int ct = changeTime[i];
2895 const TRGState st = Hitmap->state(ct);
2896
2897 //...LUT...
2898 // 0:no hit, 1:right, 2:left, 3:LR unknown hit
2899 const unsigned lut = tsi->LUT()->getValue(unsigned(st));
2900 luts.push_back(lut);
2901
2902 //...Any wire hit (for the fastest timing)...
2903 const bool active = st.active();
2904 if (active) {
2905 const int timeCounter = ct - lastFastHit;
2906
2907 //...Record as the fastest timing hit...
2908 if (timeCounter > 15) {
2909 lastFastHit = ct;
2910 TRGState ftnow = fTime.state(ct);
2911 ftnow += TRGState(1, 1);
2912 //ft = ftnow;
2913 eOut = true;
2914 }
2915 }
2916
2917 // output for EvtTime & Low pT tracker module
2918 if (lut) {
2919 if (eOut) {
2920 resultE->set(fTimeVect, ct);
2921 eOut = false;
2922 }
2923 }
2924
2925 //...Hit position...
2926 const bool hit1st = pri0->riseEdge(ct);
2927 const bool hit2nd0 = pri1->riseEdge(ct);
2928 const bool hit2nd1 = pri2->riseEdge(ct);
2929 const bool hit2nd = hit2nd0 || hit2nd1;
2930
2931 //...Hit position state machine...
2932
2933 //...State : wait...
2934 if (stateHitPos == 0) {
2935 hitPos = 0;
2936 timing = 0;
2937 timePosFound = 0;
2938 if (hit1st) {
2939 hitPos = 3;
2940 timing = unsigned(pTime.state(ct));
2941 timePosFound = ct;
2942 stateHitPos = 1;
2943 } else if (hit2nd) {
2944 if ((* Hitmap)[0].state(ct))
2945 hitPos = 2;
2946 else
2947 hitPos = 1;
2948 timing = unsigned(pTime.state(ct));
2949 timePosFound = ct;
2950 stateHitPos = 2;
2951 }
2952 }
2953
2954 //...State : active1st...
2955 else if (stateHitPos == 1) {
2956 counterPos = ct - timePosFound;
2957 if (counterPos > 15)
2958 stateHitPos = 0;
2959 }
2960
2961 //...State : active2nd...
2962 else if (stateHitPos == 2) {
2963 if (hit1st) {
2964 hitPos = 3;
2965 timing = unsigned(pTime.state(ct));
2966 timePosFound = ct;
2967 stateHitPos = 1;
2968 } else {
2969 counterPos = ct - timePosFound;
2970 if (counterPos > 15)
2971 stateHitPos = 0;
2972 }
2973 }
2974
2975 //...State unknown...
2976 else {
2977 cout << "TSF::simulateTSF2 !!! strange state in hit position"
2978 << endl;
2979 }
2980
2981 //...L/R decision state machine...
2982
2983 //...State : wait...
2984 if (stateLR == 0) {
2985 if (lut != 0) {
2986 const unsigned val = (timing << 4) | (lut << 2) | hitPos;
2987 const TRGState output(13, val);
2988 resultT->set(output, ct);
2989// timeLRFound = ct;
2990 if ((lut == 1) || (lut == 2))
2991 stateLR = 1;
2992 else
2993 stateLR = 2;
2994
2995 if (TRGDebug::level()) {
2996 if (((lut == 1) || (lut == 2)) && (stateHitPos == 0))
2997 cout << TRGDebug::tab()
2998 << "!!! state machines incosistent" << endl;
2999 }
3000 }
3001 }
3002
3003 //...State : LUT12...
3004 else if (stateLR == 1) {
3005// counterLR = ct - timeLRFound;
3006 if (counterPos > 15)
3007 stateLR = 0;
3008 }
3009
3010 //...State : LUT3...
3011 else if (stateLR == 2) {
3012 if (lut) {
3013 if ((lut == 1) || (lut == 2)) {
3014 const unsigned val = (timing << 4) | (lut << 2) |
3015 hitPos;
3016 const TRGState output(13, val);
3017 resultT->set(output, ct);
3018// timeLRFound = ct;
3019 stateLR = 1;
3020 } else {
3021// counterLR = ct - timeLRFound;
3022 if (counterPos > 15)
3023 stateLR = 0;
3024 }
3025 }
3026 }
3027
3028 //...State unknown...
3029 else {
3030 cout << "TSF::simulateTSF2 !!! strange state in L/R decision"
3031 << endl;
3032 }
3033
3034 if (TRGDebug::level() > 1) {
3035 cout << TRGDebug::tab() << "clk=" << ct
3036 << ", ptn=" << st
3037 << ", LUT=" << lut
3038 << ", pri=" << hit1st
3039 << ", sec=" << hit2nd
3040 << ", hPos=" << hitPos
3041 << ", ctr=" << counterPos // << "," << counterLR
3042 << ", states=" << stateHitPos << "," << stateLR
3043 << endl;
3044 }
3045 }
3047 }
3048
3049 if (TRGDebug::level()) {
3050 vector<int> sc = resultT->stateChanges();
3051 vector<unsigned> lv;
3052 for (unsigned i = 0; i < sc.size(); i++) {
3053 //...LUT value...
3054 unsigned l = unsigned(resultT->state(sc[i]).subset(2, 2));
3055 lv.push_back(l);
3056 cout << "clk=" << sc[i] << " LUT output[" << i << "]=" << l << endl;
3057 }
3058 }
3059
3060 result.push_back(resultT);
3061 result.push_back(resultE);
3062
3063 delete Hitmap;
3064
3065 return result;
3066 }

◆ simulateTSFOld()

vector< TRGSignalVector * > simulateTSFOld ( TRGSignalVector in,
unsigned  id 
)

Simulate TSF response (unified version)

output for EvtTime & Low pT tracker module

output for Tracker & N.N

Definition at line 2421 of file TrackSegmentFinder.cc.

2422 {
2423
2424 //variables for common
2425 const string na = "TSF" + TRGUtilities::itostring(tsid) + " in " +
2426 name();
2427 TCSegment* tsi = _tsSL[tsid];
2428 vector <TRGSignalVector*> result;
2429
2430 //variables for EvtTime & Low pT
2431 vector<bool> fTimeVect;
2432 // int tmpFTime = 0 ;
2433
2434 //variables for Tracker & N.N
2435 vector <bool> tmpOutBool;
2436
2437 //iwTRGSignalVector* resultT = new TRGSignalVector(na, in->clock(),22);
2438 TRGSignalVector* resultT = new TRGSignalVector(na, in->clock(), 13);
2439 TRGSignalVector* resultE = new TRGSignalVector(na, in->clock(), 10);
2440 TRGSignalVector* Hitmap = new TRGSignalVector(na + "HitMap", in->clock(), 0);
2441 TRGSignalVector pTime(na + "PriorityTime", in->clock(), 0);
2442 TRGSignalVector fTime(na + "FastestTime", in->clock(), 0);
2443 TRGSignal* pri0 = 0;
2444 TRGSignal* pri1 = 0;
2445 TRGSignal* pri2 = 0;
2446 if (_type == innerType) {
2447 for (unsigned i = 0; i < 16; i++) {
2448 Hitmap->push_back((* in)[i]);
2449 (* Hitmap)[i].widen(16);
2450 }
2451 for (unsigned i = 0; i < 4; i++) {
2452 pTime.push_back((* in)[i + 16]);
2453 fTime.push_back((* in)[i + 20]);
2454 }
2455 pri0 = & (*Hitmap)[1];
2456 pri1 = & (*Hitmap)[2];
2457 pri2 = & (*Hitmap)[3];
2458 } else {
2459 for (unsigned i = 0; i < 12; i++) {
2460 Hitmap->push_back((* in)[i]);
2461 (* Hitmap)[i].widen(16);
2462 }
2463 for (unsigned i = 0; i < 4; i++) {
2464 pTime.push_back((* in)[i + 12]);
2465 fTime.push_back((* in)[i + 16]);
2466 }
2467 pri0 = & (*Hitmap)[6];
2468 pri1 = & (*Hitmap)[7];
2469 pri2 = & (*Hitmap)[8];
2470 }
2471
2472 //...Clock counter...
2473 const TRGSignalVector& cc = in->clock().clockCounter();
2474 for (unsigned i = 0; i < 5; i++) {
2475 pTime.push_back(cc[i]);
2476 fTime.push_back(cc[i]);
2477 }
2478
2479 vector <int> changeTime = Hitmap->stateChanges();
2480
2481 int* LUTValue = new int[changeTime.size()];
2482 if (changeTime.size()) {
2483
2484 const string fn = "TSF::simulateTSF:tsid=" + to_string(tsid);
2486
2487 int hitPosition = 0;
2488 bool fTimeBool[10];
2489 int tmpPTime = 0 ;
2490 int tmpCTime = 0 ;
2491 int tmpOutInt;
2492 fTime.state(changeTime[0]).copy2bool(fTimeBool);
2493 fTimeBool[9] = true;
2494 fTimeVect.insert(fTimeVect.begin(), fTimeBool, fTimeBool + 10);
2495 //tmpFTime = mkint(fTime.state(changeTime[0]));
2496 bool eOUT = true;
2497 for (unsigned i = 0; i < changeTime.size(); i++) {
2498 int ct = changeTime[i];
2499
2500// LUTValue[i] = tsi->LUT()->getValue(mkint(Hitmap->state(ct)));
2501 LUTValue[i] = tsi->LUT()->getValue(unsigned(Hitmap->state(ct)));
2502
2504 if ((LUTValue[i]) && (eOUT)) {
2505 resultE->set(fTimeVect, ct);
2506 eOUT = false;
2507 }
2508
2509 bool priority1rise = pri0->riseEdge(ct);
2510 bool priority2rise = pri1->riseEdge(ct) or pri2->riseEdge(ct);
2511
2513 //ready for output
2514 if (priority1rise) {
2515 hitPosition = 3;
2516// tmpPTime = mkint(pTime.state(ct));
2517 tmpPTime = unsigned(pTime.state(ct));
2518 tmpCTime = ct;
2519 } else if (priority2rise) {
2520 if (!hitPosition) {
2521// tmpPTime = mkint(pTime.state(ct));
2522 tmpPTime = unsigned(pTime.state(ct));
2523 tmpCTime = ct;
2524 if ((*Hitmap)[0].state(ct)) hitPosition = 2;
2525 else hitPosition = 1;
2526 }
2527 }
2528
2529 // output selection
2530 if ((hitPosition) && (LUTValue[i]) && ((ct - tmpCTime) < 16)) {
2531 tmpOutInt = tmpPTime * pow(2, 4) +
2532 LUTValue[i] * pow(2, 2) + hitPosition;
2533 tmpOutBool = mkbool(tmpOutInt, 13); // ID removed : iw
2534
2535 if (hitPosition == 3) {
2536 if (priority1rise) {
2537 resultT->set(tmpOutBool, ct);
2538 } else {
2539 if ((LUTValue[i] == 1) | (LUTValue[i] == 2)) {
2540 if (!((LUTValue[i - 1] == 1) |
2541 (LUTValue[i - 1] == 2)))
2542 resultT->set(tmpOutBool, ct);
2543 } else {
2544 if (!(LUTValue[i - 1])) resultT->set(tmpOutBool, ct);
2545 }
2546 }
2547 } else {
2548 if (priority2rise) resultT->set(tmpOutBool, ct);
2549 else {
2550 if ((LUTValue[i] == 1) | (LUTValue[i] == 2)) {
2551 if (!((LUTValue[i - 1] == 1) |
2552 (LUTValue[i - 1] == 2)))
2553 resultT->set(tmpOutBool, ct);
2554 } else {
2555 if (!(LUTValue[i])) resultT->set(tmpOutBool, ct);
2556 }
2557 }
2558 }
2559 }
2560
2561 if (TRGDebug::level() > 1) {
2562 cout << TRGDebug::tab() << "clk=" << ct
2563 << ", pattern=" << Hitmap->state(ct)
2564 << ", LUT=" << LUTValue[i]
2565 << ", pri=" << priority1rise
2566 << ", sec=" << priority2rise
2567 << ", hitPos=" << hitPosition
2568 << ", (clk-tmpCTime)=" << (ct - tmpCTime)
2569 << endl;
2570 }
2571 }
2572
2574 }
2575
2576 result.push_back(resultT);
2577 result.push_back(resultE);
2578
2579 // cppcheck-suppress uninitdata
2580 delete[] LUTValue;
2581 delete Hitmap;
2582
2583 return result;
2584 }

◆ simulateWithClock()

void simulateWithClock ( std::string  cdcCollectionName,
std::string  tsCollectionName 
)

simulates TF hit time-dependently

Definition at line 291 of file Segment.cc.

292 {
293 // check LUT pattern without clock -> if there is no hit, skip clock simulation
294 if (m_TSLUT->getValue(lutPattern()) == 0) return;
295
296 TRGDebug::enterStage("TS sim with clock");
297
298 StoreArray<CDCHit> cdcHits(cdcCollectionName);
299 StoreArray<CDCTriggerSegmentHit> segmentHits(tsCollectionName);
300
301 // get data clock of first and last hit
302 const TRGClock& wireClock = _wires[0]->signal().clock();
303 int clkMin = 1000;
304 int clkMax = -1000;
305 for (unsigned i = 0, n = _wires.size(); i < n; ++i) {
306 const TRGSignal& s = _wires[i]->signal();
307 if (s.active()) {
308 int clk0 = s[0]->time();
309 int clk1 = s[s.nEdges() - 2]->time();
310 if (clk0 < clkMin) clkMin = clk0;
311 if (clk1 > clkMax) clkMax = clk1;
312 }
313 }
314 // loop over data clock cycles
315 //const int step = wireClock.frequency() / TRGCDC::getTRGCDC()->dataClock().frequency();
316 const int step = wireClock.frequency() / signal().clock().frequency();
317 const int width = 16 * step;
318 clkMin -= clkMin % step;
319 clkMax -= clkMax % step;
320 int lastLutValue = 0;
321 int lastPriority = 0;
322 int lastFastest = 0;
323 for (int iclk = clkMin; iclk <= clkMax; iclk += step) {
324 // check pattern in the last width clock cycles
325 unsigned pattern = lutPattern(iclk - width, iclk + step);
326 int lutValue = m_TSLUT->getValue(pattern);
327 if (lutValue) {
328 int priorityPos = priorityPosition(iclk - width, iclk + step);
329 int fastest = fastestTime(iclk - width);
330 // make a new hit if L/R changes to known, if priority changes to first
331 // or if the fastest hit changes
332 if ((lastLutValue == 3 && lutValue != 3) ||
333 (lastPriority != 3 && priorityPos == 3) ||
334 fastest != lastFastest) {
335 // add new edge to signal
336 TRGTime rise = TRGTime(wireClock.absoluteTime(iclk), true, _signal.clock());
337 TRGTime fall = rise;
338 fall.shift(1).reverse();
339 _signal |= TRGSignal(rise & fall);
340 // get priority wire from position flag
341 int ipr = (priorityPos == 3) ? 0 : priorityPos;
342 const TRGCDCWire* priorityWire = (_wires.size() == 15) ? _wires[ipr] : _wires[ipr + 5];
343 // get priority time (first hit on priority wire in time window)
344 int tdc = priorityWire->signal()[0]->time();
345 if (tdc < iclk - width) {
346 for (unsigned itdc = 2, edges = priorityWire->signal().nEdges(); itdc < edges; itdc += 2) {
347 tdc = priorityWire->signal()[itdc]->time();
348 if (tdc >= iclk - width) break;
349 }
350 }
351 // create hit
352 const CDCHit* priorityHit = cdcHits[priorityWire->hit()->iCDCHit()];
353 const CDCTriggerSegmentHit* storeHit =
354 segmentHits.appendNew(*priorityHit,
355 id(),
356 priorityPos,
357 lutValue,
358 tdc,
359 fastest,
360 iclk + step);
361 addStoreHit(storeHit);
362 // relation to all CDCHits in segment
363 for (unsigned iw = 0; iw < _wires.size(); ++iw) {
364 if (_wires[iw]->signal().active(iclk - width, iclk + step)) {
365 // priority wire has relation weight 2
366 double weight = (_wires[iw] == priorityWire) ? 2. : 1.;
367 storeHit->addRelationTo(cdcHits[_wires[iw]->hit()->iCDCHit()], weight);
368 }
369 }
370 // relation to MCParticles (same as priority hit)
371 RelationVector<MCParticle> mcrel = priorityHit->getRelationsFrom<MCParticle>();
372 for (unsigned imc = 0; imc < mcrel.size(); ++imc) {
373 mcrel[imc]->addRelationTo(storeHit, mcrel.weight(imc));
374 }
375 // store values of this hit to compare with the next hit
376 lastLutValue = lutValue;
377 lastPriority = priorityPos;
378 lastFastest = fastest;
379 }
380 }
381 }
382
383 TRGDebug::leaveStage("TS sim with clock");
384 }
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
float fastestTime(void) const
return fastest time in TSHit.
Definition: Segment.cc:387
void addStoreHit(const CDCTriggerSegmentHit *)
sets a pointer to a CDCTriggerSegmentHit.
Definition: Segment.h:244
int getValue(unsigned) const
get LUT Values
Definition: LUT.cc:47
unsigned iCDCHit(void) const
returns an index to CDCHit.
Definition: CellHit.h:360
double frequency(void) const
returns frequency in MHz.
Definition: Clock.h:187

◆ simulateWithoutClock()

void simulateWithoutClock ( bool  logicLUTFlag)

simulates time-indegrated TF hit

Definition at line 176 of file Segment.cc.

177 {
178 TRGDebug::enterStage("TS sim");
179
180 //...Get wire informtion...
181 const unsigned n = _wires.size();
182 unsigned nHits = 0;
183 vector<TRGSignal> signals;
184 for (unsigned i = 0; i < n; i++) {
185
186 //...Store wire hit information...
187 const TCWHit* h = _wires[i]->hit();
188 if (h)
189 _hits.push_back(h);
190
191 //...Copy signal from a wire...
192 const TRGSignal& s = _wires[i]->signal();
193 signals.push_back(s);
194
195 //...Widen it...
196 const unsigned width = signals.back().clock().unit(1000);
197 signals.back().widen(width);
198
199 if (s.active())
200 ++nHits;
201 }
202
203 if (logicLUTFlag == 0) {
205 //...Check number of hit wires...
206 //cout<<"TSF: nHits is "<<nHits<<endl;
207 if (nHits < 4) {
208 TRGDebug::leaveStage("TS sim");
209 return;
210 }
211
212 //...Signal simulation...
213 TRGSignal l0, l1, l2, l3, l4;
214 TRGSignal wo1, wo2, wo3, wo4;
215 TRGSignal all;
216 if (n == 11) {
217
218 //...Simple simulation assuming 3:2:1:2:3 shape...
219 l0 = signals[0] | signals[1] | signals[2];
220 l1 = signals[3] | signals[4];
221 l2 = signals[5];
222 l3 = signals[6] | signals[7];
223 l4 = signals[8] | signals[9] | signals[10];
224 //l0.dump();
225 //l1.dump();
226 //l2.dump();
227 //l3.dump();
228 //l4.dump();
229 wo1 = l1 & l3 & l4;
230 wo2 = l0 & l3 & l4;
231 wo3 = l0 & l1 & l4;
232 wo4 = l0 & l1 & l3;
233 all = l2 & (wo1 | wo2 | wo3 | wo4);
234
235 } else if (n == 15) {
236
237 //...Simple simulation assuming 1:2:3:4:5 shape...
238 l0 = signals[0];
239 l1 = signals[1] | signals[2];
240 l2 = signals[3] | signals[4] | signals[5];
241 l3 = signals[6] | signals[7] | signals[8] | signals[9];
242 l4 = signals[10] | signals[11] | signals[12] | signals[13] | signals[14];
243 wo1 = l2 & l3 & l4;
244 wo2 = l1 & l3 & l4;
245 wo3 = l1 & l2 & l4;
246 wo4 = l1 & l2 & l3;
247 all = l0 & (wo1 | wo2 | wo3 | wo4);
248 }
249
250 //...Coincidence of all layers...
251// TRGSignal all = l0 & l1 & l2 & l3 & l4;
252
253 if (all.nEdges()) {
254 //cout<<"TSF is found"<<endl;
255 all.name(name());
256 _signal = all;
257 //cout<<all.name()<<":#signals="<<all.nSignals()<<endl;;
258 //all.dump();
259 }
261 }
262
263 if (logicLUTFlag == 1) {
265 //... Find hit wires ...
266 vector<TRGSignal> hitSignals;
267 for (unsigned iWire = 0; iWire < signals.size(); iWire++) {
268 if (signals[iWire].active()) hitSignals.push_back(signals[iWire]);
269 }
270 //... Coincidence all hit wires ...
271 TRGSignal allSignals;
272 if (hitSignals.size() != 0) {
273 allSignals = hitSignals[0];
274 for (unsigned iHitWire = 1; iHitWire < hitSignals.size(); iHitWire++) {
275 allSignals = allSignals & hitSignals[iHitWire];
276 }
277 }
278
279 int lutValue = LUT()->getValue(lutPattern());
280 if ((lutValue != 0) && (priority().signal().active() != 0)) {
281 allSignals.name(name());
282 _signal = allSignals;
283 }
285 }
286
287 TRGDebug::leaveStage("TS sim");
288 }

◆ sinPhi0()

double sinPhi0 ( void  ) const
inline

returns sin(phi0).

Definition at line 363 of file Helix.h.

364 {
365 return m_sp;
366 }

◆ size() [1/2]

unsigned size ( void  ) const
inline

returns size of stream in unit of bit.

Definition at line 150 of file BitStream.h.

151 {
152 return _size;
153 }

◆ size() [2/2]

unsigned size ( void  ) const
inline

returns bit size.

Definition at line 149 of file State.h.

150 {
151 return _size;
152 }

◆ sizeInChar()

unsigned sizeInChar ( void  ) const
inline

returns size in char's.

Definition at line 177 of file BitStream.h.

178 {
179 unsigned s = _size / 8;
180 if (_size % 8)
181 ++s;
182 return s;
183 }

◆ slvToSigned() [1/2]

TRGCDCJSignal const slvToSigned ( TRGCDCJSignal const &  in)
static

Change slv to signed.

Definition at line 1076 of file JSignal.cc.

1077 {
1078 return slvToSigned(in, in.m_toReal, in.m_minInt, in.m_maxInt, in.m_actual, in.m_minActual, in.m_maxActual, in.m_finishClock);
1079 }
static TRGCDCJSignal const slvToSigned(TRGCDCJSignal const &in, double const &toReal, signed long long const &minInt, signed long long const &maxInt, double const &actual, double const &minActual, double const &maxActual, int const &finishClock)
Change slv to signed with target clock.
Definition: JSignal.cc:1040

◆ slvToSigned() [2/2]

TRGCDCJSignal const slvToSigned ( TRGCDCJSignal const &  in,
double const &  toReal,
signed long long const &  minInt,
signed long long const &  maxInt,
double const &  actual,
double const &  minActual,
double const &  maxActual,
int const &  finishClock 
)
static

Change slv to signed with target clock.

Definition at line 1040 of file JSignal.cc.

1042 {
1043
1044 vector<bool> const& slv = in.m_slv;
1045
1046 // Check input
1047 if (in.m_type != 2) cout << "[Error] TRGCDCJSignal::slvToSigned() => type is not slv." << endl;
1048 if (slv.size() > 63) cout << "[Error] TRGCDCJSignal::slvToSigned() => bitwidth is too large." << endl;
1049
1050 TRGCDCJSignal result(in);
1051
1052 // Calculate value. [Index 0 is lsb]
1053 result.m_int = 0;
1054 for (unsigned iBit = 0; iBit < slv.size() - 1; iBit++) {
1055 result.m_int += slv[iBit] * pow(2, iBit);
1056 }
1057 result.m_int -= slv[slv.size() - 1] * pow(2, slv.size() - 1);
1058 // Set values.
1059 result.m_minInt = minInt;
1060 result.m_maxInt = maxInt;
1061 result.m_actual = actual;
1062 result.m_minActual = minActual;
1063 result.m_maxActual = maxActual;
1064 result.m_toReal = toReal;
1065 result.m_type = 0;
1066 result.m_type = result.calType();
1067 result.m_bitsize = result.calBitwidth();
1068 result.m_finishClock = finishClock;
1069 // Check if there is overflow or underflow.
1070 result.checkInt("slvToSigned");
1071 result.m_commonData = in.m_commonData;
1072
1073 return result;
1074 }

◆ slvToUnsigned() [1/2]

TRGCDCJSignal const slvToUnsigned ( TRGCDCJSignal const &  in)
static

Change slv to unsigned with target clock.

Definition at line 1116 of file JSignal.cc.

1117 {
1118 return slvToUnsigned(in, in.m_toReal, in.m_minInt, in.m_maxInt, in.m_actual, in.m_minActual, in.m_maxActual, in.m_finishClock);
1119 }
static TRGCDCJSignal const slvToUnsigned(TRGCDCJSignal const &in, double const &toReal, signed long long const &minInt, signed long long const &maxInt, double const &actual, double const &minActual, double const &maxActual, int const &finishClock)
Change slv to unsigned with target clock.
Definition: JSignal.cc:1081

◆ slvToUnsigned() [2/2]

TRGCDCJSignal const slvToUnsigned ( TRGCDCJSignal const &  in,
double const &  toReal,
signed long long const &  minInt,
signed long long const &  maxInt,
double const &  actual,
double const &  minActual,
double const &  maxActual,
int const &  finishClock 
)
static

Change slv to unsigned with target clock.

Definition at line 1081 of file JSignal.cc.

1083 {
1084
1085 vector<bool> const& slv = in.m_slv;
1086
1087 // Check input
1088 if (in.m_type != 2) cout << "[Error] TRGCDCJSignal::slvToUnsigned() => type is not slv." << endl;
1089 if (slv.size() > 63) cout << "[Error] TRGCDCJSignal::slvToUnsigned() => bitwidth is too large." << endl;
1090
1091 TRGCDCJSignal result(in);
1092
1093 // Calculate value. [Index 0 is lsb]
1094 result.m_int = 0;
1095 for (unsigned iBit = 0; iBit < slv.size(); iBit++) {
1096 result.m_int += slv[iBit] * pow(2, iBit);
1097 }
1098 // Set values.
1099 result.m_minInt = minInt;
1100 result.m_maxInt = maxInt;
1101 result.m_actual = actual;
1102 result.m_minActual = minActual;
1103 result.m_maxActual = maxActual;
1104 result.m_toReal = toReal;
1105 result.m_type = 0;
1106 result.m_type = result.calType();
1107 result.m_bitsize = result.calBitwidth();
1108 result.m_finishClock = finishClock;
1109 // Check if there is overflow or underflow.
1110 result.checkInt("slvToSigned");
1111 result.m_commonData = in.m_commonData;
1112
1113 return result;
1114 }

◆ solve_lambda()

double solve_lambda ( void  )
private

private member function solve_lambda

Definition at line 282 of file Lpav.cc.

283 {
284 if (m_rscale <= 0) return -1;
285 double xrrxrr = m_xrravp * m_xrravp;
286 double yrryrr = m_yrravp * m_yrravp;
287 double rrrrm1 = m_rrrravp - 1;
288 double xxyy = m_xxavp * m_yyavp;
289
290 double c0 = rrrrm1 * xxyy - xrrxrr * m_yyavp - yrryrr * m_xxavp;
291 double c1 = - rrrrm1 + xrrxrr + yrryrr - 4 * xxyy;
292 double c2 = 4 + rrrrm1 - 4 * xxyy;
293 double c4 = - 4;
294//
295//C COEFFICIENTS OF THE DERIVATIVE - USED IN NEWTON-RAPHSON ITERATIONS
296//
297 double c2d = 2 * c2;
298 double c4d = 4 * c4;
299//
300 double lambda = 0;
301
302 double chiscl = m_wsum_temp * m_rscale * m_rscale;
303 double dlamax = 0.001 / chiscl;
304 const int ntry = 5;
305 int itry = 0;
306 double dlambda = dlamax;
307 while (itry < ntry && std::fabs(dlambda) >= dlamax) {
308 double cpoly = c0 + lambda * (c1 + lambda *
309 (c2 + lambda * lambda * c4));
310 double dcpoly = c1 + lambda * (c2d + lambda * lambda * c4d);
311 dlambda = - cpoly / dcpoly;
312 lambda += dlambda;
313 itry ++;
314 }
315 lambda = lambda < 0 ? 0 : lambda;
316 return lambda;
317 }

◆ solve_lambda3()

double solve_lambda3 ( void  )
private

private member function solve_lambda3

Definition at line 319 of file Lpav.cc.

320 {
321 if (m_rscale <= 0) return -1;
322 double xrrxrr = m_xrravp * m_xrravp;
323 double yrryrr = m_yrravp * m_yrravp;
324//cnv double rrrrm1 = m_rrrravp - 1;
325//cnv double xxyy = m_xxavp * m_yyavp;
326
327 double a = m_rrrravp;
328 double b = xrrxrr + yrryrr - m_rrrravp * (m_xxavp + m_yyavp);
329 double c = m_rrrravp * m_xxavp * m_yyavp
330 - m_yyavp * xrrxrr - m_xxavp * yrryrr
332 if (c >= 0 && b <= 0) {
333 return (-b - std::sqrt(b * b - 4 * a * c)) / 2 / a;
334 } else if (c >= 0 && b > 0) {
335 std::cout << " returning " << -1 << std::endl;
336 return -1;
337 } else if (c < 0) {
338 return (-b + std::sqrt(b * b - 4 * a * c)) / 2 / a;
339 }
340 return -1;
341 }

◆ sort()

void sort ( void  )
private

Sort operation.

Definition at line 442 of file Signal.cc.

443 {
444 std::sort(_history.begin(), _history.end(), TRGTime::sortByTime);
445
446#if TRG_DEBUG
448#endif
449 }

◆ sortById() [1/3]

int sortById ( const TRGCDCCellHit **  a,
const TRGCDCCellHit **  b 
)
static

Sort function.

Definition at line 122 of file CellHit.cc.

123 {
124 if ((* a)->_cell.id() > (* b)->_cell.id())
125 return 1;
126 else if ((* a)->_cell.id() == (* b)->_cell.id())
127 return 0;
128 else
129 return -1;
130 }

◆ sortById() [2/3]

bool sortById ( const TRGCDCLink a,
const TRGCDCLink b 
)
static

sorts by ID.

Definition at line 471 of file Link.cc.

472 {
473 return a->cell()->id() < b->cell()->id();
474 }

◆ sortById() [3/3]

int sortById ( const TRGCDCSegmentHit **  a,
const TRGCDCSegmentHit **  b 
)
static

Sorting funnction.

Definition at line 59 of file SegmentHit.cc.

61 {
62 if ((* a)->cell().id() > (* b)->cell().id())
63 return 1;
64 else if ((* a)->cell().id() == (* b)->cell().id())
65 return 0;
66 else
67 return -1;
68 }

◆ sortByTime()

bool sortByTime ( const TRGTime a,
const TRGTime b 
)
static

returns true if a is older than b.

Definition at line 107 of file Time.cc.

108 {
109 if (a.time() < b.time()) {
110 return true;
111 } else if (a.time() == b.time()) {
112 if (a.edge() and (! b.edge()))
113 return true;
114 else if (a.edge() == b.edge())
115 return true;
116 }
117 return false;
118 }

◆ sortByWireId()

int sortByWireId ( const TRGCDCWireHit **  a,
const TRGCDCWireHit **  b 
)
static

Sort function. This will be removed.

Definition at line 66 of file WireHit.cc.

68 {
69 if ((* a)->cell().id() > (* b)->cell().id())
70 return 1;
71 else if ((* a)->cell().id() == (* b)->cell().id())
72 return 0;
73 else
74 return -1;
75 }

◆ sortByX()

int sortByX ( const TRGCDCLink a,
const TRGCDCLink b 
)
static

sorts by X position.

Definition at line 477 of file Link.cc.

478 {
479 return a->position().x() < b->position().x();
480 }

◆ state() [1/8]

bool state ( int  clockPosition) const
inline

returns true if signal is active in given clock position.

Definition at line 286 of file Signal.h.

287 {
288 if (_history.size()) {
289 bool last = false;
290 for (unsigned i = 0; i < _history.size(); i++) {
291 if (_history[i].time() <= a)
292 last = _history[i].edge();
293 else if (_history[i].time() > a)
294 break;
295 }
296 return last;
297 }
298 return false;
299
300 }

◆ state() [2/8]

TRGState state ( int  clockPosition) const

returns state at given clock position.

Definition at line 246 of file SignalBundle.cc.

247 {
248 TRGState s;
249 const unsigned n = size();
250 for (unsigned i = 0; i < n; i++) {
251 TRGState t = (* this)[i]->state(clockPosition);
252 s += t;
253 }
254 return s;
255 }

◆ state() [3/8]

TRGState state ( int  clockPosition) const

returns state at given clock position.

Definition at line 158 of file SignalVector.cc.

159 {
160 std::vector<bool> list;
161 const unsigned n = size();
162 for (unsigned i = 0; i < n; i++)
163 list.push_back((* this)[i].state(clockPosition));
164 return TRGState(list);
165 }

◆ state() [4/8]

unsigned state ( unsigned  newState)
inline

sets state.

Definition at line 249 of file Cell.h.

250 {
251 return _state = a;
252 }

◆ state() [5/8]

unsigned state ( unsigned  newState)
inline

sets state. Meaning of bits are written below.

Definition at line 303 of file CellHit.h.

304 {
305 return _state = i;
306 }

◆ state() [6/8]

unsigned state ( unsigned  newState) const
inline

sets state. Meaning of bits are written below. (tmp)

Definition at line 310 of file CellHit.h.

311 {
312 return _state = i;
313 }

◆ state() [7/8]

unsigned state ( void  ) const
inline

returns state.

Definition at line 242 of file Cell.h.

243 {
244 return _state;
245 }

◆ state() [8/8]

unsigned state ( void  ) const
inline

returns state.

Definition at line 259 of file CellHit.h.

260 {
261 return _state;
262 }

◆ stateChanges() [1/3]

std::vector< int > stateChanges ( void  ) const

returns a list of clock position of state change.

Definition at line 349 of file Signal.cc.

350 {
351 std::vector<int> list;
352 const unsigned n = _history.size();
353 for (unsigned i = 0; i < n; i++)
354 list.push_back(_history[i].time());
355 return list;
356 }

◆ stateChanges() [2/3]

std::vector< int > stateChanges ( void  ) const

returns a list of clock position of state change.

Definition at line 211 of file SignalBundle.cc.

212 {
213
214 //...List for clock positions...
215 std::vector<int> list;
216
217 //...Pick up all clock points with state changes...
218 const unsigned n = size();
219 for (unsigned i = 0; i < n; i++) {
220 vector<int> a = (* this)[i]->stateChanges();
221 for (unsigned j = 0; j < a.size(); j++)
222 list.push_back(a[j]);
223 }
224
225 //...Append the first clock point if there are state changes...
226 if (list.size())
227 list.push_back(_clock->min());
228
229 //...Sorting...
230 std::sort(list.begin(), list.end());
231
232 //...Remove duplicated clock...
233 std::vector<int> list2;
234 int last = numeric_limits<int>::min();
235 for (unsigned i = 0; i < list.size(); i++) {
236 const int j = list[i];
237 if (j != last) {
238 list2.push_back(j);
239 last = j;
240 }
241 }
242 return list2;
243 }

◆ stateChanges() [3/3]

std::vector< int > stateChanges ( void  ) const

returns a list of clock position of state change.

Definition at line 130 of file SignalVector.cc.

131 {
132 std::vector<int> list;
133 const unsigned n = size();
134 for (unsigned i = 0; i < n; i++) {
135 vector<int> a = (* this)[i].stateChanges();
136 for (unsigned j = 0; j < a.size(); j++)
137 list.push_back(a[j]);
138 }
139
140 //...Sorting...
141 std::sort(list.begin(), list.end());
142
143 //...Remove duplicated clock...
144 std::vector<int> list2;
145 int last = numeric_limits<int>::min();
146 for (unsigned i = 0; i < list.size(); i++) {
147 const int j = list[i];
148 if (j != last) {
149 list2.push_back(j);
150 last = j;
151 }
152 }
153
154 return list2;
155 }

◆ status() [1/2]

int status ( void  ) const
inline

returns status.

Definition at line 199 of file TrackBase.h.

200 {
201 return _status;
202 }

◆ status() [2/2]

int status ( void  ) const
inline

returns status.

Definition at line 122 of file TrackMC.h.

123 {
124//cnv return _hep->m_isthep;
125 return 0;
126 }

◆ stereo() [1/2]

bool stereo ( void  ) const
inline

returns true if this wire is in a stereo layer.

Definition at line 263 of file Cell.h.

264 {
265 return _layer.stereo();
266 }
bool stereo(void) const
returns true if this is a stereo layer.
Definition: Layer.h:209

◆ stereo() [2/2]

bool stereo ( void  ) const
inline

returns true if this is a stereo layer.

Definition at line 209 of file Layer.h.

210 {
211 if (_nShifts) return true;
212 return false;
213 }

◆ stereoHits() [1/2]

vector< TRGCDCLink * > stereoHits ( const std::vector< TRGCDCLink * > &  links)
static

returns stereo hits.

Definition at line 397 of file Link.cc.

398 {
399 vector<TRGCDCLink*> a;
400 unsigned n = links.size();
401 for (unsigned i = 0; i < n; i++) {
402 if (! links[i]->cell()->axial())
403 a.push_back(links[i]);
404 }
405 return a;
406 }

◆ stereoHits() [2/2]

vector< const TCWHit * > stereoHits ( void  ) const

returns a list of stereo hits.

'update()' must be called before calling this function.

Definition at line 1692 of file TRGCDC.cc.

1693 {
1694 vector<const TCWHit*> t;
1695 t.assign(_stereoHits.begin(), _stereoHits.end());
1696 return t;
1697
1698 // if (! mask) return _stereoHits;
1699 // else if (mask == CellHitFindingValid) return _stereoHits;
1700 // cout << "TRGCDC::stereoHits !!! unsupported mask given" << endl;
1701 // return _stereoHits;
1702 }

◆ stereoSegment()

const TRGCDCSegment & stereoSegment ( unsigned  lyrId,
unsigned  id 
) const
inline

returns a track segment in stereo layers. (lyrId is stereo #)

Definition at line 947 of file TRGCDC.h.

948 {
949 return * _tsSL[a * 2 + 1][b];
950 }

◆ stereoSegmentHits()

std::vector< const TRGCDCSegmentHit * > stereoSegmentHits ( unsigned  a) const
inline

returns a list of TRGCDCSegmentHit in a stereo super layer N.

'simulate()' must be called before calling this function

Definition at line 1023 of file TRGCDC.h.

1024 {
1025 std::vector<const TRGCDCSegmentHit*> t;
1026 t.assign(_segmentHitsSL[a * 2 + 1].begin(),
1027 _segmentHitsSL[a * 2 + 1].end());
1028 return t;
1029 }

◆ stereoType()

const std::string stereoType ( void  ) const
inline

returns "A" or "U" or "V" depending on stereo type.

Definition at line 238 of file Layer.h.

239 {
240 if (axial())
241 return "A";
242 else if (nShifts() > 0)
243 return "U";
244 else
245 return "V";
246 }
int nShifts(void) const
returns shifts. (non-zero for stereo layers)
Definition: Layer.h:187

◆ storeHits()

const std::vector< const CDCTriggerSegmentHit * > storeHits ( void  ) const
inline

returns a pointer to a CDCTriggerSegmentHit.

Definition at line 251 of file Segment.h.

252 {
253 return _storeHits;
254 }

◆ storeSimulationResults()

void storeSimulationResults ( std::string  collection2Dfinder,
std::string  collection2Dfitter,
std::string  collection3Dfitter 
)
private

Save results of fast simulation to data store (segment hits & tracks).

Parameters
collection2Dfindername of the StoreArray for the 2D finder tracks
collection2Dfittername of the StoreArray for the 2D fitter tracks
collection3Dfittername of the StoreArray for the 3D fitter tracks

Definition at line 2248 of file TRGCDC.cc.

2251 {
2252 TRGDebug::enterStage("TRGCDC storeSimulationResults");
2253
2254 // hits
2255 if (!(_fastSimulationMode & 2)) {
2256 StoreArray<CDCTriggerSegmentHit> storeSegmentHits;
2257 StoreArray<CDCHit> cdcHits(_cdchitCollectionName);
2258 for (unsigned its = 0; its < _segmentHits.size(); ++its) {
2259 const TCSHit* segmentHit = _segmentHits[its];
2260 const CDCHit* priorityHit = cdcHits[segmentHit->iCDCHit()];
2261 const TCSegment* segment = static_cast<const TCSegment*>(&segmentHit->cell());
2262 const CDCTriggerSegmentHit* storeHit =
2263 storeSegmentHits.appendNew(*priorityHit,
2264 segment->id(),
2269 segment->foundTime());
2270 _tss[segment->id()]->addStoreHit(storeHit);
2271 // relation to all CDCHits in segment
2272 for (unsigned iw = 0; iw < segment->wires().size(); ++iw) {
2273 const TRGCDCWire* wire = (TRGCDCWire*)(*segment)[iw];
2274 if (wire->signal().active()) {
2275 // priority wire has relation weight 2
2276 double weight = (wire == &(segment->priority())) ? 2. : 1.;
2277 storeHit->addRelationTo(cdcHits[wire->hit()->iCDCHit()], weight);
2278 }
2279 }
2280 // relation to MCParticles (same as priority hit)
2281 RelationVector<MCParticle> mcrel = priorityHit->getRelationsFrom<MCParticle>();
2282 for (unsigned imc = 0; imc < mcrel.size(); ++imc) {
2283 mcrel[imc]->addRelationTo(storeHit, mcrel.weight(imc));
2284 }
2285 }
2286 }
2287 // event time
2288 StoreObjPtr<TRGTiming> eventTime("CDCTriggerEventTime");
2289 eventTime.construct(Const::CDC, getEventTime());
2290 // 2D finder tracks
2291 StoreArray<CDCTriggerTrack> storeTracks2Dfinder(collection2Dfinder);
2292 for (unsigned itr = 0; itr < _trackList2D.size(); ++itr) {
2293 const TCTrack* track2D = _trackList2D[itr];
2294 double phi0 = remainder(track2D->helix().phi0() + M_PI_2, 2. * M_PI);
2295 double omega = track2D->charge() / track2D->helix().radius();
2296 const CDCTriggerTrack* track =
2297 storeTracks2Dfinder.appendNew(phi0, omega, 0.);
2298 // relation to SegmentHits
2299 vector<TRGCDCLink*> links = track2D->links();
2300 for (unsigned its = 0; its < links.size(); ++its) {
2301 const TRGCDCSegment* segment = static_cast<const TRGCDCSegment*>(links[its]->cell());
2302 const vector<const CDCTriggerSegmentHit*> storeHits = segment->storeHits();
2303 for (unsigned ihit = 0; ihit < storeHits.size(); ++ihit) {
2304 track->addRelationTo(storeHits[ihit]);
2305 }
2306 }
2307 }
2308 // 2D fitter tracks
2309 StoreArray<CDCTriggerTrack> storeTracks2Dfitter(collection2Dfitter);
2310 for (unsigned itr = 0; itr < _trackList2DFitted.size(); ++itr) {
2311 const TCTrack* track2D = _trackList2DFitted[itr];
2312 if (!track2D->fitted()) continue;
2313 double phi0 = remainder(track2D->helix().phi0() + M_PI_2, 2. * M_PI);
2314 double omega = track2D->charge() / track2D->helix().radius();
2315 double chi2 = track2D->get2DFitChi2();
2316 const CDCTriggerTrack* track =
2317 storeTracks2Dfitter.appendNew(phi0, omega, chi2);
2318 // relation to SegmentHits
2319 vector<TRGCDCLink*> links = track2D->links();
2320 for (unsigned its = 0; its < links.size(); ++its) {
2321 const TRGCDCSegment* segment = static_cast<const TRGCDCSegment*>(links[its]->cell());
2322 const vector<const CDCTriggerSegmentHit*> storeHits = segment->storeHits();
2323 for (unsigned ihit = 0; ihit < storeHits.size(); ++ihit) {
2324 track->addRelationTo(storeHits[ihit]);
2325 }
2326 }
2327 // relation to 2D finder, assuming same order in tracklist
2328 if (storeTracks2Dfinder.getEntries() > 0)
2329 storeTracks2Dfinder[itr]->addRelationTo(track);
2330 }
2331 // 3D tracks
2332 StoreArray<CDCTriggerTrack> storeTracks3Dfitter(collection3Dfitter);
2333 for (unsigned itr = 0; itr < _trackList3D.size(); ++itr) {
2334 const TCTrack* track3D = _trackList3D[itr];
2335 if (!track3D->fitted()) continue;
2336 double phi0 = remainder(track3D->helix().phi0() + M_PI_2, 2. * M_PI);
2337 double omega = 1. / track3D->helix().radius();
2338 double chi2 = track3D->get2DFitChi2();
2339 double z = track3D->helix().dz();
2340 double cot = track3D->helix().tanl();
2341 double chi3 = track3D->get3DFitChi2();
2342 const CDCTriggerTrack* track =
2343 storeTracks3Dfitter.appendNew(phi0, omega, chi2, z, cot, chi3);
2344 // relation to SegmentHits
2345 vector<TRGCDCLink*> links = track3D->links();
2346 for (unsigned its = 0; its < links.size(); ++its) {
2347 const TRGCDCSegment* segment = static_cast<const TRGCDCSegment*>(links[its]->cell());
2348 const vector<const CDCTriggerSegmentHit*> storeHits = segment->storeHits();
2349 for (unsigned ihit = 0; ihit < storeHits.size(); ++ihit) {
2350 track->addRelationTo(storeHits[ihit]);
2351 }
2352 }
2353 // relation to 2D finder, assuming same order in tracklist
2354 if (storeTracks2Dfinder.getEntries() > 0)
2355 storeTracks2Dfinder[itr]->addRelationTo(track);
2356 }
2357
2358 TRGDebug::leaveStage("TRGCDC storeSimulationResults");
2359 return;
2360 }
std::string _cdchitCollectionName
name of the CDCHit DataStore array used as input
Definition: TRGCDC.h:771
const TRGCDCWireHit * hit(void) const
returns a pointer to a TRGCDCWireHit.
Definition: Wire.h:153
const std::vector< const CDCTriggerSegmentHit * > storeHits(void) const
returns a pointer to a CDCTriggerSegmentHit.
Definition: Segment.h:251
const std::vector< const TRGCDCWire * > & wires(void) const
returns a vector containing pointers to a wire.
Definition: Segment.h:198
float priorityTime(void) const
return priority time in TSHit.
Definition: Segment.cc:463
float foundTime(void) const
return found time in TSHit.
Definition: Segment.cc:423

◆ streamDisplay() [1/2]

string streamDisplay ( unsigned  val)
static

Dumps bit stream in string.

Definition at line 136 of file Utilities.cc.

137 {
138 return streamDisplay(val, 0, 63);
139 }

◆ streamDisplay() [2/2]

string streamDisplay ( unsigned  val,
unsigned  firstDigit,
unsigned  lastDigit 
)
static

Dumps bit stream in string.

Definition at line 125 of file Utilities.cc.

126 {
127 string s;
128 for (unsigned i = f; i < l + 1; i++) {
129 if ((i % 8) == 0) s += " ";
130 s += itostring((val >> i) % 2);
131 }
132 return s;
133 }

◆ sub()

void sub ( double  x,
double  y,
double  w = 1,
double  a = 0,
double  b = 0 
)
private

private member functions

private member function sub

Definition at line 641 of file Lpav.cc.

642 {
643//double wi = err_dis_inv(xi, yi, w, a, b);
644 double wi = err_dis_inv(xi, yi, w, a, b);
645 m_wsum -= wi;
646 m_xsum -= wi * xi;
647 m_ysum -= wi * yi;
648 m_xxsum -= wi * xi * xi;
649 m_yysum -= wi * yi * yi;
650 m_xysum -= wi * xi * yi;
651//double rri = ( xi * xi + yi * yi );
652//double wrri = wi * rri;
653 double rri = (xi * xi + yi * yi);
654 double wrri = wi * rri;
655 m_xrrsum -= wrri * xi;
656 m_yrrsum -= wrri * yi;
657 m_rrrrsum -= wrri * rri;
658 m_nc -= 1;
659 }
static double err_dis_inv(double x, double y, double w, double a, double b)
distance error
Definition: Lpav.cc:30

◆ subset()

TRGState subset ( unsigned  i,
unsigned  n 
) const

returns subset from i with n bits.

Definition at line 356 of file State.cc.

357 {
358 vector<bool> stack;
359 for (unsigned i = s; i < s + n; i++) {
360 if ((* this)[i])
361 stack.push_back(true);
362 else
363 stack.push_back(false);
364 }
365 return TRGState(stack);
366 }

◆ superLayer() [1/3]

unsigned superLayer ( const std::vector< TRGCDCLink * > &  list)
static

returns super layer pattern.

Definition at line 644 of file Link.cc.

645 {
646 unsigned sl = 0;
647 unsigned n = list.size();
648 for (unsigned i = 0; i < n; i++)
649 sl |= (1 << (list[i]->cell()->superLayerId()));
650 return sl;
651 }

◆ superLayer() [2/3]

unsigned superLayer ( const std::vector< TRGCDCLink * > &  list,
unsigned  minNHits 
)
static

returns super layer pattern.

Definition at line 654 of file Link.cc.

655 {
657 unsigned n = links.size();
658 for (unsigned i = 0; i < n; i++)
659 ++_nHitsSL[links[i]->cell()->superLayerId()];
660 unsigned sl = 0;
661 for (unsigned i = 0; i < _nSL; i++)
662 if (_nHitsSL[i] >= minN)
663 sl |= (1 << i);
664 return sl;
665 }

◆ superLayer() [3/3]

const std::vector< TRGCDCLayer * > * superLayer ( unsigned  id) const
inline

returns a pointer to a super-layer.

0 will be returned if 'id' is invalid.

Definition at line 835 of file TRGCDC.h.

836 {
837 return _superLayers[id];
838 }

◆ superLayerId() [1/3]

unsigned superLayerId ( unsigned  wireId) const

returns super layer ID. This function is expensive.

Definition at line 1820 of file TRGCDC.cc.

1821 {
1822 unsigned iLayer = 0;
1823 unsigned nW = 0;
1824 bool nextLayer = true;
1825 while (nextLayer) {
1826 const vector<TRGCDCLayer*>& sl = *superLayer(iLayer);
1827 const unsigned nLayers = sl.size();
1828 for (unsigned i = 0; i < nLayers; i++)
1829 nW += sl[i]->nCells();
1830
1831 if (id < (nW - 1))
1832 return iLayer;
1833 if (nW >= nWires())
1834 nextLayer = false;
1835 }
1836 cout << "TRGCDC::superLayerId !!! no such a wire (id=" << id
1837 << endl;
1838 return TRGCDC_UNDEFINED;
1839 }

◆ superLayerId() [2/3]

unsigned superLayerId ( void  ) const
inline

returns super layer id.

Definition at line 221 of file Cell.h.

222 {
223 return _layer.superLayerId();
224 }

◆ superLayerId() [3/3]

unsigned superLayerId ( void  ) const
inline

returns super layer id.

Definition at line 166 of file Layer.h.

167 {
168 return _superLayerId;
169 }

◆ superLayerR()

float superLayerR ( unsigned  superLayerId) const
inline

returns inner radius of super layer.

Definition at line 919 of file TRGCDC.h.

920 {
921 return _r[i];
922 }

◆ superLayerR2()

float superLayerR2 ( unsigned  superLayerId) const
inline

returns (inner radius)^2 of super layer.

Definition at line 926 of file TRGCDC.h.

927 {
928 return _r2[i];
929 }

◆ swap()

void swap ( TRGCDCJSignal first,
TRGCDCJSignal second 
) const

Swaps the TRGCDCJSignals.

Definition at line 1241 of file JSignal.cc.

1242 {
1243 std::swap(first.m_name, second.m_name);
1244 std::swap(first.m_type, second.m_type);
1245 std::swap(first.m_bitsize, second.m_bitsize);
1246 std::swap(first.m_int, second.m_int);
1247 std::swap(first.m_minInt, second.m_minInt);
1248 std::swap(first.m_maxInt, second.m_maxInt);
1249 std::swap(first.m_actual, second.m_actual);
1250 std::swap(first.m_minActual, second.m_minActual);
1251 std::swap(first.m_maxActual, second.m_maxActual);
1252 std::swap(first.m_toReal, second.m_toReal);
1253 std::swap(first.m_debug, second.m_debug);
1254 std::swap(first.m_vhdlCode, second.m_vhdlCode);
1255 std::swap(first.m_argumentSignals, second.m_argumentSignals);
1256 std::swap(first.m_finishClock, second.m_finishClock);
1257 std::swap(first.m_commonData, second.m_commonData);
1258 }

◆ systemClock() [1/3]

const TRGClock & systemClock ( void  ) const
inline

calculates corrected drift time.

correctionFlag(bit 0:tof, 1:T0 offset, 2:propagation delay, 3:tan(lambda) correction) returns the system clock.

Definition at line 961 of file TRGCDC.h.

962 {
963 return _clock;
964 }

◆ systemClock() [2/3]

const TRGClock & systemClock ( void  ) const
inline

returns the system clock.

Definition at line 313 of file TRGGDL.h.

314 {
315 return _clock;
316 }

◆ systemClock() [3/3]

const TRGClock & systemClock ( void  ) const
inline

returns the system clock.

Definition at line 213 of file TRGGRL.h.

214 {
215 return _clock;
216 }
const TRGClock & _clock
GRL trigger system clock.
Definition: TRGGRL.h:159

◆ systemClockFE()

const TRGClock & systemClockFE ( void  ) const
inline

returns the system clock of the front-end

Definition at line 968 of file TRGCDC.h.

969 {
970 return _clockFE;
971 }

◆ systemOffsetMC() [1/2]

double systemOffsetMC ( void  ) const
inline

returns the system offset in MC.

Definition at line 989 of file TRGCDC.h.

990 {
991 return _offset;
992 }
const double _offset
Timing offset of CDC trigger.
Definition: TRGCDC.h:693

◆ systemOffsetMC() [2/2]

double systemOffsetMC ( void  ) const
inline

returns the system offset in MC.

Definition at line 320 of file TRGGDL.h.

321 {
322 return _offset;
323 }
const double _offset
Timing offset of GDL.
Definition: TRGGDL.h:236

◆ tab() [1/2]

string tab ( int  extra)
static

returns tab spaces with extra spaces

Definition at line 57 of file Debug.cc.

58 {
59 string t = tab();
60 if (extra > 0)
61 for (unsigned i = 0; i < unsigned(extra); i++)
62 t += " ";
63 return t;
64 }

◆ tab() [2/2]

string tab ( void  )
static

returns tab spaces.

Definition at line 47 of file Debug.cc.

48 {
49 string t;
50 const unsigned n = _stages.size();
51 for (unsigned i = 0; i < n; i++)
52 t += " ";
53 return t;
54 }

◆ tanl()

double tanl ( void  ) const
inline

returns tanl.

Definition at line 299 of file Helix.h.

300 {
301 return m_ac[4];
302 }

◆ TDCClock()

const TRGClock & TDCClock ( void  ) const
inline

returns the system clock of the trigger TDC after mergers (2 * front-end binwidth)

Definition at line 975 of file TRGCDC.h.

976 {
977 return _clockTDC;
978 }

◆ terminate() [1/8]

void terminate ( void  )

Termination.

Definition at line 1530 of file Fitter3D.cc.

1531 {
1532 if (m_mBool["fRootFile"]) {
1533 HandleRoot::writeRoot(m_fileFitter3D);
1534 HandleRoot::terminateRoot(m_mTVectorD, m_mTClonesArray);
1535 delete m_fileFitter3D;
1536 }
1537
1538 if (m_mBool["fVHDLFile"]) {
1539 //if(m_mSavedIoSignals.size()!=0) FpgaUtility::multipleWriteCoe(10, m_mSavedIoSignals, "./VHDL/LutData/Io/");
1540 //if(m_mSavedSignals.size()!=0) FpgaUtility::writeSignals("./VHDL/signals",m_mSavedSignals);
1542 if (m_mSavedSignals.size() != 0) FpgaUtility::writeSignals("signalValues", m_mSavedSignals);
1543 }
1544
1545 if (m_commonData) delete m_commonData;
1546 }
static void writeSignals(std::string outFilePath, std::map< std::string, std::vector< signed long long > > &data)
COE file functions.
Definition: FpgaUtility.cc:202
static void multipleWriteCoe(int lutInBitsize, std::map< std::string, std::vector< signed long long > > &data, const std::string &fileDirectory)
Writes multiple signal values to a file in coe format.
Definition: FpgaUtility.cc:220

◆ terminate() [2/8]

void terminate ( void  )

termination.

Definition at line 395 of file HoughFinder.cc.

396 {
397 if (_commonData) delete _commonData;
398 }

◆ terminate() [3/8]

void terminate ( void  )

terminate function

Definition at line 249 of file EventTime.cc.

250 {
251 delete h;
252 if (m_makeRootFile) {
253 m_fileEvtTime->Write();
254 m_fileEvtTime->Close();
255 }
256 }
bool m_makeRootFile
make Root file or not
Definition: EventTime.h:103
TFile * m_fileEvtTime
TFile pointer.
Definition: EventTime.h:68

◆ terminate() [4/8]

void terminate ( void  )

Termination method.

Definition at line 210 of file Hough3DFinder.cc.

211 {
212 if (m_makeRootFile) {
213 HandleRoot::writeRoot(m_fileFinder3D);
214 HandleRoot::terminateRoot(m_mRunTVectorD, m_mEventTVectorD, m_mTClonesArray);
215 delete m_fileFinder3D;
216 }
218 }
void destruct(void)
Destructs the 3D finder.

◆ terminate() [5/8]

void terminate ( void  )

terminate

Definition at line 125 of file TrackSegmentFinder.cc.

126 {
127 if (m_makeRootFile) {
128 m_fileTSF->Write();
129 m_fileTSF->Close();
130 }
131 }

◆ terminate() [6/8]

void terminate ( void  )
private

terminates when run is finished

Definition at line 739 of file TRGCDC.cc.

740 {
741 TRGDebug::enterStage("TRGCDC terminate");
742
743 if (_tsFinder) {
745 }
746 if (_eventTime.back()) {
747 _eventTime.back()->terminate();
748 }
749 if (_fitter3D) {
751 }
752 if (_hFinder) {
754 }
755 if (_h3DFinder) {
757 }
758 if (_makeRootFile) {
759 m_file->Write();
760 m_file->Close();
761 }
762
763 TRGDebug::leaveStage("TRGCDC terminate");
764 }
void terminate()
Termination.
Definition: Fitter3D.cc:1530

◆ terminate() [7/8]

void terminate ( void  )
private

terminates when run is finished

Definition at line 179 of file TRGGDL.cc.

180 {
181 }

◆ terminate() [8/8]

void terminate ( void  )
private

terminates when run is finished

Definition at line 120 of file TRGGRL.cc.

121 {
122 }

◆ time() [1/2]

int time ( int  newTime)
inline

sets and returns timing in clock position.

Definition at line 178 of file Time.h.

179 {
180 return _time = a;
181 }

◆ time() [2/2]

int time ( void  ) const
inline

returns timing in clock position.

Definition at line 171 of file Time.h.

172 {
173 return _time;
174 }

◆ timingDecision()

TRGState timingDecision ( const TRGState input,
TRGState registers,
bool &  logicStillActive 
)
static

Makes timing decision.

Definition at line 870 of file TRGGDL.cc.

873 {
874
875 //...Prepare registers...
876 // reg[0] := timing logic active, NOT USED
877 // reg[3:1] := state (0 to 7)
878 // reg[6:4] := counter after timing logic active
879
880 // reg[1] := waiting for timing of TOP, ECL, and CDC
881 // reg[2] := TOP timing active
882 // reg[3] := ECL timing active
883 // reg[4] := CDC timing active
884 // reg[7:5] := remaining count to issue timing signal
885
886
887
888 //...Input preparations...
889 // Assuming ftl_0.01
890 // Last bit is additional FTD signal
891 bool in[14];
892
893 //...CDC...
894 in[0] = input[0];
895 in[1] = input[1];
896 in[2] = input[2];
897 in[3] = input[3];
898 /*
899 bool cdc = in[0];
900 bool * cdct = & in[1];
901 */
902
903 //...ECL...
904 in[4] = input[4];
905 in[5] = input[5];
906 in[6] = input[6];
907 in[7] = input[7];
908 /*
909 bool ecl = in[4];
910 bool * eclt = & in[5];
911 */
912
913 //...TOP...
914 in[8] = input[8];
915 in[9] = input[9];
916 in[10] = input[10];
917 in[11] = input[11];
918 in[12] = input[12];
919 /*
920 bool top = in[8];
921 bool * topt = & in[9];
922 */
923
924 //...FTD...
925 in[13] = input[13];
926 bool ftd = in[13];
927
928 //...Get state info...
929 unsigned state = unsigned(reg.subset(1, 3));
930 unsigned count = unsigned(reg.subset(4, 3));
931
932 //...State machine...
933 bool timing = false;
934 unsigned source = 0;
935 if (state == 0) {
936 if (ftd) {
937 active = 1;
938 state = 1;
939 count = 1;
940 } else {
941 active = 0;
942 }
943 } else if (state == 1) {
944 if (count == 7) {
945 active = 0;
946 state = 0;
947 timing = true;
948 } else {
949 active = 1;
950 ++count;
951 }
952 }
953
954 //...Set registers...
955 reg.set(1, 3, state);
956 reg.set(4, 3, count);
957
958 //...Output...
959 TRGState out(3);
960 out.set(0, 1, timing);
961 out.set(1, 2, source);
962
963 if (TRGDebug::level()) {
964 input.dump("detail", TRGDebug::tab(4) + "Timing in,");
965 reg.dump("detail", TRGDebug::tab(4) + "Registers,");
966 cout << TRGDebug::tab(4) << "ftd,active,state,count=" << ftd << ","
967 << active << "," << state
968 << "," << count << endl;
969
970 out.dump("detail", TRGDebug::tab(4) + "Timing out,");
971 }
972
973 //...Termination...
974 return out;
975 }

◆ toSignedVhdlCode()

void toSignedVhdlCode ( )

Changes signal type to signed type in VHDL.

Definition at line 1750 of file JSignal.cc.

1751 {
1752 if (m_type == -1) return;
1753 // Find if bitwidth is optimized for signed or unsigned. t_bitwidth is optimized for signed.
1754 int t_bitwidth = calBitwidth();
1755 if (calType() == 1) t_bitwidth++;
1756
1757 if (t_bitwidth <= m_bitsize) {
1758 m_vhdlCode = "signed(" + m_vhdlCode + ")";
1759 } else if (t_bitwidth - 1 == m_bitsize) {
1760 m_vhdlCode = "signed('0'&(" + m_vhdlCode + "))";
1761 m_bitsize += 1;
1762 } else {
1763 cout << "[Error] TRGCDCJSignal::toSignedVhdlCode() => m_bitsize is too small." << endl;
1764 }
1765 m_type = -1;
1766 }
int calBitwidth() const
Calculates the bit width.
Definition: JSignal.cc:1461

◆ toSlv() [1/2]

TRGCDCJSignal const toSlv ( TRGCDCJSignal const &  in)
static

Change singal to std_logic_vector.

Definition at line 1152 of file JSignal.cc.

1153 {
1154 if (in.m_type == 2) return (in);
1155 // Don't think I need below but will keep it for now.
1156 if (in.m_type == -1) {
1157 cout << "[Error] TRGCDCJSignal::toSlv() => Slv is not same as unsigned anymore." << endl;
1158 }
1159 TRGCDCJSignal t_result(in);
1160 t_result.m_type = 2;
1161
1162 if (in.getPrintVhdl() == 1) vhdlCode("std_logic_vector", in, t_result, t_result.m_vhdlCode);
1163
1164 return t_result;
1165 }

◆ toSlv() [2/2]

TRGCDCJSignal const toSlv ( TRGCDCJSignal const &  in,
int  test 
)
static

Change signal to std_logic_vector using vector<bool>. (Will be deprecated.)

Definition at line 1121 of file JSignal.cc.

1122 {
1123
1124 TRGCDCJSignal result(in);
1125
1126 // Temporary signal.
1127 //test += 0; //TODO why?
1128 signed long long t_int = in.m_int;
1129 if (in.m_type == -1) {
1130 // Change signed m_int to vector<bool>
1131 t_int = ~t_int;
1132 t_int += 1;
1133 result.m_slv.clear();
1134 result.m_slv.resize(in.m_bitsize);
1135 for (int iBit = 0; iBit < in.m_bitsize; iBit++) {
1136 result.m_slv[iBit] = (bool)(t_int >> iBit) & 1;
1137 }
1138 } else if (in.m_type == 1) {
1139 // Change unsigned m_int to vector<bool>
1140 result.m_slv.clear();
1141 result.m_slv.resize(in.m_bitsize);
1142 for (int iBit = 0; iBit < in.m_bitsize; iBit++) {
1143 result.m_slv[iBit] = (bool)(t_int >> iBit) & 1;
1144 }
1145 } else {
1146 cout << "[Error] TRGCDCJSignal::toSlv() => m_type is not 1 or -1." << endl;
1147 }
1148
1149 return result;
1150 }

◆ toUnsigned()

unsigned toUnsigned ( unsigned  n,
const bool *  array 
)
inlinestatic

Coverts from bool array to unsigned.

Definition at line 334 of file State.h.

335 {
336#ifdef TRG_DEBUG
337 if (n > 8) std::cout << "given array size(" << n << ") is too big"
338 << std::endl;
339#endif
340
341 unsigned b = 0;
342 for (unsigned i = 0; i < n; i++) {
343 if (a[i]) {
344 const unsigned bp = i % _bsu;
345 b |= (1 << bp);
346 }
347 }
348 return b;
349 }

◆ toUnsignedVhdlCode()

void toUnsignedVhdlCode ( )

Changes signal type to unsigned type in VHDL.

Definition at line 1768 of file JSignal.cc.

1769 {
1770 if (m_type == 1) return;
1771
1772 if (calType() == -1) {
1773 cout << "[Warning] TRGCDCJSignal::toUnsignedVhdlCode() => signal can be minus." << endl;
1774 } else {
1775 m_vhdlCode = "unsigned(" + m_vhdlCode + ")";
1776 m_type = 1;
1777 }
1778
1779 }

◆ track() [1/6]

const void * track ( const void *  a)
inline

assigns a pointer to a TTrack.

Definition at line 324 of file CellHit.h.

325 {
326 return _track = a;
327 }
const void * _track
a pointer to a TTrack
Definition: CellHit.h:191

◆ track() [2/6]

const void * track ( const void *  a) const
inline

assigns a pointer to a TTrack. (tmp)

Definition at line 331 of file CellHit.h.

332 {
333 return _track = a;
334 }

◆ track() [3/6]

TRGCDCTrack * track ( TRGCDCTrack a)
inline

sets a pointer to a track.

Definition at line 441 of file Link.h.

442 {
443 return _track = a;
444 }

◆ track() [4/6]

const void * track ( void  ) const
inline

assigns a pointer to a TTrack.

Definition at line 317 of file CellHit.h.

318 {
319 return _track;
320 }

◆ track() [5/6]

TRGCDCTrack * track ( void  ) const
inline

returns a pointer to a track.

Definition at line 427 of file Link.h.

428 {
429 return _track;
430 }

◆ track() [6/6]

const TRGCDCTrackBase & track ( void  ) const
inline

returns a track.

Definition at line 90 of file Relation.h.

91 {
92 return _track;
93 }
const TRGCDCTrackBase & _track
Track.
Definition: Relation.h:77

◆ tracker2D()

const TRGCDCTracker2D * tracker2D ( unsigned  id) const
inline

returns a 2D tracker board.

Definition at line 1054 of file TRGCDC.h.

1055 {
1056 return _tracker2Ds[a];
1057 }

◆ trackListMC()

const std::vector< int > & trackListMC ( void  ) const
inline

returns MC track list which contributes to CDC hits.

Definition at line 86 of file PerfectFinder.h.

87 {
88 return _mcList;
89 }

◆ transformation()

const TRGCDCHoughTransformation & transformation ( void  ) const
inline

returns Hough transformation object.

Definition at line 522 of file HoughPlaneBase.h.

523 {
524 return _trans;
525 }
const TRGCDCHoughTransformation & _trans
Hough transformation.

◆ TRGArea2D()

TRGArea2D ( const TRGPoint2D leftBottom,
const TRGPoint2D rightUpper 
)

Contructor.

Definition at line 17 of file Area2D.cc.

19 {
20 _c[0] = leftBottom;
21 _c[1] = rightUpper;
22 }

◆ TRGBitStream() [1/4]

Default constructor.

Definition at line 21 of file BitStream.cc.

21 :
22 _name("unknown"),
23 _sizeMax(0),
24 _size(0),
25 _stream(0)
26 {
27 }

◆ TRGBitStream() [2/4]

TRGBitStream ( const char * const  c,
unsigned  sizeInBit 
)

Constructor with char stream.

Definition at line 47 of file BitStream.cc.

47 :
48 _name("unknown"),
49 _sizeMax(0),
50 _size(s),
51 _stream(0)
52 {
53 unsigned sz = s / 8;
54 if (s % 8) ++sz;
55 unsigned sz4 = sz / 4;
56 for (unsigned i = 0; i < sz4; i++) {
57// unsigned j = * (unsigned *) c[i * 4];
58 unsigned j = * (unsigned*)(& (c[i * 4]));
59 _stream.push_back(new unsigned(j));
60 }
61 if (sz % 4) {
62 unsigned j = 0;
63 for (unsigned i = 0; i < sz % 4; i++)
64 j |= (c[sz4 + i] << i * 8);
65 _stream.push_back(new unsigned(j));
66 }
67 }
char c(unsigned positionInChar) const
returns a pointer to char's.
Definition: BitStream.h:187

◆ TRGBitStream() [3/4]

TRGBitStream ( const TRGBitStream a)

Copy constructor.

Definition at line 37 of file BitStream.cc.

37 :
38 _name("CopyOf" + a._name),
39 _sizeMax(a._sizeMax),
40 _size(a._size),
41 _stream(0)
42 {
43 for (unsigned i = 0; i < a._stream.size(); i++)
44 _stream.push_back(new unsigned(* a._stream[i]));
45 }

◆ TRGBitStream() [4/4]

TRGBitStream ( int  size,
const std::string &  name = "unknown" 
)
explicit

Constructor of fixed size.

Definition at line 29 of file BitStream.cc.

29 :
30 _name(name),
32 _size(0),
33 _stream(0)
34 {
35 }

◆ TRGBitStream2TRGSignal()

vector< TRGSignal > TRGBitStream2TRGSignal ( const TRGClock clock,
int  initialClockPosition,
std::vector< TRGBitStream * >  stream 
)
static

Make trigger signals from bit stream.

Definition at line 127 of file BitStream.cc.

130 {
131
132 vector<TRGSignal> t;
133
134 //...Check the size of stream...
135 if (stream.size() == 0) {
136 cout << " !!! TRGBitStream::TRGBitStream2TRGSignal: given stream "
137 << "has no data" << endl;
138 return t;
139 }
140
141 //...Get bit size...
142 const unsigned bs = stream[0]->size();
143 const unsigned cs = stream.size();
144
145 //...Preparation...
146 vector<TRGSignal*> s;
147 for (unsigned i = 0; i < bs; i++)
148 s.push_back(new TRGSignal());
149
150 //...Bit stream loop...
151 for (unsigned i = 0; i < cs; i++) {
152
153 //...Bit position loop...
154 for (unsigned j = 0; j < bs; j++) {
155 if (stream[i]->bit(j)) {
156 TRGTime r(int(initialClockPosition + i), true, clock);
157 TRGTime f = r;
158 f.shift(1).reverse();
159 (* s[j]) |= (r & f);
160 }
161 }
162 }
163
164 //...Return value...
165 for (unsigned i = 0; i < s.size(); i++)
166 t.push_back(* s[i]);
167 return t;
168 }
bool bit(unsigned positionInBit) const
returns true if given position is active.
Definition: BitStream.h:197

◆ TRGBoard()

TRGBoard ( const std::string &  name,
const TRGClock systemClock,
const TRGClock dataClock,
const TRGClock userClockInput,
const TRGClock userClockOutput 
)

Constructor.

Definition at line 22 of file Board.cc.

27 : _name(name),
28 _clockSystem(& systemClock),
29 _clockData(& dataClock),
30 _clockUserInput(& userClockInput),
31 _clockUserOutput(& userClockOutput),
34 {
35 }

◆ TRGCDC()

TRGCDC ( const std::string &  configFile,
unsigned  simulationMode,
unsigned  fastSimulationMode,
unsigned  firmwareSimulationMode,
int  firmwareSimulationStart,
int  firmwareSimulationStop,
bool  makeRootFile,
bool  perfect2DFinder,
bool  perfect3DFinder,
const std::string &  innerTSLUTFile,
const std::string &  outerTSLUTFile,
const std::string &  rootTRGCDCFile,
const std::string &  rootFitter3DFile,
unsigned  houghFinderPeakMin,
const std::string &  houghMappingFilePlus,
const std::string &  houghMappingFileMinus,
unsigned  houghDoit,
bool  fLogicLUTTSF,
bool  fLRLUT,
bool  fFitter3Dsmclr,
bool  fFitter3Ds2DFit,
bool  fFitter3Ds2DFitDrift,
double  inefficiecny,
bool  fileTSF,
bool  fileETF,
int  fverETF,
bool  fprintFirmETF,
bool  fileHough3D,
int  finder3DMode,
bool  fileFitter3D,
bool  fXtSimpleFitter3D,
double  TdcBinWidth,
int  trgCDCDataInputMode,
const std::string &  cdchitCollectionName 
)
private

Constructor.

Definition at line 217 of file TRGCDC.cc.

250 :
251 _debugLevel(0),
252 _configFilename(configFile),
253 _simulationMode(simulationMode),
254 _fastSimulationMode(fastSimulationMode),
258 _returnValue(0),
259 _makeRootFile(makeRootFile),
260 _perfect2DFinder(perfect2DFinder),
262 _innerTSLUTFilename(innerTSLUTFile),
263 _outerTSLUTFilename(outerTSLUTFile),
264 _rootTRGCDCFilename(rootTRGCDCFile),
265 _rootFitter3DFilename(rootFitter3DFile),
266 _fLogicLUTTSF(fLogicLUTTSF),
267 _fLRLUT(fLRLUT),
268 _fFitter3Dsmclr(fFitter3Dsmclr),
269 _fFitter3Ds2DFit(fFitter3Ds2DFit),
270 _fFitter3Ds2DFitDrift(fFitter3Ds2DFitDrift),
271 _inefficiency(inefficiency),
272 _fileTSF(fileTSF),
273 _fileETF(fileETF),
274 _fverETF(fverETF),
275 _fprintFirmETF(fprintFirmETF),
276 _fileHough3D(fileHough3D),
277 _finder3DMode(finder3DMode),
278 _fileFitter3D(fileFitter3D),
279 _fXtSimpleFitter3D(fXtSimpleFitter3D),
280 _fudgeFactor(1.),
281 _width(0),
282 _r(0),
283 _r2(0),
284 _clock("CDCTrigger system clock", 0, 125. / TdcBinWidth),
285 _clockFE("CDCFE TDC clock", _clock, 8),
286 _clockTDC("CDCTrigger TDC clock (after mergers)", _clock, 4),
287 _clockD("CDCTrigger data clock", _clock, 1, 4),
288 _clockUser3125("CDCTrigger Aurora user clock (3.125Gbps)",
289 _clock, 25, 20),
290 _clockUser6250("CDCTrigger Aurora user clock (6.250Gbps)",
291 _clock, 50, 20),
292 _offset(5.3),
293 _pFinder(0),
294 _hFinder(0),
295 _h3DFinder(0),
296 _fitter3D(0),
297 _eventTime(0),
298 _trgCDCDataInputMode(trgCDCDataInputMode),
299 _cdchitCollectionName(cdchitCollectionName)
300 {
301
302 TRGDebug::enterStage("TRGCDC constructor");
303
304#ifdef TRGCDC_DISPLAY
305 int argc = 0;
306 char** argv = 0;
307 Gtk::Main main_instance(argc, argv);
308 if (! D)
309 D = new TCDisplayRphi();
310 D->clear();
311 D->show();
312 cout << "TRGCDC ... GTK initialized" << endl;
313#endif
314
315 //...Clock summary...
316 _clock.dump();
317 _clockFE.dump();
318 _clockTDC.dump();
319 _clockD.dump();
320
321 //...Firmware simulation time window...
322 TRGTime rise = TRGTime(_firmwareSimulationStart, true, _clockFE);
323 TRGTime fall = rise;
324 fall.shift(_firmwareSimulationStop).reverse();
325 _firmwareSimulationWindow = TRGSignal(rise & fall);
326 _firmwareSimulationWindow.name("Firmware simulation window in FE clock");
328
329 //...Time window in other clocks...
334
335 cout << "In " << _clock.name() << endl;
336 cout << " Start : "
338 << endl;
339 cout << " Stop : "
341 << endl;
342 cout << "In " << _clockTDC.name() << endl;
343 cout << " Start : "
345 << endl;
346 cout << " Stop : "
348 << endl;
349 cout << "In " << _clockD.name() << endl;
350 cout << " Start : " << _firmwareSimulationStartDataClock << endl;
351 cout << " Stop : " << _firmwareSimulationStopDataClock << endl;
352
353 if (TRGDebug::level()) {
354 cout << "TRGCDC ... TRGCDC initializing with " << _configFilename
355 << endl
356 << "mode=0x" << hex << _simulationMode << dec << endl;
357 }
358
359 initialize(houghFinderPeakMin,
360 houghMappingFilePlus,
361 houghMappingFileMinus,
362 houghDoit);
363
364 if (TRGDebug::level()) {
365 cout << "TRGCDC ... TRGCDC created with " << _configFilename << endl;
366 }
367
368 TRGDebug::leaveStage("TRGCDC constructor");
369 }
int _trgCDCDataInputMode
Switch for TRG CDC input mode.
Definition: TRGCDC.h:768
TRGSignal _firmwareSimulationWindow
Firmware simulation time window in FE.
Definition: TRGCDC.h:524
const bool _perfect3DFinder
Switch to activate perfect 3D finder.
Definition: TRGCDC.h:551
double _inefficiency
Hit inefficiency parameter.
Definition: TRGCDC.h:581
void initialize(unsigned houghFinderPeakMin, const std::string &houghMappingFilePlus, const std::string &houghMappingFileMinus, unsigned houghDoit)
initializes CDC geometry.
Definition: TRGCDC.cc:372

◆ TRGCDCCell()

TRGCDCCell ( unsigned  id,
unsigned  localId,
const TRGCDCLayer layer,
const HepGeom::Point3D< double > &  forwardPosition,
const HepGeom::Point3D< double > &  backwardPosition 
)

Constructor.

Definition at line 30 of file Cell.cc.

35 : _id(id),
37 _layer(l),
38 _xyPosition(0.5 * (fp + bp)),
41 _direction((fp - bp).unit()),
42 _state(0),
43 _hit(0)
44 {
45 }
const HepGeom::Point3D< double > _xyPosition
Wire center(?) position.
Definition: Cell.h:175

◆ TRGCDCCellHit()

TRGCDCCellHit ( const TRGCDCCell w,
unsigned  indexCDCHit = 0,
unsigned  indexCDCSimHit = 0,
unsigned  indexMCParticle = 0,
float  driftLeft = 0,
float  driftLeftError = 0,
float  driftRight = 0,
float  driftRightError = 0,
int  mcLRflag = 0,
float  fudgeFacgtor = 1 
)
explicit

Constructor.

Definition at line 34 of file CellHit.cc.

44 : _state(0),
45 _cell(w),
46 _xyPosition(w.xyPosition()),
47 _track(0),
48 _sequentialLength(0), //2019/07/31 by ytlai
49 _iCDCHit(indexCDCHit),
50 _iCDCSimHit(indexCDCSimHit),
51 _iMCParticle(indexMCParticle)
52 {
53// w.hit(this); // set by TRGCDC
54 _mcLR = mcLRflag;
55 _drift[0] = driftLeft;
56 _drift[1] = driftRight;
57 _driftError[0] = driftLeftError * fudgeFactor;
58 _driftError[1] = driftRightError * fudgeFactor;
59 if (w.axial()) _state |= CellHitAxial;
60 else _state |= CellHitStereo;
61 }

◆ TRGCDCCircle() [1/2]

TRGCDCCircle ( const std::vector< TRGCDCLink * > &  links)
explicit

Constructor with links.

Definition at line 34 of file Circle.cc.

35 : TCTBase("UnknownCircle", 0),
37 _radius(0),
38 _plane(0)
39 {
40 fitter(& _fitter);
42 }
static const TRGCDCCircleFitter _fitter
Default fitter.
Definition: Circle.h:90
const TRGCDCFitter * fitter(void) const
returns a pointer to a default fitter.
Definition: TrackBase.h:262

◆ TRGCDCCircle() [2/2]

TRGCDCCircle ( double  r,
double  phi,
double  charge,
const TRGCDCHoughPlane plane 
)

Constructor with a circle center, assuming the origin is on a circle.

Definition at line 44 of file Circle.cc.

48 : TCTBase("unknown", charge),
49 _center(r * cos(phi), r * sin(phi)),
50 _radius(r),
51 _plane(& plane)
52 {
53 fitter(& _fitter);
54 }

◆ TRGCDCCircleFitter()

TRGCDCCircleFitter ( const std::string &  name)
explicit

Constructor.

Definition at line 30 of file CircleFitter.cc.

31 : TCFitter(name), _charge(0.), _radius(0.), _center(Point3D(0., 0., 0.))
32 {
33 }

◆ TRGCDCEventTime()

TRGCDCEventTime ( const TRGCDC TRGCDC,
bool  makeRootFile 
)

constructor of TRGCDCEventTime class

Definition at line 43 of file EventTime.cc.

44 : _cdc(TRGCDC),
45 cnt{{0}},
46 ft{{{0}}},
47 m_foundT0(0), // 2019/07/31 by ytlai
48 m_minusET(0),
49 m_noET(0),
50 threshold(0),
51 m_eventN(0),
52 m_makeRootFile(makeRootFile),
53 m_ver(0)
54 {
55
56 if (m_makeRootFile) m_fileEvtTime = new TFile("ETF.root", "RECREATE");
57
58 m_evtOutputTs = new TTree("m_evtOutsTs", "EvtTime Outputs for TS");
59 m_evtOut = new TTree("m_evtOut", "EvtTime Outputs for 20 TS");
60
61 m_evtOutputTs->Branch("tsFastestTime", &m_fastestT, "m_fastestT/I");
62 m_evtOutputTs->Branch("tsFoundTime", &m_foundT, "m_foundT/I");
63 m_evtOutputTs->Branch("foundT_fastT_diff", &m_whdiff, "m_whdiff/I");
64
65 m_evtOut->Branch("histTime", &m_histT, "m_histT/I");
66
67 h = new TH1D("h", "h", 1000, -500, 499);
68
69 memset(cnt, 0, sizeof cnt);
70 memset(ft, 0, sizeof ft);
71
72 // move to constructor
73 //m_minusET = 0;
74 //m_noET = 0;
75 //m_eventN = 0;
76 //m_ver = 0;
77 //m_foundT0 = 0;
78 }

◆ TRGCDCEventTimeFinder()

TRGCDCEventTimeFinder ( const std::string &  name,
const TRGClock systemClock,
const TRGClock dataClock,
const TRGClock userClockInput,
const TRGClock userClockOutput 
)

Constructor.

Definition at line 41 of file EventTimeFinder.cc.

46 : TRGBoard(name, systemClock, dataClock, userClockInput, userClockOutput)
47 {
48 // _tisb(0),
49 // _tosbE(0),
50 // _tosbT(0) {
51 }
TRGBoard(const std::string &name, const TRGClock &systemClock, const TRGClock &dataClock, const TRGClock &userClockInput, const TRGClock &userClockOutput)
Constructor.
Definition: Board.cc:22

◆ TRGCDCFitter()

TRGCDCFitter ( const std::string &  name)

Constructor.

Definition at line 24 of file Fitter.cc.

24 : _name(name)
25 {
26 }

◆ TRGCDCFitter3D()

TRGCDCFitter3D ( const std::string &  name,
const std::string &  rootFitter3DFile,
const TRGCDC TRGCDC,
const std::map< std::string, bool > &  flags 
)

Constructor.

Definition at line 62 of file Fitter3D.cc.

66 : m_name(name), m_cdc(TRGCDC),
67 m_mBool(flags), m_rootFitter3DFileName(rootFitter3DFile),
68 m_treeTrackFitter3D(), m_treeConstantsFitter3D() // 2019/07/31 by ytlai
69 {
71 m_commonData = 0;
72 }

◆ TRGCDCFrontEnd()

TRGCDCFrontEnd ( const std::string &  name,
boardType  type,
const TRGClock systemClock,
const TRGClock dataClock,
const TRGClock userClock 
)

Constructor.

Definition at line 31 of file FrontEnd.cc.

36 : TRGBoard(name,
37 systemClock,
38 dataClock,
39 userClockOutput,
40 userClockOutput),
41 _type(type),
42 _isb(0),
43 _osb(0)
44 {
45
46 }
boardType _type
Board type.
Definition: FrontEnd.h:145

◆ TRGCDCHelix() [1/3]

TRGCDCHelix ( const HepGeom::Point3D< double > &  pivot,
const CLHEP::HepVector &  a 
)

Constructor without error matrix.

Definition at line 88 of file Helix.cc.

90 : m_matrixValid(false),
91 m_helixValid(false),
92 m_bField(15.0),
93 m_alpha(222.376063),
95 m_a(a),
96 m_Ea(CLHEP::HepSymMatrix(5, 0))
97 {
98 // m_alpha = 222.376063;
99 if (m_a.num_row() == 5) {
100 updateCache();
101 }
102 }

◆ TRGCDCHelix() [2/3]

TRGCDCHelix ( const HepGeom::Point3D< double > &  pivot,
const CLHEP::HepVector &  a,
const CLHEP::HepSymMatrix &  Ea 
)

Constructor with pivot, helix parameter a, and its error matrix.

Definition at line 70 of file Helix.cc.

73 : m_matrixValid(true),
74 m_helixValid(false),
75 m_bField(15.0),
76 m_alpha(222.376063),
78 m_a(a),
79 m_Ea(Ea)
80 {
81 // m_alpha = 10000. / 2.99792458 / m_bField;
82 // m_alpha = 222.376063;
83 if (m_a.num_row() == 5 && m_Ea.num_row() == 5) {
85 }
86 }

◆ TRGCDCHelix() [3/3]

TRGCDCHelix ( const HepGeom::Point3D< double > &  position,
const CLHEP::Hep3Vector &  momentum,
double  charge 
)

Constructor with position, momentum, and charge.

Definition at line 104 of file Helix.cc.

107 : m_matrixValid(false),
108 m_helixValid(false),
109 m_bField(15.0),
110 m_alpha(222.376063),
111 m_pivot(position),
112 m_a(CLHEP::HepVector(5, 0)),
113 m_Ea(CLHEP::HepSymMatrix(5, 0))
114 {
115 m_a[0] = 0.;
116 m_a[3] = 0.;
117 double perp(momentum.perp());
118 if (perp != 0.0) {
119 m_a[1] = fmod(atan2(- momentum.x(), momentum.y())
120 + M_PI4, M_PI2);
121 m_a[2] = charge / perp;
122 m_a[4] = momentum.z() / perp;
123 } else {
124 m_a[2] = charge * (DBL_MAX);
125 }
126 // m_alpha = 222.376063;
127 updateCache();
128 }

◆ TRGCDCHough3DFinder()

TRGCDCHough3DFinder ( const TRGCDC TRGCDC,
bool  makeRootFile,
int  finderMode 
)

Contructor.

Definition at line 51 of file Hough3DFinder.cc.

52 : _cdc(TRGCDC), m_makeRootFile(makeRootFile), m_finderMode(finderMode)
53 {
54
58
59 m_mBool["fMc"] = 1;
60 m_mBool["fVerbose"] = 0;
61 m_mBool["fIsPrintError"] = 0;
62 m_mBool["fIsIntegerEffect"] = 1;
63 m_mBool["fmcLR"] = 0;
64 m_mBool["fLRLUT"] = 1;
65 m_mBool["f2DFitDrift"] = 1;
66 m_mBool["f2DFit"] = 1;
67
68 // For finder3D.
69 m_mBool["debugEfficiency"] = 1;
70 m_mBool["debugNTs"] = 1;
71
72 m_mConstD["Trg_PI"] = M_PI;
73 // Get rr,zToStraw,angleSt,nWire
74 const CDC::CDCGeometryPar& cdcp = CDC::CDCGeometryPar::Instance();
75 m_mConstV["rr"] = vector<double> (9);
76 m_mConstV["nWires"] = vector<double> (9);
77 m_mConstV["nTSs"] = vector<double> (9);
78 for (unsigned iSL = 0; iSL < 9; iSL++) {
79 unsigned t_layerId = _cdc.segment(iSL, 0).center().layerId();
80 m_mConstV["rr"][iSL] = cdcp.senseWireR(t_layerId);
81 m_mConstV["nWires"][iSL] = cdcp.nWiresInLayer(t_layerId) * 2;
82 m_mConstV["nTSs"][iSL] = cdcp.nWiresInLayer(t_layerId);
83 }
84 m_mConstV["nTSs2D"] = vector<double> (5);
85 for (unsigned iAx = 0; iAx < 5; iAx++) {
86 m_mConstV["nTSs2D"][iAx] = m_mConstV["nTSs"][2 * iAx];
87 }
88
89 m_mConstV["zToStraw"] = vector<double> (4);
90 m_mConstV["zToOppositeStraw"] = vector<double> (4);
91 m_mConstV["angleSt"] = vector<double> (4);
92 m_mConstV["nShift"] = vector<double> (4);
93 for (int iSt = 0; iSt < 4; iSt++) {
94 unsigned t_layerId = _cdc.stereoSegment(iSt, 0).center().layerId();
95 m_mConstV["zToStraw"][iSt] = cdcp.senseWireBZ(t_layerId);
96 m_mConstV["zToOppositeStraw"][iSt] = cdcp.senseWireFZ(t_layerId);
97 m_mConstV["angleSt"][iSt] = 2 * m_mConstV["rr"][2 * iSt + 1] * sin(m_mConstD["Trg_PI"] * cdcp.nShifts(t_layerId) /
98 (2 * cdcp.nWiresInLayer(t_layerId))) / (cdcp.senseWireFZ(t_layerId) - cdcp.senseWireBZ(t_layerId));
99 m_mConstV["nShift"][iSt] = cdcp.nShifts(t_layerId);
100 }
101 m_mConstV["rr2D"] = vector<double> (5);
102 m_mConstV["rr3D"] = vector<double> (4);
103 for (int iAx = 0; iAx < 5; iAx++) m_mConstV["rr2D"][iAx] = m_mConstV["rr"][iAx * 2];
104 for (int iSt = 0; iSt < 4; iSt++) m_mConstV["rr3D"][iSt] = m_mConstV["rr"][iSt * 2 + 1];
105 m_mConstV["wirePhi2DError"] = vector<double> (5);
106 m_mConstV["driftPhi2DError"] = vector<double> (5);
107
109 //m_mConstD["driftResolution"] = 2 * 40 * 0.0001; // (cm)
110 //m_mConstV["cellResolution"] = vector<double> (5);
111 //for(unsigned iAx=0; iAx<5; iAx++){
112 // m_mConstV["cellResolution"][iAx] = m_mConstV["rr2D"][iAx] * 2 * m_mConstD["Trg_PI"] / (m_mConstV["nWires"][iAx*2]/2); // (cm)
113 //}
114 //for(unsigned iAx=0; iAx<5; iAx++){
115 // m_mConstV["wirePhi2DError"][iAx] = m_mConstV["cellResolution"][iAx]/m_mConstV["rr2D"][iAx] / sqrt(12);
116 //}
117 //for(unsigned iAx=0; iAx<5; iAx++){
118 // m_mConstV["driftPhi2DError"][iAx] = m_mConstD["driftResolution"]/m_mConstV["rr2D"][iAx] / sqrt(12);
119 //}
120 m_mConstV["wirePhi2DError"][0] = 0.00085106;
121 m_mConstV["wirePhi2DError"][1] = 0.00039841;
122 m_mConstV["wirePhi2DError"][2] = 0.00025806;
123 m_mConstV["wirePhi2DError"][3] = 0.00019084;
124 m_mConstV["wirePhi2DError"][4] = 0.0001514;
125 m_mConstV["driftPhi2DError"][0] = 0.00085106;
126 m_mConstV["driftPhi2DError"][1] = 0.00039841;
127 m_mConstV["driftPhi2DError"][2] = 0.00025806;
128 m_mConstV["driftPhi2DError"][3] = 0.00019084;
129 m_mConstV["driftPhi2DError"][4] = 0.0001514;
134 //m_mConstV["wireZError"] = vector<double> (4);
135 //m_mConstV["wireZError"][0] = 3.19263;
136 //m_mConstV["wireZError"][1] = 2.8765;
137 //m_mConstV["wireZError"][2] = 2.90057;
138 //m_mConstV["wireZError"][3] = 3.96206;
139 //m_mConstV["driftZError"] = vector<double> (4);
140 //m_mConstV["driftZError"][0] = 3.19263;
141 //m_mConstV["driftZError"][1] = 2.8765;
142 //m_mConstV["driftZError"][2] = 2.90057;
143 //m_mConstV["driftZError"][3] = 3.96206;
144
145 // (2016.06.07) study
146 //m_mConstV["wireZError"] = vector<double> ({4.752, 6.393, 6.578, 6.418});
147 //m_mConstV["driftZError"] = vector<double> ({0.4701, 0.7203, 0.8058, 0.9382});
148 m_mConstV["driftZError"] = vector<double> ({0.7676, 0.9753, 1.029, 1.372});
149 m_mConstV["wireZError"] = vector<double> ({0.7676, 0.9753, 1.029, 1.372});
150
151 // Make driftLength table for each superlayer. Up to 511 clock ticks.
152 // driftLengthTableSLX[ tdcCount (~2ns unit) ] = drift length (cm)
153 for (unsigned iSl = 0; iSl < 9; iSl++) {
154 string tableName = "driftLengthTableSL" + to_string(iSl);
155 unsigned tableSize = 512;
156 m_mConstV[tableName] = vector<double> (tableSize);
157 unsigned t_layer = _cdc.segment(iSl, 0).center().layerId();
158 for (unsigned iTick = 0; iTick < tableSize; iTick++) {
159 double t_driftTime = iTick * 2 * cdcp.getTdcBinWidth();
160 double avgDriftLength = 0;
161 if (m_mBool["fXtSimple"] == 1) {
162 avgDriftLength = cdcp.getNominalDriftV() * t_driftTime;
163 } else {
164 double driftLength_0 = cdcp.getDriftLength(t_driftTime, t_layer, 0);
165 double driftLength_1 = cdcp.getDriftLength(t_driftTime, t_layer, 1);
166 avgDriftLength = (driftLength_0 + driftLength_1) / 2;
167 }
168 m_mConstV[tableName][iTick] = avgDriftLength;
169 }
170 }
171
172 // Save geometry to root file.
173 TVectorD geometryHough3D(16);
174 for (int i = 0; i < 4; i++) {
175 geometryHough3D[i] = m_mConstV["rr"][2 * i + 1] / 100;
176 geometryHough3D[i + 4] = m_mConstV["angleSt"][i];
177 geometryHough3D[i + 8] = m_mConstV["zToStraw"][i] / 100;
178 geometryHough3D[i + 12] = m_mConstV["nWires"][2 * i + 1];
179 }
180
182 // 1: Hough3DFinder 2: GeoFinder 3: VHDL GeoFinder
184 // Set input file name for VHDL GeoFinder.
185 m_Hough3DFinder->setInputFileName(string(std::getenv("BELLE2_LOCAL_DIR")) + "/data/trg/cdc/GeoFinder.input");
186
187 // For VHDL GEoFinder
188 //m_Hough3DFinder->setInputFileName("GeoFinder.input");
189 // cotStart, cotEnd, z0Start, z0End, cotSteps, z0Steps
190 float tempInitVariables[] = { -3, 3, -2, 2, 1001, 1001};
191 vector<float > initVariables(tempInitVariables, tempInitVariables + sizeof(tempInitVariables) / sizeof(tempInitVariables[0]));
192 // Save the init variables
193 m_Hough3DFinder->initialize(geometryHough3D, initVariables);
194
195 m_mConstD["modeHough3D"] = m_Hough3DFinder->getMode();
196 m_mConstV["initVariablesHough3D"] = vector<double> (6);
197 m_mConstV["initVariablesHough3D"][0] = tempInitVariables[0];
198 m_mConstV["initVariablesHough3D"][1] = tempInitVariables[1];
199 m_mConstV["initVariablesHough3D"][2] = tempInitVariables[2];
200 m_mConstV["initVariablesHough3D"][3] = tempInitVariables[3];
201 m_mConstV["initVariablesHough3D"][4] = tempInitVariables[4];
202 m_mConstV["initVariablesHough3D"][5] = tempInitVariables[5];
203
204 }
A class to finded stereo TS hits related to 2D tracks.
void initialize(const TVectorD &geometryVariables, std::vector< float > &initVariables)
Geometry variables.
void setInputFileName(const std::string &inputFileName)
Sets the config file for the GeoFinder.
void setMode(int mode)
Sets which 3D finder to use.

◆ TRGCDCHoughFinder()

TRGCDCHoughFinder ( const std::string &  name,
const TRGCDC TRGCDC,
unsigned  peakMin,
const std::string &  mappingFilePlus,
const std::string &  mappingFileMinus,
unsigned  doit 
)

Contructor.

Definition at line 79 of file HoughFinder.cc.

85 : _name(name),
86 _cdc(TRGCDC),
87 _circleH("CircleHough"),
88 _doit(doit),
89 _peakFinder("PeakFinder"),
90 _peakMin(peakMin)
91 {
92
93 _commonData = 0;
94
95 //...Read Hough plane parameters from file
96 const string fMap[2] = {mappingFilePlus, mappingFileMinus};
97 const string fName[2] = {string("circle hough plus"), string("circle hough minus")};
98
99 for (unsigned f = 0; f < 2; f++) {
100 const string fn = fMap[f];
101 ifstream infile(fn.c_str(), ios::in);
102 if (infile.fail()) {
103 B2FATAL("Cannot open Hough mapping file " << fn);
104 return;
105 }
106
107 //...Ignore lines not starting with a digit...
108 string ignores;
109 while (!isdigit(infile.peek())) {
110 getline(infile, ignores);
111 }
112
113 //...Read Hough plane cell number and limits...
114 unsigned nX = 0;
115 unsigned nY = 0;
116 double Ymin = 0.;
117 double Ymax = 0.;
118
119 infile >> nX >> nY >> Ymin >> Ymax;
120 infile.close();
121
122 _plane[f] = new TCHPlaneMulti2(fName[f], _circleH,
123 nX, 0, 2 * M_PI,
124 nY, Ymin, Ymax,
125 5);
126 }
127
128 //...Set charge...
129 _plane[0]->charge(1);
130 _plane[1]->charge(-1);
131
132#ifdef TRGCDC_DISPLAY_HOUGH
133 if (! H0)
134 H0 = new TCDisplayHough("Plus");
135 H0->link(* D);
136 H0->clear();
137 H0->show();
138 H0->move(630, 0);
139 if (! H1)
140 H1 = new TCDisplayHough("Minus");
141 H1->link(* D);
142 H1->clear();
143 H1->show();
144 H0->move(1260, 0);
145#endif
146
147 //...Old mapping (trasan methode)...
148 if (_doit == 0 || _doit == 1) {
149
150 //...Create patterns...
151 unsigned axialSuperLayerId = 0;
152 for (unsigned i = 0; i < _cdc.nSegmentLayers(); i++) {
154 const unsigned nWires = l->nCells();
155
156 if (! nWires) continue;
157 if ((* l)[0]->stereo()) continue;
158
159 _plane[0]->preparePatterns(axialSuperLayerId, nWires);
160 _plane[1]->preparePatterns(axialSuperLayerId, nWires);
161 for (unsigned j = 0; j < nWires; j++) {
162 const TCCell& w = * (* l)[j];
163 const float x = w.xyPosition().x();
164 const float y = w.xyPosition().y();
165
166 _plane[0]->clear();
167 _plane[0]->vote(x, y, +1, axialSuperLayerId, 1);
168 _plane[0]->registerPattern(axialSuperLayerId, j);
169
170 _plane[1]->clear();
171 _plane[1]->vote(x, y, -1, axialSuperLayerId, 1);
172 _plane[1]->registerPattern(axialSuperLayerId, j);
173 }
174 ++axialSuperLayerId;
175 }
176 }
177
178 //...Kaiyu's methode...
179 else {
180 mappingByFile(mappingFilePlus, mappingFileMinus);
181 }
182 }
TRGCDCHoughTransformationCircle _circleH
Circle Hough transformtion.
Definition: HoughFinder.h:148
void mappingByFile(const std::string &mappingFilePlus, const std::string &mappingFileMinus)
creates mappings by a file.
Definition: HoughFinder.cc:661
float charge(void) const
returns charge for this plane.

◆ TRGCDCHoughPlane()

TRGCDCHoughPlane ( const std::string &  name,
const TRGCDCHoughTransformation transformation,
unsigned  nX,
float  xMin,
float  xMax,
unsigned  nY,
float  yMin,
float  yMax 
)

Contructor.

Definition at line 23 of file HoughPlane.cc.

32// _cell(new unsigned[nX * nY * sizeof(unsigned)]),
33 _cell(new int[nX * nY]),
34 _patterns(0),
35 _nPatterns(0)
36 {
37 clear();
38 }
float xMin(void) const
returns min. of x.
float xMax(void) const
returns max. of x.
TRGCDCHoughPlaneBase(const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax)
Contructor.
float yMax(void) const
returns max. of y.
float yMin(void) const
returns min. of y.

◆ TRGCDCHoughPlaneBase()

TRGCDCHoughPlaneBase ( const std::string &  name,
const TRGCDCHoughTransformation transformation,
unsigned  nX,
float  xMin,
float  xMax,
unsigned  nY,
float  yMin,
float  yMax 
)

Contructor.

Definition at line 23 of file HoughPlaneBase.cc.

31 : _name(name),
32 _trans(trans),
33 _charge(0),
34 _nX(nX),
35 _xMin(xMin),
36 _xMax(xMax),
37 _xSize((xMax - xMin) / float(nX)),
38 _nY(nY),
39 _yMin(yMin),
40 _yMax(yMax),
41 _ySize((yMax - yMin) / float(nY)),
42 _area(TRGPoint2D(xMin, yMin), TRGPoint2D(xMax, yMax))
43 {
44 }

◆ TRGCDCHoughPlaneBoolean()

TRGCDCHoughPlaneBoolean ( const std::string &  name,
const TRGCDCHoughTransformation transformation,
unsigned  nX,
float  xMin,
float  xMax,
unsigned  nY,
float  yMin,
float  yMax 
)

Contructor.

Definition at line 27 of file HoughPlaneBoolean.cc.

36 _n(nX * nY / 32 + 1),
37 _cell(new unsigned[_n]),
38 _nPatterns(0),
39 _patterns(0),
40 _nActive(0),
41 _reverse(0)
42 {
43 clear();
44 }

◆ TRGCDCHoughPlaneMulti()

TRGCDCHoughPlaneMulti ( const std::string &  name,
const TRGCDCHoughTransformation transformation,
unsigned  nX,
float  xMin,
float  xMax,
unsigned  nY,
float  yMin,
float  yMax,
unsigned  nLayers 
)

Contructor.

Definition at line 23 of file HoughPlaneMulti.cc.

32 : TRGCDCHoughPlane(name, trans, nX, xMin, xMax, nY, yMin, yMax),
33 _nLayers(nLayers)
34 {
35
36 for (unsigned i = 0; i < N_LAYERS; i++)
37 _usage[i] = false;
38 for (unsigned i = 0; i < _nLayers; i++)
40 trans,
41 nX,
42 xMin,
43 xMax,
44 nY,
45 yMin,
46 yMax);
47 if (nLayers > N_LAYERS)
48 std::cout << "Too many layers requested("
49 << _nLayers << ") : "
50 << "max #layers = "
51 << N_LAYERS << std::endl;
52 }
TRGCDCHoughPlane(const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax)
Contructor.
Definition: HoughPlane.cc:23

◆ TRGCDCHoughPlaneMulti2()

TRGCDCHoughPlaneMulti2 ( const std::string &  name,
const TRGCDCHoughTransformation transformation,
unsigned  nX,
float  xMin,
float  xMax,
unsigned  nY,
float  yMin,
float  yMax,
unsigned  nLayers 
)

Contructor.

Definition at line 25 of file HoughPlaneMulti2.cc.

34 : TRGCDCHoughPlane(name, trans, nX, xMin, xMax, nY, yMin, yMax),
36 _reverse{} // 2019/07/31 by ytlai
37 {
38
39 for (unsigned i = 0; i < N_LAYERS; i++)
40 _usage[i] = false;
41 for (unsigned i = 0; i < _nLayers; i++)
42 _layers[i] = new TCHPlaneBoolean(name +
43 ":layer" +
44 TRGUtil::itostring(i),
45 trans,
46 nX,
47 xMin,
48 xMax,
49 nY,
50 yMin,
51 yMax);
52 if (nLayers > N_LAYERS)
53 std::cout
54 << "Too many layers requested(" << _nLayers << ") : "
55 << "max #layers = " << N_LAYERS << std::endl;
56 }
std::vector< unsigned > * _reverse
Pattern ID's for each cell.

◆ TRGCDCHoughTransformation()

TRGCDCHoughTransformation ( const std::string &  name)

Contructor.

Definition at line 22 of file HoughTransformation.cc.

23 : _name(name)
24 {
25
26
27 }

◆ TRGCDCHoughTransformationCircle()

TRGCDCHoughTransformationCircle ( const std::string &  name)
explicit

Contructor.

Definition at line 25 of file HoughTransformationCircle.cc.

28 {
29 }
TRGCDCHoughTransformation(const std::string &name)
Contructor.

◆ TRGCDCJLUT() [1/2]

TRGCDCJLUT ( const std::string &  name = "no_name")

Contructor.

Definition at line 47 of file JLUT.cc.

48 : m_name(name),
53 {
54 m_write = 0;
55 }
double m_outputIntMax
The integer offset of the output for LUT.
Definition: JLUT.h:167

◆ TRGCDCJLUT() [2/2]

TRGCDCJLUT ( const TRGCDCJLUT in)

Copy constructor.

Definition at line 57 of file JLUT.cc.

58 : m_const(in.m_const),
59 m_name(in.m_name),
60 m_fileName(in.m_fileName),
61 m_function(in.m_function),
62 m_floatFunction(in.m_floatFunction),
63 m_inputMin(in.m_inputMin),
64 m_inputMax(in.m_inputMax),
65 m_shiftOutputMin(in.m_shiftOutputMin),
66 m_shiftOffsetOutputMax(in.m_shiftOffsetOutputMax)
67 {
68 m_outputFlag = in.m_outputFlag;
69 m_inputBitsize = in.m_inputBitsize;
70 m_outputBitsize = in.m_outputBitsize;
71 m_inputOffset = in.m_inputOffset;
72 m_inputToReal = in.m_inputToReal;
73 m_outputOffset = in.m_outputOffset;
74 m_outputNBitsWithOffset = in.m_outputNBitsWithOffset;
75 m_outputType = in.m_outputType;
76 m_toReal = in.m_toReal;
77 m_inputShiftBits = in.m_inputShiftBits;
78 m_outputIntMax = in.m_outputIntMax;
79 m_write = 0;
80 }
std::vector< double > m_const
Storage for values used in function.
Definition: JLUT.h:117

◆ TRGCDCJSignal() [1/7]

Constructor.

Definition at line 55 of file JSignal.cc.

56 {
57 (*this) = TRGCDCJSignal(0);
58 }

◆ TRGCDCJSignal() [2/7]

TRGCDCJSignal ( double const &  value,
double const &  toReal,
TRGCDCJSignalData commonData 
)

Constant constructor.

Definition at line 132 of file JSignal.cc.

133 {
134 m_type = calType(value);
135 m_toReal = toReal;
137 m_minInt = m_int;
138 m_maxInt = m_int;
139 m_actual = value;
140 m_minActual = value;
141 m_maxActual = value;
143 m_debug = 0;
144 m_name = "";
145 m_vhdlCode = "";
146 m_finishClock = -1;
147 m_commonData = commonData;
148 // Check if there is overflow or underflow.
149 checkInt("TRGCDCJSignal(double, double)");
150 }

◆ TRGCDCJSignal() [3/7]

TRGCDCJSignal ( int const &  bitwidth,
double const &  value,
double const &  min,
double const &  max,
int const &  clock,
TRGCDCJSignalData commonData 
)

Actual to integer constructor with clock.

Definition at line 78 of file JSignal.cc.

80 {
81 m_bitsize = bitwidth;
82 m_type = calType(minValue);
83 if (m_type == -1) {
84 m_toReal = 1 / ((pow(2, bitwidth - 1) - 0.5) / max(maxValue, fabs(minValue)));
85 } else if (m_type == 1) {
86 m_toReal = 1 / ((pow(2, bitwidth) - 0.5) / maxValue);
87 }
91 m_actual = value;
92 m_minActual = minValue;
93 m_maxActual = maxValue;
94 m_debug = 0;
95 m_name = "";
96 m_vhdlCode = "";
97 m_finishClock = clock;
98 m_commonData = commonData;
99 // Check if there is overflow or underflow.
100 checkInt("TRGCDCJSignal(int, int, double, double)");
101 }

◆ TRGCDCJSignal() [4/7]

TRGCDCJSignal ( int const &  bitwidth,
double const &  value,
double const &  min,
double const &  max,
TRGCDCJSignalData commonData 
)

Actual to integer constructor with clock set to 0.

Definition at line 103 of file JSignal.cc.

105 {
106 (*this) = TRGCDCJSignal(bitwidth, value, minValue, maxValue, 0, commonData);
107 }

◆ TRGCDCJSignal() [5/7]

TRGCDCJSignal ( signed long long const &  intValue,
double const &  toReal,
signed long long const &  minInt,
signed long long const &  maxInt,
double const &  actual,
double const &  minActual,
double const &  maxActual,
int const &  finishClock,
TRGCDCJSignalData commonData,
bool  b_slv = 0 
)

Integer constructor.

Definition at line 109 of file JSignal.cc.

112 {
113 m_int = intValue;
114 m_minInt = minInt;
115 m_maxInt = maxInt;
116 m_actual = actual;
117 m_minActual = minActual;
118 m_maxActual = maxActual;
119 m_toReal = toReal;
120 if (b_slv == 0) m_type = calType();
121 else m_type = 2;
123 m_finishClock = finishClock;
124 m_debug = 0;
125 m_name = "";
126 m_vhdlCode = "";
127 m_commonData = commonData;
128 // Check if there is overflow or underflow.
129 checkInt("TRGCDCJSignal(int, double, signed long long, signed long long, double, double, double)");
130 }

◆ TRGCDCJSignal() [6/7]

TRGCDCJSignal ( std::vector< bool > const &  slvValue,
int const &  finishClock,
TRGCDCJSignalData commonData 
)

Slv constructor.

Definition at line 152 of file JSignal.cc.

153 : m_name("")
154 {
155 m_type = 2;
156 m_bitsize = slvValue.size();
157 m_slv = slvValue;
158 m_int = 0;
159 m_minInt = 0;
160 m_maxInt = 0;
161 m_actual = 0;
162 m_minActual = 0;
163 m_maxActual = 0;
164 m_toReal = 0;
165 m_debug = 0;
166 m_vhdlCode = "";
167 m_finishClock = finishClock;
168 m_commonData = commonData;
169 }
std::vector< bool > m_slv
storage for std_logic_vector. (Will be deprecated.)
Definition: JSignal.h:284

◆ TRGCDCJSignal() [7/7]

TRGCDCJSignal ( TRGCDCJSignalData commonData)
explicit

Copy constructor.

Definition at line 60 of file JSignal.cc.

61 : m_name(""),
62 m_vhdlCode("")
63 {
64 m_type = 1;
65 m_bitsize = -1;
66 m_int = 0;
67 m_minInt = 0;
68 m_maxInt = 0;
69 m_actual = 0;
70 m_minActual = 0;
71 m_maxActual = 0;
72 m_toReal = 0;
73 m_debug = 0;
74 m_finishClock = -2;
75 m_commonData = commonData;
76 }

◆ TRGCDCJSignalData()

Constructor for class.

Definition at line 34 of file JSignalData.cc.

35 : m_vhdlOutputFile("vhdlOutput"),
36 m_vhdlEntry(""),
37 m_vhdlDefine(""),
40 {
41 m_printVhdl = 0;
43 }

◆ TRGCDCLayer() [1/3]

Empty constructor for reduced CDC.

Definition at line 83 of file Layer.cc.

84 : _id(0),
89 _offset(0),
90 _nShifts(0),
91 _cellSize(0),
92 _nCells(0),
93 _innerRadius(0),
95 {
96 }

◆ TRGCDCLayer() [2/3]

TRGCDCLayer ( unsigned  id,
const TRGCDCCell w 
)

Constructor for track segments.

Definition at line 67 of file Layer.cc.

69 : _id(id),
70 _superLayerId(w.superLayerId()),
74 _offset(w.layer().offset()),
75 _nShifts(w.layer().nShifts()),
76 _cellSize(w.cellSize()),
77 _nCells(w.layer().nCells()),
78 _innerRadius(), // 2019/07/31 by ytlai
80 {
81 }

◆ TRGCDCLayer() [3/3]

TRGCDCLayer ( unsigned  id,
unsigned  superLayerId,
unsigned  localLayerId,
unsigned  axialStereoLayerId,
unsigned  axialStereoSuperLayerId,
float  offset,
int  nShifts,
float  cellSize,
unsigned  nCells,
float  innerRadius,
float  outerRadius 
)

Constructor.

Definition at line 41 of file Layer.cc.

52 : _name("unknown"),
53 _id(id),
64 {
65 }
float innerRadius(void) const
sets and returns inner radius.
Definition: Layer.h:250
float offset(void) const
returns offset.
Definition: Layer.h:180
float outerRadius(void) const
sets and returns outer radius.
Definition: Layer.h:257

◆ TRGCDCLink() [1/2]

TRGCDCLink ( const TRGCDCLink l)

Copy constructor.

Definition at line 76 of file Link.cc.

77 : _track(l._track),
78 _hit(l._hit),
79 _onTrack(l._onTrack),
80 _onWire(l._onWire),
81 _position(l._position),
82 _dPhi(l._dPhi),
83 _leftRight(l._leftRight),
84 _zStatus(l._zStatus),
85 _zPair(l._zPair),
86 _pull(l._pull),
87 _link(l._link),
88 _fit2D(l._fit2D)
89 {
90 _drift[0] = l._drift[0];
91 _drift[1] = l._drift[1];
92 _dDrift[0] = l._dDrift[0];
93 _dDrift[1] = l._dDrift[1];
94 for (unsigned i = 0; i < 7; ++i)
95 _neighbor[i] = l._neighbor[i];
96 for (unsigned i = 0; i < 4; ++i)
97 _arcZ[i] = l._arcZ[i];
98 }

◆ TRGCDCLink() [2/2]

TRGCDCLink ( TRGCDCTrack track = 0,
const TRGCDCCellHit hit = 0,
const HepGeom::Point3D< double > &  position = Point3D() 
)

Constructor.

Definition at line 44 of file Link.cc.

47 : _track(t),
48 _hit(h),
49 _position(p),
50 _dPhi(0),
51 _leftRight(0),
52 _pull(0),
53 _link(0),
54 _fit2D(0)
55 {
56 if (h) {
57 _drift[0] = h->drift(0);
58 _drift[1] = h->drift(1);
59 _dDrift[0] = h->dDrift(0);
60 _dDrift[1] = h->dDrift(1);
61 } else {
62 _drift[0] = 0.;
63 _drift[1] = 0.;
64 _dDrift[0] = 0.;
65 _dDrift[1] = 0.;
66 }
67
68 for (unsigned i = 0; i < 7; ++i)
69 _neighbor[i] = NULL;
70
71 if (h) {
72 _onTrack = _onWire = h->xyPosition();
73 }
74 }

◆ TRGCDCLpar() [1/2]

TRGCDCLpar ( )
inline

Constructor.

Definition at line 195 of file Lpar.h.

196 {
197 m_alpha = 0;
198 m_beta = 1;
199 m_gamma = 0;
200 m_kappa = 0;
201 }

◆ TRGCDCLpar() [2/2]

TRGCDCLpar ( const TRGCDCLpar l)
inlineprivate

Constructors and destructor.

Definition at line 203 of file Lpar.h.

204 {
205 m_alpha = l.m_alpha;
206 m_beta = l.m_beta;
207 m_gamma = l.m_gamma;
208 m_kappa = l.m_kappa;
209 }

◆ TRGCDCLpav() [1/2]

Constructor.

Definition at line 49 of file Lpav.cc.

49 :
50 m_wsum(),
51 m_xsum(),
52 m_ysum(),
53 m_xxsum(),
54 m_yysum(),
55 m_xysum(),
56 m_xrrsum(),
57 m_yrrsum(),
58 m_rrrrsum(),
60 m_xav(),
61 m_yav(),
62 m_xyavp(),
63 m_rscale(),
64 m_xxavp(),
65 m_yyavp(),
66 m_xrravp(),
67 m_yrravp(),
68 m_rrrravp(),
69 m_sinrot(),
70 m_cosrot(),
71 m_nc(),
72 m_chisq() // 2019/07/31 by ytlai
73 {
74 clear();
75 }
void clear()
member functions for clear
Definition: Lpav.h:252

◆ TRGCDCLpav() [2/2]

TRGCDCLpav ( const TRGCDCLpav lp)
inlineprivate

Constructors and destructor.

Definition at line 221 of file Lpav.h.

221 : TRGCDCLpar(lp)
222 {
223 m_wsum = lp.m_wsum;
224 m_xsum = lp.m_xsum;
225 m_ysum = lp.m_ysum;
226 m_xxsum = lp.m_xxsum;
227 m_yysum = lp.m_yysum;
228 m_xysum = lp.m_xysum;
229 m_xrrsum = lp.m_xrrsum;
230 m_yrrsum = lp.m_yrrsum;
231 m_rrrrsum = lp.m_rrrrsum;
232
234 m_xav = lp.m_xav;
235 m_yav = lp.m_yav;
236 m_xyavp = lp.m_xyavp;
237
238 m_rscale = lp. m_rscale;
239 m_xxavp = lp.m_xxavp;
240 m_yyavp = lp.m_yyavp;
241 m_xrravp = lp.m_xrravp;
242 m_yrravp = lp.m_yrravp;
243 m_rrrravp = lp.m_rrrravp;
244 m_sinrot = lp.m_sinrot;
245 m_cosrot = lp.m_cosrot;
246
247 m_nc = lp. m_nc;
248 m_chisq = lp.m_chisq;
249 return;
250 }
TRGCDCLpar()
Constructor.
Definition: Lpar.h:195

◆ TRGCDCLUT()

TRGCDCLUT ( )

Contructor.

Definition at line 38 of file LUT.cc.

38 :
39 m_data{}, m_bitsize(), m_name() // 2019/07/31 by ytlai
40 {
41 }

◆ TRGCDCMerger()

TRGCDCMerger ( const std::string &  name,
unitType  type,
const TRGClock systemClock,
const TRGClock dataClock,
const TRGClock userClockInput,
const TRGClock userClockOutput 
)

Constructor.

Definition at line 34 of file Merger.cc.

40 : TRGBoard(name, systemClock, dataClock, userClockOutput, userClockOutput),
41 _type(type),
42 _misb(0),
43 _mosb(0)
44 {
45 userClockInput.name(); //jb
46 }
unitType _type
Unit type.
Definition: Merger.h:130

◆ TRGCDCPeakFinder()

TRGCDCPeakFinder ( const std::string &  name)
explicit

Contructor.

Definition at line 43 of file PeakFinder.cc.

44 : _name(name)
45 {
46 }

◆ TRGCDCPerfectFinder()

TRGCDCPerfectFinder ( const std::string &  name,
const TRGCDC TRGCDC 
)

Contructor.

Definition at line 54 of file PerfectFinder.cc.

56 : _name(name), _cdc(TRGCDC)
57 {
58 }

◆ TRGCDCRelation()

TRGCDCRelation ( const TRGCDCTrackBase track,
const std::map< unsigned, unsigned > &  relation 
)

Constructor.

Definition at line 27 of file Relation.cc.

29 : _track(track),
30 _relations(relation),
31 _pairs(nullptr)
32 {
33 }

◆ TRGCDCSegment()

TRGCDCSegment ( unsigned  id,
const TRGCDCLayer layer,
const TRGCDCWire w,
const TRGClock clock,
const std::string &  TSLUTFile,
const std::vector< const TRGCDCWire * > &  wires 
)

Constructor.

Definition at line 40 of file Segment.cc.

46 : TCCell(id,
47 layer.size(),
48 layer,
49 w.forwardPosition(),
50 w.backwardPosition()),
51 _wires(cells),
52 _center(), // 2019/07/31 by ytlai
53 _signal(std::string("TS_") + TRGUtil::itostring(id), clock),
54 _storeHits{},
55 m_TSLUTFileName(TSLUTFile)
56 {
57 }
const TRGCDCWire * _center
Center wire.
Definition: Segment.h:173

◆ TRGCDCSegmentHit()

TRGCDCSegmentHit ( const TRGCDCSegment )
explicit

Constructor.

Definition at line 32 of file SegmentHit.cc.

34 : TCCHit(w,
35 //w.center().hit()->iCDCHit(),
36 //w.center().hit()->iCDCSimHit(),
37 //w.center().hit()->iMCParticle(),
38 //w.center().hit()->drift(0),
39 //w.center().hit()->dDrift(0),
40 //w.center().hit()->drift(1),
41 //w.center().hit()->dDrift(1),
42 //w.center().hit()->mcLR()) {
43 w.priority().hit()->iCDCHit(),
44 w.priority().hit()->iCDCSimHit(),
45 w.priority().hit()->iMCParticle(),
46 w.priority().hit()->drift(0),
47 w.priority().hit()->dDrift(0),
48 w.priority().hit()->drift(1),
49 w.priority().hit()->dDrift(1),
50 w.priority().hit()->mcLR())
51 {
52 }

◆ TRGCDCSteppingAction()

Constructor.

Definition at line 24 of file SteppingAction.cc.

25 {
26 }

◆ TRGCDCTrack() [1/2]

Constructor.

Definition at line 37 of file TRGCDCTrack.cc.

38 : TCTBase("unknown", 0),
39 _helix(ORIGIN, CLHEP::HepVector(5, 0), CLHEP::HepSymMatrix(5, 0)), m_2DFitChi2(9999), m_3DFitChi2(9999), m_debugValue(0)
40 {
41 }

◆ TRGCDCTrack() [2/2]

TRGCDCTrack ( const TRGCDCCircle c)
explicit

Constructor from a Circle.

Definition at line 43 of file TRGCDCTrack.cc.

44 : TCTBase((const TCTBase&) c),
45 _helix(ORIGIN, CLHEP::HepVector(5, 0), CLHEP::HepSymMatrix(5, 0)), m_2DFitChi2(9999), m_3DFitChi2(9999), m_debugValue(0)
46 {
47
48 //...Basic stuff...
49// const string newName = "CopyOF" + c.name();
50 name("ConvFrom" + c.name());
51 charge(c.charge());
52
53 //...Set a defualt fitter...
54// fitter(& TTrack::_fitter);
55
56 //...Calculate helix parameters...
57 CLHEP::HepVector a(5);
58 a[1] = fmod(atan2(_charge * (c.center().y() - ORIGIN.y()),
59 _charge * (c.center().x() - ORIGIN.x()))
60 + 4. * M_PI,
61 2. * M_PI);
62 a[2] = TCHelix::ConstantAlpha / c.radius();
63 a[0] = (c.center().x() - ORIGIN.x()) / cos(a[1]) - c.radius();
64 a[3] = 0.;
65 a[4] = 0.;
66 _helix.a(a);
67
68 //...Update links...
69 unsigned n = _tsAll.size();
70 for (unsigned i = 0; i < n; i++)
71 _tsAll[i]->track(this);
72
73 _fitted = false;
74 }

◆ TRGCDCTrackBase() [1/2]

TRGCDCTrackBase ( const std::string &  name,
double  charge 
)

Constructor.

Definition at line 47 of file TrackBase.cc.

48 : _name(name),
49 _status(0),
51 _ts(0),
52 _nTs(TRGCDC::getTRGCDC()->nSuperLayers()),
53 _fitter(0),
54 _fitted(false),
55 m_trackID(9999)
56 {
57 _ts = new vector<TCLink*>[_nTs];
58 }

◆ TRGCDCTrackBase() [2/2]

Copy constructor.

Definition at line 31 of file TrackBase.cc.

32 : _name("CopyOf" + t._name),
33 _status(t._status),
34 _charge(t._charge),
35 _ts(0),
36 _tsAll(t._tsAll),
37 _nTs(t._nTs),
38 _fitter(t._fitter),
39 _fitted(t._fitted),
40 m_trackID(t.m_trackID)
41 {
42 _ts = new vector<TCLink*>[_nTs];
43 for (unsigned i = 0; i < _nTs; i++)
44 _ts[i].assign(t._ts[i].begin(), t._ts[i].end());
45 }

◆ TRGCDCTracker2D()

TRGCDCTracker2D ( const std::string &  name,
const TRGClock systemClock,
const TRGClock dataClock,
const TRGClock userClockInput,
const TRGClock userClockOutput 
)

Constructor.

Definition at line 38 of file Tracker2D.cc.

43 : TRGBoard(name, systemClock, dataClock, userClockInput, userClockOutput)
44 {
45 }

◆ TRGCDCTrackMC()

TRGCDCTrackMC ( )
private

Constructor.

Definition at line 67 of file TrackMC.cc.

68 {
69 }

◆ TRGCDCTrackSegmentFinder() [1/2]

TRGCDCTrackSegmentFinder ( const TRGCDC TRGCDC,
bool  makeRootFile,
bool  logicLUTFlag 
)

Constructor.

Definition at line 49 of file TrackSegmentFinder.cc.

52 :
53 TRGBoard("", TRGClock("", 0, 0), TRGClock("", 0, 0), TRGClock("", 0, 0),
54 TRGClock("", 0, 0)),
55 _cdc(TRGCDC),
56 m_logicLUTFlag(logicLUTFlag),
57 m_makeRootFile(makeRootFile),
58 _type(), _tosbE(), _tosbT() // 2019/07/31 by ytlai
59 {
60
61 m_hitPatternInformation = new TClonesArray("TVectorD");
62 m_particleEfficiency = new TClonesArray("TVectorD");
63 m_tsInformation = new TClonesArray("TVectorD");
64 m_nnPatternInformation = new TClonesArray("TVectorD");
65
66 // For ROOT file
67 TDirectory* currentDir = gDirectory;
68 if (m_makeRootFile) {
69 m_fileTSF = new TFile("TSF.root", "RECREATE");
70
71 m_treeInputTSF = new TTree("m_treeInputTSF", "InputTSF");
72 m_treeInputTSF->Branch("hitPatternInformation", &m_hitPatternInformation,
73 32000, 0);
74
75 m_treeOutputTSF = new TTree("m_treeOutputTSF", "OutputTSF");
76 m_treeOutputTSF->Branch("particleEfficiency", &m_particleEfficiency, 32000, 0);
77 m_treeOutputTSF->Branch("tsInformation", &m_tsInformation, 32000, 0);
78
79 // For neural network TSF. Filled only when TSF and priority is hit.
80 m_treeNNTSF = new TTree("m_treeNNTSF", "NNTSF");
81 m_treeNNTSF->Branch("nnPatternInformation", &m_nnPatternInformation, 32000, 0);
82 }
83 currentDir->cd();
84 }
TRGSignalBundle * _tosbE
Input signal bundle.
TRGSignalBundle * _tosbT
Output signal bundle.

◆ TRGCDCTrackSegmentFinder() [2/2]

TRGCDCTrackSegmentFinder ( const TRGCDC TRGCDC,
const std::string &  name,
boardType  type,
const TRGClock systemClock,
const TRGClock dataClock,
const TRGClock userClockInput,
const TRGClock userClockOutput,
const std::vector< TRGCDCSegment * > &  tsSL 
)

Constructor.

Definition at line 87 of file TrackSegmentFinder.cc.

95 : TRGBoard(name, systemClock, dataClock, userClockInput, userClockOutput),
96 _cdc(TRGCDC),
99 m_fileTSF(),
100 _type(type),
101 // _tisb(0),
102 _tosbE(0),
103 _tosbT(0),
104 _tsSL(tsSL)
105 {
106
107 }
std::string m_rootTSFFilename
ROOT file name string.
boardType type(void) const
board type of TSF

◆ TRGCDCWire()

TRGCDCWire ( unsigned  id,
unsigned  localId,
const TRGCDCLayer ,
const HepGeom::Point3D< double > &  forwardPosition,
const HepGeom::Point3D< double > &  backwardPosition,
const TRGClock clock 
)

Constructor.

Definition at line 34 of file Wire.cc.

40 : TCCell(id, localId, l, fp, bp),
41 _mcHits(),
42 _signal(clock),
43 _signal_adc(clock)
44 {
45 _signal.name(name());
47 }

◆ TRGCDCWireHit()

TRGCDCWireHit ( const TRGCDCWire w,
unsigned  indexCDCHit = 0,
unsigned  indexCDCSimHit = 0,
unsigned  indexMCParticle = 0,
float  driftLeft = 0,
float  driftLeftError = 0,
float  driftRight = 0,
float  driftRightError = 0,
int  mcLRflag = 1,
float  fudgeFacgtor = 1 
)
explicit

Constructor.

Definition at line 30 of file WireHit.cc.

40 : TCCHit((TRGCDCCell&) w,
41 indexCDCHit,
42 indexCDCSimHit,
43 indexMCParticle,
44 driftLeft,
45 driftLeftError,
46 driftRight,
47 driftRightError,
48 mcLRflag,
49 fudgeFactor),
50 _mc(), //2019/07/31 by ytlai
51 _iCDCSimHit(indexCDCSimHit)
52 {
53 }

◆ TRGCDCWireHitMC()

TRGCDCWireHitMC ( const TRGCDCWire w,
const TRGCDCWireHit wh 
)

Constructor.

Definition at line 21 of file WireHitMC.cc.

23 : _wire(w),
24 _hit(wh),
25 _distance(), // 2019/07/31 by ytlai
26 _energy(),
27 _hep(),
29 {
30 }
const TRGCDCWire * _wire
pointer to TRGCDCWire
Definition: WireHitMC.h:73
float _energy
energy
Definition: WireHitMC.h:87

◆ TRGChannel()

TRGChannel ( const std::string &  name,
const TRGBoard sender,
const TRGBoard receiver 
)

Constructor.

Definition at line 21 of file Channel.cc.

24 : _name(name),
26 _receiver(receiver),
27 _data(0)
28 {
29 }
const TRGBoard & _receiver
Receiver.
Definition: Channel.h:68
const TRGBoard & sender(void) const
sender TRG board
Definition: Channel.h:100

◆ TRGClock() [1/2]

TRGClock ( const std::string &  name,
const TRGClock source,
unsigned  multiplicationFactor,
unsigned  divisionFactor = 1 
)

Constructor with clock source.

Definition at line 60 of file Clock.cc.

64 : _name(name),
65 _source(& source),
66 _multi(multiplicationFactor),
67 _div(divisionFactor),
68 _offset(source._offset),
69 _frequency(source._frequency *
70 double(multiplicationFactor) /
71 double(divisionFactor)),
72 _cycle(source._cycle /
73 double(multiplicationFactor) *
74 double(divisionFactor)),
75 _min(source._min * int(multiplicationFactor) / int(divisionFactor)),
76 _max(source._max * int(multiplicationFactor) / int(divisionFactor)),
78 {
79 }

◆ TRGClock() [2/2]

TRGClock ( const std::string &  name,
double  offset,
double  frequency 
)

Constructor. "offset" is in unit of ns. "frequency" is in unit of MHz.

Definition at line 31 of file Clock.cc.

34 : _name(name),
35 _source(0),
36 _multi(1),
37 _div(1),
40 _cycle(1000 / frequency),
41// _min(int(TRGTime::min() / frequency)),
42// _max(int(TRGTime::max() / frequency)),
43// _min(numeric_limits<int>::min() + 100),
44// _max(numeric_limits<int>::max() - 100),
45 _min(numeric_limits<int>::min() / 16),
46 _max(numeric_limits<int>::max() / 16),
48 {
49
50 if (this != & Belle2_GDL::GDLSystemClock) {
51 if (Belle2_GDL::GDLSystemClock.minTiming() > minTiming())
52 _min = int((Belle2_GDL::GDLSystemClock.minTiming() - _offset)
53 / _cycle);
54 if (Belle2_GDL::GDLSystemClock.maxTiming() < maxTiming())
55 _max = int((Belle2_GDL::GDLSystemClock.maxTiming() - _offset)
56 / _cycle);
57 }
58 }
double offset(void) const
returns offset of the clock zero position in nano second.
Definition: Clock.h:150

◆ TrgEclDatabaseImporter()

TrgEclDatabaseImporter Constructor.

Definition at line 38 of file TrgEclDatabaseImporter.cc.

38 : startExp(0), startRun(0), endExp(-1), endRun(-1)
39 {}

◆ TRGGDL()

TRGGDL ( const std::string &  configFile,
unsigned  simulationMode,
unsigned  fastSimulationMode,
unsigned  firmwareSimulationMode,
const std::string &  Phase,
bool  algFromDB = true,
const std::string &  algFilePath = "ftd.alg",
int  debugLevel = 0,
double  timquality_threshold_sfin = 0,
double  timquality_threshold_fine = 0 
)
private

Constructor.

Definition at line 110 of file TRGGDL.cc.

122 _simulationMode(simulationMode),
123 _fastSimulationMode(fastSimulationMode),
125 _Phase(Phase),
126 _algFilePath(algFilePath),
127 _clock(Belle2_GDL::GDLSystemClock),
128 _offset(15.3),
129 _isb(0),
130 _osb(0),
131 _timquality_threshold_sfin(timquality_threshold_sfin),
132 _timquality_threshold_fine(timquality_threshold_fine),
133 _algFromDB(algFromDB)
134 {
135
136 if (TRGDebug::level()) {
137 cout << "TRGGDL ... TRGGDL initializing with " << _configFilename
138 << endl
139 << " mode=0x" << hex << _simulationMode << dec << endl;
140 }
141
142 initialize();
143
144 if (TRGDebug::level()) {
145 cout << "TRGGDL ... TRGGDL created with " << _configFilename << endl;
146 _clock.dump();
147 }
148
149 for (int i = 0; i < m_InputBitsDB->getninbit(); i++) {
150 _inpBitNames.push_back(std::string(m_InputBitsDB->getinbitname(i)));
151 }
152
153 for (int i = 0; i < m_FTDLBitsDB->getnoutbit(); i++) {
154 _oupBitNames.push_back(std::string(m_FTDLBitsDB->getoutbitname(i)));
155 }
156
157 }
unsigned _fastSimulationMode
Fast simulation mode.
Definition: TRGGDL.h:221
void initialize(void)
initializes GDL.
Definition: TRGGDL.cc:160

◆ TRGGRL()

TRGGRL ( const std::string &  configFile,
unsigned  simulationMode,
unsigned  fastSimulationMode,
unsigned  firmwareSimulationMode 
)
private

Constructor.

Definition at line 80 of file TRGGRL.cc.

84 : _debugLevel(0),
86 _simulationMode(simulationMode),
87 _fastSimulationMode(fastSimulationMode),
89 _clock(Belle2_GDL::GDLSystemClock)
90 {
91
92 B2DEBUG(100, "TRGGRL ... TRGGRL initializing with " << _configFilename
93 << " mode=0x" << hex << _simulationMode << dec);
94
95 initialize();
96
97 B2DEBUG(100, "TRGGRL ... TRGGRL created with " << _configFilename);
98 }
unsigned _fastSimulationMode
Fast simulation mode.
Definition: TRGGRL.h:153

◆ TRGGRLMatch()

TRGGRLMatch ( TRGCDCTrack track,
TRGECLCluster cluster,
int  flag 
)

public member functions of TRGGRLMatch class Private variables can be called by the corresponding get function

Constructor

Definition at line 25 of file TRGGRLMatch.cc.

26 : _track(track),
27 _cluster(cluster),
28 _match3D(flag)
29 {
30 calculate();
31 }
void calculate(void)
a function to execute calculation of matching
Definition: TRGGRLMatch.cc:38

◆ TRGOpticalLink()

TRGOpticalLink ( const std::string &  name,
const TRGClock clock 
)

Constructor.

Definition at line 21 of file OpticalLink.cc.

22 :
23 _name(name),
24 _clock(& clock)
25 {
26 }

◆ TRGPoint2D() [1/5]

Constructor.

Definition at line 17 of file Point2D.cc.

18 {
19 _p[0] = 0.;
20 _p[1] = 0.;
21 }

◆ TRGPoint2D() [2/5]

TRGPoint2D ( const CLHEP::Hep3Vector &  a)
explicit

Constructor.

Definition at line 41 of file Point2D.cc.

42 {
43 _p[0] = a.x();
44 _p[1] = a.y();
45 }

◆ TRGPoint2D() [3/5]

TRGPoint2D ( const HepGeom::Point3D< double > &  a)

Constructor.

Definition at line 29 of file Point2D.cc.

30 {
31 _p[0] = a.x();
32 _p[1] = a.y();
33 }

◆ TRGPoint2D() [4/5]

TRGPoint2D ( const Vector3D a)
explicit

Constructor.

Definition at line 35 of file Point2D.cc.

36 {
37 _p[0] = a.x();
38 _p[1] = a.y();
39 }

◆ TRGPoint2D() [5/5]

TRGPoint2D ( double  x,
double  y 
)

Constructor.

Definition at line 23 of file Point2D.cc.

24 {
25 _p[0] = x;
26 _p[1] = y;
27 }

◆ TRGSignal() [1/7]

TRGSignal ( const std::string &  name,
const TRGClock c = Belle2_GDL::GDLSystemClock 
)
explicit

Constructor with name.

Definition at line 81 of file Signal.cc.

81 :
82 _name(name),
83 _clock(& c),
84 _history()
85 {
86#if TRG_DEBUG
88#endif
89 }

◆ TRGSignal() [2/7]

TRGSignal ( const TRGClock c = Belle2_GDL::GDLSystemClock)

Constructor.

Definition at line 23 of file Signal.cc.

23 :
24 _name("?"),
25 _clock(& c),
26 _history()
27 {
28 }

◆ TRGSignal() [3/7]

TRGSignal ( const TRGClock c,
double  t0,
double  t1 
)

Constructor with clock and timing(t0 leading, t1 trailing).

t0 and t1 are in absolute time.

Definition at line 66 of file Signal.cc.

66 :
67 _name("?"),
68 _clock(& c),
69 _history()
70 {
71 TRGTime time0(t0, true, c);
72 TRGTime time1(t1, false, c);
73 _history.push_back(time0);
74 _history.push_back(time1);
75
76#if TRG_DEBUG
78#endif
79 }

◆ TRGSignal() [4/7]

TRGSignal ( const TRGClock c,
int  t0,
int  t1 
)

Constructor with clock and timing(t0 leading, t1 trailing).

Definition at line 51 of file Signal.cc.

51 :
52 _name("?"),
53 _clock(& c),
54 _history()
55 {
56 TRGTime time0(t0, true, c);
57 TRGTime time1(t1, false, c);
58 _history.push_back(time0);
59 _history.push_back(time1);
60
61#if TRG_DEBUG
63#endif
64 }

◆ TRGSignal() [5/7]

TRGSignal ( const TRGSignal t)

Copy constructor.

Definition at line 91 of file Signal.cc.

91 :
92// _history(t._history),
93 _name(t._name),
94 _clock(t._clock)
95 {
96 const unsigned n = t._history.size();
97 for (unsigned i = 0; i < n; i++) {
98 _history.push_back(t._history[i]);
99 }
100#if TRG_DEBUG
102#endif
103 }

◆ TRGSignal() [6/7]

TRGSignal ( const TRGTime t)
explicit

Constructor.

Definition at line 105 of file Signal.cc.

105 :
106 _name(t.name()),
107 _clock(& t.clock())
108 {
109
110 //...Check edge...
111 if (t.edge()) {
112
113 //...Store itself...
114 _history.push_back(t);
115
116 //...Set falling edge...
117 _history.push_back(t.clock().maxTRGTime(false));
118 } else {
119
120 //...Set rising edge...
121 _history.push_back(t.clock().minTRGTime(true));
122
123 //...Store itself...
124 _history.push_back(t);
125 }
126#if TRG_DEBUG
128#endif
129 }

◆ TRGSignal() [7/7]

TRGSignal ( const TRGTime t0,
const TRGTime t1 
)

Constructor with clock and timing(t0 leading, t1 trailing).

Definition at line 30 of file Signal.cc.

30 :
31 _name("?"),
32 _clock(& t0.clock()),
33 _history()
34 {
35#if TRG_DEBUG
36 if ((& t0.clock()) != (& t1.clock()))
37 cout << "TRGSignal !!! signal is made with two different clocks"
38 << endl
39 << " t0.clock=" << t0.clock().name() << endl
40 << " t1.clock=" << t1.clock().name() << endl;
41#endif
42
43 _history.push_back(t0);
44 _history.push_back(t1);
45
46#if TRG_DEBUG
48#endif
49 }

◆ TRGSignalBundle() [1/4]

TRGSignalBundle ( const std::string &  name,
const TRGClock c 
)

Constructor with name.

Definition at line 38 of file SignalBundle.cc.

39 : _name(name),
40 _clock(& c)
41 {
42 }

◆ TRGSignalBundle() [2/4]

TRGSignalBundle ( const std::string &  name,
const TRGClock clock,
const TRGSignalBundle input,
const unsigned  outputBitSize,
const unsigned  registerBitSize,
TRGState(*)(const TRGState &in, TRGState &registers, bool &logicStillActive)  packer 
)

Constructor with a packer which can handle multiple clock states.

Definition at line 91 of file SignalBundle.cc.

99 : _name(name),
100 _clock(& clock)
101 {
102
103 const string sn = "TRGSignalBundle constructor(4)";
105
106 //...Get state information...
107 const vector<int> states = input.stateChanges();
108 const unsigned nStates = states.size();
109
110 if (TRGDebug::level()) {
111 cout << TRGDebug::tab() << "#states=" << nStates << endl;
112 for (unsigned i = 0; i < nStates; i++)
113 cout << TRGDebug::tab() << i << " : " << states[i] << endl;
114 }
115
116 //...Input is stably inactive...
117 if (nStates == 0) {
118 TRGSignalVector* sb = new TRGSignalVector(_name, clock, outputBitSize);
119 push_back(sb);
121 return;
122 }
123
124 //...Loop over all states...
125 vector<TRGState*> outputStates;
126 vector<int> newStates;
127 int lastClock = states[0] - 1;
128 TRGState* r = new TRGState(registerBitSize);
129 for (unsigned i = 0; i < nStates; i++) {
130
131 if (TRGDebug::level())
132 cout << TRGDebug::tab() << "Last clock=" << lastClock << endl;
133
134 //...Check clock position...
135 if (states[i] <= lastClock)
136 continue;
137
138 if (TRGDebug::level()) {
139 cout << TRGDebug::tab() << "state=" << i << endl;
140 r->dump("", TRGDebug::tab() + "reg=");
141 }
142
143 bool active = true;
144 int nLoops = 0;
145 while (active) {
146 int clk = states[i] + nLoops;
147 lastClock = clk;
148
149 TRGState s = input.state(clk);
150 outputStates.push_back(new TRGState((* packer)(s, * r, active)));
151 newStates.push_back(clk);
152 ++nLoops;
153
154 if (TRGDebug::level()) {
155 cout << TRGDebug::tab() << "state=" << i << ",clock=" << clk <<
156 ",LogicActive=" << active << endl;
157 r->dump("", TRGDebug::tab() + "reg=");
158 }
159 }
160 }
161 delete r;
162
163 //...Size of output...
164 // unsigned outputSize = 0;
165 // if (outputStates.size())
166 // outputSize = outputStates.back()->size();
167
168 //...Creat a SignalVector...
169 TRGSignalVector* sb = new TRGSignalVector(_name, clock, outputBitSize);
170
171 //...Make a SignalVector...
172 // const TRGState &os0 = * outputStates[0];
173 // sb->set(os0, 0); delete &os0;
174 // const unsigned n = outputStates.size(); // same as nStates
175
176 const unsigned n = outputStates.size();
177 for (unsigned i = 0; i < n; i++) {
178 const TRGState* s = outputStates[i];
179 sb->set((* s), newStates[i]);
180 delete s;
181 }
182
183 push_back(sb);
184
186 }

◆ TRGSignalBundle() [3/4]

TRGSignalBundle ( const std::string &  name,
const TRGClock clock,
const TRGSignalBundle input,
const unsigned  outputBitSize,
TRGState(*)(const TRGState &)  packer 
)

Constructor with a packer.

Definition at line 44 of file SignalBundle.cc.

49 : _name(name),
50 _clock(& c)
51 {
52
53 //...Get state information...
54 const vector<int> states = input.stateChanges();
55 const unsigned nStates = states.size();
56
57 //...Loop over all states...
58 vector<TRGState*> outputStates;
59 for (unsigned i = 0; i < nStates; i++) {
60 TRGState s = input.state(states[i]);
61
62 // if (TRGDebug::level()) {
63 // cout << TRGDebug::tab() << "Clock=" << states[i] << endl;
64 // }
65
66 outputStates.push_back(new TRGState((* packer)(s)));
67 }
68
69 //...Bit size of output...
70 // unsigned outputSize = 0;
71 // if (outputStates.size())
72 // outputSize = outputStates.back()->size();
73
74 //...Creat a SignalVector...
75 TRGSignalVector* sb = new TRGSignalVector(_name, c, outputBitSize);
76
77 //...Make a SignalVector...
78 // const TRGState &os0 = * outputStates[0];
79 // sb->set(os0, 0); delete &os0;
80 // const unsigned n = outputStates.size(); // same as nStates
81
82 for (unsigned i = 0; i < nStates; i++) {
83 const TRGState* s = outputStates[i];
84 sb->set((*s), states[i]);
85 delete s;
86 }
87
88 push_back(sb);
89 }

◆ TRGSignalBundle() [4/4]

TRGSignalBundle ( const TRGClock c)
explicit

Default constructor.

Definition at line 32 of file SignalBundle.cc.

33 : _name("unknown"),
34 _clock(& c)
35 {
36 }

◆ TRGSignalVector() [1/3]

TRGSignalVector ( const std::string &  name,
const TRGClock c,
unsigned  size = 0 
)

Default constructor.

Constructor with name.

Definition at line 29 of file SignalVector.cc.

32 : _name(name),
33 _clock(& c)
34 {
35 for (unsigned i = 0; i < size; i++) {
36 const string n = _name + ":bit" + TRGUtilities::itostring(i);
37 TRGSignal t(n, c);
38 push_back(t);
39 }
40 }

◆ TRGSignalVector() [2/3]

TRGSignalVector ( const TRGSignal t)
explicit

Constructor.

Definition at line 52 of file SignalVector.cc.

52 :
53 _name("VectorOf" + t.name())
54 {
55 _clock = & t.clock();
56 push_back(t);
57 }

◆ TRGSignalVector() [3/3]

TRGSignalVector ( const TRGSignalVector t)
explicit

Copy constructor.

Definition at line 42 of file SignalVector.cc.

42 :
43 std::vector<TRGSignal>(),
44 _name("CopyOf" + t._name)
45 {
46 _clock = t._clock;
47 const unsigned n = t.size();
48 for (unsigned i = 0; i < n; i++)
49 push_back(t[i]);
50 }

◆ TRGState() [1/6]

TRGState ( const char *  inChar,
unsigned  type 
)

Constructor. type: 0-> binary, 1->hex.

Definition at line 124 of file State.cc.

125 : _size(0),
126 _n(0),
127 _state(0)
128 {
129
130 if (inType == 0) {
131 _size = strlen(inChar);
132 // Check if all values are binary
133 for (unsigned iBit = 0; iBit < _size; iBit++) {
134 if (!(inChar[iBit] == '0' || inChar[iBit] == '1')) {
135#ifdef TRG_DEBUG
136 cout << "TRGState::TRGState !!! invalid char found : aborted"
137 << endl;
138 cout << " invalid char = [" << inChar[iBit]
139 << "]" << endl;
140#endif
141 return;
142 }
143 }
144 } else if (inType == 1) {
145 _size = strlen(inChar) * 4;
146 // Check if all values are hex
147 for (unsigned iChar = 0; iChar < _size / 4; iChar++) {
148 if (!isxdigit(inChar[iChar])) {
149#ifdef TRG_DEBUG
150 cout << "TRGState::TRGState !!! invalid char found : aborted"
151 << endl;
152 cout << " invalid char = ["
153 << inChar[iChar] << "]" << endl;
154#endif
155 return;
156 }
157 }
158 } else {
159#ifdef TRG_DEBUG
160 cout << "TRGState::TRGState !!! invalid type : aborted"
161 << endl;
162 cout << " invalid type = " << inType
163 << endl;
164#endif
165 return;
166 }
167
168 _n = _size / _bsu;
169 if (_size % _bsu) ++_n;
170 _state = (unsigned*) calloc(_n, _su);
171 if (inType == 0) {
172 for (unsigned iBit = 0; iBit < _size; iBit++) {
173 const unsigned wp = iBit / _bsu;
174 const unsigned bp = iBit % _bsu;
175 if (inChar[_size - 1 - iBit] == '1')
176 _state[wp] |= (1 << bp);
177 else
178 _state[wp] &= ~(1 << bp);
179 }
180 } else if (inType == 1) {
181 for (unsigned iChar = 0; iChar < _size / 4; iChar++) {
182 if (iChar % 8 == 0) _state[iChar / 8] = 0;
183 short unsigned t_int;
184 unsigned charP = _size / 4 - 1 - iChar;
185 if (inChar[charP] > 47 && inChar[charP] < 58) t_int = inChar[charP] - 48;
186 else t_int = inChar[charP] - 97 + 10;
187 _state[iChar / 8] += t_int << ((iChar % 8) * 4);
188 }
189 }
190 }

◆ TRGState() [2/6]

TRGState ( std::vector< bool >  states)

Constructor.

Definition at line 79 of file State.cc.

80 : _size(0),
81 _n(0),
82 _state(0)
83 {
84
85 _size = states.size();
86 _n = _size / _bsu;
87 if (_size % _bsu) ++_n;
88 _state = (unsigned*) calloc(_n, _su);
89
90 for (unsigned i = 0; i < _size; i++) {
91 const unsigned wp = i / _bsu;
92 const unsigned bp = i % _bsu;
93 if (states[i])
94 _state[wp] |= (1 << bp);
95 else
96 _state[wp] &= ~(1 << bp);
97
98// cout << "size,given,states=" << _size << "," << states[i] << ","
99// << _state[wp] << endl;
100
101 }
102 }

◆ TRGState() [3/6]

TRGState ( std::vector< unsigned > &  states,
unsigned  order 
)

Constructor. order: 0=>inVector[0] is lsb. 1=>inVector[0] is msb.

Definition at line 104 of file State.cc.

105 : _size(0),
106 _n(0),
107 _state(0)
108 {
109
110 _size = states.size() * _bsu;
111 _n = _size / _bsu;
112 _state = (unsigned*) calloc(_n, _su);
113
114 for (unsigned i = 0; i < _n; i++) {
115
116 if (order == 0) _state[i] = states[i];
117 else _state[_n - 1 - i] = states[i];
118// cout << "size,given,states=" << _size << "," << states[i] << ","
119// << _state[wp] << endl;
120
121 }
122 }

◆ TRGState() [4/6]

TRGState ( unsigned  bitSize,
const bool *const  states 
)

Constructor.

Definition at line 59 of file State.cc.

60 : _size(bitSize),
61 _n(0),
62 _state(0)
63 {
64
65 _n = _size / _bsu;
66 if (_size % _bsu) ++_n;
67 _state = (unsigned*) calloc(_n, _su);
68
69 for (unsigned i = 0; i < _size; i++) {
70 const unsigned wp = i / _bsu;
71 const unsigned bp = i % _bsu;
72 if (s[i])
73 _state[wp] |= (1 << bp);
74 else
75 _state[wp] &= ~(1 << bp);
76 }
77 }

◆ TRGState() [5/6]

TRGState ( unsigned  bitSize,
unsigned  value 
)

Constructor with unsigned.

Definition at line 41 of file State.cc.

42 : _size(bitSize),
43 _n(0),
44 _state(0)
45 {
46 _n = _size / _bsu;
47 if (_size % _bsu) ++_n;
48 if (_n)
49 _state = (unsigned*) calloc(_n, _su);
50
51 for (unsigned i = 0; i < bitSize; i++) {
52 const unsigned wp = i / _bsu;
53 const unsigned bp = i % _bsu;
54 if (value & (1 << i))
55 _state[wp] |= (1 << bp);
56 }
57 }

◆ TRGState() [6/6]

TRGState ( unsigned  bitSize = 0)

Default constructor.

Definition at line 30 of file State.cc.

31 : _size(bitSize),
32 _n(0),
33 _state(0)
34 {
35 _n = _size / _bsu;
36 if (_size % _bsu) ++_n;
37 if (_n)
38 _state = (unsigned*) calloc(_n, _su);
39 }

◆ TRGTime() [1/3]

TRGTime ( const TRGTime t)

Copy constructor.

Definition at line 22 of file Time.cc.

22 :
23 _time(t._time),
24 _edge(t._edge),
25 _clock(t._clock),
26 _name(t._name)
27 {
28 }

◆ TRGTime() [2/3]

TRGTime ( double  timing,
bool  edge,
const TRGClock clock,
const std::string &  name = "signal" 
)

Constructor with clock.

For rising edge, edge must be true. Given timing is syncronized to clock.

Definition at line 30 of file Time.cc.

33 :
34 _time(clock.position(timing)),
35 _edge(edge),
36 _clock(& clock),
37 _name(name)
38 {
39 }
bool edge(void) const
returns edge information.
Definition: Time.h:156

◆ TRGTime() [3/3]

TRGTime ( int  clockPosition,
bool  edge,
const TRGClock clock,
const std::string &  name = "signal" 
)

Constructor with clock.

For rising edge, edge must be true. Given timing is syncronized to clock.

Definition at line 41 of file Time.cc.

44 :
45 _time(timing),
46 _edge(edge),
47 _clock(& clock),
48 _name(name)
49 {
50 }

◆ tsfboard()

TRGCDCTrackSegmentFinder * tsfboard ( unsigned  id) const
inline

returns a TSF board.

Definition at line 1047 of file TRGCDC.h.

1048 {
1049 return _tsfboards[a];
1050 }

◆ type() [1/3]

TRGCDCFrontEnd::boardType type ( void  ) const

returns type.

Definition at line 59 of file FrontEnd.cc.

60 {
61 return _type;
62 }

◆ type() [2/3]

TRGCDCMerger::unitType type ( void  ) const

return type.

Definition at line 59 of file Merger.cc.

60 {
61 return _type;
62 }

◆ type() [3/3]

TRGCDCTrackSegmentFinder::boardType type ( void  ) const

board type of TSF

Definition at line 121 of file TrackSegmentFinder.cc.

122 {
123 return _type;
124 }

◆ udrel()

bool udrel ( vector< unsigned >  a,
vector< unsigned >  b 
)

...udrel...

Definition at line 183 of file PeakFinder.cc.

184 {
185 bool t = true;
186 //case 1
187 if (a[1] == 0 && a[2] == 0 && a[3] == 0 && a[4] == 0) {
188 t = false;
189 }
190 //case 2
191 if (a[3] == 0 && a[4] == 0 && b[1] == 0 && b[2] == 0) {
192 t = false;
193 }
194 //case 3
195 if (b[1] == 0 && b[2] == 0 && b[3] == 0 && b[4] == 0) {
196 t = false;
197 }
198
199 return t;
200 }

◆ unit() [1/2]

int unit ( double  period) const
inline

returns min # of clocks to cover given time period.

Definition at line 180 of file Clock.h.

181 {
182 return int(a / _cycle) + 1;
183 }

◆ unit() [2/2]

TRGPoint2D unit ( void  ) const
inline

unit vector

Definition at line 187 of file Point2D.h.

188 {
189 double sum2 = _p[0] * _p[0] + _p[1] * _p[1];
190 if (sum2 == 0.) return TRGPoint2D(0., 0.);
191 double sum = sqrt(sum2);
192 return TRGPoint2D(_p[0] / sum, _p[1] / sum);
193 }

◆ unpacker()

void unpacker ( const TRGState input,
TRGState output 
)
static

Unpack TSF output.

Definition at line 157 of file Tracker2D.cc.

159 {
160
161 const string sn = "TRGCDC 2D unpacker";
163
164 //...Constants...
165// const unsigned noHit = 0b11111111;
166 const unsigned sizeSB = 420; // bits
167 const unsigned sizeTS = 21; // bits
168 const unsigned sizeID = 8; // bits
169 const unsigned posID = 13; // bit position
170
171 //...Store hit TSF id...
172 unsigned tsfId[5][20]; // Max. 20 TSF ID is sent
173 bool hitFound = false;
174 for (unsigned i = 0; i < 5; i++) {
175 for (unsigned j = 0; j < 20; j++) {
176 unsigned jr = 20 - j - 1;
177 tsfId[i][jr] = input.subset(i * sizeSB + sizeTS * jr + posID,
178 sizeID);
179 if (tsfId[i][jr] != 0) {
180 output.set(tsfId[i][jr] * 16, true);
181 hitFound = true;
182 }
183 }
184 }
185
186 if (TRGDebug::level() && hitFound) {
187 input.dump("", TRGDebug::tab() + "input bits:");
188 cout << TRGDebug::tab() << "TSF hit ID" << endl;
189 for (unsigned i = 0; i < 5; i++) {
190 cout << TRGDebug::tab() << " ASL" << i
191 << " < " << nTSF(i) / 2 << endl;
192 cout << TRGDebug::tab() << " ";
193 for (unsigned j = 0; j < 20; j++) {
194 cout << tsfId[i][j] << ",";
195 }
196 cout << endl;
197 }
198 }
199
201 }

◆ unpackerInner()

void unpackerInner ( const TRGState input,
const TRGState output 
)
static

Unpack TRGState.

Definition at line 719 of file Merger.cc.

721 {
722
723 TRGState inputInside = input.subset(0, 256);
724 TRGState inputOutside = input.subset(256, 256);
725
726 unsigned ipos = 0, o = 0;
727
728 cout << "======================= Merger unpackerInner ================================= " << endl;
729 cout << "input bit information: " << endl;
730 for (unsigned bi = 0; bi < input.size(); bi++) {
731 if (input[bi]) cout << "* " ;
732 else cout << ". ";
733 if ((bi % 16) == 15) cout << endl;
734 if (bi == 255) cout << "--------------------------------" << endl;
735 }
736
737 cout << "Input bit size = " << input.size() << " and Output bit size =" << output.size() << endl << endl;
738
739 cout << "Hit map: " << endl;
740 cout << "inputOutside : wire hit pattern" << endl;
741 cout << " ";
742 for (unsigned i = 0; i < 48; i++) {
743 const unsigned j = 47 - i;
744 if (i && ((i % 8) == 0))
745 cout << "_";
746 if (inputOutside[j])
747 cout << "*";
748 else
749 cout << ".";
750 }
751 cout << endl;
752 cout << "inputInside : wire hit pattern" << endl;
753 cout << " ";
754 for (unsigned i = 0; i < 32; i++) {
755 const unsigned j = 31 - i;
756 if (i && ((i % 8) == 0))
757 cout << "_";
758 if (inputInside[j])
759 cout << "*";
760 else
761 cout << ".";
762 }
763 cout << endl;
764 cout << "-------------------------------------------" << endl;
765 cout << "Output : wire hit pattern" << endl;
766 cout << " ";
767 for (unsigned i = 0; i < 80; i++) {
768 const unsigned j = 79 - i;
769 if ((i % 16) == 0) {
770 cout << endl << " ";
771 if (int(i / 16) % 2) {
772 } else cout << " ";
773 }
774 if (output[j])
775 cout << "O ";
776 else
777 cout << ". ";
778 }
779 cout << endl;
780 cout << " -=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-" << endl << endl;
781
782 cout << "Priority cell timing:" << endl;
783 cout << "inputOutside : no priority cell timing information" << endl;
784 cout << "inputInside : priority cell timing" << endl;
785 ipos = 32;
786 for (unsigned i = 0; i < 16; i++) {
787 TRGState s = inputInside.subset(ipos + i * 5, 5);
788 if ((i % 4) == 0)
789 cout << " ";
790 cout << setw(2) << i << ": " << s << " ";
791 if ((i % 4) == 3)
792 cout << endl;
793 }
794 cout << "inputInsidepriority cell location flag" << endl;
795 ipos = 112;
796 for (unsigned i = 0; i < 16; i++) {
797 if ((i % 4) == 0)
798 cout << " ";
799 if (inputInside[ipos + i])
800 cout << setw(2) << i << ": (1)Left ";
801 else
802 cout << setw(2) << i << ": (0)Right ";
803 if ((i % 4) == 3)
804 cout << endl;
805 }
806
807 cout << "ouput : priority cell timing" << endl;
808 o = 80;
809 for (unsigned i = 0; i < 16; i++) {
810 TRGState s = output.subset(o + i * 4, 4);
811 if ((i % 4) == 0)
812 cout << " ";
813 cout << setw(2) << i << ": " << s << " ";
814 if ((i % 4) == 3)
815 cout << endl;
816 }
817 cout << "output : priority cell location flag" << endl;
818 o = 208;
819 for (unsigned i = 0; i < 16; i++) {
820 if ((i % 4) == 0)
821 cout << " ";
822 if (output[o + i])
823 cout << setw(2) << i << ": (1)Left ";
824 else
825 cout << setw(2) << i << ": (0)Right ";
826 if ((i % 4) == 3)
827 cout << endl;
828 }
829 cout << " -=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-=" << endl << endl;
830
831 cout << "Fastest timing of each TrackSegment: " << endl;
832 cout << "inputOutside : fastest timing" << endl;
833 ipos = 128;
834 for (unsigned i = 0; i < 16; i++) {
835 TRGState s = inputOutside.subset(ipos + i * 5, 5);
836 if ((i % 4) == 0)
837 cout << " ";
838 cout << setw(2) << i << ": " << s << " ";
839 if ((i % 4) == 3)
840 cout << endl;
841 }
842 ipos = 48;
843 cout << "inputInside : fastest timing" << endl;
844 for (unsigned i = 0; i < 16; i++) {
845 TRGState s = inputInside.subset(ipos + i * 5, 5);
846 if ((i % 4) == 0)
847 cout << " ";
848 cout << setw(2) << i << ": " << s << " ";
849 if ((i % 4) == 3)
850 cout << endl;
851 }
852 cout << "output : fastest timing" << endl;
853 o = 144;
854 for (unsigned i = 0; i < 16; i++) {
855 TRGState s = output.subset(o + i * 4, 4);
856 if ((i % 4) == 0)
857 cout << " ";
858 cout << setw(2) << i << ": " << s << " ";
859 if ((i % 4) == 3)
860 cout << endl;
861 }
862 cout << " -=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-=" << endl << endl;
863
864 cout << "Edge time information: " << endl;
865 cout << "inputOutside : timing of missing wires" << endl;
866 ipos = 128;
867 for (unsigned i = 0; i < 4; i++) {
868 TRGState s = inputOutside.subset(ipos + i * 5, 5);
869 if ((i % 4) == 0)
870 cout << " ";
871 cout << setw(2) << i << ": " << s << " ";
872 if ((i % 4) == 3)
873 cout << endl;
874 } cout << endl;
875 ipos = 208;
876 cout << "inputInside : timing of missing wires" << endl;
877 for (unsigned i = 0; i < 1; i++) {
878 TRGState s = inputInside.subset(ipos + i * 5, 5);
879 if ((i % 4) == 0)
880 cout << " ";
881 cout << setw(2) << i << ": " << s << " ";
882 if ((i % 4) == 3)
883 cout << endl;
884 } cout << endl;
885 cout << "output : timing of missing wires" << endl;
886 o = 224;
887 for (unsigned i = 0; i < 5; i++) {
888 TRGState s = output.subset(o + i * 4, 4);
889 if ((i % 4) == 0)
890 cout << " ";
891 cout << setw(2) << i << ": " << s << " ";
892 if ((i % 4) == 3)
893 cout << endl;
894 }
895 cout << endl;
896
897 cout << "================== End of Merger unpackerInner ========================= " << endl;
898
899
900 }

◆ unpackerInnerInside()

void unpackerInnerInside ( const TRGState input,
const TRGState output 
)
static

Unpacks TRGState.

Definition at line 1273 of file FrontEnd.cc.

1275 {
1276
1277 cout << "Input bit size=" << input.size() << endl;
1278
1279 cout << "Input : wire hit pattern" << endl;
1280 cout << " ";
1281 for (unsigned i = 0; i < 48; i++) {
1282 const unsigned j = 48 - i - 1;
1283 if (i && ((i % 8) == 0))
1284 cout << "_";
1285 if (input[j])
1286 cout << "1";
1287 else
1288 cout << "0";
1289 }
1290 cout << endl;
1291 cout << "Input : wire hit timing" << endl;
1292 unsigned o = 48;
1293 for (unsigned i = 0; i < 48; i++) {
1294 TRGState s = input.subset(o + i * 5, 5);
1295 if ((i % 4) == 0)
1296 cout << " ";
1297 cout << i << ": " << s << " ";
1298 if ((i % 4) == 3)
1299 cout << endl;
1300 }
1301
1302 cout << "Output bit size=" << output.size() << endl;
1303
1304 cout << "Output : wire hit pattern" << endl;
1305 cout << " ";
1306 for (unsigned i = 0; i < 32; i++) {
1307 const unsigned j = 32 - i - 1;
1308 if (i && ((i % 8) == 0))
1309 cout << "_";
1310 if (output[j])
1311 cout << "1";
1312 else
1313 cout << "0";
1314 }
1315 cout << endl;
1316
1317 cout << "Output : priority cell timing" << endl;
1318 o = 32;
1319 for (unsigned i = 0; i < 16; i++) {
1320 TRGState s = output.subset(o + i * 5, 5);
1321 if ((i % 4) == 0)
1322 cout << " ";
1323 cout << i << ": " << s << " ";
1324 if ((i % 4) == 3)
1325 cout << endl;
1326 }
1327
1328 cout << "Output : second priority cell position" << endl;
1329 cout << " ";
1330 o = 112;
1331 for (unsigned i = 0; i < 16; i++) {
1332 TRGState s = output.subset(o + i, 1);
1333 if (i && ((i % 8) == 0))
1334 cout << "_";
1335 if (s.active())
1336 cout << "1";
1337 else
1338 cout << "0";
1339 }
1340 cout << endl;
1341
1342 cout << "Output : fastest timing" << endl;
1343 o = 128;
1344 for (unsigned i = 0; i < 16; i++) {
1345 TRGState s = output.subset(o + i * 5, 5);
1346 if ((i % 4) == 0)
1347 cout << " ";
1348 cout << i << ": " << s << " ";
1349 if ((i % 4) == 3)
1350 cout << endl;
1351 }
1352
1353 cout << "Output : timing of missing wires" << endl;
1354 o = 208;
1355 for (unsigned i = 0; i < 1; i++) {
1356 TRGState s = output.subset(o + i * 5, 5);
1357 if ((i % 4) == 0)
1358 cout << " ";
1359 cout << i << ": " << s << " ";
1360 if ((i % 4) == 3)
1361 cout << endl;
1362 }
1363
1364 cout << endl;
1365 }

◆ unpackerInnerOutside()

void unpackerInnerOutside ( const TRGState input,
const TRGState output 
)
static

Unpacks TRGState.

Definition at line 1368 of file FrontEnd.cc.

1370 {
1371
1372 cout << "Input bit size=" << input.size() << endl;
1373
1374 cout << "Input : wire hit pattern" << endl;
1375 cout << " ";
1376 for (unsigned i = 0; i < 48; i++) {
1377 const unsigned j = 48 - i - 1;
1378 if (i && ((i % 8) == 0))
1379 cout << "_";
1380 if (input[j])
1381 cout << "1";
1382 else
1383 cout << "0";
1384 }
1385 cout << endl;
1386 cout << "Input : wire hit timing" << endl;
1387 unsigned o = 48;
1388 for (unsigned i = 0; i < 48; i++) {
1389 TRGState s = input.subset(o + i * 5, 5);
1390 if ((i % 4) == 0)
1391 cout << " ";
1392 cout << i << ": " << s << " ";
1393 if ((i % 4) == 3)
1394 cout << endl;
1395 }
1396
1397 cout << "Output bit size=" << output.size() << endl;
1398
1399 cout << "Output : wire hit pattern" << endl;
1400 cout << " ";
1401 for (unsigned i = 0; i < 48; i++) {
1402 const unsigned j = 48 - i - 1;
1403 if (i && ((i % 8) == 0))
1404 cout << "_";
1405 if (output[j])
1406 cout << "1";
1407 else
1408 cout << "0";
1409 }
1410 cout << endl;
1411
1412 cout << "Output : fastest timing" << endl;
1413 o = 48;
1414 for (unsigned i = 0; i < 16; i++) {
1415 TRGState s = output.subset(o + i * 5, 5);
1416 if ((i % 4) == 0)
1417 cout << " ";
1418 cout << i << ": " << s << " ";
1419 if ((i % 4) == 3)
1420 cout << endl;
1421 }
1422
1423 cout << "Output : timing of missing wires" << endl;
1424 o = 128;
1425 for (unsigned i = 0; i < 4; i++) {
1426 TRGState s = output.subset(o + i * 5, 5);
1427 if ((i % 4) == 0)
1428 cout << " ";
1429 cout << i << ": " << s << " ";
1430 if ((i % 4) == 3)
1431 cout << endl;
1432 }
1433
1434 cout << endl;
1435 }

◆ unpackerOuter()

void unpackerOuter ( const TRGState input,
const TRGState output 
)
static

Unpack TRGState.

Definition at line 905 of file Merger.cc.

907 {
908
909 TRGState inputInside = input.subset(0, 256);
910 TRGState inputOutside = input.subset(256, 256);
911
912 unsigned o = 0;
913
914 cout << "======================= Merger unpackerOuter================================== " << endl;
915 cout << "input bit information: " << endl;
916 for (unsigned bi = 0; bi < input.size(); bi++) {
917 if (input[bi]) cout << "* " ;
918 else cout << ". ";
919 if ((bi % 16) == 15) cout << endl;
920 if (bi == 255) cout << "--------------------------------" << endl;
921 }
922
923 cout << "Input bit size = " << input.size() << " and Output bit size =" << output.size() << endl << endl;
924
925 cout << "Hit map: " << endl;
926 cout << "inputOutside : wire hit pattern" << endl;
927 cout << " ";
928 for (unsigned i = 0; i < 48; i++) {
929 const unsigned j = 47 - i;
930 if (i && ((i % 8) == 0))
931 cout << "_";
932 if (inputOutside[j])
933 cout << "*";
934 else
935 cout << ".";
936 }
937 cout << endl;
938 cout << "inputInside : wire hit pattern" << endl;
939 cout << " ";
940 for (unsigned i = 0; i < 48; i++) {
941 const unsigned j = 48 - i - 1;
942 if (i && ((i % 8) == 0))
943 cout << "_";
944 if (inputInside[j])
945 cout << "*";
946 else
947 cout << ".";
948 }
949 cout << endl;
950 cout << "-------------------------------------------" << endl;
951 cout << "Output : wire hit pattern" << endl;
952 cout << " ";
953 for (unsigned i = 0; i < 80; i++) {
954 const unsigned j = 79 - i;
955 /*
956 if (i && ((i % 8) == 0))
957 cout << "_";
958 if (output[j])
959 cout << "* ";
960 else
961 cout << ". ";
962 if ( (i % 32) == 31 ) cout << endl << " ";
963 */
964 if ((i % 16) == 0) {
965 cout << endl << " ";
966 if (int(i / 16) % 2) {
967 } else cout << " ";
968 }
969 if (output[j])
970 cout << "O ";
971 else
972 cout << ". ";
973 // if ( (i % 32) == 31 ) cout << endl << " ";
974 }
975 cout << endl;
976 cout << " -=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-" << endl << endl;
977
978 cout << "Priority cell timing:" << endl;
979 cout << "inputOutside : priority cell timing" << endl;
980 o = 48;
981 for (unsigned i = 0; i < 16; i++) {
982 TRGState s = inputOutside.subset(o + i * 5, 5);
983 if ((i % 4) == 0)
984 cout << " ";
985 cout << setw(2) << i << ": " << s << " ";
986 if ((i % 4) == 3)
987 cout << endl;
988 }
989 cout << "inputInside : priority cell timing" << endl;
990 for (unsigned i = 0; i < 16; i++) {
991 TRGState s = inputInside.subset(o + i * 5, 5);
992 if ((i % 4) == 0)
993 cout << " ";
994 cout << setw(2) << i << ": " << s << " ";
995 if ((i % 4) == 3)
996 cout << endl;
997 }
998 cout << "ouput : priority cell timing" << endl;
999 o = 80;
1000 for (unsigned i = 0; i < 16; i++) {
1001 TRGState s = output.subset(o + i * 4, 4);
1002 if ((i % 4) == 0)
1003 cout << " ";
1004 cout << setw(2) << i << ": " << s << " ";
1005 if ((i % 4) == 3)
1006 cout << endl;
1007 }
1008 cout << "output : priority cell location flag" << endl;
1009 o = 208;
1010 for (unsigned i = 0; i < 16; i++) {
1011 if ((i % 4) == 0)
1012 cout << " ";
1013 if (output[o + i])
1014 cout << setw(2) << i << ": (1)Left ";
1015 else
1016 cout << setw(2) << i << ": (0)Right ";
1017 if ((i % 4) == 3)
1018 cout << endl;
1019 }
1020 cout << " -=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-=" << endl << endl;
1021
1022 cout << "Fastest timing of each TrackSegment: " << endl;
1023 cout << "inputOutside : fastest timing" << endl;
1024 o = 128;
1025 for (unsigned i = 0; i < 16; i++) {
1026 TRGState s = inputOutside.subset(o + i * 5, 5);
1027 if ((i % 4) == 0)
1028 cout << " ";
1029 cout << setw(2) << i << ": " << s << " ";
1030 if ((i % 4) == 3)
1031 cout << endl;
1032 }
1033 cout << "inputInside : fastest timing" << endl;
1034 for (unsigned i = 0; i < 16; i++) {
1035 TRGState s = inputInside.subset(o + i * 5, 5);
1036 if ((i % 4) == 0)
1037 cout << " ";
1038 cout << setw(2) << i << ": " << s << " ";
1039 if ((i % 4) == 3)
1040 cout << endl;
1041 }
1042 cout << "output : fastest timing" << endl;
1043 o = 144;
1044 for (unsigned i = 0; i < 16; i++) {
1045 TRGState s = output.subset(o + i * 4, 4);
1046 if ((i % 4) == 0)
1047 cout << " ";
1048 cout << setw(2) << i << ": " << s << " ";
1049 if ((i % 4) == 3)
1050 cout << endl;
1051 }
1052 cout << " -=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-=-=+=-=+=-=" << endl << endl;
1053
1054 cout << "Edge time information: " << endl;
1055 cout << "inputOutside : timing of missing wires" << endl;
1056 o = 208;
1057 for (unsigned i = 0; i < 2; i++) {
1058 TRGState s = inputOutside.subset(o + i * 5, 5);
1059 if ((i % 4) == 0)
1060 cout << " ";
1061 cout << setw(2) << i << ": " << s << " ";
1062 if ((i % 4) == 3)
1063 cout << endl;
1064 } cout << endl;
1065 cout << "inputInside : timing of missing wires" << endl;
1066 for (unsigned i = 0; i < 2; i++) {
1067 TRGState s = inputInside.subset(o + i * 5, 5);
1068 if ((i % 4) == 0)
1069 cout << " ";
1070 cout << setw(2) << i << ": " << s << " ";
1071 if ((i % 4) == 3)
1072 cout << endl;
1073 } cout << endl;
1074 cout << "output : timing of missing wires" << endl;
1075 o = 224;
1076 for (unsigned i = 0; i < 3; i++) {
1077 TRGState s = output.subset(o + i * 4, 4);
1078 if ((i % 4) == 0)
1079 cout << " ";
1080 cout << setw(2) << i << ": " << s << " ";
1081 if ((i % 4) == 3)
1082 cout << endl;
1083 }
1084 cout << endl;
1085
1086 cout << "================= End of Merger unpackerOuter ========================= " << endl;
1087
1088
1089 }

◆ unpackerOuterInside()

void unpackerOuterInside ( const TRGState input,
const TRGState output 
)
static

Unpacks TRGState.

Definition at line 1438 of file FrontEnd.cc.

1440 {
1441
1442 cout << "Input bit size=" << input.size() << endl;
1443
1444 cout << "Input : wire hit pattern" << endl;
1445 cout << " ";
1446 for (unsigned i = 0; i < 48; i++) {
1447 const unsigned j = 48 - i - 1;
1448 if (i && ((i % 8) == 0))
1449 cout << "_";
1450 if (input[j])
1451 cout << "1";
1452 else
1453 cout << "0";
1454 }
1455 cout << endl;
1456 cout << "Input : wire hit timing" << endl;
1457 unsigned o = 48;
1458 for (unsigned i = 0; i < 48; i++) {
1459 TRGState s = input.subset(o + i * 5, 5);
1460 if ((i % 4) == 0)
1461 cout << " ";
1462 cout << i << ": " << s << " ";
1463 if ((i % 4) == 3)
1464 cout << endl;
1465 }
1466
1467 cout << "Output bit size=" << output.size() << endl;
1468
1469 cout << "Output : wire hit pattern" << endl;
1470 cout << " ";
1471 for (unsigned i = 0; i < 48; i++) {
1472 const unsigned j = 48 - i - 1;
1473 if (i && ((i % 8) == 0))
1474 cout << "_";
1475 if (output[j])
1476 cout << "1";
1477 else
1478 cout << "0";
1479 }
1480 cout << endl;
1481
1482 cout << "Output : priority cell timing" << endl;
1483 o = 48;
1484 for (unsigned i = 0; i < 16; i++) {
1485 TRGState s = output.subset(o + i * 5, 5);
1486 if ((i % 4) == 0)
1487 cout << " ";
1488 cout << i << ": " << s << " ";
1489 if ((i % 4) == 3)
1490 cout << endl;
1491 }
1492
1493 cout << "Output : fastest timing" << endl;
1494 o = 128;
1495 for (unsigned i = 0; i < 16; i++) {
1496 TRGState s = output.subset(o + i * 5, 5);
1497 if ((i % 4) == 0)
1498 cout << " ";
1499 cout << i << ": " << s << " ";
1500 if ((i % 4) == 3)
1501 cout << endl;
1502 }
1503
1504 cout << "Output : timing of missing wires" << endl;
1505 o = 208;
1506 for (unsigned i = 0; i < 2; i++) {
1507 TRGState s = output.subset(o + i * 5, 5);
1508 if ((i % 4) == 0)
1509 cout << " ";
1510 cout << i << ": " << s << " ";
1511 if ((i % 4) == 3)
1512 cout << endl;
1513 }
1514
1515 cout << endl;
1516 }

◆ unpackerOuterOutside()

void unpackerOuterOutside ( const TRGState input,
const TRGState output 
)
static

Unpacks TRGState.

Definition at line 1519 of file FrontEnd.cc.

1521 {
1522
1523 cout << "Input bit size=" << input.size() << endl;
1524
1525 cout << "Input : wire hit pattern" << endl;
1526 cout << " ";
1527 for (unsigned i = 0; i < 48; i++) {
1528 const unsigned j = 48 - i - 1;
1529 if (i && ((i % 8) == 0))
1530 cout << "_";
1531 if (input[j])
1532 cout << "1";
1533 else
1534 cout << "0";
1535 }
1536 cout << endl;
1537 cout << "Input : wire hit timing" << endl;
1538 unsigned o = 48;
1539 for (unsigned i = 0; i < 48; i++) {
1540 TRGState s = input.subset(o + i * 5, 5);
1541 if ((i % 4) == 0)
1542 cout << " ";
1543 cout << i << ": " << s << " ";
1544 if ((i % 4) == 3)
1545 cout << endl;
1546 }
1547
1548 cout << "Output bit size=" << output.size() << endl;
1549
1550 cout << "Output : wire hit pattern" << endl;
1551 cout << " ";
1552 for (unsigned i = 0; i < 48; i++) {
1553 const unsigned j = 48 - i - 1;
1554 if (i && ((i % 8) == 0))
1555 cout << "_";
1556 if (output[j])
1557 cout << "1";
1558 else
1559 cout << "0";
1560 }
1561 cout << endl;
1562
1563 cout << "Output : Second priority cell timing" << endl;
1564 o = 48;
1565 for (unsigned i = 0; i < 16; i++) {
1566 TRGState s = output.subset(o + i * 5, 5);
1567 if ((i % 4) == 0)
1568 cout << " ";
1569 cout << i << ": " << s << " ";
1570 if ((i % 4) == 3)
1571 cout << endl;
1572 }
1573
1574 cout << "Output : fastest timing" << endl;
1575 o = 128;
1576 for (unsigned i = 0; i < 16; i++) {
1577 TRGState s = output.subset(o + i * 5, 5);
1578 if ((i % 4) == 0)
1579 cout << " ";
1580 cout << i << ": " << s << " ";
1581 if ((i % 4) == 3)
1582 cout << endl;
1583 }
1584
1585 cout << "Output : timing of missing wires" << endl;
1586 o = 208;
1587 for (unsigned i = 0; i < 2; i++) {
1588 TRGState s = output.subset(o + i * 5, 5);
1589 if ((i % 4) == 0)
1590 cout << " ";
1591 cout << i << ": " << s << " ";
1592 if ((i % 4) == 3)
1593 cout << endl;
1594 }
1595 cout << endl;
1596 }

◆ unset()

const TRGSignal & unset ( int  t0,
int  t1 
)

clear(or unset) with leading edge at clock t0 and with trailing edge at clock t1.

Definition at line 426 of file Signal.cc.

427 {
428 if (active(t0, t1)) {
429 TRGSignal x(clock(), t0, t1);
430 x.invert();
431 (* this) &= x;
432 }
433
434#if TRG_DEBUG
436#endif
437
438 return * this;
439 }

◆ update() [1/5]

void update ( void  )

updates TRGCDC wire information. clear() is called in this function.

Definition at line 984 of file TRGCDC.cc.

985 {
986 _trackList2D.clear();
987 _trackList2DFitted.clear();
988 _trackList3D.clear();
989
990 TRGDebug::enterStage("TRGCDC update");
991
992 if (_trgCDCDataInputMode != 0) {
994 } else {
995
996 //...Clear old information...
997 // fastClear();
998 clear();
999
1000 //...CDCSimHit...
1001 StoreArray<CDCSimHit> SimHits;
1002 if (! SimHits) {
1003 if (TRGDebug::level())
1004 cout << "TRGCDC !!! can not access to CDCSimHits" << endl;
1005 TRGDebug::leaveStage("TRGCDC update");
1006 return;
1007 }
1008 const unsigned n = SimHits.getEntries();
1009
1010 //...CDCHit...
1011 StoreArray<CDCHit> CDCHits(_cdchitCollectionName);
1012 if (! CDCHits) {
1013 if (TRGDebug::level())
1014 cout << "TRGCDC !!! can not access to CDCHits" << endl;
1015 TRGDebug::leaveStage("TRGCDC update");
1016 return;
1017 }
1018 const unsigned nHits = CDCHits.getEntries();
1019
1020 //...MCParticle...
1021 StoreArray<MCParticle> mcParticles;
1022 if (! mcParticles) {
1023 if (TRGDebug::level())
1024 cout << "TRGCDC !!! can not access to MCParticles" << endl;
1025 TRGDebug::leaveStage("TRGCDC update");
1026 return;
1027 }
1028
1029 //...Relations...
1030 RelationArray rels(SimHits, CDCHits);
1031 const unsigned nRels = rels.getEntries();
1032 RelationArray relsMC(mcParticles, CDCHits);
1033 const unsigned nRelsMC = relsMC.getEntries();
1034
1035 //...Loop over CDCHits...
1036 for (unsigned i = 0; i < nHits; i++) {
1037 const CDCHit& h = *CDCHits[i];
1038 double tmp = gRandom->Uniform(0.0, 1.0) / (double(RAND_MAX));
1039 if (tmp < _inefficiency)
1040 continue;
1041
1042 // //...Check validity (skip broken channel)...
1043 // if (! (h->m_stat & CellHitFindingValid)) continue;
1044
1045 //...Get CDCSimHit... This is expensive. Should be moved outside.
1046 unsigned iSimHit = 0;
1047 for (unsigned j = 0; j < nRels; j++) {
1048 const unsigned k = rels[j].getToIndices().size();
1049 for (unsigned l = 0; l < k; l++) {
1050 if (rels[j].getToIndex(l) == i)
1051 iSimHit = rels[j].getFromIndex();
1052 }
1053
1054 if (TRGDebug::level())
1055 if (k > 1)
1056 cout << "TRGCDC::update !!! CDCSimHit[" << iSimHit
1057 << "] has multiple CDCHit(" << k << " hits)" << endl;
1058 }
1059
1060 //...Get MCParticle... This is expensive, again.
1061 // (Getting the first MCParticle only)
1062 unsigned iMCPart = 0;
1063 for (unsigned j = 0; j < nRelsMC; j++) {
1064 const unsigned k = relsMC[j].getToIndices().size();
1065 for (unsigned l = 0; l < k; l++) {
1066 if (relsMC[j].getToIndex(l) == i) {
1067 iMCPart = relsMC[j].getFromIndex();
1068 break;
1069 }
1070 }
1071
1072 if (TRGDebug::level())
1073 if (k > 1)
1074 cout << "TRGCDC::update !!! MCParticle[" << iMCPart
1075 << "] has multiple CDCHit(" << k << " hits)" << endl;
1076 }
1077
1078 //...Wire...
1079 int t_layerId;
1080 if (h.getISuperLayer() == 0) t_layerId = h.getILayer();
1081 else t_layerId = h.getILayer() + 6 * h.getISuperLayer() + 2;
1082 const unsigned layerId = t_layerId;
1083 const unsigned wireId = h.getIWire();
1084 const TCWire& w = * static_cast<const TCWire*>(wire(layerId, wireId));
1085
1086 //...TDC count...
1087 B2INFO("t0:" << m_cdcp->getT0(WireID(h.getID())) <<
1088 "binwidth:" << m_cdcp->getTdcBinWidth() <<
1089 "tdc count:" << h.getTDCCount());
1090 const int tdcCount = floor(m_cdcp->getT0(WireID(h.getID())) / m_cdcp->getTdcBinWidth()
1091 - h.getTDCCount() + 0.5);
1092
1093 //...Drift length from TDC...
1094 const float driftLength = tdcCount * m_cdcp->getTdcBinWidth() * m_cdcp->getNominalDriftV();
1095 const float driftLengthError = 0.013;
1096
1097 //...Trigger timing...
1098 TRGTime rise = TRGTime(tdcCount, true, _clockFE, w.name());
1099 if (_simulationMode & 1)
1100 rise.clock(_clockTDC);
1101 TRGTime fall = rise;
1102 fall.shift(1).reverse();
1103 if (_simulationMode & 1)
1104 w._signal |= TRGSignal(rise & fall);
1105 else
1106 w._signal |= (TRGSignal(rise & fall) & _firmwareSimulationWindow);
1107 w._signal.name(w.name());
1108
1109 //...Left/right...
1110 const int LRflag = SimHits[iSimHit]->getPosFlag();
1111
1112 //...TCWireHit...
1113 TCWHit* hit = new TCWHit(w,
1114 i,
1115 iSimHit,
1116 iMCPart,
1117 driftLength,
1118 driftLengthError,
1119 driftLength,
1120 driftLengthError,
1121 LRflag,
1122 1);
1123 hit->state(CellHitFindingValid | CellHitFittingValid);
1124
1125 //...Store a hit...
1126 if (!(*_layers[layerId])[wireId]->hit())
1127 ((TCWire*)(*_layers[layerId])[wireId])->hit(hit);
1128 _hits.push_back(hit);
1129 if (w.axial()) _axialHits.push_back(hit);
1130 else _stereoHits.push_back(hit);
1131
1132 //...Debug...
1133 if (TRGDebug::level() > 2) {
1134 w._signal.dump("", TRGDebug::tab());
1135 cout << TRGDebug::tab(4) << "CDCHit TDC count="
1136 << h.getTDCCount() << std::endl;
1137 }
1138 }
1139
1140 //...Track segment... This part is moved to ::simulate().
1141
1142 //...Hit classification...
1143 // _hits.sort(TCWHit::sortByWireId);
1145
1146 if (TRGDebug::level()) {
1147 cout << TRGDebug::tab() << "#CDCSimHit=" << n << ",#CDCHit="
1148 << nHits << endl;
1149 }
1150
1151 if (TRGDebug::level() > 2) {
1152 // StoreArray<CDCSimHit> simHits("CDCSimHits"); //TODO variable is not used, is it ok?
1153 _clock.dump("detail", TRGDebug::tab());
1154 _clockFE.dump("detail", TRGDebug::tab());
1155 if (TRGDebug::level() > 10) {
1156 for (unsigned i = 0; i < _hits.size(); i++) {
1157 const TCWHit& h = *_hits[i];
1158 h.dump("detail", TRGDebug::tab(4));
1159 }
1160 } else {
1161 //unsigned nh = 10; //TODO these two lines have no impact
1162 //if (nh > _hits.size()) nh = _hits.size();
1163 cout << TRGDebug::tab() << "Dump of the first " << n
1164 << " hits of a wire" << endl;
1165 for (unsigned i = 0; i < n; i++) {
1166 const TCWHit& h = *_hits[i];
1167 h.dump("detail", TRGDebug::tab(4));
1168 }
1169 }
1170 }
1171
1172 }
1173
1174 TRGDebug::leaveStage("TRGCDC update");
1175 }
double getTdcBinWidth() const
Return TDC bin width (nsec).
float getT0(const WireID &wireID) const
Returns t0 parameter of the specified sense wire.
double getNominalDriftV() const
Return the nominal drift velocity of He-ethane gas (default: 4.0x10^-3 cm/nsec).
void classification(void)
classify hits.
Definition: TRGCDC.cc:1604
void updateByData(int inputMode)
updates TRGCDC wire information by Hardware data 0: From CDC FE ASCII file (Implementing) 1: From CDC...
Definition: TRGCDC.cc:1179

◆ update() [2/5]

void update ( bool  mcAnalysis = true)

updates TRGGDL information.

Definition at line 209 of file TRGGDL.cc.

210 {
211 /*
212 TRGDebug::enterStage("TRGGDL update");
213
214 if (TRGDebug::level())
215 cout << TRGDebug::tab() << name() << " do nothing..." << endl;
216
217 TRGDebug::leaveStage("TRGGDL update");
218 */
219 }

◆ update() [3/5]

void update ( bool  mcAnalysis = true)

updates TRGGRL information.

Definition at line 143 of file TRGGRL.cc.

144 {
145
146 matchList.clear();
147 matchList3D.clear();
148
149 B2DEBUG(100, "do nothing...");
150
151 }

◆ update() [4/5]

void update ( const HepGeom::Point3D< double > &  onTrack,
const HepGeom::Point3D< double > &  onWire,
unsigned  leftRight,
double  pull 
)
inline

sets results of fitting.

Definition at line 448 of file Link.h.

452 {
453 _onTrack = onTrack;
454 _onWire = onWire;
456 _pull = pull;
457 }

◆ update() [5/5]

void update ( void  )
staticprivate

updates information.

Definition at line 29 of file TrackMC.cc.

30 {
31 if (_list.size()) {
32 for (unsigned i = 0; i < _list.size(); i++)
33 delete _list[i];
34 _list.clear();
35 }
36
37// unsigned n = 0;
38
39// for (unsigned i = 0; i < n; i++) {
40// struct gen_hepevt * h = 0;
41// if (! h) {
42// std::cout << "TRGCDCTrackMC::update !!! can not access to GEN_HEPEVT";
43// std::cout << std::endl;
44// break;
45// }
46// // if (h->m_P[3] != 0.0 && (h->m_P[0] * h->m_P[0] + h->m_P[1] * h->m_P[1]
47// // + h->m_P[2] * h->m_P[2]) != 0.0) {
48// _list.push_back(new TRGCDCTrackMC(h));
49// // } else {
50// // std::cout << "TRGCDCTrackMC::update !!! momentum/energy is zero";
51// // std::cout << std::endl;
52// // }
53// }
54 }

◆ updateByData()

void updateByData ( int  inputMode)

updates TRGCDC wire information by Hardware data 0: From CDC FE ASCII file (Implementing) 1: From CDC FE-DAQ root file (Not implemented) 2: From TSIM root file (Not implemented)

Definition at line 1179 of file TRGCDC.cc.

1180 {
1181 TRGDebug::enterStage("TRGCDC updateByData");
1182
1183 //...Clear old information...
1184 clear();
1185
1186 // There is a 1 window difference between slow control parameter and actual data.
1187 // For SPrint-8 data
1188 int cdcDelay = 101;
1189 int nCDCWindows = 28 + 1;
1190 // For Fuji hall data
1191 //int cdcDelay = 87;
1192 //int nCDCWindows = 32+1;
1193 // For Fuji hall matching data
1194 //int cdcDelay = 79;
1195 //int nCDCWindows = 47+1;
1196
1197 // For TRG parameters
1198 unsigned nTRGWindows = 48;
1199 int nTrgBitsInWindow = 352;
1200
1201 vector<string> trgInformations;
1202
1203 // ##### Store data into a common binary format #####
1204 // inBinaryData[iBoard][iWord]
1205 vector<vector<unsigned> > inBinaryData;
1206 // Get data using Belle2Link
1207 if (inputMode == 1) {
1208
1209 int nCdcBitsInWindow = 1536;
1210 //[FIXME] Getting data from ROOT file is fixed to 2 CDC FE, 1 TRG board.
1211 // Data should be in CDCFE0, CDCFE1, TRG sequence.
1212
1213 // For Fuji data
1214 // Get data from root file.
1215 StoreArray<RawDataBlock> raw_datablkarray;
1216 // One block is one event. Take only first block = event.
1217 // Copper board 0 is for two CDC FE and one TRG.
1218 int iBlock = 0;
1219 int iCopper = 0;
1220 //cout<<"Number of blocks: "<<raw_cdcarray.getEntries()<<endl;
1221 //cout<<"Number of Copper: "<<raw_cdcarray[iBlock]->GetNumEntries()<<endl;
1222 int* temp_buf = raw_datablkarray[ iBlock ]->GetBuffer(iCopper);
1223 int nwords = raw_datablkarray[ iBlock ]->GetBlockNwords(iCopper);
1224 int malloc_flag = 0;
1225 int num_nodes = 1;
1226 int num_events = 1;
1227 RawCOPPER* raw_copper;
1228 RawCOPPER raw_copper_buf;
1229 raw_copper_buf.SetBuffer(temp_buf, nwords, malloc_flag, num_nodes, num_events);
1230 raw_copper = &raw_copper_buf;
1231
1233 //StoreArray<RawCDC> raw_cdcarray;
1234 //int iBlock = 0;
1235 //int iCopper = 0;
1236 //RawCOPPER* raw_copper = raw_cdcarray[iBlock];
1237
1239 //printf("*******Start of BODY**********\n");
1240 //printf("\n%.8d : ", 0);
1241 //for (int j = 0; j < raw_copper->GetBlockNwords(iCopper); j++) {
1242 // printf("0x%.8x ", (raw_copper->GetBuffer(iCopper))[ j ]);
1243 // if ((j + 1) % 10 == 0) {
1244 // printf("\n%.8d : ", j + 1);
1245 // }
1246 //}
1247 //printf("*******End of BODY**********\n");
1248
1249 // Number of words for data
1250 int daqHeader = 32;
1251 int cdcHeader = 5;
1252 int cdcTrailer = 2;
1253 int trgHeader = 1;
1254 //int trgTrailer = 1;
1255 // 3 for event data. -1 for lost word in DAQ. Each window is 48 words.
1256 int widthCDCFEData = 3 - 1 + nCdcBitsInWindow / 32 * nCDCWindows;
1257 int widthTRGData = nTrgBitsInWindow / 32 * nTRGWindows;
1258
1259 // Remove headers and trailer from data.
1260 // rawBinaryData[iBoard][iWord]
1261 // CDCFE0, CDCFE1, TSF sequence.
1262 vector<vector<unsigned> > rawBinaryData;
1263 for (int iFe = 0; iFe < 2; iFe++) {
1264 int startCDCData = daqHeader + cdcHeader + (iFe * (widthCDCFEData + cdcTrailer + cdcHeader)) + 1;
1265 // 1 is due to missing data.
1266 vector<unsigned> t_feData(widthCDCFEData + 1);
1267 // Loop over all the words for CDC FE data
1268 for (int iWord = 0; iWord < widthCDCFEData; iWord++) {
1269 t_feData[iWord] = (raw_copper->GetBuffer(iCopper))[iWord + startCDCData];
1270 }
1271 // Fill with 0 for last missing data
1272 t_feData[widthCDCFEData] = 0;
1273 rawBinaryData.push_back(t_feData);
1274 }
1275 vector<unsigned> t_trgData(widthTRGData);
1276 // Loop over all the words for TRG data
1277 int startTRGData = daqHeader + 2 * (cdcHeader + widthCDCFEData + cdcTrailer) + trgHeader + 1;
1278 for (int iWord = 0; iWord < widthTRGData; iWord++) {
1279 t_trgData[iWord] = (raw_copper->GetBuffer(iCopper))[iWord + startTRGData];
1280 }
1281 rawBinaryData.push_back(t_trgData);
1283 //for(unsigned iBoard=0; iBoard<rawBinaryData.size(); iBoard++){
1284 // cout<<"Board"<<iBoard<<endl;
1285 // for(unsigned iWord=0; iWord<rawBinaryData[iBoard].size(); iWord++){
1286 // cout<<setfill('0')<<setw(8)<<hex<<rawBinaryData[iBoard][iWord];
1287 // }
1288 // cout<<dec<<endl;
1289 //}
1290
1291 // Shift all binary data by 8 bits to the right for two CDC FE data
1292 for (unsigned iBoard = 0; iBoard < 2; iBoard++) {
1293 unsigned t_buf = 0;
1294 // 1 is due to missing data
1295 vector<unsigned> t_feData(widthCDCFEData + 1);
1296 for (unsigned iWord = 0; iWord < rawBinaryData[iBoard].size(); iWord++) {
1297 unsigned t_value = t_buf + (rawBinaryData[iBoard][iWord] >> 8);
1298 t_buf = rawBinaryData[iBoard][iWord] << 24;
1299 t_feData[iWord] = t_value;
1300 }
1301 inBinaryData.push_back(t_feData);
1302 }
1303 inBinaryData.push_back(rawBinaryData[2]);
1305 //for(unsigned iBoard=0; iBoard<inBinaryData.size(); iBoard++){
1306 // cout<<"Board"<<iBoard<<endl;
1307 // for(unsigned iWord=0; iWord<inBinaryData[iBoard].size(); iWord++){
1308 // cout<<setfill('0')<<setw(8)<<hex<<inBinaryData[iBoard][iWord];
1309 // }
1310 // cout<<dec<<endl;
1311 //}
1312 } else if (inputMode == 2) {
1313 // get data from Belle2Link
1314 StoreArray<RawTRG> raw_trgarray;
1315 for (int i = 0; i < raw_trgarray.getEntries(); i++) {
1316 cout << "\n===== DataBlock(RawTRG) : Block # " << i << endl;
1317 for (int j = 0; j < raw_trgarray[ i ]->GetNumEntries(); j++) {
1318 RawCOPPER* raw_copper = raw_trgarray[ i ];
1319 vector<vector<unsigned> > rawBinaryData;
1320 // Loop over 4 FINESSEs
1321 for (int iFinesse = 0; iFinesse < 4; iFinesse++) {
1322 int bufferNwords = raw_copper->GetDetectorNwords(j, iFinesse);
1323 if (bufferNwords > 0) {
1324 printf("===== Detector Buffer(FINESSE # %i) 0x%x words \n", iFinesse, bufferNwords);
1325 vector<unsigned> t_copperData(raw_copper->GetDetectorNwords(j, iFinesse));
1326 // Loop over all the words for board data
1327 for (int iWord = 0; iWord < bufferNwords; iWord++) {
1328 t_copperData[iWord] = (raw_copper->GetDetectorBuffer(j, iFinesse))[iWord];
1329 }
1330 rawBinaryData.push_back(t_copperData);
1331 inBinaryData.push_back(t_copperData);
1332
1333 }
1334 }
1335 }
1336 }
1337
1339 //for(unsigned iBoard=0; iBoard<inBinaryData.size(); iBoard++){
1340 // cout<<"Board"<<iBoard<<endl;
1341 // for(unsigned iWord=0; iWord<inBinaryData[iBoard].size(); iWord++){
1342 // cout<<setfill('0')<<setw(8)<<hex<<inBinaryData[iBoard][iWord];
1343 // }
1344 // cout<<dec<<endl;
1345 //}
1346 } else {
1347 cout << "[ERROR} TRGCDCDataInputMode is incorrect! No simulation will be done." << endl;
1348 return;
1349 }
1350
1351 // #####Separate binary into meaningful data#####
1352 // CDC
1353 // cdcTrgTiming[iFE]
1354 vector<unsigned> cdcTrgTiming(2);
1355 for (unsigned iFe = 0; iFe < 2; iFe++) {
1356 cdcTrgTiming[iFe] = (inBinaryData[iFe][1]) >> 16;
1357 if (cdcTrgTiming[iFe] >= 32768) cout << "CDC trigger timing error. TDC is larger than 0x8000" << endl;
1358 }
1360 //for(unsigned iFe=0; ieE<2; iFe++){
1361 // cout<<"FE"<<iFe<<" TRG Timing: "<<setfill('0')<<setw(8)<<hex<<cdcTrgTiming[0]<<dec<<endl;
1362 //}
1363 // [iHit] [0]: layerId, [1]: wireId, [2]: adc, [3]: tdc, [4]: FE trg timing
1364 vector<vector<unsigned>> hitCdcData;
1365 // Store information according to window,FE,Wire
1366 for (int iWindow = 0; iWindow < nCDCWindows; iWindow++) {
1367 for (int iFE = 0; iFE < 2; iFE++) {
1368 for (int iWire = 0; iWire < 48; iWire++) {
1369 unsigned t_adc;
1370 unsigned t_tdc;
1371 unsigned t_layerId = 3 * iFE + ((iWire / 8) % 3);
1372 unsigned t_wireId = 8 * (iWire / 24) + iWire % 8;
1373 // Take 16 bits according to wire.
1374 t_adc = ((inBinaryData[iFE][iWire / 2 + iWindow * 48 + 3] << (16 * (iWire % 2))) >> 16);
1375 t_tdc = ((inBinaryData[iFE][iWire / 2 + iWindow * 48 + 24 + 3] << (16 * (iWire % 2))) >> 16);
1376 if (t_tdc != 0) {
1377 if (t_tdc >= 32768) {
1378 // Calculate TDC.
1379 t_tdc -= 32768;
1380 // Round down and go back cdcDelay+nCDCWindows windows
1381 unsigned startTiming;
1382 if (unsigned(cdcTrgTiming[iFE] / 32) * 32 > (unsigned)(cdcDelay + nCDCWindows) * 32) {
1383 startTiming = unsigned(cdcTrgTiming[iFE] / 32) * 32 - (cdcDelay + nCDCWindows) * 32;
1384 } else {
1385 startTiming = unsigned(cdcTrgTiming[iFE] / 32) * 32 + 32768 - (cdcDelay + nCDCWindows) * 32;
1386 }
1387 if (t_tdc > startTiming) t_tdc -= startTiming;
1388 else t_tdc += 32768 - startTiming;
1389 // Fill data
1390 vector<unsigned> t_hitCdcData(5);
1391 t_hitCdcData[0] = t_layerId;
1392 t_hitCdcData[1] = t_wireId;
1393 t_hitCdcData[2] = t_adc;
1394 t_hitCdcData[3] = t_tdc;
1395 t_hitCdcData[4] = cdcTrgTiming[iFE];
1396 hitCdcData.push_back(t_hitCdcData);
1397 } else {
1398 cout << "CDC TDC data error. TDC is smaller than 0x8000. " << hex << t_tdc << dec << endl;
1399 continue;
1400 }
1401 } // end tdc hit
1402 } // wire loop
1403 } // fe loop
1404 } // window loop
1406 //for(unsigned iHit=0; iHit<hitCdcData.size(); iHit++){
1407 // cout<<"["<<hitCdcData[iHit][0]<<"]["<<hitCdcData[iHit][1]<<"]: "<<hitCdcData[iHit][2]<<", "<<hitCdcData[iHit][3]<<endl;
1408 //}
1409 // TRG
1410 // Save data into string
1411 stringstream t_trgWindow;
1412 for (unsigned iWord = 0; iWord < inBinaryData[2].size(); iWord++) {
1413 t_trgWindow << setw(8) << setfill('0') << hex << inBinaryData[2][iWord];
1414 if (iWord % 11 == 10) {
1415 trgInformations.push_back(t_trgWindow.str());
1416 t_trgWindow.str("");
1417 }
1418 }
1419 // Save data into hits
1420 // [iHit] [0]: layerId, [1]: wireId, [2]: window timing, [3]: priority timing
1421 // priority timing = -1 : No timing
1422 vector<vector<int> > hitTrgData;
1423 for (unsigned iWindow = 0; iWindow < nTRGWindows; iWindow++) {
1424 // Change binary into TRGState
1425 vector<unsigned> t_trgData(inBinaryData[2].begin() + 11 * iWindow, inBinaryData[2].begin() + 11 * iWindow + 11);
1426 TRGState t_trgState(t_trgData, 1);
1427 TRGState t_mergerState = t_trgState.subset(96, 256);
1428 TRGState t_hitMap = t_mergerState.subset(0, 80);
1429 TRGState t_priorityMap = t_mergerState.subset(32, 16);
1430 TRGState t_secondPriorityMap = t_mergerState.subset(48, 16);
1431 TRGState t_secondHitFlag = t_mergerState.subset(208, 16);
1432 TRGState t_priorityTiming = t_mergerState.subset(80, 64);
1433 TRGState t_fastestTiming = t_mergerState.subset(144, 64);
1434 //cout<<"["<<iWindow<<"] HM: "<<t_hitMap<<endl;
1435 //cout<<"["<<iWindow<<"] PHM: "<<t_priorityMap<<endl;
1436 //cout<<"["<<iWindow<<"] SHM: "<<t_secondPriorityMap<<endl;
1437 //cout<<"["<<iWindow<<"] SPF: "<<t_secondHitFlag<<endl;
1438 //cout<<"["<<iWindow<<"] PT: "<<setfill('0')<<setw(16)<<hex<<(unsigned long long) (t_priorityTiming)<<dec<<endl;
1439 //cout<<"["<<iWindow<<"] FT: "<<setfill('0')<<setw(16)<<hex<<(unsigned long long) (t_fastestTiming)<<dec<<endl;
1440 for (unsigned iWire = 0; iWire < t_hitMap.size(); iWire++) {
1441 unsigned t_layerId = iWire / 16;
1442 unsigned t_wireId = iWire % 16;
1443 if (t_hitMap[iWire] == 1) {
1444 vector<int> t_hitTrgData(4);
1445 t_hitTrgData[0] = t_layerId;
1446 t_hitTrgData[1] = t_wireId;
1447 t_hitTrgData[2] = iWindow;
1448 // Calculate priority timing
1449 if (t_layerId == 2) {
1450 t_hitTrgData[3] = (unsigned)t_priorityTiming.subset(4 * t_wireId, 4);
1451 //cout<<"["<<t_layerId<<"]["<<t_wireId<<"]: "<<iWindow<<", "<<t_hitTrgData[3]<<endl;
1452 } else if (t_layerId == 3) {
1453 // [1] Priority hit, [0] secondaryLR
1454 TRGState t_leftInformation(2);
1455 TRGState t_rightInformation(2);
1456 TRGState t_priorityHits(2);
1457 TRGState t_secondaryLR(2);
1458 if (t_wireId != 15) {
1459 t_priorityHits = t_priorityMap.subset(t_wireId, 2);
1460 t_secondaryLR = t_secondHitFlag.subset(t_wireId, 2);
1461 t_leftInformation.set(1, t_priorityMap.subset(t_wireId + 1, 1));
1462 t_leftInformation.set(0, t_secondHitFlag.subset(t_wireId + 1, 1));
1463 t_rightInformation.set(1, t_priorityMap.subset(t_wireId, 1));
1464 t_rightInformation.set(0, t_secondHitFlag.subset(t_wireId, 1));
1465 } else {
1466 t_priorityHits.set(0, t_priorityMap.subset(t_wireId, 1));
1467 t_priorityHits.set(1, 0);
1468 t_secondaryLR.set(0, t_secondHitFlag.subset(t_wireId, 1));
1469 t_secondaryLR.set(1, 0);
1470 t_leftInformation.set(1, 1);
1471 t_leftInformation.set(0, 0);
1472 t_rightInformation.set(1, t_priorityMap.subset(t_wireId, 1));
1473 t_rightInformation.set(0, t_secondHitFlag.subset(t_wireId, 1));
1474 }
1475 //cout<<"["<<iWindow<<"]["<<t_layerId<<"]["<<t_wireId<<"] PriorityHits: "<<t_priorityHits<<endl;
1476 //cout<<"["<<iWindow<<"]["<<t_layerId<<"]["<<t_wireId<<"] SecondaryLR: "<<t_secondaryLR<<endl;
1477 //cout<<"["<<iWindow<<"]["<<t_layerId<<"]["<<t_wireId<<"] Combine0: "<<t_leftInformation<<endl;
1478 //cout<<"["<<iWindow<<"]["<<t_layerId<<"]["<<t_wireId<<"] Combine1: "<<t_rightInformation<<endl;
1479 int secondaryFlag = -1;
1480 if ((unsigned)t_leftInformation == (unsigned)TRGState("00", 0)) secondaryFlag = 0;
1481 if ((unsigned)t_leftInformation == (unsigned)TRGState("01", 0)) secondaryFlag = 1;
1482 //cout<<"["<<iWindow<<"]["<<t_layerId<<"]["<<t_wireId<<"] SecondaryFlag: "<<secondaryFlag<<" timing: ";
1483 if (secondaryFlag != -1) {
1484 if (t_wireId + (1 - secondaryFlag) < 16) {
1485 //int t_priorityTiming = strtol(priorityTiming.substr(15-t_wireId-(1-secondaryFlag),1).c_str(),0,16);
1486 unsigned t_secondaryTiming = (unsigned)t_priorityTiming.subset(4 * (t_wireId + (1 - secondaryFlag)), 4);
1487 t_hitTrgData[3] = t_secondaryTiming;
1488 //cout<<t_secondaryTiming<<endl;
1489 } else {
1490 cout << "Error in TRGDATA for secondary priority hits" << endl;
1491 }
1492 //cout<<"Layer3end"<<endl;
1493 } else {
1494 t_hitTrgData[3] = -1;
1495 //cout<<"-1"<<endl;
1496 }
1497 } else {
1498 t_hitTrgData[3] = -1;
1499 }
1500 hitTrgData.push_back(t_hitTrgData);
1501 } // wire is hit
1502 } // wire loop
1503 } // window loop
1505 //if(hitTrgData.size()) cout<<"TRG: "<<endl;
1506 //for(unsigned iHit=0; iHit<hitTrgData.size(); iHit++){
1507 // cout<<"["<<hitTrgData[iHit][0]<<"]["<<hitTrgData[iHit][1]<<"]: "<<hitTrgData[iHit][2]*32+hitTrgData[iHit][3]*2<<"("<<hitTrgData[iHit][2]<<","<<hitTrgData[iHit][3]<<")"<<endl;;
1508 //}
1509 //if(hitTrgData.size()) {
1510 // for(unsigned iWindow=0; iWindow<nTRGWindows; iWindow++){
1511 // vector<unsigned> t_trgData(inBinaryData[2].begin()+11*iWindow, inBinaryData[2].begin()+11*iWindow+11);
1512 // TRGState t_trgState(t_trgData,1);
1513 // TRGState t_mergerState = t_trgState.subset(96, 256);
1514 // TRGState t_hitMap = t_mergerState.subset(0,80);
1515 // TRGState t_priorityMap = t_mergerState.subset(32,16);
1516 // TRGState t_secondPriorityMap = t_mergerState.subset(48,16);
1517 // TRGState t_secondHitFlag= t_mergerState.subset(208,16);
1518 // TRGState t_priorityTiming = t_mergerState.subset(80,64);
1519 // TRGState t_fastestTiming = t_mergerState.subset(144,64);
1520 // cout<<"["<<iWindow<<"] HM: "<<t_hitMap<<endl;
1521 // cout<<"["<<iWindow<<"] PHM: "<<t_priorityMap<<endl;
1522 // cout<<"["<<iWindow<<"] SHM: "<<t_secondPriorityMap<<endl;
1523 // cout<<"["<<iWindow<<"] SPF: "<<t_secondHitFlag<<endl;
1524 // cout<<"["<<iWindow<<"] PT: "<<setfill('0')<<setw(16)<<hex<<(unsigned long long) (t_priorityTiming)<<dec<<endl;
1525 // cout<<"["<<iWindow<<"] FT: "<<setfill('0')<<setw(16)<<hex<<(unsigned long long) (t_fastestTiming)<<dec<<endl;
1526 // }
1527 //}
1528
1529 const int trgOutput = 2;
1530 // Store TRG data to TRGSignalBundle.
1531 // 1 is FE output. 2 is Merger output. 3 is TRG output.
1532 //...Clock...
1533 const TRGClock& dClock = TRGCDC::getTRGCDC()->dataClock();
1534 // Create signal bundle
1535 TRGSignalBundle* allTrgData;
1536 allTrgData = new TRGSignalBundle(string("TRGData"), dClock);
1537 // Create signal vector. Need to create signals for of signal vector.
1538 TRGSignalVector* trgData;
1539 trgData = new TRGSignalVector(string("TRGData"), dClock, nTrgBitsInWindow);
1540 // Loop over data and fill TRGSignalVector
1541 for (unsigned iWindow = 0; iWindow < nTRGWindows; iWindow++) {
1542 vector<unsigned> t_trgData(inBinaryData[2].begin() + 11 * iWindow, inBinaryData[2].begin() + 11 * iWindow + 11);
1543 TRGState t_trgState(t_trgData, 1);
1544 trgData->set(t_trgState, iWindow);
1545 }
1546 if (allTrgData) {
1547 allTrgData->push_back(trgData);
1548 // Clean up memory
1549 for (unsigned i = 0; i < allTrgData->size(); i++) delete (*allTrgData)[i];
1550 delete allTrgData;
1551 }
1552
1553
1554 // Save CDC hit data and TRG hit data to ROOT file.
1555 if (_makeRootFile) {
1556 saveTRGRawInformation(trgInformations);
1557 saveCDCHitInformation(hitCdcData);
1558 // cppcheck-suppress knownConditionTrueFalse
1559 if (trgOutput == 2) {
1560 saveTRGHitInformation(hitTrgData);
1561 }
1562 m_treeROOTInput->Fill();
1563 }
1564
1565 // Update CDC wires using data. Start from layer 50.
1566 for (unsigned iHit = 0; iHit < hitCdcData.size(); iHit++) {
1567 unsigned t_layerId = hitCdcData[iHit][0] + 50;
1568 unsigned t_wireId = hitCdcData[iHit][1];
1569 int t_rawTdc = hitCdcData[iHit][2];
1570 const TCWire& currentWire = *static_cast<const TCWire*>(wire(t_layerId, t_wireId));
1571
1572 // Update currentWire._signal
1573 TRGTime rise = TRGTime(t_rawTdc, true, _clockFE, currentWire.name());
1574 TRGTime fall = rise;
1575 fall.shift(1).reverse();
1576 if (currentWire._signal.active()) {
1577 currentWire._signal = currentWire.signal() | TRGSignal(rise & fall);
1578 currentWire._signal.name(currentWire.name());
1579 } else {
1580 currentWire._signal = TRGSignal(rise & fall);
1581 currentWire._signal.name(currentWire.name());
1582
1583 // Make TCWireHit and store in _layers.
1584 // [FIXME] TCWireHit can not accept wire being hit two times.
1585 TCWHit* hit = new TCWHit(currentWire, 0, 0, 0, t_rawTdc, 0, t_rawTdc, 0, 0, 1);
1586 hit->state(CellHitFindingValid | CellHitFittingValid);
1587 ((TCWire*)(*_layers[t_layerId])[t_wireId])->hit(hit);
1588 _hits.push_back(hit);
1589 if (currentWire.axial()) _axialHits.push_back(hit);
1590 else _stereoHits.push_back(hit);
1591 }
1592 //cout<<"iLayer, iWire, iHit: "<<t_layerId<<" "<<t_wireId<<" "<<iHit<<endl;
1593 //currentWire.signal().dump();
1594
1595 } // End updating CDC wires
1596
1597 //...Hit classification...
1599
1600 TRGDebug::leaveStage("TRGCDC updateByData");
1601 }
void saveTRGHitInformation(std::vector< std::vector< int > > &)
Save functions for ROOT.
Definition: TRGCDC.cc:2775
void saveTRGRawInformation(std::vector< std::string > &)
Save functions for ROOT.
Definition: TRGCDC.cc:2789
void saveCDCHitInformation(std::vector< std::vector< unsigned > > &)
Save functions for ROOT.
Definition: TRGCDC.cc:2760

◆ updateCache()

void updateCache ( void  )
private

update Caches

Definition at line 436 of file Helix.cc.

437 {
438#if defined(BELLE_DEBUG)
439 checkValid();
440 if (m_helixValid) {
441#endif
442 //
443 // Calculate TRGCDCHelix center( xc, yc ).
444 //
445 // xc = x0 + (dr + (alpha / kappa)) * cos(phi0) (cm)
446 // yc = y0 + (dr + (alpha / kappa)) * sin(phi0) (cm)
447 //
448 m_ac[0] = m_a[0];
449 m_ac[1] = m_a[1];
450 m_ac[2] = m_a[2];
451 m_ac[3] = m_a[3];
452 m_ac[4] = m_a[4];
453
454 m_cp = cos(m_ac[1]);
455 m_sp = sin(m_ac[1]);
456 if (m_ac[2] != 0.0) {
457 if (m_ac[2] == DBL_MAX || m_ac[2] == (-DBL_MAX)) {
458 m_pt = m_r = 0;
459 return;
460 } else {
461 m_pt = 1. / m_ac[2];
462 m_r = m_alpha / m_ac[2];
463 }
464 } else {
465 m_pt = (DBL_MAX);
466 m_r = (DBL_MAX);
467 return;
468 }
469
470 double x = m_pivot.x() + (m_ac[0] + m_r) * m_cp;
471 double y = m_pivot.y() + (m_ac[0] + m_r) * m_sp;
472 m_center.setX(x);
473 m_center.setY(y);
474 m_center.setZ(0.);
475#if defined(BELLE_DEBUG)
476 } else {
477 m_ac[0] = m_a[0];
478 m_ac[1] = m_a[1];
479 m_ac[2] = m_a[2];
480 m_ac[3] = m_a[3];
481 m_ac[4] = m_a[4];
482
483 m_cp = cos(m_ac[1]);
484 m_sp = sin(m_ac[1]);
485 if (m_ac[2] != 0.0) {
486 if (m_ac[2] == DBL_MAX || m_ac[2] == (-DBL_MAX)) {
487 m_pt = m_r = 0;
488 return;
489 } else {
490 m_pt = 1. / m_ac[2];
491 m_r = m_alpha / m_ac[2];
492 }
493 } else {
494 m_pt = (DBL_MAX);
495 m_r = (DBL_MAX);
496 return;
497 }
498
499 double x = m_pivot.x() + (m_ac[0] + m_r) * m_cp;
500 double y = m_pivot.y() + (m_ac[0] + m_r) * m_sp;
501 m_center.setX(x);
502 m_center.setY(y);
503 m_center.setZ(0.);
504 }
505#endif
506 }
void checkValid(void)
check validity
Definition: Helix.cc:815

◆ UserSteppingAction()

void UserSteppingAction ( const G4Step *  aStep)
virtual

Stepping action to control a step in G4.

Definition at line 33 of file SteppingAction.cc.

34 {
35 const G4StepPoint& in = * aStep->GetPreStepPoint();
36 const G4StepPoint& out = * aStep->GetPostStepPoint();
37 const double rIn = in.GetPosition().r();
38 const double rOut = out.GetPosition().r();
39 const bool curlBack = rIn > rOut;
40 if (curlBack)
41 aStep->GetTrack()->SetTrackStatus(fKillTrackAndSecondaries);
42 };

◆ v()

const CLHEP::Hep3Vector & v ( void  ) const
inline

returns position vector.

Definition at line 159 of file TrackMC.h.

160 {
161 return _v;
162 }

◆ valuesToMapSignals()

void valuesToMapSignals ( std::vector< std::tuple< std::string, double, int, double, double, int > > const &  inValues,
Belle2::TRGCDCJSignalData inCommonData,
std::map< std::string, Belle2::TRGCDCJSignal > &  outMap 
)
static

Values => [name, value, bitwidth, min, max, clock] Changes values to signals.

Definition at line 2208 of file JSignal.cc.

2210 {
2211 for (unsigned iSignals = 0; iSignals < inValues.size(); iSignals++) {
2212 string const& t_name = get<0>(inValues[iSignals]);
2213 double const& t_value = get<1>(inValues[iSignals]);
2214 int const& t_bitWidth = get<2>(inValues[iSignals]);
2215 double const& t_min = get<3>(inValues[iSignals]);
2216 double const& t_max = get<4>(inValues[iSignals]);
2217 int const& t_clock = get<5>(inValues[iSignals]);
2218 // Put input to signal.
2219 // Input to finish clock is 0.
2220 // Signals that will be used will have finish clock 1 due to below line.
2221 outMap[t_name] <= Belle2::TRGCDCJSignal(t_bitWidth, t_value, t_min, t_max, t_clock, inCommonData);
2222 }
2223 }

◆ version() [1/12]

string version ( void  )
static

returns version.

Definition at line 53 of file FrontEnd.cc.

54 {
55 return ("TRGCDCFrontEnd version 0.01");
56 }

◆ version() [2/12]

string version ( void  )
static

return version.

Definition at line 53 of file Merger.cc.

54 {
55 return ("TRGCDCMerger version 0.00");
56 }

◆ version() [3/12]

string version ( void  )
static

returns version.

Definition at line 52 of file Tracker2D.cc.

53 {
54 return ("TRGCDCTracker2D version 0.00");
55 }

◆ version() [4/12]

string version ( void  ) const

Gets version of class.

Definition at line 1548 of file Fitter3D.cc.

1549 {
1550 return string("TRGCDCFitter3D 6.0");
1551 }

◆ version() [5/12]

string version ( void  ) const

returns version.

Definition at line 74 of file HoughFinder.cc.

75 {
76 return string("TRGCDCHoughFinder 5.24");
77 }

◆ version() [6/12]

std::string version ( void  ) const

returns version.

Definition at line 42 of file JLUT.cc.

43 {
44 return string("TRGCDCJLUT 0.00");
45 }

◆ version() [7/12]

std::string version ( void  ) const

returns version.

Definition at line 33 of file LUT.cc.

34 {
35 return string("TRGCDCLUT 1.00");
36 }

◆ version() [8/12]

string version ( void  ) const

returns version.

Definition at line 38 of file PeakFinder.cc.

39 {
40 return string("TRGCDCPeakFinder 5.05");
41 }

◆ version() [9/12]

string version ( void  ) const

returns version.

Definition at line 49 of file PerfectFinder.cc.

50 {
51 return string("TRGCDCPerfectFinder 5.24");
52 }

◆ version() [10/12]

string version ( void  ) const

returns version.

Definition at line 98 of file TRGCDC.cc.

99 {
100 return string("TRGCDC 5.39");
101 }

◆ version() [11/12]

string version ( void  ) const

returns version.

Definition at line 60 of file TRGGDL.cc.

61 {
62 return string("TRGGDL 0.01");
63 }

◆ version() [12/12]

string version ( void  ) const

returns version.

Definition at line 43 of file TRGGRL.cc.

44 {
45 return string("TRGGRL 0.01");
46 }

◆ versionCDC()

std::string versionCDC ( void  ) const
inline

returns CDC version.

Definition at line 856 of file TRGCDC.h.

857 {
858 return std::string(_cdcVersion);
859 }
const std::string _cdcVersion
CDC version.
Definition: TRGCDC.h:496

◆ vhdlCode() [1/2]

void vhdlCode ( const std::string &  operation,
TRGCDCJSignal const &  first,
TRGCDCJSignal const &  result,
std::string &  targetVhdlCode 
)
static

Writes vhdl code using one signal.

Definition at line 1844 of file JSignal.cc.

1846 {
1847 // Copy first for VHDL version.
1848 TRGCDCJSignal t_first(first);
1849 // Set m_vhdlCode if needed. (Will require clock implementation later)
1850 if (t_first.m_vhdlCode == "") {
1851 t_first.initVhdlCode();
1852 }
1853 // Match types
1854 // Change VHDL unsigned to VHDL signed if required.
1855 if (t_first.m_type != -1 && result.m_type == -1) {
1856 t_first.toSignedVhdlCode();
1857 }
1858 // Change to unsigned if slv.
1859 if (t_first.m_type == 2) t_first.toUnsignedVhdlCode();
1860
1861 // Calculate result type and bitwidth.
1862 int logicType, logicBitwidth, vhdlType, vhdlBitwidth;
1863 logicType = result.m_type;
1864 logicBitwidth = result.m_bitsize;
1865 // Will always be same as first type and bitsize.
1866 vhdlType = t_first.m_type;
1867 vhdlBitwidth = t_first.m_bitsize;
1868
1869 // Make code.
1870 string resultCode;
1871 // If logic(out) is unsigned and vhdl(in) is signed.
1872 if (logicType == 1 && vhdlType == -1) {
1873 if (logicBitwidth + 1 > vhdlBitwidth) t_first.m_vhdlCode = "resize(" + t_first.m_vhdlCode + "," + to_string(
1874 logicBitwidth + 1) + ")";
1875 if (operation == "shift_left"
1876 || operation == "shift_right") resultCode = operation + "(" + t_first.m_vhdlCode + "," + to_string(abs(
1877 first.m_bitsize - result.m_bitsize)) + ")";
1878 else if (operation == "unsigned" || operation == "none") resultCode = t_first.m_vhdlCode;
1879 else resultCode = operation + "(" + t_first.m_vhdlCode + ")";
1880 resultCode = "resize(unsigned(" + resultCode + ")," + to_string(logicBitwidth) + ")";
1881 } else {
1882 // Normal case.
1883 if (logicBitwidth > vhdlBitwidth) {
1884 t_first.m_vhdlCode = "resize(" + t_first.m_vhdlCode + "," + to_string(logicBitwidth) + ")";
1885 }
1886 if (operation == "shift_left"
1887 || operation == "shift_right") resultCode = operation + "(" + t_first.m_vhdlCode + "," + to_string(abs(
1888 first.m_bitsize - result.m_bitsize)) + ")";
1889 else if (operation == "resize" || operation == "signed" || operation == "none") resultCode = t_first.m_vhdlCode;
1890 else resultCode = operation + "(" + t_first.m_vhdlCode + ")";
1891 // Resize output to minimum bitwidth.
1892 if (logicBitwidth < vhdlBitwidth) {
1893 resultCode = "resize(" + resultCode + "," + to_string(logicBitwidth) + ")";
1894 }
1895 }
1896 resultVhdlCode = resultCode;
1897 }

◆ vhdlCode() [2/2]

void vhdlCode ( TRGCDCJSignal const &  first,
const std::string &  operation,
TRGCDCJSignal const &  second,
TRGCDCJSignal const &  result,
std::string &  targtVhdlCode 
)
static

Writes vhdl code using two signals.

Definition at line 1781 of file JSignal.cc.

1783 {
1784 // Copy first and second for VHDL version.
1785 TRGCDCJSignal t_first(first);
1786 TRGCDCJSignal t_second(second);
1787 // Set m_vhdlCode if needed. (Will require clock implementation later)
1788 if (t_first.m_vhdlCode == "") {
1789 t_first.initVhdlCode();
1790 }
1791 if (t_second.m_vhdlCode == "") {
1792 t_second.initVhdlCode();
1793 }
1794
1795 // Match types.
1796 // Changed to signed.
1797 if (t_first.m_type * t_second.m_type < 0 || (t_first.m_type != -1 && result.m_type == -1)) {
1798 if (t_first.m_type != -1) {
1799 t_first.toSignedVhdlCode();
1800 }
1801 if (t_second.m_type != -1) {
1802 t_second.toSignedVhdlCode();
1803 }
1804 }
1805 // Change to unsigned.
1806 if (t_first.m_type == 2) t_first.toUnsignedVhdlCode();
1807 if (t_second.m_type == 2) t_second.toUnsignedVhdlCode();
1808
1809 // Calculate result type and bitwidth.
1810 int logicType, logicBitwidth, vhdlType, vhdlBitwidth;
1811 logicType = result.m_type;
1812 logicBitwidth = result.m_bitsize;
1813 calVhdlTypeBitwidth(t_first, operation, t_second, vhdlType, vhdlBitwidth);
1814
1815 // Make code.
1816 string resultCode;
1817 // For compare operations.
1818 if (operation == "=" || operation == "/=" || operation == "<" || operation == "<=" ||
1819 operation == ">" || operation == ">=" || operation == "and" || operation == "or") {
1820 resultCode = "(" + t_first.m_vhdlCode + operation + t_second.m_vhdlCode + ")";
1821 } else {
1822 // For arithmetic operations.
1823 // If special case.
1824 if (logicType > 0 && vhdlType == -1) {
1825 if (logicBitwidth + 1 > vhdlBitwidth) t_first.m_vhdlCode = "resize(" + t_first.m_vhdlCode + "," + to_string(
1826 logicBitwidth + 1) + ")";
1827 resultCode = t_first.m_vhdlCode + operation + t_second.m_vhdlCode;
1828 resultCode = "resize(unsigned(" + resultCode + ")," + to_string(logicBitwidth) + ")";
1829 } else {
1830 // Normal case.
1831 if (logicBitwidth > vhdlBitwidth) {
1832 t_first.m_vhdlCode = "resize(" + t_first.m_vhdlCode + "," + to_string(logicBitwidth) + ")";
1833 }
1834 resultCode = t_first.m_vhdlCode + operation + t_second.m_vhdlCode;
1835 // Resize output to minimum bitwidth.
1836 if (logicBitwidth < vhdlBitwidth) {
1837 resultCode = "resize(" + resultCode + "," + to_string(logicBitwidth) + ")";
1838 }
1839 }
1840 }
1841 resultVhdlCode = resultCode;
1842 }
static void calVhdlTypeBitwidth(TRGCDCJSignal const &first, const std::string &operation, TRGCDCJSignal const &second, int &type, int &bitwidth)
Calculates vhdl bitwidth and type for operation.
Definition: JSignal.cc:1667

◆ vote() [1/11]

void vote ( float  phi,
unsigned  layerId,
int  weight 
)

vote

Definition at line 110 of file HoughPlaneMulti.cc.

111 {
112 _layers[layerId]->vote(phi, weight);
113 }
virtual void vote(float rx, float ry, int weight=1)
Voring.

◆ vote() [2/11]

void vote ( float  rx,
float  ry,
float  charge,
const TRGCDCHoughTransformation hough,
unsigned  weight,
unsigned  layerId 
)

vote

Definition at line 61 of file HoughPlaneMulti.cc.

67 {
68
69#ifdef TRASAN_DEBUG
70 if (layerId >= N_LAYERS)
71 std::cout << "TRGCDCHoughPlaneMulti::vote !!! (" << name()
72 << ") given layerId(" << layerId << ") is too big : max="
73 << _nLayers - 1 << std::endl;
74#endif
75
76// const unsigned a = layerId / 32;
77// _usage[a] |= (1 << (layerId % 32));
78 _usage[layerId] = true;
79 _layers[layerId]->vote(rx, ry, (int) targetCharge, weight);
80 }

◆ vote() [3/11]

void vote ( float  rx,
float  ry,
float  charge,
int  weight = 1 
)

Votes with charge decision.

Definition at line 57 of file HoughPlaneBoolean.cc.

61 {
62
63 const HepGeom::Point3D<double> r(rx, ry, 0);
64
65//
66// cout << "yMax=" << yMax() << endl;
67//
68
69 //...phi loop...
70 for (unsigned i = 0; i < nX(); i++) {
71 const float x0 = xSize() * float(i);
72 const HepGeom::Point3D<double> center(cos(x0), sin(x0), 0);
73 float charge = r.cross(center).z();
74 if (targetCharge != 0)
75 if (targetCharge * charge > 0)
76 continue;
77
78 float y0 = transformation().y(rx, ry, x0);
79 const float x1 = xSize() * float(i + 1);
80 float y1 = transformation().y(rx, ry, x1);
81
82//
83// cout << "x0,x1,y0,y1=" << x0 << "," << x1 << "," << y0 << "," << y1
84// << endl;
85//
86
87 //...Check y position...
88 if ((y0 == 0) && (y1 == 0))
89 continue;
90 else if ((y0 > yMax()) && (y1 > yMax()))
91 continue;
92 else if ((y0 < yMin()) && (y1 < yMin()))
93 continue;
94
95 //...Divergence here...
96 if ((y0 == 0) && (y1 != 0))
97 y0 = yMax();
98 else if ((y0 != 0) && (y1 == 0))
99 y1 = yMax();
100
101 //...Adjust location...
102 if (y0 < yMin())
103 y0 = yMin();
104 if (y1 < yMin())
105 y1 = yMin();
106 if (y0 > yMax())
107 y0 = yMax();
108 if (y1 > yMax())
109 y1 = yMax();
110
111 //...Location in the plane...
112 int iY0 = int((y0 - yMin()) / ySize());
113 int iY1 = int((y1 - yMin()) / ySize());
114
115//
116// cout << "x0,x1,y0,y1=" << x0 << "," << x1 << "," << y0 << "," << y1
117// << "," << iY0 << "," << iY1 << endl;
118//
119
120 //...Sorting...
121 if (iY0 > iY1) {
122 const int tmp = iY0;
123 iY0 = iY1;
124 iY1 = tmp;
125 }
126
127 //...Voting...
128 for (unsigned j = (unsigned) iY0; j < (unsigned)(iY1 + 1); j++) {
129 const unsigned k = i * nY() + j;
130 const unsigned b0 = k / 32;
131 const unsigned b1 = k % 32;
132 if (weight > 0)
133 _cell[b0] |= (1 << b1);
134 else
135 _cell[b0] &= (~(1 << b1));
136 }
137 }
138 }
virtual float y(float xReal, float yReal, float x) const =0
returns Y coordinate in a Hough parameter plane.
float ySize(void) const
returns size of y bin.
const TRGCDCHoughTransformation & transformation(void) const
returns Hough transformation object.
float xSize(void) const
returns size of x bin.

◆ vote() [4/11]

void vote ( float  rx,
float  ry,
int  charge,
int  weight = 1 
)
virtual

Voring.

Reimplemented in TRGCDCHoughPlaneMulti, and TRGCDCHoughPlaneMulti2.

Definition at line 158 of file HoughPlaneBase.cc.

162 {
163
164 const HepGeom::Point3D<double> r(rx, ry, 0);
165
166 //...phi loop...
167 for (unsigned i = 0; i < _nX; i++) {
168 const float x0 = xSize() * float(i);
169 const HepGeom::Point3D<double> phi(cos(x0), sin(x0), 0);
170 float charge = r.cross(phi).z();
171 if (targetCharge != 0)
172 if (targetCharge * charge > 0)
173 continue;
174
175 const float y0 = _trans.y(rx, ry, x0);
176 const float x1 = xSize() * float(i + 1);
177 const float y1 = _trans.y(rx, ry, x1);
178
179 //...Location in the plane...
180 int iY0 = int((y0 - yMin()) / ySize());
181 int iY1 = int((y1 - yMin()) / ySize());
182
183 //...This is special implementation for Circle Hough...
184 if (_trans.diverge(rx, ry, x0, x1)) {
185 if (iY0 > 0) {
186 if (iY0 >= (int) _nY) continue;
187 iY1 = _nY - 1;
188 } else {
189 if (iY1 >= (int) _nY) continue;
190 iY0 = iY1;
191 iY1 = _nY - 1;
192 }
193 }
194
195 //...Sorting...
196 if (iY0 > iY1) {
197 const int tmp = iY0;
198 iY0 = iY1;
199 iY1 = tmp;
200 }
201
202 //...Both out of region ?...
203 if (iY1 < 0) continue;
204 if (iY0 >= (int) _nY) continue;
205
206 //...In region ?...
207 if (iY0 < 0) iY0 = 0;
208 if (iY0 >= (int) _nY) iY0 = _nY - 1;
209 //if (iY1 < 0) iY1 = 0; //redundant condition
210 if (iY1 >= (int) _nY) iY1 = _nY - 1;
211
212 //...Voting...
213 for (unsigned j = (unsigned) iY0; j < (unsigned)(iY1 + 1); j++) {
214// _cell[i * _nY + j] += weight;
215 add(i * _nY + j, weight);
216// if (_cell[i * _nY + j] < 0)
217// _cell[i * _nY + j] = 0;
218 }
219 }
220 }
virtual void add(unsigned cellId, int weight)=0
Add to a cell.
virtual bool diverge(float xReal, float yReal, float x0, float x1) const =0
returns true if Y diverges in given region.

◆ vote() [5/11]

void vote ( float  rx,
float  ry,
int  charge,
unsigned  layerId,
int  weight = 1 
)
inline

Voting.

Definition at line 175 of file HoughPlaneMulti2.h.

180 {
181 _usage[layerId] = true;
182 _layers[layerId]->vote(rx, ry, charge, weight);
183 }
void vote(float rx, float ry, int weight=1) override
Votes.

◆ vote() [6/11]

void vote ( float  rx,
float  ry,
int  weight = 1 
)
inlinevirtual

Voring.

Reimplemented in TRGCDCHoughPlaneMulti, TRGCDCHoughPlaneMulti2, and TRGCDCHoughPlaneBoolean.

Definition at line 506 of file HoughPlaneBase.h.

509 {
510 vote(rx, ry, 0, weight);
511 }

◆ vote() [7/11]

void vote ( float  rx,
float  ry,
int  weight = 1 
)
inlineoverridevirtual

Votes.

Reimplemented from TRGCDCHoughPlaneBase.

Definition at line 166 of file HoughPlaneBoolean.h.

169 {
170 vote(rx, ry, 0, weight);
171 }

◆ vote() [8/11]

void vote ( float  rx,
float  ry,
unsigned  layerId,
int  weight = 1 
)
inline

Voting.

Voting.

Definition at line 187 of file HoughPlaneMulti2.h.

191 {
192 _usage[layerId] = true;
193 _layers[layerId]->vote(rx, ry, weight);
194 }

◆ vote() [9/11]

void vote ( float  xOffset,
int  weight = 1 
)
inlinevirtual

Votes using a pattern.

Reimplemented in TRGCDCHoughPlaneMulti, and TRGCDCHoughPlaneMulti2.

Definition at line 515 of file HoughPlaneBase.h.

516 {
517// do nothing
518 }

◆ vote() [10/11]

void vote ( unsigned  layerId,
unsigned  localId,
int  weight = 1 
)
inline

Voting.

Voting.

Definition at line 205 of file HoughPlaneMulti2.h.

206 {
207 _usage[a] = true;
208 _layers[a]->vote(b, c);
209 }

◆ vote() [11/11]

void vote ( unsigned  patternId,
int  weight 
)

Votes using registered pattern.

Definition at line 271 of file HoughPlaneBoolean.cc.

272 {
273 const unsigned n = _nActive[patternId];
274 for (unsigned i = 0; i < n; i++) {
275 add(_patterns[patternId][i], weight);
276 }
277 }

◆ voteByPattern()

void voteByPattern ( float  xOffset,
int  weight = 1 
)
virtual

Votes using a pattern.

Definition at line 224 of file HoughPlane.cc.

225 {
226#ifdef TRASAN_DEBUG
227 if (_patterns == 0)
228 std::cout << "TRGCDCHoughPlane::vote !!! pattern is note defined" << std::endl;
229 if ((xOffset < 0) || (xOffset > 1))
230 std::cout << "TRGCDCHoughPlane::vote !!! xOffset should be (0 - 1). xOffset="
231 << xOffset << std::endl;
232#endif
233
234 const unsigned x = unsigned(nX() * xOffset);
235 const unsigned p = x ? (x - 1) * nY() : 0;
236 const unsigned n = nX() * nY();
237
238 for (unsigned i = 0; i < _nPatterns; i++) {
239 unsigned id = _patterns[i] + p;
240 if (id > n) id -= n;
241 _cell[id] += weight;
242 }
243
244// const unsigned x = unsigned(nX() * xOffset);
245// const unsigned p = x ? (x - 1) * nY() : 0;
246// const unsigned n = nX() * nY();
247// unsigned j = 0;
248// for (unsigned i = p; i < n; i++)
249// _cell[i] += _pattern[j++] * weight;
250// for (unsigned i = 0; i < p; i++)
251// _cell[i] += _pattern[j++] * weight;
252
253// std::cout << "--------------------------------" << std::endl;
254 }

◆ voteUsedInTrasan()

void voteUsedInTrasan ( float  rx,
float  ry,
float  charge,
int  weight = 1 
)

Votes with charge decision.

Definition at line 141 of file HoughPlaneBoolean.cc.

145 {
146
147 const HepGeom::Point3D<double> r(rx, ry, 0);
148
149 //...phi loop...
150 for (unsigned i = 0; i < nX(); i++) {
151 const float x0 = xSize() * float(i);
152 const HepGeom::Point3D<double> phi(cos(x0), sin(x0), 0);
153 float charge = r.cross(phi).z();
154 if (targetCharge != 0)
155 if (targetCharge * charge > 0)
156 continue;
157
158 const float y0 = transformation().y(rx, ry, x0);
159 const float x1 = xSize() * float(i + 1);
160 const float y1 = transformation().y(rx, ry, x1);
161
162 //...Location in the plane...
163 int iY0 = int((y0 - yMin()) / ySize());
164 int iY1 = int((y1 - yMin()) / ySize());
165
166 //...This is special implementation for Circle Hough...
167 if (transformation().diverge(rx, ry, x0, x1)) {
168 if (iY0 > 0) {
169 if (iY0 >= (int) nY()) continue;
170 iY1 = nY() - 1;
171 } else {
172 if (iY1 >= (int) nY()) continue;
173 iY0 = iY1;
174 iY1 = nY() - 1;
175 }
176 }
177
178 //...Sorting...
179 if (iY0 > iY1) {
180 const int tmp = iY0;
181 iY0 = iY1;
182 iY1 = tmp;
183 }
184
185 //...Both out of region ?...
186 if (iY1 < 0) continue;
187 if (iY0 >= (int) nY()) continue;
188
189 //...In region ?...
190 if (iY0 < 0) iY0 = 0;
191 if (iY0 >= (int) nY()) iY0 = nY() - 1;
192 // if (iY1 < 0) iY1 = 0; //redundant
193 if (iY1 >= (int) nY()) iY1 = nY() - 1;
194
195 //...Voting...
196 for (unsigned j = (unsigned) iY0; j < (unsigned)(iY1 + 1); j++) {
197 const unsigned k = i * nY() + j;
198 const unsigned b0 = k / 32;
199 const unsigned b1 = k % 32;
200 if (weight > 0)
201 _cell[b0] |= (1 << b1);
202 else
203 _cell[b0] &= (~(1 << b1));
204 }
205 }
206 }

◆ widen()

TRGSignal & widen ( unsigned  width)

returns widen signals. Signals wider than "width" will be untouched.

Definition at line 321 of file Signal.cc.

322 {
323
324 //...Check rising edges...
325 const unsigned n = _history.size();
326 for (unsigned i = 0; i < n; i++) {
327 const bool edge = _history[i].edge();
328
329 if (! edge) {
330 const int t0 = _history[i - 1].time();
331 const int t1 = _history[i].time();
332 if ((t1 - t0) < int(width))
333 _history[i].time(t0 + width);
334 }
335 }
336
337 // Merge overlapping history
338 std::sort(_history.begin(), _history.end(), TRGTime::sortByTime);
340
341#if TRG_DEBUG
343#endif
344
345 return * this;
346 }
unsigned width(unsigned i=0) const
returns width of i'th signal (i=0,1,2,...).
Definition: Signal.cc:388

◆ width() [1/2]

unsigned width ( const std::vector< TRGCDCLink * > &  list)
static

returns width(wire cell unit) of given std::vector<TRGCDCLink *>.

This function assumes that all TRGCDCLink's are in the same super layer.

Definition at line 483 of file Link.cc.

484 {
485 const unsigned n = list.size();
486 if (n < 2) return n;
487
488 const TCCell* const w0 = list[0]->cell();
489//cnv const unsigned sId = w0->superLayerId();
490 unsigned nWires = w0->layer().nCells();
491 unsigned center = w0->localId();
492
493 if (ms_smallcell && w0->layerId() < 3) {
494 nWires /= 2;
495 center /= 2;
496 }
497
498 unsigned left = 0;
499 unsigned right = 0;
500 for (unsigned i = 1; i < n; i++) {
501 const TCCell* const w = list[i]->cell();
502 unsigned id = w->localId();
503
504 if (ms_smallcell && w->layerId() < 3)
505 id /= 2;
506
507 unsigned distance0, distance1;
508 if (id > center) {
509 distance0 = id - center;
510 distance1 = nWires - distance0;
511 } else {
512 distance1 = center - id;
513 distance0 = nWires - distance1;
514 }
515
516 if (distance0 < distance1) {
517 if (distance0 > right) right = distance0;
518 } else {
519 if (distance1 > left) left = distance1;
520 }
521 }
522
523 return right + left + 1;
524 }
static bool ms_smallcell
ms_smallcell
Definition: Link.h:393

◆ width() [2/2]

unsigned width ( unsigned  i = 0) const

returns width of i'th signal (i=0,1,2,...).

Definition at line 388 of file Signal.cc.

389 {
390 unsigned j = 0;
391 const unsigned n = _history.size();
392 for (unsigned i = 0; i < n; i++) {
393 const bool edge = _history[i].edge();
394
395 if (! edge) {
396 const int t0 = _history[i - 1].time();
397 const int t1 = _history[i].time();
398 const unsigned w = t1 - t0;
399 if (j == a) {
400 return w;
401 }
402 ++j;
403 }
404 }
405 return 0;
406 }

◆ wire() [1/6]

const TCWire * wire ( float  r,
float  phi 
) const

returns a pointer to a wire.

returns a pointer to a wire.

Definition at line 915 of file TRGCDC.cc.

916 {
917 //...Not implemented yet...
918 return _wires[0];
919
920 // // cout << "r,phi = " << r << "," << p << endl;
921
922 // // unsigned id = 25;
923 // // bool ok = false;
924 // // const TRGCDCLayer * l;
925 // // while (! ok) {
926 // // l = layer(id);
927 // // if (! l) return 0;
928
929 // // const geocdc_layer * geo = l->geocdc();
930 // // if (geo->m_r + geo->m_rcsiz2 < r) ++id;
931 // // else if (geo->m_r - geo->m_rcsiz1 > r) --id;
932 // // else ok = true;
933 // // }
934 // // float dPhi = 2. * M_PI / float(l->nCells());
935 // // if (l->geocdc()->m_offset > 0.) p -= dPhi / 2.;
936 // // unsigned localId = unsigned(phi(p) / dPhi);
937 // // return l->wire(localId);
938 // }
939 }

◆ wire() [2/6]

const TCWire * wire ( unsigned  layerId,
int  localId 
) const

returns a pointer to a wire.

'localId' can be negative. 0 will be returned if 'layerId' is invalid.

Definition at line 900 of file TRGCDC.cc.

901 {
902 if (layerId < nLayers())
903 return (TCWire*) & _layers[layerId]->cell(localId);
904 return 0;
905 }

◆ wire() [3/6]

const TCWire * wire ( unsigned  wireId) const

returns a pointer to a wire.

0 will be returned if 'wireId' is invalid.

Definition at line 892 of file TRGCDC.cc.

893 {
894 if (id < nWires())
895 return _wires[id];
896 return 0;
897 }

◆ wire() [4/6]

const TRGCDCWire * wire ( void  ) const

returns a pointer to a wire.

Definition at line 833 of file Link.cc.

834 {
835 if (_hit)
836 return dynamic_cast<const TRGCDCWire*>(& _hit->cell());
837 return 0;
838 }

◆ wire() [5/6]

const TRGCDCWire & wire ( void  ) const

returns a pointer to a TRGCDCWire.

Definition at line 60 of file WireHit.cc.

61 {
62 return dynamic_cast<const TRGCDCWire&>(cell());
63 }

◆ wire() [6/6]

const TRGCDCWire * wire ( void  ) const
inline

returns a pointer to a TRGCDCWire.

Definition at line 135 of file WireHitMC.h.

136 {
137 return _wire;
138 }

◆ wireName()

string wireName ( unsigned  wireId) const

returns wire name.

Definition at line 1759 of file TRGCDC.cc.

1760 {
1761 string as = "-";
1762 const TCWire* const w = wire(wireId);
1763 if (w) {
1764 if (w->stereo())
1765 as = "=";
1766 } else {
1767 return "invalid_wire(" + TRGUtil::itostring(wireId) + ")";
1768 }
1769 return TRGUtil::itostring(layerId(wireId)) + as + TRGUtil::itostring(localId(wireId));
1770 }

◆ wires()

const std::vector< const TRGCDCWire * > & wires ( void  ) const
inline

returns a vector containing pointers to a wire.

Definition at line 198 of file Segment.h.

199 {
200 return _wires;
201 }

◆ x() [1/8]

HepGeom::Point3D< double > x ( double  dPhi,
CLHEP::HepSymMatrix &  Ex 
) const

returns position and convariance matrix(Ex) after rotation.

Definition at line 171 of file Helix.cc.

172 {
173
174 double x = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] + phi));
175 double y = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] + phi));
176 double z = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
177
178 //
179 // Calculate position error matrix.
180 // Ex(phi) = (@x/@a)(Ea)(@x/@a)^T, phi is deflection angle to specify the
181 // point to be calcualted.
182 //
183 // CLHEP::HepMatrix dXDA(3, 5, 0);
184 // dXDA = delXDelA(phi);
185 // Ex.assign(dXDA * m_Ea * dXDA.T());
186
187 if (m_matrixValid) Ex = m_Ea.similarity(delXDelA(phi));
188 else Ex = m_Ea;
189
190 return HepGeom::Point3D<double> (x, y, z);
191 }
CLHEP::HepMatrix delXDelA(double phi) const
Mathmatical functions.
Definition: Helix.cc:578

◆ x() [2/8]

double * x ( double  dPhi,
double  p[3] 
) const

returns position after rotating angle dPhi in phi direction.

Definition at line 153 of file Helix.cc.

154 {
155 //
156 // Calculate position (x,y,z) along helix.
157 //
158 // x = x0 + dr * cos(phi0) + (alpha / kappa) * (cos(phi0) - cos(phi0+phi))
159 // y = y0 + dr * sin(phi0) + (alpha / kappa) * (sin(phi0) - sin(phi0+phi))
160 // z = z0 + dz - (alpha / kappa) * tan(lambda) * phi
161 //
162
163 p[0] = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] + phi));
164 p[1] = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] + phi));
165 p[2] = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
166
167 return p;
168 }

◆ x() [3/8]

HepGeom::Point3D< double > x ( double  dPhi = 0.) const

returns position after rotating angle dPhi in phi direction.

Definition at line 135 of file Helix.cc.

136 {
137 //
138 // Calculate position (x,y,z) along helix.
139 //
140 // x = x0 + dr * cos(phi0) + (alpha / kappa) * (cos(phi0) - cos(phi0+phi))
141 // y = y0 + dr * sin(phi0) + (alpha / kappa) * (sin(phi0) - sin(phi0+phi))
142 // z = z0 + dz - (alpha / kappa) * tan(lambda) * phi
143 //
144
145 double x = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] + phi));
146 double y = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] + phi));
147 double z = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
148
149 return HepGeom::Point3D<double> (x, y, z);
150 }

◆ x() [4/8]

double x ( double  r) const
private

private const member functions

Definition at line 174 of file Lpar.cc.

175 {
176 double t_x, t_y;
177 xy(r, t_x, t_y);
178 return t_x;
179 }

◆ x() [5/8]

double x ( double  a)
inline

x of the point

Definition at line 106 of file Point2D.h.

107 {
108 return _p[0] = a;
109 }

◆ x() [6/8]

const CLHEP::Hep3Vector & x ( void  ) const
inlinevirtual

returns position vector.

Reimplemented in TRGCDCTrack.

Definition at line 213 of file TrackBase.h.

214 {
215 return _x;
216 }
CLHEP::Hep3Vector _x
Position.
Definition: TrackBase.h:154

◆ x() [7/8]

double x ( void  ) const
inline

x of the point

Definition at line 92 of file Point2D.h.

93 {
94 return _p[0];
95 }

◆ x() [8/8]

const CLHEP::Hep3Vector & x ( void  ) const
inlineoverridevirtual

returns position vector.

Reimplemented from TRGCDCTrackBase.

Definition at line 173 of file TRGCDCTrack.h.

174 {
175 _x = _helix.x();
176 return _x;
177 }
CLHEP::Hep3Vector _x
Position.
Definition: TRGCDCTrack.h:116

◆ xhyh()

void xhyh ( double  x,
double  y,
double &  xh,
double &  yh 
) const
private

private const member functions

Definition at line 197 of file Lpar.cc.

198 {
199 double ddm = dr(x, y);
200 if (ddm == 0) {
201 xh = x;
202 yh = y;
203 return;
204 }
205 double kdp1 = 1 + 2 * kappa() * ddm;
206 xh = x - ddm * (2 * kappa() * x + alpha()) / kdp1;
207 yh = y - ddm * (2 * kappa() * y + beta()) / kdp1;
208 }
double dr(double x, double y) const
const member functions
Definition: Lpar.h:263

◆ xMax() [1/2]

float xMax ( float  newXMax)
inline

sets and returns max. of x.

Definition at line 280 of file HoughPlaneBase.h.

281 {
282 _xMax = a;
283 _xSize = (_xMax - _xMin) / float(_nX);
284 return _xMax;
285 }

◆ xMax() [2/2]

float xMax ( void  ) const
inline

returns max. of x.

Definition at line 273 of file HoughPlaneBase.h.

274 {
275 return _xMax;
276 }

◆ xMin() [1/2]

float xMin ( float  newXMin)
inline

sets and returns min. of x.

Definition at line 264 of file HoughPlaneBase.h.

265 {
266 _xMin = a;
267 _xSize = (_xMax - _xMin) / float(_nX);
268 return _xMin;
269 }

◆ xMin() [2/2]

float xMin ( void  ) const
inline

returns min. of x.

Definition at line 257 of file HoughPlaneBase.h.

258 {
259 return _xMin;
260 }

◆ xSize()

float xSize ( void  ) const
inline

returns size of x bin.

Definition at line 289 of file HoughPlaneBase.h.

290 {
291 return _xSize;
292 }

◆ xy()

bool xy ( double  r,
double &  x,
double &  y,
int  dir = 0 
) const
private

private const member functions

Definition at line 157 of file Lpar.cc.

158 {
159 double t_kr2g = kr2g(r);
160 double t_xi2 = xi2();
161 double ro = r * r * t_xi2 - t_kr2g * t_kr2g;
162 if (ro < 0) return false;
163 double rs = sqrt(ro);
164 if (dir == 0) {
165 x = (- m_alpha * t_kr2g - m_beta * rs) / t_xi2;
166 y = (- m_beta * t_kr2g + m_alpha * rs) / t_xi2;
167 } else {
168 x = (- m_alpha * t_kr2g + m_beta * rs) / t_xi2;
169 y = (- m_beta * t_kr2g - m_alpha * rs) / t_xi2;
170 }
171 return true;
172 }
double kr2g(double r) const
private const member functions
Definition: Lpar.h:151

◆ xyPosition() [1/4]

double * xyPosition ( double  p[3]) const
inline

middle position of a wire. z componet is 0.

Definition at line 348 of file Cell.h.

349 {
350 a[0] = _xyPosition.x();
351 a[1] = _xyPosition.y();
352 a[2] = 0.;
353 return a;
354 }

◆ xyPosition() [2/4]

const HepGeom::Point3D< double > & xyPosition ( void  ) const
inline

returns middle position of a wire. z componet is 0.

Definition at line 341 of file Cell.h.

342 {
343 return _xyPosition;
344 }

◆ xyPosition() [3/4]

const HepGeom::Point3D< double > & xyPosition ( void  ) const
inline

returns position in the middle of wire. z is always zero, however.

Definition at line 296 of file CellHit.h.

297 {
298 return _xyPosition;
299 }

◆ xyPosition() [4/4]

const HepGeom::Point3D< double > & xyPosition ( void  ) const
inline

returns middle position of a wire. z componet is 0.

Definition at line 616 of file Link.h.

617 {
618 return _hit->cell().xyPosition();
619 }
const HepGeom::Point3D< double > & xyPosition(void) const
returns middle position of a wire. z componet is 0.
Definition: Cell.h:341

◆ y() [1/4]

double y ( double  r) const
private

private const member functions

Definition at line 181 of file Lpar.cc.

182 {
183 double t_x, t_y;
184 xy(r, t_x, t_y);
185 return t_y;
186 }

◆ y() [2/4]

double y ( double  a)
inline

y of the point

Definition at line 113 of file Point2D.h.

114 {
115 return _p[1] = a;
116 }

◆ y() [3/4]

float y ( float  xReal,
float  yReal,
float  x 
) const
overridevirtual

returns Y coordinate in a Hough parameter plane.

Implements TRGCDCHoughTransformation.

Definition at line 36 of file HoughTransformationCircle.cc.

37 {
38// return log10((xReal * xReal + yReal * yReal) /
39// (2 * xReal * cos(x) + 2 * yReal * sin(x)));
40 const float r = (xReal * xReal + yReal * yReal) /
41 (2 * xReal * cos(x) + 2 * yReal * sin(x));
42 if (r > 0)
43 return log10(r);
44 else
45 return 0;
46 }

◆ y() [4/4]

double y ( void  ) const
inline

y of the point

Definition at line 99 of file Point2D.h.

100 {
101 return _p[1];
102 }

◆ yMax() [1/2]

float yMax ( float  newYMax)
inline

sets and returns max. of y.

Definition at line 326 of file HoughPlaneBase.h.

327 {
328 _yMax = a;
329 _ySize = (_yMax - _yMin) / float(_nY);
330 return _yMax;
331 }

◆ yMax() [2/2]

float yMax ( void  ) const
inline

returns max. of y.

Definition at line 319 of file HoughPlaneBase.h.

320 {
321 return _yMax;
322 }

◆ yMin() [1/2]

float yMin ( float  newYMin)
inline

sets and returns min. of y.

Definition at line 310 of file HoughPlaneBase.h.

311 {
312 _yMin = a;
313 _ySize = (_yMax - _yMin) / float(_nY);
314 return _yMin;
315 }

◆ yMin() [2/2]

float yMin ( void  ) const
inline

returns min. of y.

Definition at line 303 of file HoughPlaneBase.h.

304 {
305 return _yMin;
306 }

◆ ySize()

float ySize ( void  ) const
inline

returns size of y bin.

Definition at line 335 of file HoughPlaneBase.h.

336 {
337 return _ySize;
338 }

◆ ~TRGArea2D()

~TRGArea2D ( )
virtual

Destructor.

Definition at line 24 of file Area2D.cc.

25 {
26 }

◆ ~TRGBitStream()

~TRGBitStream ( )
virtual

Destructor.

Definition at line 69 of file BitStream.cc.

70 {
71 for (unsigned i = 0; i < _stream.size(); i++)
72 delete _stream[i];
73 }

◆ ~TRGBoard()

~TRGBoard ( )
virtual

Destructor.

Definition at line 37 of file Board.cc.

38 {
39 }

◆ ~TRGCDC()

~TRGCDC ( )
privatevirtual

Destructor.

Definition at line 2003 of file TRGCDC.cc.

2004 {
2005 TRGDebug::enterStage("TRGCDC destructor");
2006 clear();
2007
2008 delete [] _width;
2009 delete [] _r;
2010 delete [] _r2;
2011
2012 if (_tsFinder) delete _tsFinder;
2013 if (_hFinder)
2014 delete _hFinder;
2015 if (_h3DFinder)
2016 delete _h3DFinder;
2017 if (_fitter3D)
2018 delete _fitter3D;
2019
2020#ifdef TRGCDC_DISPLAY
2021 if (D)
2022 delete D;
2023 cout << "TRGCDC ... rphi displays deleted" << endl;
2024#endif
2025
2026 TRGDebug::leaveStage("TRGCDC destructor");
2027 }

◆ ~TRGCDCCell()

~TRGCDCCell ( )
virtual

Destructor.

Definition at line 47 of file Cell.cc.

48 {
49 }

◆ ~TRGCDCCellHit()

~TRGCDCCellHit ( )
virtual

Destructor.

Definition at line 63 of file CellHit.cc.

64 {
65 }

◆ ~TRGCDCCircle()

~TRGCDCCircle ( )
virtual

Destructor.

Definition at line 56 of file Circle.cc.

57 {
58 }

◆ ~TRGCDCCircleFitter()

~TRGCDCCircleFitter ( )
virtual

Destructor.

Definition at line 35 of file CircleFitter.cc.

36 {
37 }

◆ ~TRGCDCEventTime()

~TRGCDCEventTime ( )
virtual

destructor of TRGCDCEventTime class

Definition at line 80 of file EventTime.cc.

81 {
82 delete m_evtOutputTs;
83 delete m_evtOut;
84 if (m_makeRootFile) delete m_fileEvtTime;
85 delete h;
86 }

◆ ~TRGCDCEventTimeFinder()

Destructor.

Definition at line 53 of file EventTimeFinder.cc.

54 {
55 }

◆ ~TRGCDCFitter()

~TRGCDCFitter ( )
virtual

Destructor.

Definition at line 28 of file Fitter.cc.

29 {
30 }

◆ ~TRGCDCFitter3D()

~TRGCDCFitter3D ( )
virtual

Destructor.

Definition at line 74 of file Fitter3D.cc.

75 {
76 }

◆ ~TRGCDCFrontEnd()

~TRGCDCFrontEnd ( )
virtual

Destructor.

Definition at line 48 of file FrontEnd.cc.

49 {
50 }

◆ ~TRGCDCHelix()

~TRGCDCHelix ( )
virtual

Destructor.

Definition at line 130 of file Helix.cc.

131 {
132 }

◆ ~TRGCDCHough3DFinder()

Destructor.

Definition at line 206 of file Hough3DFinder.cc.

207 {
208 }

◆ ~TRGCDCHoughFinder()

~TRGCDCHoughFinder ( )
virtual

Destructor.

Definition at line 184 of file HoughFinder.cc.

185 {
186#ifdef TRGCDC_DISPLAY_HOUGH
187 if (H0)
188 delete H0;
189 if (H1)
190 delete H1;
191 cout << "TRGCDCHoughFinder ... Hough displays deleted" << endl;
192#endif
193 }

◆ ~TRGCDCHoughPlane()

~TRGCDCHoughPlane ( )
virtual

Destructor.

Definition at line 40 of file HoughPlane.cc.

41 {
42 delete [] _cell;
43 if (_patterns)
44 delete [] _patterns;
45 }

◆ ~TRGCDCHoughPlaneBase()

~TRGCDCHoughPlaneBase ( )
virtual

Destructor.

Definition at line 46 of file HoughPlaneBase.cc.

47 {
48 // HepAListDeleteAll(_regions);
50 }

◆ ~TRGCDCHoughPlaneBoolean()

Destructor.

Definition at line 46 of file HoughPlaneBoolean.cc.

47 {
48 for (unsigned i = 0; i < _nPatterns; i++)
49 delete [] _patterns[i];
50 delete [] _patterns;
51 delete [] _nActive;
52 delete [] _cell;
53 delete [] _reverse;
54 }

◆ ~TRGCDCHoughPlaneMulti()

~TRGCDCHoughPlaneMulti ( )
virtual

Destructor.

Definition at line 54 of file HoughPlaneMulti.cc.

55 {
56 for (unsigned i = 0; i < _nLayers; i++)
57 delete _layers[i];
58 }

◆ ~TRGCDCHoughPlaneMulti2()

~TRGCDCHoughPlaneMulti2 ( )
virtual

Destructor.

Definition at line 58 of file HoughPlaneMulti2.cc.

59 {
60 for (unsigned i = 0; i < _nLayers; i++)
61 delete _layers[i];
62 }

◆ ~TRGCDCHoughTransformation()

Destructor.

Definition at line 29 of file HoughTransformation.cc.

30 {
31 }

◆ ~TRGCDCHoughTransformationCircle()

Destructor.

Definition at line 31 of file HoughTransformationCircle.cc.

32 {
33 }

◆ ~TRGCDCJLUT()

~TRGCDCJLUT ( )
virtual

Destructor.

Definition at line 82 of file JLUT.cc.

83 {
84 }

◆ ~TRGCDCLayer()

~TRGCDCLayer ( )
virtual

Destructor.

Definition at line 98 of file Layer.cc.

99 {
100 }

◆ ~TRGCDCLink()

~TRGCDCLink ( )
virtual

Destructor.

Definition at line 100 of file Link.cc.

101 {
102 }

◆ ~TRGCDCLpar()

~TRGCDCLpar ( )
virtual

Destructor.

Definition at line 52 of file Lpar.cc.

53 {
54 }

◆ ~TRGCDCLpav()

~TRGCDCLpav ( )
virtual

Destructor.

Definition at line 81 of file Lpav.cc.

82 {
83 }

◆ ~TRGCDCLUT()

~TRGCDCLUT ( )
virtual

Destructor.

Definition at line 43 of file LUT.cc.

44 {
45 }

◆ ~TRGCDCMerger()

~TRGCDCMerger ( )
virtual

Destructor.

Definition at line 48 of file Merger.cc.

49 {
50 }

◆ ~TRGCDCPeakFinder()

~TRGCDCPeakFinder ( )
virtual

Destructor.

Definition at line 48 of file PeakFinder.cc.

49 {
50 }

◆ ~TRGCDCPerfectFinder()

~TRGCDCPerfectFinder ( )
virtual

Destructor.

Definition at line 60 of file PerfectFinder.cc.

61 {
62 }

◆ ~TRGCDCRelation()

~TRGCDCRelation ( )
virtual

Destructor.

Definition at line 35 of file Relation.cc.

36 {
37 delete [] _pairs;
38 }

◆ ~TRGCDCSegment()

~TRGCDCSegment ( )
virtual

Destructor.

Definition at line 60 of file Segment.cc.

61 {
62 }

◆ ~TRGCDCSegmentHit()

~TRGCDCSegmentHit ( )
virtual

Destructor.

Definition at line 54 of file SegmentHit.cc.

55 {
56 }

◆ ~TRGCDCSteppingAction()

~TRGCDCSteppingAction ( )
virtual

Destructor.

Definition at line 28 of file SteppingAction.cc.

29 {
30 }

◆ ~TRGCDCTrack()

~TRGCDCTrack ( )
virtual

Destructor.

Definition at line 76 of file TRGCDCTrack.cc.

77 {
78 if (_list.size()) {
79 for (unsigned i = 0; i < _list.size(); i++)
80 if (_list[i] == this)
81 _list.erase(_list.begin(), _list.begin() + i);
82 }
83 }

◆ ~TRGCDCTrackBase()

~TRGCDCTrackBase ( )
virtual

Destructor.

Definition at line 60 of file TrackBase.cc.

61 {
62 }

◆ ~TRGCDCTracker2D()

~TRGCDCTracker2D ( )
virtual

Destructor.

Definition at line 47 of file Tracker2D.cc.

48 {
49 }

◆ ~TRGCDCTrackMC()

~TRGCDCTrackMC ( )
virtual

Destructor.

Definition at line 71 of file TrackMC.cc.

72 {
73 if (_list.size()) {
74 for (unsigned i = 0; i < _list.size(); i++)
75 delete _list[i];
76 _list.clear();
77 }
78 }

◆ ~TRGCDCTrackSegmentFinder()

Destructor.

Definition at line 108 of file TrackSegmentFinder.cc.

109 {
110
112 delete m_tsInformation;
115 delete m_treeInputTSF;
116 if (m_makeRootFile) delete m_fileTSF;
117
118 }

◆ ~TRGCDCWire()

~TRGCDCWire ( )
virtual

Destructor.

Definition at line 49 of file Wire.cc.

50 {
51 }

◆ ~TRGCDCWireHit()

~TRGCDCWireHit ( )
virtual

Destructor.

Definition at line 55 of file WireHit.cc.

56 {
57 }

◆ ~TRGCDCWireHitMC()

~TRGCDCWireHitMC ( )
virtual

Destructor.

Definition at line 32 of file WireHitMC.cc.

33 {
34 }

◆ ~TRGChannel()

~TRGChannel ( )
virtual

Destructor.

Definition at line 31 of file Channel.cc.

32 {
33 }

◆ ~TRGClock()

~TRGClock ( )
virtual

Destructor.

Definition at line 81 of file Clock.cc.

82 {
83 if (_clockCounter)
84 delete _clockCounter;
85 }

◆ ~TRGGDL()

~TRGGDL ( )
privatevirtual

Destructor.

Definition at line 221 of file TRGGDL.cc.

222 {
223 clear();
224 }

◆ ~TRGGRL()

~TRGGRL ( )
privatevirtual

Destructor.

Definition at line 153 of file TRGGRL.cc.

154 {
155 h1->Write();
156 m_file->Write();
157 m_file->Close();
158 clear();
159 }

◆ ~TRGGRLMatch()

~TRGGRLMatch ( )
virtual

Destructor.

Definition at line 33 of file TRGGRLMatch.cc.

34 {
35 }

◆ ~TRGOpticalLink()

~TRGOpticalLink ( )
virtual

Destructor.

Definition at line 28 of file OpticalLink.cc.

29 {
30 }

◆ ~TRGPoint2D()

~TRGPoint2D ( )
virtual

Destructor.

Definition at line 47 of file Point2D.cc.

48 {
49 }

◆ ~TRGSignal()

~TRGSignal ( )
virtual

Destructor.

Definition at line 131 of file Signal.cc.

132 {
133#if TRG_DEBUG
135#endif
136 }

◆ ~TRGSignalBundle()

~TRGSignalBundle ( )
virtual

Destructor.

Definition at line 188 of file SignalBundle.cc.

189 {
190 }

◆ ~TRGSignalVector()

~TRGSignalVector ( )
virtual

Destructor.

Definition at line 59 of file SignalVector.cc.

60 {
61 }

◆ ~TRGState()

~TRGState ( )
virtual

Destructor.

Definition at line 192 of file State.cc.

193 {
194 if (_state)
195 free(_state);
196 }

◆ ~TRGTime()

~TRGTime ( )
virtual

Destructor.

Definition at line 52 of file Time.cc.

53 {
54 }

Variable Documentation

◆ _all [1/3]

vector< TCLink * > _all
staticprivate

Keeps all TRGCDCLinks created by new().

Definition at line 348 of file Link.h.

◆ _all [2/3]

vector< TRGCDCSegmentHit * > _all
staticprivate

Keeps all TRGCDCSegmentHit created by new().

Definition at line 73 of file SegmentHit.h.

◆ _all [3/3]

vector< TRGCDCWireHit * > _all
staticprivate

Keeps all TRGCDCWireHit created by new().

Definition at line 83 of file WireHit.h.

◆ _bsu

const unsigned _bsu = 8 * sizeof(unsigned)
staticprivate

bit size of unsigned.

Definition at line 133 of file State.h.

◆ _cdc

TRGCDC * _cdc = 0
staticprivate

CDC trigger singleton.

Definition at line 490 of file TRGCDC.h.

◆ _fitter

const TRGCDCCircleFitter _fitter = TRGCDCCircleFitter("TRGCDCCircle Default Fitter")
staticprivate

Default fitter.

Definition at line 90 of file Circle.h.

◆ _ftd

void(* _ftd)(bool *b, const bool *i)=0
static

Function to simulate final trigger decision.

Definition at line 145 of file TRGGDL.h.

◆ _gdl

TRGGDL * _gdl = 0
staticprivate

GDL singleton.

do the final trigger decision

Definition at line 209 of file TRGGDL.h.

◆ _grl

TRGGRL * _grl = 0
staticprivate

GRL singleton.

Definition at line 141 of file TRGGRL.h.

◆ _level

int _level = 0
staticprivate

Debug level. 0:do nothing, 1:show you flow, 2:show you detail, 10:show you very detail.

Definition at line 50 of file Debug.h.

◆ _list [1/2]

std::vector< const TRGCDCTrackMC * > _list = std::vector<const TRGCDCTrackMC*>()
staticprivate

vector of pointers to TRGCDCTrackMC

Definition at line 105 of file TrackMC.h.

◆ _list [2/2]

vector< const TRGCDCTrack * > _list = vector<const TRGCDCTrack*>()
staticprivate

a vector to keep all TRGCDCTrack objects.

Definition at line 105 of file TRGCDCTrack.h.

◆ _n

vector< unsigned > _n
staticprivate

# of TSFs in super layer i.

Definition at line 105 of file Tracker2D.h.

◆ _nHitsSL

unsigned * _nHitsSL = 0
staticprivate

...Buffers...

Definition at line 404 of file Link.h.

◆ _nL

unsigned _nL = 56
staticprivate

...Buffers...

Definition at line 398 of file Link.h.

◆ _nSL

unsigned _nSL = 9
staticprivate

...Buffers...

Definition at line 400 of file Link.h.

◆ _nSLA

unsigned _nSLA = 5
staticprivate

...Buffers...

Definition at line 402 of file Link.h.

◆ _nTSF

unsigned _nTSF = 0
staticprivate

# of TSFs.

Definition at line 102 of file Tracker2D.h.

◆ _stages

vector< string > _stages
staticprivate

Storage for stages.

Definition at line 47 of file Debug.h.

◆ _su

const unsigned _su = sizeof(unsigned)
staticprivate

size of unsigned.

Definition at line 130 of file State.h.

◆ _ts

TRGState _ts
staticprivate

Keeps TS hit info.

Definition at line 108 of file Tracker2D.h.

◆ _undefined

TRGCDCTrackMC * _undefined = new TRGCDCTrackMC()
static

returns a pointer to gen_hepevt.

Dummy particle.

Definition at line 88 of file TrackMC.h.

◆ BELLE_ALPHA

const double BELLE_ALPHA
staticprivate

belle alpha

Definition at line 183 of file Lpar.h.

◆ ConstantAlpha

const double ConstantAlpha = 222.376063
static

Constant alpha for uniform field.

Definition at line 202 of file Helix.h.

◆ dictionary

map< string, TRGCDCLUT > dictionary
static

list of LUTs, to avoid reading LUT data 2336 times

Definition at line 64 of file LUT.h.

◆ invalidhelix

const std::string invalidhelix
staticprivate

string of invalid helix

Definition at line 235 of file Helix.h.

◆ M_PI2

const double M_PI2 = 2. * M_PI

2*PI

Definition at line 31 of file Helix.cc.

◆ M_PI4

const double M_PI4 = 4. * M_PI

4*PI

Definition at line 35 of file Helix.cc.

◆ M_PI8

const double M_PI8 = 8. * M_PI

8*PI

Definition at line 39 of file Helix.cc.

◆ ms_amax

CLHEP::HepVector ms_amax
staticprivate

limits for helix parameters

Definition at line 165 of file Helix.h.

◆ ms_amin

CLHEP::HepVector ms_amin
staticprivate

limits for helix parameters

Definition at line 163 of file Helix.h.

◆ ms_check_range

bool ms_check_range
staticprivate

range in checked or not

Definition at line 167 of file Helix.h.

◆ ms_print_debug

bool ms_print_debug
staticprivate

print debug info or not

Definition at line 169 of file Helix.h.

◆ ms_smallcell

bool ms_smallcell
staticprivate

ms_smallcell

Definition at line 393 of file Link.h.

◆ ms_superb

bool ms_superb
staticprivate

ms_superb

Definition at line 395 of file Link.h.

◆ ms_throw_exception

bool ms_throw_exception
staticprivate

throw exception or not

Definition at line 171 of file Helix.h.

◆ ntrgline

const int ntrgline = 18

set the total number of trigger lines and prescalefactor

Definition at line 44 of file L1TriggerMenuv0.cc.

◆ scalef_phase2

double scalef_phase2[ntrgline] = {1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 1, 1, 1, 1, 1}

prescale factor for phase2

Definition at line 46 of file L1TriggerMenuv0.cc.

◆ scalef_phase3

double scalef_phase3[ntrgline] = {1, 1, 20, 2, 1, 1, 1, 1, 2, 1, 1, 20, 20, 1, 5, 1, 3, 5}

prescale factor for phase3

Definition at line 48 of file L1TriggerMenuv0.cc.

◆ TRGCDCUndefinedLayer

const TRGCDCLayer* TRGCDCUndefinedLayer
Initial value:
= new TRGCDCLayer(9999,
9999,
9999,
9999,
9999,
0,
0,
9999,
9999,
0,
0)

TRGCDCUndefinedLayer declaration.

Definition at line 29 of file Layer.cc.