CMS 3D CMS Logo

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

CSCGangedWireGrouping::~CSCGangedWireGrouping ( )
inlineoverride

Definition at line 25 of file CSCGangedWireGrouping.h.

References CSCGangedWireGrouping().

25 {}
CSCGangedWireGrouping::CSCGangedWireGrouping ( const Container consecutiveGroups,
const Container wiresInConsecutiveGroups,
int  numberOfGroups 
)

Constructor from endcap muon wire information parsed from DDD

Definition at line 10 of file CSCGangedWireGrouping.cc.

References mps_fire::i, LogTrace, theFirstWireOfEachWireGroup, theNumberOfWires, and theNumberOfWiresPerWireGroup.

Referenced by clone(), and ~CSCGangedWireGrouping().

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

Member Function Documentation

CSCWireGrouping* CSCGangedWireGrouping::clone ( void  ) const
inlineoverridevirtual

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
overridevirtual

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 96 of file CSCGangedWireGrouping.cc.

References theFirstWireOfEachWireGroup, theNumberOfGroups, and theNumberOfWiresPerWireGroup.

Referenced by numberOfWireGroups().

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

How many wire groups

Implements CSCWireGrouping.

Definition at line 46 of file CSCGangedWireGrouping.h.

References middleWireOfGroup(), numberOfWiresPerGroup(), theNumberOfGroups, and wireGroup().

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

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
overridevirtual

How many wires in a wiregroup

Implements CSCWireGrouping.

Definition at line 61 of file CSCGangedWireGrouping.cc.

References theNumberOfGroups, and theNumberOfWiresPerWireGroup.

Referenced by numberOfWireGroups().

61  {
62  if ( wireGroup > 0 && wireGroup <= theNumberOfGroups )
64  else return 0;
65 }
int wireGroup(int wire) const override
int CSCGangedWireGrouping::wireGroup ( int  wire) const
overridevirtual

Wire group containing a given wire

Implements CSCWireGrouping.

Definition at line 67 of file CSCGangedWireGrouping.cc.

References hcalTTPDigis_cfi::id, theFirstWireOfEachWireGroup, and theNumberOfWiresPerWireGroup.

Referenced by numberOfWireGroups().

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