Belle II Software development
CDCGeometryPar Class Reference

The Class for CDC Geometry Parameters. More...

#include <CDCGeometryPar.h>

Public Types

enum  EWirePosition {
  c_Base = 0 ,
  c_Misaligned ,
  c_Aligned
}
 Wire position set. More...
 

Public Member Functions

virtual ~CDCGeometryPar ()
 Destructor.
 
void clear ()
 Clears.
 
void readFromDB (const CDCGeometry &)
 Gets geometry parameters from database.
 
void readWirePositionParams (EWirePosition set, const CDCGeometry *geom)
 Read displacement or (mis)alignment params from text file.
 
void setWirPosAlignParams ()
 Set wire alignment params.
 
void setWirPosMisalignParams ()
 Set wire misalignment params.
 
void readXT (const GearDir &gbxParams, int mode=0)
 Read XT-relation table.
 
void newReadXT (const GearDir &gbxParams, int mode=0)
 Read XT-relation table in new format.
 
void setXT ()
 Set XT-relation table (from DB).
 
void setXtRel ()
 Set XT-relation table (from DB) (new).
 
void readSigma (const GearDir &gbxParams, int mode=0)
 Read spatial resolution table.
 
void newReadSigma (const GearDir &gbxParams, int mode=0)
 Read spatial resolution table in new format.
 
void setSResol ()
 Set spatial resolution (from DB).
 
void setFFactor ()
 Set fudge factors (from DB).
 
void readPropSpeed (const GearDir &gbxParams, int mode=0)
 Read the propagation speed along the sense wire.
 
void setPropSpeed ()
 Set prop.
 
void readT0 (const GearDir &gbxParams, int mode=0)
 Read t0 parameters (from a file).
 
void setT0 ()
 Set t0 parameters (from DB)
 
void calcMeanT0 (double minT0=3800, double maxT0=5800, int maxIt=10, double nStdv=3, double epsi=0.1)
 Calculate mean t0 in ns (over all good wires)
 
void setBadWire ()
 Set bad-wires (from DB)
 
void setBadBoard ()
 Set bad-boards (from DB)
 
void readChMap ()
 Read channel map between wire-id and electronics-id.
 
void setChMap ()
 Set channel map (from DB)
 
void readTW (const GearDir &gbxParams, int mode=0)
 Read time-walk parameter.
 
void readEDepToADC (const GearDir &gbxParams, int mode=0)
 Read spatial edep-to-adc conv.
 
void setTW ()
 Set time-walk parameters.
 
void setEDepToADCConversions ()
 Set edep-to-ADC conversion params.
 
double getEDepToADCConvFactor (unsigned short layer, unsigned short cell, double edep, double dx, double costh)
 Return edep-to-ADC conversion factor.
 
double getEDepToADCMainFactor (unsigned short layer, unsigned short cell, double costh=0)
 Return edep-to-ADC conversion main factor (in count/keV)
 
double getEDepToADCSigma (unsigned short layer, unsigned short cell)
 Return sigma for extra smearing of edep to ADC conversion.
 
void generateXML (const std::string &of)
 Generate an xml file used in gearbox.
 
const std::string & version () const
 Returns the version of cdc geometry parameters.
 
double motherInnerR () const
 The method to get cdc mother volume inner R.
 
double motherOuterR () const
 The method to get cdc mother volume outer R.
 
double motherLength () const
 The method to get cdc mother volume length.
 
int momBound () const
 to get the number of boundary position of the CDC mother volume
 
double momZ (int iBound) const
 Returns boundary position in Z axis of the CDC mother volume.
 
double momRmin (int iBound) const
 Returns inner radius of the CDC mother volume.
 
unsigned cellId (unsigned layerId, const B2Vector3D &position) const
 The method to get cell id based on given layer id and the position.
 
double innerRadiusOuterWall () const
 Returns the inner radius of the outer wall.
 
double outerRadiusOuterWall () const
 Returns the outer radius of the outer wall.
 
double zOuterWall () const
 Returns the length of the outer wall in Z.
 
double zOffsetOuterWall () const
 Returns the offset of the outer wall in z direction.
 
double innerRadiusInnerWall () const
 Returns the inner radius of the inner wall.
 
double outerRadiusInnerWall () const
 Returns the outer radius of the inner wall.
 
double zInnerWall () const
 Returns the length of the inner wall in Z.
 
double zOffsetInnerWall () const
 Returns the offset of the outer wall in z direction.
 
double senseWireDiameter () const
 Returns diameter of the sense wire.
 
double fieldWireDiameter () const
 Returns diameter of the field wire.
 
unsigned nWiresInLayer (int layerId) const
 Returns wire numbers in a layer.
 
const double * innerRadiusWireLayer () const
 Returns an array of inner radius of wire layers.
 
const double * outerRadiusWireLayer () const
 Returns an array of outer radius of wire layers.
 
const double * zForwardWireLayer () const
 Returns an array of forward z of wire layers.
 
const double * zBackwardWireLayer () const
 Returns an array of backward z of wire layers.
 
double zOffsetWireLayer (unsigned i) const
 Returns the offset of z of the wire layer i.
 
double getMeanT0 () const
 Returns the mean t0 over all wires.
 
const B2Vector3D wireForwardPosition (uint layerId, int cellId, EWirePosition set=c_Base) const
 Returns the forward position of the input sense wire.
 
const B2Vector3D wireForwardPosition (const WireID &wireID, EWirePosition set=c_Base) const
 The same function but in a different input format.
 
const B2Vector3D wireForwardPosition (uint layerId, int cellId, double z, EWirePosition set=c_Base) const
 Returns a virtual forward position corresp. to a tangent to the wire at the input z-position.
 
const B2Vector3D wireForwardPosition (const WireID &wireID, double z, EWirePosition set=c_Base) const
 The same function but in a different input format.
 
const B2Vector3D wireBackwardPosition (uint layerId, int cellId, EWirePosition set=c_Base) const
 Returns the backward position of the input sense wire.
 
const B2Vector3D wireBackwardPosition (const WireID &wireID, EWirePosition set=c_Base) const
 The same function but in a different input format.
 
const B2Vector3D wireBackwardPosition (uint layerId, int cellId, double z, EWirePosition set=c_Base) const
 Returns a virtual backward position corresp. to a tangent to the wire at the input z-position.
 
const B2Vector3D wireBackwardPosition (const WireID &wireID, double z, EWirePosition set=c_Base) const
 The same function but in a different input format.
 
double getWireSagCoef (EWirePosition set, uint layerId, int cellId) const
 Returns coefficient for the sense wire sag.
 
double getThresholdEnerguDeposit () const
 Returns threshold for energy deposit in one G4 step.
 
double getMinTrackLength () const
 Returns the minimum track length required in one G4 step (only secondary particles which pass this criterion are to be saved in MCParticle)
 
bool isWireSagOn () const
 Returns on/off for sense wire sag in FullSim.
 
bool isModifiedLeftRightFlagOn () const
 Returns on/off for modified left/right calculation in FullSim.
 
float getT0 (const WireID &wireID) const
 Returns t0 parameter of the specified sense wire.
 
unsigned short getBoardID (const WireID &wID) const
 Returns frontend board id. corresponding to the wire id.
 
unsigned short getChannelID (const WireID &wID) const
 Returns frontend channel id. corresponding to the wire id.
 
const WireID getWireID (unsigned short bd, unsigned short ch) const
 Returns wire id. corresponding to the board-and-cannel ids.
 
double getTimeWalk (const WireID &wID, unsigned short adcCount) const
 Returns time-walk.
 
void setShiftInSuperLayer ()
 Calculates and saves shifts in super-layers (to be used in searching hits in neighboring cells)
 
signed short getShiftInSuperLayer (unsigned short iSuperLayer, unsigned short iLayer) const
 Returns shift in the super-layer.
 
double senseWireR (int layerId) const
 Returns radius of sense wire in each layer.
 
double senseWireFZ (int layerId) const
 Returns forward z position of sense wire in each layer.
 
double senseWireBZ (int layerId) const
 Returns backward z position of sense wire in each layer.
 
double fieldWireR (int layerId) const
 Returns radius of field wire in each layer.
 
double fieldWireFZ (int layerId) const
 Returns forward z position of field wire in each layer.
 
double fieldWireBZ (int layerId) const
 Returns backward z position of field wire in each layer.
 
int nShifts (int layerId) const
 Returns number shift.
 
double offset (int layerID) const
 Return wire offset in phi direction at endplate.
 
void setSenseWireR (int layerId, double r)
 Set radius of sense wire in each layer.
 
void setSenseWireFZ (int layerId, double fz)
 Set forward z position of sense wires.
 
void setSenseWireBZ (int layerId, double bz)
 set backward z position of sense wires.
 
unsigned short getTdcOffset () const
 Return TDC offset value (default = 0 ch).
 
double getTdcBinWidth () const
 Return TDC bin width (nsec).
 
double getNominalDriftV () const
 Return the nominal drift velocity of He-ethane gas (default: 4.0x10^-3 cm/nsec).
 
double getNominalPropSpeed () const
 Return the nominal propagation speed of the sense wire (default: 27.25 cm/nsec).
 
double getNominalSpaceResol () const
 Return the nominal spatial resolution.
 
int getMaterialDefinitionMode () const
 Return mode for material definition.
 
int getSenseWireZposMode () const
 Return mode for sense wire z position.
 
double getBwdDeltaZ (unsigned short layerID) const
 Return backward 'deltaZ'.
 
double getFwdDeltaZ (unsigned short layerID) const
 Return forward 'deltaZ'.
 
void setNominalSpaceResol (double resol)
 Set the nominal spatial resolution in the unit of um.
 
double getPropSpeedInv (const unsigned int layerID) const
 Get the inversel of propagation speed in the sense wire.
 
bool isBadWire (const WireID &wid)
 Inquire if the wire is totally-dead.
 
bool isDeadWire (const WireID &wid, double &eff)
 Inquire if the wire is dead.
 
bool isHotWire (const WireID &wid)
 Inquire if the wire is hot.
 
void getWireSagEffect (EWirePosition set, unsigned layerID, unsigned cellID, double zw, double &ywb_sag, double &ywf_sag) const
 Compute effects of the sense wire sag.
 
double getDriftV (double dt, unsigned short layer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI) const
 Get the realistic drift velocity.
 
double getDriftLength (double dt, unsigned short layer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI, bool calculateMinTime=true, double minTime=0.) const
 Return the drift dength to the sense wire.
 
double getDriftLength0 (double dt, unsigned short layer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI) const
 Return the drift dength to the sense wire; tentative ver.
 
double getMinDriftTime (unsigned short layer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI) const
 Return the min.
 
double getDriftTime (double dist, unsigned short layer, unsigned short lr, double alpha, double theta) const
 Return the drift time to the sense wire.
 
double getSigma (double dist, unsigned short layer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI) const
 Return the basic resolution of drift length (cm).
 
double getFudgeFactorForSigma (unsigned short target) const
 Return the fuge factor for space resol.
 
unsigned short getOldLeftRight (const B2Vector3D &posOnWire, const B2Vector3D &posOnTrack, const B2Vector3D &momentum) const
 Returns old left/right.
 
unsigned short getNewLeftRightRaw (const B2Vector3D &posOnWire, const B2Vector3D &posOnTrack, const B2Vector3D &momentum) const
 Returns new left/right_raw.
 
double getAlpha (const B2Vector3D &posOnWire, const B2Vector3D &momentum) const
 Returns track incident angle in rphi plane (alpha in rad.).
 
double getTheta (const B2Vector3D &momentum) const
 Returns track incident angle (theta in rad.).
 
void getClosestAlphaPoints (const double alpha, double &wal, unsigned short points[2], unsigned short lrs[2]) const
 Returns the two closest alpha points for the input track incident angle (alpha).
 
void getClosestAlphaPoints4Sgm (const double alpha, double &wal, unsigned short points[2], unsigned short lrs[2]) const
 Returns the two closest alpha points for sigma for the input track incident angle (alpha).
 
void getClosestThetaPoints (const double alpha, const double theta, double &wth, unsigned short points[2]) const
 Returns the two closest theta points for the input track incident angle (theta).
 
void getClosestThetaPoints4Sgm (const double alpha, const double theta, double &wth, unsigned short points[2]) const
 Returns the two closest theta points for sigma for the input track incident angle (theta).
 
double getMinDriftTimeWithXtPoints (unsigned short layer, unsigned short lr, double alpha, double theta, double wal, const unsigned short ial[2], const unsigned short ilr[2], double wth, const unsigned short ith[2]) const
 Return the min.
 
void setDesignWirParam (unsigned layerID, unsigned cellID)
 Set the desizend wire parameters.
 
void outputDesignWirParam (unsigned layerID, unsigned cellID) const
 Write the designed wire parameters to the alignment.dat (default).
 
void setDisplacement ()
 Set displacement of sense wire.
 
ushort getNumberOfSenseWires () const
 Get the number of sense wires.
 
ushort getNumberOfFieldWires () const
 Get the number of field wires.
 
ushort getNumberOfSenseLayers () const
 Get the number of sense layers.
 
ushort getNumberOfFieldLayers () const
 Get the number of field layers.
 
ushort getMaxNumberOfSuperLayers () const
 Get the maximum number of super layers.
 
ushort getOffsetOfFirstLayer () const
 Get the offset of the first layer.
 
ushort getOffsetOfFirstSuperLayer () const
 Get the offset of the first super layer.
 
ushort getMaxNumberOfCellsPerLayer () const
 Get the maximum number of cells in one layer.
 

Static Public Member Functions

static CDCGeometryParInstance (const CDCGeometry *=nullptr)
 Static method to get a reference to the CDCGeometryPar instance.
 
static void Print ()
 Print some debug information.
 
static void readFFactor (const GearDir &gbxParams, int mode=0)
 Read fudge factors.
 
static unsigned nWireLayers ()
 Returns a number of wire layers.
 
static unsigned short getOutgoingLR (const unsigned short lr, const double alpha)
 Converts incoming-lr to outgoing-lr.
 
static double getOutgoingAlpha (const double alpha)
 Converts incoming- to outgoing-alpha.
 
static double getOutgoingTheta (const double alpha, const double theta)
 Converts incoming- to outgoing-theta.
 

Private Member Functions

 CDCGeometryPar (const CDCGeometry *=nullptr)
 Singleton class.
 
 CDCGeometryPar (const CDCGeometryPar &)
 Singleton class.
 
CDCGeometryParoperator= (const CDCGeometryPar &)
 Singleton class.
 

Private Attributes

bool m_debug
 Switch for debug printing.
 
bool m_linearInterpolationOfXT
 Switch for linear interpolation of xt.
 
bool m_linearInterpolationOfSgm
 Switch for linear interpolation of sigma.
 
bool m_XTetc
 Switch for reading x-t etc.
 
bool m_displacement
 Switch for displacement.
 
bool m_misalignment
 Switch for misalignment.
 
bool m_alignment
 Switch for alignment.
 
bool m_XTetc4Recon
 Switch for selecting xt etc.
 
bool m_wireSag
 Switch for sense wire sag.
 
bool m_modLeftRightFlag
 Switch for modified left/right flag.
 
std::string m_version
 The version of geometry parameters.
 
int m_materialDefinitionMode
 Control switch for gas and wire material definition.
 
int m_senseWireZposMode
 Mode for sense wire z position corr.
 
int m_xtFileFormat
 Format of xt input file.
 
int m_xtParamMode
 Mode for xt parameterization.
 
int m_sigmaFileFormat
 Format of sigma input file.
 
int m_sigmaParamMode
 Mode for sigma parameterization.
 
int m_twParamMode
 Mode for tw parameterization.
 
int m_nSLayer
 The number of sense wire layer.
 
int m_nFLayer
 The number of field wire layer.
 
unsigned short m_nAlphaPoints
 No.
 
unsigned short m_nThetaPoints
 No.
 
unsigned short m_nAlphaPoints4Sgm
 No.
 
unsigned short m_nThetaPoints4Sgm
 No.
 
signed short m_shiftInSuperLayer [c_nSuperLayers][8]
 shift in phi-direction wrt the 1st layer in each super layer
 
double m_rWall [4]
 The array to store radius of inner wall and outer wall.
 
double m_zWall [4][2]
 The array to store z position of inner wall and outer wall.
 
double m_rSLayer [c_maxNSenseLayers]
 The array to store radius of sense wire layers.
 
double m_zSForwardLayer [c_maxNSenseLayers]
 The array to store forward z position of sense wire layers.
 
double m_dzSForwardLayer [c_maxNSenseLayers]
 Corrections for forward z position of sense wire layers.
 
double m_zSBackwardLayer [c_maxNSenseLayers]
 The array to store backward z position of sense wire layers.
 
double m_dzSBackwardLayer [c_maxNSenseLayers]
 Corrections for backward z position of sense wire layers.
 
double m_rFLayer [c_maxNFieldLayers]
 The array to store radius of field wire layers.
 
double m_zFForwardLayer [c_maxNFieldLayers]
 The array to store forward z position of field wire layers.
 
double m_zFBackwardLayer [c_maxNFieldLayers]
 The array to store backward z position of field wire layers.
 
double m_offSet [c_maxNSenseLayers]
 The array to store z offset of sense wire layers.
 
double m_cellSize [c_maxNSenseLayers]
 The array to store cell size in each sense wire layer.
 
int m_nShifts [c_maxNSenseLayers]
 The array to store shifted cell number in each sense wire layer.
 
unsigned m_nWires [c_maxNSenseLayers]
 The array to store the wire number in each sense wire layre.
 
double m_senseWireDiameter
 The diameter of sense wires.
 
double m_senseWireTension
 The tension of sense wires.
 
double m_senseWireDensity
 The density of sense wires.
 
double m_fieldWireDiameter
 The diameter of field wires.
 
double m_globalPhiRotation
 Global ratation in phi (rad.); only for sense wires now.
 
double m_momZ [7]
 Z-cordinates of the cdc mother volume (7 segments).
 
double m_momRmin [7]
 R_min of the cdc mother volume (7 segments).
 
double m_thresholdEnergyDeposit
 Energy thresh.
 
double m_minTrackLength
 Minimum track length for G4 step.
 
float m_FWirPos [c_maxNSenseLayers][c_maxNDriftCells][3]
 Wire position incl.
 
float m_BWirPos [c_maxNSenseLayers][c_maxNDriftCells][3]
 Wire position incl.
 
float m_WireSagCoef [c_maxNSenseLayers][c_maxNDriftCells]
 Wire sag coefficient for each cell; ibid.
 
float m_FWirPosMisalign [c_maxNSenseLayers][c_maxNDriftCells][3]
 Wire position incl.
 
float m_BWirPosMisalign [c_maxNSenseLayers][c_maxNDriftCells][3]
 Wire position incl.
 
float m_WireSagCoefMisalign [c_maxNSenseLayers][c_maxNDriftCells]
 Wire sag coefficient incl.
 
float m_FWirPosAlign [c_maxNSenseLayers][c_maxNDriftCells][3]
 Wire position incl.
 
float m_BWirPosAlign [c_maxNSenseLayers][c_maxNDriftCells][3]
 Wire position incl.
 
float m_WireSagCoefAlign [c_maxNSenseLayers][c_maxNDriftCells]
 Wire sag coefficient incl.
 
float m_eDepToADCParams [c_maxNSenseLayers][c_maxNDriftCells][7] = {}
 edep-to-ADC conv.
 
float m_alphaPoints [c_maxNAlphaPoints]
 alpha sampling points for xt (rad)
 
float m_thetaPoints [c_maxNThetaPoints]
 theta sampling points for xt (rad)
 
float m_alphaPoints4Sgm [c_maxNAlphaPoints]
 alpha sampling points for sigma (rad)
 
float m_thetaPoints4Sgm [c_maxNThetaPoints]
 theta sampling points for sigma (rad)
 
float m_XT [c_maxNSenseLayers][2][c_maxNAlphaPoints][c_maxNThetaPoints][c_nXTParams]
 XT-relation coefficients for each layer, Left/Right, entrance angle and polar angle.
 
float m_Sigma [c_maxNSenseLayers][2][c_maxNAlphaPoints][c_maxNThetaPoints][c_nSigmaParams]
 position resolution for each layer.
 
float m_propSpeedInv [c_maxNSenseLayers]
 Inverse of propagation speed of the sense wire.
 
float m_t0 [c_maxNSenseLayers][c_maxNDriftCells] = {}
 t0 for each sense-wire (in nsec).
 
float m_timeWalkCoef [c_nBoards][2]
 coefficients for time walk.
 
double m_meanT0
 mean t0 over all wires; should be double.
 
std::map< WireID, unsigned short > m_wireToBoard
 map relating wire-id and board-id.
 
std::map< WireID, unsigned short > m_wireToChannel
 map relating wire-id and channel-id.
 
unsigned short m_boardAndChannelToWire [c_nBoards][48]
 array relating board-channel-id and wire-id.
 
unsigned short m_tdcOffset
 Not used; to be removed later.
 
double m_clockFreq4TDC
 Clock frequency used for TDC (GHz).
 
double m_tdcBinWidth
 TDC bin width (nsec/bin).
 
double m_nominalDriftV
 Nominal drift velocity (4.0x10^-3 cm/nsec).
 
double m_nominalDriftVInv
 Inverse of the nominal drift velocity.
 
double m_nominalPropSpeed
 Nominal propagation speed of the sense wire (27.25 cm/nsec).
 
double m_nominalSpaceResol
 Nominal spatial resolution (0.0130 cm).
 
double m_maxSpaceResol
 max space resolution allowed (cm).
 
double m_fudgeFactorForSigma [3]
 Fuge factor for space resol.
 
DBObjPtr< CDCTimeZeros > * m_t0FromDB
 t0s retrieved from DB.
 
DBObjPtr< CDCBadWires > * m_badWireFromDB
 bad-wires retrieved from DB.
 
DBObjPtr< CDCBadBoards > * m_badBoardsFromDB
 bad-boards retrieved from DB.
 
DBObjPtr< CDCPropSpeeds > * m_propSpeedFromDB
 prop.
 
DBObjPtr< CDCTimeWalks > * m_timeWalkFromDB
 time-walk coeffs.
 
DBObjPtr< CDCXtRelations > * m_xtRelFromDB
 xt params.
 
DBObjPtr< CDCSpaceResols > * m_sResolFromDB
 sigma params.
 
DBObjPtr< CDCFudgeFactorsForSigma > * m_fFactorFromDB
 fudge factors retrieved from DB.
 
DBArray< CDCChannelMap > * m_chMapFromDB
 channel map retrieved from DB.
 
DBArray< CDCDisplacement > * m_displacementFromDB
 displacement params.
 
DBObjPtr< CDCAlignment > * m_alignmentFromDB
 alignment params.
 
DBObjPtr< CDCMisalignment > * m_misalignmentFromDB
 misalignment params.
 
DBObjPtr< CDCEDepToADCConversions > * m_eDepToADCConversionsFromDB
 Pointer to edep-to-ADC conv.
 
DBObjPtr< HardwareClockSettingsm_clockSettings
 hardware clock settings
 
ushort m_nSenseWires = c_nSenseWires
 Maximum number of Sense Wires.
 
ushort m_nFieldWires = c_nFieldWires
 Maximum number of Field Wires.
 
ushort m_maxNSenseLayers = c_maxNSenseLayers
 Maximum number of Sense Wire Layers.
 
ushort m_maxNFieldLayers = c_maxNFieldLayers
 Maximum number of Field Wire Layers.
 
ushort m_maxNSuperLayers = c_nSuperLayers
 Maximum number of Super Layers.
 
ushort m_firstLayerOffset = 0
 Offset of the first layer (for reduced CDC studies)
 
ushort m_firstSuperLayerOffset = 0
 Offset of the first super layer (for reduced CDC studies)
 
ushort m_maxNCellsPerLayer = c_maxNDriftCells
 Maximum number wires within a layer.
 

Static Private Attributes

static CDCGeometryParm_B4CDCGeometryParDB = 0
 Pointer that saves the instance of this class.
 

Detailed Description

The Class for CDC Geometry Parameters.

This class provides CDC geometry parameters for simulation, reconstruction and so on. These parameters are gotten from gearbox.

Definition at line 52 of file CDCGeometryPar.h.

Member Enumeration Documentation

◆ EWirePosition

Wire position set.

Definition at line 57 of file CDCGeometryPar.h.

57{c_Base = 0, c_Misaligned, c_Aligned};

Constructor & Destructor Documentation

◆ ~CDCGeometryPar()

~CDCGeometryPar ( )
virtual

Destructor.

Definition at line 144 of file CDCGeometryPar.cc.

145{
146}

◆ CDCGeometryPar()

CDCGeometryPar ( const CDCGeometry * geom = nullptr)
explicitprivate

Singleton class.

Definition at line 38 of file CDCGeometryPar.cc.

