test
CMS 3D CMS Logo

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

#include <DDHGCalModuleAlgo.h>

Inheritance diagram for DDHGCalModuleAlgo:

Public Member Functions

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

Protected Member Functions

void constructLayers (DDLogicalPart, DDCompactView &cpv)
 
void positionSensitive (DDLogicalPart &glog, double rin, double rout, DDCompactView &cpv)
 
double rMax (double z)
 

Private Attributes

std::unordered_set< int > copies
 
std::vector< int > copyNumber
 
std::string idName
 
std::string idNameSpace
 
std::vector< int > layers
 
std::vector< int > layerSense
 
std::vector< double > layerThick
 
std::vector< int > layerType
 
std::vector< std::string > materials
 
std::vector< std::string > names
 
double rMaxFine
 
std::vector< double > rMaxFront
 
int sectors
 
std::vector< double > slopeB
 
std::vector< double > slopeT
 
std::vector< double > thick
 
std::vector< std::string > wafer
 
double waferW
 
std::vector< double > zFront
 
double zMinBlock
 

Detailed Description

Definition at line 11 of file DDHGCalModuleAlgo.h.

Constructor & Destructor Documentation

DDHGCalModuleAlgo::DDHGCalModuleAlgo ( )

Definition at line 22 of file DDHGCalModuleAlgo.cc.

22  {
23 #ifdef DebugLog
24  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo info: Creating an instance";
25 #endif
26 }
DDHGCalModuleAlgo::~DDHGCalModuleAlgo ( )
virtual

Definition at line 28 of file DDHGCalModuleAlgo.cc.

28 {}

Member Function Documentation

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

Definition at line 124 of file DDHGCalModuleAlgo.cc.

References alpha, filterCSVwithJSON::copy, copyNumber, funct::cos(), dbl_to_string(), DDBase< N, C >::ddname(), DDSplit(), plotBeamSpotDB::first, i, idNameSpace, cuy::ii, relval_2017::k, layers, layerSense, layerThick, layerType, materials, mergeVDriftHistosByStation::name, DDBase< N, C >::name(), names, pi, DDSolidFactory::polyhedra(), DDCompactView::position(), positionSensitive(), diffTwoXMLs::r1, rMax(), makeMuonMisalignmentScenario::rot, edm::second(), sectors, slopeB, AlCaHLTBitMon_QueryRunRegistry::string, thick, DDSolidFactory::tubs(), and zMinBlock.

Referenced by execute().

