CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Private Attributes
DDHGCalHEAlgo Class Reference

#include <DDHGCalHEAlgo.h>

Inheritance diagram for DDHGCalHEAlgo:

Classes

struct  HGCalHEPar
 

Public Member Functions

 DDHGCalHEAlgo ()
 
void execute (DDCompactView &cpv)
 
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
 
virtual ~DDHGCalHEAlgo ()
 

Protected Member Functions

void constructLayers (DDLogicalPart, DDCompactView &cpv)
 
HGCalHEPar parameterLayer (double rinF, double routF, double rinB, double routB, double zi, double zo)
 
HGCalHEPar parameterLayer (int type, double rinF, double routF, double rinB, double routB, double zi, double zo)
 
double rMax (double z)
 

Private Attributes

std::vector< int > copyNumber
 
std::vector< int > heightType
 
std::string idName
 
std::string idNameSpace
 
std::vector< int > layerType
 
std::vector< std::string > materials
 
std::vector< std::string > names
 
std::vector< double > rMaxFront
 
std::string rotstr
 
int sectors
 
double slopeB
 
std::vector< double > slopeT
 
std::vector< double > thick
 
double thickModule
 
std::vector< int > type
 
std::vector< double > zFront
 
std::vector< double > zMinBlock
 

Detailed Description

Definition at line 10 of file DDHGCalHEAlgo.h.

Constructor & Destructor Documentation

DDHGCalHEAlgo::DDHGCalHEAlgo ( )

Definition at line 20 of file DDHGCalHEAlgo.cc.

20  {
21  edm::LogInfo("HGCalGeom") << "DDHGCalHEAlgo info: Creating an instance";
22 }
DDHGCalHEAlgo::~DDHGCalHEAlgo ( )
virtual

Definition at line 24 of file DDHGCalHEAlgo.cc.

24 {}

Member Function Documentation

void DDHGCalHEAlgo::constructLayers ( DDLogicalPart  module,
DDCompactView cpv 
)
protected

Definition at line 87 of file DDHGCalHEAlgo.cc.

References DDHGCalHEAlgo::HGCalHEPar::alp, DDHGCalHEAlgo::HGCalHEPar::bl1, DDHGCalHEAlgo::HGCalHEPar::bl2, filterCSVwithJSON::copy, copyNumber, dbl_to_string(), DDBase< N, C >::ddname(), DDSplit(), plotBeamSpotDB::first, heightType, i, idNameSpace, cuy::ii, layerType, materials, mergeVDriftHistosByStation::name, DDBase< N, C >::name(), names, parameterLayer(), DDHGCalHEAlgo::HGCalHEPar::phi, DDCompactView::position(), diffTwoXMLs::r1, rMax(), makeMuonMisalignmentScenario::rot, rotstr, edm::second(), slopeB, AlCaHLTBitMon_QueryRunRegistry::string, DDHGCalHEAlgo::HGCalHEPar::theta, thick, thickModule, DDHGCalHEAlgo::HGCalHEPar::tl1, DDHGCalHEAlgo::HGCalHEPar::tl2, DDSolidFactory::trap(), DDHGCalHEAlgo::HGCalHEPar::xpos, DDHGCalHEAlgo::HGCalHEPar::yh1, DDHGCalHEAlgo::HGCalHEPar::yh2, DDHGCalHEAlgo::HGCalHEPar::ypos, zMinBlock, and DDHGCalHEAlgo::HGCalHEPar::zpos.

Referenced by execute().

