#include <TrackerGeometryCompare.h>
Module that reads survey info from DB and prints them out.
Usage: module comparator = TrackerGeometryCompare {
lots of stuff
} path p = { comparator }
Definition at line 35 of file TrackerGeometryCompare.h.
typedef std::vector<Alignable*> TrackerGeometryCompare::Alignables |
Definition at line 41 of file TrackerGeometryCompare.h.
Definition at line 39 of file TrackerGeometryCompare.h.
Definition at line 40 of file TrackerGeometryCompare.h.
TrackerGeometryCompare::TrackerGeometryCompare | ( | const edm::ParameterSet & | cfg | ) |
Do nothing. Required by framework.
Definition at line 52 of file TrackerGeometryCompare.cc.
References _alignTree, _alphaVal, _betaVal, _dalphaVal, _daVal, _dbetaVal, _dbVal, _detDim, _detIdFlag, _detIdFlagFile, _detIdFlagVector, _dgammaVal, _dgVal, _dphiVal, _drVal, _duVal, _dvVal, _dwVal, _dxVal, _dyVal, _dzVal, _etaVal, _filename, _gammaVal, _id, _identifiers, _inputFilename1, _inputFilename2, _inputTreename, _level, _mid, _mlevel, _phiVal, _rVal, _setCommonTrackerSystem, _sublevel, _surLength, _surRot, _surWidth, _theFile, _useDetId, _weightBy, _weightById, _weightByIdFile, _weightByIdVector, _writeToDB, _xVal, _yVal, _zVal, edm::ParameterSet::getUntrackedParameter(), prof2calltree::l, and theLevels.
{ //input is ROOT _inputFilename1 = cfg.getUntrackedParameter< std::string > ("inputROOTFile1"); _inputFilename2 = cfg.getUntrackedParameter< std::string > ("inputROOTFile2"); _inputTreename = cfg.getUntrackedParameter< std::string > ("treeName"); //output file _filename = cfg.getUntrackedParameter< std::string > ("outputFile"); _writeToDB = cfg.getUntrackedParameter< bool > ("writeToDB" ); const std::vector<std::string>& levels = cfg.getUntrackedParameter< std::vector<std::string> > ("levels"); _weightBy = cfg.getUntrackedParameter< std::string > ("weightBy"); _setCommonTrackerSystem = cfg.getUntrackedParameter< std::string > ("setCommonTrackerSystem"); _detIdFlag = cfg.getUntrackedParameter< bool > ("detIdFlag"); _detIdFlagFile = cfg.getUntrackedParameter< std::string > ("detIdFlagFile"); _weightById = cfg.getUntrackedParameter< bool > ("weightById"); _weightByIdFile = cfg.getUntrackedParameter< std::string > ("weightByIdFile"); //setting the levels being used in the geometry comparator AlignableObjectId dummy; edm::LogInfo("TrackerGeometryCompare") << "levels: " << levels.size(); for (unsigned int l = 0; l < levels.size(); ++l){ theLevels.push_back( dummy.nameToType(levels[l])); edm::LogInfo("TrackerGeometryCompare") << "level: " << levels[l]; } // if want to use, make id cut list if (_detIdFlag){ ifstream fin; fin.open( _detIdFlagFile.c_str() ); while (!fin.eof() && fin.good() ){ uint32_t id; fin >> id; _detIdFlagVector.push_back(id); } fin.close(); } // turn weightByIdFile into weightByIdVector if (_weightById){ std::ifstream inFile; inFile.open( _weightByIdFile.c_str() ); int ctr = 0; while ( !inFile.eof() ){ ctr++; unsigned int listId; inFile >> listId; inFile.ignore(256, '\n'); _weightByIdVector.push_back( listId ); } inFile.close(); } //root configuration _theFile = new TFile(_filename.c_str(),"RECREATE"); _alignTree = new TTree("alignTree","alignTree");//,"id:level:mid:mlevel:sublevel:x:y:z:r:phi:a:b:c:dx:dy:dz:dr:dphi:da:db:dc"); _alignTree->Branch("id", &_id, "id/I"); _alignTree->Branch("level", &_level, "level/I"); _alignTree->Branch("mid", &_mid, "mid/I"); _alignTree->Branch("mlevel", &_mlevel, "mlevel/I"); _alignTree->Branch("sublevel", &_sublevel, "sublevel/I"); _alignTree->Branch("x", &_xVal, "x/F"); _alignTree->Branch("y", &_yVal, "y/F"); _alignTree->Branch("z", &_zVal, "z/F"); _alignTree->Branch("r", &_rVal, "r/F"); _alignTree->Branch("phi", &_phiVal, "phi/F"); _alignTree->Branch("eta", &_etaVal, "eta/F"); _alignTree->Branch("alpha", &_alphaVal, "alpha/F"); _alignTree->Branch("beta", &_betaVal, "beta/F"); _alignTree->Branch("gamma", &_gammaVal, "gamma/F"); _alignTree->Branch("dx", &_dxVal, "dx/F"); _alignTree->Branch("dy", &_dyVal, "dy/F"); _alignTree->Branch("dz", &_dzVal, "dz/F"); _alignTree->Branch("dr", &_drVal, "dr/F"); _alignTree->Branch("dphi", &_dphiVal, "dphi/F"); _alignTree->Branch("dalpha", &_dalphaVal, "dalpha/F"); _alignTree->Branch("dbeta", &_dbetaVal, "dbeta/F"); _alignTree->Branch("dgamma", &_dgammaVal, "dgamma/F"); _alignTree->Branch("du", &_duVal, "du/F"); _alignTree->Branch("dv", &_dvVal, "dv/F"); _alignTree->Branch("dw", &_dwVal, "dw/F"); _alignTree->Branch("da", &_daVal, "da/F"); _alignTree->Branch("db", &_dbVal, "db/F"); _alignTree->Branch("dg", &_dgVal, "dg/F"); _alignTree->Branch("useDetId", &_useDetId, "useDetId/I"); _alignTree->Branch("detDim", &_detDim, "detDim/I"); _alignTree->Branch("surW", &_surWidth, "surW/F"); _alignTree->Branch("surL", &_surLength, "surL/F"); _alignTree->Branch("surRot", &_surRot, "surRot[9]/D"); _alignTree->Branch("identifiers", &_identifiers, "identifiers[6]/I"); }
void TrackerGeometryCompare::addSurveyInfo | ( | Alignable * | ali | ) | [private] |
Definition at line 617 of file TrackerGeometryCompare.cc.
References Alignable::alignableObjectId(), Alignable::components(), error, Exception, Alignable::geomDetId(), i, AlignableSurface::length(), Alignments::m_align, SurveyErrors::m_surveyErrors, SurveyError::matrix(), pos, DetId::rawId(), SurveyError::rawId(), AlignableSurface::setLength(), Alignable::setSurvey(), AlignableSurface::setWidth(), SurveyError::structureType(), Alignable::surface(), theSurveyErrors, theSurveyIndex, theSurveyValues, and AlignableSurface::width().
{ const std::vector<Alignable*>& comp = ali->components(); unsigned int nComp = comp.size(); for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo(comp[i]); const SurveyError& error = theSurveyErrors->m_surveyErrors[theSurveyIndex]; if ( ali->geomDetId().rawId() != error.rawId() || ali->alignableObjectId() != error.structureType() ) { throw cms::Exception("DatabaseError") << "Error reading survey info from DB. Mismatched id!"; } const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[theSurveyIndex].translation(); const CLHEP::HepRotation& rot = theSurveyValues->m_align[theSurveyIndex].rotation(); AlignableSurface surf( align::PositionType( pos.x(), pos.y(), pos.z() ), align::RotationType( rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz() ) ); surf.setWidth( ali->surface().width() ); surf.setLength( ali->surface().length() ); ali->setSurvey( new SurveyDet( surf, error.matrix() ) ); ++theSurveyIndex; }
void TrackerGeometryCompare::analyze | ( | const edm::Event & | , |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 159 of file TrackerGeometryCompare.cc.
References _alignTree, _setCommonTrackerSystem, _theFile, _writeToDB, AlignableTracker::alignmentErrors(), AlignableTracker::alignments(), compareGeometries(), createROOTGeometry(), currentTracker, firstEvent_, edm::Service< T >::isAvailable(), referenceTracker, and setCommonTrackerSystem().
{ if (firstEvent_) { //upload the ROOT geometries createROOTGeometry(iSetup); //set common tracker system first // if setting the tracker common system if (_setCommonTrackerSystem != "NONE"){ setCommonTrackerSystem(); } //compare the goemetries compareGeometries(referenceTracker,currentTracker); //write out ntuple //might be better to do within output module _theFile->cd(); _alignTree->Write(); _theFile->Close(); if (_writeToDB){ Alignments* myAlignments = currentTracker->alignments(); AlignmentErrors* myAlignmentErrors = currentTracker->alignmentErrors(); // 2. Store alignment[Error]s to DB edm::Service<cond::service::PoolDBOutputService> poolDbService; // Call service if( !poolDbService.isAvailable() ) // Die if not available throw cms::Exception("NotAvailable") << "PoolDBOutputService not available"; poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), "TrackerAlignmentRcd"); poolDbService->writeOne<AlignmentErrors>(&(*myAlignmentErrors), poolDbService->beginOfTime(), "TrackerAlignmentErrorRcd"); } firstEvent_ = false; } }
void TrackerGeometryCompare::beginJob | ( | void | ) | [virtual] |
Read from DB and print survey info.
Reimplemented from edm::EDAnalyzer.
Definition at line 155 of file TrackerGeometryCompare.cc.
References firstEvent_.
{ firstEvent_ = true; }
Definition at line 310 of file TrackerGeometryCompare.cc.
References _weightBy, _weightById, _weightByIdVector, Alignable::alignableObjectId(), CastorDataFrameFilter_impl::check(), Alignable::components(), cond::rpcobgas::detid, diffTreeTool::diff, align::diffAlignables(), Exception, fillTree(), Alignable::geomDetId(), i, Alignable::id(), PV3DBase< T, PVType, FrameType >::mag(), align::moveAlignable(), DetId::rawId(), and theLevels.
Referenced by analyze().
{ const std::vector<Alignable*>& refComp = refAli->components(); const std::vector<Alignable*>& curComp = curAli->components(); unsigned int nComp = refComp.size(); //only perform for designate levels bool useLevel = false; for (unsigned int i = 0; i < theLevels.size(); ++i){ if (refAli->alignableObjectId() == theLevels[i]) useLevel = true; } //another added level for difference between det and detunit //if ((refAli->alignableObjectId()==2)&&(nComp == 1)) useLevel = false; //coordinate matching, etc etc if (useLevel){ //std::cout << "ali identifiers: " << refAli->id() << ", " << refAli->alignableObjectId() << std::endl; //std::cout << "diff pos" << (refAli->globalPosition() - curAli->globalPosition()) << std::endl; //std::cout <<"z"; CLHEP::Hep3Vector Rtotal, Wtotal, lRtotal, lWtotal; Rtotal.set(0.,0.,0.); Wtotal.set(0.,0.,0.); lRtotal.set(0.,0.,0.); lWtotal.set(0.,0.,0.); for (int i = 0; i < 100; i++){ AlgebraicVector diff = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector); CLHEP::Hep3Vector dR(diff[0],diff[1],diff[2]); Rtotal+=dR; CLHEP::Hep3Vector dW(diff[3],diff[4],diff[5]); CLHEP::HepRotation rot(Wtotal.unit(),Wtotal.mag()); CLHEP::HepRotation drot(dW.unit(),dW.mag()); rot*=drot; Wtotal.set(rot.axis().x()*rot.delta(), rot.axis().y()*rot.delta(), rot.axis().z()*rot.delta()); // local coordinates lRtotal.set(diff[6],diff[7],diff[8]); lWtotal.set(diff[9],diff[10],diff[11]); //std::cout << "a"; //if (refAli->alignableObjectId() == 1) std::cout << "DIFF: " << diff << std::endl; align::moveAlignable(curAli, diff); float tolerance = 1e-7; AlgebraicVector check = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector); align::GlobalVector checkR(check[0],check[1],check[2]); align::GlobalVector checkW(check[3],check[4],check[5]); DetId detid(refAli->id()); if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){ edm::LogInfo("TrackerGeometryCompare") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId() << ", rawId: " << refAli->geomDetId().rawId() << ", subdetId: "<< detid.subdetId() << "): " << diff; throw cms::Exception("Tolerance in TrackerGeometryCompare exceeded"); } else{ break; } } AlgebraicVector TRtot(12); // global TRtot(1) = Rtotal.x(); TRtot(2) = Rtotal.y(); TRtot(3) = Rtotal.z(); TRtot(4) = Wtotal.x(); TRtot(5) = Wtotal.y(); TRtot(6) = Wtotal.z(); // local TRtot(7) = lRtotal.x(); TRtot(8) = lRtotal.y(); TRtot(9) = lRtotal.z(); TRtot(10) = lWtotal.x(); TRtot(11) = lWtotal.y(); TRtot(12) = lWtotal.z(); fillTree(refAli, TRtot); } //another added level for difference between det and detunit for (unsigned int i = 0; i < nComp; ++i) compareGeometries(refComp[i],curComp[i]); }
void TrackerGeometryCompare::createROOTGeometry | ( | const edm::EventSetup & | iSetup | ) | [private] |
Definition at line 202 of file TrackerGeometryCompare.cc.
References _inputFilename1, _inputFilename2, _inputRootFile1, _inputRootFile2, _inputTree1, _inputTree2, _inputTreename, GeometryAligner::applyAlignments(), TrackerGeomBuilderFromGeometricDet::build(), currentTracker, align::DetectorGlobalPosition(), edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), i, Alignments::m_align, AlignmentErrors::m_alignError, referenceTracker, python::multivaluedict::sort(), and DetId::Tracker.
Referenced by analyze().
{ int inputRawId1, inputRawId2; double inputX1, inputY1, inputZ1, inputX2, inputY2, inputZ2; double inputAlpha1, inputBeta1, inputGamma1, inputAlpha2, inputBeta2, inputGamma2; //declare alignments Alignments* alignments1 = new Alignments(); AlignmentErrors* alignmentErrors1 = new AlignmentErrors(); if (_inputFilename1 != "IDEAL"){ _inputRootFile1 = new TFile(_inputFilename1.c_str()); TTree* _inputTree1 = (TTree*) _inputRootFile1->Get(_inputTreename.c_str()); _inputTree1->SetBranchAddress("rawid", &inputRawId1); _inputTree1->SetBranchAddress("x", &inputX1); _inputTree1->SetBranchAddress("y", &inputY1); _inputTree1->SetBranchAddress("z", &inputZ1); _inputTree1->SetBranchAddress("alpha", &inputAlpha1); _inputTree1->SetBranchAddress("beta", &inputBeta1); _inputTree1->SetBranchAddress("gamma", &inputGamma1); int nEntries1 = _inputTree1->GetEntries(); //fill alignments for (int i = 0; i < nEntries1; ++i){ _inputTree1->GetEntry(i); CLHEP::Hep3Vector translation1(inputX1, inputY1, inputZ1); CLHEP::HepEulerAngles eulerangles1(inputAlpha1,inputBeta1,inputGamma1); uint32_t detid1 = inputRawId1; AlignTransform transform1(translation1, eulerangles1, detid1); alignments1->m_align.push_back(transform1); //dummy errors CLHEP::HepSymMatrix clhepSymMatrix(3,0); AlignTransformError transformError(clhepSymMatrix, detid1); alignmentErrors1->m_alignError.push_back(transformError); } // to get the right order std::sort( alignments1->m_align.begin(), alignments1->m_align.end(), lessAlignmentDetId<AlignTransform>() ); std::sort( alignmentErrors1->m_alignError.begin(), alignmentErrors1->m_alignError.end(), lessAlignmentDetId<AlignTransformError>() ); } //------------------ Alignments* alignments2 = new Alignments(); AlignmentErrors* alignmentErrors2 = new AlignmentErrors(); if (_inputFilename2 != "IDEAL"){ _inputRootFile2 = new TFile(_inputFilename2.c_str()); TTree* _inputTree2 = (TTree*) _inputRootFile2->Get(_inputTreename.c_str()); _inputTree2->SetBranchAddress("rawid", &inputRawId2); _inputTree2->SetBranchAddress("x", &inputX2); _inputTree2->SetBranchAddress("y", &inputY2); _inputTree2->SetBranchAddress("z", &inputZ2); _inputTree2->SetBranchAddress("alpha", &inputAlpha2); _inputTree2->SetBranchAddress("beta", &inputBeta2); _inputTree2->SetBranchAddress("gamma", &inputGamma2); int nEntries2 = _inputTree2->GetEntries(); //fill alignments for (int i = 0; i < nEntries2; ++i){ _inputTree2->GetEntry(i); CLHEP::Hep3Vector translation2(inputX2, inputY2, inputZ2); CLHEP::HepEulerAngles eulerangles2(inputAlpha2,inputBeta2,inputGamma2); uint32_t detid2 = inputRawId2; AlignTransform transform2(translation2, eulerangles2, detid2); alignments2->m_align.push_back(transform2); //dummy errors CLHEP::HepSymMatrix clhepSymMatrix(3,0); AlignTransformError transformError(clhepSymMatrix, detid2); alignmentErrors2->m_alignError.push_back(transformError); } //to get the right order std::sort( alignments2->m_align.begin(), alignments2->m_align.end(), lessAlignmentDetId<AlignTransform>() ); std::sort( alignmentErrors2->m_alignError.begin(), alignmentErrors2->m_alignError.end(), lessAlignmentDetId<AlignTransformError>() ); } //accessing the initial geometry edm::ESTransientHandle<DDCompactView> cpv; iSetup.get<IdealGeometryRecord>().get(cpv); edm::ESHandle<GeometricDet> theGeometricDet; iSetup.get<IdealGeometryRecord>().get(theGeometricDet); TrackerGeomBuilderFromGeometricDet trackerBuilder; edm::ESHandle<Alignments> globalPositionRcd; iSetup.get<TrackerDigiGeometryRecord>().getRecord<GlobalPositionRcd>().get(globalPositionRcd); //reference tracker TrackerGeometry* theRefTracker = trackerBuilder.build(&*theGeometricDet); if (_inputFilename1 != "IDEAL"){ GeometryAligner aligner1; aligner1.applyAlignments<TrackerGeometry>( &(*theRefTracker), &(*alignments1), &(*alignmentErrors1), align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker))); } referenceTracker = new AlignableTracker(&(*theRefTracker)); //currernt tracker TrackerGeometry* theCurTracker = trackerBuilder.build(&*theGeometricDet); if (_inputFilename2 != "IDEAL"){ GeometryAligner aligner2; aligner2.applyAlignments<TrackerGeometry>( &(*theCurTracker), &(*alignments2), &(*alignmentErrors2), align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker))); } currentTracker = new AlignableTracker(&(*theCurTracker)); }
void TrackerGeometryCompare::diffCommonTrackerSystem | ( | Alignable * | refAli, |
Alignable * | curAli | ||
) | [private] |
Definition at line 418 of file TrackerGeometryCompare.cc.
References _commonTrackerLevel, _TrackerCommonCM, _TrackerCommonR, _TrackerCommonT, _weightBy, _weightById, _weightByIdVector, Alignable::alignableObjectId(), Alignable::components(), diffTreeTool::diff, align::diffAlignables(), Alignable::globalPosition(), and i.
Referenced by setCommonTrackerSystem().
{ const std::vector<Alignable*>& refComp = refAli->components(); const std::vector<Alignable*>& curComp = curAli->components(); unsigned int nComp = refComp.size(); //only perform for designate levels bool useLevel = false; if (refAli->alignableObjectId() == _commonTrackerLevel) useLevel = true; //useLevel = false; if (useLevel){ CLHEP::Hep3Vector Rtotal, Wtotal; Rtotal.set(0.,0.,0.); Wtotal.set(0.,0.,0.); AlgebraicVector diff = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector); CLHEP::Hep3Vector dR(diff[0],diff[1],diff[2]); Rtotal+=dR; CLHEP::Hep3Vector dW(diff[3],diff[4],diff[5]); CLHEP::HepRotation rot(Wtotal.unit(),Wtotal.mag()); CLHEP::HepRotation drot(dW.unit(),dW.mag()); rot*=drot; Wtotal.set(rot.axis().x()*rot.delta(), rot.axis().y()*rot.delta(), rot.axis().z()*rot.delta()); /* //std::cout << "a"; //if (refAli->alignableObjectId() == 1) std::cout << "DIFF: " << diff << std::endl; align::moveAlignable(curAli, diff); float tolerance = 1e-7; AlgebraicVector check = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector); align::GlobalVector checkR(check[0],check[1],check[2]); align::GlobalVector checkW(check[3],check[4],check[5]); DetId detid(refAli->id()); if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){ edm::LogInfo("TrackerGeometryCompare") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId() << ", rawId: " << refAli->geomDetId().rawId() << ", subdetId: "<< detid.subdetId() << "): " << diff; } else{ break; } } */ //_TrackerCommonT.set(Rtotal.x(), Rtotal.y(), Rtotal.z()); _TrackerCommonT = align::GlobalVector(Rtotal.x(), Rtotal.y(), Rtotal.z()); _TrackerCommonR = align::GlobalVector(Wtotal.x(), Wtotal.y(), Wtotal.z()); _TrackerCommonCM = curAli->globalPosition(); //_TrackerCommonTR(1) = Rtotal.x(); _TrackerCommonTR(2) = Rtotal.y(); _TrackerCommonTR(3) = Rtotal.z(); //_TrackerCommonTR(4) = Wtotal.x(); _TrackerCommonTR(5) = Wtotal.y(); _TrackerCommonTR(6) = Wtotal.z(); } else{ for (unsigned int i = 0; i < nComp; ++i) diffCommonTrackerSystem(refComp[i],curComp[i]); } }
void TrackerGeometryCompare::fillIdentifiers | ( | int | subdetlevel, |
int | rawid | ||
) | [private] |
Definition at line 664 of file TrackerGeometryCompare.cc.
References _identifiers, PXFDetId::blade(), gather_cfg::cout, PXFDetId::disk(), PXBDetId::ladder(), TIBDetId::layer(), TOBDetId::layer(), PXBDetId::layer(), PXFDetId::module(), TOBDetId::module(), TIDDetId::module(), PXBDetId::module(), TECDetId::module(), TIBDetId::module(), PXFDetId::panel(), TECDetId::petal(), TIDDetId::ring(), TECDetId::ring(), TOBDetId::rod(), PXFDetId::side(), TIDDetId::side(), TECDetId::side(), TIBDetId::string(), TIDDetId::wheel(), and TECDetId::wheel().
Referenced by fillTree().
{ switch( subdetlevel ){ case 1: { PXBDetId pxbid( rawid ); _identifiers[0] = pxbid.module(); _identifiers[1] = pxbid.ladder(); _identifiers[2] = pxbid.layer(); _identifiers[3] = 999; _identifiers[4] = 999; _identifiers[5] = 999; break; } case 2: { PXFDetId pxfid( rawid ); _identifiers[0] = pxfid.module(); _identifiers[1] = pxfid.panel(); _identifiers[2] = pxfid.blade(); _identifiers[3] = pxfid.disk(); _identifiers[4] = pxfid.side(); _identifiers[5] = 999; break; } case 3: { TIBDetId tibid( rawid ); _identifiers[0] = tibid.module(); _identifiers[1] = tibid.string()[0]; _identifiers[2] = tibid.string()[1]; _identifiers[3] = tibid.string()[2]; _identifiers[4] = tibid.layer(); _identifiers[5] = 999; break; } case 4: { TIDDetId tidid( rawid ); _identifiers[0] = tidid.module()[0]; _identifiers[1] = tidid.module()[1]; _identifiers[2] = tidid.ring(); _identifiers[3] = tidid.wheel(); _identifiers[4] = tidid.side(); _identifiers[5] = 999; break; } case 5: { TOBDetId tobid( rawid ); _identifiers[0] = tobid.module(); _identifiers[1] = tobid.rod()[0]; _identifiers[2] = tobid.rod()[1]; _identifiers[3] = tobid.layer(); _identifiers[4] = 999; _identifiers[5] = 999; break; } case 6: { TECDetId tecid( rawid ); _identifiers[0] = tecid.module(); _identifiers[1] = tecid.ring(); _identifiers[2] = tecid.petal()[0]; _identifiers[3] = tecid.petal()[1]; _identifiers[4] = tecid.wheel(); _identifiers[5] = tecid.side(); break; } default: { std::cout << "Error: bad subdetid!!" << std::endl; break; } } }
void TrackerGeometryCompare::fillTree | ( | Alignable * | refAli, |
AlgebraicVector | diff | ||
) | [private] |
Definition at line 477 of file TrackerGeometryCompare.cc.
References _alignTree, _alphaVal, _betaVal, _dalphaVal, _daVal, _dbetaVal, _dbVal, _detDim, _detIdFlag, _dgammaVal, _dgVal, _dphiVal, _drVal, _duVal, _dvVal, _dwVal, _dxVal, _dyVal, _dzVal, _etaVal, _gammaVal, _id, _level, _mid, _mlevel, _phiVal, _rVal, _sublevel, _surLength, _surRot, _surWidth, _useDetId, _xVal, _yVal, _zVal, align::AlignableDet, align::AlignableDetUnit, Alignable::alignableObjectId(), cond::rpcobgas::detid, PV3DBase< T, PVType, FrameType >::eta(), fillIdentifiers(), g, Alignable::geomDetId(), Alignable::globalPosition(), Alignable::globalRotation(), Alignable::id(), prof2calltree::l, AlignableSurface::length(), Alignable::mother(), passIdCut(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), DetId::rawId(), DetId::subdetId(), Alignable::surface(), align::toAngles(), AlignableSurface::toLocal(), AlignableSurface::width(), 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().
Referenced by compareGeometries().
{ _id = refAli->id(); _level = refAli->alignableObjectId(); //need if ali has no mother if (refAli->mother()){ _mid = refAli->mother()->geomDetId().rawId(); _mlevel = refAli->mother()->alignableObjectId(); } else{ _mid = -1; _mlevel = -1; } DetId detid(_id); _sublevel = detid.subdetId(); fillIdentifiers( _sublevel, _id ); _xVal = refAli->globalPosition().x(); _yVal = refAli->globalPosition().y(); _zVal = refAli->globalPosition().z(); align::GlobalVector vec(_xVal,_yVal,_zVal); _rVal = vec.perp(); _phiVal = vec.phi(); _etaVal = vec.eta(); align::RotationType rot = refAli->globalRotation(); align::EulerAngles eulerAngles = align::toAngles(rot); _alphaVal = eulerAngles[0]; _betaVal = eulerAngles[1]; _gammaVal = eulerAngles[2]; // global _dxVal = diff[0]; _dyVal = diff[1]; _dzVal = diff[2]; // local _duVal = diff[6]; _dvVal = diff[7]; _dwVal = diff[8]; //...TODO... align::GlobalVector g(_dxVal, _dyVal, _dzVal); align::LocalVector l = refAli->surface().toLocal(g); //getting dR and dPhi align::GlobalVector vRef(_xVal,_yVal,_zVal); align::GlobalVector vCur(_xVal + _dxVal, _yVal + _dyVal, _zVal + _dzVal); _drVal = vCur.perp() - vRef.perp(); _dphiVal = vCur.phi() - vRef.phi(); // global _dalphaVal = diff[3]; _dbetaVal = diff[4]; _dgammaVal = diff[5]; // local _daVal = diff[9]; _dbVal = diff[10]; _dgVal = diff[11]; //detIdFlag if (refAli->alignableObjectId() == align::AlignableDetUnit){ if (_detIdFlag){ if ((passIdCut(refAli->id()))||(passIdCut(refAli->mother()->id()))){ _useDetId = 1; } else{ _useDetId = 0; } } } // det module dimension if (refAli->alignableObjectId() == align::AlignableDetUnit){ if (refAli->mother()->alignableObjectId() != align::AlignableDet) _detDim = 1; else if (refAli->mother()->alignableObjectId() == align::AlignableDet) _detDim = 2; } else _detDim = 0; _surWidth = refAli->surface().width(); _surLength = refAli->surface().length(); align::RotationType rt = refAli->globalRotation(); _surRot[0] = rt.xx(); _surRot[1] = rt.xy(); _surRot[2] = rt.xz(); _surRot[3] = rt.yx(); _surRot[4] = rt.yy(); _surRot[5] = rt.yz(); _surRot[6] = rt.zx(); _surRot[7] = rt.zy(); _surRot[8] = rt.zz(); //Fill _alignTree->Fill(); }
bool TrackerGeometryCompare::passIdCut | ( | uint32_t | id | ) | [private] |
Definition at line 651 of file TrackerGeometryCompare.cc.
References _detIdFlagVector, and i.
Referenced by fillTree().
{ bool pass = false; int nEntries = _detIdFlagVector.size(); for (int i = 0; i < nEntries; i++){ if (_detIdFlagVector[i] == id) pass = true; } return pass; }
void TrackerGeometryCompare::setCommonTrackerSystem | ( | ) | [private] |
Definition at line 381 of file TrackerGeometryCompare.cc.
References _commonTrackerLevel, _setCommonTrackerSystem, _TrackerCommonCM, _TrackerCommonR, _TrackerCommonT, gather_cfg::cout, currentTracker, diffCommonTrackerSystem(), Alignable::globalPosition(), align::moveAlignable(), TkRotation< T >::multiplyInverse(), AlignableObjectId::nameToType(), referenceTracker, align::toMatrix(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by analyze().
{ edm::LogInfo("TrackerGeometryCompare") << "Setting Common Tracker System...."; AlignableObjectId dummy; _commonTrackerLevel = dummy.nameToType(_setCommonTrackerSystem); diffCommonTrackerSystem(referenceTracker, currentTracker); align::EulerAngles dOmega(3); dOmega[0] = _TrackerCommonR.x() ; dOmega[1] = _TrackerCommonR.y(); dOmega[2] = _TrackerCommonR.z(); align::RotationType rot = align::toMatrix( dOmega ); align::GlobalVector theR = _TrackerCommonT; std::cout << "what we get from overlaying the pixels..." << theR << ", " << rot << std::endl; //transform to the Tracker System align::PositionType trackerCM = currentTracker->globalPosition(); align::GlobalVector cmDiff( trackerCM.x()-_TrackerCommonCM.x(), trackerCM.y()-_TrackerCommonCM.y(), trackerCM.z()-_TrackerCommonCM.z() ); std::cout << "Pixel CM: " << _TrackerCommonCM << ", tracker CM: " << trackerCM << std::endl; //adjust translational difference factoring in different rotational CM //needed because rotateInGlobalFrame is about CM of alignable, not Tracker align::GlobalVector::BasicVectorType lpvgf = cmDiff.basicVector(); align::GlobalVector moveV( rot.multiplyInverse(lpvgf) - lpvgf); align::GlobalVector theRprime(theR + moveV); AlgebraicVector TrackerCommonTR(6); TrackerCommonTR(1) = theRprime.x(); TrackerCommonTR(2) = theRprime.y(); TrackerCommonTR(3) = theRprime.z(); TrackerCommonTR(4) = _TrackerCommonR.x(); TrackerCommonTR(5) = _TrackerCommonR.y(); TrackerCommonTR(6) = _TrackerCommonR.z(); std::cout << "and after the transformation: " << TrackerCommonTR << std::endl; align::moveAlignable(currentTracker, TrackerCommonTR ); }
void TrackerGeometryCompare::surveyToTracker | ( | AlignableTracker * | ali, |
Alignments * | alignVals, | ||
AlignmentErrors * | alignErrors | ||
) | [private] |
Definition at line 565 of file TrackerGeometryCompare.cc.
References filterCSVwithJSON::copy, AlignableTracker::endcapGeomDets(), i, AlignableTracker::innerBarrelGeomDets(), j, gen::k, Alignments::m_align, AlignmentErrors::m_alignError, AlignableTracker::outerBarrelGeomDets(), AlignableTracker::pixelEndcapGeomDets(), AlignableTracker::pixelHalfBarrelGeomDets(), pos, SurveyDet::position(), SurveyDet::rotation(), python::multivaluedict::sort(), and AlignableTracker::TIDGeomDets().
{ //getting the right alignables for the alignment record std::vector<Alignable*> detPB = ali->pixelHalfBarrelGeomDets(); std::vector<Alignable*> detPEC = ali->pixelEndcapGeomDets(); std::vector<Alignable*> detTIB = ali->innerBarrelGeomDets(); std::vector<Alignable*> detTID = ali->TIDGeomDets(); std::vector<Alignable*> detTOB = ali->outerBarrelGeomDets(); std::vector<Alignable*> detTEC = ali->endcapGeomDets(); std::vector<Alignable*> allGeomDets; std::copy(detPB.begin(), detPB.end(), std::back_inserter(allGeomDets)); std::copy(detPEC.begin(), detPEC.end(), std::back_inserter(allGeomDets)); std::copy(detTIB.begin(), detTIB.end(), std::back_inserter(allGeomDets)); std::copy(detTID.begin(), detTID.end(), std::back_inserter(allGeomDets)); std::copy(detTOB.begin(), detTOB.end(), std::back_inserter(allGeomDets)); std::copy(detTEC.begin(), detTEC.end(), std::back_inserter(allGeomDets)); std::vector<Alignable*> rcdAlis; for (std::vector<Alignable*>::iterator i = allGeomDets.begin(); i!= allGeomDets.end(); i++){ if ((*i)->components().size() == 1){ rcdAlis.push_back((*i)); } else if ((*i)->components().size() > 1){ rcdAlis.push_back((*i)); std::vector<Alignable*> comp = (*i)->components(); for (std::vector<Alignable*>::iterator j = comp.begin(); j != comp.end(); j++){ rcdAlis.push_back((*j)); } } } //turning them into alignments for(std::vector<Alignable*>::iterator k = rcdAlis.begin(); k != rcdAlis.end(); k++){ const SurveyDet* surveyInfo = (*k)->survey(); align::PositionType pos(surveyInfo->position()); align::RotationType rot(surveyInfo->rotation()); CLHEP::Hep3Vector clhepVector(pos.x(),pos.y(),pos.z()); CLHEP::HepRotation clhepRotation( CLHEP::HepRep3x3(rot.xx(),rot.xy(),rot.xz(),rot.yx(),rot.yy(),rot.yz(),rot.zx(),rot.zy(),rot.zz())); AlignTransform transform(clhepVector, clhepRotation, (*k)->id()); AlignTransformError transformError(CLHEP::HepSymMatrix(3,1), (*k)->id()); alignVals->m_align.push_back(transform); alignErrors->m_alignError.push_back(transformError); } //to get the right order std::sort( alignVals->m_align.begin(), alignVals->m_align.end(), lessAlignmentDetId<AlignTransform>() ); std::sort( alignErrors->m_alignError.begin(), alignErrors->m_alignError.end(), lessAlignmentDetId<AlignTransformError>() ); }
TTree* TrackerGeometryCompare::_alignTree [private] |
Definition at line 112 of file TrackerGeometryCompare.h.
Referenced by analyze(), fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_alphaVal [private] |
Definition at line 119 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_betaVal [private] |
Definition at line 119 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
Definition at line 104 of file TrackerGeometryCompare.h.
Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().
float TrackerGeometryCompare::_dalphaVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_daVal [private] |
Definition at line 123 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dbetaVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dbVal [private] |
Definition at line 123 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_detDim [private] |
Definition at line 118 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
bool TrackerGeometryCompare::_detIdFlag [private] |
Definition at line 97 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_detIdFlagFile [private] |
Definition at line 98 of file TrackerGeometryCompare.h.
Referenced by TrackerGeometryCompare().
std::vector< uint32_t > TrackerGeometryCompare::_detIdFlagVector [private] |
Definition at line 103 of file TrackerGeometryCompare.h.
Referenced by passIdCut(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dgammaVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dgVal [private] |
Definition at line 123 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dphiVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_drVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_duVal [private] |
Definition at line 123 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dvVal [private] |
Definition at line 123 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dwVal [private] |
Definition at line 123 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dxVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dyVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dzVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_etaVal [private] |
Definition at line 119 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_filename [private] |
Definition at line 110 of file TrackerGeometryCompare.h.
Referenced by TrackerGeometryCompare().
float TrackerGeometryCompare::_gammaVal [private] |
Definition at line 119 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_id [private] |
Definition at line 118 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
uint32_t TrackerGeometryCompare::_identifiers[6] [private] |
Definition at line 125 of file TrackerGeometryCompare.h.
Referenced by fillIdentifiers(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_inputFilename1 [private] |
Definition at line 91 of file TrackerGeometryCompare.h.
Referenced by createROOTGeometry(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_inputFilename2 [private] |
Definition at line 92 of file TrackerGeometryCompare.h.
Referenced by createROOTGeometry(), and TrackerGeometryCompare().
TFile* TrackerGeometryCompare::_inputRootFile1 [private] |
Definition at line 113 of file TrackerGeometryCompare.h.
Referenced by createROOTGeometry().
TFile* TrackerGeometryCompare::_inputRootFile2 [private] |
Definition at line 114 of file TrackerGeometryCompare.h.
Referenced by createROOTGeometry().
TTree* TrackerGeometryCompare::_inputTree1 [private] |
Definition at line 115 of file TrackerGeometryCompare.h.
Referenced by createROOTGeometry().
TTree* TrackerGeometryCompare::_inputTree2 [private] |
Definition at line 116 of file TrackerGeometryCompare.h.
Referenced by createROOTGeometry().
std::string TrackerGeometryCompare::_inputTreename [private] |
Definition at line 93 of file TrackerGeometryCompare.h.
Referenced by createROOTGeometry(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_level [private] |
Definition at line 118 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_mid [private] |
Definition at line 118 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_mlevel [private] |
Definition at line 118 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_phiVal [private] |
Definition at line 119 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_rVal [private] |
Definition at line 119 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_setCommonTrackerSystem [private] |
Definition at line 96 of file TrackerGeometryCompare.h.
Referenced by analyze(), setCommonTrackerSystem(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_sublevel [private] |
Definition at line 118 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_surLength [private] |
Definition at line 124 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
double TrackerGeometryCompare::_surRot[9] [private] |
Definition at line 126 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_surWidth [private] |
Definition at line 124 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
TFile* TrackerGeometryCompare::_theFile [private] |
Definition at line 111 of file TrackerGeometryCompare.h.
Referenced by analyze(), and TrackerGeometryCompare().
Definition at line 107 of file TrackerGeometryCompare.h.
Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().
Definition at line 106 of file TrackerGeometryCompare.h.
Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().
Definition at line 105 of file TrackerGeometryCompare.h.
Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().
int TrackerGeometryCompare::_useDetId [private] |
Definition at line 118 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_weightBy [private] |
Definition at line 95 of file TrackerGeometryCompare.h.
Referenced by compareGeometries(), diffCommonTrackerSystem(), and TrackerGeometryCompare().
bool TrackerGeometryCompare::_weightById [private] |
Definition at line 99 of file TrackerGeometryCompare.h.
Referenced by compareGeometries(), diffCommonTrackerSystem(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_weightByIdFile [private] |
Definition at line 100 of file TrackerGeometryCompare.h.
Referenced by TrackerGeometryCompare().
std::vector< unsigned int > TrackerGeometryCompare::_weightByIdVector [private] |
Definition at line 101 of file TrackerGeometryCompare.h.
Referenced by compareGeometries(), diffCommonTrackerSystem(), and TrackerGeometryCompare().
bool TrackerGeometryCompare::_writeToDB [private] |
Definition at line 94 of file TrackerGeometryCompare.h.
Referenced by analyze(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_xVal [private] |
Definition at line 119 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_yVal [private] |
Definition at line 119 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_zVal [private] |
Definition at line 119 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
Definition at line 84 of file TrackerGeometryCompare.h.
Referenced by analyze(), createROOTGeometry(), and setCommonTrackerSystem().
Definition at line 83 of file TrackerGeometryCompare.h.
bool TrackerGeometryCompare::firstEvent_ [private] |
Definition at line 128 of file TrackerGeometryCompare.h.
Referenced by analyze(), and beginJob().
Definition at line 60 of file TrackerGeometryCompare.h.
Definition at line 82 of file TrackerGeometryCompare.h.
Referenced by analyze(), createROOTGeometry(), and setCommonTrackerSystem().
std::vector<align::StructureType> TrackerGeometryCompare::theLevels [private] |
Definition at line 61 of file TrackerGeometryCompare.h.
Referenced by compareGeometries(), and TrackerGeometryCompare().
const SurveyErrors* TrackerGeometryCompare::theSurveyErrors [private] |
Definition at line 88 of file TrackerGeometryCompare.h.
Referenced by addSurveyInfo().
unsigned int TrackerGeometryCompare::theSurveyIndex [private] |
Definition at line 86 of file TrackerGeometryCompare.h.
Referenced by addSurveyInfo().
const Alignments* TrackerGeometryCompare::theSurveyValues [private] |
Definition at line 87 of file TrackerGeometryCompare.h.
Referenced by addSurveyInfo().