CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
CSCHitFromWireOnly Class Reference

#include <CSCHitFromWireOnly.h>

Public Types

typedef std::vector< int > ChannelContainer
 

Public Member Functions

bool addToCluster (const CSCWireDigi &digi)
 
 CSCHitFromWireOnly (const edm::ParameterSet &ps)
 
float findWireHitPosition ()
 
void makeWireCluster (const CSCWireDigi &digi)
 
std::vector< CSCWireHitrunWire (const CSCDetId &id, const CSCLayer *layer, const CSCWireDigiCollection::Range &rwired)
 
void setConditions (const CSCRecoConditions *reco)
 
 ~CSCHitFromWireOnly ()
 

Public Attributes

CSCDetId id_
 
const CSCLayerlayer_
 
const CSCLayerGeometrylayergeom_
 

Private Member Functions

bool isDeadWG (const CSCDetId &id, int WG)
 

Private Attributes

int deltaT
 To fill BX + wiregroup in CSCWireHit. More...
 
const CSCRecoConditionsrecoConditions_
 Hold pointer to current conditions data. More...
 
int theLastChannel
 
int theTime
 
bool useReducedWireTime
 
std::vector< CSCWireDigiwire_cluster
 
std::vector< int > wire_in_cluster
 
std::vector< int > wire_in_clusterAndBX
 
std::vector< float > wire_spacing
 
int wireTimeWindow_high
 
int wireTimeWindow_low
 

Detailed Description

Search for hits within the wire groups. For each of these hits, try forming clusters by looking at adjacent wiregroup. Form a wire Hit out of these clusters by finding the center-of-mass position of the hit in terms of the wire #. The DetId, wire hit position, and peaking time are stored in a CSCWireHit collection.

To keep wire hits only so they can be used in segment building. Only the DetId and wiregroup # are stored in a CSCWireHit collection

Author
Dominique Fortin - UCR
Stoyan Stoynev - Northwestern

Definition at line 36 of file CSCHitFromWireOnly.h.

Member Typedef Documentation

◆ ChannelContainer

typedef std::vector<int> CSCHitFromWireOnly::ChannelContainer

Definition at line 38 of file CSCHitFromWireOnly.h.

Constructor & Destructor Documentation

◆ CSCHitFromWireOnly()

CSCHitFromWireOnly::CSCHitFromWireOnly ( const edm::ParameterSet ps)
explicit

Definition at line 20 of file CSCHitFromWireOnly.cc.

References deltaT, edm::ParameterSet::getParameter(), useReducedWireTime, wireTimeWindow_high, and wireTimeWindow_low.

