CMS 3D CMS Logo

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