CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCGeometry.cc
Go to the documentation of this file.
7 
8 #include <string>
9 
11  : debugV_(false),
12  gangedstripsME1a_(true),
13  onlywiresME1a_(false),
14  realWireGeometry_(true),
15  useCentreTIOffsets_(false) {
16  if (debugV_)
18 }
19 
21  bool dbgv, bool gangedstripsME1a, bool onlywiresME1a, bool realWireGeometry, bool useCentreTIOffsets)
22  : debugV_(dbgv),
23  gangedstripsME1a_(gangedstripsME1a),
24  onlywiresME1a_(onlywiresME1a),
25  realWireGeometry_(realWireGeometry),
26  useCentreTIOffsets_(useCentreTIOffsets) {
27  if (debugV_)
29 }
30 
32 
34  deallocate();
35 
36  theChambers.clear();
37  theMap.clear();
38  theDetTypes.clear();
39  theDets.clear();
40  theDetUnits.clear();
41  theDetIds.clear();
42  theDetUnitIds.clear();
43  theLayers.clear();
44  specsContainer.clear();
45 }
46 
48  // delete all the chambers (which will delete the layers)
49  for (ChamberContainer::const_iterator ich = theChambers.begin(); ich != theChambers.end(); ++ich)
50  delete (*ich);
51 
52  // delete specs
53  for (CSCSpecsContainer::const_iterator it = specsContainer.begin(); it != specsContainer.end(); ++it) {
54  delete (*it).second; // they are never shared per chamber type so should be no possible double deletion.
55  }
56 }
57 
59  theChambers.emplace_back(ch);
60  addDet(ch);
61 }
62 
64  theDetUnits.emplace_back(l);
65  theLayers.emplace_back(l);
66  theDetTypes.emplace_back(l->chamber()->specs());
67  theDetUnitIds.emplace_back(l->geographicalId());
68  addDet(l);
69 }
70 
71 void CSCGeometry::addDetType(GeomDetType* type) { theDetTypes.emplace_back(type); }
72 
74  theDets.emplace_back(det);
75  theDetIds.emplace_back(det->geographicalId());
76  theMap.insert(CSCDetMap::value_type(det->geographicalId(), det));
77 }
78 
80 
82 
84 
86 
88 
89 const GeomDet* CSCGeometry::idToDetUnit(DetId id) const { return dynamic_cast<const GeomDet*>(idToDet(id)); }
90 
92  CSCDetMap::const_iterator i = theMap.find(id);
93  return (i != theMap.end()) ? i->second : nullptr;
94 }
95 
97 
99 
101  CSCDetId id1(id.endcap(), id.station(), id.ring(), id.chamber(), 0);
102  return dynamic_cast<const CSCChamber*>(idToDet(id1));
103 }
104 
105 const CSCLayer* CSCGeometry::layer(CSCDetId id) const { return dynamic_cast<const CSCLayer*>(idToDetUnit(id)); }
106 
108  // Dump user-selected overall modelling parameters.
109  // Only requires calling once per job.
110 
111  LogTrace("CSCGeometry|CSC") << "CSCGeometry::queryModelling entered...";
112 
113  edm::LogInfo("CSC") << "CSCGeometry version 18-Oct-2012 queryModelling...\n";
114 
115  std::string gs = " ";
116  if (gangedstripsME1a_)
117  gs = "GANGED";
118  else
119  gs = "UNGANGED";
120 
121  edm::LogInfo("CSC") << "CSCGeometry: in ME1a use " << gs << " strips"
122  << "\n";
123 
124  std::string wo = " ";
125  if (onlywiresME1a_)
126  wo = "WIRES ONLY";
127  else
128  wo = "WIRES & STRIPS";
129 
130  edm::LogInfo("CSC") << "CSCGeometry: in ME1a use " << wo << "\n";
131 
132  std::string wg = " ";
133  if (realWireGeometry_)
134  wg = "REAL";
135  else
136  wg = "PSEUDO";
137 
138  edm::LogInfo("CSC") << "CSCGeometry: wires are modelled using " << wg << " wire geometry "
139  << "\n";
140 
141  std::string cti = " ";
143  cti = "WITH";
144  else
145  cti = "WITHOUT";
146 
147  edm::LogInfo("CSC") << "CSCGeometry: strip plane centre-to-intersection ideal " << cti << " corrections "
148  << "\n";
149 }
150 
151 const CSCChamberSpecs* CSCGeometry::findSpecs(int iChamberType) {
152  const CSCChamberSpecs* aSpecs = nullptr;
153  CSCSpecsContainer::const_iterator it = specsContainer.find(iChamberType);
154  if (it != specsContainer.end())
155  aSpecs = (*it).second;
156  return aSpecs;
157 }
158 
159 const CSCChamberSpecs* CSCGeometry::buildSpecs(int iChamberType,
160  const std::vector<float>& fpar,
161  const std::vector<float>& fupar,
162  const CSCWireGroupPackage& wg) {
163  // Note arg list order is hbot, htop, apothem, hthickness
164  TrapezoidalPlaneBounds bounds(fpar[0], fpar[1], fpar[3], fpar[2]);
165  const CSCChamberSpecs* aSpecs = new CSCChamberSpecs(this, iChamberType, bounds, fupar, wg);
166  specsContainer[iChamberType] = aSpecs;
167  return aSpecs;
168 }
CSCSpecsContainer specsContainer
Definition: CSCGeometry.h:181
void deallocate()
deallocate managed memory
Definition: CSCGeometry.cc:47
void addDet(GeomDet *det)
Add a GeomDet; not to be called by the builder.
Definition: CSCGeometry.cc:73
DetContainer theDetUnits
Definition: CSCGeometry.h:164
const CSCChamberSpecs * buildSpecs(int iChamberType, const std::vector< float > &fpar, const std::vector< float > &fupar, const CSCWireGroupPackage &wg)
Definition: CSCGeometry.cc:159
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: CSCGeometry.cc:81
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: CSCGeometry.cc:87
void clear()
Definition: CSCGeometry.cc:33
CSCDetMap theMap
Definition: CSCGeometry.h:158
void queryModelling() const
Dump parameters for overall strip and wire modelling.
Definition: CSCGeometry.cc:107
DetContainer theDets
Definition: CSCGeometry.h:163
void addChamber(CSCChamber *ch)
Add a chamber with given DetId.
Definition: CSCGeometry.cc:58
const ChamberContainer & chambers() const
Return a vector of all chambers.
Definition: CSCGeometry.cc:96
ChamberContainer theChambers
Definition: CSCGeometry.h:155
DetTypeContainer theDetTypes
Definition: CSCGeometry.h:162
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
Definition: CSCGeometry.cc:85
bool realWireGeometry_
Definition: CSCGeometry.h:177
#define LogTrace(id)
void addLayer(CSCLayer *l)
Add a DetUnit.
Definition: CSCGeometry.cc:63
std::vector< const GeomDet * > DetContainer
const CSCChamberSpecs * findSpecs(int iChamberType)
Definition: CSCGeometry.cc:151
void addDetType(GeomDetType *type)
Add a DetType.
Definition: CSCGeometry.cc:71
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: CSCGeometry.cc:79
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:39
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: CSCGeometry.cc:83
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
Log< level::Info, false > LogInfo
Definition: DetId.h:17
bool useCentreTIOffsets_
Definition: CSCGeometry.h:178
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
DetIdContainer theDetIds
Definition: CSCGeometry.h:165
bool gangedstripsME1a_
Definition: CSCGeometry.h:175
DetIdContainer theDetUnitIds
Definition: CSCGeometry.h:166
std::vector< DetId > DetIdContainer
std::vector< const CSCChamber * > ChamberContainer
Definition: CSCGeometry.h:30
CSCGeometry()
Default constructor.
Definition: CSCGeometry.cc:10
LayerContainer theLayers
Definition: CSCGeometry.h:169
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105
std::vector< const GeomDetType * > DetTypeContainer
std::vector< const CSCLayer * > LayerContainer
Definition: CSCGeometry.h:31
~CSCGeometry() override
Destructor.
Definition: CSCGeometry.cc:31
const CSCChamber * chamber() const
Definition: CSCLayer.h:49
bool onlywiresME1a_
Definition: CSCGeometry.h:176
const LayerContainer & layers() const
Return a vector of all layers.
Definition: CSCGeometry.cc:98
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: CSCGeometry.cc:89
const GeomDet * idToDet(DetId) const override
Definition: CSCGeometry.cc:91