Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:45

0001 #include <RecoMuon/DetLayers/src/MuonDTDetLayerGeometryBuilder.h>
0002 
0003 #include <DataFormats/MuonDetId/interface/DTChamberId.h>
0004 #include <Geometry/CommonDetUnit/interface/GeomDet.h>
0005 #include <RecoMuon/DetLayers/interface/MuRodBarrelLayer.h>
0006 #include <RecoMuon/DetLayers/interface/MuDetRod.h>
0007 
0008 #include <Utilities/General/interface/precomputed_value_sort.h>
0009 #include <Geometry/CommonDetUnit/interface/DetSorting.h>
0010 
0011 #include <FWCore/MessageLogger/interface/MessageLogger.h>
0012 
0013 #include <iostream>
0014 
0015 using namespace std;
0016 
0017 MuonDTDetLayerGeometryBuilder::MuonDTDetLayerGeometryBuilder() {}
0018 
0019 MuonDTDetLayerGeometryBuilder::~MuonDTDetLayerGeometryBuilder() {}
0020 
0021 vector<DetLayer*> MuonDTDetLayerGeometryBuilder::buildLayers(const DTGeometry& geo) {
0022   const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonDTDetLayerGeometryBuilder";
0023 
0024   vector<DetLayer*> detlayers;
0025   vector<MuRodBarrelLayer*> result;
0026 
0027   for (int station = DTChamberId::minStationId; station <= DTChamberId::maxStationId; station++) {
0028     vector<const DetRod*> muDetRods;
0029     for (int sector = DTChamberId::minSectorId; sector <= DTChamberId::maxSectorId; sector++) {
0030       vector<const GeomDet*> geomDets;
0031       for (int wheel = DTChamberId::minWheelId; wheel <= DTChamberId::maxWheelId; wheel++) {
0032         const GeomDet* geomDet = geo.idToDet(DTChamberId(wheel, station, sector));
0033         if (geomDet) {
0034           geomDets.push_back(geomDet);
0035           LogTrace(metname) << "get DT chamber " << DTChamberId(wheel, station, sector)
0036                             << " at R=" << geomDet->position().perp() << ", phi=" << geomDet->position().phi();
0037         }
0038       }
0039 
0040       if (!geomDets.empty()) {
0041         precomputed_value_sort(geomDets.begin(), geomDets.end(), geomsort::DetZ());
0042         muDetRods.push_back(new MuDetRod(geomDets));
0043         LogTrace(metname) << "  New MuDetRod with " << geomDets.size()
0044                           << " chambers at R=" << muDetRods.back()->position().perp()
0045                           << ", phi=" << muDetRods.back()->position().phi();
0046       }
0047     }
0048     precomputed_value_sort(muDetRods.begin(), muDetRods.end(), geomsort::ExtractPhi<GeometricSearchDet, float>());
0049     result.push_back(new MuRodBarrelLayer(muDetRods));
0050     LogDebug(metname) << "    New MuRodBarrelLayer with " << muDetRods.size() << " rods, at R "
0051                       << result.back()->specificSurface().radius();
0052   }
0053 
0054   for (vector<MuRodBarrelLayer*>::const_iterator it = result.begin(); it != result.end(); it++)
0055     detlayers.push_back((DetLayer*)(*it));
0056 
0057   return detlayers;
0058 }