CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Friends

MuonDetLayerGeometry Class Reference

#include <MuonDetLayerGeometry.h>

Inheritance diagram for MuonDetLayerGeometry:
DetLayerGeometry

List of all members.

Public Member Functions

const std::vector< DetLayer * > & allBackwardLayers () const
 return all backward (-Z) layers (CSC+RPC), inside-out
const std::vector< DetLayer * > & allBarrelLayers () const
 return all barrel DetLayers (DT+RPC), inside-out
const std::vector< DetLayer * > & allCSCLayers () const
 return the CSC DetLayers (endcap), -Z to +Z
const std::vector< DetLayer * > & allDTLayers () const
 return the DT DetLayers (barrel), inside-out
const std::vector< DetLayer * > & allEndcapLayers () const
 return all endcap DetLayers (CSC+RPC), -Z to +Z
const std::vector< DetLayer * > & allForwardLayers () const
 return all forward (+Z) layers (CSC+RPC), inside-out
const std::vector< DetLayer * > & allLayers () const
 return all layers (DT+CSC+RPC), order: backward, barrel, forward
const std::vector< DetLayer * > & allRPCLayers () const
 return all RPC DetLayers, order: backward, barrel, forward
const std::vector< DetLayer * > & backwardCSCLayers () const
 return the backward (-Z) CSC DetLayers, inside-out
const std::vector< DetLayer * > & backwardRPCLayers () const
 return the backward (-Z) RPC DetLayers, inside-out
const std::vector< DetLayer * > & barrelRPCLayers () const
 return the barrel RPC DetLayers, inside-out
const std::vector< DetLayer * > & endcapRPCLayers () const
 return the endcap RPC DetLayers, -Z to +Z
const std::vector< DetLayer * > & forwardCSCLayers () const
 return the forward (+Z) CSC DetLayers, inside-out
const std::vector< DetLayer * > & forwardRPCLayers () const
 return the forward (+Z) RPC DetLayers, inside-out
virtual const DetLayeridToLayer (const DetId &detId) const
 return the DetLayer which correspond to a certain DetId
 MuonDetLayerGeometry ()
 Constructor.
virtual ~MuonDetLayerGeometry ()
 Destructor.

Private Member Functions

void addCSCLayers (std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > csclayers)
void addDTLayers (std::vector< DetLayer * > dtlayers)
void addRPCLayers (std::vector< DetLayer * > barrelRPCLayers, std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > endcapRPCLayers)
DetId makeDetLayerId (const DetLayer *detLayer) const
void sortLayers ()

Private Attributes

std::vector< DetLayer * > allBackward
std::vector< DetLayer * > allBarrel
std::vector< DetLayer * > allDetLayers
std::vector< DetLayer * > allEndcap
std::vector< DetLayer * > allForward
std::vector< DetLayer * > cscLayers_all
std::vector< DetLayer * > cscLayers_bk
std::vector< DetLayer * > cscLayers_fw
std::map< DetId, DetLayer * > detLayersMap
std::vector< DetLayer * > dtLayers
std::vector< DetLayer * > rpcLayers_all
std::vector< DetLayer * > rpcLayers_barrel
std::vector< DetLayer * > rpcLayers_bk
std::vector< DetLayer * > rpcLayers_endcap
std::vector< DetLayer * > rpcLayers_fw

Friends

class MuonDetLayerGeometryESProducer

Detailed Description

Provide access to the DetLayers of muon detectors.

Date:
2009/07/03 09:12:47
Revision:
1.13
Author:
N. Amapane - CERN

Definition at line 20 of file MuonDetLayerGeometry.h.


Constructor & Destructor Documentation

MuonDetLayerGeometry::MuonDetLayerGeometry ( )

Constructor.

Definition at line 24 of file MuonDetLayerGeometry.cc.

{}
MuonDetLayerGeometry::~MuonDetLayerGeometry ( ) [virtual]

Destructor.

Definition at line 26 of file MuonDetLayerGeometry.cc.

                                           {
  for(vector<DetLayer*>::const_iterator it = allDetLayers.begin(); it != allDetLayers.end(); ++it)
  {
    delete *it;
  }
}

Member Function Documentation

void MuonDetLayerGeometry::addCSCLayers ( std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > >  csclayers) [private]

Add CSC layers csclayers.first=forward (+Z), csclayers.second=backward (-Z) both vectors are ASSUMED to be sorted inside-out

Definition at line 33 of file MuonDetLayerGeometry.cc.

