Go to the documentation of this file.00001 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
00002 #include "Geometry/CSCGeometry/interface/CSCChamber.h"
00003 #include "Geometry/CSCGeometry/interface/CSCChamberSpecs.h"
00004 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 #include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
00007
00008 #include <string>
00009
00010 CSCGeometry::CSCGeometry(): debugV(false), gangedstripsME1a(true),
00011 onlywiresME1a(false), useRealWireGeometry(true), useCentreTIOffsets(false) {
00012 if ( debugV ) queryModelling();
00013 }
00014
00015 CSCGeometry::~CSCGeometry(){
00016
00017
00018 for (ChamberContainer::const_iterator ich=theChambers.begin();
00019 ich!=theChambers.end(); ++ich) delete (*ich);
00020
00021
00022 for ( CSCSpecsContainer::const_iterator it =
00023 specsContainer.begin(); it!=specsContainer.end(); ++it) {
00024 delete (*it).second;
00025 }
00026
00027 }
00028
00029
00030 void CSCGeometry::addChamber(CSCChamber* ch){
00031 theChambers.push_back(ch);
00032 addDet(ch);
00033 }
00034
00035
00036 void CSCGeometry::addLayer(CSCLayer* l) {
00037 theDetUnits.push_back(l);
00038 theLayers.push_back(l);
00039 theDetTypes.push_back(const_cast<GeomDetType*>(&(l->type())));
00040 theDetUnitIds.push_back(l->geographicalId());
00041 addDet(l);
00042 }
00043
00044
00045 void CSCGeometry::addDetType(GeomDetType* type) {
00046 theDetTypes.push_back(type);
00047 }
00048
00049
00050 void CSCGeometry::addDet(GeomDet* det){
00051 theDets.push_back(det);
00052 theDetIds.push_back(det->geographicalId());
00053 theMap.insert(CSCDetMap::value_type(det->geographicalId(),det));
00054 }
00055
00056
00057 const CSCGeometry::DetTypeContainer& CSCGeometry::detTypes() const
00058 {
00059 return theDetTypes;
00060 }
00061
00062
00063 const CSCGeometry::DetUnitContainer& CSCGeometry::detUnits() const
00064 {
00065 return theDetUnits;
00066 }
00067
00068
00069 const CSCGeometry::DetContainer& CSCGeometry::dets() const
00070 {
00071 return theDets;
00072 }
00073
00074
00075 const CSCGeometry::DetIdContainer& CSCGeometry::detUnitIds() const
00076 {
00077 return theDetUnitIds;
00078 }
00079
00080
00081 const CSCGeometry::DetIdContainer& CSCGeometry::detIds() const
00082 {
00083 return theDetIds;
00084 }
00085
00086
00087 const GeomDetUnit* CSCGeometry::idToDetUnit(DetId id) const
00088 {
00089 return dynamic_cast<const GeomDetUnit*>(idToDet(id));
00090 }
00091
00092
00093 const GeomDet* CSCGeometry::idToDet(DetId id) const{
00094 CSCDetMap::const_iterator i = theMap.find(id);
00095 return (i != theMap.end()) ?
00096 i->second : 0 ;
00097 }
00098
00099
00100 const CSCGeometry::ChamberContainer& CSCGeometry::chambers() const
00101 {
00102 return theChambers;
00103 }
00104
00105
00106 const CSCGeometry::LayerContainer& CSCGeometry::layers() const
00107 {
00108
00109
00110
00111
00112
00113 return theLayers;
00114 }
00115
00116
00117 const CSCChamber* CSCGeometry::chamber(CSCDetId id) const {
00118 CSCDetId id1(id.endcap(), id.station(), id.ring(), id.chamber(), 0);
00119 return dynamic_cast<const CSCChamber*>(idToDet(id1));
00120 }
00121
00122
00123 const CSCLayer* CSCGeometry::layer(CSCDetId id) const {
00124 return dynamic_cast<const CSCLayer*>(idToDetUnit(id));
00125 }
00126
00127 void CSCGeometry::queryModelling() const {
00128
00129
00130
00131 LogTrace("CSCGeometry|CSC") << "CSCGeometry::queryModelling entered...";
00132
00133 std::string gs = " ";
00134 if ( gangedstripsME1a )
00135 gs = "GANGED";
00136 else
00137 gs = "UNGANGED";
00138
00139 edm::LogInfo("CSC") << "CSCGeometry: in ME1a use " << gs << " strips" << "\n";
00140
00141 std::string wo = " ";
00142 if ( onlywiresME1a )
00143 wo = "WIRES ONLY";
00144 else
00145 wo = "WIRES & STRIPS";
00146
00147 edm::LogInfo("CSC") << "CSCGeometry: in ME1a use " << wo << "\n";
00148
00149 std::string wg = " ";
00150 if ( useRealWireGeometry )
00151 wg = "REAL";
00152 else
00153 wg = "PSEUDO";
00154
00155 edm::LogInfo("CSC") << "CSCGeometry: wires are modelled using " << wg << " wire geometry " << "\n";
00156
00157 std::string cti = " ";
00158 if ( useCentreTIOffsets )
00159 cti = "WITH";
00160 else
00161 cti = "WITHOUT";
00162
00163 edm::LogInfo("CSC") << "CSCGeometry: strip plane centre-to-intersection ideal " << cti << " corrections " << "\n";
00164 }
00165
00166 const CSCChamberSpecs* CSCGeometry::findSpecs( int iChamberType ) {
00167 const CSCChamberSpecs* aSpecs = 0;
00168 CSCSpecsContainer::const_iterator it = specsContainer.find( iChamberType );
00169 if ( it != specsContainer.end() ) aSpecs = (*it).second;
00170 return aSpecs;
00171 }
00172
00173 const CSCChamberSpecs* CSCGeometry::buildSpecs( int iChamberType,
00174 const std::vector<float>& fpar,
00175 const std::vector<float>& fupar,
00176 const CSCWireGroupPackage& wg ) {
00177
00178
00179 TrapezoidalPlaneBounds bounds( fpar[0], fpar[1], fpar[3], fpar[2] );
00180 const CSCChamberSpecs* aSpecs = new CSCChamberSpecs( this, iChamberType, bounds, fupar, wg );
00181 specsContainer[ iChamberType ] = aSpecs;
00182 return aSpecs;
00183 }