39{
40
41 CDCGeoControlPar& gcp = CDCGeoControlPar::getInstance();
42
43 if (gcp.getT0InputType()) {
44 m_t0FromDB = new DBObjPtr<CDCTimeZeros>;
45 if ((*m_t0FromDB).isValid()) {
46 (*m_t0FromDB).addCallback(this, &CDCGeometryPar::setT0);
47 }
48 }
49
50 if (gcp.getBwInputType()) {
51 m_badWireFromDB = new DBObjPtr<CDCBadWires>;
52 if ((*m_badWireFromDB).isValid()) {
53 (*m_badWireFromDB).addCallback(this, &CDCGeometryPar::setBadWire);
54 }
55 }
56 // Bad boards are on DB only:
57 m_badBoardsFromDB = new DBObjPtr<CDCBadBoards>;
58 if ((*m_badBoardsFromDB).isValid()) {
59 (*m_badBoardsFromDB).addCallback(this, &CDCGeometryPar::setBadBoard);
60 }
61
62 if (gcp.getPropSpeedInputType()) {
63 m_propSpeedFromDB = new DBObjPtr<CDCPropSpeeds>;
64 if ((*m_propSpeedFromDB).isValid()) {
65 (*m_propSpeedFromDB).addCallback(this, &CDCGeometryPar::setPropSpeed);
66 }
67 }
68
69 if (gcp.getTwInputType()) {
70 m_timeWalkFromDB = new DBObjPtr<CDCTimeWalks>;
71 if ((*m_timeWalkFromDB).isValid()) {
72 (*m_timeWalkFromDB).addCallback(this, &CDCGeometryPar::setTW);
73 }
74 }
75
76 if (gcp.getXtInputType()) {
77 m_xtRelFromDB = new DBObjPtr<CDCXtRelations>;
78 if ((*m_xtRelFromDB).isValid()) {
79 (*m_xtRelFromDB).addCallback(this, &CDCGeometryPar::setXtRel);
80 }
81 }
82
83 if (gcp.getSigmaInputType()) {
84 m_sResolFromDB = new DBObjPtr<CDCSpaceResols>;
85 if ((*m_sResolFromDB).isValid()) {
86 (*m_sResolFromDB).addCallback(this, &CDCGeometryPar::setSResol);
87 }
88 }
89
90 if (gcp.getFFactorInputType()) {
91 m_fFactorFromDB = new DBObjPtr<CDCFudgeFactorsForSigma>;
92 if ((*m_fFactorFromDB).isValid()) {
93 (*m_fFactorFromDB).addCallback(this, &CDCGeometryPar::setFFactor);
94 }
95 }
96
97 if (gcp.getChMapInputType()) {
98 m_chMapFromDB = new DBArray<CDCChannelMap>;
99 if ((*m_chMapFromDB).isValid()) {
100 (*m_chMapFromDB).addCallback(this, &CDCGeometryPar::setChMap);
101 }
102 }
103
104 if (gcp.getDisplacementInputType()) {
105 m_displacementFromDB = new DBArray<CDCDisplacement>;
106 if ((*m_displacementFromDB).isValid()) {
107 (*m_displacementFromDB).addCallback(this, &CDCGeometryPar::setDisplacement);
108 }
109 }
110
111 if (gcp.getAlignmentInputType()) {
112 m_alignmentFromDB = new DBObjPtr<CDCAlignment>;
113 if ((*m_alignmentFromDB).isValid()) {
114 (*m_alignmentFromDB).addCallback(this, &CDCGeometryPar::setWirPosAlignParams);
115 }
116 }
117
118 if (gcp.getMisalignment()) {
119 if (gcp.getMisalignmentInputType()) {
120 m_misalignmentFromDB = new DBObjPtr<CDCMisalignment>;
121 if ((*m_misalignmentFromDB).isValid()) {
122 (*m_misalignmentFromDB).addCallback(this, &CDCGeometryPar::setWirPosMisalignParams);
123 }
124 }
125 }
126
127 //TODO in future: make a new (singleton?) class and move all EDepToADC things there.
128 if (gcp.getEDepToADCInputType()) {
129 m_eDepToADCConversionsFromDB = new OptionalDBObjPtr<CDCEDepToADCConversions>;
130 if ((*m_eDepToADCConversionsFromDB).isValid()) {
131 (*m_eDepToADCConversionsFromDB).addCallback(this, &CDCGeometryPar::setEDepToADCConversions);
132 }
133 }
134
135 clear();
136 if (geom) {
137 // B2INFO("CDCGeometryPar: Read Geometry object");
138 readFromDB(*geom);
139 } else {
140 B2WARNING("CDCGeometryPar: Strange that readFromDB is not called! Please make sure that CDC is included in Geometry.");
141 }
142}
bool getSigmaInputType()
Get input type for sigma.
bool getMisalignmentInputType()
Get input type for wire misalignment.
bool getDisplacementInputType()
Get input type for wire displacement.
bool getAlignmentInputType()
Get input type for wire alignment.
bool getT0InputType()
Get input type for t0.
bool getEDepToADCInputType()
Get input type for edeptoadc.
bool getMisalignment() const
Get misalignment switch.
bool getTwInputType()
Get input type for time-walk.
bool getChMapInputType()
Get input type for channel map.
bool getFFactorInputType()
Get input type for fuge factor.
bool getXtInputType()
Get input type for xt.
bool getBwInputType()
Get input type for bad wire.
bool getPropSpeedInputType()
Get input type for prop.
static CDCGeoControlPar & getInstance()
Static method to get a reference to the CDCGeoControlPar instance.
void setWirPosAlignParams()
Set wire alignment params.
void setXtRel()
Set XT-relation table (from DB) (new).
DBObjPtr< CDCBadWires > * m_badWireFromDB
bad-wires retrieved from DB.
void setT0()
Set t0 parameters (from DB)
void setEDepToADCConversions()
Set edep-to-ADC conversion params.
DBArray< CDCDisplacement > * m_displacementFromDB
displacement params.
DBObjPtr< CDCMisalignment > * m_misalignmentFromDB
misalignment params.
DBObjPtr< CDCSpaceResols > * m_sResolFromDB
sigma params.
void setDisplacement()
Set displacement of sense wire.
DBObjPtr< CDCTimeWalks > * m_timeWalkFromDB
time-walk coeffs.
DBObjPtr< CDCBadBoards > * m_badBoardsFromDB
bad-boards retrieved from DB.
DBObjPtr< CDCTimeZeros > * m_t0FromDB
t0s retrieved from DB.
void setChMap()
Set channel map (from DB)
DBObjPtr< CDCFudgeFactorsForSigma > * m_fFactorFromDB
fudge factors retrieved from DB.
DBArray< CDCChannelMap > * m_chMapFromDB
channel map retrieved from DB.
void readFromDB(const CDCGeometry &)
Gets geometry parameters from database.
DBObjPtr< CDCXtRelations > * m_xtRelFromDB
xt params.
DBObjPtr< CDCPropSpeeds > * m_propSpeedFromDB
prop.
void setBadWire()
Set bad-wires (from DB)
void setBadBoard()
Set bad-boards (from DB)
void setWirPosMisalignParams()
Set wire misalignment params.
void setTW()
Set time-walk parameters.
void setSResol()
Set spatial resolution (from DB).
DBObjPtr< CDCAlignment > * m_alignmentFromDB
alignment params.
DBObjPtr< CDCEDepToADCConversions > * m_eDepToADCConversionsFromDB
Pointer to edep-to-ADC conv.
void setFFactor()
Set fudge factors (from DB).

Member Function Documentation

◆ calcMeanT0()

void calcMeanT0 ( double minT0 = 3800,
double maxT0 = 5800,
int maxIt = 10,
double nStdv = 3,
double epsi = 0.1 )

Calculate mean t0 in ns (over all good wires)

Parameters
minT0min. of t0 window (ns)
maxT0max. of t0 window (ns)
maxItmax. no. of iterations
nStdvstandard-deviation cut applied for next iteration
epsicriterion for iteration stop (ns)

Definition at line 1188 of file CDCGeometryPar.cc.

1189{
1190 double oldMeanT0 = 0;
1191 unsigned short it1 = 0;
1192 for (unsigned short it = 0; it < maxIt; ++it) {
1193 it1 = it;
1194 double effiSum = 0.;
1195 m_meanT0 = 0.;
1196 double stdvT0 = 0;
1197 for (unsigned short iCL = 0; iCL < c_maxNSenseLayers; ++iCL) {
1198 for (unsigned short iW = 0; iW < m_nWires[iCL]; ++iW) {
1199 if (m_t0[iCL][iW] < minT0 || m_t0[iCL][iW] > maxT0) continue;
1200 const WireID wid = WireID(iCL, iW);
1201 if (isHotWire(wid)) continue;
1202 if (isBadWire(wid)) continue;
1203 double effi = 1.;
1204 isDeadWire(wid, effi);
1205 effiSum += effi;
1206 m_meanT0 += (iCL < m_firstLayerOffset) ? 0. : effi * m_t0[iCL][iW];
1207 stdvT0 += (iCL < m_firstLayerOffset) ? 0. : effi * m_t0[iCL][iW] * m_t0[iCL][iW];
1208 }
1209 }
1210 if (effiSum > 0.) {
1211 m_meanT0 /= effiSum;
1212 stdvT0 /= effiSum;
1213 stdvT0 = sqrt(fabs(stdvT0 - m_meanT0 * m_meanT0));
1214 B2DEBUG(29, it << " " << effiSum << " " << m_meanT0 << " " << stdvT0);
1215 if (fabs(m_meanT0 - oldMeanT0) < epsi) break;
1216 oldMeanT0 = m_meanT0;
1217 minT0 = m_meanT0 - nStdv * stdvT0;
1218 maxT0 = m_meanT0 + nStdv * stdvT0;
1219 } else {
1220 B2FATAL("Wire efficiency sum <= 0!");
1221 }
1222 }
1223 if (it1 == maxIt - 1) B2WARNING("Max. iterations(=" << maxIt << ") needed to calculate the mean t0. Strange.");
1224}
bool isDeadWire(const WireID &wid, double &eff)
Inquire if the wire is dead.
unsigned m_nWires[c_maxNSenseLayers]
The array to store the wire number in each sense wire layre.
bool isHotWire(const WireID &wid)
Inquire if the wire is hot.
double m_meanT0
mean t0 over all wires; should be double.
float m_t0[c_maxNSenseLayers][c_maxNDriftCells]
t0 for each sense-wire (in nsec).
bool isBadWire(const WireID &wid)
Inquire if the wire is totally-dead.
ushort m_firstLayerOffset
Offset of the first layer (for reduced CDC studies)
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28

◆ cellId()

unsigned cellId ( unsigned layerId,
const B2Vector3D & position ) const

The method to get cell id based on given layer id and the position.

Parameters
layerIdThe given layer id.
positionThe given position to calculate cell id.
Returns
Cell id.

Definition at line 1620 of file CDCGeometryPar.cc.

1621{
1622 if (layerId < m_firstLayerOffset) {
1623 return 0;
1624 }
1625
1626 const unsigned nWires = m_nWires[layerId];
1627
1628 double offset = m_offSet[layerId];
1629 //...Offset modification to be aligned to axial at z=0...
1630 const double phiSize = 2 * M_PI / double(nWires);
1631
1632 unsigned j = 0;
1633 for (unsigned i = 0; i < 1; ++i) {
1634 const double phiF = phiSize * (double(i) + offset)
1635 + phiSize * 0.5 * double(m_nShifts[layerId]) + m_globalPhiRotation;
1636 const double phiB = phiSize * (double(i) + offset) + m_globalPhiRotation;
1637 const B2Vector3D f(m_rSLayer[layerId] * cos(phiF), m_rSLayer[layerId] * sin(phiF), m_zSForwardLayer[layerId]);
1638 const B2Vector3D b(m_rSLayer[layerId] * cos(phiB), m_rSLayer[layerId] * sin(phiB), m_zSBackwardLayer[layerId]);
1639 const B2Vector3D v = f - b;
1640 const B2Vector3D u = v.Unit();
1641 const double beta = (position.Z() - b.Z()) / u.Z();
1642 const B2Vector3D p = b + beta * u;
1643 double dPhi = std::atan2(position.Y(), position.X())
1644 - std::atan2(p.Y(), p.X())
1645 + phiSize / 2.;
1646 while (dPhi < 0) dPhi += (2. * M_PI);
1647 j = int(dPhi / phiSize);
1648 while (j >= nWires) j -= nWires;
1649 }
1650
1651 return j;
1652}
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition B2Vector3.h:439
DataType X() const
access variable X (= .at(0) without boundary check)
Definition B2Vector3.h:435
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition B2Vector3.h:437
double m_globalPhiRotation
Global ratation in phi (rad.); only for sense wires now.
int m_nShifts[c_maxNSenseLayers]
The array to store shifted cell number in each sense wire layer.
double offset(int layerID) const
Return wire offset in phi direction at endplate.
double m_zSForwardLayer[c_maxNSenseLayers]
The array to store forward z position of sense wire layers.
double m_rSLayer[c_maxNSenseLayers]
The array to store radius of sense wire layers.
double m_offSet[c_maxNSenseLayers]
The array to store z offset of sense wire layers.
double m_zSBackwardLayer[c_maxNSenseLayers]
The array to store backward z position of sense wire layers.
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition B2Vector3.h:522

◆ clear()

void clear ( )

Clears.

Definition at line 148 of file CDCGeometryPar.cc.

149{
150 m_version = "unknown";
151 m_nSLayer = 0;
152 m_nFLayer = 0;
154 m_senseWireTension = 0.0;
155 m_senseWireDensity = 0.0;
157
158 m_tdcOffset = 0; //not used; to be removed later
159 m_clockFreq4TDC = 0.0;
160 m_tdcBinWidth = 0.0;
161 m_nominalDriftV = 0.0;
162 m_nominalPropSpeed = 0.0;
164
165 for (unsigned i = 0; i < 4; ++i) {
166 m_rWall[i] = 0;
167 for (unsigned j = 0; j < 2; ++j)
168 m_zWall[i][j] = 0;
169 }
170 for (unsigned i = 0; i < c_maxNSenseLayers; ++i) {
171 m_rSLayer[i] = 0;
172 m_zSForwardLayer[i] = 0;
173 m_dzSForwardLayer[i] = 0;
174 m_zSBackwardLayer[i] = 0;
175 m_dzSBackwardLayer[i] = 0;
176 m_cellSize[i] = 0;
177 m_nWires[i] = 0;
178 m_offSet[i] = 0;
179 m_nShifts[i] = 0;
180 m_propSpeedInv[i] = 0.;
181 }
182 for (unsigned i = 0; i < c_maxNFieldLayers; ++i) {
183 m_rFLayer[i] = 0;
184 m_zFForwardLayer[i] = 0;
185 m_zFBackwardLayer[i] = 0;
186 }
187
188 for (unsigned L = 0; L < c_maxNSenseLayers; ++L) {
189 for (unsigned C = 0; C < c_maxNDriftCells; ++C) {
190 for (unsigned i = 0; i < 3; ++i) {
191 m_FWirPos [L][C][i] = 0.;
192 m_BWirPos [L][C][i] = 0.;
193 m_FWirPosMisalign[L][C][i] = 0.;
194 m_BWirPosMisalign[L][C][i] = 0.;
195 m_FWirPosAlign [L][C][i] = 0.;
196 m_BWirPosAlign [L][C][i] = 0.;
197 }
198 for (unsigned i = 0; i < 7; ++i) {
199 m_eDepToADCParams[L][C][i] = 0.;
200 }
201 m_WireSagCoef [L][C] = 0.;
202 m_WireSagCoefMisalign[L][C] = 0.;
203 m_WireSagCoefAlign [L][C] = 0.;
204 m_t0 [L][C] = 0.;
205 }
206 }
207
208 for (unsigned L = 0; L < c_maxNSenseLayers; ++L) {
209 for (unsigned i = 0; i < 2; ++i) {
210 for (unsigned alpha = 0; alpha < c_maxNAlphaPoints; ++alpha) {
211 for (unsigned theta = 0; theta < c_maxNThetaPoints; ++theta) {
212 for (unsigned xtparam = 0; xtparam < c_nXTParams; ++xtparam) {
213 m_XT[L][i][alpha][theta][xtparam] = 0.;
214 }
215
216 for (unsigned sigmaparam = 0; sigmaparam < c_nSigmaParams; ++sigmaparam) {
217 m_Sigma[L][i][alpha][theta][sigmaparam] = 0.;
218 }
219 }
220 }
221 }
222 }
223
224 for (unsigned board = 0; board < c_nBoards; ++board) {
225 for (unsigned i = 0; i < 2; ++i) {
226 m_timeWalkCoef[board][i] = 0.;
227 }
228 for (unsigned channel = 0; channel < 48; ++channel) {
229 m_boardAndChannelToWire[board][channel] = 0.;
230 }
231 }
232
233 for (unsigned superLayer = 0; superLayer < c_nSuperLayers; ++superLayer) {
234 for (unsigned layer = 0; layer < 8; ++layer) {
235 m_shiftInSuperLayer[superLayer][layer] = 0;
236 }
237 }
238
239}
float m_BWirPosMisalign[c_maxNSenseLayers][c_maxNDriftCells][3]
Wire position incl.
double m_nominalPropSpeed
Nominal propagation speed of the sense wire (27.25 cm/nsec).
unsigned short m_boardAndChannelToWire[c_nBoards][48]
array relating board-channel-id and wire-id.
float m_WireSagCoef[c_maxNSenseLayers][c_maxNDriftCells]
Wire sag coefficient for each cell; ibid.
float m_eDepToADCParams[c_maxNSenseLayers][c_maxNDriftCells][7]
edep-to-ADC conv.
float m_FWirPosMisalign[c_maxNSenseLayers][c_maxNDriftCells][3]
Wire position incl.
double m_clockFreq4TDC
Clock frequency used for TDC (GHz).
int m_nFLayer
The number of field wire layer.
float m_XT[c_maxNSenseLayers][2][c_maxNAlphaPoints][c_maxNThetaPoints][c_nXTParams]
XT-relation coefficients for each layer, Left/Right, entrance angle and polar angle.
signed short m_shiftInSuperLayer[c_nSuperLayers][8]
shift in phi-direction wrt the 1st layer in each super layer
std::string m_version
The version of geometry parameters.
unsigned short m_tdcOffset
Not used; to be removed later.
double m_senseWireDiameter
The diameter of sense wires.
double m_dzSBackwardLayer[c_maxNSenseLayers]
Corrections for backward z position of sense wire layers.
int m_nSLayer
The number of sense wire layer.
double m_nominalDriftV
Nominal drift velocity (4.0x10^-3 cm/nsec).
float m_FWirPos[c_maxNSenseLayers][c_maxNDriftCells][3]
Wire position incl.
float m_WireSagCoefAlign[c_maxNSenseLayers][c_maxNDriftCells]
Wire sag coefficient incl.
float m_FWirPosAlign[c_maxNSenseLayers][c_maxNDriftCells][3]
Wire position incl.
double m_dzSForwardLayer[c_maxNSenseLayers]
Corrections for forward z position of sense wire layers.
double m_zFForwardLayer[c_maxNFieldLayers]
The array to store forward z position of field wire layers.
double m_fieldWireDiameter
The diameter of field wires.
double m_zFBackwardLayer[c_maxNFieldLayers]
The array to store backward z position of field wire layers.
float m_WireSagCoefMisalign[c_maxNSenseLayers][c_maxNDriftCells]
Wire sag coefficient incl.
double m_cellSize[c_maxNSenseLayers]
The array to store cell size in each sense wire layer.
float m_BWirPosAlign[c_maxNSenseLayers][c_maxNDriftCells][3]
Wire position incl.
float m_propSpeedInv[c_maxNSenseLayers]
Inverse of propagation speed of the sense wire.
double m_zWall[4][2]
The array to store z position of inner wall and outer wall.
double m_senseWireDensity
The density of sense wires.
float m_timeWalkCoef[c_nBoards][2]
coefficients for time walk.
float m_BWirPos[c_maxNSenseLayers][c_maxNDriftCells][3]
Wire position incl.
float m_Sigma[c_maxNSenseLayers][2][c_maxNAlphaPoints][c_maxNThetaPoints][c_nSigmaParams]
position resolution for each layer.
double m_rFLayer[c_maxNFieldLayers]
The array to store radius of field wire layers.
double m_nominalSpaceResol
Nominal spatial resolution (0.0130 cm).
double m_rWall[4]
The array to store radius of inner wall and outer wall.
double m_tdcBinWidth
TDC bin width (nsec/bin).
double m_senseWireTension
The tension of sense wires.

◆ fieldWireBZ()

double fieldWireBZ ( int layerId) const
inline

Returns backward z position of field wire in each layer.

Parameters
layerIdThe layer id of field wires.
Returns
The backward z position of field wire in layer layerId.

Definition at line 1327 of file CDCGeometryPar.h.

1328 {
1329 return m_zFBackwardLayer[layerID];
1330 }

◆ fieldWireDiameter()

double fieldWireDiameter ( ) const
inline

Returns diameter of the field wire.

Returns
Diameter of the field wire.

Definition at line 1377 of file CDCGeometryPar.h.

1378 {
1379 return m_fieldWireDiameter;
1380 }

◆ fieldWireFZ()

double fieldWireFZ ( int layerId) const
inline

Returns forward z position of field wire in each layer.

Parameters
layerIdThe layer id of field wires.
Returns
The forward z position of field wire in layer layerId.

Definition at line 1322 of file CDCGeometryPar.h.

1323 {
1324 return m_zFForwardLayer[layerID];
1325 }

◆ fieldWireR()

double fieldWireR ( int layerId) const
inline

Returns radius of field wire in each layer.

Parameters
layerIdThe layer id of field wires.
Returns
The radius of field wire in layer layerId.

Definition at line 1317 of file CDCGeometryPar.h.

1318 {
1319 return m_rFLayer[layerID];
1320 }

◆ generateXML()

void generateXML ( const std::string & of)

Generate an xml file used in gearbox.

Parameters
ofThe file name.

Definition at line 1654 of file CDCGeometryPar.cc.

1655{
1656 //...Open xml file...
1657 std::ofstream ofs(of.c_str(), std::ios::out);
1658 if (! ofs) {
1659 B2ERROR("CDCGeometryPar::read !!! can not open file : "
1660 << of);
1661 }
1662 ofs << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
1663 << endl
1664 << "<Subdetector type=\"CDC\">"
1665 << endl
1666 << " <Name>CDC BelleII </Name>"
1667 << endl
1668 << " <Description>CDC geometry parameters</Description>"
1669 << endl
1670 << " <Version>0</Version>"
1671 << endl
1672 << " <GeoCreator>CDCBelleII</GeoCreator>"
1673 << endl
1674 << " <Content>"
1675 << endl
1676 << " <Rotation desc=\"Rotation of the whole cdc detector (should be the same as beampipe)\" unit=\"mrad\">0.0</Rotation>"
1677 << endl
1678 << " <OffsetZ desc=\"The offset of the whole cdc in z with respect to the IP (should be the same as beampipe)\" unit=\"mm\">0.0</OffsetZ>"
1679 << endl
1680 << " <Material>CDCGas</Material>"
1681 << endl
1682 << endl;
1683
1684 ofs << " <SLayers>" << endl;
1685
1686 for (int i = 0; i < m_nSLayer; i++) {
1687 ofs << " <SLayer id=\"" << i << "\">" << endl;
1688 ofs << " <Radius desc=\"Radius of wires in this layer\" unit=\"mm\">" << senseWireR(i) << "</Radius>" << endl;
1689 ofs << " <BackwardZ desc=\"z position of this wire layer at backward endplate\" unit=\"mm\">" << senseWireBZ(
1690 i) << "</BackwardZ>" << endl;
1691 ofs << " <ForwardZ desc=\"z position of this wire layer at forward endplate\" unit=\"mm\">" << senseWireFZ(
1692 i) << "</ForwardZ>" << endl;
1693 ofs << " <NHoles desc=\"the number of holes in this layer, 2*(cell number)\">" << nWiresInLayer(
1694 i) * 2 << "</NHoles>" << endl;
1695 ofs << " <NShift desc=\"the shifted hole number of each wire in this layer\">" << nShifts(i) << "</NShift>" << endl;
1696 ofs << " <Offset desc=\"wire offset in phi direction at endplate\">" << m_offSet[i] << "</Offset>" << endl;
1697 ofs << " </SLayer>" << endl;
1698 }
1699
1700 ofs << " </SLayers>" << endl;
1701 ofs << " <FLayers>" << endl;
1702
1703 for (int i = 0; i < m_nFLayer; i++) {
1704 ofs << " <FLayer id=\"" << i << "\">" << endl;
1705 ofs << " <Radius desc=\"Radius of field wires in this layer\" unit=\"mm\">" << fieldWireR(i) << "</Radius>" << endl;
1706 ofs << " <BackwardZ desc=\"z position of this field wire layer at backward endplate\" unit=\"mm\">" << fieldWireBZ(
1707 i) << "</BackwardZ>" << endl;
1708 ofs << " <ForwardZ desc=\"z position of this field wire layer at forward endplate\" unit=\"mm\">" << fieldWireFZ(
1709 i) << "</ForwardZ>" << endl;
1710 ofs << " </FLayer>" << endl;
1711 }
1712
1713 ofs << " </FLayers>" << endl;
1714
1715 ofs << " <InnerWall name=\"InnerWall\">" << endl;
1716 ofs << " <InnerR desc=\"Inner radius\" unit=\"mm\">" << innerRadiusInnerWall() << "</InnerR>" << endl;
1717 ofs << " <OuterR desc=\"Outer radius\" unit=\"mm\">" << outerRadiusInnerWall() << "</OuterR>" << endl;
1718 ofs << " <BackwardZ desc=\"z position at backward endplate\" unit=\"mm\">" << m_zWall[0][0] << "</BackwardZ>" << endl;
1719 ofs << " <ForwardZ desc=\"z position at forward endplate\" unit=\"mm\">" << m_zWall[0][1] << "</ForwardZ>" << endl;
1720 ofs << " </InnerWall>" << endl;
1721
1722 ofs << " <OuterWall name=\"OuterWall\">" << endl;
1723 ofs << " <InnerR desc=\"Inner radius\" unit=\"mm\">" << innerRadiusOuterWall() << "</InnerR>" << endl;
1724 ofs << " <OuterR desc=\"Outer radius\" unit=\"mm\">" << outerRadiusOuterWall() << "</OuterR>" << endl;
1725 ofs << " <BackwardZ desc=\"z position at backward endplate\" unit=\"mm\">" << m_zWall[2][0] << "</BackwardZ>" << endl;
1726 ofs << " <ForwardZ desc=\"z position at forward endplate\" unit=\"mm\">" << m_zWall[2][1] << "</ForwardZ>" << endl;
1727 ofs << " </OuterWall>" << endl;
1728
1729 ofs << " </Content>" << endl
1730 << "</Subdetector>" << endl;
1731}
double outerRadiusInnerWall() const
Returns the outer radius of the inner wall.
double innerRadiusOuterWall() const
Returns the inner radius of the outer wall.
int nShifts(int layerId) const
Returns number shift.
double fieldWireR(int layerId) const
Returns radius of field wire in each layer.
double senseWireBZ(int layerId) const
Returns backward z position of sense wire in each layer.
unsigned nWiresInLayer(int layerId) const
Returns wire numbers in a layer.
double fieldWireBZ(int layerId) const
Returns backward z position of field wire in each layer.
double senseWireFZ(int layerId) const
Returns forward z position of sense wire in each layer.
double innerRadiusInnerWall() const
Returns the inner radius of the inner wall.
double fieldWireFZ(int layerId) const
Returns forward z position of field wire in each layer.
double outerRadiusOuterWall() const
Returns the outer radius of the outer wall.
double senseWireR(int layerId) const
Returns radius of sense wire in each layer.

◆ getAlpha()

double getAlpha ( const B2Vector3D & posOnWire,
const B2Vector3D & momentum ) const

Returns track incident angle in rphi plane (alpha in rad.).

Parameters
posOnWirePosition on the wire at the closest point.
momentumTrack momentum at the closest point.

Definition at line 2465 of file CDCGeometryPar.cc.

2466{
2467 const double wx = posOnWire.X();
2468 const double wy = posOnWire.Y();
2469 const double px = momentum.X();
2470 const double py = momentum.Y();
2471
2472 const double cross = wx * py - wy * px;
2473 const double dot = wx * px + wy * py;
2474
2475 return atan2(cross, dot);
2476}
T dot(GeneralVector< T > a, GeneralVector< T > b)
dot product of two general vectors

◆ getBoardID()

unsigned short getBoardID ( const WireID & wID) const
inline

Returns frontend board id. corresponding to the wire id.

Parameters
wIDwire id.
Returns
board id.

Definition at line 580 of file CDCGeometryPar.h.

581 {
582 std::map<WireID, unsigned short>::const_iterator it = m_wireToBoard.find(wID);
583 unsigned short iret = (it != m_wireToBoard.end()) ? it->second : -999;
584 return iret;
585 }

◆ getBwdDeltaZ()

double getBwdDeltaZ ( unsigned short layerID) const
inline

Return backward 'deltaZ'.

Parameters
[in]layerID(0-55)

Definition at line 804 of file CDCGeometryPar.h.

805 {
806 return m_dzSBackwardLayer[layerID];
807 }

◆ getChannelID()

unsigned short getChannelID ( const WireID & wID) const
inline

Returns frontend channel id. corresponding to the wire id.

Parameters
wIDwire id.
Returns
channel id. (0-47)

