-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Infrastructure for using channel-dependent pulse shapes for HB/HE #45995
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
Closed
igv4321
wants to merge
3
commits into
cms-sw:master
from
igv4321:hbhe-channel-dependent-pulse-shapes
Closed
Changes from 2 commits
Commits
Show all changes
3 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
43 changes: 43 additions & 0 deletions
43
CalibCalorimetry/HcalAlgos/interface/HcalPulseShapeLookup.h
This file contains hidden or 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,43 @@ | ||
| #ifndef CalibCalorimetry_HcalAlgos_HcalPulseShapeLookup_h | ||
| #define CalibCalorimetry_HcalAlgos_HcalPulseShapeLookup_h | ||
|
|
||
| #include <vector> | ||
| #include <string> | ||
| #include <utility> | ||
|
|
||
| #include "CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h" | ||
| #include "Geometry/CaloTopology/interface/HcalTopology.h" | ||
|
|
||
| // This class must be sufficiently similar in its interface to HcalPulseShapes | ||
| // so that both of them can be used as parameters of the same templated code. | ||
| // However, this one is designed for use with a more efficient pulse shape | ||
| // lookup scheme and can accommodate more pulse shapes. | ||
| class HcalPulseShapeLookup { | ||
| public: | ||
| typedef HcalPulseShape Shape; | ||
| typedef std::pair<std::string, Shape> LabeledShape; | ||
|
|
||
| HcalPulseShapeLookup(const std::vector<LabeledShape>& shapes, | ||
| const std::vector<int>& channelToTypeLookup, | ||
| const HcalTopology* htopo); | ||
|
|
||
| inline unsigned nShapeTypes() const { return theShapes_.size(); } | ||
| const Shape& getShape(int shapeType) const; | ||
| const std::string& getLabel(int shapeType) const; | ||
|
|
||
| int getShapeType(unsigned linearizedChannelNumber) const; | ||
| const Shape& getChannelShape(unsigned linearizedChannelNumber) const; | ||
| const std::string& getChannelLabel(unsigned linearizedChannelNumber) const; | ||
|
|
||
| int getShapeType(const DetId& id) const; | ||
| const Shape& getChannelShape(const DetId& id) const; | ||
| const std::string& getChannelLabel(const DetId& id) const; | ||
|
|
||
| private: | ||
| std::vector<LabeledShape> theShapes_; | ||
| std::vector<int> shapeTypes_; | ||
| // We do not own the pointer | ||
| const HcalTopology* htopo_; | ||
| }; | ||
|
|
||
| #endif // CalibCalorimetry_HcalAlgos_HcalPulseShapeLookup_h |
This file contains hidden or 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 "FWCore/Utilities/interface/typelookup.h" | ||
| #include "CalibCalorimetry/HcalAlgos/interface/HcalPulseShapeLookup.h" | ||
|
|
||
| TYPELOOKUP_DATA_REG(HcalPulseShapeLookup); |
This file contains hidden or 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,38 @@ | ||
| #include <cassert> | ||
|
|
||
| #include "CalibCalorimetry/HcalAlgos/interface/HcalPulseShapeLookup.h" | ||
|
|
||
| HcalPulseShapeLookup::HcalPulseShapeLookup(const std::vector<LabeledShape>& shapes, | ||
| const std::vector<int>& channelToTypeLookup, | ||
| const HcalTopology* htopo) | ||
| : theShapes_(shapes), shapeTypes_(channelToTypeLookup), htopo_(htopo) { | ||
| assert(htopo_); | ||
| } | ||
|
|
||
| const HcalPulseShapeLookup::Shape& HcalPulseShapeLookup::getShape(const int shapeType) const { | ||
| return theShapes_.at(shapeType).second; | ||
| } | ||
|
|
||
| const std::string& HcalPulseShapeLookup::getLabel(const int shapeType) const { return theShapes_.at(shapeType).first; } | ||
|
|
||
| int HcalPulseShapeLookup::getShapeType(const unsigned linearizedChannelNumber) const { | ||
| return shapeTypes_.at(linearizedChannelNumber); | ||
| } | ||
|
|
||
| int HcalPulseShapeLookup::getShapeType(const DetId& id) const { return getShapeType(htopo_->detId2denseId(id)); } | ||
|
|
||
| const HcalPulseShapeLookup::Shape& HcalPulseShapeLookup::getChannelShape(const unsigned linearizedChannelNumber) const { | ||
| return theShapes_.at(shapeTypes_.at(linearizedChannelNumber)).second; | ||
| } | ||
|
|
||
| const std::string& HcalPulseShapeLookup::getChannelLabel(const unsigned linearizedChannelNumber) const { | ||
| return theShapes_.at(shapeTypes_.at(linearizedChannelNumber)).first; | ||
| } | ||
|
|
||
| const HcalPulseShapeLookup::Shape& HcalPulseShapeLookup::getChannelShape(const DetId& id) const { | ||
| return getChannelShape(htopo_->detId2denseId(id)); | ||
| } | ||
|
|
||
| const std::string& HcalPulseShapeLookup::getChannelLabel(const DetId& id) const { | ||
| return getChannelLabel(htopo_->detId2denseId(id)); | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
12 changes: 12 additions & 0 deletions
12
RecoLocalCalo/HcalRecAlgos/interface/HcalPulseShapeLookupRcd.h
This file contains hidden or 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,12 @@ | ||
| #ifndef RecoLocalCalo_HcalRecAlgos_HcalPulseShapeLookupRcd_h | ||
| #define RecoLocalCalo_HcalRecAlgos_HcalPulseShapeLookupRcd_h | ||
|
|
||
| #include "FWCore/Framework/interface/DependentRecordImplementation.h" | ||
| #include "Geometry/Records/interface/HcalRecNumberingRecord.h" | ||
| #include "Geometry/Records/interface/CaloGeometryRecord.h" | ||
|
|
||
| class HcalPulseShapeLookupRcd : public edm::eventsetup::DependentRecordImplementation< | ||
| HcalPulseShapeLookupRcd, | ||
| edm::mpl::Vector<HcalRecNumberingRecord, CaloGeometryRecord> > {}; | ||
|
|
||
| #endif // RecoLocalCalo_HcalRecAlgos_HcalPulseShapeLookupRcd_h |
This file contains hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.