CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

CSCGangedWireGrouping Class Reference

#include <CSCGangedWireGrouping.h>

Inheritance diagram for CSCGangedWireGrouping:
CSCWireGrouping

List of all members.

Public Types

typedef Container::const_iterator CIterator
typedef std::vector< int > Container

Public Member Functions

CSCWireGroupingclone () const
 CSCGangedWireGrouping (const Container &consecutiveGroups, const Container &wiresInConsecutiveGroups, int numberOfGroups)
float middleWireOfGroup (int wireGroup) const
int numberOfWireGroups () const
int numberOfWires () const
int numberOfWiresPerGroup (int wireGroup) const
int wireGroup (int wire) const
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.

{}
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, LogTrace, theFirstWireOfEachWireGroup, theNumberOfWires, and theNumberOfWiresPerWireGroup.

Referenced by clone().

                       : 
     theNumberOfGroups(numberOfGroups) {

  int countGroups = 0;       // counter for no. of wire groups
  int firstWire = 1;         // (virtual) wire number which is 1st in a group
  int countConsecutive = 0;  // counter for the sections in DDD

  for ( CIterator it = consecutiveGroups.begin();
        it != consecutiveGroups.end(); ++it ) {
    int igs = *it;
    if ( igs != 0 ) {
      // igs is number of consecutive groups each containing
      // an identical number of wires
      countGroups += igs;
      for ( int ic = 0; ic != igs; ++ic ) {
        theFirstWireOfEachWireGroup.push_back( firstWire );
        int wiresInGroup= wiresInConsecutiveGroups[countConsecutive];
        theNumberOfWiresPerWireGroup.push_back( wiresInGroup );
        firstWire += wiresInGroup; // ready for next group
      }
    }
    else {
      // zero means a gap - just add in the no. of virtual wires in gap
      firstWire += wiresInConsecutiveGroups[countConsecutive];
    }
    ++countConsecutive; // ready for next set of consecutive groups
  }

  theNumberOfWires = firstWire - 1; // at end of loop we're on 1st for next

  if ( countGroups != numberOfGroups ) {
    edm::LogError("CSC") << "CSCGangedWireGrouping: ERROR in parsing wire info from DDD..." << "\n";
    edm::LogError("CSC") << "groups expected = " << numberOfGroups << 
      " groups seen = " << countGroups << "\n";
    edm::LogError("CSC") << "Please report this error to Tim.Cox@cern.ch" << "\n";
  }

  LogTrace("CSCWireGeometry|CSC") << "CSCGangedWireGrouping constructor complete," <<
    " wire group list follows... ";
  LogTrace("CSCWireGeometry|CSC") << "Size of group buffers = " << theFirstWireOfEachWireGroup.size() <<
    " and " << theNumberOfWiresPerWireGroup.size();
  LogTrace("CSCWireGeometry|CSC") << " wg#    1st wire  #wires";
  for ( size_t i = 0; i != theFirstWireOfEachWireGroup.size(); ++i ) {
    LogTrace("CSCWireGeometry|CSC") << std::setw(4) << i+1 << std::setw(12) << theFirstWireOfEachWireGroup[i] <<
      std::setw(8) << theNumberOfWiresPerWireGroup[i];
  }
  LogTrace("CSCWireGeometry|CSC") << "Total no. of wires = " << theNumberOfWires;

}

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().

                                 {
    return new CSCGangedWireGrouping(*this);
  }
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.

                                                                    {
  // Return exact wire number for group with odd number of wires
  // Return half-integer wire number for group with even number of wires
  // i.e. first + 0.5 * float(#) - 0.5
  // Return 0 if out of range

  float middleWire = 0.;
  if ( wireGroup > 0 && wireGroup <= theNumberOfGroups ) {
    middleWire = theFirstWireOfEachWireGroup[ wireGroup-1 ] +
      0.5 * theNumberOfWiresPerWireGroup[ wireGroup-1 ] -
         0.5 ;
  }
  return middleWire;
}
int CSCGangedWireGrouping::numberOfWireGroups ( ) const [inline, virtual]

How many wire groups

Implements CSCWireGrouping.

Definition at line 46 of file CSCGangedWireGrouping.h.

References theNumberOfGroups.

                                 {
    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.

                            {
    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.

                                                                      { 
  if ( wireGroup > 0 && wireGroup <= theNumberOfGroups )
    return theNumberOfWiresPerWireGroup[ wireGroup-1 ];
  else return 0;
}
int CSCGangedWireGrouping::wireGroup ( int  wire) const [virtual]

Wire group containing a given wire

Implements CSCWireGrouping.

Definition at line 68 of file CSCGangedWireGrouping.cc.

References theFirstWireOfEachWireGroup, and theNumberOfWiresPerWireGroup.

                                                   {
  // Return wire group number (start at 1) containing (virtual) 'wire'
  // Return 0 if 'wire' is not in a wire group; this includes
  // wires out outside the chamber, and lying in 'dead' regions

  int wireG = 0;

  // upper_bound works on a sorted range and points to first element 
  // _succeeding_ supplied value.

  CIterator it = upper_bound( theFirstWireOfEachWireGroup.begin(),
                              theFirstWireOfEachWireGroup.end(), wire );

  // We are now pointing to the wire group _after_ the required one
  // (unless we are at begin() or end() when we just return wireG=0)
  ptrdiff_t pd = it - theFirstWireOfEachWireGroup.begin(); 

  if ( pd > 0 ) {
    size_t id = --pd; //@@ Need to step back one. IS THIS SANE CODE?
    int wiresInGroup = theNumberOfWiresPerWireGroup[id];
    int firstWire    = theFirstWireOfEachWireGroup[id];
  
  // Require wire not past end of group (may be in a dead region, or
  // bigger than total wires in chamber)
    if ( wire < (firstWire + wiresInGroup) ) wireG = ++id;
  }
  return wireG;
}

Member Data Documentation

Definition at line 79 of file CSCGangedWireGrouping.h.

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

Definition at line 77 of file CSCGangedWireGrouping.h.

Referenced by CSCGangedWireGrouping(), and numberOfWires().