Referenced by MuonDetLayerGeometryESProducer::produce().

                                                                                             {
    
  vector<DetLayer*>::const_iterator it;
  for(it=csclayers.first.begin(); it!=csclayers.first.end(); it++) {
    cscLayers_fw.push_back(*it);
    //    cscLayers_all.push_back(*it);
    allForward.push_back(*it);
    //    allEndcap.push_back(*it);
    //    allDetLayers.push_back(*it);
    
    detLayersMap[ makeDetLayerId(*it) ] = *it;
  }
  
  for(it=csclayers.second.begin(); it!=csclayers.second.end(); it++) {
    cscLayers_bk.push_back(*it);
    //    cscLayers_all.push_back(*it);
    allBackward.push_back(*it);
    //    allEndcap.push_back(*it);
    //    allDetLayers.push_back(*it);
    
    detLayersMap[ makeDetLayerId(*it) ] = *it;
  }    
}    
void MuonDetLayerGeometry::addDTLayers ( std::vector< DetLayer * >  dtlayers) [private]

Definition at line 93 of file MuonDetLayerGeometry.cc.

Referenced by MuonDetLayerGeometryESProducer::produce().

                                                                 {

    vector<DetLayer*>::const_iterator it;
    for(it=dtlayers.begin(); it!=dtlayers.end(); it++) {
        dtLayers.push_back(*it);
        allBarrel.push_back(*it);
        //        allDetLayers.push_back(*it);

        detLayersMap[ makeDetLayerId(*it) ] = *it;
    }
}    
void MuonDetLayerGeometry::addRPCLayers ( std::vector< DetLayer * >  barrelRPCLayers,
std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > >  endcapRPCLayers 
) [private]

Add RPC layers endcapRPCLayers.first=forward (+Z), endcapRPCLayers.second=backward (-Z) All three vectors are ASSUMED to be sorted inside-out

Definition at line 57 of file MuonDetLayerGeometry.cc.

Referenced by MuonDetLayerGeometryESProducer::produce().

                                                                                                                                {
  
  vector<DetLayer*>::const_iterator it;
  
  for (it=barrelLayers.begin();it!=barrelLayers.end();it++){
    rpcLayers_barrel.push_back(*it);
    //    rpcLayers_all.push_back(*it);
    allBarrel.push_back(*it);
    //    allDetLayers.push_back(*it);

    detLayersMap[ makeDetLayerId(*it) ] = *it;
  }
  for (it=endcapLayers.first.begin(); it!=endcapLayers.first.end(); it++){
    rpcLayers_fw.push_back(*it);
    //    rpcLayers_all.push_back(*it);
    //    rpcLayers_endcap.push_back(*it);
    allForward.push_back(*it);
    //    allEndcap.push_back(*it);
    //    allDetLayers.push_back(*it);

    detLayersMap[ makeDetLayerId(*it) ] = *it;
  }
  
  for (it=endcapLayers.second.begin(); it!=endcapLayers.second.end(); it++){
    rpcLayers_bk.push_back(*it);
    //    rpcLayers_all.push_back(*it);
    //    rpcLayers_endcap.push_back(*it);
    allBackward.push_back(*it);
    //    allEndcap.push_back(*it);
    //    allDetLayers.push_back(*it);

    detLayersMap[ makeDetLayerId(*it) ] = *it;
  }
  
}    
const vector< DetLayer * > & MuonDetLayerGeometry::allBackwardLayers ( ) const

return all backward (-Z) layers (CSC+RPC), inside-out

Definition at line 213 of file MuonDetLayerGeometry.cc.

Referenced by MuonNavigationPrinter::MuonNavigationPrinter().

                                              {
    return allBackward;    
}    
const vector< DetLayer * > & MuonDetLayerGeometry::allBarrelLayers ( ) const

return all barrel DetLayers (DT+RPC), inside-out

Definition at line 196 of file MuonDetLayerGeometry.cc.

Referenced by MuonNavigationPrinter::MuonNavigationPrinter(), MuonNavigationSchool::MuonNavigationSchool(), and MuonTkNavigationSchool::MuonTkNavigationSchool().

                                            {
    return allBarrel;    
}    
const vector< DetLayer * > & MuonDetLayerGeometry::allCSCLayers ( ) const

return the CSC DetLayers (endcap), -Z to +Z

Definition at line 142 of file MuonDetLayerGeometry.cc.

