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

◆ CIterator

typedef Container::const_iterator CSCGangedWireGrouping::CIterator

Definition at line 21 of file CSCGangedWireGrouping.h.

◆ Container

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

Definition at line 20 of file CSCGangedWireGrouping.h.

Constructor & Destructor Documentation

◆ ~CSCGangedWireGrouping()

CSCGangedWireGrouping::~CSCGangedWireGrouping ( )
inlineoverride

Definition at line 23 of file CSCGangedWireGrouping.h.

23 {}

◆ CSCGangedWireGrouping()

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

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

Member Function Documentation

◆ clone()

CSCWireGrouping* CSCGangedWireGrouping::clone ( void  ) const
inlineoverridevirtual

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

Implements CSCWireGrouping.

Definition at line 67 of file CSCGangedWireGrouping.h.

References CSCGangedWireGrouping().

67 { return new CSCGangedWireGrouping(*this); }
CSCGangedWireGrouping(const Container &consecutiveGroups, const Container &wiresInConsecutiveGroups, int numberOfGroups)

◆ middleWireOfGroup()

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

References theFirstWireOfEachWireGroup, theNumberOfGroups, theNumberOfWiresPerWireGroup, and wireGroup().

94  {
95  // Return exact wire number for group with odd number of wires
96  // Return half-integer wire number for group with even number of wires
97  // i.e. first + 0.5 * float(#) - 0.5
98  // Return 0 if out of range
99 
100  float middleWire = 0.;
101  if (wireGroup > 0 && wireGroup <= theNumberOfGroups) {
103  }
104  return middleWire;
105 }
int wireGroup(int wire) const override

◆ numberOfWireGroups()

int CSCGangedWireGrouping::numberOfWireGroups ( ) const
inlineoverridevirtual

How many wire groups

Implements CSCWireGrouping.

Definition at line 43 of file CSCGangedWireGrouping.h.

References theNumberOfGroups.

◆ numberOfWires()

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 38 of file CSCGangedWireGrouping.h.

References theNumberOfWires.

◆ numberOfWiresPerGroup()

int CSCGangedWireGrouping::numberOfWiresPerGroup ( int  wireGroup) const
overridevirtual

How many wires in a wiregroup

Implements CSCWireGrouping.

Definition at line 58 of file CSCGangedWireGrouping.cc.

References theNumberOfGroups, theNumberOfWiresPerWireGroup, and wireGroup().

58  {
61  else
62  return 0;
63 }
int wireGroup(int wire) const override

◆ wireGroup()

int CSCGangedWireGrouping::wireGroup ( int  wire) const
overridevirtual

Wire group containing a given wire

Implements CSCWireGrouping.

Definition at line 65 of file CSCGangedWireGrouping.cc.

References l1ctLayer2EG_cff::id, theFirstWireOfEachWireGroup, theNumberOfWiresPerWireGroup, pfDeepBoostedJetPreprocessParams_cfi::upper_bound, and nano_mu_digi_cff::wire.

Referenced by middleWireOfGroup(), and numberOfWiresPerGroup().

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

Member Data Documentation

◆ theFirstWireOfEachWireGroup

Container CSCGangedWireGrouping::theFirstWireOfEachWireGroup
private

Definition at line 73 of file CSCGangedWireGrouping.h.

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

◆ theNumberOfGroups

int CSCGangedWireGrouping::theNumberOfGroups
private

◆ theNumberOfWires

int CSCGangedWireGrouping::theNumberOfWires
private

Definition at line 71 of file CSCGangedWireGrouping.h.

Referenced by CSCGangedWireGrouping(), and numberOfWires().

◆ theNumberOfWiresPerWireGroup

Container CSCGangedWireGrouping::theNumberOfWiresPerWireGroup
private