test
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 | 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
 
std::vector< CSCWireDigiwire_cluster
 
std::vector< int > wire_in_cluster
 
std::vector< int > wire_in_clusterAndBX
 
std::vector< float > wire_spacing
 

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, and edm::ParameterSet::getParameter().

21  : recoConditions_(0){
22 
23  deltaT = ps.getParameter<int>("CSCWireClusterDeltaT");
24  //clusterSize = ps.getParameter<int>("CSCWireClusterMaxSize");
25 }
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 28 of file CSCHitFromWireOnly.cc.

28 {}

Member Function Documentation

bool CSCHitFromWireOnly::addToCluster ( const CSCWireDigi digi)

Definition at line 136 of file CSCHitFromWireOnly.cc.

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

Referenced by runWire().

136  {
137 
138 
139  int iwg = digi.getWireGroup();
140 
141  if ( iwg == theLastChannel ){
142  return true; // Same wire group but different tbin -> ignore
143  }
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.
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 160 of file CSCHitFromWireOnly.cc.

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

Referenced by runWire().

160  {
161 
162  // Again use center of mass to determine position of wire hit
163  // To do so, need to know wire spacing and # of wires
164 
165  float y = 0.0;
166 
167  for ( unsigned i = 0; i < wire_cluster.size(); ++i ) {
168  CSCWireDigi wdigi = wire_cluster[i];
169  int wgroup = wdigi.getWireGroup();
170  wire_in_cluster.push_back( wgroup );
171  int wgroupAndBX = wdigi.getBXandWireGroup();
172  //std::cout << " wgroupAndBX: " << std::hex << wgroupAndBX << std::dec << std::endl;
173  wire_in_clusterAndBX.push_back( wgroupAndBX );
174  y += float( wgroup );
175  }
176 
177  float wiregpos = y /wire_cluster.size() ;
178 
179  return wiregpos;
180 
181 }
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 183 of file CSCHitFromWireOnly.cc.

References CSCRecoConditions::badWireWord(), and recoConditions_.

Referenced by runWire().

183  {
184 
185  const std::bitset<112> & deadWG = recoConditions_->badWireWord( id );
186  bool isDead = false;
187  if(WG>-1 && WG<112){
188  isDead = deadWG.test(WG);
189  }
190  return isDead;
191 }
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 126 of file CSCHitFromWireOnly.cc.

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

Referenced by runWire().

126  {
127  wire_cluster.clear();
128  wire_in_cluster.clear();
129  wire_in_clusterAndBX.clear();
130  theLastChannel = digi.getWireGroup();
131  theTime = digi.getTimeBin();
132  wire_cluster.push_back( digi );
133 }
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 31 of file CSCHitFromWireOnly.cc.

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

Referenced by CSCRecHitDBuilder::build().

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

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.