Referenced by MuonNavigationSchool::MuonNavigationSchool().

                                         {
    return cscLayers_all;
}
const vector< DetLayer * > & MuonDetLayerGeometry::allDTLayers ( ) const

return the DT DetLayers (barrel), inside-out

Definition at line 137 of file MuonDetLayerGeometry.cc.

Referenced by MuonSeedBuilder::build(), MuonNavigationPrinter::MuonNavigationPrinter(), and MuonNavigationSchool::MuonNavigationSchool().

                                        {    
    return dtLayers; 
}
const vector< DetLayer * > & MuonDetLayerGeometry::allEndcapLayers ( ) const

return all endcap DetLayers (CSC+RPC), -Z to +Z

Definition at line 201 of file MuonDetLayerGeometry.cc.

Referenced by MuonNavigationSchool::MuonNavigationSchool(), and MuonTkNavigationSchool::MuonTkNavigationSchool().

                                            {
    return allEndcap;    
}    
const vector< DetLayer * > & MuonDetLayerGeometry::allForwardLayers ( ) const

return all forward (+Z) layers (CSC+RPC), inside-out

Definition at line 207 of file MuonDetLayerGeometry.cc.

Referenced by MuonNavigationPrinter::MuonNavigationPrinter().

                                             {
    return allForward;    
}    
const vector< DetLayer * > & MuonDetLayerGeometry::allLayers ( ) const

return all layers (DT+CSC+RPC), order: backward, barrel, forward

Definition at line 190 of file MuonDetLayerGeometry.cc.

Referenced by MuonNavigationSchool::MuonNavigationSchool(), and MuonTkNavigationSchool::MuonTkNavigationSchool().

                                      {
    return allDetLayers;    
}    
const vector< DetLayer * > & MuonDetLayerGeometry::allRPCLayers ( ) const

return all RPC DetLayers, order: backward, barrel, forward

Definition at line 160 of file MuonDetLayerGeometry.cc.

                                         {
    return rpcLayers_all;    
}
const vector< DetLayer * > & MuonDetLayerGeometry::backwardCSCLayers ( ) const

return the backward (-Z) CSC DetLayers, inside-out

Definition at line 154 of file MuonDetLayerGeometry.cc.

Referenced by MuonSeedBuilder::build(), and MuonNavigationPrinter::MuonNavigationPrinter().

                                              {
    return cscLayers_bk;
}
const vector< DetLayer * > & MuonDetLayerGeometry::backwardRPCLayers ( ) const

return the backward (-Z) RPC DetLayers, inside-out

Definition at line 184 of file MuonDetLayerGeometry.cc.

                                              {
    return rpcLayers_bk; 
}
const vector< DetLayer * > & MuonDetLayerGeometry::barrelRPCLayers ( ) const

return the barrel RPC DetLayers, inside-out

Definition at line 166 of file MuonDetLayerGeometry.cc.

                                            {
    return rpcLayers_barrel; 
}
const vector< DetLayer * > & MuonDetLayerGeometry::endcapRPCLayers ( ) const

return the endcap RPC DetLayers, -Z to +Z

Definition at line 172 of file MuonDetLayerGeometry.cc.

                                            {
    return rpcLayers_endcap;    
}
const vector< DetLayer * > & MuonDetLayerGeometry::forwardCSCLayers ( ) const

return the forward (+Z) CSC DetLayers, inside-out

Definition at line 148 of file MuonDetLayerGeometry.cc.

Referenced by MuonSeedBuilder::build(), and MuonNavigationPrinter::MuonNavigationPrinter().

                                             {
    return cscLayers_fw;
}
const vector< DetLayer * > & MuonDetLayerGeometry::forwardRPCLayers ( ) const

return the forward (+Z) RPC DetLayers, inside-out

Definition at line 178 of file MuonDetLayerGeometry.cc.

                                             {
     return rpcLayers_fw; 
}
const DetLayer * MuonDetLayerGeometry::idToLayer ( const DetId detId) const [virtual]

return the DetLayer which correspond to a certain DetId

Reimplemented from DetLayerGeometry.

Definition at line 217 of file MuonDetLayerGeometry.cc.

References CSC(), CSCDetId, GeomDetEnumerators::DT, DTChamberId, Exception, errorMatrix2Lands_multiChannel::id, DetId::rawId(), dedefs::RPC, RPCDetId, and DetId::subdetId().