Definition at line 592 of file CDCGeometryPar.h.

593 {
594 std::map<WireID, unsigned short>::const_iterator it = m_wireToChannel.find(wID);
595 unsigned short iret = (it != m_wireToChannel.end()) ? it->second : -999;
596 return iret;
597 }

◆ getClosestAlphaPoints()

void getClosestAlphaPoints ( const double alpha,
double & wal,
unsigned short points[2],
unsigned short lrs[2] ) const

Returns the two closest alpha points for the input track incident angle (alpha).

Definition at line 2511 of file CDCGeometryPar.cc.

2513{
2514 double alphao = getOutgoingAlpha(alpha);
2515 weight = 1.;
2516
2517 if (alphao < m_alphaPoints[0]) {
2518 points[0] = m_nAlphaPoints - 1;
2519 points[1] = 0;
2520 if (m_nAlphaPoints > 1) {
2521 lrs[0] = abs(lrs[0] - 1); //flip lr
2522 weight = (alphao - (m_alphaPoints[points[0]] - M_PI)) / (m_alphaPoints[points[1]] - (m_alphaPoints[points[0]] - M_PI));
2523 }
2524 } else if (m_alphaPoints[m_nAlphaPoints - 1] <= alphao) {
2525 points[0] = m_nAlphaPoints - 1;
2526 points[1] = 0;
2527 if (m_nAlphaPoints > 1) {
2528 lrs[1] = abs(lrs[1] - 1); //flip lr
2529 weight = (alphao - m_alphaPoints[points[0]]) / (m_alphaPoints[points[1]] + M_PI - m_alphaPoints[points[0]]);
2530 }
2531 } else {
2532 const float* upper = std::upper_bound(m_alphaPoints,
2533 m_alphaPoints + m_nAlphaPoints, alphao);
2534 points[1] = upper - m_alphaPoints;
2535 points[0] = points[1] - 1;
2536 weight = (alphao - m_alphaPoints[points[0]]) / (m_alphaPoints[points[1]] - m_alphaPoints[points[0]]);
2537 }
2538}
float m_alphaPoints[c_maxNAlphaPoints]
alpha sampling points for xt (rad)
static double getOutgoingAlpha(const double alpha)
Converts incoming- to outgoing-alpha.
unsigned short m_nAlphaPoints
No.

◆ getClosestAlphaPoints4Sgm()

void getClosestAlphaPoints4Sgm ( const double alpha,
double & wal,
unsigned short points[2],
unsigned short lrs[2] ) const

Returns the two closest alpha points for sigma for the input track incident angle (alpha).

TODO: unify the two getClosestAlphaPoints().

Definition at line 2541 of file CDCGeometryPar.cc.

2543{
2544 double alphao = getOutgoingAlpha(alpha);
2545 weight = 1.;
2546
2547 if (alphao < m_alphaPoints4Sgm[0]) {
2548 points[0] = m_nAlphaPoints4Sgm - 1;
2549 points[1] = 0;
2550 if (m_nAlphaPoints4Sgm > 1) {
2551 lrs[0] = abs(lrs[0] - 1); //flip lr
2552 weight = (alphao - (m_alphaPoints4Sgm[points[0]] - M_PI)) / (m_alphaPoints4Sgm[points[1]] - (m_alphaPoints4Sgm[points[0]] - M_PI));
2553 }
2554 } else if (m_alphaPoints4Sgm[m_nAlphaPoints4Sgm - 1] <= alphao) {
2555 points[0] = m_nAlphaPoints4Sgm - 1;
2556 points[1] = 0;
2557 if (m_nAlphaPoints4Sgm > 1) {
2558 lrs[1] = abs(lrs[1] - 1); //flip lr
2559 weight = (alphao - m_alphaPoints4Sgm[points[0]]) / (m_alphaPoints4Sgm[points[1]] + M_PI - m_alphaPoints4Sgm[points[0]]);
2560 }
2561 } else {
2562 const float* upper = std::upper_bound(m_alphaPoints4Sgm,
2564 points[1] = upper - m_alphaPoints4Sgm;
2565 points[0] = points[1] - 1;
2566 weight = (alphao - m_alphaPoints4Sgm[points[0]]) / (m_alphaPoints4Sgm[points[1]] - m_alphaPoints4Sgm[points[0]]);
2567 }
2568}
unsigned short m_nAlphaPoints4Sgm
No.
float m_alphaPoints4Sgm[c_maxNAlphaPoints]
alpha sampling points for sigma (rad)

◆ getClosestThetaPoints()

void getClosestThetaPoints ( const double alpha,
const double theta,
double & wth,
unsigned short points[2] ) const

Returns the two closest theta points for the input track incident angle (theta).

Definition at line 2571 of file CDCGeometryPar.cc.

2572{
2573 const double thetao = getOutgoingTheta(alpha, theta);
2574
2575 if (thetao < m_thetaPoints[0]) {
2576 points[0] = 0;
2577 points[1] = 0;
2578 weight = 1.;
2579 } else if (m_thetaPoints[m_nThetaPoints - 1] <= thetao) {
2580 points[0] = m_nThetaPoints - 1;
2581 points[1] = m_nThetaPoints - 1;
2582 weight = 1.;
2583 } else {
2584 const float* upper = std::upper_bound(m_thetaPoints,
2585 m_thetaPoints + m_nThetaPoints, thetao);
2586 points[1] = upper - m_thetaPoints;
2587 points[0] = points[1] - 1;
2588 weight = (thetao - m_thetaPoints[points[0]]) / (m_thetaPoints[points[1]] - m_thetaPoints[points[0]]);
2589 }
2590}
float m_thetaPoints[c_maxNThetaPoints]
theta sampling points for xt (rad)
static double getOutgoingTheta(const double alpha, const double theta)
Converts incoming- to outgoing-theta.
unsigned short m_nThetaPoints
No.

◆ getClosestThetaPoints4Sgm()

void getClosestThetaPoints4Sgm ( const double alpha,
const double theta,
double & wth,
unsigned short points[2] ) const

Returns the two closest theta points for sigma for the input track incident angle (theta).

Definition at line 2593 of file CDCGeometryPar.cc.

2595{
2596 const double thetao = getOutgoingTheta(alpha, theta);
2597
2598 if (thetao < m_thetaPoints4Sgm[0]) {
2599 points[0] = 0;
2600 points[1] = 0;
2601 weight = 1.;
2602 } else if (m_thetaPoints4Sgm[m_nThetaPoints4Sgm - 1] <= thetao) {
2603 points[0] = m_nThetaPoints4Sgm - 1;
2604 points[1] = m_nThetaPoints4Sgm - 1;
2605 weight = 1.;
2606 } else {
2607 const float* upper = std::upper_bound(m_thetaPoints4Sgm,
2609 points[1] = upper - m_thetaPoints4Sgm;
2610 points[0] = points[1] - 1;
2611 weight = (thetao - m_thetaPoints4Sgm[points[0]]) / (m_thetaPoints4Sgm[points[1]] - m_thetaPoints4Sgm[points[0]]);
2612 }
2613}
unsigned short m_nThetaPoints4Sgm
No.
float m_thetaPoints4Sgm[c_maxNThetaPoints]
theta sampling points for sigma (rad)

◆ getDriftLength()

double getDriftLength ( double dt,
unsigned short layer,
unsigned short lr,
double alpha = 0.,
double theta = 0.5 * M_PI,
bool calculateMinTime = true,
double minTime = 0. ) const

Return the drift dength to the sense wire.

Parameters
[in]dtDrift time (ns).
[in]layerLayer ID.
[in]lrLeft/Right
[in]alphaincident angle (in rphi plane) w.r.t. the cell (rad).
[in]thetaincident angle (polar angle) (rad).
calculateMinTimecalculate min. drift time inside this function (=true) or feed as input (=false).
minTimeinput min. drift time when calculateMinTime=false.

Definition at line 2054 of file CDCGeometryPar.cc.

2058{
2059 if (iCLayer < m_firstLayerOffset || iCLayer >= c_maxNSenseLayers) {
2060 return 0.;
2061 }
2062
2063 double dist = 0.;
2064 double delta = 0.;
2065
2066 //convert incoming- to outgoing-lr
2067 unsigned short lro = getOutgoingLR(lr, alpha);
2068
2070 B2FATAL("linearInterpolationOfXT = false is not allowed now !");
2071 } else {
2072 double wal(0.);
2073 unsigned short ial[2] = {0};
2074 unsigned short ilr[2] = {lro, lro};
2075 getClosestAlphaPoints(alpha, wal, ial, ilr);
2076 double wth(0.);
2077 unsigned short ith[2] = {0};
2078 getClosestThetaPoints(alpha, theta, wth, ith);
2079
2080 //calculate min. drift time reusing the interpolation points computed above
2081 double minTime = calculateMinTime ? getMinDriftTimeWithXtPoints(iCLayer, lr, alpha, theta, wal, ial, ilr, wth, ith)
2082 : inputMinTime;
2083 delta = time - minTime;
2084
2085 unsigned short jal, jlr, jth;
2086 double w;
2087
2088 //use xt reversed at (x=0,t=tmin) for delta<0 ("negative drifttime")
2089 double timep = delta < 0. ? minTime - delta : time;
2090
2091 //compute linear interpolation (=weithed average over 4 points) in (alpha-theta) space
2092 for (unsigned k = 0; k < 4; ++k) {
2093 if (k == 0) {
2094 jal = ial[0];
2095 jlr = ilr[0];
2096 jth = ith[0];
2097 w = (1. - wal) * (1. - wth);
2098 } else if (k == 1) {
2099 jal = ial[0];
2100 jlr = ilr[0];
2101 jth = ith[1];
2102 w = (1. - wal) * wth;
2103 } else if (k == 2) {
2104 jal = ial[1];
2105 jlr = ilr[1];
2106 jth = ith[0];
2107 w = wal * (1. - wth);
2108 } else { // k == 3
2109 jal = ial[1];
2110 jlr = ilr[1];
2111 jth = ith[1];
2112 w = wal * wth;
2113 }
2114
2115 double boundary = m_XT[iCLayer][jlr][jal][jth][6];
2116
2117 if (timep < boundary) {
2118 if (m_xtParamMode == 1) {
2119 dist += w * ROOT::Math::Chebyshev5(timep, m_XT[iCLayer][jlr][jal][jth][0], m_XT[iCLayer][jlr][jal][jth][1],
2120 m_XT[iCLayer][jlr][jal][jth][2], m_XT[iCLayer][jlr][jal][jth][3], m_XT[iCLayer][jlr][jal][jth][4], m_XT[iCLayer][jlr][jal][jth][5]);
2121 } else {
2122 dist += w * (m_XT[iCLayer][jlr][jal][jth][0] + timep
2123 * (m_XT[iCLayer][jlr][jal][jth][1] + timep
2124 * (m_XT[iCLayer][jlr][jal][jth][2] + timep
2125 * (m_XT[iCLayer][jlr][jal][jth][3] + timep
2126 * (m_XT[iCLayer][jlr][jal][jth][4] + timep
2127 * (m_XT[iCLayer][jlr][jal][jth][5]))))));
2128 }
2129 } else {
2130 dist += w * (m_XT[iCLayer][jlr][jal][jth][7] * (timep - boundary) + m_XT[iCLayer][jlr][jal][jth][8]);
2131 }
2132 } //end of weighted mean loop
2133 }
2134
2135 dist = fabs(dist);
2136 if (delta < 0.) dist *= -1.;
2137 return dist;
2138
2139}
void getClosestAlphaPoints(const double alpha, double &wal, unsigned short points[2], unsigned short lrs[2]) const
Returns the two closest alpha points for the input track incident angle (alpha).
static unsigned short getOutgoingLR(const unsigned short lr, const double alpha)
Converts incoming-lr to outgoing-lr.
bool m_linearInterpolationOfXT
Switch for linear interpolation of xt.
void getClosestThetaPoints(const double alpha, const double theta, double &wth, unsigned short points[2]) const
Returns the two closest theta points for the input track incident angle (theta).
int m_xtParamMode
Mode for xt parameterization.
double getMinDriftTimeWithXtPoints(unsigned short layer, unsigned short lr, double alpha, double theta, double wal, const unsigned short ial[2], const unsigned short ilr[2], double wth, const unsigned short ith[2]) const
Return the min.

◆ getDriftLength0()

double getDriftLength0 ( double dt,
unsigned short layer,
unsigned short lr,
double alpha = 0.,
double theta = 0.5 * M_PI ) const

Return the drift dength to the sense wire; tentative ver.

Parameters
[in]dtDrift time (ns).
[in]layerLayer ID.
[in]lrLeft/Right
[in]alphaincident angle (in rphi plane) w.r.t. the cell (rad).
[in]thetaincident angle (polar angle) (rad).

Definition at line 1976 of file CDCGeometryPar.cc.

1978{
1979 if (iCLayer < m_firstLayerOffset || iCLayer >= c_maxNSenseLayers) {
1980 return 0.;
1981 }
1982
1983 double dist = 0.;
1984
1985 //convert incoming- to outgoing-lr
1986 unsigned short lro = getOutgoingLR(lr, alpha);
1987
1989 B2FATAL("linearInterpolationOfXT = false is not allowed now !");
1990 } else {
1991 double wal(0.);
1992 unsigned short ial[2] = {0};
1993 unsigned short ilr[2] = {lro, lro};
1994 getClosestAlphaPoints(alpha, wal, ial, ilr);
1995 double wth(0.);
1996 unsigned short ith[2] = {0};
1997 getClosestThetaPoints(alpha, theta, wth, ith);
1998
1999 unsigned short jal, jlr, jth;
2000 double w;
2001
2002 //use xt reversed at (x=0,t=tmin) for delta<0 ("negative drifttime")
2003 double timep = time;
2004
2005 //compute linear interpolation (=weithed average over 4 points) in (alpha-theta) space
2006 for (unsigned k = 0; k < 4; ++k) {
2007 if (k == 0) {
2008 jal = ial[0];
2009 jlr = ilr[0];
2010 jth = ith[0];
2011 w = (1. - wal) * (1. - wth);
2012 } else if (k == 1) {
2013 jal = ial[0];
2014 jlr = ilr[0];
2015 jth = ith[1];
2016 w = (1. - wal) * wth;
2017 } else if (k == 2) {
2018 jal = ial[1];
2019 jlr = ilr[1];
2020 jth = ith[0];
2021 w = wal * (1. - wth);
2022 } else { // k == 3
2023 jal = ial[1];
2024 jlr = ilr[1];
2025 jth = ith[1];
2026 w = wal * wth;
2027 }
2028
2029 double boundary = m_XT[iCLayer][jlr][jal][jth][6];
2030
2031 if (timep < boundary) {
2032 if (m_xtParamMode == 1) {
2033 dist += w * ROOT::Math::Chebyshev5(timep, m_XT[iCLayer][jlr][jal][jth][0], m_XT[iCLayer][jlr][jal][jth][1],
2034 m_XT[iCLayer][jlr][jal][jth][2], m_XT[iCLayer][jlr][jal][jth][3], m_XT[iCLayer][jlr][jal][jth][4], m_XT[iCLayer][jlr][jal][jth][5]);
2035 } else {
2036 dist += w * (m_XT[iCLayer][jlr][jal][jth][0] + timep
2037 * (m_XT[iCLayer][jlr][jal][jth][1] + timep
2038 * (m_XT[iCLayer][jlr][jal][jth][2] + timep
2039 * (m_XT[iCLayer][jlr][jal][jth][3] + timep
2040 * (m_XT[iCLayer][jlr][jal][jth][4] + timep
2041 * (m_XT[iCLayer][jlr][jal][jth][5]))))));
2042 }
2043 } else {
2044 dist += w * (m_XT[iCLayer][jlr][jal][jth][7] * (timep - boundary) + m_XT[iCLayer][jlr][jal][jth][8]);
2045 }
2046 } //end of weighted mean loop
2047 }
2048
2049 // dist = fabs(dist);
2050 return dist;
2051
2052}

◆ getDriftTime()

double getDriftTime ( double dist,
unsigned short layer,
unsigned short lr,
double alpha,
double theta ) const

Return the drift time to the sense wire.

Parameters
distDrift length (cm).
layerLayer ID.
lrLeft/Right
alphaincident angle (in rphi plane) w.r.t. the cell (rad).
thetaincident angle (polar angle) (rad).

Definition at line 2291 of file CDCGeometryPar.cc.

2293{
2294 if (iCLayer < m_firstLayerOffset || iCLayer >= c_maxNSenseLayers) {
2295 return 0.;
2296 }
2297
2298 //to be replaced with a smarter algorithm...
2299
2300 const double eps = 2.5e-1;
2301 const double maxTrials = 100;
2302
2303 double maxTime = 2000.; //in ns (n.b. further reduction, 2->1us could be ok)
2304 double minTime = getMinDriftTime(iCLayer, lr, alpha, theta);
2305 double t0 = minTime;
2306 const bool calMinTime = false;
2307 double d0 = - dist;
2308
2309 unsigned i = 0;
2310 double t1 = maxTime;
2311 double time = dist * m_nominalDriftVInv;
2312 while (((t1 - t0) > eps) && (i < maxTrials)) {
2313 time = 0.5 * (t0 + t1);
2314 double d1 = getDriftLength(time, iCLayer, lr, alpha, theta, calMinTime, minTime) - dist;
2315 if (d0 * d1 > 0.) {
2316 t0 = time;
2317 } else {
2318 t1 = time;
2319 }
2320 ++i;
2321 }
2322
2323 if (i >= maxTrials - 1 || time > maxTime) {
2324 B2WARNING("CDCGeometryPar::getDriftTime " << dist << " " << iCLayer << " " << alpha << " " << lr << " " << t0 << " " << t1 << " " <<
2325 time << " " << d0);
2326 }
2327
2328 return time;
2329
2330}
double getMinDriftTime(unsigned short layer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI) const
Return the min.
double m_nominalDriftVInv
Inverse of the nominal drift velocity.
double getDriftLength(double dt, unsigned short layer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI, bool calculateMinTime=true, double minTime=0.) const
Return the drift dength to the sense wire.

◆ getDriftV()

double getDriftV ( double dt,
unsigned short layer,
unsigned short lr,
double alpha = 0.,
double theta = 0.5 * M_PI ) const

Get the realistic drift velocity.

Parameters
[in]dtDrift time (ns).
[in]layerLayer ID.
[in]lrLeft/Right
[in]alphaincident angle (in rphi plane) w.r.t. the cell (rad).
[in]thetaincident angle (polar angle) (rad).

Definition at line 1888 of file CDCGeometryPar.cc.

1890{
1891 if (iCLayer < m_firstLayerOffset || iCLayer >= c_maxNSenseLayers) {
1892 return 0.;
1893 }
1894
1895 double dDdt = 0.;
1896
1897 //calculate min. drift time
1898 double minTime = getMinDriftTime(iCLayer, lr, alpha, theta);
1899 // cppcheck-suppress variableScope ; kept next to the related declarations for readability
1900 double delta = time - minTime;
1901
1902 //convert incoming- to outgoing-lr
1903 unsigned short lro = getOutgoingLR(lr, alpha);
1904
1906 B2FATAL("linearInterpolationOfXT = false is not allowed now !");
1907 } else {
1908 double wal(0.);
1909 unsigned short ial[2] = {0};
1910 unsigned short ilr[2] = {lro, lro};
1911 getClosestAlphaPoints(alpha, wal, ial, ilr);
1912 double wth(0.);
1913 unsigned short ith[2] = {0};
1914 getClosestThetaPoints(alpha, theta, wth, ith);
1915
1916 unsigned short jal, jlr, jth;
1917 double w;
1918
1919 //use xt reversed at (x=0,t=tmin) for delta<0 ("negative drifttime")
1920 double timep = delta < 0. ? minTime - delta : time;
1921
1922 //compute linear interpolation (=weithed average over 4 points) in (alpha-theta) space
1923 for (unsigned k = 0; k < 4; ++k) {
1924 if (k == 0) {
1925 jal = ial[0];
1926 jlr = ilr[0];
1927 jth = ith[0];
1928 w = (1. - wal) * (1. - wth);
1929 } else if (k == 1) {
1930 jal = ial[0];
1931 jlr = ilr[0];
1932 jth = ith[1];
1933 w = (1. - wal) * wth;
1934 } else if (k == 2) {
1935 jal = ial[1];
1936 jlr = ilr[1];
1937 jth = ith[0];
1938 w = wal * (1. - wth);
1939 } else { // k == 3
1940 jal = ial[1];
1941 jlr = ilr[1];
1942 jth = ith[1];
1943 w = wal * wth;
1944 }
1945
1946 double boundary = m_XT[iCLayer][jlr][jal][jth][6];
1947
1948 if (timep < boundary) {
1949 if (m_xtParamMode == 1) {
1950 const double& c1 = m_XT[iCLayer][jlr][jal][jth][1];
1951 const double& c2 = m_XT[iCLayer][jlr][jal][jth][2];
1952 const double& c3 = m_XT[iCLayer][jlr][jal][jth][3];
1953 const double& c4 = m_XT[iCLayer][jlr][jal][jth][4];
1954 const double& c5 = m_XT[iCLayer][jlr][jal][jth][5];
1955 dDdt += w * ROOT::Math::Chebyshev4(timep, c1 + 3.*c3 + 5.*c5, 4.*c2 + 8.*c4, 6.*c3 + 10.*c5, 8.*c4, 10.*c5);
1956 } else {
1957 dDdt += w * (m_XT[iCLayer][jlr][jal][jth][1] + timep
1958 * (2.*m_XT[iCLayer][jlr][jal][jth][2] + timep
1959 * (3.*m_XT[iCLayer][jlr][jal][jth][3] + timep
1960 * (4.*m_XT[iCLayer][jlr][jal][jth][4] + timep
1961 * (5.*m_XT[iCLayer][jlr][jal][jth][5])))));
1962 }
1963 } else {
1964 dDdt += w * m_XT[iCLayer][jlr][jal][jth][7];
1965 }
1966 } //end of weighted mean loop
1967 }
1968
1969 dDdt = fabs(dDdt);
1970 // note that dDdt > 0 even for delta < 0
1971 return dDdt;
1972
1973}

◆ getEDepToADCConvFactor()

double getEDepToADCConvFactor ( unsigned short layer,
unsigned short cell,
double edep,
double dx,
double costh )

Return edep-to-ADC conversion factor.

Parameters
layerno. (0-55)
cellno. (0-)
edepenergy-deposit in the cell(keV).
dxpath length (cm) of the track in the cell.
costhcos(theta) of track.

Definition at line 1448 of file CDCGeometryPar.cc.

1449{
1450 // double convF = (100.0 / 3.2); //keV -> count
1451 // Model assumed here is from CLEO-c:
1452 // Igen = Imea * [1 + alf*Imea/cth] / [1 + gam*Imea/cth];
1453 // cth = |costh| + dlt;
1454 // Igen: original dE/dx; Imea: measured dE/dx with space-charge effect
1455 const double mainF = (iCL < m_firstLayerOffset) ? 0. : m_eDepToADCParams[iCL][iW][0];
1456 const double& alf = (iCL < m_firstLayerOffset) ? 0. : m_eDepToADCParams[iCL][iW][1];
1457 const double& gam = (iCL < m_firstLayerOffset) ? 0. : m_eDepToADCParams[iCL][iW][2];
1458 const double& dlt = (iCL < m_firstLayerOffset) ? 0. : m_eDepToADCParams[iCL][iW][3];
1459 const double& a = (iCL < m_firstLayerOffset) ? 0. : m_eDepToADCParams[iCL][iW][4];
1460 const double& b = (iCL < m_firstLayerOffset) ? 0. : m_eDepToADCParams[iCL][iW][5];
1461 const double cth = fabs(costh) + dlt;
1462 const double iGen = edep / dx; // keV/cm
1463 const double tmp = cth - gam * iGen;
1464 const double disc = tmp * tmp + 4.*alf * cth * iGen;
1465
1466 double iMea = 0.;
1467 if (alf == 0.) {
1468 iMea = cth * iGen / tmp;
1469 } else if (disc >= 0.) {
1470 iMea = (-tmp + sqrt(disc)) / (2.*alf);
1471 }
1472
1473 double convF = mainF;
1474 if (iMea > 0.) {
1475 convF = mainF * std::min(iMea / iGen, 1.);
1476 } else {
1477 // TODO: check the following issue more
1478 // B2WARNING("CDCGeometryPar: Measured dE/dx <= 0!");
1479 // B2DEBUG(29, "CDCGeometryPar: Measured dE/dx <= 0!");
1480 // B2DEBUG(29, "iGen,iMea= " << std::setw(15) << std::scientific << std::setprecision(8) << iGen <<" "<< iMea);
1481 // B2DEBUG(29, "dx,mainF,alf,gam,dlt,cth,tmp,disc= " << dx <<" "<< mainF <<" "<< alf <<" "<< gam <<" "<< dlt <<" "<<" "<< tmp <<" "<< disc);
1482 }
1483 convF *= 1. + a * (costh - b);
1484 return convF;
1485}

◆ getEDepToADCMainFactor()

double getEDepToADCMainFactor ( unsigned short layer,
unsigned short cell,
double costh = 0 )
inline

Return edep-to-ADC conversion main factor (in count/keV)

Parameters
layerno. (0-55)
cellno. (0-)
costhcosine of incident angle (theta) of particle

Definition at line 272 of file CDCGeometryPar.h.

273 {
274 return m_eDepToADCParams[layer][cell][0] + m_eDepToADCParams[layer][cell][4] * (costh - m_eDepToADCParams[layer][cell][5]);
275 };

◆ getEDepToADCSigma()

double getEDepToADCSigma ( unsigned short layer,
unsigned short cell )
inline

Return sigma for extra smearing of edep to ADC conversion.

Parameters
layerno. (0-55)
cellno. (0-)

Definition at line 281 of file CDCGeometryPar.h.

282 {
283 return m_eDepToADCParams[layer][cell][6];
284 };

◆ getFudgeFactorForSigma()

double getFudgeFactorForSigma ( unsigned short target) const
inline

Return the fuge factor for space resol.

Parameters
targettarget sigma: =0: for sigma in data reconstruction; =1: for sigma in MC recon.; =2: for sigma in digitization in MC

Definition at line 960 of file CDCGeometryPar.h.

961 {
962 return m_fudgeFactorForSigma[target];
963 }

◆ getFwdDeltaZ()

double getFwdDeltaZ ( unsigned short layerID) const
inline

Return forward 'deltaZ'.

Parameters
[in]layerID(0-55)

Definition at line 814 of file CDCGeometryPar.h.

815 {
816 return m_dzSForwardLayer[layerID];
817 }

◆ getMaterialDefinitionMode()

int getMaterialDefinitionMode ( ) const
inline

Return mode for material definition.

Return value = 0: define a mixture of gases and wires in the entire tracking volume; =1: define two different mixtures: one for the inner volume (small cell), and the other for the outer volume (normal cell).

Definition at line 781 of file CDCGeometryPar.h.

782 {
783 return m_materialDefinitionMode;
784 }

◆ getMaxNumberOfCellsPerLayer()

ushort getMaxNumberOfCellsPerLayer ( ) const
inline

Get the maximum number of cells in one layer.