20  : recoConditions_(nullptr) {
21  deltaT = ps.getParameter<int>("CSCWireClusterDeltaT");
22  useReducedWireTime = ps.getParameter<bool>("CSCUseReducedWireTimeWindow");
23  wireTimeWindow_low = ps.getParameter<int>("CSCWireTimeWindowLow");
24  wireTimeWindow_high = ps.getParameter<int>("CSCWireTimeWindowHigh");
25 
26  //clusterSize = ps.getParameter<int>("CSCWireClusterMaxSize");
27 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
int deltaT
To fill BX + wiregroup in CSCWireHit.
const CSCRecoConditions * recoConditions_
Hold pointer to current conditions data.

◆ ~CSCHitFromWireOnly()

CSCHitFromWireOnly::~CSCHitFromWireOnly ( )

Definition at line 29 of file CSCHitFromWireOnly.cc.

29 {}

Member Function Documentation

◆ addToCluster()

bool CSCHitFromWireOnly::addToCluster ( const CSCWireDigi digi)

Definition at line 139 of file CSCHitFromWireOnly.cc.

References funct::abs(), deltaT, CSCWireDigi::getTimeBin(), CSCWireDigi::getWireGroup(), theLastChannel, theTime, and wire_cluster.

Referenced by runWire().

139  {
140  int iwg = digi.getWireGroup();
141 
142  if (iwg == theLastChannel) {
143  return true; // Same wire group but different tbin -> ignore
144  } else {
145  if ((iwg == theLastChannel + 1) && (abs(digi.getTimeBin() - theTime) <= deltaT)) {
146  theLastChannel = iwg;
147  wire_cluster.push_back(digi);
148  return true;
149  }
150  }
151 
152  return false;
153 }
int deltaT
To fill BX + wiregroup in CSCWireHit.
int getTimeBin() const
return first tbin ON number
Definition: CSCWireDigi.cc:35
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< CSCWireDigi > wire_cluster
int getWireGroup() const
default
Definition: CSCWireDigi.h:22

◆ findWireHitPosition()

float CSCHitFromWireOnly::findWireHitPosition ( )

BX to WireHit

BX to WireHit

Definition at line 159 of file CSCHitFromWireOnly.cc.

References dqmMemoryStats::float, CSCWireDigi::getBXandWireGroup(), CSCWireDigi::getWireGroup(), mps_fire::i, wire_cluster, wire_in_cluster, wire_in_clusterAndBX, and y.

Referenced by runWire().

159  {
160  // Again use center of mass to determine position of wire hit
161  // To do so, need to know wire spacing and # of wires
162 
163  float y = 0.0;
164 
165  for (unsigned i = 0; i < wire_cluster.size(); ++i) {
166  CSCWireDigi wdigi = wire_cluster[i];
167  int wgroup = wdigi.getWireGroup();
168  wire_in_cluster.push_back(wgroup);
169  int wgroupAndBX = wdigi.getBXandWireGroup();
170  //std::cout << " wgroupAndBX: " << std::hex << wgroupAndBX << std::dec << std::endl;
171  wire_in_clusterAndBX.push_back(wgroupAndBX);
172  y += float(wgroup);
173  }
174 
175  float wiregpos = y / wire_cluster.size();
176 
177  return wiregpos;
178 }
std::vector< int > wire_in_cluster
std::vector< int > wire_in_clusterAndBX
int getBXandWireGroup() const
Definition: CSCWireDigi.h:27
std::vector< CSCWireDigi > wire_cluster
int getWireGroup() const
default
Definition: CSCWireDigi.h:22

◆ isDeadWG()

bool CSCHitFromWireOnly::isDeadWG ( const CSCDetId id,
int  WG 
)
private

Definition at line 180 of file CSCHitFromWireOnly.cc.

References CSCRecoConditions::badWireWord(), and recoConditions_.

Referenced by runWire().

180  {
181  const std::bitset<112>& deadWG = recoConditions_->badWireWord(id);
182  bool isDead = false;
183  if (WG > -1 && WG < 112) {
184  isDead = deadWG.test(WG);
185  }
186  return isDead;
187 }
const std::bitset< 112 > & badWireWord(const CSCDetId &id) const
Get bad wiregroup word.
const CSCRecoConditions * recoConditions_
Hold pointer to current conditions data.

◆ makeWireCluster()

void CSCHitFromWireOnly::makeWireCluster ( const CSCWireDigi digi)

BX to wire

Definition at line 130 of file CSCHitFromWireOnly.cc.

References CSCWireDigi::getTimeBin(), CSCWireDigi::getWireGroup(), theLastChannel, theTime, wire_cluster, wire_in_cluster, and wire_in_clusterAndBX.

Referenced by runWire().

130  {
131  wire_cluster.clear();
132  wire_in_cluster.clear();
133  wire_in_clusterAndBX.clear();
134  theLastChannel = digi.getWireGroup();
135  theTime = digi.getTimeBin();
136  wire_cluster.push_back(digi);
137 }
int getTimeBin() const
return first tbin ON number
Definition: CSCWireDigi.cc:35
std::vector< int > wire_in_cluster
std::vector< int > wire_in_clusterAndBX
std::vector< CSCWireDigi > wire_cluster
int getWireGroup() const
default
Definition: CSCWireDigi.h:22

◆ runWire()

std::vector< CSCWireHit > CSCHitFromWireOnly::runWire ( const CSCDetId id,
const CSCLayer layer,
const CSCWireDigiCollection::Range rwired 
)

BX

Print statement (!!!to control WireHit content!!!) BX

Definition at line 31 of file CSCHitFromWireOnly.cc.

References addToCluster(), findWireHitPosition(), CSCWireDigi::getWireGroup(), l1ctLayer2EG_cff::id, id_, isDeadWG(), phase1PixelTopology::layer, layer_, layergeom_, makeWireCluster(), theTime, useReducedWireTime, wire_cluster, wire_in_cluster, wire_in_clusterAndBX, wireTimeWindow_high, and wireTimeWindow_low.

Referenced by CSCRecHitDBuilder::build().

33  {
34  std::vector<CSCWireHit> hitsInLayer;
35 
36  id_ = id;
37  layer_ = layer;
38  layergeom_ = layer->geometry();
39  bool any_digis = true;
40  int n_wgroup = 0;
41 
42  // Loop over wire digi collection
43  for (CSCWireDigiCollection::const_iterator it = rwired.first; it != rwired.second; ++it) {
44  const CSCWireDigi wdigi = *it;
45 
46  if (isDeadWG(id, wdigi.getWireGroup())) {
47  continue;
48  }
49  if (any_digis) {
50  any_digis = false;
51  makeWireCluster(wdigi);
52  n_wgroup = 1;
53  } else {
54  if (!addToCluster(wdigi)) {
55  // Make Wire Hit from cluster, delete old cluster and start new one
56  float whit_pos = findWireHitPosition();
57  bool deadWG_left = isDeadWG(id, wire_in_cluster.at(0) - 1);
58  bool deadWG_right = isDeadWG(id, wire_in_cluster.at(wire_in_cluster.size() - 1) + 1);
59  short int aDeadWG = 0;
60  if (!deadWG_left && !deadWG_right) {
61  aDeadWG = 0;
62  } else if (deadWG_left && deadWG_right) {
63  aDeadWG = 255;
64  } else {
65  if (deadWG_left) {
66  aDeadWG = wire_in_cluster.at(0) - 1;
67  } else {
68  aDeadWG = wire_in_cluster.at(wire_in_cluster.size() - 1) + 1;
69  }
70  }
71  // Set time bins for wire hit as the time bins of the central wire digi, lower of central two if an even number of digis.
72  std::vector<int> timeBinsOn = wire_cluster[n_wgroup / 2].getTimeBinsOn();
73  //CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, isDeadWGAround, timeBinsOn );
74  CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, aDeadWG, timeBinsOn);
75 
76  if (!useReducedWireTime) {
77  hitsInLayer.push_back(whit);
79  hitsInLayer.push_back(whit);
80  }
81 
82  makeWireCluster(wdigi);
83  n_wgroup = 1;
84  } else {
85  n_wgroup++;
86  }
87  }
88  // Don't forget to fill last wire hit !!!
89  if (rwired.second - it == 1) {
90  float whit_pos = findWireHitPosition();
91  bool deadWG_left = isDeadWG(id, wire_in_cluster.at(0) - 1);
92  bool deadWG_right = isDeadWG(id, wire_in_cluster.at(wire_in_cluster.size() - 1) + 1);
93  short int aDeadWG = 0;
94  if (!deadWG_left && !deadWG_right) {
95  aDeadWG = 0;
96  } else if (deadWG_left && deadWG_right) {
97  aDeadWG = 255;
98  } else {
99  if (deadWG_left) {
100  aDeadWG = wire_in_cluster.at(0) - 1;
101  } else {
102  aDeadWG = wire_in_cluster.at(wire_in_cluster.size() - 1) + 1;
103  }
104  }
105  std::vector<int> timeBinsOn = wire_cluster[n_wgroup / 2].getTimeBinsOn();
107  //CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, isDeadWGAround, timeBinsOn );
108  CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, aDeadWG, timeBinsOn);
109 
110  if (!useReducedWireTime) {
111  hitsInLayer.push_back(whit);
113  hitsInLayer.push_back(whit);
114  }
115 
116  n_wgroup++;
117  }
118  }
119 
121  /*
122  for(std::vector<CSCWireHit>::const_iterator itWHit=hitsInLayer.begin(); itWHit!=hitsInLayer.end(); ++itWHit){
123  (*itWHit).print();
124  }
125  */
126 
127  return hitsInLayer;
128 }
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< int > wire_in_cluster
void makeWireCluster(const CSCWireDigi &digi)
const CSCLayer * layer_
bool addToCluster(const CSCWireDigi &digi)
std::vector< DigiType >::const_iterator const_iterator
std::vector< int > wire_in_clusterAndBX
const CSCLayerGeometry * layergeom_
bool isDeadWG(const CSCDetId &id, int WG)
std::vector< CSCWireDigi > wire_cluster
int getWireGroup() const
default
Definition: CSCWireDigi.h:22