Referenced by GlobalDetLayerGeometry::idToLayer().

                                                                       {

  DetId id;
  
  if(detId.subdetId() == MuonSubdetId::CSC){
    CSCDetId cscId( detId.rawId() );

    if(cscId.station() == 1)
      {
        if(cscId.ring() == 1 || cscId.ring() == 4)
          id = CSCDetId(cscId.endcap(),1,1,0,0);
        else if(cscId.ring() == 2 || cscId.ring() == 3)
          id = CSCDetId(cscId.endcap(),1,2,0,0);
        else
          throw cms::Exception("InvalidCSCRing")<<" Invalid CSC Ring: "<<cscId.ring()<<endl;
      }
    else id = CSCDetId(cscId.endcap(),cscId.station(),0,0,0);
  }
  
  else if (detId.subdetId() == MuonSubdetId::DT){
    DTChamberId dtId( detId.rawId() );
    id = DTChamberId(0,dtId.station(),0);
  }
  else if (detId.subdetId() == MuonSubdetId::RPC){
    RPCDetId rpcId(detId.rawId() );
    id = RPCDetId(rpcId.region(),0,rpcId.station(),0,rpcId.layer(),0,0);
  }

  else throw cms::Exception("InvalidSubdetId")<< detId.subdetId();

  std::map<DetId,DetLayer*>::const_iterator layer = detLayersMap.find(id);
  if (layer == detLayersMap.end()) return 0;
  return layer->second; 
}
DetId MuonDetLayerGeometry::makeDetLayerId ( const DetLayer detLayer) const [private]

Definition at line 105 of file MuonDetLayerGeometry.cc.

References GeometricSearchDet::basicComponents(), CSC(), CSCDetId, GeomDetEnumerators::DT, DTChamberId, Reference_intrackfit_cff::endcap, Exception, errorMatrix2Lands_multiChannel::id, relativeConstraints::ring, GeomDetEnumerators::RPCBarrel, RPCDetId, GeomDetEnumerators::RPCEndcap, relativeConstraints::station, and DetLayer::subDetector().

                                                                        {

  if(detLayer->subDetector() ==  GeomDetEnumerators::CSC){
    CSCDetId id( detLayer->basicComponents().front()->geographicalId().rawId() ) ;

    if(id.station() == 1 )
      {
        if(id.ring() == 1 || id.ring() == 4)
          return CSCDetId(id.endcap(),1,1,0,0);
        else if(id.ring() == 2 || id.ring() == 3)
          return CSCDetId(id.endcap(),1,2,0,0);
        else
          throw cms::Exception("InvalidCSCRing")<<" Invalid CSC Ring: "<<id.ring()<<endl;
      }
    else
      return CSCDetId(id.endcap(),id.station(),0,0,0);
    
  }
  else if(detLayer->subDetector() == GeomDetEnumerators::DT){
    DTChamberId id( detLayer->basicComponents().front()->geographicalId().rawId() ) ;
    return  DTChamberId(0,id.station(),0);
  }
  else if(detLayer->subDetector()== GeomDetEnumerators::RPCBarrel ||
          detLayer->subDetector()== GeomDetEnumerators::RPCEndcap){
    RPCDetId id( detLayer->basicComponents().front()->geographicalId().rawId());
    return RPCDetId(id.region(),0,id.station(),0,id.layer(),0,0);
  }
  else throw cms::Exception("InvalidModuleIdentification"); // << detLayer->module();
}
void MuonDetLayerGeometry::sortLayers ( ) [private]

Definition at line 265 of file MuonDetLayerGeometry.cc.

References filterCSVwithJSON::copy, and precomputed_value_sort().

