CMS 3D CMS Logo

CSCGangedWireGrouping Class Reference

A concrete CSCWireGrouping in which wires are ganged. More...

#include <Geometry/CSCGeometry/src/CSCGangedWireGrouping.h>

Inheritance diagram for CSCGangedWireGrouping:

CSCWireGrouping

List of all members.

Public Types

typedef Container::const_iterator CIterator
typedef std::vector< intContainer

Public Member Functions

CSCWireGroupingclone () const
 Clone to handle correct copy of component objects referenced by base class pointer.
 CSCGangedWireGrouping (const Container &consecutiveGroups, const Container &wiresInConsecutiveGroups, int numberOfGroups)
 Constructor from endcap muon wire information parsed from DDD.
float middleWireOfGroup (int wireGroup) const
 Middle of wire-group.
int numberOfWireGroups () const
 How many wire groups.
int numberOfWires () const
 Total number of (virtual) wires.
int numberOfWiresPerGroup (int wireGroup) const
 How many wires in a wiregroup.
int wireGroup (int wire) const
 Wire group containing a given wire.
virtual ~CSCGangedWireGrouping ()

Private Attributes

Container theFirstWireOfEachWireGroup
int theNumberOfGroups
int theNumberOfWires
Container theNumberOfWiresPerWireGroup


Detailed Description

A concrete CSCWireGrouping in which wires are ganged.

All 'wire'-related values refer to 'virtual wires' which cover the face of the detector. All 'wire-group' values refer to actual active (in principle) read out channels.

Author:
Tim Cox

Definition at line 18 of file CSCGangedWireGrouping.h.


Member Typedef Documentation

typedef Container::const_iterator CSCGangedWireGrouping::CIterator

Definition at line 23 of file CSCGangedWireGrouping.h.

typedef std::vector<int> CSCGangedWireGrouping::Container

Definition at line 22 of file CSCGangedWireGrouping.h.


Constructor & Destructor Documentation

virtual CSCGangedWireGrouping::~CSCGangedWireGrouping (  )  [inline, virtual]

Definition at line 25 of file CSCGangedWireGrouping.h.

00025 {}

CSCGangedWireGrouping::CSCGangedWireGrouping ( const Container consecutiveGroups,
const Container wiresInConsecutiveGroups,
int  numberOfGroups 
)

Constructor from endcap muon wire information parsed from DDD.

Definition at line 9 of file CSCGangedWireGrouping.cc.

References i, it, LogTrace, theFirstWireOfEachWireGroup, theNumberOfWires, and theNumberOfWiresPerWireGroup.

Referenced by clone().

00012                        : 
00013      theNumberOfGroups(numberOfGroups) {
00014 
00015   int countGroups = 0;       // counter for no. of wire groups
00016   int firstWire = 1;         // (virtual) wire number which is 1st in a group
00017   int countConsecutive = 0;  // counter for the sections in DDD
00018 
00019   for ( CIterator it = consecutiveGroups.begin();
00020         it != consecutiveGroups.end(); ++it ) {
00021     int igs = *it;
00022     if ( igs != 0 ) {
00023       // igs is number of consecutive groups each containing
00024       // an identical number of wires
00025       countGroups += igs;
00026       for ( int ic = 0; ic != igs; ++ic ) {
00027         theFirstWireOfEachWireGroup.push_back( firstWire );
00028         int wiresInGroup= wiresInConsecutiveGroups[countConsecutive];
00029         theNumberOfWiresPerWireGroup.push_back( wiresInGroup );
00030         firstWire += wiresInGroup; // ready for next group
00031       }
00032     }
00033     else {
00034       // zero means a gap - just add in the no. of virtual wires in gap
00035       firstWire += wiresInConsecutiveGroups[countConsecutive];
00036     }
00037     ++countConsecutive; // ready for next set of consecutive groups
00038   }
00039 
00040   theNumberOfWires = firstWire - 1; // at end of loop we're on 1st for next
00041 
00042   if ( countGroups != numberOfGroups ) {
00043     edm::LogError("CSC") << "CSCGangedWireGrouping: ERROR in parsing wire info from DDD..." << "\n";
00044     edm::LogError("CSC") << "groups expected = " << numberOfGroups << 
00045       " groups seen = " << countGroups << "\n";
00046     edm::LogError("CSC") << "Please report this error to Tim.Cox@cern.ch" << "\n";
00047   }
00048 
00049   LogTrace("CSC") << "CSCGangedWireGrouping constructor complete," <<
00050     " wire group list follows... ";
00051   LogTrace("CSC") << "Size of group buffers = " << theFirstWireOfEachWireGroup.size() <<
00052     " and " << theNumberOfWiresPerWireGroup.size();
00053   LogTrace("CSC") << " wg#    1st wire  #wires";
00054   for ( size_t i = 0; i != theFirstWireOfEachWireGroup.size(); ++i ) {
00055     LogTrace("CSC") << std::setw(4) << i+1 << std::setw(12) << theFirstWireOfEachWireGroup[i] <<
00056       std::setw(8) << theNumberOfWiresPerWireGroup[i];
00057   }
00058   LogTrace("CSC") << "Total no. of wires = " << theNumberOfWires;
00059 
00060 }


Member Function Documentation

CSCWireGrouping* CSCGangedWireGrouping::clone ( void   )  const [inline, virtual]

