-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bsunanda:Run2-hcx60 Provide hexgonal geometry for HGCal #12845
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
CondFormats/GeometryObjects/interface/HGCalParameters.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#ifndef CondFormats_GeometryObjects_HGCalParameters_h | ||
#define CondFormats_GeometryObjects_HGCalParameters_h | ||
|
||
#include "CondFormats/Serialization/interface/Serializable.h" | ||
#include "DataFormats/GeometryVector/interface/GlobalPoint.h" | ||
#include<string> | ||
#include<vector> | ||
#include<iostream> | ||
#include<stdint.h> | ||
#include<CLHEP/Geometry/Transform3D.h> | ||
|
||
class HGCalParameters { | ||
|
||
public: | ||
|
||
struct hgtrap { | ||
int lay; | ||
float bl, tl, h, dz, alpha, cellSize; | ||
}; | ||
|
||
struct hgtrform { | ||
int zp, lay, sec, subsec; | ||
CLHEP::Hep3Vector h3v; | ||
CLHEP::HepRotation hr; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bsunanda - this object should define what is stored to/retrieved from DB. I think, using vectors of doubles is better. |
||
|
||
HGCalParameters(const std::string& nam); | ||
~HGCalParameters( void ); | ||
void fillModule(const hgtrap& mytr, bool reco); | ||
hgtrap getModule(unsigned int k, bool reco) const; | ||
void fillTrForm(const hgtrform& mytr); | ||
hgtrform getTrForm(unsigned int k) const; | ||
void addTrForm(const CLHEP::Hep3Vector& h3v); | ||
void scaleTrForm(double); | ||
|
||
static const int kMaskZside = 0x1; | ||
static const int kMaskLayer = 0x7F; | ||
static const int kMaskSector = 0x3FF; | ||
static const int kMaskSubSec = 0x1; | ||
static const int kShiftZside = 19; | ||
static const int kShiftLayer = 12; | ||
static const int kShiftSector = 1; | ||
static const int kShiftSubSec = 0; | ||
|
||
std::string name_; | ||
int nCells_; | ||
int nSectors_; | ||
std::vector<double> cellSize_; | ||
std::vector<int> moduleLayS_; | ||
std::vector<double> moduleBlS_; | ||
std::vector<double> moduleTlS_; | ||
std::vector<double> moduleHS_; | ||
std::vector<double> moduleDzS_; | ||
std::vector<double> moduleAlphaS_; | ||
std::vector<double> moduleCellS_; | ||
std::vector<int> moduleLayR_; | ||
std::vector<double> moduleBlR_; | ||
std::vector<double> moduleTlR_; | ||
std::vector<double> moduleHR_; | ||
std::vector<double> moduleDzR_; | ||
std::vector<double> moduleAlphaR_; | ||
std::vector<double> moduleCellR_; | ||
std::vector<uint32_t> trformIndex_; | ||
std::vector<double> trformTranX_; | ||
std::vector<double> trformTranY_; | ||
std::vector<double> trformTranZ_; | ||
std::vector<double> trformRotXX_; | ||
std::vector<double> trformRotYX_; | ||
std::vector<double> trformRotZX_; | ||
std::vector<double> trformRotXY_; | ||
std::vector<double> trformRotYY_; | ||
std::vector<double> trformRotZY_; | ||
std::vector<double> trformRotXZ_; | ||
std::vector<double> trformRotYZ_; | ||
std::vector<double> trformRotZZ_; | ||
std::vector<int> layer_; | ||
std::vector<int> layerIndex_; | ||
std::vector<int> layerGroup_; | ||
std::vector<int> cellFactor_; | ||
std::vector<int> depth_; | ||
std::vector<int> depthIndex_; | ||
std::vector<int> depthLayerF_; | ||
std::vector<double> zLayerHex_; | ||
std::vector<double> rMinLayHex_; | ||
std::vector<double> rMaxLayHex_; | ||
std::vector<int> waferCopy_; | ||
std::vector<int> waferTypeL_; | ||
std::vector<int> waferTypeT_; | ||
std::vector<double> waferPosX_; | ||
std::vector<double> waferPosY_; | ||
std::vector<double> cellFineX_; | ||
std::vector<double> cellFineY_; | ||
std::vector<double> cellCoarseX_; | ||
std::vector<double> cellCoarseY_; | ||
std::vector<int> layerGroupM_; | ||
std::vector<int> layerGroupO_; | ||
std::vector<double> boundR_; | ||
double waferR_; | ||
int mode_; | ||
|
||
COND_SERIALIZABLE; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
#include "CondFormats/GeometryObjects/interface/HGCalParameters.h" | ||
//#define DebugLog | ||
|
||
HGCalParameters::HGCalParameters(const std::string& nam): name_(nam) { } | ||
|
||
HGCalParameters::~HGCalParameters() { } | ||
|
||
void HGCalParameters::fillModule(const HGCalParameters::hgtrap& mytr, | ||
bool reco) { | ||
|
||
if (reco) { | ||
moduleLayR_.push_back(mytr.lay); | ||
moduleBlR_.push_back(mytr.bl); | ||
moduleTlR_.push_back(mytr.tl); | ||
moduleHR_.push_back(mytr.h); | ||
moduleDzR_.push_back(mytr.dz); | ||
moduleAlphaR_.push_back(mytr.alpha); | ||
moduleCellR_.push_back(mytr.cellSize); | ||
} else { | ||
moduleLayS_.push_back(mytr.lay); | ||
moduleBlS_.push_back(mytr.bl); | ||
moduleTlS_.push_back(mytr.tl); | ||
moduleHS_.push_back(mytr.h); | ||
moduleDzS_.push_back(mytr.dz); | ||
moduleAlphaS_.push_back(mytr.alpha); | ||
moduleCellS_.push_back(mytr.cellSize); | ||
} | ||
} | ||
|
||
HGCalParameters::hgtrap HGCalParameters::getModule(unsigned int k, | ||
bool reco) const { | ||
HGCalParameters::hgtrap mytr; | ||
if (reco) { | ||
if (k < moduleLayR_.size()) { | ||
mytr.lay = moduleLayR_[k]; | ||
mytr.bl = moduleBlR_[k]; | ||
mytr.tl = moduleTlR_[k]; | ||
mytr.h = moduleHR_[k]; | ||
mytr.dz = moduleDzR_[k]; | ||
mytr.alpha = moduleAlphaR_[k]; | ||
mytr.cellSize = moduleCellR_[k]; | ||
} else { | ||
mytr.lay = -1; | ||
mytr.bl = mytr.tl = mytr.h = mytr.dz = mytr.alpha = mytr.cellSize = 0; | ||
} | ||
} else { | ||
if (k < moduleLayS_.size()) { | ||
mytr.lay = moduleLayS_[k]; | ||
mytr.bl = moduleBlS_[k]; | ||
mytr.tl = moduleTlS_[k]; | ||
mytr.h = moduleHS_[k]; | ||
mytr.dz = moduleDzS_[k]; | ||
mytr.alpha = moduleAlphaS_[k]; | ||
mytr.cellSize = moduleCellS_[k]; | ||
} else { | ||
mytr.lay = -1; | ||
mytr.bl = mytr.tl = mytr.h = mytr.dz = mytr.alpha = mytr.cellSize = 0; | ||
} | ||
} | ||
return mytr; | ||
} | ||
|
||
void HGCalParameters::fillTrForm(const HGCalParameters::hgtrform& mytr) { | ||
|
||
int zp = (mytr.zp == 1) ? 1 : 0; | ||
uint32_t indx = ((zp & kMaskZside) << kShiftZside); | ||
indx |= ((mytr.lay & kMaskLayer) << kShiftLayer); | ||
indx |= ((mytr.sec & kMaskSector) << kShiftSector); | ||
indx |= ((mytr.subsec & kMaskSubSec) << kShiftSubSec); | ||
// std::cout << "ZP " << zp << ":" << kMaskZside << ":" << kShiftZside << ((zp & kMaskZside) << kShiftZside) << " Lay " << mytr.lay << ":" << kMaskLayer << ":" << kShiftLayer << ":" << ((mytr.lay & kMaskLayer) << kShiftLayer) << " Sector " << mytr.sec << ":" << kMaskSector << ":" << kShiftSector << ":" << ((mytr.sec & kMaskSector) << kShiftSector) << " SubSec " << mytr.subsec << ":" << kMaskSubSec << ":" << kShiftSubSec << ":" << ((mytr.subsec & kMaskSubSec) << kShiftSubSec) << " Index " << std::hex << indx << std::dec << std::endl; | ||
|
||
trformIndex_.push_back(indx); | ||
trformTranX_.push_back(mytr.h3v.x()); | ||
trformTranY_.push_back(mytr.h3v.y()); | ||
trformTranZ_.push_back(mytr.h3v.z()); | ||
trformRotXX_.push_back(mytr.hr.xx()); | ||
trformRotYX_.push_back(mytr.hr.yx()); | ||
trformRotZX_.push_back(mytr.hr.zx()); | ||
trformRotXY_.push_back(mytr.hr.xy()); | ||
trformRotYY_.push_back(mytr.hr.yy()); | ||
trformRotZY_.push_back(mytr.hr.zy()); | ||
trformRotXZ_.push_back(mytr.hr.xz()); | ||
trformRotYZ_.push_back(mytr.hr.yz()); | ||
trformRotZZ_.push_back(mytr.hr.zz()); | ||
#ifdef DebugLog | ||
unsigned int k = trformIndex_.size() - 1; | ||
std::cout << "HGCalParameters[" << k << "] Index " << std::hex | ||
<< trformIndex_[k] << std::dec << " (" << mytr.zp << ", "<< mytr.lay | ||
<< ", " << mytr.sec << ", " << mytr.subsec << ") Translation (" | ||
<< trformTranX_[k] << ", " << trformTranY_[k] << ", " | ||
<< trformTranZ_[k] << ") Rotation (" << trformRotXX_[k] << ", " | ||
<< trformRotYX_[k] << ", " << trformRotZX_[k] << ", " | ||
<< trformRotXY_[k] << ", " << trformRotYY_[k] << ", " | ||
<< trformRotZY_[k] << ", " << trformRotXZ_[k] << ", " | ||
<< trformRotYZ_[k] << ", " << trformRotZZ_[k] << std::endl; | ||
#endif | ||
} | ||
|
||
HGCalParameters::hgtrform HGCalParameters::getTrForm(unsigned int k) const { | ||
|
||
HGCalParameters::hgtrform mytr; | ||
if (k < trformIndex_.size()) { | ||
int zp = ((trformIndex_[k] >> kShiftZside) & kMaskZside); | ||
mytr.zp = (zp == 1) ? 1 : -1; | ||
mytr.lay = ((trformIndex_[k] >> kShiftLayer) & kMaskLayer); | ||
mytr.sec = ((trformIndex_[k] >> kShiftSector) & kMaskSector); | ||
mytr.subsec= ((trformIndex_[k] >> kShiftSubSec) & kMaskSubSec); | ||
mytr.h3v = CLHEP::Hep3Vector(trformTranX_[k],trformTranY_[k],trformTranZ_[k]); | ||
const CLHEP::HepRep3x3 rotation(trformRotXX_[k],trformRotXY_[k],trformRotXZ_[k], | ||
trformRotYX_[k],trformRotYY_[k],trformRotYZ_[k], | ||
trformRotZX_[k],trformRotZY_[k],trformRotZZ_[k]); | ||
mytr.hr = CLHEP::HepRotation(rotation); | ||
} else { | ||
mytr.zp = mytr.lay = mytr.sec = mytr.subsec = 0; | ||
} | ||
#ifdef DebugLog | ||
std::cout << "HGCalParameters[" << k << "] Index " << std::hex | ||
<< trformIndex_[k] << std::dec << " (" << mytr.zp << ", "<< mytr.lay | ||
<< ", " << mytr.sec << ", " << mytr.subsec << ") Translation (" | ||
<< mytr.h3v.x() << ", " << mytr.h3v.y() << ", " << mytr.h3v.z() | ||
<< ") Rotation (" << mytr.hr.xx() << ", " << mytr.hr.yx() << ", " | ||
<< mytr.hr.zx() << ", " << mytr.hr.xy() << ", " << mytr.hr.yy() | ||
<< ", " << mytr.hr.zy() << ", " << mytr.hr.xz() << ", " | ||
<< mytr.hr.yz() << ", " << mytr.hr.zz() << std::endl; | ||
#endif | ||
return mytr; | ||
} | ||
|
||
void HGCalParameters::addTrForm(const CLHEP::Hep3Vector& h3v) { | ||
|
||
unsigned int k = trformTranX_.size(); | ||
if (k > 0) { | ||
trformTranX_[k-1] += h3v.x(); | ||
trformTranY_[k-1] += h3v.y(); | ||
trformTranZ_[k-1] += h3v.z(); | ||
} | ||
} | ||
|
||
void HGCalParameters::scaleTrForm(double scale) { | ||
unsigned int k = trformTranX_.size(); | ||
if (k > 0) { | ||
trformTranX_[k-1] *= scale; | ||
trformTranY_[k-1] *= scale; | ||
trformTranZ_[k-1] *= scale; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
CondFormats/GeometryObjects/src/T_EventSetup_HGCalParameters.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "CondFormats/GeometryObjects/interface/HGCalParameters.h" | ||
#include "FWCore/Utilities/interface/typelookup.h" | ||
|
||
TYPELOOKUP_DATA_REG(HGCalParameters); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bsunanda - please, add a space in the lines above. I think, using clhep here is not a good idea.