◆ setConditions()

void CSCHitFromWireOnly::setConditions ( const CSCRecoConditions reco)
inline

Definition at line 47 of file CSCHitFromWireOnly.h.

References dt_dqm_sourceclient_common_cff::reco, and recoConditions_.

Referenced by CSCRecHitDBuilder::setConditions().

47 { recoConditions_ = reco; }
const CSCRecoConditions * recoConditions_
Hold pointer to current conditions data.

Member Data Documentation

◆ deltaT

int CSCHitFromWireOnly::deltaT
private

To fill BX + wiregroup in CSCWireHit.

Definition at line 66 of file CSCHitFromWireOnly.h.

Referenced by addToCluster(), and CSCHitFromWireOnly().

◆ id_

CSCDetId CSCHitFromWireOnly::id_

Definition at line 52 of file CSCHitFromWireOnly.h.

Referenced by runWire().

◆ layer_

const CSCLayer* CSCHitFromWireOnly::layer_

Definition at line 53 of file CSCHitFromWireOnly.h.

Referenced by runWire().

◆ layergeom_

const CSCLayerGeometry* CSCHitFromWireOnly::layergeom_

Definition at line 54 of file CSCHitFromWireOnly.h.

Referenced by runWire().

◆ recoConditions_

const CSCRecoConditions* CSCHitFromWireOnly::recoConditions_
private