Clone to handle correct copy of component objects referenced by base class pointer.

Implements CSCWireGrouping.

Definition at line 71 of file CSCGangedWireGrouping.h.

References CSCGangedWireGrouping().

00071                                  {
00072     return new CSCGangedWireGrouping(*this);
00073   }

float CSCGangedWireGrouping::middleWireOfGroup ( int  wireGroup  )  const [virtual]

Middle of wire-group.

This is the central wire no. for a group with an odd no. of wires. This is a pseudo-wire no. for a group with an even no. of wires. Accordingly, it is non-integer.

Implements CSCWireGrouping.

Definition at line 97 of file CSCGangedWireGrouping.cc.

References theFirstWireOfEachWireGroup, theNumberOfGroups, and theNumberOfWiresPerWireGroup.

00097                                                                     {
00098   // Return exact wire number for group with odd number of wires
00099   // Return half-integer wire number for group with even number of wires
00100   // i.e. first + 0.5 * float(#) - 0.5
00101   // Return 0 if out of range
00102 
00103   float middleWire = 0.;
00104   if ( wireGroup > 0 && wireGroup <= theNumberOfGroups ) {
00105     middleWire = theFirstWireOfEachWireGroup[ wireGroup-1 ] +
00106       0.5 * theNumberOfWiresPerWireGroup[ wireGroup-1 ] -
00107          0.5 ;
00108   }
00109   return middleWire;
00110 }

int CSCGangedWireGrouping::numberOfWireGroups (  )  const [inline, virtual]

How many wire groups.

Implements CSCWireGrouping.

Definition at line 46 of file CSCGangedWireGrouping.h.

References theNumberOfGroups.

00046                                  {
00047     return theNumberOfGroups; }

int CSCGangedWireGrouping::numberOfWires (  )  const [inline, virtual]

Total number of (virtual) wires.

Some wires may not be implemented in the hardware. This is the number which would fill the region covered by wires, assuming the constant wire spacing.

Implements CSCWireGrouping.

Definition at line 40 of file CSCGangedWireGrouping.h.

References theNumberOfWires.

00040                             {
00041     return theNumberOfWires; }

int CSCGangedWireGrouping::numberOfWiresPerGroup ( int  wireGroup  )  const [virtual]

How many wires in a wiregroup.

Implements CSCWireGrouping.

Definition at line 62 of file CSCGangedWireGrouping.cc.

References theNumberOfGroups, and theNumberOfWiresPerWireGroup.

00062                                                                       { 
00063   if ( wireGroup > 0 && wireGroup <= theNumberOfGroups )
00064     return theNumberOfWiresPerWireGroup[ wireGroup-1 ];
00065   else return 0;
00066 }

int CSCGangedWireGrouping::wireGroup ( int  wire  )  const [virtual]

Wire group containing a given wire.

Implements CSCWireGrouping.

Definition at line 68 of file CSCGangedWireGrouping.cc.

References it, theFirstWireOfEachWireGroup, and theNumberOfWiresPerWireGroup.

00068                                                    {
00069   // Return wire group number (start at 1) containing (virtual) 'wire'
00070   // Return 0 if 'wire' is not in a wire group; this includes
00071   // wires out outside the chamber, and lying in 'dead' regions
00072 
00073   int wireG = 0;
00074 
00075   // upper_bound works on a sorted range and points to first element 
00076   // _succeeding_ supplied value.
00077 
00078   CIterator it = upper_bound( theFirstWireOfEachWireGroup.begin(),
00079                               theFirstWireOfEachWireGroup.end(), wire );
00080 
00081   // We are now pointing to the wire group _after_ the required one
00082   // (unless we are at begin() or end() when we just return wireG=0)
00083   ptrdiff_t pd = it - theFirstWireOfEachWireGroup.begin(); 
00084 
00085   if ( pd > 0 ) {
00086     size_t id = --pd; //@@ Need to step back one. IS THIS SANE CODE?
00087     int wiresInGroup = theNumberOfWiresPerWireGroup[id];
00088     int firstWire    = theFirstWireOfEachWireGroup[id];
00089   
00090   // Require wire not past end of group (may be in a dead region, or
00091   // bigger than total wires in chamber)
00092     if ( wire < (firstWire + wiresInGroup) ) wireG = ++id;
00093   }
00094   return wireG;
00095 }


Member Data Documentation

Container CSCGangedWireGrouping::theFirstWireOfEachWireGroup [private]

Definition at line 79 of file CSCGangedWireGrouping.h.

Referenced by CSCGangedWireGrouping(), middleWireOfGroup(), and wireGroup().

int CSCGangedWireGrouping::theNumberOfGroups [private]

Definition at line 78 of file CSCGangedWireGrouping.h.

Referenced by middleWireOfGroup(), numberOfWireGroups(), and numberOfWiresPerGroup().

int CSCGangedWireGrouping::theNumberOfWires [private]

Definition at line 77 of file CSCGangedWireGrouping.h.

Referenced by CSCGangedWireGrouping(), and numberOfWires().

Container CSCGangedWireGrouping::theNumberOfWiresPerWireGroup [private]

Definition at line 80 of file CSCGangedWireGrouping.h.

Referenced by CSCGangedWireGrouping(), middleWireOfGroup(), numberOfWiresPerGroup(), and wireGroup().


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