Public Member Functions | |
ApeSettingAlgorithm (const edm::ParameterSet &cfg) | |
Constructor. | |
virtual void | initialize (const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras, AlignmentParameterStore *store) |
Call at beginning of job. | |
virtual void | run (const edm::EventSetup &setup, const EventInfo &eventInfo) |
Run the algorithm. | |
virtual void | terminate (const edm::EventSetup &iSetup) |
Call at end of job. | |
virtual | ~ApeSettingAlgorithm () |
Destructor. | |
Private Attributes | |
bool | readApeFromAscii_ |
bool | readFullLocalMatrix_ |
bool | readLocalNotGlobal_ |
bool | saveApeToAscii_ |
bool | saveComposites_ |
bool | saveLocalNotGlobal_ |
bool | setComposites_ |
AlignableNavigator * | theAlignableNavigator |
edm::ParameterSet | theConfig |
AlignableTracker * | theTracker |
Definition at line 56 of file ApeSettingAlgorithm.cc.
ApeSettingAlgorithm::ApeSettingAlgorithm | ( | const edm::ParameterSet & | cfg | ) |
Constructor.
Definition at line 93 of file ApeSettingAlgorithm.cc.
References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), readApeFromAscii_, readFullLocalMatrix_, readLocalNotGlobal_, saveApeToAscii_, saveComposites_, saveLocalNotGlobal_, setComposites_, and theConfig.
: AlignmentAlgorithmBase(cfg), theConfig(cfg), theAlignableNavigator(0) { edm::LogInfo("Alignment") << "@SUB=ApeSettingAlgorithm" << "Start."; saveApeToAscii_ = theConfig.getUntrackedParameter<bool>("saveApeToASCII"); saveComposites_ = theConfig.getUntrackedParameter<bool>("saveComposites"); saveLocalNotGlobal_ = theConfig.getUntrackedParameter<bool>("saveLocalNotGlobal"); readApeFromAscii_ = theConfig.getParameter<bool>("readApeFromASCII"); readLocalNotGlobal_ = theConfig.getParameter<bool>("readLocalNotGlobal"); readFullLocalMatrix_ = theConfig.getParameter<bool>("readFullLocalMatrix"); setComposites_ = theConfig.getParameter<bool>("setComposites"); }
ApeSettingAlgorithm::~ApeSettingAlgorithm | ( | ) | [virtual] |
Destructor.
Definition at line 110 of file ApeSettingAlgorithm.cc.
References theAlignableNavigator.
{ delete theAlignableNavigator; }
void ApeSettingAlgorithm::initialize | ( | const edm::EventSetup & | setup, |
AlignableTracker * | tracker, | ||
AlignableMuon * | muon, | ||
AlignableExtras * | extras, | ||
AlignmentParameterStore * | store | ||
) | [virtual] |
Call at beginning of job.
Implements AlignmentAlgorithmBase.
Definition at line 117 of file ApeSettingAlgorithm.cc.
References AlignableNavigator::alignableFromDetId(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), readApeFromAscii_, readFullLocalMatrix_, readLocalNotGlobal_, setComposites_, theAlignableNavigator, theConfig, theTracker, patCandidatesForDimuonsSequences_cff::tracker, TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().
{ theAlignableNavigator = new AlignableNavigator(tracker, muon); theTracker = tracker; if (readApeFromAscii_) { std::ifstream apeReadFile(theConfig.getParameter<edm::FileInPath>("apeASCIIReadFile").fullPath().c_str()); //requires <fstream> if (!apeReadFile.good()) { edm::LogInfo("Alignment") << "@SUB=initialize" <<"Problem opening APE file: skipping" << theConfig.getParameter<edm::FileInPath>("apeASCIIReadFile").fullPath(); return; } std::set<int> apeList; //To avoid duplicates while (!apeReadFile.eof()) { int apeId=0; double x11,x21,x22,x31,x32,x33; if (!readLocalNotGlobal_ || readFullLocalMatrix_) { apeReadFile>>apeId>>x11>>x21>>x22>>x31>>x32>>x33>>std::ws;} else { apeReadFile>>apeId>>x11>>x22>>x33>>std::ws;} //idr What sanity checks do we need to put here? if (apeId != 0) //read appears valid? { if (apeList.find(apeId) == apeList.end()) //Not previously done { DetId id(apeId); AlignableDetOrUnitPtr alidet(theAlignableNavigator->alignableFromDetId(id)); //NULL if none if (alidet) { if ((alidet->components().size()<1) || setComposites_) //the problem with glued dets... { GlobalError globErr; if (readLocalNotGlobal_) { AlgebraicSymMatrix33 as; if (readFullLocalMatrix_) { as[0][0]=x11; as[1][0]=x21; as[1][1]=x22; as[2][0]=x31; as[2][1]=x32; as[2][2]=x33; } else { as[0][0]=x11*x11; as[1][1]=x22*x22; as[2][2]=x33*x33;} //local cov. align::RotationType rt=alidet->globalRotation(); AlgebraicMatrix33 am; am[0][0]=rt.xx(); am[0][1]=rt.xy(); am[0][2]=rt.xz(); am[1][0]=rt.yx(); am[1][1]=rt.yy(); am[1][2]=rt.yz(); am[2][0]=rt.zx(); am[2][1]=rt.zy(); am[2][2]=rt.zz(); globErr = GlobalError(ROOT::Math::SimilarityT(am,as)); } else { globErr = GlobalError(x11,x21,x22,x31,x32,x33); } alidet->setAlignmentPositionError(globErr, false); // do not propagate down! apeList.insert(apeId); //Flag it's been set } else { edm::LogInfo("Alignment") << "@SUB=initialize" << "Not Setting APE for Composite DetId "<<apeId; } } } else { edm::LogInfo("Alignment") << "@SUB=initialize" << "Skipping duplicate APE for DetId "<<apeId; } } } apeReadFile.close(); edm::LogInfo("Alignment") << "@SUB=initialize" << "Set "<<apeList.size()<<" APE values."; } }
void ApeSettingAlgorithm::run | ( | const edm::EventSetup & | setup, |
const EventInfo & | eventInfo | ||
) | [virtual] |
Run the algorithm.
Implements AlignmentAlgorithmBase.
Definition at line 223 of file ApeSettingAlgorithm.cc.
{
// nothing to do here?
}
void ApeSettingAlgorithm::terminate | ( | const edm::EventSetup & | iSetup | ) | [virtual] |
Call at end of job.
Implements AlignmentAlgorithmBase.
Definition at line 186 of file ApeSettingAlgorithm.cc.
References AlignableNavigator::alignableFromDetId(), AlignableTracker::alignmentErrors(), edm::ParameterSet::getUntrackedParameter(), i, j, gen::k, AlignmentErrors::m_alignError, saveApeToAscii_, saveComposites_, saveLocalNotGlobal_, AlCaHLTBitMon_QueryRunRegistry::string, theAlignableNavigator, theConfig, theTracker, TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().
{ if (saveApeToAscii_) { AlignmentErrors* aliErr=theTracker->alignmentErrors(); int theSize=aliErr->m_alignError.size(); std::ofstream apeSaveFile(theConfig.getUntrackedParameter<std::string>("apeASCIISaveFile").c_str()); //requires <fstream> for (int i=0; i < theSize; ++i) { int id= aliErr->m_alignError[i].rawId(); AlignableDetOrUnitPtr alidet(theAlignableNavigator->alignableFromDetId(DetId(id))); //NULL if none if (alidet && ((alidet->components().size()<1) || saveComposites_)) { apeSaveFile<<id; CLHEP::HepSymMatrix sm = aliErr->m_alignError[i].matrix(); if (saveLocalNotGlobal_) { align::RotationType rt=alidet->globalRotation(); AlgebraicMatrix am(3,3); am[0][0]=rt.xx(); am[0][1]=rt.xy(); am[0][2]=rt.xz(); am[1][0]=rt.yx(); am[1][1]=rt.yy(); am[1][2]=rt.yz(); am[2][0]=rt.zx(); am[2][1]=rt.zy(); am[2][2]=rt.zz(); sm=sm.similarity(am); //symmetric matrix } //transform to local for (int j=0; j < 3; ++j) for (int k=0; k <= j; ++k) apeSaveFile<<" "<<sm[j][k]; //always write full matrix apeSaveFile<<std::endl; } } delete aliErr; apeSaveFile.close(); } // clean up at end: // FIXME: should we delete here or in destructor? delete theAlignableNavigator; theAlignableNavigator = 0; }
bool ApeSettingAlgorithm::readApeFromAscii_ [private] |
Definition at line 80 of file ApeSettingAlgorithm.cc.
Referenced by ApeSettingAlgorithm(), and initialize().
bool ApeSettingAlgorithm::readFullLocalMatrix_ [private] |
Definition at line 80 of file ApeSettingAlgorithm.cc.
Referenced by ApeSettingAlgorithm(), and initialize().
bool ApeSettingAlgorithm::readLocalNotGlobal_ [private] |
Definition at line 81 of file ApeSettingAlgorithm.cc.
Referenced by ApeSettingAlgorithm(), and initialize().
bool ApeSettingAlgorithm::saveApeToAscii_ [private] |
Definition at line 80 of file ApeSettingAlgorithm.cc.
Referenced by ApeSettingAlgorithm(), and terminate().
bool ApeSettingAlgorithm::saveComposites_ [private] |
Definition at line 82 of file ApeSettingAlgorithm.cc.
Referenced by ApeSettingAlgorithm(), and terminate().
bool ApeSettingAlgorithm::saveLocalNotGlobal_ [private] |
Definition at line 81 of file ApeSettingAlgorithm.cc.
Referenced by ApeSettingAlgorithm(), and terminate().
bool ApeSettingAlgorithm::setComposites_ [private] |
Definition at line 82 of file ApeSettingAlgorithm.cc.
Referenced by ApeSettingAlgorithm(), and initialize().
Definition at line 78 of file ApeSettingAlgorithm.cc.
Referenced by initialize(), terminate(), and ~ApeSettingAlgorithm().
Definition at line 77 of file ApeSettingAlgorithm.cc.
Referenced by ApeSettingAlgorithm(), initialize(), and terminate().
AlignableTracker* ApeSettingAlgorithm::theTracker [private] |
Definition at line 79 of file ApeSettingAlgorithm.cc.
Referenced by initialize(), and terminate().