Hold pointer to current conditions data.

Definition at line 73 of file CSCHitFromWireOnly.h.

Referenced by isDeadWG(), and setConditions().

◆ theLastChannel

int CSCHitFromWireOnly::theLastChannel
private

Definition at line 63 of file CSCHitFromWireOnly.h.

Referenced by addToCluster(), and makeWireCluster().

◆ theTime

int CSCHitFromWireOnly::theTime
private

Definition at line 62 of file CSCHitFromWireOnly.h.

Referenced by addToCluster(), makeWireCluster(), and runWire().

◆ useReducedWireTime

bool CSCHitFromWireOnly::useReducedWireTime
private

Definition at line 67 of file CSCHitFromWireOnly.h.

Referenced by CSCHitFromWireOnly(), and runWire().

◆ wire_cluster

std::vector<CSCWireDigi> CSCHitFromWireOnly::wire_cluster
private

Definition at line 59 of file CSCHitFromWireOnly.h.

Referenced by addToCluster(), findWireHitPosition(), makeWireCluster(), and runWire().

◆ wire_in_cluster

std::vector<int> CSCHitFromWireOnly::wire_in_cluster
private

Definition at line 60 of file CSCHitFromWireOnly.h.

Referenced by findWireHitPosition(), makeWireCluster(), and runWire().

◆ wire_in_clusterAndBX

std::vector<int> CSCHitFromWireOnly::wire_in_clusterAndBX
private

Definition at line 64 of file CSCHitFromWireOnly.h.

Referenced by findWireHitPosition(), makeWireCluster(), and runWire().

◆ wire_spacing

std::vector<float> CSCHitFromWireOnly::wire_spacing
private

Definition at line 61 of file CSCHitFromWireOnly.h.

◆ wireTimeWindow_high

int CSCHitFromWireOnly::wireTimeWindow_high
private

Definition at line 69 of file CSCHitFromWireOnly.h.

Referenced by CSCHitFromWireOnly(), and runWire().

◆ wireTimeWindow_low

int CSCHitFromWireOnly::wireTimeWindow_low
private

Definition at line 68 of file CSCHitFromWireOnly.h.

Referenced by CSCHitFromWireOnly(), and runWire().