#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< CSCWireHit > | runWire (const CSCDetId &id, const CSCLayer *layer, const CSCWireDigiCollection::Range &rwired) |
void | setConditions (const CSCRecoConditions *reco) |
~CSCHitFromWireOnly () | |
Public Attributes | |
CSCDetId | id_ |
const CSCLayer * | layer_ |
const CSCLayerGeometry * | layergeom_ |
Private Member Functions | |
bool | isDeadWG (const CSCDetId &id, int WG) |
Private Attributes | |
int | deltaT |
To fill BX + wiregroup in CSCWireHit. | |
const CSCRecoConditions * | recoConditions_ |
Hold pointer to current conditions data. | |
int | theLastChannel |
int | theTime |
std::vector< CSCWireDigi > | wire_cluster |
std::vector< int > | wire_in_cluster |
std::vector< int > | wire_in_clusterAndBX |
std::vector< float > | wire_spacing |
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
Definition at line 37 of file CSCHitFromWireOnly.h.
typedef std::vector<int> CSCHitFromWireOnly::ChannelContainer |
Definition at line 41 of file CSCHitFromWireOnly.h.
CSCHitFromWireOnly::CSCHitFromWireOnly | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 21 of file CSCHitFromWireOnly.cc.
References deltaT, and edm::ParameterSet::getParameter().
: recoConditions_(0){ deltaT = ps.getParameter<int>("CSCWireClusterDeltaT"); //clusterSize = ps.getParameter<int>("CSCWireClusterMaxSize"); }
CSCHitFromWireOnly::~CSCHitFromWireOnly | ( | ) |
Definition at line 28 of file CSCHitFromWireOnly.cc.
{}
bool CSCHitFromWireOnly::addToCluster | ( | const CSCWireDigi & | digi | ) |
Definition at line 136 of file CSCHitFromWireOnly.cc.
References abs, deltaT, CSCWireDigi::getTimeBin(), CSCWireDigi::getWireGroup(), theLastChannel, theTime, and wire_cluster.
Referenced by runWire().
{ int iwg = digi.getWireGroup(); if ( iwg == theLastChannel ){ return true; // Same wire group but different tbin -> ignore } else{ if ( (iwg == theLastChannel+1) && (abs(digi.getTimeBin()-theTime)<= deltaT) ) { theLastChannel = iwg; wire_cluster.push_back( digi ); return true; } } return false; }
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 ExpressReco_HICollisions_FallBack::y.
Referenced by runWire().
{ // Again use center of mass to determine position of wire hit // To do so, need to know wire spacing and # of wires float y = 0.0; for ( unsigned i = 0; i < wire_cluster.size(); ++i ) { CSCWireDigi wdigi = wire_cluster[i]; int wgroup = wdigi.getWireGroup(); wire_in_cluster.push_back( wgroup ); int wgroupAndBX = wdigi.getBXandWireGroup(); //std::cout << " wgroupAndBX: " << std::hex << wgroupAndBX << std::dec << std::endl; wire_in_clusterAndBX.push_back( wgroupAndBX ); y += float( wgroup ); } float wiregpos = y /wire_cluster.size() ; return wiregpos; }
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().
{ const std::bitset<112> & deadWG = recoConditions_->badWireWord( id ); bool isDead = false; if(WG>-1 && WG<112){ isDead = deadWG.test(WG); } return isDead; }
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().
{ wire_cluster.clear(); wire_in_cluster.clear(); wire_in_clusterAndBX.clear(); theLastChannel = digi.getWireGroup(); theTime = digi.getTimeBin(); wire_cluster.push_back( digi ); }
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(), ExpressReco_HICollisions_FallBack::id, id_, isDeadWG(), layer_, layergeom_, makeWireCluster(), theTime, wire_cluster, wire_in_cluster, and wire_in_clusterAndBX.
Referenced by CSCRecHitDBuilder::build().
{ std::vector<CSCWireHit> hitsInLayer; id_ = id; layer_ = layer; layergeom_ = layer->geometry(); bool any_digis = true; int n_wgroup = 0; // Loop over wire digi collection for ( CSCWireDigiCollection::const_iterator it = rwired.first; it != rwired.second; ++it ) { const CSCWireDigi wdigi = *it; if(isDeadWG( id, wdigi.getWireGroup())){ continue; } if ( any_digis ) { any_digis = false; makeWireCluster( wdigi ); n_wgroup = 1; } else { if ( !addToCluster( wdigi ) ) { // Make Wire Hit from cluster, delete old cluster and start new one float whit_pos = findWireHitPosition(); bool deadWG_left = isDeadWG( id, wire_in_cluster.at(0) -1 ); bool deadWG_right = isDeadWG( id, wire_in_cluster.at(wire_in_cluster.size()-1) + 1); short int aDeadWG = 0; if(!deadWG_left && !deadWG_right){ aDeadWG = 0; } else if(deadWG_left && deadWG_right){ aDeadWG = 255; } else{ if(deadWG_left){ aDeadWG = wire_in_cluster.at(0) -1; } else{ aDeadWG = wire_in_cluster.at(wire_in_cluster.size()-1) + 1; } } // 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. std::vector <int> timeBinsOn=wire_cluster[n_wgroup/2].getTimeBinsOn(); //CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, isDeadWGAround, timeBinsOn ); CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, aDeadWG, timeBinsOn ); hitsInLayer.push_back( whit ); makeWireCluster( wdigi ); n_wgroup = 1; } else { n_wgroup++; } } // Don't forget to fill last wire hit !!! if ( rwired.second - it == 1) { float whit_pos = findWireHitPosition(); bool deadWG_left = isDeadWG( id, wire_in_cluster.at(0) -1 ); bool deadWG_right = isDeadWG( id, wire_in_cluster.at(wire_in_cluster.size()-1) + 1); short int aDeadWG = 0; if(!deadWG_left && !deadWG_right){ aDeadWG = 0; } else if(deadWG_left && deadWG_right){ aDeadWG = 255; } else{ if(deadWG_left){ aDeadWG = wire_in_cluster.at(0) -1; } else{ aDeadWG = wire_in_cluster.at(wire_in_cluster.size()-1) + 1; } } std::vector <int> timeBinsOn=wire_cluster[n_wgroup/2].getTimeBinsOn(); //CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, isDeadWGAround, timeBinsOn ); CSCWireHit whit(id, whit_pos, wire_in_clusterAndBX, theTime, aDeadWG, timeBinsOn ); hitsInLayer.push_back( whit ); n_wgroup++; } } /* for(std::vector<CSCWireHit>::const_iterator itWHit=hitsInLayer.begin(); itWHit!=hitsInLayer.end(); ++itWHit){ (*itWHit).print(); } */ return hitsInLayer; }
void CSCHitFromWireOnly::setConditions | ( | const CSCRecoConditions * | reco | ) | [inline] |
Definition at line 49 of file CSCHitFromWireOnly.h.
References dt_offlineAnalysis_common_cff::reco, and recoConditions_.
Referenced by CSCRecHitDBuilder::setConditions().
{ recoConditions_ = reco; }
int CSCHitFromWireOnly::deltaT [private] |
To fill BX + wiregroup in CSCWireHit.
Definition at line 70 of file CSCHitFromWireOnly.h.
Referenced by addToCluster(), and CSCHitFromWireOnly().
Definition at line 56 of file CSCHitFromWireOnly.h.
Referenced by runWire().
Definition at line 57 of file CSCHitFromWireOnly.h.
Referenced by runWire().
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.