CMS 3D CMS Logo

ZdcGeometry Class Reference

#include <Geometry/ForwardGeometry/interface/ZdcGeometry.h>

Inheritance diagram for ZdcGeometry:

CaloSubdetectorGeometry

List of all members.

Public Member Functions

virtual DetId getClosestCell (const GlobalPoint &r) const
virtual std::vector< DetId >
const & 
getValidDetIds (DetId::Detector det, int subdet) const
 Get a list of valid detector ids (for the given subdetector).
 ZdcGeometry (const ZdcTopology *topology)
virtual ~ZdcGeometry ()

Private Attributes

DetId::Detector lastReqDet_
int lastReqSubdet_
const ZdcTopologytheTopology


Detailed Description

Definition at line 8 of file ZdcGeometry.h.


Constructor & Destructor Documentation

ZdcGeometry::ZdcGeometry ( const ZdcTopology topology  )  [explicit]

Definition at line 5 of file ZdcGeometry.cc.

00006 : theTopology(topology),
00007   lastReqDet_(DetId::Detector(0)), 
00008   lastReqSubdet_(0) 
00009 {
00010 }

ZdcGeometry::~ZdcGeometry (  )  [virtual]

Definition at line 12 of file ZdcGeometry.cc.

00012                           {
00013 }


Member Function Documentation

DetId ZdcGeometry::getClosestCell ( const GlobalPoint r  )  const [virtual]

Reimplemented from CaloSubdetectorGeometry.

Definition at line 36 of file ZdcGeometry.cc.

References funct::cos(), dYPlate, HcalZDCDetId::EM, HcalZDCDetId::HAD, HcalZDCDetId::LUM, funct::sin(), funct::tan(), theXChannelBoundaries, theZHadChannelBoundaries, theZLUMChannelBoundaries, theZSectionBoundaries, tiltangle, HcalZDCDetId::Unknown, PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.

00037 {
00038   // first find the side
00039   double z = r.z();
00040   double x = r.x();
00041   double y = r.y();
00042   double dz = 0.;
00043   double zt = 0.;
00044 
00045   int zside = 0;
00046   if(z >= 0)
00047     zside = 1;
00048   else
00049     zside =-1;
00050 
00051   bool isPositive = false;
00052   if(z>0)isPositive = true;
00053   z = fabs(z);
00054   
00055   // figure out if is closer to EM, HAD or LUM section
00056   HcalZDCDetId::Section section = HcalZDCDetId::Unknown;
00057   if(z<= theZSectionBoundaries[1])section = HcalZDCDetId::EM;
00058   if(theZSectionBoundaries[1]<z<= theZSectionBoundaries[2])section = HcalZDCDetId::LUM;
00059   if(z>theZSectionBoundaries[2])section = HcalZDCDetId::HAD;
00060 
00061   // figure out channel
00062   int channel = -1;
00063   if(section ==HcalZDCDetId::EM){
00064     if(x < theXChannelBoundaries[1]) channel = 1;
00065     if(theXChannelBoundaries[1]<= x <theXChannelBoundaries[2])channel = 2;
00066     if(theXChannelBoundaries[2]<= x <theXChannelBoundaries[3])channel = 3;
00067     if(theXChannelBoundaries[3]<= x <theXChannelBoundaries[4])channel = 4;
00068     if(x > theXChannelBoundaries[4])channel = 5;
00069   }
00070   
00071   if(section == HcalZDCDetId::LUM){
00072     if(z <= theZLUMChannelBoundaries[1])channel = 1;
00073     if(z > theZLUMChannelBoundaries[1])channel = 2;
00074   } 
00075   if(section == HcalZDCDetId::HAD){
00076     if(fabs(y) > dYPlate*sin(tiltangle))
00077       dz = (y > 0.) ?  dYPlate*cos(tiltangle) : -  dYPlate*sin(tiltangle);
00078     else
00079       dz = (y > 0.) ?  y/tan(tiltangle) : -y/tan(tiltangle); 
00080     zt = z - dz;
00081     if(zt< theZHadChannelBoundaries[1]) channel = 1;
00082     if(theZHadChannelBoundaries[1]<=  zt <theZHadChannelBoundaries[2])channel = 2;
00083     if(theZHadChannelBoundaries[2]<=  zt <theZHadChannelBoundaries[3])channel = 3;
00084     if(zt > theZHadChannelBoundaries[4])channel = 4;
00085   }
00086   
00087   HcalZDCDetId bestId  = HcalZDCDetId(section,isPositive,channel);
00088   return bestId;
00089 }

std::vector< DetId > const & ZdcGeometry::getValidDetIds ( DetId::Detector  det,
int  subdet 
) const [virtual]

Get a list of valid detector ids (for the given subdetector).

Note:
The implementation in this class is relevant for SubdetectorGeometries which handle only a single subdetector at a time. It does not look at the det and subdet arguments.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 15 of file ZdcGeometry.cc.

References begin, CaloSubdetectorGeometry::cellGeometries(), i, id, lastReqDet_, lastReqSubdet_, CaloSubdetectorGeometry::m_validIds, size, and python::multivaluedict::sort().

00015                                                                                         {
00016   if (lastReqDet_!=det || lastReqSubdet_!=subdet) {
00017     lastReqDet_=det;
00018     lastReqSubdet_=subdet;
00019     m_validIds.clear();
00020   }
00021   if (m_validIds.empty()) {
00022     m_validIds.reserve(cellGeometries().size());
00023     CaloSubdetectorGeometry::CellCont::const_iterator i;
00024     for (i=cellGeometries().begin(); i!=cellGeometries().end(); i++) {
00025       DetId id(i->first);
00026       if (id.det()==det && id.subdetId()==subdet) 
00027         m_validIds.push_back(id);
00028     }
00029       std::sort(m_validIds.begin(),m_validIds.end());
00030   }
00031 
00032   return m_validIds;
00033 }


Member Data Documentation

DetId::Detector ZdcGeometry::lastReqDet_ [mutable, private]

Definition at line 19 of file ZdcGeometry.h.

Referenced by getValidDetIds().

int ZdcGeometry::lastReqSubdet_ [mutable, private]

Definition at line 20 of file ZdcGeometry.h.

Referenced by getValidDetIds().

const ZdcTopology* ZdcGeometry::theTopology [private]

Definition at line 18 of file ZdcGeometry.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:35:56 2009 for CMSSW by  doxygen 1.5.4