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 37 of file CSCHitFromWireOnly.h.

Member Typedef Documentation

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

Definition at line 41 of file CSCHitFromWireOnly.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file CSCHitFromWireOnly.cc.

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

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

Definition at line 32 of file CSCHitFromWireOnly.cc.

32 {}

Member Function Documentation

bool CSCHitFromWireOnly::addToCluster ( const CSCWireDigi digi)

Definition at line 154 of file CSCHitFromWireOnly.cc.

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

Referenced by runWire(), and setConditions().

154  {
155 
156 
157  int iwg = digi.getWireGroup();
158 
159  if ( iwg == theLastChannel ){
160  return true; // Same wire group but different tbin -> ignore
161  }
162  else{
163  if ( (iwg == theLastChannel+1) && (abs(digi.getTimeBin()-theTime)<= deltaT) ) {
164  theLastChannel = iwg;
165  wire_cluster.push_back( digi );
166  return true;
167  }
168  }
169 
170  return false;
171 }
int deltaT
To fill BX + wiregroup in CSCWireHit.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int getWireGroup() const
default
Definition: CSCWireDigi.h:24
int getTimeBin() const
return first tbin ON number
Definition: CSCWireDigi.cc:37
std::vector< CSCWireDigi > wire_cluster
float CSCHitFromWireOnly::findWireHitPosition ( )

BX to WireHit

BX to WireHit

Definition at line 178 of file CSCHitFromWireOnly.cc.

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

Referenced by runWire(), and setConditions().

178  {
179 
180  // Again use center of mass to determine position of wire hit
181  // To do so, need to know wire spacing and # of wires
182 
183  float y = 0.0;
184 
185  for ( unsigned i = 0; i < wire_cluster.size(); ++i ) {
186  CSCWireDigi wdigi = wire_cluster[i];
187  int wgroup = wdigi.getWireGroup();
188  wire_in_cluster.push_back( wgroup );
189  int wgroupAndBX = wdigi.getBXandWireGroup();
190  //std::cout << " wgroupAndBX: " << std::hex << wgroupAndBX << std::dec << std::endl;
191  wire_in_clusterAndBX.push_back( wgroupAndBX );
192  y += float( wgroup );
193  }
194 
195  float wiregpos = y /wire_cluster.size() ;
196 
197  return wiregpos;
198 
199 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > wire_in_cluster
int getWireGroup() const
default
Definition: CSCWireDigi.h:24
std::vector< int > wire_in_clusterAndBX
int getBXandWireGroup() const
Definition: CSCWireDigi.h:29
std::vector< CSCWireDigi > wire_cluster
bool CSCHitFromWireOnly::isDeadWG ( const CSCDetId id,
int  WG 
)
private

Definition at line 201 of file CSCHitFromWireOnly.cc.

References CSCRecoConditions::badWireWord(), and recoConditions_.

Referenced by runWire().

201  {
202 
203  const std::bitset<112> & deadWG = recoConditions_->badWireWord( id );
204  bool isDead = false;
205  if(WG>-1 && WG<112){
206  isDead = deadWG.test(WG);
207  }
208  return isDead;
209 }
const CSCRecoConditions * recoConditions_
Hold pointer to current conditions data.
const std::bitset< 112 > & badWireWord(const CSCDetId &id) const
Get bad wiregroup word.
void CSCHitFromWireOnly::makeWireCluster ( const CSCWireDigi digi)

BX to wire

Definition at line 144 of file CSCHitFromWireOnly.cc.

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

Referenced by runWire(), and setConditions().

144  {
145  wire_cluster.clear();
146  wire_in_cluster.clear();
147  wire_in_clusterAndBX.clear();
148  theLastChannel = digi.getWireGroup();
149  theTime = digi.getTimeBin();
150  wire_cluster.push_back( digi );
151 }
std::vector< int > wire_in_cluster
int getWireGroup() const
default
Definition: CSCWireDigi.h:24
std::vector< int > wire_in_clusterAndBX
int getTimeBin() const
return first tbin ON number
Definition: CSCWireDigi.cc:37
std::vector< CSCWireDigi > wire_cluster
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 35 of file CSCHitFromWireOnly.cc.

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

Referenced by CSCRecHitDBuilder::build().

35  {
36 
37  std::vector<CSCWireHit> hitsInLayer;
38 
39  id_ = id;
40  layer_ = layer;
41  layergeom_ = layer->geometry();
42  bool any_digis = true;
43  int n_wgroup = 0;
44 
45 
46  // Loop over wire digi collection
47  for ( CSCWireDigiCollection::const_iterator it = rwired.first; it != rwired.second; ++it ) {
48 
49  const CSCWireDigi wdigi = *it;
50 
51  if(isDeadWG( id, wdigi.getWireGroup())){
52  continue;
53  }
54  if ( any_digis ) {
55  any_digis = false;
56  makeWireCluster( wdigi );
57  n_wgroup = 1;
58  } else {
59  if ( !addToCluster( wdigi ) ) {
60  // Make Wire Hit from cluster, delete old cluster and start new one
61  float whit_pos = findWireHitPosition();
62  bool deadWG_left = isDeadWG( id, wire_in_cluster.at(0) -1 );
63  bool deadWG_right = isDeadWG( id, wire_in_cluster.at(wire_in_cluster.size()-1) + 1);
64  short int aDeadWG = 0;
65  if(!deadWG_left && !deadWG_right){
66  aDeadWG = 0;
67  }
68  else if(deadWG_left && deadWG_right){
69  aDeadWG = 255;
70  }
71  else{
72  if(deadWG_left){
73  aDeadWG = wire_in_cluster.at(0) -1;
74  }
75  else{
76  aDeadWG = wire_in_cluster.at(wire_in_cluster.size()-1) + 1;
77  }
78  }
79  // 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.
80  std::vector <int> timeBinsOn=wire_cluster[n_wgroup/2].getTimeBinsOn();
81  //CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, isDeadWGAround, timeBinsOn );
82  CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, aDeadWG, timeBinsOn );
83 
84  if (!useReducedWireTime) {
85  hitsInLayer.push_back( whit );
86  }
88  hitsInLayer.push_back( whit );
89  }
90 
91  makeWireCluster( wdigi );
92  n_wgroup = 1;
93  } else {
94  n_wgroup++;
95  }
96  }
97  // Don't forget to fill last wire hit !!!
98  if ( rwired.second - it == 1) {
99  float whit_pos = findWireHitPosition();
100  bool deadWG_left = isDeadWG( id, wire_in_cluster.at(0) -1 );
101  bool deadWG_right = isDeadWG( id, wire_in_cluster.at(wire_in_cluster.size()-1) + 1);
102  short int aDeadWG = 0;
103  if(!deadWG_left && !deadWG_right){
104  aDeadWG = 0;
105  }
106  else if(deadWG_left && deadWG_right){
107  aDeadWG = 255;
108  }
109  else{
110  if(deadWG_left){
111  aDeadWG = wire_in_cluster.at(0) -1;
112  }
113  else{
114  aDeadWG = wire_in_cluster.at(wire_in_cluster.size()-1) + 1;
115  }
116  }
117  std::vector <int> timeBinsOn=wire_cluster[n_wgroup/2].getTimeBinsOn();
119  //CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, isDeadWGAround, timeBinsOn );
120  CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, aDeadWG, timeBinsOn );
121 
122  if (!useReducedWireTime) {
123  hitsInLayer.push_back( whit );
124  }
126  hitsInLayer.push_back( whit );
127  }
128 
129  n_wgroup++;
130  }
131  }
132 
134  /*
135  for(std::vector<CSCWireHit>::const_iterator itWHit=hitsInLayer.begin(); itWHit!=hitsInLayer.end(); ++itWHit){
136  (*itWHit).print();
137  }
138  */
139 
140  return hitsInLayer;
141 }
std::vector< int > wire_in_cluster
void makeWireCluster(const CSCWireDigi &digi)
const CSCLayer * layer_
bool addToCluster(const CSCWireDigi &digi)
int getWireGroup() const
default
Definition: CSCWireDigi.h:24
std::vector< CSCWireDigi >::const_iterator const_iterator
std::vector< int > wire_in_clusterAndBX
const CSCLayerGeometry * layergeom_
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
bool isDeadWG(const CSCDetId &id, int WG)
std::vector< CSCWireDigi > wire_cluster
void CSCHitFromWireOnly::setConditions ( const CSCRecoConditions reco)
inline