Definition at line 1115 of file CDCGeometryPar.h.

1115{ return m_maxNCellsPerLayer;}

◆ getMaxNumberOfSuperLayers()

ushort getMaxNumberOfSuperLayers ( ) const
inline

Get the maximum number of super layers.

Definition at line 1100 of file CDCGeometryPar.h.

1100{ return m_maxNSuperLayers;}

◆ getMeanT0()

double getMeanT0 ( ) const
inline

Returns the mean t0 over all wires.

Returns
mean t0.

Definition at line 1402 of file CDCGeometryPar.h.

1403 {
1404 return m_meanT0;
1405 }

◆ getMinDriftTime()

double getMinDriftTime ( unsigned short layer,
unsigned short lr,
double alpha = 0.,
double theta = 0.5 * M_PI ) const

Return the min.

drift time (ns).

Parameters
[in]layerLayer ID.
[in]lrLeft/Right
[in]alphaincident angle (in rphi plane) w.r.t. the cell (rad).
[in]thetaincident angle (polar angle) (rad).

Definition at line 2141 of file CDCGeometryPar.cc.

2143{
2144 if (iCLayer < m_firstLayerOffset || iCLayer >= c_maxNSenseLayers) {
2145 return 0.;
2146 }
2147
2148 //convert incoming- to outgoing-lr
2149 unsigned short lro = getOutgoingLR(lr, alpha);
2150
2152 B2FATAL("linearInterpolationOfXT = false is not allowed now !");
2153 }
2154
2155 double wal(0.);
2156 unsigned short ial[2] = {0};
2157 unsigned short ilr[2] = {lro, lro};
2158 getClosestAlphaPoints(alpha, wal, ial, ilr);
2159 double wth(0.);
2160 unsigned short ith[2] = {0};
2161 getClosestThetaPoints(alpha, theta, wth, ith);
2162
2163 return getMinDriftTimeWithXtPoints(iCLayer, lr, alpha, theta, wal, ial, ilr, wth, ith);
2164}

◆ getMinDriftTimeWithXtPoints()

double getMinDriftTimeWithXtPoints ( unsigned short layer,
unsigned short lr,
double alpha,
double theta,
double wal,
const unsigned short ial[2],
const unsigned short ilr[2],
double wth,
const unsigned short ith[2] ) const

Return the min.

drift time (ns) with already computed closest alpha and theta points. Called by getMinDriftTime and getDriftLength to share the interpolation point search.

Parameters
[in]layerLayer ID.
[in]lrLeft/Right (used only for warning messages).
[in]alphaincident angle (in rphi plane) w.r.t. the cell (rad, used only for warning messages).
[in]thetaincident angle (polar angle) (rad, used only for warning messages).
[in]walweight of the second closest alpha point.
[in]ialthe two closest alpha points.
[in]ilrthe left/right passage corresponding to the closest alpha points.
[in]wthweight of the second closest theta point.
[in]iththe two closest theta points.

Definition at line 2166 of file CDCGeometryPar.cc.

2170{
2171 double minTime = 0.;
2172
2173 {
2174 unsigned short jal, jlr, jth;
2175 double w;
2176
2177 double c[6] = {0.}, a[6] = {0.};
2178 for (unsigned k = 0; k < 4; ++k) {
2179 if (k == 0) {
2180 jal = ial[0];
2181 jlr = ilr[0];
2182 jth = ith[0];
2183 w = (1. - wal) * (1. - wth);
2184 } else if (k == 1) {
2185 jal = ial[0];
2186 jlr = ilr[0];
2187 jth = ith[1];
2188 w = (1. - wal) * wth;
2189 } else if (k == 2) {
2190 jal = ial[1];
2191 jlr = ilr[1];
2192 jth = ith[0];
2193 w = wal * (1. - wth);
2194 } else { // k == 3
2195 jal = ial[1];
2196 jlr = ilr[1];
2197 jth = ith[1];
2198 w = wal * wth;
2199 }
2200
2201 for (int i = 0; i < 5; ++i) {
2202 c[i] += w * m_XT[iCLayer][jlr][jal][jth][i];
2203 }
2204 }
2205
2206 if (m_xtParamMode == 1) { //convert c to coeff for normal-poly if Chebyshev
2207 a[0] = c[0] - c[2] + c[4];
2208 a[1] = c[1] - 3.*c[3] + 5.*c[5];
2209 a[2] = 2.*c[2] - 8.*c[4];
2210 a[3] = 4.*c[3] - 20.*c[5];
2211 a[4] = 8.*c[4];
2212 a[5] = 16.*c[5];
2213 } else { //normal-poly
2214 for (int i = 0; i < 5; ++i) a[i] = c[i];
2215 }
2216
2217 //estimate an initial value
2218 if (a[2] != 0.) { //2nd-order approx. near t=0
2219 const double det = a[1] * a[1] - 4.*a[2] * a[0];
2220 if (det >= 0.) {
2221 //Choose the solution with dx/dt > 0 which gives x=0
2222 minTime = (-a[1] + sqrt(det)) / (2.*a[2]);
2223 } else {
2224 //Choose the solution with smallest x
2225 minTime = -a[1] / (2.*a[2]);
2226 }
2227 } else if (a[1] != 0.) {
2228 minTime = -a[0] / a[1]; //1st-order approx.
2229 } else {
2230 B2WARNING("CDCGeometryPar::getMinDriftTime: minDriftTime not determined; assume zero.\n" << "layer(#0-55),lr,alpha(rad),theta= " <<
2231 iCLayer << " " << lr << " " << alpha << " " << theta);
2232 return minTime;
2233 }
2234
2235 // double minTime0 = minTime;
2236 // higher-order corr. using Newton method; trial to minimize x^2
2237 double edm; // = 10.; //(cm)
2238 const double epsi4x = 5.e-6; //(cm)
2239 const unsigned short maxIter = 8;
2240 const double maxDt = 20.; //(ns)
2241 unsigned short nIter = 0;
2242 double minXsq = 1.e10; //(cm^2)
2243 double minMinTime = minTime;
2244 for (nIter = 0; nIter <= maxIter; ++nIter) {
2245 // told = minTime;
2246 double t = minTime;
2247 double x = a[0] + t * (a[1] + t * (a[2] + t * (a[3] + t * (a[4] + t * a[5]))));
2248 double x2 = x * x;
2249 if (x2 < minXsq) {
2250 minXsq = x2;
2251 minMinTime = t;
2252 }
2253 double xp = a[1] + t * (2 * a[2] + t * (3 * a[3] + t * (4 * a[4] + t * 5 * a[5])));
2254 double xpp = 2 * a[2] + t * (6 * a[3] + t * (12 * a[4] + t * 20 * a[5]));
2255 double den = xp * xp + x * xpp;
2256 if (den <= 0.) {
2257 den = xp * xp;
2258 }
2259
2260 if (den > 0.) {
2261 //estimated distance to min.
2262 edm = fabs(x * xp) / sqrt(den); //not in distance^2 but in distance
2263 if (edm < epsi4x) break; //converged
2264 }
2265
2266 double dt = 1.; //dt for den=0 (ns)
2267 if (den != 0.) {
2268 dt = x * xp / den;
2269 if (dt >= 0.) {
2270 dt = std::min(dt, maxDt);
2271 } else {
2272 dt = std::max(dt, -maxDt);
2273 }
2274 } else {
2275 B2WARNING("CDCGeometryPar::getMinDriftTime: den = 0\n" << "layer(#0-55),lr,alpha(rad),theta= " <<
2276 iCLayer << " "
2277 << lr <<
2278 " " << alpha << " " << theta);
2279 }
2280 minTime -= dt;
2281 } //end of iteration loop
2282
2283 //choose minMinTime for not-converged case
2284 if (nIter == (maxIter + 1)) minTime = minMinTime;
2285
2286 }
2287
2288 return minTime;
2289}

◆ getMinTrackLength()

double getMinTrackLength ( ) const
inline

Returns the minimum track length required in one G4 step (only secondary particles which pass this criterion are to be saved in MCParticle)

Returns
length (cm)

Definition at line 538 of file CDCGeometryPar.h.

539 {
540 return m_minTrackLength;
541 }

◆ getNewLeftRightRaw()

unsigned short getNewLeftRightRaw ( const B2Vector3D & posOnWire,
const B2Vector3D & posOnTrack,
const B2Vector3D & momentum ) const

Returns new left/right_raw.

Parameters
posOnWirePosition on the wire at the closest point.
posOnTrackPosition on the track at the closest point.
momentumTrack 3-momentum.

Definition at line 2456 of file CDCGeometryPar.cc.

2458{
2459 const double distanceCrossP = ((posOnWire - posOnTrack).Cross(momentum)).Z();
2460 unsigned short int lr = (distanceCrossP > 0.) ? 1 : 0;
2461 return lr;
2462}

◆ getNominalDriftV()

double getNominalDriftV ( ) const
inline

Return the nominal drift velocity of He-ethane gas (default: 4.0x10^-3 cm/nsec).

Definition at line 746 of file CDCGeometryPar.h.

747 {
748 return m_nominalDriftV;
749 }

◆ getNominalPropSpeed()

double getNominalPropSpeed ( ) const
inline

Return the nominal propagation speed of the sense wire (default: 27.25 cm/nsec).

Definition at line 756 of file CDCGeometryPar.h.

757 {
758 return m_nominalPropSpeed;
759 }

◆ getNominalSpaceResol()

double getNominalSpaceResol ( ) const
inline

Return the nominal spatial resolution.

(default: 130 um defined in CDC.xml).

Definition at line 766 of file CDCGeometryPar.h.

767 {
768 return m_nominalSpaceResol;
769 }

◆ getNumberOfFieldLayers()

ushort getNumberOfFieldLayers ( ) const
inline

Get the number of field layers.

Definition at line 1095 of file CDCGeometryPar.h.

1095{ return m_maxNFieldLayers;}

◆ getNumberOfFieldWires()

ushort getNumberOfFieldWires ( ) const
inline

Get the number of field wires.

Definition at line 1085 of file CDCGeometryPar.h.

1085{ return m_nFieldWires;}

◆ getNumberOfSenseLayers()

ushort getNumberOfSenseLayers ( ) const
inline

Get the number of sense layers.

Definition at line 1090 of file CDCGeometryPar.h.

1090{ return m_maxNSenseLayers;}

◆ getNumberOfSenseWires()

ushort getNumberOfSenseWires ( ) const
inline

Get the number of sense wires.

Definition at line 1080 of file CDCGeometryPar.h.

1080{ return m_nSenseWires;}

◆ getOffsetOfFirstLayer()

ushort getOffsetOfFirstLayer ( ) const
inline

Get the offset of the first layer.

Definition at line 1105 of file CDCGeometryPar.h.

1105{ return m_firstLayerOffset;}

◆ getOffsetOfFirstSuperLayer()

ushort getOffsetOfFirstSuperLayer ( ) const
inline

Get the offset of the first super layer.

Definition at line 1110 of file CDCGeometryPar.h.

1110{ return m_firstSuperLayerOffset;}

◆ getOldLeftRight()

unsigned short getOldLeftRight ( const B2Vector3D & posOnWire,
const B2Vector3D & posOnTrack,
const B2Vector3D & momentum ) const

Returns old left/right.

Parameters
posOnWirePosition on the wire at the closest point.
posOnTrackPosition on the track at the closest point.
momentumTrack 3-momentum.

Definition at line 2421 of file CDCGeometryPar.cc.

2423{
2424 unsigned short lr = 0;
2425 double wCrossT = (posOnWire.Cross(posOnTrack)).Z();
2426
2427 if (wCrossT < 0.) {
2428 lr = 0;
2429 } else if (wCrossT > 0.) {
2430 lr = 1;
2431 } else {
2432 if ((posOnTrack - posOnWire).Perp() != 0.) {
2433 double wCrossP = (posOnWire.Cross(momentum)).Z();
2434 if (wCrossP > 0.) {
2435 if (posOnTrack.Perp() > posOnWire.Perp()) {
2436 lr = 0;
2437 } else {
2438 lr = 1;
2439 }
2440 } else if (wCrossP < 0.) {
2441 if (posOnTrack.Perp() < posOnWire.Perp()) {
2442 lr = 0;
2443 } else {
2444 lr = 1;
2445 }
2446 } else {
2447 lr = 0;
2448 }
2449 } else {
2450 lr = 0;
2451 }
2452 }
2453 return lr;
2454}
B2Vector3< DataType > Cross(const B2Vector3< DataType > &p) const
Cross product.
Definition B2Vector3.h:298
DataType Perp() const
The transverse component (R in cylindrical coordinate system).
Definition B2Vector3.h:202

◆ getOutgoingAlpha()

double getOutgoingAlpha ( const double alpha)
static

Converts incoming- to outgoing-alpha.

Parameters
alphain rad.

Definition at line 2491 of file CDCGeometryPar.cc.

2492{
2493 //convert incoming- to outgoing-alpha
2494 double alphao = alpha;
2495 if (alpha > 0.5 * M_PI) {
2496 alphao -= M_PI;
2497 } else if (alpha < -0.5 * M_PI) {
2498 alphao += M_PI;
2499 }
2500
2501 return alphao;
2502}

◆ getOutgoingLR()

unsigned short getOutgoingLR ( const unsigned short lr,
const double alpha )
static

Converts incoming-lr to outgoing-lr.

Parameters
lrLeft/Right flag.
alphaTrack incident angle in rphi-plane (rad).

Definition at line 2484 of file CDCGeometryPar.cc.

2485{
2486 unsigned short lro = (fabs(alpha) <= 0.5 * M_PI) ? lr : abs(lr - 1);
2487 return lro;
2488}

◆ getOutgoingTheta()

double getOutgoingTheta ( const double alpha,
const double theta )
static

Converts incoming- to outgoing-theta.

Parameters
alphain rad.
thetain rad.

Definition at line 2504 of file CDCGeometryPar.cc.

2505{
2506 //convert incoming- to outgoing-theta
2507 double thetao = fabs(alpha) > 0.5 * M_PI ? M_PI - theta : theta;
2508 return thetao;
2509}

◆ getPropSpeedInv()

double getPropSpeedInv ( const unsigned int layerID) const
inline

Get the inversel of propagation speed in the sense wire.

Parameters
[in]layerIDlayer ID (0-55)

Definition at line 836 of file CDCGeometryPar.h.

837 {
838 return m_propSpeedInv[layerID];
839 }

◆ getSenseWireZposMode()

int getSenseWireZposMode ( ) const
inline

Return mode for sense wire z position.

Return value =0: define at the end-plate (gas side) with old design; =1: define at the bush inside the feedthrough with correction for the diff. betw. final- and old-design.

Definition at line 794 of file CDCGeometryPar.h.

795 {
796 return m_senseWireZposMode;
797 }

◆ getShiftInSuperLayer()

signed short getShiftInSuperLayer ( unsigned short iSuperLayer,
unsigned short iLayer ) const

Returns shift in the super-layer.

Parameters
iSuperLayerThe super-layer id.
iLayerThe layer id. in the super-layer

Definition at line 2666 of file CDCGeometryPar.cc.

2667{
2668 return m_shiftInSuperLayer[iSuperLayer][iLayer];
2669}

◆ getSigma()

double getSigma ( double dist,
unsigned short layer,
unsigned short lr,
double alpha = 0.,
double theta = 0.5 * M_PI ) const

Return the basic resolution of drift length (cm).

N.B. A fudge factor may be multiplied at the place where this is called; be careful.

Parameters
distDrift length (cm); negative dist is treated as |dist|.
layerLayer id.
lrLeft/Right.
alphaincident angle (in rphi plane) w.r.t. the cell (rad).
thetaincident angle (polar angle) (rad).

Definition at line 2332 of file CDCGeometryPar.cc.

2334{
2335 if (iCLayer < m_firstLayerOffset || iCLayer >= c_maxNSenseLayers) {
2336 return 0.;
2337 }
2338
2339
2340 double sigma = 0.;
2341 // DriftL0 < 0 for the hit w/driftTime < 0; use |DriftL0| to avoid sigma=nan
2342 const double driftL = fabs(DriftL0);
2343
2344 //convert incoming- to outgoing-lr
2345 unsigned short lro = getOutgoingLR(lr, alpha);
2346
2348 B2FATAL("linearInterpolationOfSgm = false is not allowed now !");
2349 }
2351 double wal(0.);
2352 unsigned short ial[2] = {0};
2353 unsigned short ilr[2] = {lro, lro};
2354 getClosestAlphaPoints4Sgm(alpha, wal, ial, ilr);
2355 double wth(0.);
2356 unsigned short ith[2] = {0};
2357 getClosestThetaPoints4Sgm(alpha, theta, wth, ith);
2358
2359 //compute linear interpolation (=weithed average over 4 points) in (alpha-theta) space
2360 unsigned short jal, jlr, jth;
2361 double w;
2362 for (unsigned k = 0; k < 4; ++k) {
2363 if (k == 0) {
2364 jal = ial[0];
2365 jlr = ilr[0];
2366 jth = ith[0];
2367 w = (1. - wal) * (1. - wth);
2368 } else if (k == 1) {
2369 jal = ial[0];
2370 jlr = ilr[0];
2371 jth = ith[1];
2372 w = (1. - wal) * wth;
2373 } else if (k == 2) {
2374 jal = ial[1];
2375 jlr = ilr[1];
2376 jth = ith[0];
2377 w = wal * (1. - wth);
2378 } else { // k == 3
2379 jal = ial[1];
2380 jlr = ilr[1];
2381 jth = ith[1];
2382 w = wal * wth;
2383 }
2384
2385 const double& P0 = m_Sigma[iCLayer][jlr][jal][jth][0];
2386 const double& P1 = m_Sigma[iCLayer][jlr][jal][jth][1];
2387 const double& P2 = m_Sigma[iCLayer][jlr][jal][jth][2];
2388 const double& P3 = m_Sigma[iCLayer][jlr][jal][jth][3];
2389 const double& P4 = m_Sigma[iCLayer][jlr][jal][jth][4];
2390 const double& P5 = m_Sigma[iCLayer][jlr][jal][jth][5];
2391 const double& P6 = m_Sigma[iCLayer][jlr][jal][jth][6];
2392 const double P7 = m_sigmaParamMode == 0 ? DBL_MAX : m_Sigma[iCLayer][jlr][jal][jth][7];
2393
2394 if (driftL < P7) {
2395 sigma += w * sqrt(P0 / (driftL * driftL + P1) + P2 * driftL + P3 +
2396 P4 * exp(P5 * (driftL - P6) * (driftL - P6)));
2397 } else {
2398 double forthTermAtP7 = P4 * exp(P5 * (P7 - P6) * (P7 - P6));
2399 const double& P8 = m_Sigma[iCLayer][jlr][jal][jth][8];
2400 if (m_sigmaParamMode == 1) {
2401 double sigmaAtP7 = sqrt(P0 / (P7 * P7 + P1) + P2 * P7 + P3 + forthTermAtP7);
2402 sigma += w * (P8 * (driftL - P7) + sigmaAtP7);
2403 } else if (m_sigmaParamMode == 2) {
2404 double onePls4AtP7 = sqrt(P0 / (P7 * P7 + P1) + forthTermAtP7);
2405 const double onePls4 = P8 * (driftL - P7) + onePls4AtP7;
2406 sigma += w * sqrt(P2 * driftL + P3 + onePls4 * onePls4);
2407 } else if (m_sigmaParamMode == 3) {
2408 forthTermAtP7 = sqrt(forthTermAtP7);
2409 const double forthTerm = P8 * (driftL - P7) + forthTermAtP7;
2410 sigma += w * sqrt(P0 / (driftL * driftL + P1) + P2 * driftL + P3 +
2411 forthTerm * forthTerm);
2412 } //end of mode
2413 } // end of driftL
2414 } //end of for loop
2415 }
2416
2417 sigma = std::min(sigma, m_maxSpaceResol);
2418 return sigma;
2419}
int m_sigmaParamMode
Mode for sigma parameterization.
void getClosestAlphaPoints4Sgm(const double alpha, double &wal, unsigned short points[2], unsigned short lrs[2]) const
Returns the two closest alpha points for sigma for the input track incident angle (alpha).
bool m_linearInterpolationOfSgm
Switch for linear interpolation of sigma.
double m_maxSpaceResol
max space resolution allowed (cm).
void getClosestThetaPoints4Sgm(const double alpha, const double theta, double &wth, unsigned short points[2]) const
Returns the two closest theta points for sigma for the input track incident angle (theta).

◆ getT0()

float getT0 ( const WireID & wireID) const
inline

Returns t0 parameter of the specified sense wire.

Parameters
wireIDWire id.
Returns
t0.

Definition at line 565 of file CDCGeometryPar.h.

566 {
567 // std::cout << wireID.getICLayer() <<" "<< wireID.getIWire() << std::endl;
568 unsigned int iclayer = wireID.getICLayer();
569 unsigned int iwire = wireID.getIWire();
570 if (iclayer >= c_maxNSenseLayers) iclayer = c_maxNSenseLayers - 1;
571 if (iwire >= c_maxNDriftCells) iwire = c_maxNDriftCells - 1;
572 return m_t0[iclayer][iwire];
573 }

◆ getTdcBinWidth()

double getTdcBinWidth ( ) const
inline

Return TDC bin width (nsec).

Definition at line 736 of file CDCGeometryPar.h.

737 {
738 return m_tdcBinWidth;
739 }

◆ getTdcOffset()

unsigned short getTdcOffset ( ) const
inline

Return TDC offset value (default = 0 ch).

Definition at line 727 of file CDCGeometryPar.h.

728 {
729 return m_tdcOffset;
730 }

◆ getTheta()

double getTheta ( const B2Vector3D & momentum) const

Returns track incident angle (theta in rad.).

Parameters
momentumTrack momentum at the closest point.

Definition at line 2478 of file CDCGeometryPar.cc.

2479{
2480 return atan2(momentum.Perp(), momentum.Z());
2481}

◆ getThresholdEnerguDeposit()

double getThresholdEnerguDeposit ( ) const
inline

Returns threshold for energy deposit in one G4 step.

Returns
threshold (GeV)

Definition at line 529 of file CDCGeometryPar.h.

530 {
531 return m_thresholdEnergyDeposit;
532 }

◆ getTimeWalk()

double getTimeWalk ( const WireID & wID,
unsigned short adcCount ) const
inline

Returns time-walk.

Parameters
wIDwire id
adcCountADC count
Returns
time-walk (in ns)

Definition at line 616 of file CDCGeometryPar.h.

617 {
618 std::map<WireID, unsigned short>::const_iterator it = m_wireToBoard.find(wID);
619 // std::cout <<"SL,L,W, bd#= " << wID.getISuperLayer() <<" "<< wID.getILayer() <<" "<< wID.getIWire() <<" "<< it->second << std::endl;
620 double tw = 0.;
621 if (it != m_wireToBoard.end() && adcCount > 0) {
622 if (m_twParamMode == 0) {
623 tw = m_timeWalkCoef[it->second][0] / sqrt(adcCount);
624 } else if (m_twParamMode == 1) {
625 double p0 = m_timeWalkCoef[it->second][0];
626 double p1 = m_timeWalkCoef[it->second][1];
627 tw = p0 * exp(-p1 * adcCount);
628 }
629 }
630 // std::cout <<"bd#,coef,adc,tw= " << it->second <<" "<< m_timeWalkCoef[it->second] <<" "<< adcCount <<" "<< tw << std::endl;
631 return tw;
632 }

◆ getWireID()

const WireID getWireID ( unsigned short bd,
unsigned short ch ) const
inline

Returns wire id. corresponding to the board-and-cannel ids.

Parameters
bdboard id. (1-300)
chchannel id. (0-47)
Returns
wire id.

Definition at line 605 of file CDCGeometryPar.h.

606 {
607 return WireID(m_boardAndChannelToWire[bd][ch]);
608 }

◆ getWireSagCoef()

double getWireSagCoef ( EWirePosition set,
uint layerId,
int cellId ) const

Returns coefficient for the sense wire sag.

Parameters
setWire position set; =c_Base, c_Misaligned or c_Aligned
layerIdThe layer id.
cellIdThe cell id.
Returns
Coefficient for the sense wire sag.

Definition at line 1587 of file CDCGeometryPar.cc.

1588{
1589 double coef = m_WireSagCoef[layerID][cellID];
1590 if (set == c_Misaligned) {
1591 coef = m_WireSagCoefMisalign[layerID][cellID];
1592 } else if (set == c_Aligned) {
1593 coef = m_WireSagCoefAlign [layerID][cellID];
1594 }
1595 return coef;
1596}

◆ getWireSagEffect()

void getWireSagEffect ( EWirePosition set,
unsigned layerID,
unsigned cellID,
double zw,
double & ywb_sag,
double & ywf_sag ) const

Compute effects of the sense wire sag.

Parameters
[in]setWire position set; =c_Base, c_Misaligned or c_Aligned
[in]layerIDLayer ID
[in]cellIDCell ID in the layer
[in]zwZ-coord. (cm) at which the sense wire sag is computed
[out]ywb_sagY-corrd. (cm) of intersection between a tangent and the backward endplate.
[out]ywf_sagY-corrd. (cm) of intersection between a tangent and the forward endplate.
Attention
The tangent is computed from the first derivative of a paraboric wire (due to gravity) defined at Z.

Definition at line 1733 of file CDCGeometryPar.cc.

