![]() |
![]() |
#include <HcalHitRelabeller.h>
Public Member Functions | |
HcalHitRelabeller (const edm::ParameterSet &ps) | |
void | process (std::vector< PCaloHit > &hcalHits) |
void | setGeometry (const CaloGeometry *&theGeometry) |
Private Member Functions | |
DetId | relabel (const uint32_t testId) const |
Private Attributes | |
bool | m_CorrectPhi |
std::vector< std::vector< int > > | m_segmentation |
const CaloGeometry * | theGeometry |
Definition at line 10 of file HcalHitRelabeller.h.
HcalHitRelabeller::HcalHitRelabeller | ( | const edm::ParameterSet & | ps | ) |
Definition at line 10 of file HcalHitRelabeller.cc.
References gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), i, gen::k, m_CorrectPhi, m_segmentation, and mergeVDriftHistosByStation::name.
{ // try to make sure the memory gets pinned in place m_segmentation.resize(29); m_CorrectPhi = ps.getUntrackedParameter<bool>("CorrectPhi",false); for (int i=0; i<29; i++) { char name[10]; snprintf(name,10,"Eta%d",i+1); if (i>0) { m_segmentation[i]=ps.getUntrackedParameter<std::vector<int> >(name,m_segmentation[i-1]); } else { m_segmentation[i]=ps.getUntrackedParameter<std::vector<int> >(name); } } #ifdef DEBUG for (int i=0; i<29; i++) { std::cout << "Segmentation[" << i << "] with " << m_segmentation[i].size() << " elements:"; for (unsigned int k=0; k<m_segmentation[i].size(); ++k) std::cout << " " << m_segmentation[i][k]; std::cout << std::endl; } std::cout << "correctPhi " << m_CorrectPhi << std::endl; #endif }
void HcalHitRelabeller::process | ( | std::vector< PCaloHit > & | hcalHits | ) |
Definition at line 34 of file HcalHitRelabeller.cc.
References gather_cfg::cout, CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), cuy::ii, python::tagInventory::newid, DetId::rawId(), relabel(), and theGeometry.
Referenced by HcalDigitizer::accumulateCaloHits().
{ for (unsigned int ii=0; ii<hcalHits.size(); ++ii) { #ifdef DEBUG std::cout << "Hit[" << ii << "] " << std::hex << hcalHits[ii].id() << std::dec << '\n'; #endif DetId newid = relabel(hcalHits[ii].id()); #ifdef DEBUG std::cout << "Hit " << ii << " out of " << hcalHits.size() << " " << std::hex << newid.rawId() << std::dec << '\n'; HcalDetId newcell(newid); const CaloCellGeometry *cellGeometry = theGeometry->getSubdetectorGeometry(newcell)->getGeometry(newcell); GlobalPoint globalposition = (GlobalPoint)(cellGeometry->getPosition()); std::cout << "PCaloHit " << newcell << " position: " << globalposition << std::endl; std::cout.flush(); #endif hcalHits[ii].setID(newid.rawId()); #ifdef DEBUG std::cout << "Modified Hit " << hcalHits[ii] << std::endl; #endif } //End Change by Wetzel }
DetId HcalHitRelabeller::relabel | ( | const uint32_t | testId | ) | const [private] |
Definition at line 66 of file HcalHitRelabeller.cc.
References gather_cfg::cout, eta(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, m_CorrectPhi, m_segmentation, phi, DetId::rawId(), HcalTestNumbering::unpackHcalIndex(), and z.
Referenced by process().
{ #ifdef DEBUG std::cout << "Enter HcalHitRelabeller::relabel " << std::endl; #endif HcalDetId hid; int det, z, depth, eta, phi, layer, sign; HcalTestNumbering::unpackHcalIndex(testId,det,z,depth,eta,phi,layer); layer-=1; // one is added in the simulation, here used for indexing sign=(z==0)?(-1):(1); #ifdef DEBUG std::cout << "det: " << det << " " << "z: " << z << " " << "depth: " << depth << " " << "ieta: " << eta << " " << "iphi: " << phi << " " << "layer: " << layer << " "; std::cout.flush(); #endif int newDepth = 0; // moved out of if's just for printing purposes... int phi_skip = phi; if (m_CorrectPhi) { if (eta >= 40) phi_skip = (phi-1)*4 - 1; else if (eta > 20) phi_skip = (phi-1)*2 + 1; if (phi_skip < 0) phi_skip += 72; } if (det==int(HcalBarrel)) { newDepth=m_segmentation[eta-1][layer]; if(eta==16 && newDepth > 2) newDepth=2;// tower 16 HACK to be watched out.. hid=HcalDetId(HcalBarrel,eta*sign,phi_skip,newDepth); } if (det==int(HcalEndcap)) { newDepth=m_segmentation[eta-1][layer]; if (eta==16 && newDepth<3) newDepth=3; // tower 16 HACK to be watched out.. hid=HcalDetId(HcalEndcap,eta*sign,phi_skip,newDepth); } if (det==int(HcalOuter)) { hid=HcalDetId(HcalOuter,eta*sign,phi_skip,4); newDepth = 4; } if (det==int(HcalForward)) { hid=HcalDetId(HcalForward,eta*sign,phi_skip,depth); newDepth = depth; } #ifdef DEBUG std::cout << " new HcalDetId -> hex.RawID = " << std::hex << hid.rawId() << std::dec; std::cout.flush(); std::cout << " det, z, depth, eta, phi = " << det << " " << z << " " << newDepth << " " << eta << " " << phi << " " << phi_skip << " " << " ---> " << hid << std::endl; #endif return hid; }
void HcalHitRelabeller::setGeometry | ( | const CaloGeometry *& | theGeometry | ) |
Definition at line 62 of file HcalHitRelabeller.cc.
References relativeConstraints::geom, and theGeometry.
Referenced by HcalDigitizer::updateGeometry().
{ theGeometry = geom; }
bool HcalHitRelabeller::m_CorrectPhi [private] |
Definition at line 22 of file HcalHitRelabeller.h.
Referenced by HcalHitRelabeller(), and relabel().
std::vector<std::vector<int> > HcalHitRelabeller::m_segmentation [private] |
Definition at line 21 of file HcalHitRelabeller.h.
Referenced by HcalHitRelabeller(), and relabel().
const CaloGeometry* HcalHitRelabeller::theGeometry [private] |
Definition at line 19 of file HcalHitRelabeller.h.
Referenced by process(), and setGeometry().