 |
Belle II Software
release-05-02-19
|
11 #ifndef CDCGEOMETRYPAR_H
12 #define CDCGEOMETRYPAR_H
14 #include <framework/gearbox/GearDir.h>
15 #include <framework/database/DBArray.h>
16 #include <framework/database/DBObjPtr.h>
18 #include <cdc/dataobjects/WireID.h>
19 #include <cdc/dbobjects/CDCTimeZeros.h>
20 #include <cdc/dbobjects/CDCBadWires.h>
21 #include <cdc/dbobjects/CDCPropSpeeds.h>
22 #include <cdc/dbobjects/CDCTimeWalks.h>
23 #include <cdc/dbobjects/CDCXtRelations.h>
24 #include <cdc/dbobjects/CDCSpaceResols.h>
25 #include <cdc/dbobjects/CDCFudgeFactorsForSigma.h>
26 #include <cdc/dbobjects/CDCChannelMap.h>
27 #include <cdc/dbobjects/CDCDisplacement.h>
28 #include <cdc/dbobjects/CDCAlignment.h>
29 #include <cdc/dbobjects/CDCMisalignment.h>
30 #include <cdc/dbobjects/CDCGeometry.h>
31 #include <cdc/dbobjects/CDCEDepToADCConversions.h>
40 const unsigned MAX_N_SLAYERS = 56;
41 const unsigned MAX_N_SCELLS = 384;
42 const unsigned MAX_N_FLAYERS = 55;
43 const unsigned nSenseWires = 14336;
44 const unsigned nSuperLayers = 9;
45 const unsigned nBoards = 300;
47 const unsigned maxNAlphaPoints = 18;
48 const unsigned maxNThetaPoints = 7;
49 const unsigned nXTParams = 9;
50 const unsigned nSigmaParams = 9;
273 double getEDepToADCConvFactor(
unsigned short layer,
unsigned short cell,
double edep,
double dx,
double costh);
326 double momZ(
int iBound)
const;
333 double momRmin(
int iBound)
const;
341 unsigned cellId(
unsigned layerId,
const TVector3& position)
const;
578 std::map<WireID, unsigned short>::const_iterator it =
m_wireToBoard.find(wID);
579 unsigned short iret = (it !=
m_wireToBoard.end()) ? it->second : -999;
590 std::map<WireID, unsigned short>::const_iterator it =
m_wireToChannel.find(wID);
591 unsigned short iret = (it !=
m_wireToChannel.end()) ? it->second : -999;
614 std::map<WireID, unsigned short>::const_iterator it =
m_wireToBoard.find(wID);
623 tw = p0 * exp(-p1 * adcCount);
689 int nShifts(
int layerId)
const;
696 double offset(
int layerID)
const;
845 bool torf = *
m_badWireFromDB ? (*m_badWireFromDB)->isBadWire(wid) :
false;
855 bool torf = *
m_badWireFromDB ? (*m_badWireFromDB)->isDeadWire(wid, eff) :
false;
864 bool torf = *
m_badWireFromDB ? (*m_badWireFromDB)->isHotWire(wid) :
false;
893 double getDriftV(
double dt,
unsigned short layer,
unsigned short lr,
double alpha = 0.,
double theta = 0.5 * M_PI)
const;
906 double getDriftLength(
double dt,
unsigned short layer,
unsigned short lr,
double alpha = 0.,
double theta = 0.5 * M_PI,
907 bool calculateMinTime =
true,
double minTime = 0.)
const;
917 double getDriftLength0(
double dt,
unsigned short layer,
unsigned short lr,
double alpha = 0.,
double theta = 0.5 * M_PI)
const;
926 double getMinDriftTime(
unsigned short layer,
unsigned short lr,
double alpha = 0.,
double theta = 0.5 * M_PI)
const;
937 double getDriftTime(
double dist,
unsigned short layer,
unsigned short lr,
double alpha,
double theta)
const;
947 double getSigma(
double dist,
unsigned short layer,
unsigned short lr,
double alpha = 0.,
double theta = 0.5 * M_PI)
const;
964 unsigned short getOldLeftRight(
const TVector3& posOnWire,
const TVector3& posOnTrack,
const TVector3& momentum)
const;
973 unsigned short getNewLeftRightRaw(
const TVector3& posOnWire,
const TVector3& posOnTrack,
const TVector3& momentum)
const;
981 double getAlpha(
const TVector3& posOnWire,
const TVector3& momentum)
const;
987 double getTheta(
const TVector3& momentum)
const;
995 unsigned short getOutgoingLR(
const unsigned short lr,
const double alpha)
const;
1016 void getClosestAlphaPoints(
const double alpha,
double& wal,
unsigned short points[2],
unsigned short lrs[2])
const;
1028 void getClosestThetaPoints(
const double alpha,
const double theta,
double& wth,
unsigned short points[2])
const;
1141 float m_XT[MAX_N_SLAYERS][2][maxNAlphaPoints][maxNThetaPoints][nXTParams];
1142 float m_Sigma[MAX_N_SLAYERS][2][maxNAlphaPoints][maxNThetaPoints][nSigmaParams];
1144 float m_t0[MAX_N_SLAYERS][MAX_N_SCELLS] = {0};
1313 return MAX_N_SLAYERS;
double outerRadiusInnerWall() const
Returns the outer radius of the inner wall.
float m_BWirPosMisalign[MAX_N_SLAYERS][MAX_N_SCELLS][3]
Wire position incl.
unsigned short getChannelID(const WireID &wID) const
Returns frontend channel id. corresponding to the wire id.
double m_zFBackwardLayer[MAX_N_FLAYERS]
The array to store backward z position of field wire layers.
void setShiftInSuperLayer()
Calculates and saves shifts in super-layers (to be used in searching hits in neighboring cells)
void readXT(const GearDir, int mode=0)
Read XT-relation table.
Class to identify a wire inside the CDC.
int m_xtFileFormat
Format of xt input file.
double motherOuterR() const
The method to get cdc mother volume outer R.
double getMinTrackLength() const
Returns the minimum track length required in one G4 step (only secondary particles which pass this cr...
double getPropSpeedInv(const unsigned int layerID) const
Get the inversel of propagation speed in the sense wire.
unsigned nWireLayers() const
Returns a number of wire layers.
double m_thresholdEnergyDeposit
Energy thresh.
double m_senseWireTension
The tension of sense wires.
const TVector3 wireForwardPosition(int layerId, int cellId, EWirePosition set=c_Base) const
Returns the forward position of the input sense wire.
bool isDeadWire(const WireID &wid, double &eff)
Inquire if the wire is dead.
DBObjPtr< CDCFudgeFactorsForSigma > * m_fFactorFromDB
fudge factors retrieved from DB.
void setBadWire()
Set bad-wires (from DB)
double getOutgoingTheta(const double alpha, const double theta) const
Converts incoming- to outgoing-theta.
static CDCGeometryPar * m_B4CDCGeometryParDB
Pointer that saves the instance of this class.
double m_nominalDriftVInv
Inverse of the nominal drift velocity.
const TVector3 wireForwardPosition(const WireID &wireID, EWirePosition set=c_Base) const
The same function but in a different input format.
float m_timeWalkCoef[nBoards][2]
coefficients for time walk.
bool isModifiedLeftRightFlagOn() const
Returns on/off for modified left/right calculation in FullSim.
float m_FWirPos[MAX_N_SLAYERS][MAX_N_SCELLS][3]
Wire position incl.
double m_rSLayer[MAX_N_SLAYERS]
The array to store radius of sense wire layers.
double m_rWall[4]
The array to store radius of inner wall and outer wall.
float m_BWirPos[MAX_N_SLAYERS][MAX_N_SCELLS][3]
Wire position incl.
DBArray< CDCChannelMap > * m_chMapFromDB
channel map retrieved from DB.
DBArray< CDCDisplacement > * m_displacementFromDB
displacement params.
double outerRadiusOuterWall() const
Returns the outer radius of the outer wall.
float m_t0[MAX_N_SLAYERS][MAX_N_SCELLS]
t0 for each sense-wire (in nsec).
void setWirPosAlignParams()
Set wire alignment params.
const double * innerRadiusWireLayer() const
Returns an array of inner radius of wire layers.
unsigned m_nWires[MAX_N_SLAYERS]
The array to store the wire number in each sense wire layre.
float m_WireSagCoefMisalign[MAX_N_SLAYERS][MAX_N_SCELLS]
Wire sag coefficient incl.
double m_tdcBinWidth
TDC bin width (nsec/bin).
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).
signed short m_shiftInSuperLayer[nSuperLayers][8]
shift in phi-direction wrt the 1st layer in each super layer
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 senseWireBZ(int layerId) const
Returns backward z position of sense wire in each layer.
void setDesignWirParam(unsigned layerID, unsigned cellID)
Set the desizend wire parameters.
CDCGeometryPar(const CDCGeometry *=nullptr)
Singleton class.
void readFFactor(const GearDir, int mode=0)
Read fudge factors.
double zOuterWall() const
Returns the length of the outer wall in Z.
double getNominalSpaceResol() const
Return the nominal spacial resolution.
int getSenseWireZposMode() const
Return mode for sense wire z position.
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).
const TVector3 wireForwardPosition(const WireID &wireID, double z, EWirePosition set=c_Base) const
The same function but in a different input format.
std::map< WireID, unsigned short > m_wireToBoard
map relating wire-id and board-id.
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).
Class for accessing arrays of objects in the database.
float m_alphaPoints[maxNAlphaPoints]
alpha sampling points for xt (rad)
double momZ(int iBound) const
Returns boundary position in Z axis of the CDC mother volume.
double m_minTrackLength
Minimum track length for G4 step.
unsigned short m_tdcOffset
Not used; to be removed later.
double zInnerWall() const
Returns the length of the inner wall in Z.
float m_propSpeedInv[MAX_N_SLAYERS]
Inverse of propagation speed of the sense wire.
bool m_debug
Switch for debug printing.
float m_Sigma[MAX_N_SLAYERS][2][maxNAlphaPoints][maxNThetaPoints][nSigmaParams]
position resulution for each layer.
void setChMap()
Set channel map (from DB)
double getNominalPropSpeed() const
Return the nominal propagation speed of the sense wire (default: 27.25 cm/nsec).
void readT0(const GearDir, int mode=0)
Read t0 parameters (from a file).
void calcMeanT0()
Calculate mean t0 in ns (over all wires)
std::map< WireID, unsigned short > m_wireToChannel
map relating wire-id and channel-id.
double getTdcBinWidth() const
Return TDC bin width (nsec).
double momRmin(int iBound) const
Returns inner radius of the CDC mother volume.
unsigned short getNewLeftRightRaw(const TVector3 &posOnWire, const TVector3 &posOnTrack, const TVector3 &momentum) const
Returns new left/right_raw.
CDCGeometryPar & operator=(const CDCGeometryPar &)
Singleton class.
std::string m_version
The version of geometry parameters.
double m_cellSize[MAX_N_SLAYERS]
The array to store cell size in each sense wire layer.
double m_zSForwardLayer[MAX_N_SLAYERS]
The array to store forward z position of sense wire layers.
unsigned short m_nThetaPoints
No.
double senseWireFZ(int layerId) const
Returns forward z position of sense wire in each layer.
bool m_XTetc4Recon
Switch for selecting xt etc.
void newReadSigma(const GearDir, int mode=0)
Read spatial resolution table in new format.
float m_thetaPoints[maxNThetaPoints]
theta sampling points for xt (rad)
double m_dzSBackwardLayer[MAX_N_SLAYERS]
Corrections for backward z position of sense wire layers.
double fieldWireDiameter() const
Returns diameter of the field wire.
void setXtRel()
Set XT-relation table (from DB) (new).
DBObjPtr< CDCTimeZeros > * m_t0FromDB
t0s retrieved from DB.
void setWirPosMisalignParams()
Set wire misalignment params.
void setSenseWireBZ(int layerId, double bz)
set backward z position of sense wires.
int m_nShifts[MAX_N_SLAYERS]
The array to store shifted cell number in each sense wire layer.
void newReadXT(const GearDir, int mode=0)
Read XT-relation table in new format.
double getMinDriftTime(unsigned short layer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI) const
Return the min.
double getEDepToADCMainFactor(unsigned short layer, unsigned short cell)
Return edep-to-ADC conversion main factor (in count/keV)
double m_dzSForwardLayer[MAX_N_SLAYERS]
Corrections for forward z position of sense wire layers.
float m_eDepToADCParams[MAX_N_SLAYERS][MAX_N_SCELLS][6]
edep-to-ADC conv.
void readChMap()
Read channel map between wire-id and electronics-id.
double m_nominalPropSpeed
Nominal propagation speed of the sense wire (27.25 cm/nsec).
Class for accessing objects in the database.
double getFwdDeltaZ(unsigned short layerID) const
Return forward 'deltaZ'.
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).
double getThresholdEnerguDeposit() const
Returns threshold for energy deposit in one G4 step.
int momBound() const
to get the number of boundary position of the CDC mother volume
The Class for CDC geometry.
void setSResol()
Set spatial resolution (from DB).
double getEDepToADCConvFactor(unsigned short layer, unsigned short cell, double edep, double dx, double costh)
Return edep-to-ADC conversion factor.
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 m_momRmin[7]
R_min of the cdc mother volume (7 segments).
The Class for CDC Geometry Parameters.
unsigned short getOutgoingLR(const unsigned short lr, const double alpha) const
Converts incoming-lr to outgoing-lr.
const WireID getWireID(unsigned short bd, unsigned short ch) const
Returns wire id. corresponding to the board-and-cannel ids.
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).
bool isBadWire(const WireID &wid)
Inquire if the wire is totally-dead.
bool m_linearInterpolationOfXT
Switch for linear interpolation of xt.
float m_BWirPosAlign[MAX_N_SLAYERS][MAX_N_SCELLS][3]
Wire position incl.
double senseWireR(int layerId) const
Returns radius of sense wire in each layer.
const TVector3 wireBackwardPosition(int layerId, int cellId, EWirePosition set=c_Base) const
Returns the backward position of the input sense wire.
bool isWireSagOn() const
Returns on/off for sense wire sag in FullSim.
unsigned short getTdcOffset() const
Return TDC offset value (default = 0 ch).
void setSenseWireFZ(int layerId, double fz)
Set forward z position of sense wires.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
double getTheta(const TVector3 &momentum) const
Returns track incident angle (theta in rad.).
Abstract base class for different kinds of events.
double m_zWall[4][2]
The array to store z position of inner wall and outer wall.
double m_maxSpaceResol
10 times Nominal spacial resolution.
const double * outerRadiusWireLayer() const
Returns an array of outer radius of wire layers.
void setPropSpeed()
Set prop.
double getDriftTime(double dist, unsigned short layer, unsigned short lr, double alpha, double theta) const
Return the drift time to the sense wire.
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.
unsigned short getOldLeftRight(const TVector3 &posOnWire, const TVector3 &posOnTrack, const TVector3 &momentum) const
Returns old left/right.
double offset(int layerID) const
Return wire offset in phi direction at endplate.
double motherInnerR() const
The method to get cdc mother volume inner R.
int m_materialDefinitionMode
Control switch for gas and wire material definition.
DBObjPtr< CDCMisalignment > * m_misalignmentFromDB
misalignment params.
int m_xtParamMode
Mode for xt parameterization.
int m_sigmaParamMode
Mode for sigma parameterization.
GearDir is the basic class used for accessing the parameter store.
signed short getShiftInSuperLayer(unsigned short iSuperLayer, unsigned short iLayer) const
Returns shift in the super-layer.
void readFromDB(const CDCGeometry &)
Gets geometry parameters from database.
double m_fieldWireDiameter
The diameter of field wires.
int getMaterialDefinitionMode() const
Return mode for material definition.
unsigned short getBoardID(const WireID &wID) const
Returns frontend board id. corresponding to the wire id.
double fieldWireR(int layerId) const
Returns radius of field wire in each layer.
void readEDepToADC(const GearDir, int mode=0)
Read spatial edep-to-adc conv.
int nShifts(int layerId) const
Returns number shift.
double fieldWireFZ(int layerId) const
Returns forward z position of field wire in each layer.
void readSigma(const GearDir, int mode=0)
Read spatial resolution table.
void setXT()
Set XT-relation table (from DB).
double getNominalDriftV() const
Return the nominal drift velocity of He-ethane gas (default: 4.0x10^-3 cm/nsec).
bool m_displacement
Switch for displacement.
unsigned cellId(unsigned layerId, const TVector3 &position) const
The method to get cell id based on given layer id and the position.
double m_momZ[7]
Z-cordinates of the cdc mother volume (7 segments).
virtual ~CDCGeometryPar()
Destructor.
bool m_modLeftRightFlag
Switch for modified left/right flag.
const double * zBackwardWireLayer() const
Returns an array of backward z of wire layers.
double getMeanT0() const
Returns the mean t0 over all wires.
std::string version() const
Returns the version of cdc geometry parameters.
void setDisplacement()
Set displacement of sense wire.
unsigned short m_boardAndChannelToWire[nBoards][48]
array relating board-channel-id and wire-id.
double m_meanT0
mean t0 over all wires; should be double.
int m_twParamMode
Mode for tw parameterization.
bool m_wireSag
Switch for sense wire sag.
double zOffsetWireLayer(unsigned i) const
Returns the offset of z of the wire layer i.
float m_WireSagCoef[MAX_N_SLAYERS][MAX_N_SCELLS]
Wire sag coefficient for each cell; ibid.
float m_thetaPoints4Sgm[maxNThetaPoints]
theta sampling points for sigma (rad)
void setT0()
Set t0 parameters (from DB)
double m_zSBackwardLayer[MAX_N_SLAYERS]
The array to store backward z position of sense wire layers.
double getOutgoingAlpha(const double alpha) const
Converts incoming- to outgoing-alpha.
void readPropSpeed(const GearDir, int mode=0)
Read the propagation speed along the sense wire.
float m_FWirPosAlign[MAX_N_SLAYERS][MAX_N_SCELLS][3]
Wire position incl.
void readTW(const GearDir, int mode=0)
Read time-walk parameter.
float getT0(const WireID &wireID) const
Returns t0 parameter of the specified sense wire.
unsigned short m_nAlphaPoints4Sgm
No.
int m_senseWireZposMode
Mode for sense wire z position corr.
unsigned short m_nThetaPoints4Sgm
No.
void generateXML(const std::string &of)
Generate an xml file used in gearbox.
double m_nominalDriftV
Nominal drift velocity (4.0x10^-3 cm/nsec).
const TVector3 wireBackwardPosition(const WireID &wireID, double z, EWirePosition set=c_Base) const
The same function but in a different input format.
bool m_alignment
Switch for alignment.
DBObjPtr< CDCSpaceResols > * m_sResolFromDB
sigma params.
DBObjPtr< CDCEDepToADCConversions > * m_eDepToADCConversionsFromDB
Pointer to edep-to-ADC conv.
EWirePosition
Wire position set.
DBObjPtr< CDCTimeWalks > * m_timeWalkFromDB
time-walk coeffs.
unsigned nWiresInLayer(int layerId) const
Returns wire numbers in a layer.
bool m_XTetc
Switch for reading x-t etc.
double getWireSagCoef(EWirePosition set, int layerId, int cellId) const
Returns coefficient for the sense wire sag.
double m_senseWireDiameter
The diameter of sense wires.
bool m_misalignment
Switch for misalignment.
double m_nominalSpaceResol
Nominal spacial resolution (0.0130 cm).
double m_globalPhiRotation
Global ratation in phi (rad.); only for sence wires now.
double senseWireDiameter() const
Returns diameter of the sense wire.
void setNominalSpaceResol(double resol)
Set the nominal spacial resolution in the unit of um.
double innerRadiusInnerWall() const
Returns the inner radius of the inner wall.
void readWirePositionParams(EWirePosition set, const CDCGeometry *)
Read displacement or (mis)alignment params from text file.
int m_nSLayer
The number of sense wire layer.
void Print() const
Print some debug information.
double m_offSet[MAX_N_SLAYERS]
The array to store z offset of sense wire layers.
int m_nFLayer
The number of field wire layer.
const TVector3 wireBackwardPosition(const WireID &wireID, EWirePosition set=c_Base) const
The same function but in a different input format.
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 fieldWireBZ(int layerId) const
Returns backward z position of field wire in each layer.
float m_FWirPosMisalign[MAX_N_SLAYERS][MAX_N_SCELLS][3]
Wire position incl.
DBObjPtr< CDCAlignment > * m_alignmentFromDB
alignment params.
void setFFactor()
Set fudge factors (from DB).
double getTimeWalk(const WireID &wID, unsigned short adcCount) const
Returns time-walk.
double getBwdDeltaZ(unsigned short layerID) const
Return backward 'deltaZ'.
double zOffsetInnerWall() const
Returns the offset of the outer wall in z direction.
double m_fudgeFactorForSigma[3]
Fuge factor for space resol.
float m_WireSagCoefAlign[MAX_N_SLAYERS][MAX_N_SCELLS]
Wire sag coefficient incl.
void setTW()
Set time-walk parameters.
double m_senseWireDensity
The density of sense wires.
void setEDepToADCConversions()
Set edep-to-ADC conversion params.
bool isHotWire(const WireID &wid)
Inquire if the wire is hot.
void outputDesignWirParam(unsigned layerID, unsigned cellID) const
Write the designed wire parameters to the alignment.dat (default).
unsigned short getIWire() const
Getter for wire within the layer.
double m_rFLayer[MAX_N_FLAYERS]
The array to store radius of field wire layers.
unsigned short getICLayer() const
Getter for continuous layer numbering.
double getAlpha(const TVector3 &posOnWire, const TVector3 &momentum) const
Returns track incident angle in rphi plane (alpha in rad.).
int m_sigmaFileFormat
Format of sigma input file.
double m_clockFreq4TDC
Clock frequency used for TDC (GHz).
void setSenseWireR(int layerId, double r)
Set radius of sense wire in each layer.
double getFudgeFactorForSigma(unsigned short target) const
Return the fuge factor for space resol.
DBObjPtr< CDCXtRelations > * m_xtRelFromDB
xt params.
double motherLength() const
The method to get cdc mother volume length.
float m_XT[MAX_N_SLAYERS][2][maxNAlphaPoints][maxNThetaPoints][nXTParams]
XT-relation coefficients for each layer, Left/Right, entrance angle and polar angle.
float m_alphaPoints4Sgm[maxNAlphaPoints]
alpha sampling points for sigma (rad)
unsigned short m_nAlphaPoints
No.
DBObjPtr< CDCBadWires > * m_badWireFromDB
bad-wires retrieved from DB.
bool m_linearInterpolationOfSgm
Switch for linear interpolation of sigma.
double innerRadiusOuterWall() const
Returns the inner radius of the outer wall.
double m_zFForwardLayer[MAX_N_FLAYERS]
The array to store forward z position of field wire layers.
double zOffsetOuterWall() const
Returns the offset of the outer wall in z direction.
const double * zForwardWireLayer() const
Returns an array of forward z of wire layers.
DBObjPtr< CDCPropSpeeds > * m_propSpeedFromDB
prop.