87  {
88 
89  edm::LogInfo("HGCalGeom") << "DDHGCalHEAlgo test: \t\tInside Layers";
90 
92  //Pointers to the Rotation Matrices and to the Materials
94 
95  double zz(zMinBlock[0]);
96  for (unsigned int i=0; i<layerType.size(); i++) {
97  int ii = layerType[i];
98  int copy = copyNumber[ii];
99  ++copyNumber[ii];
100  int ityp = type[ii];
101  type[ii] =-ityp;
102  double zi = zMinBlock[ii];
104  if (heightType[i] == 0) zz = zi;
105 
106  double zlayer = zz + 2*thickModule;
107  if((i % 6)>2) zlayer = zz + thickModule;
108 
109  double zo = zi + thick[ii];
110  double rinF = zi * slopeB;
111  double rinB = zlayer * slopeB;
112 
113  double routF = (heightType[i] == 0) ? rMax(zi) : rMax(zz);
114  if((i % 6)>2) routF = (heightType[i] == 0) ? rMax(zi-thickModule) : rMax(zz-thickModule);
115 
116  double routB = rMax(zo);
117  std::string name = "HGCal"+names[ii]+dbl_to_string(copy);
118  edm::LogInfo("HGCalGeom") << "DDHGCalEEAlgo test: Layer " << i << ":"
119  << ii << ":" << ityp << " Front " << zi << ", "
120  << rinF << ", " << routF << " Back " << zo
121  << ", " << rinB << ", " << routB;
122  DDHGCalHEAlgo::HGCalHEPar parm = (ityp == 0) ?
123  parameterLayer(rinF, routF, rinB, routB, zi, zo) :
124  parameterLayer(ityp, rinF, routF, rinB, routB, zi, zo);
126  0.5*thick[ii], parm.theta,
127  parm.phi, parm.yh1, parm.bl1,
128  parm.tl1, parm.alp, parm.yh2,
129  parm.bl2, parm.tl2, parm.alp);
130 
131  DDName matName(DDSplit(materials[ii]).first,
132  DDSplit(materials[ii]).second);
133  DDMaterial matter(matName);
134  DDLogicalPart glog = DDLogicalPart(solid.ddname(), matter, solid);
135  edm::LogInfo("HGCalGeom") << "DDHGCalHEAlgo test: "
136  << solid.name() << " Trap made of " << matName
137  << " of dimensions " << 0.5*thick[ii] << ", "
138  << parm.theta/CLHEP::deg << ", "
139  << parm.phi/CLHEP::deg << ", " << parm.yh1
140  << ", " << parm.bl1 << ", " << parm.tl1
141  << ", " << parm.alp/CLHEP::deg << ", "
142  << parm.yh2 << ", " << parm.bl2 << ", "
143  << parm.tl2 << ", " << parm.alp/CLHEP::deg;
144  DDTranslation r1(parm.xpos, parm.ypos, parm.zpos);
145  cpv.position(glog, module, copy, r1, rot);
146  edm::LogInfo("HGCalGeom") << "DDHGCalHEAlgo test: " << glog.name()
147  << " number " << copy << " positioned in "
148  << module.name() << " at " << r1 << " with "
149  << rot;
150  } // End of loop on layers
151 }
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
std::vector< double > zMinBlock
Definition: DDHGCalHEAlgo.h:49
const N & name() const
Definition: DDBase.h:78
double rMax(double z)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:14
std::string dbl_to_string(const double &in)
Converts only the integer part of a double to a string.
Definition: DDutils.cc:12
int ii
Definition: cuy.py:588
std::vector< int > layerType
Definition: DDHGCalHEAlgo.h:50
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
double thickModule
Definition: DDHGCalHEAlgo.h:52
U second(std::pair< T, U > const &p)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
std::vector< std::string > names
Definition: DDHGCalHEAlgo.h:44
std::vector< int > heightType
Definition: DDHGCalHEAlgo.h:51
std::vector< std::string > materials
Definition: DDHGCalHEAlgo.h:43
static DDSolid trap(const DDName &name, double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
Definition: DDSolid.cc:723
HGCalHEPar parameterLayer(double rinF, double routF, double rinB, double routB, double zi, double zo)
std::string rotstr
Definition: DDHGCalHEAlgo.h:45
std::string idNameSpace
Definition: DDHGCalHEAlgo.h:60
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
std::vector< double > thick
Definition: DDHGCalHEAlgo.h:47
std::vector< int > copyNumber
Definition: DDHGCalHEAlgo.h:46
const N & ddname() const
Definition: DDBase.h:80
void DDHGCalHEAlgo::execute ( DDCompactView cpv)

Definition at line 80 of file DDHGCalHEAlgo.cc.

References constructLayers(), and dbtoconf::parent.

80  {
81 
82  edm::LogInfo("HGCalGeom") << "==>> Constructing DDHGCalHEAlgo...";
83  constructLayers (parent(), cpv);
84  edm::LogInfo("HGCalGeom") << "<<== End of DDHGCalHEAlgo construction ...";
85 }
list parent
Definition: dbtoconf.py:74
void constructLayers(DDLogicalPart, DDCompactView &cpv)
void DDHGCalHEAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 26 of file DDHGCalHEAlgo.cc.

References copyNumber, dbl_to_int(), heightType, i, idName, idNameSpace, layerType, materials, names, DDCurrentNamespace::ns(), dbtoconf::parent, rMaxFront, rotstr, sectors, slopeB, slopeT, thick, thickModule, zFront, and zMinBlock.

30  {
31 
32  materials = vsArgs["MaterialNames"];
33  names = vsArgs["VolumeNames"];
34  thick = vArgs["Thickness"];
35  type = dbl_to_int(vArgs["Type"]);
36  copyNumber = dbl_to_int(vArgs["Offsets"]);
37  zMinBlock = vArgs["ZMinType"];
38  rotstr = sArgs["Rotation"];
39  layerType = dbl_to_int(vArgs["LayerType"]);
40  heightType = dbl_to_int(vArgs["HeightType"]);
41  thickModule = nArgs["ThickModule"];
42  edm::LogInfo("HGCalGeom") << "DDHGCalHEAlgo: " << materials.size()
43  << " volumes to be put with rotation " << rotstr
44  << " in " << layerType.size() << " layers and "
45  << "module thickness " << thickModule;
46  for (unsigned int i=0; i<names.size(); ++i)
47  edm::LogInfo("HGCalGeom") << "Volume [" << i << "] " << names[i]
48  << " filled with " << materials[i] << " of type "
49  << type[i] << " thickness " << thick[i]
50  << " first copy number " << copyNumber[i]
51  << " starting at " << zMinBlock[i];
52  for (unsigned int i=0; i<layerType.size(); ++i)
53  edm::LogInfo("HGCalGeom") << "Layer [" << i << "] with material type "
54  << layerType[i] << " height type "
55  << heightType[i];
56 
57  sectors = (int)(nArgs["Sectors"]);
58  slopeB = nArgs["SlopeBottom"];
59  slopeT = vArgs["SlopeTop"];
60  zFront = vArgs["ZFront"];
61  rMaxFront = vArgs["RMaxFront"];
62  idName = parent().name().name();
64  edm::LogInfo("HGCalGeom") << "DDHGCalHEAlgo: Bottom slope " << slopeB
65  << " " << slopeT.size() << " slopes for top";
66  for (unsigned int i=0; i<slopeT.size(); ++i)
67  edm::LogInfo("HGCalGeom") << "Block [" << i << "] Zmin " << zFront[i]
68  << " Rmax " << rMaxFront[i] << " Slope "
69  << slopeT[i];
70  edm::LogInfo("HGCalGeom") << "DDHGCalHEAlgo: Sectors " << sectors
71  << "\tNameSpace:Name " << idNameSpace
72  << ":" << idName;
73 
74 }
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
std::vector< double > zMinBlock
Definition: DDHGCalHEAlgo.h:49
std::vector< double > zFront
Definition: DDHGCalHEAlgo.h:56
list parent
Definition: dbtoconf.py:74
static std::string & ns()
std::vector< int > layerType
Definition: DDHGCalHEAlgo.h:50
double thickModule
Definition: DDHGCalHEAlgo.h:52
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.cc:4
std::vector< std::string > names
Definition: DDHGCalHEAlgo.h:44
std::vector< int > heightType
Definition: DDHGCalHEAlgo.h:51
std::vector< std::string > materials
Definition: DDHGCalHEAlgo.h:43
std::string rotstr
Definition: DDHGCalHEAlgo.h:45
std::string idNameSpace
Definition: DDHGCalHEAlgo.h:60
std::vector< double > thick
Definition: DDHGCalHEAlgo.h:47
std::string idName
Definition: DDHGCalHEAlgo.h:59
std::vector< double > slopeT
Definition: DDHGCalHEAlgo.h:55
std::vector< double > rMaxFront
Definition: DDHGCalHEAlgo.h:57
std::vector< int > copyNumber
Definition: DDHGCalHEAlgo.h:46
DDHGCalHEAlgo::HGCalHEPar DDHGCalHEAlgo::parameterLayer ( double  rinF,
double  routF,
double  rinB,
double  routB,
double  zi,
double  zo 
)
protected

Definition at line 155 of file DDHGCalHEAlgo.cc.

References DDHGCalHEAlgo::HGCalHEPar::alp, alpha, DDHGCalHEAlgo::HGCalHEPar::bl1, DDHGCalHEAlgo::HGCalHEPar::bl2, funct::cos(), DDHGCalHEAlgo::HGCalHEPar::phi, pi, sectors, funct::sin(), funct::tan(), DDHGCalHEAlgo::HGCalHEPar::theta, DDHGCalHEAlgo::HGCalHEPar::tl1, DDHGCalHEAlgo::HGCalHEPar::tl2, DDHGCalHEAlgo::HGCalHEPar::xpos, DDHGCalHEAlgo::HGCalHEPar::yh1, DDHGCalHEAlgo::HGCalHEPar::yh2, DDHGCalHEAlgo::HGCalHEPar::ypos, and DDHGCalHEAlgo::HGCalHEPar::zpos.

Referenced by constructLayers().

156  {
157 
159  //Given rin, rout compute parameters of the trapezoid and
160  //position of the trapezoid for a standrd layer
161  double alpha = CLHEP::pi/sectors;
162  double rout = routF;
163  edm::LogInfo("HGCalGeom") << "Input: Front " << rinF << " " << routF << " "
164  << zi << " Back " << rinB << " " << routB << " "
165  << zo << " Alpha " << alpha/CLHEP::deg << " Rout "
166  << rout;
167 
168  parm.yh2 = parm.yh1 = 0.5 * (rout*cos(alpha) - rinB);
169  parm.bl2 = parm.bl1 = rinB * tan(alpha);
170  parm.tl2 = parm.tl1 = rout * sin(alpha);
171  parm.xpos = 0.5*(rout*cos(alpha)+rinB);
172  parm.ypos = 0.0;
173  parm.zpos = 0.5*(zi+zo);
174  parm.alp = parm.theta = parm.phi = 0;
175  edm::LogInfo("HGCalGeom") << "Output Dimensions " << parm.yh1 << " "
176  << parm.bl1 << " " << parm.tl1 << " " << parm.yh2
177  << " " << parm.bl2 << " " << parm.tl2 << " "
178  << parm.alp/CLHEP::deg <<" "<<parm.theta/CLHEP::deg
179  << " " << parm.phi/CLHEP::deg << " Position "
180  << parm.xpos << " " << parm.ypos <<" " <<parm.zpos;
181  return parm;
182 }
float alpha
Definition: AMPTWrapper.h:95
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const Double_t pi
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
DDHGCalHEAlgo::HGCalHEPar DDHGCalHEAlgo::parameterLayer ( int  type,
double  rinF,
double  routF,
double  rinB,
double  routB,
double  zi,
double  zo 
)
protected

Definition at line 185 of file DDHGCalHEAlgo.cc.

References DDHGCalHEAlgo::HGCalHEPar::alp, alpha, DDHGCalHEAlgo::HGCalHEPar::bl1, DDHGCalHEAlgo::HGCalHEPar::bl2, funct::cos(), alignCSCRings::e, DDHGCalHEAlgo::HGCalHEPar::phi, pi, alignCSCRings::r, sectors, funct::sin(), mathSSE::sqrt(), funct::tan(), DDHGCalHEAlgo::HGCalHEPar::theta, DDHGCalHEAlgo::HGCalHEPar::tl1, DDHGCalHEAlgo::HGCalHEPar::tl2, DDHGCalHEAlgo::HGCalHEPar::xpos, DDHGCalHEAlgo::HGCalHEPar::yh1, DDHGCalHEAlgo::HGCalHEPar::yh2, DDHGCalHEAlgo::HGCalHEPar::ypos, and DDHGCalHEAlgo::HGCalHEPar::zpos.

186  {
187 
189  //Given rin, rout compute parameters of the trapezoid and
190  //position of the trapezoid for a standrd layer
191  double alpha = CLHEP::pi/sectors;
192  double rout = routF;
193  edm::LogInfo("HGCalGeom") << "Input " << type << " Front " << rinF << " "
194  << routF << " " << zi << " Back " << rinB << " "
195  << routB << " " << zo <<" Alpha "
196  << alpha/CLHEP::deg << " rout " << rout;
197 
198  parm.yh2 = parm.yh1 = 0.5 * (rout*cos(alpha) - rinB);
199  parm.bl2 = parm.bl1 = 0.5 * rinB * tan(alpha);
200  parm.tl2 = parm.tl1 = 0.5 * rout * sin(alpha);
201  double dx = 0.25* (parm.bl2+parm.tl2-parm.bl1-parm.tl1);
202  double dy = 0.0;
203  parm.xpos = 0.5*(rout*cos(alpha)+rinB);
204  parm.ypos = 0.25*(parm.bl2+parm.tl2+parm.bl1+parm.tl1);
205  parm.zpos = 0.5*(zi+zo);
206  parm.alp = atan(0.5 * tan(alpha));
207  if (type > 0) {
208  parm.ypos = -parm.ypos;
209  } else {
210  parm.alp = -parm.alp;
211  dx = -dx;
212  }
213  double r = sqrt (dx*dx + dy*dy);
214  edm::LogInfo("HGCalGeom") << "dx|dy|r " << dx << ":" << dy << ":" << r;
215  if (r > 1.0e-8) {
216  parm.theta = atan (r/(zo-zi));
217  parm.phi = atan2 (dy, dx);
218  } else {
219  parm.theta = parm.phi = 0;
220  }
221  edm::LogInfo("HGCalGeom") << "Output Dimensions " << parm.yh1 << " "
222  << parm.bl1 << " " << parm.tl1 << " " << parm.yh2
223  << " " << parm.bl2 << " " << parm.tl2 << " "
224  << parm.alp/CLHEP::deg <<" " <<parm.theta/CLHEP::deg
225  << " " << parm.phi/CLHEP::deg << " Position "
226  << parm.xpos << " " << parm.ypos << " " <<parm.zpos;
227  return parm;
228 }
type
Definition: HCALResponse.h:21
float alpha
Definition: AMPTWrapper.h:95
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const Double_t pi
T sqrt(T t)
Definition: SSEVec.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double DDHGCalHEAlgo::rMax ( double  z)
protected

Definition at line 230 of file DDHGCalHEAlgo.cc.

References relval_steps::k, alignCSCRings::r, rMaxFront, slopeT, and zFront.

Referenced by constructLayers().

230  {
231 
232  double r(0);
233  unsigned int ik(0);
234  for (unsigned int k=0; k<slopeT.size(); ++k) {
235  if (z < zFront[k]) break;
236  r = rMaxFront[k] + (z - zFront[k]) * slopeT[k];
237  ik = k;
238  }
239  edm::LogInfo("HGCalGeom") << "rMax : " << z << ":" << ik << ":" << r ;
240  return r;
241 }
std::vector< double > zFront
Definition: DDHGCalHEAlgo.h:56
std::vector< double > slopeT
Definition: DDHGCalHEAlgo.h:55
std::vector< double > rMaxFront
Definition: DDHGCalHEAlgo.h:57

Member Data Documentation

std::vector<int> DDHGCalHEAlgo::copyNumber
private

Definition at line 46 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<int> DDHGCalHEAlgo::heightType
private

Definition at line 51 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

std::string DDHGCalHEAlgo::idName
private

Definition at line 59 of file DDHGCalHEAlgo.h.

Referenced by initialize().

std::string DDHGCalHEAlgo::idNameSpace
private

Definition at line 60 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<int> DDHGCalHEAlgo::layerType
private

Definition at line 50 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<std::string> DDHGCalHEAlgo::materials
private

Definition at line 43 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<std::string> DDHGCalHEAlgo::names
private

Definition at line 44 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<double> DDHGCalHEAlgo::rMaxFront
private

Definition at line 57 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and rMax().

std::string DDHGCalHEAlgo::rotstr
private

Definition at line 45 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

int DDHGCalHEAlgo::sectors
private

Definition at line 53 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and parameterLayer().

double DDHGCalHEAlgo::slopeB
private

Definition at line 54 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<double> DDHGCalHEAlgo::slopeT
private

Definition at line 55 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and rMax().

std::vector<double> DDHGCalHEAlgo::thick
private

Definition at line 47 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

double DDHGCalHEAlgo::thickModule
private

Definition at line 52 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<int> DDHGCalHEAlgo::type
private
std::vector<double> DDHGCalHEAlgo::zFront
private

Definition at line 56 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and rMax().

std::vector<double> DDHGCalHEAlgo::zMinBlock
private

Definition at line 49 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().