CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
CSCGangedWireGrouping Class Reference

#include <CSCGangedWireGrouping.h>

Inheritance diagram for CSCGangedWireGrouping:
CSCWireGrouping

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 ()
 
- Public Member Functions inherited from CSCWireGrouping
virtual ~CSCWireGrouping ()
 

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

Definition at line 25 of file CSCGangedWireGrouping.h.

25 {}
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().

12  :
13  theNumberOfGroups(numberOfGroups) {
14 
15  int countGroups = 0; // counter for no. of wire groups
16  int firstWire = 1; // (virtual) wire number which is 1st in a group
17  int countConsecutive = 0; // counter for the sections in DDD
18 
19  for ( CIterator it = consecutiveGroups.begin();
20  it != consecutiveGroups.end(); ++it ) {
21  int igs = *it;
22  if ( igs != 0 ) {
23  // igs is number of consecutive groups each containing
24  // an identical number of wires
25  countGroups += igs;
26  for ( int ic = 0; ic != igs; ++ic ) {
27  theFirstWireOfEachWireGroup.push_back( firstWire );
28  int wiresInGroup= wiresInConsecutiveGroups[countConsecutive];
29  theNumberOfWiresPerWireGroup.push_back( wiresInGroup );
30  firstWire += wiresInGroup; // ready for next group
31  }
32  }
33  else {
34  // zero means a gap - just add in the no. of virtual wires in gap
35  firstWire += wiresInConsecutiveGroups[countConsecutive];
36  }
37  ++countConsecutive; // ready for next set of consecutive groups
38  }
39 
40  theNumberOfWires = firstWire - 1; // at end of loop we're on 1st for next
41 
42  if ( countGroups != numberOfGroups ) {
43  edm::LogError("CSC") << "CSCGangedWireGrouping: ERROR in parsing wire info from DDD..." << "\n";
44  edm::LogError("CSC") << "groups expected = " << numberOfGroups <<
45  " groups seen = " << countGroups << "\n";
46  edm::LogError("CSC") << "Please report this error to Tim.Cox@cern.ch" << "\n";
47  }
48 
49  LogTrace("CSCWireGeometry|CSC") << "CSCGangedWireGrouping constructor complete," <<
50  " wire group list follows... ";
51  LogTrace("CSCWireGeometry|CSC") << "Size of group buffers = " << theFirstWireOfEachWireGroup.size() <<
52  " and " << theNumberOfWiresPerWireGroup.size();
53  LogTrace("CSCWireGeometry|CSC") << " wg# 1st wire #wires";
54  for ( size_t i = 0; i != theFirstWireOfEachWireGroup.size(); ++i ) {
55  LogTrace("CSCWireGeometry|CSC") << std::setw(4) << i+1 << std::setw(12) << theFirstWireOfEachWireGroup[i] <<
56  std::setw(8) << theNumberOfWiresPerWireGroup[i];
57  }
58  LogTrace("CSCWireGeometry|CSC") << "Total no. of wires = " << theNumberOfWires;
59 
60 }
int i
Definition: DBlmapReader.cc:9
#define LogTrace(id)
Container::const_iterator CIterator

Member Function Documentation

CSCWireGrouping* CSCGangedWireGrouping::clone ( void  ) const
inlinevirtual

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

71  {
72  return new CSCGangedWireGrouping(*this);
73  }
CSCGangedWireGrouping(const Container &consecutiveGroups, const Container &wiresInConsecutiveGroups, int numberOfGroups)
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.

97  {
98  // Return exact wire number for group with odd number of wires
99  // Return half-integer wire number for group with even number of wires
100  // i.e. first + 0.5 * float(#) - 0.5
101  // Return 0 if out of range
102 
103  float middleWire = 0.;
104  if ( wireGroup > 0 && wireGroup <= theNumberOfGroups ) {
105  middleWire = theFirstWireOfEachWireGroup[ wireGroup-1 ] +
107  0.5 ;
108  }
109  return middleWire;
110 }
int wireGroup(int wire) const
int CSCGangedWireGrouping::numberOfWireGroups ( ) const
inlinevirtual

How many wire groups

Implements CSCWireGrouping.

Definition at line 46 of file CSCGangedWireGrouping.h.

References theNumberOfGroups.

46  {
47  return theNumberOfGroups; }
int CSCGangedWireGrouping::numberOfWires ( ) const
inlinevirtual

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.

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

62  {
63  if ( wireGroup > 0 && wireGroup <= theNumberOfGroups )
65  else return 0;
66 }
int wireGroup(int wire) const
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.

68  {
69  // Return wire group number (start at 1) containing (virtual) 'wire'
70  // Return 0 if 'wire' is not in a wire group; this includes
71  // wires out outside the chamber, and lying in 'dead' regions
72 
73  int wireG = 0;
74 
75  // upper_bound works on a sorted range and points to first element
76  // _succeeding_ supplied value.
77 
78  CIterator it = upper_bound( theFirstWireOfEachWireGroup.begin(),
79  theFirstWireOfEachWireGroup.end(), wire );
80 
81  // We are now pointing to the wire group _after_ the required one
82  // (unless we are at begin() or end() when we just return wireG=0)
83  ptrdiff_t pd = it - theFirstWireOfEachWireGroup.begin();
84 
85  if ( pd > 0 ) {
86  size_t id = --pd; //@@ Need to step back one. IS THIS SANE CODE?
87  int wiresInGroup = theNumberOfWiresPerWireGroup[id];
88  int firstWire = theFirstWireOfEachWireGroup[id];
89 
90  // Require wire not past end of group (may be in a dead region, or
91  // bigger than total wires in chamber)
92  if ( wire < (firstWire + wiresInGroup) ) wireG = ++id;
93  }
94  return wireG;
95 }
Container::const_iterator CIterator

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
int CSCGangedWireGrouping::theNumberOfWires
private

Definition at line 77 of file CSCGangedWireGrouping.h.

Referenced by CSCGangedWireGrouping(), and numberOfWires().

Container CSCGangedWireGrouping::theNumberOfWiresPerWireGroup
private