1735{
1736 //Input
1737 // set : c_Base, c_Misaligned or c_Aligned
1738 // layerID: layer id (0 - 55);
1739 // cellID: cell id in the layer;
1740 // Z: Z-coord. (cm) at which sense wire sag is computed.
1741 //
1742 //Output Yb_sag: Y-corrd. (cm) of intersection of a tangent and the backward endplate.
1743 // Here the tangent is computed from the 1'st derivative of
1744 // a paraboric wire (due to gravity) defined at Z.
1745 // Yf_sag: ibid. but for forward.
1746 //
1747 //N.B.- Maybe replaced with a bit more accurate formula.
1748 // - The electrostatic force effect is not included.
1749
1750 // return early in case of empty layer, i.e. layerID < m_firstLayerOffset
1751 if (layerID < m_firstLayerOffset) {
1752 Yb_sag = 0.;
1753 Yf_sag = 0.;
1754 return;
1755 }
1756
1757 double Xb = 0.;
1758 double Xf = 0.;
1759 double Yb = 0.;
1760 double Yf = 0.;
1761 double Zb = 0.;
1762 double Zf = 0.;
1763 double Coef = 0.;
1764
1765 if (set == c_Aligned) {
1766 Coef = m_WireSagCoefAlign[layerID][cellID];
1767 Yb = m_BWirPosAlign[layerID][cellID][1];
1768 Yf = m_FWirPosAlign[layerID][cellID][1];
1769 if (Coef == 0.) {
1770 Yb_sag = Yb;
1771 Yf_sag = Yf;
1772 return;
1773 }
1774 Xb = m_BWirPosAlign[layerID][cellID][0];
1775 Xf = m_FWirPosAlign[layerID][cellID][0];
1776 Zb = m_BWirPosAlign[layerID][cellID][2];
1777 Zf = m_FWirPosAlign[layerID][cellID][2];
1778
1779 } else if (set == c_Misaligned) {
1780 Coef = m_WireSagCoefMisalign[layerID][cellID];
1781 Yb = m_BWirPosMisalign[layerID][cellID][1];
1782 Yf = m_FWirPosMisalign[layerID][cellID][1];
1783 if (Coef == 0.) {
1784 Yb_sag = Yb;
1785 Yf_sag = Yf;
1786 return;
1787 }
1788 Xb = m_BWirPosMisalign[layerID][cellID][0];
1789 Xf = m_FWirPosMisalign[layerID][cellID][0];
1790 Zb = m_BWirPosMisalign[layerID][cellID][2];
1791 Zf = m_FWirPosMisalign[layerID][cellID][2];
1792
1793 } else if (set == c_Base) {
1794 Coef = m_WireSagCoef[layerID][cellID];
1795 Yb = m_BWirPos[layerID][cellID][1];
1796 Yf = m_FWirPos[layerID][cellID][1];
1797 if (Coef == 0.) {
1798 Yb_sag = Yb;
1799 Yf_sag = Yf;
1800 return;
1801 }
1802 Xb = m_BWirPos[layerID][cellID][0];
1803 Xf = m_FWirPos[layerID][cellID][0];
1804 Zb = m_BWirPos[layerID][cellID][2];
1805 Zf = m_FWirPos[layerID][cellID][2];
1806
1807 } else {
1808 B2FATAL("CDCGeometryPar::getWireSagEffect: called with an invalid set: " << " " << set);
1809 }
1810
1811 const double dx = Xf - Xb;
1812 const double dy = Yf - Yb;
1813 const double dz = Zf - Zb;
1814
1815 const double Zfp = sqrt(dz * dz + dx * dx); // Wire length in z-x plane since Zbp==0
1816 const double Zp = (Z - Zb) * Zfp / dz;
1817
1818 const double Y_sag = (Coef * (Zp - Zfp) + dy / Zfp) * Zp + Yb;
1819 const double dydz = (Coef * (2.*Zp - Zfp) * Zfp + dy) / dz;
1820
1821 Yb_sag = Y_sag + dydz * (Zb - Z);
1822 Yf_sag = Y_sag + dydz * (Zf - Z);
1823
1824}

◆ innerRadiusInnerWall()

double innerRadiusInnerWall ( ) const
inline

Returns the inner radius of the inner wall.

Returns
The inner radius of the inner wall.

Definition at line 1347 of file CDCGeometryPar.h.

1348 {
1349 return m_rWall[0];
1350 }

◆ innerRadiusOuterWall()

double innerRadiusOuterWall ( ) const
inline

Returns the inner radius of the outer wall.

Returns
The inner radius of the outer wall.

Definition at line 1332 of file CDCGeometryPar.h.

1333 {
1334 return m_rWall[2];
1335 }

◆ innerRadiusWireLayer()

const double * innerRadiusWireLayer ( ) const

Returns an array of inner radius of wire layers.

Returns
An array of inner radius of wire layers.

Definition at line 1598 of file CDCGeometryPar.cc.

1599{
1600 static double IRWL[c_maxNSenseLayers] = {0};
1601
1602 IRWL[0] = outerRadiusInnerWall();
1603 for (unsigned i = 1; i < nWireLayers(); i++)
1604 IRWL[i] = (i == m_firstLayerOffset) ? outerRadiusInnerWall() : m_rFLayer[i - 1];
1605
1606 return IRWL;
1607}
static unsigned nWireLayers()
Returns a number of wire layers.

◆ Instance()

CDCGeometryPar & Instance ( const CDCGeometry * geom = nullptr)
static

Static method to get a reference to the CDCGeometryPar instance.

Returns
A reference to an instance of this class.

Definition at line 32 of file CDCGeometryPar.cc.

33{
36}
static CDCGeometryPar * m_B4CDCGeometryParDB
Pointer that saves the instance of this class.
CDCGeometryPar(const CDCGeometry *=nullptr)
Singleton class.

◆ isBadWire()

bool isBadWire ( const WireID & wid)
inline

Inquire if the wire is totally-dead.

Definition at line 844 of file CDCGeometryPar.h.

845 {
846 double eff = 0;
847 bool badBoard = *m_badBoardsFromDB ? (*m_badBoardsFromDB)->isDeadBoard(getBoardID(wid), eff) : false;
848 if (badBoard) return badBoard;
849 bool torf = *m_badWireFromDB ? (*m_badWireFromDB)->isBadWire(wid) : false;
850 return torf;
851 }

◆ isDeadWire()

bool isDeadWire ( const WireID & wid,
double & eff )
inline

Inquire if the wire is dead.

Definition at line 856 of file CDCGeometryPar.h.

857 {
858 bool badBoard = *m_badBoardsFromDB ? (*m_badBoardsFromDB)->isDeadBoard(getBoardID(wid), eff) : false;
859 if (badBoard) return badBoard;
860 bool torf = *m_badWireFromDB ? (*m_badWireFromDB)->isDeadWire(wid, eff) : false;
861 return torf;
862 }

◆ isHotWire()

bool isHotWire ( const WireID & wid)
inline

Inquire if the wire is hot.

Definition at line 867 of file CDCGeometryPar.h.

868 {
869 bool hotBoard = *m_badBoardsFromDB ? (*m_badBoardsFromDB)->isHotBoard(getBoardID(wid)) : false;
870 if (hotBoard) return hotBoard;
871 bool torf = *m_badWireFromDB ? (*m_badWireFromDB)->isHotWire(wid) : false;
872 return torf;
873 }

◆ isModifiedLeftRightFlagOn()

bool isModifiedLeftRightFlagOn ( ) const
inline

Returns on/off for modified left/right calculation in FullSim.

Definition at line 554 of file CDCGeometryPar.h.

555 {
556 return m_modLeftRightFlag;
557 }

◆ isWireSagOn()

bool isWireSagOn ( ) const
inline

Returns on/off for sense wire sag in FullSim.

Definition at line 546 of file CDCGeometryPar.h.

547 {
548 return m_wireSag;
549 }

◆ momBound()

int momBound ( ) const

to get the number of boundary position of the CDC mother volume

Returns
The number of boundary position of the CDC mother volume.

◆ momRmin()

double momRmin ( int iBound) const
inline

Returns inner radius of the CDC mother volume.

Parameters
iBound: The boundary id.
Returns
The inner radius of the specified baoundary position in the CDC mother volume

Definition at line 1267 of file CDCGeometryPar.h.

1268 {
1269 return m_momRmin[iBound];
1270 }

◆ momZ()

double momZ ( int iBound) const
inline

Returns boundary position in Z axis of the CDC mother volume.

Parameters
iBound: The boundary id.
Returns
The z component of the specified baoundary position in the CDC mother volume

Definition at line 1262 of file CDCGeometryPar.h.

1263 {
1264 return m_momZ[iBound];
1265 }

◆ motherInnerR()

double motherInnerR ( ) const

The method to get cdc mother volume inner R.

Returns
The inner radius of the cdc mother volume.

◆ motherLength()

double motherLength ( ) const

The method to get cdc mother volume length.

Returns
The length of the cdc mother volume.

◆ motherOuterR()

double motherOuterR ( ) const

The method to get cdc mother volume outer R.

Returns
The outer radius of the cdc mother volume.

◆ newReadSigma()

void newReadSigma ( const GearDir & gbxParams,
int mode = 0 )

Read spatial resolution table in new format.

Parameters
gbxParamsGear Dir.
mode0: read simulation file, 1: read reconstruction file.

Definition at line 846 of file CDCGeometryPar.cc.

847{
848 m_linearInterpolationOfSgm = true; //must be true now
849
850 std::string fileName0 = CDCGeoControlPar::getInstance().getSigmaFile();
851 if (mode == 1) {
852 fileName0 = gbxParams.getString("sigma4ReconFileName");
853 }
854
855 ifstream ifs;
856 openFileA(ifs, fileName0);
857
858 //read alpha bin info.
859 unsigned short nAlphaBins = 0;
860 if (ifs >> nAlphaBins) {
861 if (nAlphaBins == 0 || nAlphaBins > c_maxNAlphaPoints) B2FATAL("Fail to read alpha bins !");
862 } else {
863 B2FATAL("Fail to read alpha bins !");
864 }
865 m_nAlphaPoints4Sgm = nAlphaBins;
866
867 double alpha0, alpha1, alpha2;
868 for (unsigned short i = 0; i < nAlphaBins; ++i) {
869 ifs >> alpha0 >> alpha1 >> alpha2;
870 m_alphaPoints4Sgm[i] = alpha2;
871 }
872
873 //read theta bin info.
874 unsigned short nThetaBins = 0;
875 if (ifs >> nThetaBins) {
876 if (nThetaBins == 0 || nThetaBins > c_maxNThetaPoints) B2FATAL("CDCGeometryPar: fail to read theta bins !");
877 } else {
878 B2FATAL("CDCGeometryPar: fail to read theta bins !");
879 }
880 m_nThetaPoints4Sgm = nThetaBins;
881
882 double theta0, theta1, theta2;
883
884 for (unsigned short i = 0; i < nThetaBins; ++i) {
885 ifs >> theta0 >> theta1 >> theta2;
886 m_thetaPoints4Sgm[i] = theta2;
887 }
888
889 unsigned short np = 0;
890 unsigned short iCL, iLR;
891 double sigma[c_nSigmaParams];
892 double theta, alpha;
893
894 ifs >> m_sigmaParamMode >> np;
895 if (m_sigmaParamMode < 0 || m_sigmaParamMode > 4) B2FATAL("CDCGeometryPar: invalid sigma-parameterization mode read !");
896
897 if (np > c_nSigmaParams) B2FATAL("CDCGeometryPar: no. of sigma-params. outside limits !");
898
899 ifs >> m_maxSpaceResol;
900
901 const double epsi = 0.1;
902
903 while (ifs >> iCL) {
904
905 if (iCL < m_firstLayerOffset) {
906 continue;
907 }
908
909 ifs >> theta >> alpha >> iLR;
910 for (int i = 0; i < np; ++i) {
911 ifs >> sigma[i];
912 }
913
914 int itheta = -99;
915 for (unsigned short i = 0; i < nThetaBins; ++i) {
916 if (fabs(theta - m_thetaPoints4Sgm[i]) < epsi) {
917 itheta = i;
918 break;
919 }
920 }
921 if (itheta < 0) B2FATAL("CDCGeometryPar: thetas in sigma.dat are inconsistent !");
922
923 int ialpha = -99;
924 for (unsigned short i = 0; i < nAlphaBins; ++i) {
925 if (fabs(alpha - m_alphaPoints4Sgm[i]) < epsi) {
926 ialpha = i;
927 break;
928 }
929 }
930 if (ialpha < 0) B2FATAL("CDCGeometryPar: alphas in sigma.dat are inconsistent !");
931
932 for (int i = 0; i < np; ++i) {
933 m_Sigma[iCL][iLR][ialpha][itheta][i] = sigma[i];
934 }
935 } //end of while loop
936
937 ifs.close();
938
939 //convert unit
940 const double degrad = M_PI / 180.;
941 for (unsigned i = 0; i < nAlphaBins; ++i) {
942 m_alphaPoints4Sgm[i] *= degrad;
943 }
944 for (unsigned i = 0; i < nThetaBins; ++i) {
945 m_thetaPoints4Sgm[i] *= degrad;
946 }
947
948}
const std::string & getSigmaFile() const
Get input file name for sigma.
virtual std::string getString(const std::string &path="") const noexcept(false) override
Get the parameter path as a string.
Definition GearDir.h:69
void openFileA(std::ifstream &ifs, const std::string &fileName0)
Open a file.
Definition OpenFile.cc:25

◆ newReadXT()

void newReadXT ( const GearDir & gbxParams,
int mode = 0 )

Read XT-relation table in new format.

Parameters
[in]gbxParamsGear Dir.
[in]mode0: read simulation file, 1: read reconstruction file.

Definition at line 721 of file CDCGeometryPar.cc.

722{
723 m_linearInterpolationOfXT = true; //must be true now
724
725 std::string fileName0 = CDCGeoControlPar::getInstance().getXtFile();
726 if (mode == 1) {
727 fileName0 = gbxParams.getString("xt4ReconFileName");
728 }
729
730 boost::iostreams::filtering_istream ifs;
731 openFileB(ifs, fileName0);
732
733 //read alpha bin info.
734 unsigned short nAlphaBins = 0;
735 if (ifs >> nAlphaBins) {
736 if (nAlphaBins == 0 || nAlphaBins > c_maxNAlphaPoints) B2FATAL("Fail to read alpha bins !");
737 } else {
738 B2FATAL("Fail to read alpha bins !");
739 }
740 m_nAlphaPoints = nAlphaBins;
741 double alpha0, alpha1, alpha2;
742 for (unsigned short i = 0; i < nAlphaBins; ++i) {
743 ifs >> alpha0 >> alpha1 >> alpha2;
744 m_alphaPoints[i] = alpha2;
745 }
746
747 //read theta bin info.
748 unsigned short nThetaBins = 0;
749 if (ifs >> nThetaBins) {
750 if (nThetaBins == 0 || nThetaBins > c_maxNThetaPoints) B2FATAL("CDCGeometryPar: fail to read theta bins !");
751 } else {
752 B2FATAL("CDCGeometryPar: fail to read theta bins !");
753 }
754 m_nThetaPoints = nThetaBins;
755 double theta0, theta1, theta2;
756
757 for (unsigned short i = 0; i < nThetaBins; ++i) {
758 ifs >> theta0 >> theta1 >> theta2;
759 m_thetaPoints[i] = theta2;
760 }
761
762 short np = 0;
763 unsigned short iCL, iLR;
764 const unsigned short npx = c_nXTParams - 1;
765 double xtc[npx];
766 double theta, alpha, dummy1;
767
768 ifs >> m_xtParamMode >> np;
769 if (m_xtParamMode < 0 || m_xtParamMode > 3) B2FATAL("CDCGeometryPar: invalid xt-parameterization mode read !");
770
771 if (np <= 0 || np > npx) B2FATAL("CDCGeometryPar: no. of xt-params. outside limits !");
772
773 const double epsi = 0.1;
774
775 while (ifs >> iCL) {
776
777 if (iCL < m_firstLayerOffset) {
778 continue;
779 }
780
781 ifs >> theta >> alpha >> dummy1 >> iLR;
782 for (int i = 0; i < np; ++i) {
783 ifs >> xtc[i];
784 }
785
786 int itheta = -99;
787 for (unsigned short i = 0; i < nThetaBins; ++i) {
788 if (fabs(theta - m_thetaPoints[i]) < epsi) {
789 itheta = i;
790 break;
791 }
792 }
793 if (itheta < 0) B2FATAL("CDCGeometryPar: thetas in xt.dat are inconsistent !");
794
795 int ialpha = -99;
796 for (unsigned short i = 0; i < nAlphaBins; ++i) {
797 if (fabs(alpha - m_alphaPoints[i]) < epsi) {
798 ialpha = i;
799 break;
800 }
801 }
802 if (ialpha < 0) B2FATAL("CDCGeometryPar: alphas in xt.dat are inconsistent !");
803
804 for (int i = 0; i < np; ++i) {
805 m_XT[iCL][iLR][ialpha][itheta][i] = xtc[i];
806 }
807
808 double boundT = xtc[6];
809 if (m_xtParamMode == 1) {
810 m_XT[iCL][iLR][ialpha][itheta][np] = ROOT::Math::Chebyshev5(boundT, xtc[0], xtc[1], xtc[2], xtc[3], xtc[4], xtc[5]);
811 } else {
812 m_XT[iCL][iLR][ialpha][itheta][np] =
813 xtc[0] + boundT
814 * (xtc[1] + boundT
815 * (xtc[2] + boundT
816 * (xtc[3] + boundT
817 * (xtc[4] + boundT
818 * (xtc[5])))));
819 }
820 } //end of while loop
821
822 boost::iostreams::close(ifs);
823
824 //convert unit
825 const double degrad = M_PI / 180.;
826 for (unsigned i = 0; i < nAlphaBins; ++i) {
827 m_alphaPoints[i] *= degrad;
828 }
829 for (unsigned i = 0; i < nThetaBins; ++i) {
830 m_thetaPoints[i] *= degrad;
831 }
832
833}
const std::string & getXtFile() const
Get input file name for xt-relation.
void openFileB(boost::iostreams::filtering_istream &ifs, const std::string &fileName0)
Open a file using boost (to be able to read a gzipped file)
Definition OpenFile.cc:44

◆ nShifts()

int nShifts ( int layerId) const
inline

Returns number shift.

Parameters
layerIdThe layer id of sense wires.
Returns
The shifted cell number in layer layerId.

Definition at line 1272 of file CDCGeometryPar.h.

1273 {
1274 return m_nShifts[layerID];
1275 }

◆ nWireLayers()

unsigned nWireLayers ( )
inlinestatic

Returns a number of wire layers.

Returns
The number of wire layers.

Definition at line 1382 of file CDCGeometryPar.h.

1383 {
1384 return c_maxNSenseLayers;
1385 }

◆ nWiresInLayer()

unsigned nWiresInLayer ( int layerId) const
inline

Returns wire numbers in a layer.

Parameters
layerIdThe layer id.
Returns
Wire number in layer layerId.

Definition at line 1282 of file CDCGeometryPar.h.

1283 {
1284 return m_nWires[layerID];
1285 }

◆ offset()

double offset ( int layerID) const
inline

Return wire offset in phi direction at endplate.

Parameters
layerIDlayerID(0-55).
Returns
offset value.

Definition at line 1277 of file CDCGeometryPar.h.

1278 {
1279 return m_offSet[layerID];
1280 }

◆ outerRadiusInnerWall()

double outerRadiusInnerWall ( ) const
inline

Returns the outer radius of the inner wall.

Returns
The outer radius of the inner wall.

Definition at line 1352 of file CDCGeometryPar.h.

1353 {
1354 return m_rWall[1];
1355 }

◆ outerRadiusOuterWall()

double outerRadiusOuterWall ( ) const
inline

Returns the outer radius of the outer wall.

Returns
The outer radius of the outer wall.

Definition at line 1337 of file CDCGeometryPar.h.

1338 {
1339 return m_rWall[3];
1340 }

◆ outerRadiusWireLayer()

const double * outerRadiusWireLayer ( ) const

Returns an array of outer radius of wire layers.

Returns
A array of outer radius of wire layers.

Definition at line 1609 of file CDCGeometryPar.cc.

1610{
1611 static double ORWL[c_maxNSenseLayers] = {0};
1612
1613 ORWL[nWireLayers() - 1] = innerRadiusOuterWall();
1614 for (unsigned i = 0; i < nWireLayers() - 1; i++)
1615 ORWL[i] = m_rFLayer[i];
1616
1617 return ORWL;
1618}

◆ outputDesignWirParam()

void outputDesignWirParam ( unsigned layerID,
unsigned cellID ) const

Write the designed wire parameters to the alignment.dat (default).

Parameters
[in]layerIDLayer ID
[in]cellIDCell ID

Definition at line 1862 of file CDCGeometryPar.cc.

1863{
1864
1865 const unsigned L = layerID;
1866 const unsigned C = cellID;
1867
1868 static bool first = true;
1869 static ofstream ofs;
1870 if (first) {
1871 first = false;
1872 ofs.open("alignment.dat");
1873 }
1874
1875 ofs << L << " " << C;
1876
1877 ofs << setiosflags(ios::showpoint | ios::uppercase);
1878
1879 for (int i = 0; i < 3; ++i) ofs << " " << setw(15) << setprecision(8) << m_BWirPos[L][C][i];
1880
1881 for (int i = 0; i < 3; ++i) ofs << " " << setw(15) << setprecision(8) << m_FWirPos[L][C][i];
1882 ofs << setiosflags(ios::fixed);
1883 ofs << " " << setw(4) << setprecision(1) << m_senseWireTension;
1884
1885 ofs << endl;
1886}

◆ Print()

void Print ( )
static

Print some debug information.

Definition at line 1488 of file CDCGeometryPar.cc.

1489{}

◆ readChMap()

void readChMap ( )

Read channel map between wire-id and electronics-id.

Definition at line 1076 of file CDCGeometryPar.cc.

1077{
1078 std::string fileName0 = CDCGeoControlPar::getInstance().getChMapFile();
1079
1080 ifstream ifs;
1081 // openFile(ifs, fileName0);
1082 openFileA(ifs, fileName0);
1083
1084 unsigned short iSL, iL, iW, iB, iC;
1085 unsigned nRead = 0;
1086
1087 while (true) {
1088 // Read a relation
1089 ifs >> iSL >> iL >> iW >> iB >> iC;
1090 if (ifs.eof()) break;
1091 if (iSL >= c_nSuperLayers or iSL < m_firstSuperLayerOffset) continue;
1092
1093 ++nRead;
1094 WireID wID(iSL, iL, iW);
1095 m_wireToBoard.insert(pair<WireID, unsigned short>(wID, iB));
1096 }
1097
1098 if (nRead != m_nSenseWires) B2FATAL("CDCGeometryPar::readChMap: #lines read-in (=" << nRead <<
1099 ") is inconsistent with #sense-wires (="
1100 << m_nSenseWires << ") !");
1101
1102 ifs.close();
1103}
const std::string & getChMapFile() const
Get input file name for channel map.
ushort m_nSenseWires
Maximum number of Sense Wires.
std::map< WireID, unsigned short > m_wireToBoard
map relating wire-id and board-id.
ushort m_firstSuperLayerOffset
Offset of the first super layer (for reduced CDC studies)

◆ readEDepToADC()

void readEDepToADC ( const GearDir & gbxParams,
int mode = 0 )

Read spatial edep-to-adc conv.

factors.

Parameters
gbxParamsGear Dir.
modedummy now..

Definition at line 1107 of file CDCGeometryPar.cc.

1108{
1109 std::string fileName0 = CDCGeoControlPar::getInstance().getEDepToADCFile();
1110 if (mode == 1) {
1111 fileName0 = gbxParams.getString("fudgeFactorFileName");
1112 }
1113
1114 ifstream ifs;
1115 std::string fileName1 = "/data/cdc/" + fileName0;
1116 std::string fileName = FileSystem::findFile(fileName1, true);
1117
1118 if (fileName == "") {
1119 fileName = FileSystem::findFile(fileName0, true);
1120 }
1121
1122 if (fileName == "") {
1123 B2FATAL("CDC::openFile: " << fileName0 << " not exist!");
1124 } else {
1125 B2DEBUG(29, "CDC::openFile: open " << fileName);
1126 ifs.open(fileName.c_str());
1127 if (!ifs) B2FATAL("CDC::openFile: cannot open " << fileName << " !");
1128 }
1129
1130 unsigned short paramMode(0), nParams(0);
1131 ifs >> paramMode >> nParams;
1132 if (paramMode > 1) B2FATAL("Param mode > 1!");
1133 if (nParams > 7) B2FATAL("No. of params. > 7!");
1134 unsigned short groupId(0);
1135 ifs >> groupId;
1136 B2DEBUG(29, paramMode << " " << nParams << " " << groupId);
1137 if (groupId > 0) B2FATAL("GgroupId > 0!");
1138
1139 unsigned short cLMin[c_nSuperLayers], cLMax[c_nSuperLayers]; //min and max clayer per super-layer
1140 cLMin[0] = 0;
1141 cLMax[0] = 7;
1142 for (unsigned int sl = 1; sl < c_nSuperLayers; ++sl) {
1143 cLMin[sl] = cLMax[0] + 6 * sl - 5;
1144 cLMax[sl] = cLMax[0] + 6 * sl;
1145 }
1146
1147 unsigned short id = 0;
1148 double coef = 0.;
1149 unsigned short nRead = 0;
1150 while (ifs >> id) {
1151 for (unsigned short i = 0; i < nParams; ++i) {
1152 ifs >> coef;
1153 for (unsigned short cL = cLMin[id]; cL <= cLMax[id]; ++cL) { //clayer loop
1154 for (unsigned short cell = 0; cell < m_nWires[cL]; ++cell) { //cell loop
1155 m_eDepToADCParams[cL][cell][i] = (cL < m_firstLayerOffset) ? 0 : coef;
1156 }
1157 }
1158 }
1159 ++nRead;
1160 if (nRead > c_nSuperLayers) B2FATAL("No. of read in lines > " << c_nSuperLayers << " !");
1161 }
1162
1163 ifs.close();
1164}
const std::string & getEDepToADCFile() const
Get input file name for edeptoadc.
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...

◆ readFFactor()

void readFFactor ( const GearDir & gbxParams,
int mode = 0 )
static

Read fudge factors.

Parameters
gbxParamsGear Dir.
modedummy now.

Definition at line 952 of file CDCGeometryPar.cc.

953{
954 std::string fileName0 = CDCGeoControlPar::getInstance().getFFactorFile();
955 if (mode == 1) {
956 fileName0 = gbxParams.getString("fudgeFactorFileName");
957 }
958 B2WARNING("readFFactor is not ready! " << fileName0);
959 //TODO; implement the following part.
960}
const std::string & getFFactorFile() const
Get input file name for fudge factor.

◆ readFromDB()

void readFromDB ( const CDCGeometry & geom)

Gets geometry parameters from database.

Definition at line 241 of file CDCGeometryPar.cc.

