CMS 3D CMS Logo

Public Member Functions | Private Attributes

TrackerScenarioBuilder Class Reference

Builds a scenario from configuration and applies it to the alignable tracker. More...

#include <TrackerScenarioBuilder.h>

Inheritance diagram for TrackerScenarioBuilder:
MisalignmentScenarioBuilder

List of all members.

Public Member Functions

void applyScenario (const edm::ParameterSet &scenario)
 Apply misalignment scenario to the tracker.
virtual bool isTopLevel_ (const std::string &parameterSetName) const
 does this still make sense?
virtual bool possiblyPartOf (const std::string &sub, const std::string &large) const
 True if hierarchy level 'sub' could be part of hierarchy level 'large'.
 TrackerScenarioBuilder (AlignableTracker *alignable)
 Constructor.
 ~TrackerScenarioBuilder ()
 Destructor.

Private Attributes

AlignableTrackertheAlignableTracker
unsigned int theFirstStripIndex
 index of first strip subdet in 'theSubdets' (pixel<strip)
std::vector< std::string > theSubdets
 following things are needed in possiblyPartOf:

Detailed Description

Builds a scenario from configuration and applies it to the alignable tracker.

Date:
2009/03/15 17:39:58
Revision:
1.3
Author:
flucke
Author:
Frederic Ronga - CERN-PH-CMG

Builds a scenario from configuration and applies it to the alignable tracker.

Definition at line 23 of file TrackerScenarioBuilder.h.


Constructor & Destructor Documentation

TrackerScenarioBuilder::TrackerScenarioBuilder ( AlignableTracker alignable) [explicit]

Constructor.

Definition at line 24 of file TrackerScenarioBuilder.cc.

References Exception, theAlignableTracker, theFirstStripIndex, and theSubdets.

  : theAlignableTracker(alignable)
{

  if (!theAlignableTracker) {
    throw cms::Exception("TypeMismatch") << "Pointer to AlignableTracker is empty.\n";
  }

  // Fill what is needed for possiblyPartOf(..):
  theSubdets.push_back("TPB"); // Take care, order matters: 1st pixel, 2nd strip.
  theSubdets.push_back("TPE");
  theFirstStripIndex = theSubdets.size();
  theSubdets.push_back("TIB");
  theSubdets.push_back("TID");
  theSubdets.push_back("TOB");
  theSubdets.push_back("TEC");
}
TrackerScenarioBuilder::~TrackerScenarioBuilder ( ) [inline]

Destructor.

Definition at line 32 of file TrackerScenarioBuilder.h.

{};

Member Function Documentation

void TrackerScenarioBuilder::applyScenario ( const edm::ParameterSet scenario) [virtual]

Apply misalignment scenario to the tracker.

Implements MisalignmentScenarioBuilder.

Definition at line 44 of file TrackerScenarioBuilder.cc.

References MisalignmentScenarioBuilder::decodeMovements_(), Exception, edm::ParameterSet::getParameter(), MisalignmentScenarioBuilder::hasParameter_(), AlignableModifier::setSeed(), AlignableTracker::subStructures(), theAlignableTracker, MisalignmentScenarioBuilder::theModifier, and MisalignmentScenarioBuilder::theModifierCounter.

Referenced by SurveyDataConverter::applyCoarseSurveyInfo(), AlignmentProducer::beginOfJob(), and MisalignedTrackerESProducer::produce().

{

  // Apply the scenario to all main components of tracker.
  theModifierCounter = 0;

  // Seed is set at top-level, and is mandatory
  if ( this->hasParameter_( "seed", scenario) )
        theModifier.setSeed( static_cast<long>(scenario.getParameter<int>("seed")) );
  else
        throw cms::Exception("BadConfig") << "No generator seed defined!";  

  // misalignment applied recursively ('subStructures("Tracker")' contains only tracker itself)
  this->decodeMovements_(scenario, theAlignableTracker->subStructures("Tracker"));

  edm::LogInfo("TrackerScenarioBuilder") 
        << "Applied modifications to " << theModifierCounter << " alignables";

}
bool TrackerScenarioBuilder::isTopLevel_ ( const std::string &  parameterSetName) const [virtual]

does this still make sense?

Reimplemented from MisalignmentScenarioBuilder.

Definition at line 66 of file TrackerScenarioBuilder.cc.

References dbtoconf::root, and MisalignmentScenarioBuilder::rootName_().

{
  // Get root name (strip last character [s])
  std::string root = this->rootName_(parameterSetName);

  if (root == "Tracker") return true;

  return false;
}
bool TrackerScenarioBuilder::possiblyPartOf ( const std::string &  sub,
const std::string &  large 
) const [virtual]

True if hierarchy level 'sub' could be part of hierarchy level 'large'.

Reimplemented from MisalignmentScenarioBuilder.

Definition at line 77 of file TrackerScenarioBuilder.cc.

References theFirstStripIndex, and theSubdets.

{
  // string::find(s) != nPos => 's' is contained in string!
  const std::string::size_type nPos = std::string::npos; 

  // First check whether anything from pixel in strip.
  if (largeStr.find("Strip") != nPos) {
    if (subStruct.find("Pixel") != nPos) return false;
    for (unsigned int iPix = 0; iPix < theFirstStripIndex; ++iPix) {
      if (subStruct.find(theSubdets[iPix]) != nPos) return false;
    }
  }

  // Now check whether anything from strip in pixel.
  if (largeStr.find("Pixel") != nPos) {
    if (subStruct.find("Strip") != nPos) return false;
    for (unsigned int iStrip = theFirstStripIndex; iStrip < theSubdets.size(); ++iStrip) {
      if (subStruct.find(theSubdets[iStrip]) != nPos) return false;
    }
  }

  // Finally check for any different detector parts, e.g. TIDEndcap/TIBString gives false.
  for (unsigned int iSub = 0; iSub < theSubdets.size(); ++iSub) {
    for (unsigned int iLarge = 0; iLarge < theSubdets.size(); ++iLarge) {
      if (iLarge == iSub) continue;
      if (largeStr.find(theSubdets[iLarge]) != nPos && subStruct.find(theSubdets[iSub]) != nPos) {
        return false;
      }
    }
  }

  // It seems like a possible combination:
  return true; 
}

Member Data Documentation

Pointer to mother alignable object

Definition at line 43 of file TrackerScenarioBuilder.h.

Referenced by applyScenario(), and TrackerScenarioBuilder().

index of first strip subdet in 'theSubdets' (pixel<strip)

Definition at line 46 of file TrackerScenarioBuilder.h.

Referenced by possiblyPartOf(), and TrackerScenarioBuilder().

std::vector<std::string> TrackerScenarioBuilder::theSubdets [private]

following things are needed in possiblyPartOf:

sub-detector acronyms appearing in StructureType.h (TPE)

Definition at line 45 of file TrackerScenarioBuilder.h.

Referenced by possiblyPartOf(), and TrackerScenarioBuilder().