Definition at line 49 of file CSCHitFromWireOnly.h.

References addToCluster(), findWireHitPosition(), makeWireCluster(), trackingPlots::reco, and recoConditions_.

Referenced by CSCRecHitDBuilder::setConditions().

49  {
51  }
const CSCRecoConditions * recoConditions_
Hold pointer to current conditions data.

Member Data Documentation

int CSCHitFromWireOnly::deltaT
private

To fill BX + wiregroup in CSCWireHit.

Definition at line 70 of file CSCHitFromWireOnly.h.

Referenced by addToCluster(), and CSCHitFromWireOnly().

CSCDetId CSCHitFromWireOnly::id_

Definition at line 56 of file CSCHitFromWireOnly.h.

Referenced by runWire().

const CSCLayer* CSCHitFromWireOnly::layer_

Definition at line 57 of file CSCHitFromWireOnly.h.

Referenced by runWire().

const CSCLayerGeometry* CSCHitFromWireOnly::layergeom_

Definition at line 58 of file CSCHitFromWireOnly.h.

Referenced by runWire().

const CSCRecoConditions* CSCHitFromWireOnly::recoConditions_
private

Hold pointer to current conditions data.

Definition at line 77 of file CSCHitFromWireOnly.h.

Referenced by isDeadWG(), and setConditions().

int CSCHitFromWireOnly::theLastChannel
private

Definition at line 67 of file CSCHitFromWireOnly.h.

Referenced by addToCluster(), and makeWireCluster().

int CSCHitFromWireOnly::theTime
private

Definition at line 66 of file CSCHitFromWireOnly.h.

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

bool CSCHitFromWireOnly::useReducedWireTime
private

Definition at line 71 of file CSCHitFromWireOnly.h.

Referenced by CSCHitFromWireOnly(), and runWire().

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

Definition at line 63 of file CSCHitFromWireOnly.h.

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

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

Definition at line 64 of file CSCHitFromWireOnly.h.

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

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

Definition at line 68 of file CSCHitFromWireOnly.h.

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

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

Definition at line 65 of file CSCHitFromWireOnly.h.

int CSCHitFromWireOnly::wireTimeWindow_high
private

Definition at line 73 of file CSCHitFromWireOnly.h.

Referenced by CSCHitFromWireOnly(), and runWire().

int CSCHitFromWireOnly::wireTimeWindow_low
private

Definition at line 72 of file CSCHitFromWireOnly.h.

Referenced by CSCHitFromWireOnly(), and runWire().