Referenced by MuonDetLayerGeometryESProducer::produce().

                                      {

  // The following are filled inside-out, no need to re-sort
  // precomputed_value_sort(dtLayers.begin(), dtLayers.end(),ExtractR<DetLayer,float>());
  // precomputed_value_sort(cscLayers_fw.begin(), cscLayers_fw.end(),ExtractAbsZ<DetLayer,float>());
  // precomputed_value_sort(cscLayers_bk.begin(), cscLayers_bk.end(),ExtractAbsZ<DetLayer,float>());
  // precomputed_value_sort(rpcLayers_fw.begin(), rpcLayers_fw.end(),ExtractAbsZ<DetLayer,float>());
  // precomputed_value_sort(rpcLayers_bk.begin(), rpcLayers_bk.end(),ExtractAbsZ<DetLayer,float>());
  // precomputed_value_sort(rpcLayers_barrel.begin(), rpcLayers_barrel.end(), ExtractR<DetLayer,float>());

  // Sort these inside-out
  precomputed_value_sort(allBarrel.begin(), allBarrel.end(), ExtractBarrelDetLayerR());
  precomputed_value_sort(allBackward.begin(), allBackward.end(), ExtractAbsZ<DetLayer,float>());
  precomputed_value_sort(allForward.begin(), allForward.end(), ExtractAbsZ<DetLayer,float>());  

  // Build more complicated vectors with correct sorting

  //cscLayers_all: from -Z to +Z
  cscLayers_all.reserve(cscLayers_bk.size()+cscLayers_fw.size());
  std::copy(cscLayers_bk.begin(),cscLayers_bk.end(),back_inserter(cscLayers_all));
  std::reverse(cscLayers_all.begin(),cscLayers_all.end());
  std::copy(cscLayers_fw.begin(),cscLayers_fw.end(),back_inserter(cscLayers_all));

  //rpcLayers_endcap: from -Z to +Z
  rpcLayers_endcap.reserve(rpcLayers_bk.size()+rpcLayers_fw.size());
  std::copy(rpcLayers_bk.begin(),rpcLayers_bk.end(),back_inserter(rpcLayers_endcap));
  std::reverse(rpcLayers_endcap.begin(),rpcLayers_endcap.end());
  std::copy(rpcLayers_fw.begin(),rpcLayers_fw.end(),back_inserter(rpcLayers_endcap));

  //rpcLayers_all: order is bw, barrel, fw
  rpcLayers_all.reserve(rpcLayers_bk.size()+rpcLayers_barrel.size()+rpcLayers_fw.size());
  std::copy(rpcLayers_bk.begin(),rpcLayers_bk.end(),back_inserter(rpcLayers_all));
  std::reverse(rpcLayers_all.begin(),rpcLayers_all.end());
  std::copy(rpcLayers_barrel.begin(),rpcLayers_barrel.end(),back_inserter(rpcLayers_all));
  std::copy(rpcLayers_fw.begin(),rpcLayers_fw.end(),back_inserter(rpcLayers_all));

  // allEndcap: order is  all bw, all fw
  allEndcap.reserve(allBackward.size()+allForward.size());
  std::copy(allBackward.begin(),allBackward.end(),back_inserter(allEndcap));
  std::reverse(allEndcap.begin(),allEndcap.end());
  std::copy(allForward.begin(),allForward.end(),back_inserter(allEndcap));

  // allDetLayers: order is  all bw, all barrel, all fw
  allDetLayers.reserve(allBackward.size()+allBarrel.size()+allForward.size());
  std::copy(allBackward.begin(),allBackward.end(),back_inserter(allDetLayers));
  std::reverse(allDetLayers.begin(),allDetLayers.end());
  std::copy(allBarrel.begin(),allBarrel.end(),back_inserter(allDetLayers));
  std::copy(allForward.begin(),allForward.end(),back_inserter(allDetLayers));


}

Friends And Related Function Documentation

friend class MuonDetLayerGeometryESProducer [friend]

Definition at line 26 of file MuonDetLayerGeometry.h.


Member Data Documentation

Definition at line 105 of file MuonDetLayerGeometry.h.

std::vector<DetLayer*> MuonDetLayerGeometry::allBarrel [private]

Definition at line 107 of file MuonDetLayerGeometry.h.

Definition at line 108 of file MuonDetLayerGeometry.h.

std::vector<DetLayer*> MuonDetLayerGeometry::allEndcap [private]

Definition at line 106 of file MuonDetLayerGeometry.h.

std::vector<DetLayer*> MuonDetLayerGeometry::allForward [private]

Definition at line 104 of file MuonDetLayerGeometry.h.

Definition at line 97 of file MuonDetLayerGeometry.h.

Definition at line 96 of file MuonDetLayerGeometry.h.

Definition at line 95 of file MuonDetLayerGeometry.h.

Definition at line 110 of file MuonDetLayerGeometry.h.

std::vector<DetLayer*> MuonDetLayerGeometry::dtLayers [private]

Definition at line 103 of file MuonDetLayerGeometry.h.

Definition at line 98 of file MuonDetLayerGeometry.h.

Definition at line 102 of file MuonDetLayerGeometry.h.

Definition at line 101 of file MuonDetLayerGeometry.h.

Definition at line 99 of file MuonDetLayerGeometry.h.

Definition at line 100 of file MuonDetLayerGeometry.h.