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
Alignment geometry upgrade 81X #13976
Merged
cmsbuild
merged 11 commits into
cms-sw:CMSSW_8_1_X
from
vbotta:AlignmentGeometryUpgrade_81X
Apr 26, 2016
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5e3f1d4
added structure-names for upgraded geometry
DirtyDan88 0fbc8d2
implemented AlignmentLevels, which defines the granularity of Composi…
DirtyDan88 bef90ca
added structure-names for TIB and TEC in PhaseII (marked as invalid)
DirtyDan88 1fab501
removed some hardcoded geometry assumptions
DirtyDan88 21f4a54
added top-level structures to TrackerCounters
DirtyDan88 d01e6b2
for simplicity: renamed AlignSetup -> AlignableMap and removed templa…
DirtyDan88 cf413a3
renamed indexing-system (class Counters -> AlignableIndexer)
DirtyDan88 e609caa
new, geometry-independent AlignableComposite-builder; builds tracker-…
DirtyDan88 8af7940
implemented test analyzer for geometry-analysis and alignable-creation
DirtyDan88 4159bfc
Fix compilation error with new Phase1 geometry code in the Alignment …
vbotta 06e12d3
Fixed missing hierarchy level in new/Phase1 Alignment framework.
gregor-mittag File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
73 changes: 73 additions & 0 deletions
73
Alignment/CommonAlignment/interface/AlignableCompositeBuilder.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,73 @@ | ||
#ifndef ALIGNMENT_COMMONALIGNMENT_INTERFACE_ALIGNABLECOMPOSITEBUILDER_H_ | ||
#define ALIGNMENT_COMMONALIGNMENT_INTERFACE_ALIGNABLECOMPOSITEBUILDER_H_ | ||
|
||
// Original Author: Max Stark | ||
// Created: Wed, 10 Feb 2016 14:02:51 CET | ||
|
||
// alignment | ||
#include "Alignment/CommonAlignment/interface/AlignableMap.h" | ||
#include "Alignment/CommonAlignment/interface/AlignableComposite.h" | ||
#include "Alignment/CommonAlignment/interface/AlignableIndexer.h" | ||
#include "Alignment/CommonAlignment/interface/AlignmentLevel.h" | ||
|
||
|
||
|
||
class AlignableCompositeBuilder { | ||
|
||
//========================== PUBLIC METHODS ================================= | ||
public: //=================================================================== | ||
|
||
AlignableCompositeBuilder(const TrackerTopology*, AlignableIndexer&); | ||
virtual ~AlignableCompositeBuilder() {}; | ||
|
||
/// Add all desired AlignmentLevels for a sub-detector to the builder before | ||
/// calling buildAll(), the order matters! | ||
/// Example for PixelBarrel-RunI geometry: | ||
/// -> PXBModule, PXBLadder, TPBLayer, TPBHalfBarrel, TPBBarrel | ||
void addAlignmentLevel(AlignmentLevel* level); | ||
|
||
/// Resets the alignment-levels. | ||
void clearAlignmentLevels(); | ||
|
||
/// Builds all composite Alignables according to the levels added before via | ||
/// addAlignmentLevel(). The Alignables were built from bottom- to the top- | ||
/// hierarchy, e.g. for PixelBarrel-RunI geometry: | ||
/// - PXBLadder (with PXBModule as children) | ||
/// - TPBLayer (with PXBLadder as children) | ||
/// - TPBHalfBarrel (with TPBLayer as children) | ||
/// - TPBBarrel (with TPBHalfBarrel as children) | ||
/// Returns the number of composite Alignables which were built. | ||
unsigned int buildAll(AlignableMap&); | ||
|
||
//========================= PRIVATE METHODS ================================= | ||
private: //================================================================== | ||
|
||
/// Builds the components for a given level in the hierarchy. | ||
unsigned int buildLevel(unsigned int parentLevel, AlignableMap&, | ||
std::ostringstream&); | ||
|
||
/// Calculates the theoretical max. number of components for a given level | ||
/// in the hierarchy. | ||
unsigned int maxNumComponents(unsigned int startLevel) const; | ||
|
||
/// Calculates the index of an Alignable within the hierarchy; unique for | ||
/// each component of a given structure-type. | ||
unsigned int getIndexOfStructure(align::ID, unsigned int level) const; | ||
|
||
//========================== PRIVATE DATA =================================== | ||
//=========================================================================== | ||
|
||
// TODO: The AlignableCompositeBuilder is not 'common' as the package | ||
// suggests, because it uses the TrackerTopology. If this class shall | ||
// ever be used to build other kinds of alignables than tracker- | ||
// alignables one has to add/implement something more general than | ||
// the TrackerTopology | ||
const TrackerTopology* trackerTopology; | ||
|
||
AlignableIndexer alignableIndexer; | ||
|
||
std::vector<AlignmentLevel*> alignmentLevels; | ||
|
||
}; | ||
|
||
#endif /* ALIGNMENT_COMMONALIGNMENT_INTERFACE_ALIGNABLECOMPOSITEBUILDER_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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#ifndef Alignment_CommonAlignment_AlignSetup_h | ||
#define Alignment_CommonAlignment_AlignSetup_h | ||
|
||
/** \class AlignableMap | ||
* | ||
* A helper class to hold Alignables used by modules in alignment. | ||
* | ||
* Alignables are stored in a map<string, Alignables>. Users get Alignables | ||
* by passing the corresponding name through the method get(), if the name | ||
* doesn't exist a new entry will be created. The find()-method also delivers | ||
* Alignables per name, but it does not created new entries and will throw an | ||
* error in case of an unknown name. | ||
* | ||
* $Date: 2008/02/12 18:06:49 $ | ||
* $Revision: 1.3 $ | ||
* \author Chung Khim Lae | ||
* | ||
* Last Update: Max Stark | ||
* Date: Mon, 22 Feb 2016 19:58:45 CET | ||
*/ | ||
|
||
#include <map> | ||
#include <sstream> | ||
|
||
#include "Alignment/CommonAlignment/interface/Alignable.h" | ||
|
||
|
||
|
||
class AlignableMap | ||
{ | ||
typedef typename std::map<std::string, Alignables> Container; | ||
|
||
public: | ||
|
||
AlignableMap() {}; | ||
virtual ~AlignableMap() {}; | ||
|
||
/// Get an object from map using its name. | ||
/// A new object is default-constructed if the name does not exist. | ||
Alignables& get( const std::string& name = "" ); | ||
|
||
/// Find and return an object from map using its name. | ||
/// Throw an exception if the name does not exist. | ||
Alignables& find( const std::string& name = "" ); | ||
|
||
/// Print the name of all stored data | ||
void dump( void ) const; | ||
|
||
private: | ||
Container theStore; | ||
}; | ||
|
||
#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
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.
could this become an unique_ptr? (otherwise you need to clean up the memory in this class, as it seems to get ownership of the pointers)
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.
@davidlange6, if I understand the code correctly, the memory is cleaned up here:
https://github.com/vbotta/cmssw/blob/AlignmentGeometryUpgrade_81X/Alignment/TrackerAlignment/src/TrackerAlignmentLevelBuilder.cc#L32-L42
However, using smart pointers should, of course, be preferred. But it should be a shared_ptr in this case, if I am not mistaken.
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.
I think, my comment was wrong because the objects deleted in the code referenced by me are vectors of pointers to std::vector<AlignmentLevel*>. Need to check further, how to fix that...
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.
@davidlange6, my initial comment was right, i.e. the objects get deleted in the destructor of 'TrackerAlignmentLevelBuilder'
Since, @vbotta is currently ill, we would get some delay until she pushed the changes to use smart pointers here. That is, in case of no exception we have no leak, so should we proceed now and update the code in a separate PR?