1#ifndef CGEMGEOREADOUTPLANE_H
2#define CGEMGEOREADOUTPLANE_H
6#include <CLHEP/Units/PhysicalConstants.h>
7#include <CLHEP/Units/SystemOfUnits.h>
8#include <CLHEP/Vector/ThreeVector.h>
9#include "G4ThreeVector.hh"
19 double phi_min,
double dX_strip,
double dV,
20 double w,
double zmin,
double L,
21 int NXStrip,
int NVStrip,
22 double Xpitch,
double XstripWidth,
double Vpitch,
double VstripWidth,
double stereoAngle,
23 double midROfGap,
double outROfGap);
47 double getX(
double phi)
const;
55 void getStripID(G4ThreeVector pos,
int& X_ID,
int& V_ID)
const;
56 void getFiredStripID(G4ThreeVector pos1, G4ThreeVector pos2, vector<int>& vecXID, vector<int>& vecVID)
const;
58 double getVFromLocalXZ(
double x,
double zeta,
bool checkRange=
true)
const;
59 double getVFromPhiZ(
double phi,
double z,
bool checkRange=
true)
const;
62 double dPhi = phiminNext-m_Phimin;
63 while(dPhi<=0) dPhi+=CLHEP::twopi;
64 while(dPhi>CLHEP::twopi) dPhi-=CLHEP::twopi;
66 double dX = dPhi*m_Rmid;
67 return v-dX*
cos(m_StereoAngle);
75 return (X_ID+0.5)*m_XPitch+m_Xmin_strip;
81 return (V_ID+0.5)*m_VPitch+m_Vmin_strip;
85 double vStripLegth(0.);
86 if(V_ID>=0&&V_ID<m_NVstrips)
89 double Lz=V/fabs(
sin(m_StereoAngle));
92 vStripLegth=Lz/
cos(m_StereoAngle);
94 else if(V/
cos(m_StereoAngle)<=m_NXstrips*m_XPitch)
96 vStripLegth=m_L/
cos(m_StereoAngle);
98 else vStripLegth=(m_Vtot-V)/fabs(
sin(m_StereoAngle)*
cos(m_StereoAngle));
103 double getZFromXV(
double X,
double V,
int checkXRange=1,
int checkVRange=1)
const;
104 double getZFromPhiV(
double phi,
double V,
int checkXRange=1)
const;
131 double m_Phimin_strip;
133 double m_Phimax_strip;
145 double m_XstripWidth;
146 double m_VstripWidth;
147 double m_StereoAngle;
156 double dPhi=phi-m_Phimin;
157 while(dPhi<0) dPhi+=CLHEP::twopi;
158 while(dPhi>=2*
M_PI) dPhi-=CLHEP::twopi;
159 if(dPhi>=m_Phimin_strip && dPhi<=m_Xmax_strip/m_Rmid && z>=m_Zmin && z<=m_Zmax)
return true;
166 if( (!checkRange) || (
x>=0. && x<=m_NXstrips*m_XPitch && zeta>=0 && zeta<=m_L) )
171 double z0=m_Zmax;
if(m_k<0) z0=m_Zmin;
173 V =
x*
cos(m_StereoAngle)+(z0-zeta-m_Zmin)*
sin(m_StereoAngle);
180 double dPhi=phi-m_Phimin;
181 while(dPhi<0) dPhi+=CLHEP::twopi;
182 while(dPhi>=CLHEP::twopi) dPhi-=CLHEP::twopi;
183 double X=dPhi*m_Rmid;
184 double x=X-m_Xmin_strip;
185 double zeta=z-m_Zmin;
191 double dPhi=phi-m_Phimin;
192 while(dPhi<-CLHEP::pi) dPhi+=CLHEP::twopi;
193 while(dPhi>=CLHEP::pi) dPhi-=CLHEP::twopi;
194 double X=dPhi*m_Rmid;
195 double x=X-m_Xmin_strip;
196 double zeta=z-m_Zmin;
203 if( (vID>=0) && (vID<m_NVstrips) ){
215 while(phi<0) phi+=CLHEP::twopi;
216 while(phi>=CLHEP::twopi) phi-=CLHEP::twopi;
217 return getZFromXV(phi*m_Rmid, V, checkXRange);
221 double Vid = floor((V-m_Vmin_strip)/m_VPitch);
223 if(Vid>=m_NVstrips) Vid=-2;
double sin(const BesAngle a)
double cos(const BesAngle a)
**********INTEGER nmxhep !maximum number of particles DOUBLE PRECISION vhep INTEGER jdahep COMMON hepevt $ !serial number $ !number of particles $ !status code $ !particle ident KF $ !parent particles $ !childreen particles $ !four momentum
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
CgemGeoReadoutPlane(int iLayer, int iSheet, double rx, double rv, double phi_min, double dX_strip, double dV, double w, double zmin, double L, int NXStrip, int NVStrip, double Xpitch, double XstripWidth, double Vpitch, double VstripWidth, double stereoAngle, double midROfGap, double outROfGap)
double getVFromPhiZ(double phi, double z, bool checkRange=true) const
double getVStripLength(int V_ID) const
double incidentAngleV(Hep3Vector momentum, double phi) const
void getFiredStripID(G4ThreeVector pos1, G4ThreeVector pos2, vector< int > &vecXID, vector< int > &vecVID) const
int getVIDInNextSheetFromVID(int vID, double phimin_next) const
double getPhiMin_strip() const
double getVFromLocalXZ(double x, double zeta, bool checkRange=true) const
double getCentralXFromXID(int X_ID) const
double incidentAngleX(Hep3Vector momentum, double phi) const
double getZFromPhiV(double phi, double V, int checkXRange=1) const
double getCentralVFromVID(int V_ID) const
double getPhiFromXID(int X_ID) const
double getZFromXV(double X, double V, int checkXRange=1, int checkVRange=1) const
double getDist2ClosestXStripCenter(double phi, int &id)
int getClosestXStripID(double phi, double &dist)
int getXStripID(double phi) const
bool OnThePlane(double phi, double z) const
double getVFromPhiZ_nearPhiMin(double phi, double z, bool checkRange=true) const
int getVIDFromV(double V) const
double dAngleAcute(double phi1, double phi2) const
double getX(double phi) const
double getVInNextSheetFromV(double v, double phiminNext) const
int getClosestVStripID(G4ThreeVector pos, double &dist) const
void getStripID(G4ThreeVector pos, int &X_ID, int &V_ID) const
double getDist2ClosestVStripCenter(G4ThreeVector pos, int &id)