125  {
126 
127 #ifdef DebugLog
128  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo test: \t\tInside Layers";
129 #endif
130  double zi(zMinBlock);
131  int laymin(0);
132  const double tol(0.01);
133  for (unsigned int i=0; i<layers.size(); i++) {
134  double zo = zi + layerThick[i];
135  double routF = rMax(zi);
136  int laymax = laymin+layers[i];
137  double zz = zi;
138  for (int ly=laymin; ly<laymax; ++ly) {
139  int ii = layerType[ly];
140  int copy = copyNumber[ii];
141  double rinB = (layerSense[ly] == 0) ? (zo*slopeB[0]) : (zo*slopeB[1]);
142  zz += (0.5*thick[ii]);
143 
144  std::string name = "HGCal"+names[ii]+dbl_to_string(copy);
145 #ifdef DebugLog
146  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo test: Layer " << ly << ":"
147  << ii << " Front " << zi << ", " << routF
148  << " Back " << zo << ", " << rinB
149  << " superlayer thickness " << layerThick[i];
150 #endif
151  DDName matName(DDSplit(materials[ii]).first,
152  DDSplit(materials[ii]).second);
153  DDMaterial matter(matName);
154  DDLogicalPart glog;
155  if (layerSense[ly] == 0) {
156  double alpha = CLHEP::pi/sectors;
157  double rmax = routF*cos(alpha) - tol;
158  std::vector<double> pgonZ, pgonRin, pgonRout;
159  pgonZ.push_back(-0.5*thick[ii]); pgonZ.push_back(0.5*thick[ii]);
160  pgonRin.push_back(rinB); pgonRin.push_back(rinB);
161  pgonRout.push_back(rmax); pgonRout.push_back(rmax);
163  sectors, -alpha, CLHEP::twopi,
164  pgonZ, pgonRin, pgonRout);
165  glog = DDLogicalPart(solid.ddname(), matter, solid);
166 #ifdef DebugLog
167  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo test: "
168  << solid.name() << " polyhedra of " << sectors
169  << " sectors covering " << -alpha/CLHEP::deg
170  << ":" << (-alpha+CLHEP::twopi)/CLHEP::deg
171  << " with " << pgonZ.size() << " sections";
172  for (unsigned int k=0; k<pgonZ.size(); ++k)
173  edm::LogInfo("HGCalGeom") << "[" << k << "] z " << pgonZ[k] << " R "
174  << pgonRin[k] << ":" << pgonRout[k];
175 #endif
176  } else {
178  0.5*thick[ii], rinB, routF, 0.0,
179  CLHEP::twopi);
180  glog = DDLogicalPart(solid.ddname(), matter, solid);
181 #ifdef DebugLog
182  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo test: "
183  << solid.name() << " Tubs made of " << matName
184  << " of dimensions " << rinB << ", " << routF
185  << ", " << 0.5*thick[ii] << ", 0.0, "
186  << CLHEP::twopi/CLHEP::deg;
187 #endif
188  positionSensitive(glog,rinB,routF,cpv);
189  }
190  DDTranslation r1(0,0,zz);
191  DDRotation rot;
192  cpv.position(glog, module, copy, r1, rot);
193  ++copyNumber[ii];
194 #ifdef DebugLog
195  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo test: " << glog.name()
196  << " number " << copy << " positioned in "
197  << module.name() << " at " << r1 << " with "
198  << rot;
199 #endif
200  zz += (0.5*thick[ii]);
201  } // End of loop over layers in a block
202  zi = zo;
203  laymin = laymax;
204  } // End of loop over blocks
205 }
std::vector< int > copyNumber
std::vector< double > thick
int i
Definition: DBlmapReader.cc:9
float alpha
Definition: AMPTWrapper.h:95
const N & name() const
Definition: DDBase.h:78
void positionSensitive(DDLogicalPart &glog, double rin, double rout, DDCompactView &cpv)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
std::vector< std::string > names
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
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
const Double_t pi
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
std::vector< std::string > materials
U second(std::pair< T, U > const &p)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:788
std::vector< double > slopeB
std::string idNameSpace
std::vector< int > layerType
std::vector< int > layers
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
static DDSolid polyhedra(const DDName &name, int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polyhedra (refere to Geant3 or Geant4 documentation)
Definition: DDSolid.cc:673
std::vector< double > layerThick
double rMax(double z)
std::vector< int > layerSense
const N & ddname() const
Definition: DDBase.h:80
void DDHGCalModuleAlgo::execute ( DDCompactView cpv)

Definition at line 110 of file DDHGCalModuleAlgo.cc.

References constructLayers(), and copies.

110  {
111 
112 #ifdef DebugLog
113  edm::LogInfo("HGCalGeom") << "==>> Constructing DDHGCalModuleAlgo...";
114 #endif
115  copies.clear();
116  constructLayers (parent(), cpv);
117  edm::LogInfo("HGCalGeom") << copies.size() << " different wafer copy numbers";
118  copies.clear();
119 #ifdef DebugLog
120  edm::LogInfo("HGCalGeom") << "<<== End of DDHGCalModuleAlgo construction ...";
121 #endif
122 }
std::unordered_set< int > copies
void constructLayers(DDLogicalPart, DDCompactView &cpv)
void DDHGCalModuleAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 30 of file DDHGCalModuleAlgo.cc.

References copyNumber, dbl_to_int(), i, idNameSpace, layers, layerSense, layerThick, layerType, materials, names, DDCurrentNamespace::ns(), rMaxFine, rMaxFront, sectors, slopeB, slopeT, thick, wafer, waferW, zFront, and zMinBlock.

34  {
35 
36  wafer = vsArgs["WaferName"];
37 #ifdef DebugLog
38  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo: " << wafer.size()
39  << " wafers";
40  for (unsigned int i=0; i<wafer.size(); ++i)
41  edm::LogInfo("HGCalGeom") << "Wafer[" << i << "] " << wafer[i];
42 #endif
43  materials = vsArgs["MaterialNames"];
44  names = vsArgs["VolumeNames"];
45  thick = vArgs["Thickness"];
46  for (unsigned int i=0; i<materials.size(); ++i) {
47  copyNumber.push_back(1);
48  }
49 #ifdef DebugLog
50  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo: " << materials.size()
51  << " types of volumes";
52  for (unsigned int i=0; i<names.size(); ++i)
53  edm::LogInfo("HGCalGeom") << "Volume [" << i << "] " << names[i]
54  << " of thickness " << thick[i]
55  << " filled with " << materials[i]
56  << " first copy number " << copyNumber[i];
57 #endif
58  layers = dbl_to_int(vArgs["Layers"]);
59  layerThick = vArgs["LayerThick"];
60 #ifdef DebugLog
61  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo: " << layers.size()
62  << " blocks";
63  for (unsigned int i=0; i<layers.size(); ++i)
64  edm::LogInfo("HGCalGeom") << "Block [" << i << "] of thickness "
65  << layerThick[i] << " with " << layers[i]
66  << " layers";
67 #endif
68  layerType = dbl_to_int(vArgs["LayerType"]);
69  layerSense = dbl_to_int(vArgs["LayerSense"]);
70 #ifdef DebugLog
71  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo: " << layerType.size()
72  << " layers";
73  for (unsigned int i=0; i<layerType.size(); ++i)
74  edm::LogInfo("HGCalGeom") << "Layer [" << i << "] with material type "
75  << layerType[i] << " sensitive class "
76  << layerSense[i];
77 #endif
78  zMinBlock = nArgs["zMinBlock"];
79  rMaxFine = nArgs["rMaxFine"];
80  waferW = nArgs["waferW"];
81  sectors = (int)(nArgs["Sectors"]);
82 #ifdef DebugLog
83  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo: zStart " << zMinBlock
84  << " rFineCoarse " << rMaxFine << " wafer width "
85  << waferW << " sectors " << sectors;
86 #endif
87  slopeB = vArgs["SlopeBottom"];
88  slopeT = vArgs["SlopeTop"];
89  zFront = vArgs["ZFront"];
90  rMaxFront = vArgs["RMaxFront"];
91 #ifdef DebugLog
92  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo: Bottom slopes " << slopeB[0]
93  << ":" << slopeB[1] << " and " << slopeT.size()
94  << " slopes for top";
95  for (unsigned int i=0; i<slopeT.size(); ++i)
96  edm::LogInfo("HGCalGeom") << "Block [" << i << "] Zmin " << zFront[i]
97  << " Rmax " << rMaxFront[i] << " Slope "
98  << slopeT[i];
99 #endif
101 #ifdef DebugLog
102  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo: NameSpace " << idNameSpace;
103 #endif
104 }
std::vector< int > copyNumber
std::vector< double > thick
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > names
static std::string & ns()
std::vector< std::string > materials
std::vector< double > rMaxFront
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< double > slopeB
std::string idNameSpace
std::vector< int > layerType
std::vector< int > layers
std::vector< double > slopeT
std::vector< std::string > wafer
std::vector< double > zFront
std::vector< double > layerThick
std::vector< int > layerSense
void DDHGCalModuleAlgo::positionSensitive ( DDLogicalPart glog,
double  rin,
double  rout,
DDCompactView cpv 
)
protected

Definition at line 225 of file DDHGCalModuleAlgo.cc.

References copies, filterCSVwithJSON::copy, DDBase< N, C >::ddname(), DDSplit(), mergeVDriftHistosByStation::name, DDCompactView::position(), rMaxFine, idealTransformation::rotation, findQualityFiles::rr, mathSSE::sqrt(), funct::tan(), wafer, and waferW.

Referenced by constructLayers().

226  {
227  double dx = 0.5*waferW;
228  double dy = 3.0*dx*tan(30.0*CLHEP::deg);
229  double rr = 2.0*dx*tan(30.0*CLHEP::deg);
230  int ncol = (int)(2.0*rout/waferW) + 1;
231  int nrow = (int)(rout/(waferW*tan(30.0*CLHEP::deg))) + 1;
232  int incm(0), inrm(0), kount(0);
233 #ifdef DebugLog
234  edm::LogInfo("HGCalGeom") << glog.ddname() << " rout " << rout << " Row "
235  << nrow << " Column " << ncol;
236 #endif
237  for (int nr=-nrow; nr <= nrow; ++nr) {
238  int inr = (nr >= 0) ? nr : -nr;
239  for (int nc=-ncol; nc <= ncol; ++nc) {
240  int inc = (nc >= 0) ? nc : -nc;
241  if (inr%2 == inc%2) {
242  double xpos = nc*dx;
243  double ypos = nr*dy;
244  double rpos = std::sqrt(xpos*xpos+ypos*ypos);
245  if (rpos-rr >= rin && rpos+rr <= rout) {
246  DDTranslation tran(xpos, ypos, 0.0);
248  int copy = inr*100 + inc;
249  if (nc < 0) copy += 10000;
250  if (nr < 0) copy += 100000;
251  DDName name = (rpos < rMaxFine) ?
252  DDName(DDSplit(wafer[0]).first, DDSplit(wafer[0]).second) :
253  DDName(DDSplit(wafer[1]).first, DDSplit(wafer[1]).second);
254  cpv.position(name, glog.ddname(), copy, tran, rotation);
255  if (inc > incm) incm = inc;
256  if (inr > inrm) inrm = inr;
257  kount++;
258  if ( copies.count(copy) == 0 )
259  copies.insert(copy);
260 #ifdef DebugLog
261  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo: "
262  << name << " number " << copy
263  << " positioned in " << glog.ddname()
264  << " at " << tran << " with " << rotation;
265 #endif
266  }
267  }
268  }
269  }
270  edm::LogInfo("HGCalGeom") << "DDHGCalModuleAlgo: # of columns " << incm
271  << " # of rows " << inrm << " and " << kount
272  << " wafers for " <<glog.ddname();
273 }
std::unordered_set< int > copies
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
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
T sqrt(T t)
Definition: SSEVec.h:18
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
std::vector< std::string > wafer
const N & ddname() const
Definition: DDBase.h:80
double DDHGCalModuleAlgo::rMax ( double  z)
protected

Definition at line 207 of file DDHGCalModuleAlgo.cc.

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

Referenced by constructLayers().

207  {
208  double r(0);
209 #ifdef DebugLog
210  unsigned int ik(0);
211 #endif
212  for (unsigned int k=0; k<slopeT.size(); ++k) {
213  if (z < zFront[k]) break;
214  r = rMaxFront[k] + (z - zFront[k]) * slopeT[k];
215 #ifdef DebugLog
216  ik = k;
217 #endif
218  }
219 #ifdef DebugLog
220  edm::LogInfo("HGCalGeom") << "rMax : " << z << ":" << ik << ":" << r ;
221 #endif
222  return r;
223 }
std::vector< double > rMaxFront
std::vector< double > slopeT
std::vector< double > zFront

Member Data Documentation

std::unordered_set<int> DDHGCalModuleAlgo::copies
private

Definition at line 53 of file DDHGCalModuleAlgo.h.

Referenced by execute(), and positionSensitive().

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

Definition at line 38 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

std::string DDHGCalModuleAlgo::idName
private

Definition at line 51 of file DDHGCalModuleAlgo.h.

std::string DDHGCalModuleAlgo::idNameSpace
private

Definition at line 52 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<int> DDHGCalModuleAlgo::layers
private

Definition at line 39 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<int> DDHGCalModuleAlgo::layerSense
private

Definition at line 42 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<double> DDHGCalModuleAlgo::layerThick
private

Definition at line 40 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 41 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 35 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 36 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

double DDHGCalModuleAlgo::rMaxFine
private

Definition at line 44 of file DDHGCalModuleAlgo.h.

Referenced by initialize(), and positionSensitive().

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

Definition at line 50 of file DDHGCalModuleAlgo.h.

Referenced by initialize(), and rMax().

int DDHGCalModuleAlgo::sectors
private

Definition at line 46 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<double> DDHGCalModuleAlgo::slopeB
private

Definition at line 47 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 48 of file DDHGCalModuleAlgo.h.

Referenced by initialize(), and rMax().

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

Definition at line 37 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<std::string> DDHGCalModuleAlgo::wafer
private

Definition at line 34 of file DDHGCalModuleAlgo.h.

Referenced by initialize(), and positionSensitive().

double DDHGCalModuleAlgo::waferW
private

Definition at line 45 of file DDHGCalModuleAlgo.h.

Referenced by initialize(), and positionSensitive().

std::vector<double> DDHGCalModuleAlgo::zFront
private

Definition at line 49 of file DDHGCalModuleAlgo.h.

Referenced by initialize(), and rMax().

double DDHGCalModuleAlgo::zMinBlock
private

Definition at line 43 of file DDHGCalModuleAlgo.h.

Referenced by constructLayers(), and initialize().