242{
243 m_globalPhiRotation = geom.getGlobalPhiRotation();
244
245 // Get inner wall parameters
246 m_rWall[0] = geom.getInnerWall(2).getRmin();
247 m_zWall[0][0] = geom.getInnerWall(0).getZbwd();
248 m_zWall[0][1] = geom.getInnerWall(0).getZfwd();
249
250 m_rWall[1] = geom.getInnerWall(0).getRmax();
251 m_zWall[1][0] = geom.getInnerWall(0).getZbwd();
252 m_zWall[1][1] = geom.getInnerWall(0).getZbwd();
253
254 // Get outer wall parameters
255 m_rWall[2] = geom.getOuterWall(0).getRmin();
256 m_zWall[2][0] = geom.getOuterWall(0).getZbwd();
257 m_zWall[2][1] = geom.getOuterWall(0).getZfwd();
258
259 m_rWall[3] = geom.getOuterWall(1).getRmax();
260 m_zWall[3][0] = geom.getOuterWall(0).getZbwd();
261 m_zWall[3][1] = geom.getOuterWall(0).getZfwd();
262
263 // Get sense layers parameters
265 m_nSLayer = geom.getNSenseLayers();
266
268 if (m_materialDefinitionMode == 0) {
269 B2DEBUG(100, "CDCGeometryPar: Define a mixture of gases and wires in the tracking volume.");
270 } else if (m_materialDefinitionMode == 2) {
271 B2FATAL("CDCGeometryPar: Materialdefinition=2 is disabled for now.");
272 } else {
273 B2FATAL("CDCGeometryPar: Materialdefinition mode you specify is invalid.");
274 }
275
276 // Get mode for wire z-position
278 //Set z corrections (from input data)
279 B2DEBUG(100, "CDCGeometryPar: Sense wire z mode:" << m_senseWireZposMode);
280
281 //
282 // The DB version should be implemented ASAP.
283 //
284 GearDir content = GearDir("/Detector/DetectorComponent[@name=\"CDC\"]/Content/");
285 GearDir gbxParams(content);
286
287 //
288 // Sense wires.
289 //
290 for (const auto& sense : geom.getSenseLayers()) {
291 uint layerId = sense.getId();
292
293 m_rSLayer[layerId] = sense.getR();
294 m_zSBackwardLayer[layerId] = sense.getZbwd();
295 m_zSForwardLayer[layerId] = sense.getZfwd();
296 m_nWires[layerId] = sense.getNWires();
297 m_nShifts[layerId] = sense.getNShifts();
298 m_offSet[layerId] = sense.getOffset();
299 m_cellSize[layerId] = 2 * M_PI * m_rSLayer[layerId] / (double) m_nWires[layerId];
300 m_dzSBackwardLayer[layerId] = sense.getDZbwd();
301 m_dzSForwardLayer[layerId] = sense.getDZfwd();
302
303 //correction to z-position
304 if (m_senseWireZposMode == 0) {
305 } else if (m_senseWireZposMode == 1) {
306 m_zSBackwardLayer[layerId] += m_dzSBackwardLayer[layerId];
307 m_zSForwardLayer [layerId] -= m_dzSForwardLayer [layerId];
308 } else {
309 B2FATAL("CDCGeometryPar: invalid wire z definition mode specified");
310 }
311
312 //Set design sense-wire related params.
313 const int nWires = m_nWires[layerId];
314 for (int iCell = 0; iCell < nWires; ++iCell) {
315 setDesignWirParam(layerId, iCell);
316 }
317
318 }
319
320 // Get field layers parameters
321 for (const auto& field : geom.getFieldLayers()) {
322 uint layerId = field.getId();
323
324 m_rFLayer[layerId] = field.getR();
325 m_zFBackwardLayer[layerId] = field.getZbwd();
326 m_zFForwardLayer[layerId] = field.getZfwd();
327 }
328
329 // Get sense wire diameter
330 m_senseWireDiameter = geom.getSenseDiameter();
331
332 // Get sense wire tension
333 m_senseWireTension = geom.getSenseTension();
334
335 // // Get sense wire density
336 m_senseWireDensity = 19.3; // g/cm3 <- tentatively hard-coded here
337
338 // Get field wire diameter
339 m_fieldWireDiameter = geom.getFieldDiameter();
340
341 // Get information on the number of (super) layers etc.
342 m_nSenseWires = geom.getNSenseWires();
343 m_nFieldWires = geom.getNFieldWires();
344 m_maxNSenseLayers = geom.getNumberOfSenseLayers();
345 m_maxNFieldLayers = geom.getNumberOfFieldLayers();
346 m_maxNSuperLayers = geom.getMaxNumberOfSuperLayers();
347 m_firstLayerOffset = geom.getOffsetOfFirstLayer();
348 m_firstSuperLayerOffset = geom.getOffsetOfFirstSuperLayer();
349 m_maxNCellsPerLayer = geom.getMaxNumberOfCellsPerLayer();
350
351 //Set various quantities (should be moved to CDC.xml later...)
352 m_clockFreq4TDC = geom.getClockFrequency();
353 if (not m_clockSettings.isValid())
354 B2FATAL("HardwareClockSettings payloads are not valid.");
355 const double officialClockFreq4TDC = 2 * m_clockSettings->getAcceleratorRF(); // in GHz
356 if (abs(m_clockFreq4TDC - officialClockFreq4TDC) / m_clockFreq4TDC > 1.e-4) {
357 B2WARNING("ClockFreq4TDC changed from cdclocal " << scientific << setprecision(6) << m_clockFreq4TDC << " to official " <<
358 officialClockFreq4TDC << " (GHz) (difference larger than 0.01%)");
359 m_clockFreq4TDC = officialClockFreq4TDC;
360 }
361 B2DEBUG(100, "CDCGeometryPar: Clock freq. for TDC= " << m_clockFreq4TDC << " (GHz).");
362 m_tdcBinWidth = 1. / m_clockFreq4TDC; //in ns
363 B2DEBUG(100, "CDCGeometryPar: TDC bin width= " << m_tdcBinWidth << " (ns).");
364
365 m_nominalDriftV = 4.e-3; //in cm/ns
366 m_nominalDriftVInv = 1. / m_nominalDriftV; //in ns/cm
367 m_nominalPropSpeed = 27.25; //in cm/nsec (Belle's result, provided by iwasaki san)
368
369 m_nominalSpaceResol = geom.getNominalSpaceResolution();
370 CDCGeoControlPar& gcp = CDCGeoControlPar::getInstance();
371
372 //Set displacement params. (from input data)
374 B2DEBUG(100, "CDCGeometryPar: Load displacement params. (=1); not load (=0):" << m_displacement);
375 if (m_displacement) {
376 if (gcp.getDisplacementInputType()) {
377 B2DEBUG(100, "CDCGeometryPar: Read displacement from DB");
379 } else {
380 readWirePositionParams(c_Base, &geom);
381 }
382 }
383
384 //Set alignment params. (from input data)
386 B2DEBUG(100, "CDCGeometryPar: Load alignment params. (=1); not load (=0):" <<
388 if (m_alignment) {
389 if (gcp.getAlignmentInputType()) {
390 B2DEBUG(100, "CDCGeometryPar: Read alignment from DB");
392 } else {
393 readWirePositionParams(c_Aligned, &geom);
394 }
395 }
396
397 //Set misalignment params. (from input data)
399 B2DEBUG(100, "CDCGeometryPar: Load misalignment params. (=1); not load (=0):" <<
401 if (m_misalignment) {
402 if (gcp.getMisalignmentInputType()) {
403 B2DEBUG(100, "CDCGeometryPar: Read misalignment from DB");
405 } else {
406 readWirePositionParams(c_Misaligned, &geom);
407 }
408 }
409
410 // Get control params. for CDC FullSim
415 if (m_modLeftRightFlag) {
416 B2FATAL("ModifiedLeftRightFlag = true is disabled for now; need to update a G4-related code in framework...");
417 }
418 //N.B. The following two lines are hard-coded since only =1 are used now.
419 m_xtFileFormat = 1;
421
422 m_XTetc = true;
423 if (m_XTetc) {
424 if (gcp.getXtInputType()) {
425 B2DEBUG(100, "CDCGeometryPar: Read xt from DB");
426 setXtRel(); //Set xt param. (from DB)
427 } else {
428 readXT(gbxParams); //Read xt params. (from file)
429 }
430
431 if (gcp.getSigmaInputType()) {
432 B2DEBUG(100, "CDCGeometryPar: Read sigma from DB");
433 setSResol(); //Set sigma param. (from DB)
434 } else {
435 readSigma(gbxParams); //Read sigma params. (from file)
436 }
437
438 if (gcp.getFFactorInputType()) {
439 B2DEBUG(100, "CDCGeometryPar: Read fudge factors from DB");
440 setFFactor(); //Set fudge factors (from DB)
441 } else {
442 readFFactor(gbxParams); //Read fudge factors (from file)
443 }
444
445 if (gcp.getPropSpeedInputType()) {
446 B2DEBUG(100, "CDCGeometryPar: Read prop-speed from DB");
447 setPropSpeed(); //Set prop-speed (from DB)
448 } else {
449 readPropSpeed(gbxParams); //Read propagation speed
450 }
451
452 if (gcp.getT0InputType()) {
453 B2DEBUG(100, "CDCGeometryPar: Read t0 from DB");
454 setT0(); //Set t0 (from DB)
455 } else {
456 readT0(gbxParams); //Read t0 (from file)
457 }
458
459 if (gcp.getBwInputType()) {
460 B2DEBUG(100, "CDCGeometryPar: Read badwire from DB");
461 setBadWire(); //Set bad-wire (from DB)
462 } else {
463 // readBadWire(gbxParams); //Read bad-wire (from file)
464 B2FATAL("Text file input mode for bdwires is disabled now!");
465 }
466
467 if (gcp.getChMapInputType()) {
468 B2DEBUG(100, "CDCGeometryPar: Read ch-map from DB");
469 setChMap(); //Set ch-map (from DB)
470 } else {
471 readChMap(); //Read ch-map
472 }
473
474 if (gcp.getTwInputType()) {
475 B2DEBUG(100, "CDCGeometryPar: Read time-walk from DB");
476 setTW(); //Set time-walk coeffs. (from DB)
477 } else {
478 readTW(gbxParams); //Read time-walk coeffs. (from file)
479 }
480 B2DEBUG(100, "CDCGeometryPar: Time-walk param. mode= " << m_twParamMode);
481
482 if (gcp.getEDepToADCInputType()) {
483 B2DEBUG(29, "CDCGeometryPar: Read EDepToADC from DB");
484 if ((*m_eDepToADCConversionsFromDB).isValid()) {
485 setEDepToADCConversions(); //Set edep-to-adc (from DB)
486 }
487 } else {
488 readEDepToADC(gbxParams); //Read edep-to-adc params. (from file)
489 }
490 }
491
492 m_XTetc4Recon = 0;
493 if (m_XTetc4Recon) {
494 readXT(gbxParams, 1);
495 readSigma(gbxParams, 1);
496 readPropSpeed(gbxParams, 1);
497 readT0(gbxParams, 1);
498 readTW(gbxParams, 1);
499 }
500
501 //calculate and save shifts in super-layers
503
504}
bool getDebug() const
Get debug flag.
double getMaterialDefinitionMode() const
Get material definition mode.
bool getAlignment() const
Get alignment switch.
bool getDisplacement() const
Get displacement switch.
int getSenseWireZposMode() const
Get sense wire z position mode.
int m_materialDefinitionMode
Control switch for gas and wire material definition.
void readSigma(const GearDir &gbxParams, int mode=0)
Read spatial resolution table.
void readTW(const GearDir &gbxParams, int mode=0)
Read time-walk parameter.
void readT0(const GearDir &gbxParams, int mode=0)
Read t0 parameters (from a file).
ushort m_maxNSuperLayers
Maximum number of Super Layers.
bool m_alignment
Switch for alignment.
void readEDepToADC(const GearDir &gbxParams, int mode=0)
Read spatial edep-to-adc conv.
void setDesignWirParam(unsigned layerID, unsigned cellID)
Set the desizend wire parameters.
bool m_XTetc
Switch for reading x-t etc.
void setShiftInSuperLayer()
Calculates and saves shifts in super-layers (to be used in searching hits in neighboring cells)
bool m_wireSag
Switch for sense wire sag.
bool m_XTetc4Recon
Switch for selecting xt etc.
DBObjPtr< HardwareClockSettings > m_clockSettings
hardware clock settings
double m_minTrackLength
Minimum track length for G4 step.
bool m_debug
Switch for debug printing.
ushort m_maxNSenseLayers
Maximum number of Sense Wire Layers.
void readWirePositionParams(EWirePosition set, const CDCGeometry *geom)
Read displacement or (mis)alignment params from text file.
bool m_displacement
Switch for displacement.
int m_twParamMode
Mode for tw parameterization.
void readPropSpeed(const GearDir &gbxParams, int mode=0)
Read the propagation speed along the sense wire.
int m_xtFileFormat
Format of xt input file.
int m_sigmaFileFormat
Format of sigma input file.
void readChMap()
Read channel map between wire-id and electronics-id.
ushort m_nFieldWires
Maximum number of Field Wires.
ushort m_maxNCellsPerLayer
Maximum number wires within a layer.
ushort m_maxNFieldLayers
Maximum number of Field Wire Layers.
bool m_misalignment
Switch for misalignment.
static void readFFactor(const GearDir &gbxParams, int mode=0)
Read fudge factors.
double m_thresholdEnergyDeposit
Energy thresh.
void readXT(const GearDir &gbxParams, int mode=0)
Read XT-relation table.
int m_senseWireZposMode
Mode for sense wire z position corr.
bool m_modLeftRightFlag
Switch for modified left/right flag.
bool getModLeftRightFlag() const
Get modified left/right flag.
double getMinTrackLength() const
Get minimum track length.
double getThresholdEnergyDeposit() const
Get threshold for Energy Deposit;.
static CDCSimControlPar & getInstance()
Static method to get a reference to the CDCSimControlPar instance.
bool getWireSag() const
Get wiresag flag.

◆ readPropSpeed()

void readPropSpeed ( const GearDir & gbxParams,
int mode = 0 )

Read the propagation speed along the sense wire.

Parameters
gbxParamsGear Dir.
mode0: read simulation file, 1: read reconstruction file.

Definition at line 964 of file CDCGeometryPar.cc.

965{
966 std::string fileName0 = CDCGeoControlPar::getInstance().getPropSpeedFile();
967 if (mode == 1) {
968 fileName0 = gbxParams.getString("propSpeed4ReconFileName");
969 }
970
971 ifstream ifs;
972 openFileA(ifs, fileName0);
973
974 uint iL;
975 double speed;
976 unsigned nRead = 0;
977
978 while (true) {
979 ifs >> iL >> speed;
980 if (ifs.eof()) break;
981
982 ++nRead;
983
984 m_propSpeedInv[iL] = (iL < m_firstLayerOffset) ? 0 : 1. / speed;
985
986 if (m_debug) B2DEBUG(150, iL << " " << speed);
987 }
988
989 if (nRead != c_maxNSenseLayers) B2FATAL("CDCGeometryPar::readPropSpeed: #lines read-in (=" << nRead <<
990 ") is inconsistent with total #layers (=" << c_maxNSenseLayers << ") !");
991
992 ifs.close();
993}
const std::string & getPropSpeedFile() const
Get input file name for prop-speed.

◆ readSigma()

void readSigma ( const GearDir & gbxParams,
int mode = 0 )

Read spatial resolution table.

Parameters
gbxParamsGear Dir.
mode0: read simulation file, 1: read reconstruction file.

Definition at line 837 of file CDCGeometryPar.cc.

838{
839 if (m_sigmaFileFormat == 0) {
840 return;
841 } else {
842 newReadSigma(gbxParams, mode);
843 }
844}
void newReadSigma(const GearDir &gbxParams, int mode=0)
Read spatial resolution table in new format.

◆ readT0()

void readT0 ( const GearDir & gbxParams,
int mode = 0 )

Read t0 parameters (from a file).

Parameters
gbxParamsGear Dir.
mode0: read simulation file, 1: read reconstruction file.

Definition at line 996 of file CDCGeometryPar.cc.

997{
998 std::string fileName0 = CDCGeoControlPar::getInstance().getT0File();
999 if (mode == 1) {
1000 fileName0 = gbxParams.getString("t04ReconFileName");
1001 }
1002
1003 ifstream ifs;
1004 openFileA(ifs, fileName0);
1005
1006 uint iL(0), iC(0);
1007 float t0(0);
1008 unsigned nRead = 0;
1009
1010 while (true) {
1011 ifs >> iL >> iC >> t0;
1012
1013 if (iL < m_firstLayerOffset) {
1014 continue;
1015 }
1016
1017 if (ifs.eof()) break;
1018
1019 ++nRead;
1020
1021 m_t0[iL][iC] = (iL < m_firstLayerOffset) ? 0. : t0;
1022
1023 if (m_debug) {
1024 B2DEBUG(150, iL << " " << iC << " " << t0);
1025 }
1026 }
1027
1028 if (nRead != m_nSenseWires) B2FATAL("CDCGeometryPar::readT0: #lines read-in (=" << nRead <<
1029 ") is inconsistent with total #sense wires (=" << m_nSenseWires << ") !");
1030
1031 ifs.close();
1032
1033 calcMeanT0();
1034}
const std::string & getT0File() const
Get input file name for t0.
void calcMeanT0(double minT0=3800, double maxT0=5800, int maxIt=10, double nStdv=3, double epsi=0.1)
Calculate mean t0 in ns (over all good wires)

◆ readTW()

void readTW ( const GearDir & gbxParams,
int mode = 0 )

Read time-walk parameter.

Parameters
gbxParamsGear Dir.
mode0: read simulation file, 1: read reconstruction file.

Definition at line 1038 of file CDCGeometryPar.cc.

1039{
1040 std::string fileName0 = CDCGeoControlPar::getInstance().getTwFile();
1041 if (mode == 1) {
1042 fileName0 = gbxParams.getString("tw4ReconFileName");
1043 }
1044
1045 ifstream ifs;
1046 openFileA(ifs, fileName0);
1047
1048 unsigned short nPars(0);
1049 ifs >> m_twParamMode >> nPars;
1050 if (m_twParamMode > 1) {
1051 B2FATAL("CDCGeometryPar::readTW: invalid mode specified!");
1052 }
1053 if (nPars > 2) {
1054 B2FATAL("CDCGeometryPar::readTW: invalid #params specified!");
1055 }
1056
1057 unsigned iBoard = 0;
1058 unsigned nRead = 0;
1059 // Read board id and coefficients
1060 while (ifs >> iBoard) {
1061 for (unsigned short i = 0; i < nPars; ++i) {
1062 ifs >> m_timeWalkCoef[iBoard][i];
1063 }
1064 ++nRead;
1065 }
1066
1067 if (nRead != c_nBoards) B2FATAL("CDCGeometryPar::readTW: #lines read-in (=" << nRead << ") is inconsistent with #boards (=" <<
1068 c_nBoards
1069 << ") !");
1070
1071 ifs.close();
1072}
const std::string & getTwFile() const
Get input file name for time-walk.

◆ readWirePositionParams()

void readWirePositionParams ( EWirePosition set,
const CDCGeometry * geom )

Read displacement or (mis)alignment params from text file.

Parameters
[in]setWire position set, i.e. c_Base, c_Misaliged or c_Aligned.
[in]geomPointer to DB CDCGeometry db object.

Definition at line 507 of file CDCGeometryPar.cc.

508{
509
510 std::string fileName0;
511 const CDCGeoControlPar& gcp = CDCGeoControlPar::getInstance();
512 if (geom) {
513 if (set == c_Base) {
514 fileName0 = gcp.getDisplacementFile();
515 } else if (set == c_Misaligned) {
516 fileName0 = gcp.getMisalignmentFile();
517 } else if (set == c_Aligned) {
518 fileName0 = gcp.getAlignmentFile();
519 }
520 } else {
521 if (set == c_Base) {
522 fileName0 = gcp.getDisplacementFile();
523 } else if (set == c_Misaligned) {
524 fileName0 = gcp.getMisalignmentFile();
525 } else if (set == c_Aligned) {
526 fileName0 = gcp.getAlignmentFile();
527 }
528 }
529
530 boost::iostreams::filtering_istream ifs;
531 openFileB(ifs, fileName0);
532
533 uint iL(0), iC(0);
534 const int np = 3;
535 double back[np], fwrd[np], tension;
536 unsigned nRead = 0;
537
538 while (true) {
539 ifs >> iL >> iC;
540 for (int i = 0; i < np; ++i) {
541 ifs >> back[i];
542 }
543 for (int i = 0; i < np; ++i) {
544 ifs >> fwrd[i];
545 }
546 // if (set != c_Base) ifs >> tension;
547 ifs >> tension;
548
549 if (ifs.eof()) break;
550
551 if (iL < m_firstLayerOffset) {
552 continue;
553 }
554
555 ++nRead;
556
557 for (int i = 0; i < np; ++i) {
558 if (set == c_Base) {
559 m_BWirPos[iL][iC][i] += (iL < m_firstLayerOffset) ? 0 : back[i];
560 m_FWirPos[iL][iC][i] += (iL < m_firstLayerOffset) ? 0 : fwrd[i];
561 } else if (set == c_Misaligned) {
562 m_BWirPosMisalign[iL][iC][i] = m_BWirPos[iL][iC][i] + ((iL < m_firstLayerOffset) ? 0 : back[i]);
563 m_FWirPosMisalign[iL][iC][i] = m_FWirPos[iL][iC][i] + ((iL < m_firstLayerOffset) ? 0 : fwrd[i]);
564 } else if (set == c_Aligned) {
565 m_BWirPosAlign[iL][iC][i] = m_BWirPos[iL][iC][i] + ((iL < m_firstLayerOffset) ? 0 : back[i]);
566 m_FWirPosAlign[iL][iC][i] = m_FWirPos[iL][iC][i] + ((iL < m_firstLayerOffset) ? 0 : fwrd[i]);
567 }
568 }
569
570 // double baseTension = 0.;
571
572 if (set == c_Base) {
574 (8.*(m_senseWireTension + tension));
575 } else if (set == c_Misaligned) {
576 double baseTension = M_PI * m_senseWireDensity * m_senseWireDiameter * m_senseWireDiameter / (8.* m_WireSagCoef[iL][iC]);
578 m_senseWireDiameter / (8.* (baseTension + tension));
579 } else if (set == c_Aligned) {
580 double baseTension = M_PI * m_senseWireDensity * m_senseWireDiameter * m_senseWireDiameter / (8.* m_WireSagCoef[iL][iC]);
582 m_senseWireDiameter / (8.*(baseTension + tension));
583 }
584 }
585
586 if (nRead != m_nSenseWires) B2FATAL("CDCGeometryPar::readWirePositionParams: #lines read-in (=" << nRead <<
587 ") is inconsistent with total #sense wires (=" << m_nSenseWires << ") !");
588
589 boost::iostreams::close(ifs);
590}
const std::string & getDisplacementFile() const
Get input file name for wire displacement.
const std::string & getAlignmentFile() const
Get input file name for wire alignment.
const std::string & getMisalignmentFile() const
Get input file name for wire misalignment.

◆ readXT()

void readXT ( const GearDir & gbxParams,
int mode = 0 )

Read XT-relation table.

Parameters
[in]gbxParamsGear Dir.
[in]mode0: read simulation file, 1: read reconstruction file.

Definition at line 710 of file CDCGeometryPar.cc.

711{
712 if (m_xtFileFormat == 0) {
713 return;
714 } else {
715 newReadXT(gbxParams, mode);
716 }
717}
void newReadXT(const GearDir &gbxParams, int mode=0)
Read XT-relation table in new format.

◆ senseWireBZ()

double senseWireBZ ( int layerId) const
inline

Returns backward z position of sense wire in each layer.

Parameters
layerIdThe layer id.
Returns
The backward z position of sense wire in layer layerId.

Definition at line 1312 of file CDCGeometryPar.h.

1313 {
1314 return m_zSBackwardLayer[layerID];
1315 }

◆ senseWireDiameter()

double senseWireDiameter ( ) const
inline

Returns diameter of the sense wire.

Returns
Diameter of the sense wire.

Definition at line 1372 of file CDCGeometryPar.h.

1373 {
1374 return m_senseWireDiameter;
1375 }

◆ senseWireFZ()

double senseWireFZ ( int layerId) const
inline

Returns forward z position of sense wire in each layer.

Parameters
layerIdThe layer id.
Returns
The forward z position of sense wire in layer layerId.

Definition at line 1307 of file CDCGeometryPar.h.

1308 {
1309 return m_zSForwardLayer[layerID];
1310 }

◆ senseWireR()

double senseWireR ( int layerId) const
inline

Returns radius of sense wire in each layer.

Parameters
layerIdThe layer id.
Returns
The radius of sense wire in layer layerId.

Definition at line 1302 of file CDCGeometryPar.h.

1303 {
1304 return m_rSLayer[layerID];
1305 }

◆ setBadBoard()

void setBadBoard ( )

Set bad-boards (from DB)

Definition at line 1235 of file CDCGeometryPar.cc.

1236{
1237 calcMeanT0();
1238}

◆ setBadWire()

void setBadWire ( )

Set bad-wires (from DB)

Definition at line 1228 of file CDCGeometryPar.cc.

1229{
1230 // m_badWire = (*m_badWireFromDB)->getWires();
1231 calcMeanT0();
1232}

◆ setChMap()

void setChMap ( )

Set channel map (from DB)

Definition at line 1386 of file CDCGeometryPar.cc.

1387{
1388 for (const auto& cm : (*m_chMapFromDB)) {
1389 const unsigned short isl = cm.getISuperLayer();
1390 if (isl >= c_nSuperLayers or isl < m_firstSuperLayerOffset) continue;
1391 const uint il = cm.getILayer();
1392 const int iw = cm.getIWire();
1393 const int iBd = cm.getBoardID();
1394 const WireID wID(isl, il, iw);
1395 m_wireToBoard.insert(pair<WireID, unsigned short>(wID, iBd));
1396 const int iCh = cm.getBoardChannel();
1397 m_wireToChannel.insert(pair<WireID, unsigned short>(wID, iCh));
1398 m_boardAndChannelToWire[iBd][iCh] = wID.getEWire();
1399 }
1400}
std::map< WireID, unsigned short > m_wireToChannel
map relating wire-id and channel-id.

◆ setDesignWirParam()

void setDesignWirParam ( unsigned layerID,
unsigned cellID )

Set the desizend wire parameters.

Parameters
[in]layerIDLayer ID
[in]cellIDCell ID

Definition at line 1826 of file CDCGeometryPar.cc.

1827{
1828 const unsigned L = layerID;
1829 const unsigned C = cellID;
1830
1831 const double offSet = m_offSet[L];
1832 //...Offset modification to be aligned to axial at z=0...
1833 const double phiSize = 2 * M_PI / double(m_nWires[L]);
1834
1835 const double phiF = phiSize * (double(C) + offSet)
1836 + phiSize * 0.5 * double(m_nShifts[L]) + m_globalPhiRotation;
1837
1838 m_FWirPos[L][C][0] = (L < m_firstLayerOffset) ? 0. : m_rSLayer[L] * cos(phiF);
1839 m_FWirPos[L][C][1] = (L < m_firstLayerOffset) ? 0. : m_rSLayer[L] * sin(phiF);
1840 m_FWirPos[L][C][2] = (L < m_firstLayerOffset) ? 0. : m_zSForwardLayer[L];
1841
1842 const double phiB = phiSize * (double(C) + offSet) + m_globalPhiRotation;
1843
1844 m_BWirPos[L][C][0] = (L < m_firstLayerOffset) ? 0. : m_rSLayer[L] * cos(phiB);
1845 m_BWirPos[L][C][1] = (L < m_firstLayerOffset) ? 0. : m_rSLayer[L] * sin(phiB);
1846 m_BWirPos[L][C][2] = (L < m_firstLayerOffset) ? 0. : m_zSBackwardLayer[L];
1847
1848 for (int i = 0; i < 3; ++i) {
1849 m_FWirPosMisalign[L][C][i] = (L < m_firstLayerOffset) ? 0. : m_FWirPos[L][C][i];
1850 m_BWirPosMisalign[L][C][i] = (L < m_firstLayerOffset) ? 0. : m_BWirPos[L][C][i];
1851 m_FWirPosAlign [L][C][i] = (L < m_firstLayerOffset) ? 0. : m_FWirPos[L][C][i];
1852 m_BWirPosAlign [L][C][i] = (L < m_firstLayerOffset) ? 0. : m_BWirPos[L][C][i];
1853 }
1854
1856 (8. * m_senseWireTension);
1857 m_WireSagCoefMisalign[L][C] = (L < m_firstLayerOffset) ? 0. : m_WireSagCoef[L][C];
1858 m_WireSagCoefAlign [L][C] = (L < m_firstLayerOffset) ? 0. : m_WireSagCoef[L][C];
1859
1860}

◆ setDisplacement()

void setDisplacement ( )

Set displacement of sense wire.

Definition at line 2616 of file CDCGeometryPar.cc.

2617{
2618 for (const auto& disp : (*m_displacementFromDB)) {
2619 const int iLayer = WireID(disp.getEWire()).getICLayer();
2620 const int iWire = WireID(disp.getEWire()).getIWire();
2621 m_FWirPos[iLayer][iWire][0] += (iLayer < m_firstLayerOffset) ? 0. : disp.getXFwd();
2622 m_FWirPos[iLayer][iWire][1] += (iLayer < m_firstLayerOffset) ? 0. : disp.getYFwd();
2623 m_FWirPos[iLayer][iWire][2] += (iLayer < m_firstLayerOffset) ? 0. : disp.getZFwd();
2624 m_BWirPos[iLayer][iWire][0] += (iLayer < m_firstLayerOffset) ? 0. : disp.getXBwd();
2625 m_BWirPos[iLayer][iWire][1] += (iLayer < m_firstLayerOffset) ? 0. : disp.getYBwd();
2626 m_BWirPos[iLayer][iWire][2] += (iLayer < m_firstLayerOffset) ? 0. : disp.getZBwd();
2627 m_WireSagCoef[iLayer][iWire] = (iLayer < m_firstLayerOffset) ? 0. : M_PI * m_senseWireDensity * m_senseWireDiameter *
2628 m_senseWireDiameter / (8.*
2629 (m_senseWireTension + disp.getTension()));
2630 }
2631}

◆ setEDepToADCConversions()

void setEDepToADCConversions ( )

Set edep-to-ADC conversion params.

(from DB)

Definition at line 1403 of file CDCGeometryPar.cc.

1404{
1405 unsigned short groupId = (*m_eDepToADCConversionsFromDB)->getGroupID();
1406 unsigned short nEnt = (*m_eDepToADCConversionsFromDB)->getEntries();
1407 if (groupId == 0) { //per super-layer mode
1408 if (nEnt > c_nSuperLayers) B2FATAL("CDCGeometryPar:: group-id " << groupId << " and #entries " << nEnt << " are inconsistent!");
1409 } else if (groupId == 1) { //per layer mode
1410 if (nEnt > c_maxNSenseLayers) B2FATAL("CDCGeometryPar:: group-id " << groupId << " and #entries " << nEnt << " are inconsistent!");
1411 } else {
1412 B2FATAL("CDCGeometryPar:: Invalid group-id " << groupId << " specified !");
1413 }
1414
1415 unsigned short cLMin[c_nSuperLayers], cLMax[c_nSuperLayers]; //min and max clayer per super-layer
1416 cLMin[0] = 0;
1417 cLMax[0] = 7;
1418 for (unsigned int sl = 1; sl < c_nSuperLayers; ++sl) {
1419 cLMin[sl] = cLMax[0] + 6 * sl - 5;
1420 cLMax[sl] = cLMax[0] + 6 * sl;
1421 }
1422
1423 for (unsigned short id = 0; id < nEnt; ++id) {
1424 unsigned short np = ((*m_eDepToADCConversionsFromDB)->getParams(id)).size();
1425 if (np > 7) B2FATAL("CDCGeometryPar:: No. of edep-to-ADC conversion params. > 7");
1426 if (groupId == 0) { //per super-layer; id=super-layer
1427 for (unsigned short cL = cLMin[id]; cL <= cLMax[id]; ++cL) { //clayer loop
1428 for (unsigned short cell = 0; cell < m_nWires[cL]; ++cell) { //cell loop
1429 for (unsigned short i = 0; i < np; ++i) {
1430 m_eDepToADCParams[cL][cell][i] = (cL < m_firstLayerOffset) ? 0. : ((*m_eDepToADCConversionsFromDB)->getParams(id))[i];
1431 }
1432 }
1433 }
1434 } else if (groupId == 1) { //per clayer; id=clayer
1435 for (unsigned short cell = 0; cell < m_nWires[id]; ++cell) { //cell loop
1436 for (unsigned short i = 0; i < np; ++i) {
1437 m_eDepToADCParams[id][cell][i] = (id < m_firstLayerOffset) ? 0. : ((*m_eDepToADCConversionsFromDB)->getParams(id))[i];
1438 }
1439 }
1440 } else if (groupId == 2) { //per wire
1441 //not ready
1442 B2FATAL("CDCGeometryPar::setEDepToADCConversions(): groupId=2 not ready!");
1443 }
1444 }
1445}

◆ setFFactor()

void setFFactor ( )

Set fudge factors (from DB).

Definition at line 1358 of file CDCGeometryPar.cc.

1359{
1360 unsigned short groupId = (*m_fFactorFromDB)->getGroupID();
1361 unsigned short nEnt = (*m_fFactorFromDB)->getEntries();
1362 B2DEBUG(29, "setFFactor called: groupId,nEnt= " << groupId << " " << nEnt);
1363
1364 if (groupId == 0) { //per all-layers mode
1365 } else {
1366 B2FATAL("CDCGeometryPar:: Invalid group-id " << groupId << " specified!");
1367 }
1368
1369 for (unsigned short id = 0; id < nEnt; ++id) {
1370 unsigned short np = ((*m_fFactorFromDB)->getFactors(id)).size();
1371 if (np != 3) B2FATAL("CDCGeometryPar:: No. of fudge factors != 3!");
1372 for (unsigned short i = 0; i < np; ++i) {
1373 m_fudgeFactorForSigma[i] = ((*m_fFactorFromDB)->getFactors(id))[i];
1374 B2DEBUG(29, i << " " << m_fudgeFactorForSigma[i]);
1375 }
1376 }
1377
1378 const CDCGeoControlPar& gcp = CDCGeoControlPar::getInstance();
1381 B2DEBUG(29, "fudge factors= " << m_fudgeFactorForSigma[0] << " " << m_fudgeFactorForSigma[1] << " " << m_fudgeFactorForSigma[2]);
1382}
double getAddFudgeFactorForSigmaForMC() const
Get additional fudge factor for space resol for MC.
double getAddFudgeFactorForSigmaForData() const
Get additional fudge factor for space resol for data.
double m_fudgeFactorForSigma[3]
Fuge factor for space resol.

◆ setNominalSpaceResol()

void setNominalSpaceResol ( double resol)
inline

Set the nominal spatial resolution in the unit of um.

Parameters
[in]resolspatial resolution (um)

Definition at line 825 of file CDCGeometryPar.h.

826 {
827 m_nominalSpaceResol = resol;
828 }

◆ setPropSpeed()

void setPropSpeed ( )

Set prop.

-speeds (from DB).

Definition at line 1241 of file CDCGeometryPar.cc.

1242{
1243 for (unsigned short iCL = 0; iCL < (*m_propSpeedFromDB)->getEntries(); ++iCL) {
1244 m_propSpeedInv[iCL] = (iCL < m_firstLayerOffset) ? 0. : 1. / (*m_propSpeedFromDB)->getSpeed(iCL);
1245 }
1246}

◆ setSenseWireBZ()

void setSenseWireBZ ( int layerId,
double bz )
inline

set backward z position of sense wires.

Parameters
layerIdThe layer id of sense wire.
bzThe backward position of sense wires in layer layerId.

Definition at line 1297 of file CDCGeometryPar.h.

1298 {
1299 m_zSBackwardLayer[layerId] = bz;
1300 }

◆ setSenseWireFZ()

void setSenseWireFZ ( int layerId,
double fz )
inline

Set forward z position of sense wires.

Parameters
layerIdThe layer id of sense wire.
fzThe forward position of sense wires in layer layerId.

Definition at line 1292 of file CDCGeometryPar.h.

1293 {
1294 m_zSForwardLayer[layerId] = fz;
1295 }

◆ setSenseWireR()

void setSenseWireR ( int layerId,
double r )
inline

Set radius of sense wire in each layer.

Parameters
layerIdThe layer id of sense wires.
rThe radius of sense wires in layer layerId.

Definition at line 1287 of file CDCGeometryPar.h.

1288 {
1289 m_rSLayer[layerId] = r;
1290 }

◆ setShiftInSuperLayer()

void setShiftInSuperLayer ( )

Calculates and saves shifts in super-layers (to be used in searching hits in neighboring cells)

Definition at line 2634 of file CDCGeometryPar.cc.

2635{
2636 const unsigned short nLayers[c_nSuperLayers] = {8, 6, 6, 6, 6, 6, 6, 6, 6}; //tentative
2637
2638 for (unsigned short SLayer = 0; SLayer < c_nSuperLayers; ++SLayer) {
2639 unsigned short firstCLayer = 0;
2640 for (unsigned short i = 0; i < SLayer; ++i) {
2641 firstCLayer += nLayers[i];
2642 }
2643
2644 B2Vector3D firstBPos = wireBackwardPosition(firstCLayer, 0);
2645 for (unsigned short Layer = 0; Layer < nLayers[SLayer]; ++Layer) {
2646 unsigned short CLayer = firstCLayer + Layer;
2647
2648 if (CLayer == firstCLayer) {
2649 m_shiftInSuperLayer[SLayer][Layer] = 0;
2650
2651 } else if (CLayer == firstCLayer + 1) {
2652 B2Vector3D BPos = wireBackwardPosition(CLayer, 0);
2653 m_shiftInSuperLayer[SLayer][Layer] = (BPos.Cross(firstBPos)).Z() > 0. ? -1 : 1;
2654
2655 } else {
2656 if (Layer % 2 == 0) {
2657 m_shiftInSuperLayer[SLayer][Layer] = 0;
2658 } else {
2659 m_shiftInSuperLayer[SLayer][Layer] = m_shiftInSuperLayer[SLayer][1];
2660 }
2661 }
2662 }
2663 }
2664}
const B2Vector3D wireBackwardPosition(uint layerId, int cellId, EWirePosition set=c_Base) const
Returns the backward position of the input sense wire.

◆ setSResol()

void setSResol ( )

Set spatial resolution (from DB).

Definition at line 1321 of file CDCGeometryPar.cc.

1322{
1323 m_linearInterpolationOfSgm = true; //must be true now
1324
1325 m_nAlphaPoints4Sgm = (*m_sResolFromDB)->getNoOfAlphaBins();
1326 for (unsigned short i = 0; i < m_nAlphaPoints4Sgm; ++i) {
1327 m_alphaPoints4Sgm[i] = (*m_sResolFromDB)->getAlphaPoint(i);
1328 }
1329
1330 m_nThetaPoints4Sgm = (*m_sResolFromDB)->getNoOfThetaBins();
1331 for (unsigned short i = 0; i < m_nThetaPoints4Sgm; ++i) {
1332 m_thetaPoints4Sgm[i] = (*m_sResolFromDB)->getThetaPoint(i);
1333 }
1334
1335 m_sigmaParamMode = (*m_sResolFromDB)->getSigmaParamMode();
1336
1337 m_maxSpaceResol = (*m_sResolFromDB)->getMaxSpaceResol();
1338
1339 for (unsigned short iCL = 0; iCL < c_maxNSenseLayers; ++iCL) {
1340 for (unsigned short iLR = 0; iLR < 2; ++iLR) {
1341 for (unsigned short iA = 0; iA < m_nAlphaPoints4Sgm; ++iA) {
1342 for (unsigned short iT = 0; iT < m_nThetaPoints4Sgm; ++iT) {
1343 const std::vector<float> params = (*m_sResolFromDB)->getSigmaParams(iCL, iLR, iA, iT);
1344 unsigned short np = params.size();
1345 // std::cout <<"np4sigma= " << np << std::endl;
1346 for (unsigned short i = 0; i < np; ++i) {
1347 m_Sigma[iCL][iLR][iA][iT][i] = (iCL < m_firstLayerOffset) ? 0. : params[i];
1348 }
1349 }
1350 }
1351 }
1352 }
1353
1354}

◆ setT0()

void setT0 ( )

Set t0 parameters (from DB)

Definition at line 1168 of file CDCGeometryPar.cc.

1169{
1170 for (unsigned short iCL = 0; iCL < c_maxNSenseLayers; ++iCL) {
1171 for (unsigned short iW = 0; iW < c_maxNDriftCells; ++iW) {
1172 m_t0[iCL][iW] = 0.;
1173 }
1174 }
1175
1176 for (auto const& ent : (*m_t0FromDB)->getT0s()) {
1177 const WireID wid = WireID(ent.first);
1178 const unsigned short iCL = wid.getICLayer();
1179 const unsigned short iW = wid.getIWire();
1180 m_t0[iCL][iW] = (iCL < m_firstLayerOffset) ? 0. : ent.second;
1181 }
1182
1183 calcMeanT0();
1184}
unsigned short getICLayer() const
Getter for continuous layer numbering.
Definition WireID.cc:24
unsigned short getIWire() const
Getter for wire within the layer.
Definition WireID.h:145

◆ setTW()

void setTW ( )

Set time-walk parameters.

Definition at line 1250 of file CDCGeometryPar.cc.

1251{
1252 // (*m_timeWalkFromDB)->dump();
1253 m_twParamMode = (*m_timeWalkFromDB)->getTwParamMode();
1254
1255 for (unsigned short iBd = 0; iBd < (*m_timeWalkFromDB)->getEntries(); ++iBd) {
1256 int np = ((*m_timeWalkFromDB)->getTimeWalkParams(iBd)).size();
1257 for (int i = 0; i < np; ++i) {
1258 m_timeWalkCoef[iBd][i] = ((*m_timeWalkFromDB)->getTimeWalkParams(iBd))[i];
1259 }
1260 }
1261}

◆ setWirPosAlignParams()

void setWirPosAlignParams ( )

Set wire alignment params.

from DB.

Definition at line 594 of file CDCGeometryPar.cc.

595{
596 // Layer alignment
597 for (unsigned iL = 0; iL < c_maxNSenseLayers; ++iL) {
598
599 if (iL < m_firstLayerOffset) {
600 continue;
601 }
602
603 // wire number 511 = no wire
604 auto layerID = WireID(iL, 511);
605
606 // Alignment parameters for layer iL
607 double d_layerXbwd = (*m_alignmentFromDB)->get(layerID, CDCAlignment::layerX);
608 double d_layerYbwd = (*m_alignmentFromDB)->get(layerID, CDCAlignment::layerY);
609 double d_layerPhiBwd = (*m_alignmentFromDB)->get(layerID, CDCAlignment::layerPhi);
610
611 double d_layerXfwd = (*m_alignmentFromDB)->get(layerID, CDCAlignment::layerDx) + d_layerXbwd;
612 double d_layerYfwd = (*m_alignmentFromDB)->get(layerID, CDCAlignment::layerDy) + d_layerYbwd;
613 double d_layerPhiFwd = (*m_alignmentFromDB)->get(layerID, CDCAlignment::layerDPhi) + d_layerPhiBwd;
614
615 for (unsigned iC = 0; iC < m_nWires[iL]; ++iC) {
616 // Positions (nominal+displacement) of wire-ends of wire iC in layer iL
617 double wireXbwd = m_BWirPos[iL][iC][0];
618 double wireYbwd = m_BWirPos[iL][iC][1];
619 double wireZbwd = m_BWirPos[iL][iC][2];
620
621 double wireXfwd = m_FWirPos[iL][iC][0];
622 double wireYfwd = m_FWirPos[iL][iC][1];
623 double wireZfwd = m_FWirPos[iL][iC][2];
624
625 // Aligned positions of wire-ends are obtained by rotating "nominal+displacement" positions and shifting them using
626 // common parameters for layer rotation and shifts (at corresponding end-caps)
627 m_BWirPosAlign[iL][iC][0] = d_layerXbwd + cos(d_layerPhiBwd) * wireXbwd + sin(d_layerPhiBwd) * wireYbwd;
628 m_BWirPosAlign[iL][iC][1] = d_layerYbwd - sin(d_layerPhiBwd) * wireXbwd + cos(d_layerPhiBwd) * wireYbwd;
629 m_BWirPosAlign[iL][iC][2] = wireZbwd;
630
631 m_FWirPosAlign[iL][iC][0] = d_layerXfwd + cos(d_layerPhiFwd) * wireXfwd + sin(d_layerPhiFwd) * wireYfwd;
632 m_FWirPosAlign[iL][iC][1] = d_layerYfwd - sin(d_layerPhiFwd) * wireXfwd + cos(d_layerPhiFwd) * wireYfwd;
633 m_FWirPosAlign[iL][iC][2] = wireZfwd;
634 } //end of cell loop
635 } //end of layer loop
636
637 const int np = 3;
638 double back[np], fwrd[np];
639
640 for (unsigned iL = 0; iL < c_maxNSenseLayers; ++iL) {
641
642 if (iL < m_firstLayerOffset) {
643 continue;
644 }
645
646 for (unsigned iC = 0; iC < m_nWires[iL]; ++iC) {
647 WireID wire(iL, iC);
648 back[0] = (*m_alignmentFromDB)->get(wire, CDCAlignment::wireBwdX);
649 back[1] = (*m_alignmentFromDB)->get(wire, CDCAlignment::wireBwdY);
650 back[2] = (*m_alignmentFromDB)->get(wire, CDCAlignment::wireBwdZ);
651
652 fwrd[0] = (*m_alignmentFromDB)->get(wire, CDCAlignment::wireFwdX);
653 fwrd[1] = (*m_alignmentFromDB)->get(wire, CDCAlignment::wireFwdY);
654 fwrd[2] = (*m_alignmentFromDB)->get(wire, CDCAlignment::wireFwdZ);
655
656 for (int i = 0; i < np; ++i) {
657 // On top of the wire-end positions corrected for layer alignment, we apply possible
658 // fine corrections per wire
659 m_BWirPosAlign[iL][iC][i] += back[i];
660 m_FWirPosAlign[iL][iC][i] += fwrd[i];
661 }
662
663 double baseTension = M_PI * m_senseWireDensity * m_senseWireDiameter * m_senseWireDiameter / (8.* m_WireSagCoef[iL][iC]);
664 double tension = (*m_alignmentFromDB)->get(wire, CDCAlignment::wireTension);
665 m_WireSagCoefAlign[iL][iC] = M_PI * m_senseWireDensity *
666 m_senseWireDiameter * m_senseWireDiameter / (8.*(baseTension + tension));
667 } //end of layer loop
668 } //end of cell loop
669}
static const baseType layerDPhi
Layer rotation in global X-Y plane (gamma) dPhi = forward - backward endplate.
static const baseType layerDy
Layer shift in global Y dY = forward - backward endplate.
static const baseType wireBwdZ
Wire Z position w.r.t. nominal on backward endplate.
static const baseType layerDx
Layer shift in global X dX = forward - backward endplate.
static const baseType wireBwdY
Wire Y position w.r.t. nominal on backward endplate.
static const baseType wireFwdZ
Wire Z position w.r.t. nominal on forward endplate.
static const baseType wireFwdY
Wire Y position w.r.t. nominal on forward endplate.
static const baseType wireFwdX
Wire X position w.r.t. nominal on forward endplate.
static const baseType wireBwdX
Wire X position w.r.t. nominal on backward endplate.
static const baseType layerY
Layer shift in global Y at backward endplate.
static const baseType layerX
Layer shift in global X at backward endplate.
static const baseType layerPhi
Layer rotation in global X-Y plane (gamma) at backward endplate.
static const baseType wireTension
Wire tension w.r.t. nominal (=50. ?)

◆ setWirPosMisalignParams()

void setWirPosMisalignParams ( )

Set wire misalignment params.

from DB.

Definition at line 674 of file CDCGeometryPar.cc.

675{
676 const int np = 3;
677 double back[np], fwrd[np];
678
679 for (unsigned iL = 0; iL < c_maxNSenseLayers; ++iL) {
680
681 if (iL < m_firstLayerOffset) {
682 continue;
683 }
684
685 for (unsigned iC = 0; iC < m_nWires[iL]; ++iC) {
686 WireID wire(iL, iC);
687 back[0] = (*m_misalignmentFromDB)->get(wire, CDCMisalignment::wireBwdX);
688 back[1] = (*m_misalignmentFromDB)->get(wire, CDCMisalignment::wireBwdY);
689 back[2] = (*m_misalignmentFromDB)->get(wire, CDCMisalignment::wireBwdZ);
690
691 fwrd[0] = (*m_misalignmentFromDB)->get(wire, CDCMisalignment::wireFwdX);
692 fwrd[1] = (*m_misalignmentFromDB)->get(wire, CDCMisalignment::wireFwdY);
693 fwrd[2] = (*m_misalignmentFromDB)->get(wire, CDCMisalignment::wireFwdZ);
694
695 for (int i = 0; i < np; ++i) {
696 m_BWirPosMisalign[iL][iC][i] = m_BWirPos[iL][iC][i] + back[i];
697 m_FWirPosMisalign[iL][iC][i] = m_FWirPos[iL][iC][i] + fwrd[i];
698 }
699
700 double baseTension = M_PI * m_senseWireDensity * m_senseWireDiameter * m_senseWireDiameter / (8.* m_WireSagCoef[iL][iC]);
701 double tension = (*m_misalignmentFromDB)->get(wire, CDCMisalignment::wireTension);
703 m_senseWireDiameter * m_senseWireDiameter / (8.*(baseTension + tension));
704 } //end of layer loop
705 } //end of cell loop
706}
static const baseType wireBwdZ
Wire Z position w.r.t. nominal on backward endplate.
static const baseType wireBwdY
Wire Y position w.r.t. nominal on backward endplate.
static const baseType wireFwdZ
Wire Z position w.r.t. nominal on forward endplate.
static const baseType wireFwdY
Wire Y position w.r.t. nominal on forward endplate.
static const baseType wireFwdX
Wire X position w.r.t. nominal on forward endplate.
static const baseType wireBwdX
Wire X position w.r.t. nominal on backward endplate.
static const baseType wireTension
Wire tension w.r.t. nominal (=50. ?)

◆ setXtRel()

void setXtRel ( )

Set XT-relation table (from DB) (new).

Definition at line 1265 of file CDCGeometryPar.cc.

1266{
1267 m_linearInterpolationOfXT = true; //must be true now
1268
1269 m_nAlphaPoints = (*m_xtRelFromDB)->getNoOfAlphaBins();
1270 for (unsigned short i = 0; i < m_nAlphaPoints; ++i) {
1271 m_alphaPoints[i] = (*m_xtRelFromDB)->getAlphaPoint(i);
1272 }
1273
1274 m_nThetaPoints = (*m_xtRelFromDB)->getNoOfThetaBins();
1275 for (unsigned short i = 0; i < m_nThetaPoints; ++i) {
1276 m_thetaPoints[i] = (*m_xtRelFromDB)->getThetaPoint(i);
1277 // std::cout << m_thetaPoints[i]*180./M_PI << std::endl;
1278 }
1279
1280 m_xtParamMode = (*m_xtRelFromDB)->getXtParamMode();
1281
1282 for (unsigned short iCL = 0; iCL < c_maxNSenseLayers; ++iCL) {
1283 if (iCL < m_firstLayerOffset) {
1284 // m_XT is initialized to 0, but reading
1285 // (*m_xtRelFromDB)->getXtParams(iCL, iLR, iA, iT)
1286 // could fail if iCL < m_firstLayerOffset, thus continue as m_XT would be set to 0 in this case anyway
1287 continue;
1288 }
1289 for (unsigned short iLR = 0; iLR < 2; ++iLR) {
1290 for (unsigned short iA = 0; iA < m_nAlphaPoints; ++iA) {
1291 for (unsigned short iT = 0; iT < m_nThetaPoints; ++iT) {
1292 const std::vector<float> params = (*m_xtRelFromDB)->getXtParams(iCL, iLR, iA, iT);
1293 unsigned short np = params.size();
1294 // std::cout <<"np4xt= " << np << std::endl;
1295 for (unsigned short i = 0; i < np; ++i) {
1296 m_XT[iCL][iLR][iA][iT][i] = params[i];
1297 }
1298
1299 double boundT = m_XT[iCL][iLR][iA][iT][6];
1300 if (m_xtParamMode == 1) {
1301 m_XT[iCL][iLR][iA][iT][np] = ROOT::Math::Chebyshev5(boundT, m_XT[iCL][iLR][iA][iT][0], m_XT[iCL][iLR][iA][iT][1],
1302 m_XT[iCL][iLR][iA][iT][2], m_XT[iCL][iLR][iA][iT][3], m_XT[iCL][iLR][iA][iT][4], m_XT[iCL][iLR][iA][iT][5]);
1303 } else {
1304 m_XT[iCL][iLR][iA][iT][np] =
1305 m_XT[iCL][iLR][iA][iT][0] + boundT
1306 * (m_XT[iCL][iLR][iA][iT][1] + boundT
1307 * (m_XT[iCL][iLR][iA][iT][2] + boundT
1308 * (m_XT[iCL][iLR][iA][iT][3] + boundT
1309 * (m_XT[iCL][iLR][iA][iT][4] + boundT
1310 * (m_XT[iCL][iLR][iA][iT][5])))));
1311 }
1312 }
1313 }
1314 }
1315 }
1316
1317}

◆ version()

const std::string & version ( ) const
inline

Returns the version of cdc geometry parameters.

Returns
The version of the cdc geometry parameters.

Definition at line 1257 of file CDCGeometryPar.h.

1258 {
1259 return m_version;
1260 }

◆ wireBackwardPosition() [1/4]

const B2Vector3D wireBackwardPosition ( const WireID & wireID,
double z,
EWirePosition set = c_Base ) const
inline

The same function but in a different input format.

Definition at line 510 of file CDCGeometryPar.h.

511 {
512 return wireBackwardPosition(wireID.getICLayer(), wireID.getIWire(), z, set);
513 }

◆ wireBackwardPosition() [2/4]

const B2Vector3D wireBackwardPosition ( const WireID & wireID,
EWirePosition set = c_Base ) const
inline

The same function but in a different input format.

Definition at line 495 of file CDCGeometryPar.h.

496 {
497 return wireBackwardPosition(wireID.getICLayer(), wireID.getIWire(), set);
498 }

◆ wireBackwardPosition() [3/4]

const B2Vector3D wireBackwardPosition ( uint layerId,
int cellId,
double z,
EWirePosition set = c_Base ) const

Returns a virtual backward position corresp. to a tangent to the wire at the input z-position.

Parameters
layerIdThe layer id. of the wire
cellIdThe wire id. of the wire
zz-position
setWire position set; =c_Base, c_Misaligned or c_Aligned
Returns
The virtual backward position of the wire.

Definition at line 1563 of file CDCGeometryPar.cc.

1564{
1565 // return early in case of empty layer, i.e. layerID < m_firstLayerOffset
1566 if (layerID < m_firstLayerOffset) {
1567 return B2Vector3D(0, 0, 0);
1568 }
1569
1570 double yb_sag = 0.;
1571 double yf_sag = 0.;
1572 getWireSagEffect(set, layerID, cellID, z, yb_sag, yf_sag);
1573
1574 B2Vector3D wPos(m_BWirPosAlign[layerID][cellID][0], yb_sag,
1575 m_BWirPosAlign[layerID][cellID][2]);
1576 if (set == c_Misaligned) {
1577 wPos.SetX(m_BWirPosMisalign[layerID][cellID][0]);
1578 wPos.SetZ(m_BWirPosMisalign[layerID][cellID][2]);
1579 } else if (set == c_Base) {
1580 wPos.SetX(m_BWirPos [layerID][cellID][0]);
1581 wPos.SetZ(m_BWirPos [layerID][cellID][2]);
1582 }
1583
1584 return wPos;
1585}
void getWireSagEffect(EWirePosition set, unsigned layerID, unsigned cellID, double zw, double &ywb_sag, double &ywf_sag) const
Compute effects of the sense wire sag.

◆ wireBackwardPosition() [4/4]

const B2Vector3D wireBackwardPosition ( uint layerId,
int cellId,
EWirePosition set = c_Base ) const

Returns the backward position of the input sense wire.

Parameters
layerIdThe layer id. of the wire
cellIdThe wire id. of the wire
setWire position set; =c_Base, c_Misaligned or c_Aligned
Returns
The backward position of the wire.

Definition at line 1539 of file CDCGeometryPar.cc.

1540{
1541 // return early in case of empty layer, i.e. layerID < m_firstLayerOffset
1542 if (layerID < m_firstLayerOffset) {
1543 return B2Vector3D(0, 0, 0);
1544 }
1545
1546 B2Vector3D wPos(m_BWirPosAlign[layerID][cellID][0],
1547 m_BWirPosAlign[layerID][cellID][1],
1548 m_BWirPosAlign[layerID][cellID][2]);
1549
1550 if (set == c_Misaligned) {
1551 wPos.SetX(m_BWirPosMisalign[layerID][cellID][0]);
1552 wPos.SetY(m_BWirPosMisalign[layerID][cellID][1]);
1553 wPos.SetZ(m_BWirPosMisalign[layerID][cellID][2]);
1554 } else if (set == c_Base) {
1555 wPos.SetX(m_BWirPos [layerID][cellID][0]);
1556 wPos.SetY(m_BWirPos [layerID][cellID][1]);
1557 wPos.SetZ(m_BWirPos [layerID][cellID][2]);
1558 }
1559
1560 return wPos;
1561}

◆ wireForwardPosition() [1/4]

const B2Vector3D wireForwardPosition ( const WireID & wireID,
double z,
EWirePosition set = c_Base ) const
inline

The same function but in a different input format.

Definition at line 479 of file CDCGeometryPar.h.

481 {
482 return wireForwardPosition(wireID.getICLayer(), wireID.getIWire(), z, set);
483 }

◆ wireForwardPosition() [2/4]

const B2Vector3D wireForwardPosition ( const WireID & wireID,
EWirePosition set = c_Base ) const
inline

The same function but in a different input format.

Definition at line 464 of file CDCGeometryPar.h.

465 {
466 return wireForwardPosition(wireID.getICLayer(), wireID.getIWire(), set);
467 }

◆ wireForwardPosition() [3/4]

const B2Vector3D wireForwardPosition ( uint layerId,
int cellId,
double z,
EWirePosition set = c_Base ) const

Returns a virtual forward position corresp. to a tangent to the wire at the input z-position.

Parameters
layerIdThe layer id. of the wire
cellIdThe wire id. of the wire
zz-position
setWire position set; =c_Base, c_Misaligned or c_Aligned
Returns
The virtual forward position of the wire.

Definition at line 1515 of file CDCGeometryPar.cc.

1516{
1517 // return early in case of empty layer, i.e. layerID < m_firstLayerOffset
1518 if (layerID < m_firstLayerOffset) {
1519 return B2Vector3D(0, 0, 0);
1520 }
1521
1522 double yb_sag = 0.;
1523 double yf_sag = 0.;
1524 getWireSagEffect(set, layerID, cellID, z, yb_sag, yf_sag);
1525
1526 B2Vector3D wPos(m_FWirPosAlign[layerID][cellID][0], yf_sag,
1527 m_FWirPosAlign[layerID][cellID][2]);
1528 if (set == c_Misaligned) {
1529 wPos.SetX(m_FWirPosMisalign[layerID][cellID][0]);
1530 wPos.SetZ(m_FWirPosMisalign[layerID][cellID][2]);
1531 } else if (set == c_Base) {
1532 wPos.SetX(m_FWirPos [layerID][cellID][0]);
1533 wPos.SetZ(m_FWirPos [layerID][cellID][2]);
1534 }
1535
1536 return wPos;
1537}

◆ wireForwardPosition() [4/4]

const B2Vector3D wireForwardPosition ( uint layerId,
int cellId,
EWirePosition set = c_Base ) const

Returns the forward position of the input sense wire.

Parameters
layerIdThe layer id. of the wire
cellIdThe wire id. of the wire
setWire position set; =c_Base, c_Misaligned or c_Aligned
Returns
The forward position of the wire.

Definition at line 1491 of file CDCGeometryPar.cc.

1492{
1493 // return early in case of empty layer, i.e. layerID < m_firstLayerOffset
1494 if (layerID < m_firstLayerOffset) {
1495 return B2Vector3D(0, 0, 0);
1496 }
1497
1498 B2Vector3D wPos(m_FWirPosAlign[layerID][cellID][0],
1499 m_FWirPosAlign[layerID][cellID][1],
1500 m_FWirPosAlign[layerID][cellID][2]);
1501
1502 if (set == c_Misaligned) {
1503 wPos.SetX(m_FWirPosMisalign[layerID][cellID][0]);
1504 wPos.SetY(m_FWirPosMisalign[layerID][cellID][1]);
1505 wPos.SetZ(m_FWirPosMisalign[layerID][cellID][2]);
1506 } else if (set == c_Base) {
1507 wPos.SetX(m_FWirPos [layerID][cellID][0]);
1508 wPos.SetY(m_FWirPos [layerID][cellID][1]);
1509 wPos.SetZ(m_FWirPos [layerID][cellID][2]);
1510 }
1511
1512 return wPos;
1513}

◆ zBackwardWireLayer()

const double * zBackwardWireLayer ( ) const
inline

Returns an array of backward z of wire layers.

Returns
An array of backward z.

Definition at line 1392 of file CDCGeometryPar.h.

1393 {
1394 return m_zSBackwardLayer;
1395 }

◆ zForwardWireLayer()

const double * zForwardWireLayer ( ) const
inline

Returns an array of forward z of wire layers.

Returns
An array of forward z.

Definition at line 1387 of file CDCGeometryPar.h.

1388 {
1389 return m_zSForwardLayer;
1390 }

◆ zInnerWall()

double zInnerWall ( ) const
inline

Returns the length of the inner wall in Z.

Returns
The length of the inner wall.

Definition at line 1357 of file CDCGeometryPar.h.

1358 {
1359 return (m_zWall[0][1] - m_zWall[0][0]);
1360 }

◆ zOffsetInnerWall()

double zOffsetInnerWall ( ) const
inline

Returns the offset of the outer wall in z direction.

Returns
The z offset of the outer wall.

Definition at line 1367 of file CDCGeometryPar.h.

1368 {
1369 return (m_zWall[0][0] + zInnerWall() / 2);
1370 }

◆ zOffsetOuterWall()

double zOffsetOuterWall ( ) const
inline

Returns the offset of the outer wall in z direction.

Returns
The z offset of the outer wall.

Definition at line 1362 of file CDCGeometryPar.h.

1363 {
1364 return (m_zWall[2][0] + zOuterWall() / 2);
1365 }

◆ zOffsetWireLayer()

double zOffsetWireLayer ( unsigned i) const
inline

Returns the offset of z of the wire layer i.

Parameters
iThe layer id.
Returns
The z offset of wire layer i.

Definition at line 1397 of file CDCGeometryPar.h.

1398 {
1399 return (m_zSBackwardLayer[i] + (m_zSForwardLayer[i] - m_zSBackwardLayer[i]) / 2);
1400 }

◆ zOuterWall()

double zOuterWall ( ) const
inline

Returns the length of the outer wall in Z.

Returns
The length of the outer wall.

Definition at line 1342 of file CDCGeometryPar.h.

1343 {
1344 return (m_zWall[2][1] - m_zWall[2][0]);
1345 }

Member Data Documentation

◆ m_alignment

bool m_alignment
private

Switch for alignment.

Definition at line 1131 of file CDCGeometryPar.h.

◆ m_alignmentFromDB

DBObjPtr<CDCAlignment>* m_alignmentFromDB
private

alignment params.

retrieved from DB.

Definition at line 1235 of file CDCGeometryPar.h.

◆ m_alphaPoints

float m_alphaPoints[c_maxNAlphaPoints]
private

alpha sampling points for xt (rad)

Definition at line 1198 of file CDCGeometryPar.h.

◆ m_alphaPoints4Sgm

float m_alphaPoints4Sgm[c_maxNAlphaPoints]
private

alpha sampling points for sigma (rad)

Definition at line 1200 of file CDCGeometryPar.h.

◆ m_B4CDCGeometryParDB

CDCGeometryPar * m_B4CDCGeometryParDB = 0
staticprivate

Pointer that saves the instance of this class.

Definition at line 1241 of file CDCGeometryPar.h.

◆ m_badBoardsFromDB

DBObjPtr<CDCBadBoards>* m_badBoardsFromDB
private

bad-boards retrieved from DB.

Definition at line 1227 of file CDCGeometryPar.h.

◆ m_badWireFromDB

DBObjPtr<CDCBadWires>* m_badWireFromDB
private

bad-wires retrieved from DB.

Definition at line 1226 of file CDCGeometryPar.h.

◆ m_boardAndChannelToWire

unsigned short m_boardAndChannelToWire[c_nBoards][48]
private

array relating board-channel-id and wire-id.

Definition at line 1214 of file CDCGeometryPar.h.

◆ m_BWirPos

float m_BWirPos[c_maxNSenseLayers][c_maxNDriftCells][3]
private

Wire position incl.

displacement at the backward endplate for each cell; ibid.

Definition at line 1186 of file CDCGeometryPar.h.

◆ m_BWirPosAlign

float m_BWirPosAlign[c_maxNSenseLayers][c_maxNDriftCells][3]
private

Wire position incl.

alignment at the backward endplate for each cell; ibid.

Definition at line 1194 of file CDCGeometryPar.h.

◆ m_BWirPosMisalign

float m_BWirPosMisalign[c_maxNSenseLayers][c_maxNDriftCells][3]
private

Wire position incl.

misalignment at the backward endplate for each cell; ibid.

Definition at line 1190 of file CDCGeometryPar.h.

◆ m_cellSize

double m_cellSize[c_maxNSenseLayers]
private

The array to store cell size in each sense wire layer.

Definition at line 1165 of file CDCGeometryPar.h.

◆ m_chMapFromDB

DBArray<CDCChannelMap>* m_chMapFromDB
private

channel map retrieved from DB.

Definition at line 1233 of file CDCGeometryPar.h.

◆ m_clockFreq4TDC

double m_clockFreq4TDC
private

Clock frequency used for TDC (GHz).

Definition at line 1216 of file CDCGeometryPar.h.

◆ m_clockSettings

DBObjPtr<HardwareClockSettings> m_clockSettings
private

hardware clock settings

Definition at line 1239 of file CDCGeometryPar.h.

◆ m_debug

bool m_debug
private

Switch for debug printing.

Definition at line 1125 of file CDCGeometryPar.h.

◆ m_displacement

bool m_displacement
private

Switch for displacement.

Definition at line 1129 of file CDCGeometryPar.h.

◆ m_displacementFromDB

DBArray<CDCDisplacement>* m_displacementFromDB
private

displacement params.

retrieved from DB.

Definition at line 1234 of file CDCGeometryPar.h.

◆ m_dzSBackwardLayer

double m_dzSBackwardLayer[c_maxNSenseLayers]
private

Corrections for backward z position of sense wire layers.

Definition at line 1160 of file CDCGeometryPar.h.

◆ m_dzSForwardLayer

double m_dzSForwardLayer[c_maxNSenseLayers]
private

Corrections for forward z position of sense wire layers.

Definition at line 1158 of file CDCGeometryPar.h.

◆ m_eDepToADCConversionsFromDB

DBObjPtr<CDCEDepToADCConversions>* m_eDepToADCConversionsFromDB
private

Pointer to edep-to-ADC conv.

params. from DB.

Definition at line 1237 of file CDCGeometryPar.h.

◆ m_eDepToADCParams

float m_eDepToADCParams[c_maxNSenseLayers][c_maxNDriftCells][7] = {}
private

edep-to-ADC conv.

params.

Definition at line 1196 of file CDCGeometryPar.h.

1196{};

◆ m_fFactorFromDB

DBObjPtr<CDCFudgeFactorsForSigma>* m_fFactorFromDB
private

fudge factors retrieved from DB.

Definition at line 1232 of file CDCGeometryPar.h.

◆ m_fieldWireDiameter

double m_fieldWireDiameter
private

The diameter of field wires.

Definition at line 1172 of file CDCGeometryPar.h.

◆ m_firstLayerOffset

ushort m_firstLayerOffset = 0
private

Offset of the first layer (for reduced CDC studies)

Definition at line 1248 of file CDCGeometryPar.h.

◆ m_firstSuperLayerOffset

ushort m_firstSuperLayerOffset = 0
private

Offset of the first super layer (for reduced CDC studies)

Definition at line 1249 of file CDCGeometryPar.h.

◆ m_fudgeFactorForSigma

double m_fudgeFactorForSigma[3]
private

Fuge factor for space resol.

Definition at line 1223 of file CDCGeometryPar.h.

◆ m_FWirPos

float m_FWirPos[c_maxNSenseLayers][c_maxNDriftCells][3]
private

Wire position incl.

displacement at the forward endplate for each cell; to be implemented in a smarter way.

Definition at line 1185 of file CDCGeometryPar.h.

◆ m_FWirPosAlign

float m_FWirPosAlign[c_maxNSenseLayers][c_maxNDriftCells][3]
private

Wire position incl.

alignment at the forward endplate for each cell; ibid.

Definition at line 1193 of file CDCGeometryPar.h.

◆ m_FWirPosMisalign

float m_FWirPosMisalign[c_maxNSenseLayers][c_maxNDriftCells][3]
private

Wire position incl.

misalignment at the forward endplate for each cell; ibid.

Definition at line 1189 of file CDCGeometryPar.h.

◆ m_globalPhiRotation

double m_globalPhiRotation
private

Global ratation in phi (rad.); only for sense wires now.

Definition at line 1174 of file CDCGeometryPar.h.

◆ m_linearInterpolationOfSgm

bool m_linearInterpolationOfSgm
private

Switch for linear interpolation of sigma.

Definition at line 1127 of file CDCGeometryPar.h.

◆ m_linearInterpolationOfXT

bool m_linearInterpolationOfXT
private

Switch for linear interpolation of xt.

Definition at line 1126 of file CDCGeometryPar.h.

◆ m_materialDefinitionMode

int m_materialDefinitionMode
private

Control switch for gas and wire material definition.

Definition at line 1138 of file CDCGeometryPar.h.

◆ m_maxNCellsPerLayer

ushort m_maxNCellsPerLayer = c_maxNDriftCells
private

Maximum number wires within a layer.

Definition at line 1250 of file CDCGeometryPar.h.

◆ m_maxNFieldLayers

ushort m_maxNFieldLayers = c_maxNFieldLayers
private

Maximum number of Field Wire Layers.

Definition at line 1246 of file CDCGeometryPar.h.

◆ m_maxNSenseLayers

ushort m_maxNSenseLayers = c_maxNSenseLayers
private

Maximum number of Sense Wire Layers.

Definition at line 1245 of file CDCGeometryPar.h.

◆ m_maxNSuperLayers

ushort m_maxNSuperLayers = c_nSuperLayers
private

Maximum number of Super Layers.

Definition at line 1247 of file CDCGeometryPar.h.

◆ m_maxSpaceResol

double m_maxSpaceResol
private

max space resolution allowed (cm).

Definition at line 1222 of file CDCGeometryPar.h.

◆ m_meanT0

double m_meanT0
private

mean t0 over all wires; should be double.

Definition at line 1210 of file CDCGeometryPar.h.

◆ m_minTrackLength

double m_minTrackLength
private

Minimum track length for G4 step.

Definition at line 1183 of file CDCGeometryPar.h.

◆ m_misalignment

bool m_misalignment
private

Switch for misalignment.

Definition at line 1130 of file CDCGeometryPar.h.

◆ m_misalignmentFromDB

DBObjPtr<CDCMisalignment>* m_misalignmentFromDB
private

misalignment params.

retrieved from DB.

Definition at line 1236 of file CDCGeometryPar.h.

◆ m_modLeftRightFlag

bool m_modLeftRightFlag
private

Switch for modified left/right flag.

Definition at line 1135 of file CDCGeometryPar.h.

◆ m_momRmin

double m_momRmin[7]
private

R_min of the cdc mother volume (7 segments).

Definition at line 1177 of file CDCGeometryPar.h.

◆ m_momZ

double m_momZ[7]
private

Z-cordinates of the cdc mother volume (7 segments).

Definition at line 1176 of file CDCGeometryPar.h.

◆ m_nAlphaPoints

unsigned short m_nAlphaPoints
private

No.

of alpha points for xt.

Definition at line 1147 of file CDCGeometryPar.h.

◆ m_nAlphaPoints4Sgm

unsigned short m_nAlphaPoints4Sgm
private

No.

of alpha points for sigma.

Definition at line 1149 of file CDCGeometryPar.h.

◆ m_nFieldWires

ushort m_nFieldWires = c_nFieldWires
private

Maximum number of Field Wires.

Definition at line 1244 of file CDCGeometryPar.h.

◆ m_nFLayer

int m_nFLayer
private

The number of field wire layer.

Definition at line 1146 of file CDCGeometryPar.h.

◆ m_nominalDriftV

double m_nominalDriftV
private

Nominal drift velocity (4.0x10^-3 cm/nsec).

Definition at line 1218 of file CDCGeometryPar.h.

◆ m_nominalDriftVInv

double m_nominalDriftVInv
private

Inverse of the nominal drift velocity.

Definition at line 1219 of file CDCGeometryPar.h.

◆ m_nominalPropSpeed

double m_nominalPropSpeed
private

Nominal propagation speed of the sense wire (27.25 cm/nsec).

Definition at line 1220 of file CDCGeometryPar.h.

◆ m_nominalSpaceResol

double m_nominalSpaceResol
private

Nominal spatial resolution (0.0130 cm).

Definition at line 1221 of file CDCGeometryPar.h.

◆ m_nSenseWires

ushort m_nSenseWires = c_nSenseWires
private

Maximum number of Sense Wires.

Definition at line 1243 of file CDCGeometryPar.h.

◆ m_nShifts

int m_nShifts[c_maxNSenseLayers]
private

The array to store shifted cell number in each sense wire layer.

Definition at line 1166 of file CDCGeometryPar.h.

◆ m_nSLayer

int m_nSLayer
private

The number of sense wire layer.

Definition at line 1145 of file CDCGeometryPar.h.

◆ m_nThetaPoints

unsigned short m_nThetaPoints
private

No.

of theta points for xt.

Definition at line 1148 of file CDCGeometryPar.h.

◆ m_nThetaPoints4Sgm

unsigned short m_nThetaPoints4Sgm
private

No.

of theta points for sigma.

Definition at line 1150 of file CDCGeometryPar.h.

◆ m_nWires

unsigned m_nWires[c_maxNSenseLayers]
private

The array to store the wire number in each sense wire layre.

Definition at line 1167 of file CDCGeometryPar.h.

◆ m_offSet

double m_offSet[c_maxNSenseLayers]
private

The array to store z offset of sense wire layers.

Definition at line 1164 of file CDCGeometryPar.h.

◆ m_propSpeedFromDB

DBObjPtr<CDCPropSpeeds>* m_propSpeedFromDB
private

prop.

-speeds retrieved from DB.

Definition at line 1228 of file CDCGeometryPar.h.

◆ m_propSpeedInv

float m_propSpeedInv[c_maxNSenseLayers]
private

Inverse of propagation speed of the sense wire.

Definition at line 1205 of file CDCGeometryPar.h.

◆ m_rFLayer

double m_rFLayer[c_maxNFieldLayers]
private

The array to store radius of field wire layers.

Definition at line 1161 of file CDCGeometryPar.h.

◆ m_rSLayer

double m_rSLayer[c_maxNSenseLayers]
private

The array to store radius of sense wire layers.

Definition at line 1156 of file CDCGeometryPar.h.

◆ m_rWall

double m_rWall[4]
private

The array to store radius of inner wall and outer wall.

Definition at line 1153 of file CDCGeometryPar.h.

◆ m_senseWireDensity

double m_senseWireDensity
private

The density of sense wires.

Definition at line 1171 of file CDCGeometryPar.h.

◆ m_senseWireDiameter

double m_senseWireDiameter
private

The diameter of sense wires.

Definition at line 1169 of file CDCGeometryPar.h.

◆ m_senseWireTension

double m_senseWireTension
private

The tension of sense wires.

Definition at line 1170 of file CDCGeometryPar.h.

◆ m_senseWireZposMode

int m_senseWireZposMode
private

Mode for sense wire z position corr.

Definition at line 1139 of file CDCGeometryPar.h.

◆ m_shiftInSuperLayer

signed short m_shiftInSuperLayer[c_nSuperLayers][8]
private

shift in phi-direction wrt the 1st layer in each super layer

Definition at line 1151 of file CDCGeometryPar.h.

◆ m_Sigma

float m_Sigma[c_maxNSenseLayers][2][c_maxNAlphaPoints][c_maxNThetaPoints][c_nSigmaParams]
private

position resolution for each layer.

Definition at line 1204 of file CDCGeometryPar.h.

◆ m_sigmaFileFormat

int m_sigmaFileFormat
private

Format of sigma input file.

Definition at line 1142 of file CDCGeometryPar.h.

◆ m_sigmaParamMode

int m_sigmaParamMode
private

Mode for sigma parameterization.

Definition at line 1143 of file CDCGeometryPar.h.

◆ m_sResolFromDB

DBObjPtr<CDCSpaceResols>* m_sResolFromDB
private

sigma params.

retrieved from DB.

Definition at line 1231 of file CDCGeometryPar.h.

◆ m_t0

float m_t0[c_maxNSenseLayers][c_maxNDriftCells] = {}
private

t0 for each sense-wire (in nsec).

Definition at line 1206 of file CDCGeometryPar.h.

1206{};

◆ m_t0FromDB

DBObjPtr<CDCTimeZeros>* m_t0FromDB
private

t0s retrieved from DB.

Definition at line 1225 of file CDCGeometryPar.h.

◆ m_tdcBinWidth

double m_tdcBinWidth
private

TDC bin width (nsec/bin).

Definition at line 1217 of file CDCGeometryPar.h.

◆ m_tdcOffset

unsigned short m_tdcOffset
private

Not used; to be removed later.

Definition at line 1215 of file CDCGeometryPar.h.

◆ m_thetaPoints

float m_thetaPoints[c_maxNThetaPoints]
private

theta sampling points for xt (rad)

Definition at line 1199 of file CDCGeometryPar.h.

◆ m_thetaPoints4Sgm

float m_thetaPoints4Sgm[c_maxNThetaPoints]
private

theta sampling points for sigma (rad)

Definition at line 1201 of file CDCGeometryPar.h.

◆ m_thresholdEnergyDeposit

double m_thresholdEnergyDeposit
private

Energy thresh.

for G4 step

Definition at line 1182 of file CDCGeometryPar.h.

◆ m_timeWalkCoef

float m_timeWalkCoef[c_nBoards][2]
private

coefficients for time walk.

Definition at line 1207 of file CDCGeometryPar.h.

◆ m_timeWalkFromDB

DBObjPtr<CDCTimeWalks>* m_timeWalkFromDB
private

time-walk coeffs.

retrieved from DB.

Definition at line 1229 of file CDCGeometryPar.h.

◆ m_twParamMode

int m_twParamMode
private

Mode for tw parameterization.

Definition at line 1144 of file CDCGeometryPar.h.

◆ m_version

std::string m_version
private

The version of geometry parameters.

Definition at line 1137 of file CDCGeometryPar.h.

◆ m_wireSag

bool m_wireSag
private

Switch for sense wire sag.

Definition at line 1134 of file CDCGeometryPar.h.

◆ m_WireSagCoef

float m_WireSagCoef[c_maxNSenseLayers][c_maxNDriftCells]
private

Wire sag coefficient for each cell; ibid.

Definition at line 1187 of file CDCGeometryPar.h.

◆ m_WireSagCoefAlign

float m_WireSagCoefAlign[c_maxNSenseLayers][c_maxNDriftCells]
private

Wire sag coefficient incl.

alignment for each cell; ibid.

Definition at line 1195 of file CDCGeometryPar.h.

◆ m_WireSagCoefMisalign

float m_WireSagCoefMisalign[c_maxNSenseLayers][c_maxNDriftCells]
private

Wire sag coefficient incl.

misalignment for each cell; ibid.

Definition at line 1191 of file CDCGeometryPar.h.

◆ m_wireToBoard

std::map<WireID, unsigned short> m_wireToBoard
private

map relating wire-id and board-id.

Definition at line 1212 of file CDCGeometryPar.h.

◆ m_wireToChannel

std::map<WireID, unsigned short> m_wireToChannel
private

map relating wire-id and channel-id.

Definition at line 1213 of file CDCGeometryPar.h.

◆ m_XT

float m_XT[c_maxNSenseLayers][2][c_maxNAlphaPoints][c_maxNThetaPoints][c_nXTParams]
private

XT-relation coefficients for each layer, Left/Right, entrance angle and polar angle.

Definition at line 1203 of file CDCGeometryPar.h.

◆ m_XTetc

bool m_XTetc
private

Switch for reading x-t etc.

params..

Definition at line 1128 of file CDCGeometryPar.h.

◆ m_XTetc4Recon

bool m_XTetc4Recon
private

Switch for selecting xt etc.

Definition at line 1132 of file CDCGeometryPar.h.

◆ m_xtFileFormat

int m_xtFileFormat
private

Format of xt input file.

Definition at line 1140 of file CDCGeometryPar.h.

◆ m_xtParamMode

int m_xtParamMode
private

Mode for xt parameterization.

Definition at line 1141 of file CDCGeometryPar.h.

◆ m_xtRelFromDB

DBObjPtr<CDCXtRelations>* m_xtRelFromDB
private

xt params.

retrieved from DB (new).

Definition at line 1230 of file CDCGeometryPar.h.

◆ m_zFBackwardLayer

double m_zFBackwardLayer[c_maxNFieldLayers]
private

The array to store backward z position of field wire layers.

Definition at line 1163 of file CDCGeometryPar.h.

◆ m_zFForwardLayer

double m_zFForwardLayer[c_maxNFieldLayers]
private

The array to store forward z position of field wire layers.

Definition at line 1162 of file CDCGeometryPar.h.

◆ m_zSBackwardLayer

double m_zSBackwardLayer[c_maxNSenseLayers]
private

The array to store backward z position of sense wire layers.

Definition at line 1159 of file CDCGeometryPar.h.

◆ m_zSForwardLayer

double m_zSForwardLayer[c_maxNSenseLayers]
private

The array to store forward z position of sense wire layers.

Definition at line 1157 of file CDCGeometryPar.h.

◆ m_zWall

double m_zWall[4][2]
private

The array to store z position of inner wall and outer wall.

Definition at line 1154 of file CDCGeometryPar.h.


The documentation for this class was generated from the following files: