#include <Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h>
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 51 of file TrackerGeometryCompare.cc.
References _alignTree, _alphaVal, _betaVal, _dalphaVal, _dbetaVal, _detDim, _detIdFlag, _detIdFlagFile, _detIdFlagVector, _dgammaVal, _dphiVal, _drVal, _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, dummy, edm::ParameterSet::getUntrackedParameter(), id, edm::es::l(), and theLevels.
00052 { 00053 00054 //input is ROOT 00055 _inputFilename1 = cfg.getUntrackedParameter< std::string > ("inputROOTFile1"); 00056 _inputFilename2 = cfg.getUntrackedParameter< std::string > ("inputROOTFile2"); 00057 _inputTreename = cfg.getUntrackedParameter< std::string > ("treeName"); 00058 00059 //output file 00060 _filename = cfg.getUntrackedParameter< std::string > ("outputFile"); 00061 00062 _writeToDB = cfg.getUntrackedParameter< bool > ("writeToDB" ); 00063 00064 const std::vector<std::string>& levels = cfg.getUntrackedParameter< std::vector<std::string> > ("levels"); 00065 00066 _weightBy = cfg.getUntrackedParameter< std::string > ("weightBy"); 00067 _setCommonTrackerSystem = cfg.getUntrackedParameter< std::string > ("setCommonTrackerSystem"); 00068 _detIdFlag = cfg.getUntrackedParameter< bool > ("detIdFlag"); 00069 _detIdFlagFile = cfg.getUntrackedParameter< std::string > ("detIdFlagFile"); 00070 _weightById = cfg.getUntrackedParameter< bool > ("weightById"); 00071 _weightByIdFile = cfg.getUntrackedParameter< std::string > ("weightByIdFile"); 00072 00073 //setting the levels being used in the geometry comparator 00074 AlignableObjectId dummy; 00075 edm::LogInfo("TrakcerGeomertyCompare") << "levels: " << levels.size(); 00076 for (unsigned int l = 0; l < levels.size(); ++l){ 00077 theLevels.push_back( dummy.nameToType(levels[l])); 00078 edm::LogInfo("TrakcerGeomertyCompare") << "level: " << levels[l]; 00079 } 00080 00081 00082 // if want to use, make id cut list 00083 if (_detIdFlag){ 00084 ifstream fin; 00085 fin.open( _detIdFlagFile.c_str() ); 00086 00087 while (!fin.eof() && fin.good() ){ 00088 00089 uint32_t id; 00090 fin >> id; 00091 _detIdFlagVector.push_back(id); 00092 } 00093 fin.close(); 00094 } 00095 00096 // turn weightByIdFile into weightByIdVector 00097 if (_weightById){ 00098 std::ifstream inFile; 00099 inFile.open( _weightByIdFile.c_str() ); 00100 int ctr = 0; 00101 while ( !inFile.eof() ){ 00102 ctr++; 00103 unsigned int listId; 00104 inFile >> listId; 00105 inFile.ignore(256, '\n'); 00106 00107 _weightByIdVector.push_back( listId ); 00108 } 00109 inFile.close(); 00110 } 00111 00112 00113 //root configuration 00114 _theFile = new TFile(_filename.c_str(),"RECREATE"); 00115 _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"); 00116 _alignTree->Branch("id", &_id, "id/I"); 00117 _alignTree->Branch("level", &_level, "level/I"); 00118 _alignTree->Branch("mid", &_mid, "mid/I"); 00119 _alignTree->Branch("mlevel", &_mlevel, "mlevel/I"); 00120 _alignTree->Branch("sublevel", &_sublevel, "sublevel/I"); 00121 _alignTree->Branch("x", &_xVal, "x/F"); 00122 _alignTree->Branch("y", &_yVal, "y/F"); 00123 _alignTree->Branch("z", &_zVal, "z/F"); 00124 _alignTree->Branch("r", &_rVal, "r/F"); 00125 _alignTree->Branch("phi", &_phiVal, "phi/F"); 00126 _alignTree->Branch("eta", &_etaVal, "eta/F"); 00127 _alignTree->Branch("alpha", &_alphaVal, "alpha/F"); 00128 _alignTree->Branch("beta", &_betaVal, "beta/F"); 00129 _alignTree->Branch("gamma", &_gammaVal, "gamma/F"); 00130 _alignTree->Branch("dx", &_dxVal, "dx/F"); 00131 _alignTree->Branch("dy", &_dyVal, "dy/F"); 00132 _alignTree->Branch("dz", &_dzVal, "dz/F"); 00133 _alignTree->Branch("dr", &_drVal, "dr/F"); 00134 _alignTree->Branch("dphi", &_dphiVal, "dphi/F"); 00135 _alignTree->Branch("dalpha", &_dalphaVal, "dalpha/F"); 00136 _alignTree->Branch("dbeta", &_dbetaVal, "dbeta/F"); 00137 _alignTree->Branch("dgamma", &_dgammaVal, "dgamma/F"); 00138 _alignTree->Branch("useDetId", &_useDetId, "useDetId/I"); 00139 _alignTree->Branch("detDim", &_detDim, "detDim/I"); 00140 _alignTree->Branch("surW", &_surWidth, "surW/F"); 00141 _alignTree->Branch("surL", &_surLength, "surL/F"); 00142 _alignTree->Branch("surRot", &_surRot, "surRot[9]/D"); 00143 _alignTree->Branch("identifiers", &_identifiers, "identifiers[6]/I"); 00144 00145 00146 }
Definition at line 580 of file TrackerGeometryCompare.cc.
References Alignable::alignableObjectId(), Alignable::components(), error, Exception, Alignable::geomDetId(), i, AlignableSurface::length(), Alignments::m_align, SurveyErrors::m_surveyErrors, SurveyError::matrix(), DetId::rawId(), SurveyError::rawId(), rot, AlignableSurface::setLength(), Alignable::setSurvey(), AlignableSurface::setWidth(), SurveyError::structureType(), Alignable::surface(), theSurveyErrors, theSurveyIndex, theSurveyValues, and AlignableSurface::width().
00580 { 00581 00582 const std::vector<Alignable*>& comp = ali->components(); 00583 00584 unsigned int nComp = comp.size(); 00585 00586 for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo(comp[i]); 00587 00588 const SurveyError& error = theSurveyErrors->m_surveyErrors[theSurveyIndex]; 00589 00590 if ( ali->geomDetId().rawId() != error.rawId() || 00591 ali->alignableObjectId() != error.structureType() ) 00592 { 00593 throw cms::Exception("DatabaseError") 00594 << "Error reading survey info from DB. Mismatched id!"; 00595 } 00596 00597 const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[theSurveyIndex].translation(); 00598 const CLHEP::HepRotation& rot = theSurveyValues->m_align[theSurveyIndex].rotation(); 00599 00600 AlignableSurface surf( align::PositionType( pos.x(), pos.y(), pos.z() ), 00601 align::RotationType( rot.xx(), rot.xy(), rot.xz(), 00602 rot.yx(), rot.yy(), rot.yz(), 00603 rot.zx(), rot.zy(), rot.zz() ) ); 00604 00605 surf.setWidth( ali->surface().width() ); 00606 surf.setLength( ali->surface().length() ); 00607 00608 ali->setSurvey( new SurveyDet( surf, error.matrix() ) ); 00609 00610 ++theSurveyIndex; 00611 00612 }
void TrackerGeometryCompare::analyze | ( | const edm::Event & | , | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
void TrackerGeometryCompare::beginJob | ( | const edm::EventSetup & | iSetup | ) | [virtual] |
Read from DB and print survey info.
Reimplemented from edm::EDAnalyzer.
Definition at line 148 of file TrackerGeometryCompare.cc.
References _alignTree, _setCommonTrackerSystem, _theFile, _writeToDB, AlignableTracker::alignmentErrors(), AlignableTracker::alignments(), compareGeometries(), createROOTGeometry(), currentTracker, edm::Service< T >::isAvailable(), referenceTracker, and setCommonTrackerSystem().
00148 { 00149 00150 //upload the ROOT geometries 00151 createROOTGeometry(iSetup); 00152 00153 //set common tracker system first 00154 // if setting the tracker common system 00155 if (_setCommonTrackerSystem != "NONE"){ 00156 setCommonTrackerSystem(); 00157 } 00158 00159 00160 //compare the goemetries 00161 compareGeometries(referenceTracker,currentTracker); 00162 00163 //write out ntuple 00164 //might be better to do within output module 00165 _theFile->cd(); 00166 _alignTree->Write(); 00167 _theFile->Close(); 00168 00169 00170 if (_writeToDB){ 00171 Alignments* myAlignments = currentTracker->alignments(); 00172 AlignmentErrors* myAlignmentErrors = currentTracker->alignmentErrors(); 00173 00174 // 2. Store alignment[Error]s to DB 00175 edm::Service<cond::service::PoolDBOutputService> poolDbService; 00176 // Call service 00177 if( !poolDbService.isAvailable() ) // Die if not available 00178 throw cms::Exception("NotAvailable") << "PoolDBOutputService not available"; 00179 00180 poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), "TrackerAlignmentRcd"); 00181 poolDbService->writeOne<AlignmentErrors>(&(*myAlignmentErrors), poolDbService->beginOfTime(), "TrackerAlignmentErrorRcd"); 00182 00183 } 00184 00185 }
Definition at line 300 of file TrackerGeometryCompare.cc.
References _weightBy, _weightById, _weightByIdVector, Alignable::alignableObjectId(), HcalDataFrameFilter_impl::check(), Alignable::components(), diff, align::diffAlignables(), e, fillTree(), Alignable::geomDetId(), i, Alignable::id(), PV3DBase< T, PVType, FrameType >::mag(), align::moveAlignable(), DetId::rawId(), rot, and theLevels.
Referenced by beginJob(), and diffCommonTrackerSystem().
00300 { 00301 00302 const std::vector<Alignable*>& refComp = refAli->components(); 00303 const std::vector<Alignable*>& curComp = curAli->components(); 00304 00305 unsigned int nComp = refComp.size(); 00306 //only perform for designate levels 00307 bool useLevel = false; 00308 for (unsigned int i = 0; i < theLevels.size(); ++i){ 00309 if (refAli->alignableObjectId() == theLevels[i]) useLevel = true; 00310 } 00311 00312 //another added level for difference between det and detunit 00313 //if ((refAli->alignableObjectId()==2)&&(nComp == 1)) useLevel = false; 00314 00315 //coordinate matching, etc etc 00316 if (useLevel){ 00317 //std::cout << "ali identifiers: " << refAli->id() << ", " << refAli->alignableObjectId() << std::endl; 00318 //std::cout << "diff pos" << (refAli->globalPosition() - curAli->globalPosition()) << std::endl; 00319 //std::cout <<"z"; 00320 Hep3Vector Rtotal, Wtotal; 00321 Rtotal.set(0.,0.,0.); Wtotal.set(0.,0.,0.); 00322 00323 for (int i = 0; i < 100; i++){ 00324 AlgebraicVector diff = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector); 00325 Hep3Vector dR(diff[0],diff[1],diff[2]); 00326 Rtotal+=dR; 00327 Hep3Vector dW(diff[3],diff[4],diff[5]); 00328 HepRotation rot(Wtotal.unit(),Wtotal.mag()); 00329 HepRotation drot(dW.unit(),dW.mag()); 00330 rot*=drot; 00331 Wtotal.set(rot.axis().x()*rot.delta(), rot.axis().y()*rot.delta(), rot.axis().z()*rot.delta()); 00332 //std::cout << "a"; 00333 //if (refAli->alignableObjectId() == 1) std::cout << "DIFF: " << diff << std::endl; 00334 align::moveAlignable(curAli, diff); 00335 float tolerance = 1e-7; 00336 AlgebraicVector check = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector); 00337 align::GlobalVector checkR(check[0],check[1],check[2]); 00338 align::GlobalVector checkW(check[3],check[4],check[5]); 00339 DetId detid(refAli->id()); 00340 if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){ 00341 edm::LogInfo("CopareGeoms") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId() 00342 << ", rawId: " << refAli->geomDetId().rawId() 00343 << ", subdetId: "<< detid.subdetId() << "): " << diff; 00344 } 00345 else{ 00346 break; 00347 } 00348 } 00349 00350 AlgebraicVector TRtot(6); 00351 TRtot(1) = Rtotal.x(); TRtot(2) = Rtotal.y(); TRtot(3) = Rtotal.z(); 00352 TRtot(4) = Wtotal.x(); TRtot(5) = Wtotal.y(); TRtot(6) = Wtotal.z(); 00353 fillTree(refAli, TRtot); 00354 00355 00356 } 00357 00358 //another added level for difference between det and detunit 00359 for (unsigned int i = 0; i < nComp; ++i) compareGeometries(refComp[i],curComp[i]); 00360 00361 00362 }
void TrackerGeometryCompare::createROOTGeometry | ( | const edm::EventSetup & | iSetup | ) | [private] |
Definition at line 188 of file TrackerGeometryCompare.cc.
References _inputFilename1, _inputFilename2, _inputRootFile1, _inputRootFile2, _inputTree1, _inputTree2, _inputTreename, GeometryAligner::applyAlignments(), TrackerGeomBuilderFromGeometricDet::build(), currentTracker, align::DetectorGlobalPosition(), edm::EventSetup::get(), i, Alignments::m_align, AlignmentErrors::m_alignError, referenceTracker, python::multivaluedict::sort(), and DetId::Tracker.
Referenced by beginJob().
00188 { 00189 00190 int inputRawId1, inputRawId2; 00191 double inputX1, inputY1, inputZ1, inputX2, inputY2, inputZ2; 00192 double inputAlpha1, inputBeta1, inputGamma1, inputAlpha2, inputBeta2, inputGamma2; 00193 00194 //declare alignments 00195 Alignments* alignments1 = new Alignments(); 00196 AlignmentErrors* alignmentErrors1 = new AlignmentErrors(); 00197 if (_inputFilename1 != "IDEAL"){ 00198 _inputRootFile1 = new TFile(_inputFilename1.c_str()); 00199 TTree* _inputTree1 = (TTree*) _inputRootFile1->Get(_inputTreename.c_str()); 00200 _inputTree1->SetBranchAddress("rawid", &inputRawId1); 00201 _inputTree1->SetBranchAddress("x", &inputX1); 00202 _inputTree1->SetBranchAddress("y", &inputY1); 00203 _inputTree1->SetBranchAddress("z", &inputZ1); 00204 _inputTree1->SetBranchAddress("alpha", &inputAlpha1); 00205 _inputTree1->SetBranchAddress("beta", &inputBeta1); 00206 _inputTree1->SetBranchAddress("gamma", &inputGamma1); 00207 00208 int nEntries1 = _inputTree1->GetEntries(); 00209 //fill alignments 00210 for (int i = 0; i < nEntries1; ++i){ 00211 00212 _inputTree1->GetEntry(i); 00213 Hep3Vector translation1(inputX1, inputY1, inputZ1); 00214 HepEulerAngles eulerangles1(inputAlpha1,inputBeta1,inputGamma1); 00215 uint32_t detid1 = inputRawId1; 00216 AlignTransform transform1(translation1, eulerangles1, detid1); 00217 alignments1->m_align.push_back(transform1); 00218 00219 //dummy errors 00220 HepSymMatrix clhepSymMatrix(3,0); 00221 AlignTransformError transformError(clhepSymMatrix, detid1); 00222 alignmentErrors1->m_alignError.push_back(transformError); 00223 } 00224 00225 // to get the right order 00226 std::sort( alignments1->m_align.begin(), alignments1->m_align.end(), lessAlignmentDetId<AlignTransform>() ); 00227 std::sort( alignmentErrors1->m_alignError.begin(), alignmentErrors1->m_alignError.end(), lessAlignmentDetId<AlignTransformError>() ); 00228 } 00229 //------------------ 00230 Alignments* alignments2 = new Alignments(); 00231 AlignmentErrors* alignmentErrors2 = new AlignmentErrors(); 00232 if (_inputFilename2 != "IDEAL"){ 00233 _inputRootFile2 = new TFile(_inputFilename2.c_str()); 00234 TTree* _inputTree2 = (TTree*) _inputRootFile2->Get(_inputTreename.c_str()); 00235 _inputTree2->SetBranchAddress("rawid", &inputRawId2); 00236 _inputTree2->SetBranchAddress("x", &inputX2); 00237 _inputTree2->SetBranchAddress("y", &inputY2); 00238 _inputTree2->SetBranchAddress("z", &inputZ2); 00239 _inputTree2->SetBranchAddress("alpha", &inputAlpha2); 00240 _inputTree2->SetBranchAddress("beta", &inputBeta2); 00241 _inputTree2->SetBranchAddress("gamma", &inputGamma2); 00242 00243 int nEntries2 = _inputTree2->GetEntries(); 00244 //fill alignments 00245 for (int i = 0; i < nEntries2; ++i){ 00246 00247 _inputTree2->GetEntry(i); 00248 Hep3Vector translation2(inputX2, inputY2, inputZ2); 00249 HepEulerAngles eulerangles2(inputAlpha2,inputBeta2,inputGamma2); 00250 uint32_t detid2 = inputRawId2; 00251 AlignTransform transform2(translation2, eulerangles2, detid2); 00252 alignments2->m_align.push_back(transform2); 00253 00254 //dummy errors 00255 HepSymMatrix clhepSymMatrix(3,0); 00256 AlignTransformError transformError(clhepSymMatrix, detid2); 00257 alignmentErrors2->m_alignError.push_back(transformError); 00258 } 00259 00260 //to get the right order 00261 std::sort( alignments2->m_align.begin(), alignments2->m_align.end(), lessAlignmentDetId<AlignTransform>() ); 00262 std::sort( alignmentErrors2->m_alignError.begin(), alignmentErrors2->m_alignError.end(), lessAlignmentDetId<AlignTransformError>() ); 00263 } 00264 00265 //accessing the initial geometry 00266 edm::ESHandle<DDCompactView> cpv; 00267 iSetup.get<IdealGeometryRecord>().get(cpv); 00268 edm::ESHandle<GeometricDet> theGeometricDet; 00269 iSetup.get<IdealGeometryRecord>().get(theGeometricDet); 00270 TrackerGeomBuilderFromGeometricDet trackerBuilder; 00271 00272 edm::ESHandle<Alignments> globalPositionRcd; 00273 iSetup.get<TrackerDigiGeometryRecord>().getRecord<GlobalPositionRcd>().get(globalPositionRcd); 00274 00275 //reference tracker 00276 TrackerGeometry* theRefTracker = trackerBuilder.build(&*theGeometricDet); 00277 if (_inputFilename1 != "IDEAL"){ 00278 GeometryAligner aligner1; 00279 aligner1.applyAlignments<TrackerGeometry>( &(*theRefTracker), &(*alignments1), &(*alignmentErrors1), 00280 align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker))); 00281 } 00282 referenceTracker = new AlignableTracker(&(*theRefTracker)); 00283 00284 //currernt tracker 00285 TrackerGeometry* theCurTracker = trackerBuilder.build(&*theGeometricDet); 00286 if (_inputFilename2 != "IDEAL"){ 00287 GeometryAligner aligner2; 00288 aligner2.applyAlignments<TrackerGeometry>( &(*theCurTracker), &(*alignments2), &(*alignmentErrors2), 00289 align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker))); 00290 } 00291 currentTracker = new AlignableTracker(&(*theCurTracker)); 00292 00293 00294 }
void TrackerGeometryCompare::diffCommonTrackerSystem | ( | Alignable * | refAli, | |
Alignable * | curAli | |||
) | [private] |
Definition at line 394 of file TrackerGeometryCompare.cc.
References _commonTrackerLevel, _TrackerCommonCM, _TrackerCommonR, _TrackerCommonT, _weightBy, _weightById, _weightByIdVector, Alignable::alignableObjectId(), HcalDataFrameFilter_impl::check(), compareGeometries(), Alignable::components(), diff, align::diffAlignables(), e, Alignable::geomDetId(), Alignable::globalPosition(), i, Alignable::id(), PV3DBase< T, PVType, FrameType >::mag(), align::moveAlignable(), DetId::rawId(), rot, and theLevels.
Referenced by setCommonTrackerSystem().
00394 { 00395 00396 const std::vector<Alignable*>& refComp = refAli->components(); 00397 const std::vector<Alignable*>& curComp = curAli->components(); 00398 00399 unsigned int nComp = refComp.size(); 00400 //only perform for designate levels 00401 bool useLevel = false; 00402 for (unsigned int i = 0; i < theLevels.size(); ++i){ 00403 if (refAli->alignableObjectId() == _commonTrackerLevel) useLevel = true; 00404 } 00405 00406 if (useLevel){ 00407 Hep3Vector Rtotal, Wtotal; 00408 Rtotal.set(0.,0.,0.); Wtotal.set(0.,0.,0.); 00409 00410 for (int i = 0; i < 100; i++){ 00411 AlgebraicVector diff = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector); 00412 Hep3Vector dR(diff[0],diff[1],diff[2]); 00413 Rtotal+=dR; 00414 Hep3Vector dW(diff[3],diff[4],diff[5]); 00415 HepRotation rot(Wtotal.unit(),Wtotal.mag()); 00416 HepRotation drot(dW.unit(),dW.mag()); 00417 rot*=drot; 00418 Wtotal.set(rot.axis().x()*rot.delta(), rot.axis().y()*rot.delta(), rot.axis().z()*rot.delta()); 00419 //std::cout << "a"; 00420 //if (refAli->alignableObjectId() == 1) std::cout << "DIFF: " << diff << std::endl; 00421 align::moveAlignable(curAli, diff); 00422 float tolerance = 1e-7; 00423 AlgebraicVector check = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector); 00424 align::GlobalVector checkR(check[0],check[1],check[2]); 00425 align::GlobalVector checkW(check[3],check[4],check[5]); 00426 DetId detid(refAli->id()); 00427 if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){ 00428 edm::LogInfo("CopareGeoms") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId() 00429 << ", rawId: " << refAli->geomDetId().rawId() 00430 << ", subdetId: "<< detid.subdetId() << "): " << diff; 00431 } 00432 else{ 00433 break; 00434 } 00435 } 00436 00437 //_TrackerCommonT.set(Rtotal.x(), Rtotal.y(), Rtotal.z()); 00438 _TrackerCommonT = align::GlobalVector(Rtotal.x(), Rtotal.y(), Rtotal.z()); 00439 _TrackerCommonR(1) = Wtotal.x(); _TrackerCommonR(2) = Wtotal.y(); _TrackerCommonR(3) = Wtotal.z(); 00440 _TrackerCommonCM = curAli->globalPosition(); 00441 //_TrackerCommonTR(1) = Rtotal.x(); _TrackerCommonTR(2) = Rtotal.y(); _TrackerCommonTR(3) = Rtotal.z(); 00442 //_TrackerCommonTR(4) = Wtotal.x(); _TrackerCommonTR(5) = Wtotal.y(); _TrackerCommonTR(6) = Wtotal.z(); 00443 00444 00445 } 00446 else{ 00447 for (unsigned int i = 0; i < nComp; ++i) compareGeometries(refComp[i],curComp[i]); 00448 } 00449 00450 00451 }
Definition at line 627 of file TrackerGeometryCompare.cc.
References _identifiers, PXFDetId::blade(), GenMuonPlsPt100GeV_cfg::cout, PXFDetId::disk(), lat::endl(), PXBDetId::ladder(), TIBDetId::layer(), TOBDetId::layer(), PXBDetId::layer(), PXFDetId::module(), TOBDetId::module(), PXBDetId::module(), TIDDetId::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().
00627 { 00628 00629 00630 switch( subdetlevel ){ 00631 00632 case 1: 00633 { 00634 PXBDetId pxbid( rawid ); 00635 _identifiers[0] = pxbid.module(); 00636 _identifiers[1] = pxbid.ladder(); 00637 _identifiers[2] = pxbid.layer(); 00638 _identifiers[3] = 999; 00639 _identifiers[4] = 999; 00640 _identifiers[5] = 999; 00641 break; 00642 } 00643 case 2: 00644 { 00645 PXFDetId pxfid( rawid ); 00646 _identifiers[0] = pxfid.module(); 00647 _identifiers[1] = pxfid.panel(); 00648 _identifiers[2] = pxfid.blade(); 00649 _identifiers[3] = pxfid.disk(); 00650 _identifiers[4] = pxfid.side(); 00651 _identifiers[5] = 999; 00652 break; 00653 } 00654 case 3: 00655 { 00656 TIBDetId tibid( rawid ); 00657 _identifiers[0] = tibid.module(); 00658 _identifiers[1] = tibid.string()[0]; 00659 _identifiers[2] = tibid.string()[1]; 00660 _identifiers[3] = tibid.string()[2]; 00661 _identifiers[4] = tibid.layer(); 00662 _identifiers[5] = 999; 00663 break; 00664 } 00665 case 4: 00666 { 00667 TIDDetId tidid( rawid ); 00668 _identifiers[0] = tidid.module()[0]; 00669 _identifiers[1] = tidid.module()[1]; 00670 _identifiers[2] = tidid.ring(); 00671 _identifiers[3] = tidid.wheel(); 00672 _identifiers[4] = tidid.side(); 00673 _identifiers[5] = 999; 00674 break; 00675 } 00676 case 5: 00677 { 00678 TOBDetId tobid( rawid ); 00679 _identifiers[0] = tobid.module(); 00680 _identifiers[1] = tobid.rod()[0]; 00681 _identifiers[2] = tobid.rod()[1]; 00682 _identifiers[3] = tobid.layer(); 00683 _identifiers[4] = 999; 00684 _identifiers[5] = 999; 00685 break; 00686 } 00687 case 6: 00688 { 00689 TECDetId tecid( rawid ); 00690 _identifiers[0] = tecid.module(); 00691 _identifiers[1] = tecid.ring(); 00692 _identifiers[2] = tecid.petal()[0]; 00693 _identifiers[3] = tecid.petal()[1]; 00694 _identifiers[4] = tecid.wheel(); 00695 _identifiers[5] = tecid.side(); 00696 break; 00697 } 00698 default: 00699 { 00700 std::cout << "Error: bad subdetid!!" << std::endl; 00701 break; 00702 } 00703 00704 } 00705 }
void TrackerGeometryCompare::fillTree | ( | Alignable * | refAli, | |
AlgebraicVector | diff | |||
) | [private] |
Definition at line 453 of file TrackerGeometryCompare.cc.
References _alignTree, _alphaVal, _betaVal, _dalphaVal, _dbetaVal, _detDim, _detIdFlag, _dgammaVal, _dphiVal, _drVal, _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(), PV3DBase< T, PVType, FrameType >::eta(), fillIdentifiers(), Alignable::geomDetId(), Alignable::globalPosition(), Alignable::globalRotation(), Alignable::id(), AlignableSurface::length(), Alignable::mother(), passIdCut(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), DetId::rawId(), rot, DetId::subdetId(), Alignable::surface(), align::toAngles(), 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().
00453 { 00454 00455 00456 _id = refAli->id(); 00457 _level = refAli->alignableObjectId(); 00458 //need if ali has no mother 00459 if (refAli->mother()){ 00460 _mid = refAli->mother()->geomDetId().rawId(); 00461 _mlevel = refAli->mother()->alignableObjectId(); 00462 } 00463 else{ 00464 _mid = -1; 00465 _mlevel = -1; 00466 } 00467 DetId detid(_id); 00468 _sublevel = detid.subdetId(); 00469 fillIdentifiers( _sublevel, _id ); 00470 _xVal = refAli->globalPosition().x(); 00471 _yVal = refAli->globalPosition().y(); 00472 _zVal = refAli->globalPosition().z(); 00473 align::GlobalVector vec(_xVal,_yVal,_zVal); 00474 _rVal = vec.perp(); 00475 _phiVal = vec.phi(); 00476 _etaVal = vec.eta(); 00477 align::RotationType rot = refAli->globalRotation(); 00478 align::EulerAngles eulerAngles = align::toAngles(rot); 00479 _alphaVal = eulerAngles[0]; 00480 _betaVal = eulerAngles[1]; 00481 _gammaVal = eulerAngles[2]; 00482 _dxVal = diff[0]; 00483 _dyVal = diff[1]; 00484 _dzVal = diff[2]; 00485 //getting dR and dPhi 00486 align::GlobalVector vRef(_xVal,_yVal,_zVal); 00487 align::GlobalVector vCur(_xVal - _dxVal, _yVal - _dyVal, _zVal - _dzVal); 00488 _drVal = vCur.perp() - vRef.perp(); 00489 _dphiVal = vCur.phi() - vRef.phi(); 00490 _dalphaVal = diff[3]; 00491 _dbetaVal = diff[4]; 00492 _dgammaVal = diff[5]; 00493 00494 //detIdFlag 00495 if (refAli->alignableObjectId() == align::AlignableDetUnit){ 00496 if (_detIdFlag){ 00497 if ((passIdCut(refAli->id()))||(passIdCut(refAli->mother()->id()))){ 00498 _useDetId = 1; 00499 } 00500 else{ 00501 _useDetId = 0; 00502 } 00503 } 00504 } 00505 // det module dimension 00506 if (refAli->alignableObjectId() == align::AlignableDetUnit){ 00507 if (refAli->mother()->alignableObjectId() != align::AlignableDet) _detDim = 1; 00508 else if (refAli->mother()->alignableObjectId() == align::AlignableDet) _detDim = 2; 00509 } 00510 else _detDim = 0; 00511 00512 00513 00514 00515 _surWidth = refAli->surface().width(); 00516 _surLength = refAli->surface().length(); 00517 align::RotationType rt = refAli->globalRotation(); 00518 _surRot[0] = rt.xx(); _surRot[1] = rt.xy(); _surRot[2] = rt.xz(); 00519 _surRot[3] = rt.yx(); _surRot[4] = rt.yy(); _surRot[5] = rt.yz(); 00520 _surRot[6] = rt.zx(); _surRot[7] = rt.zy(); _surRot[8] = rt.zz(); 00521 00522 00523 //Fill 00524 _alignTree->Fill(); 00525 00526 }
bool TrackerGeometryCompare::passIdCut | ( | uint32_t | id | ) | [private] |
Definition at line 614 of file TrackerGeometryCompare.cc.
References _detIdFlagVector, and i.
Referenced by fillTree().
00614 { 00615 00616 bool pass = false; 00617 int nEntries = _detIdFlagVector.size(); 00618 00619 for (int i = 0; i < nEntries; i++){ 00620 if (_detIdFlagVector[i] == id) pass = true; 00621 } 00622 00623 return pass; 00624 00625 }
void TrackerGeometryCompare::setCommonTrackerSystem | ( | ) | [private] |
Definition at line 364 of file TrackerGeometryCompare.cc.
References _commonTrackerLevel, _setCommonTrackerSystem, _TrackerCommonCM, _TrackerCommonR, _TrackerCommonT, currentTracker, diffCommonTrackerSystem(), dummy, Alignable::globalPosition(), align::moveAlignable(), TkRotation< T >::multiplyInverse(), AlignableObjectId::nameToType(), referenceTracker, rot, align::toMatrix(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by beginJob().
00364 { 00365 00366 edm::LogInfo("TrackerGeometryCompare") << "Setting Common Tracker System...."; 00367 00368 AlignableObjectId dummy; 00369 _commonTrackerLevel = dummy.nameToType(_setCommonTrackerSystem); 00370 00371 diffCommonTrackerSystem(referenceTracker, currentTracker); 00372 00373 align::RotationType rot = align::toMatrix( _TrackerCommonR ); 00374 align::GlobalVector theR = _TrackerCommonT; 00375 00376 //transform to the Tracker System 00377 align::PositionType trackerCM = currentTracker->globalPosition(); 00378 align::GlobalVector cmDiff( trackerCM.x()-_TrackerCommonCM.x(), trackerCM.y()-_TrackerCommonCM.y(), trackerCM.z()-_TrackerCommonCM.z() ); 00379 00380 //adjust translational difference factoring in different rotational CM 00381 //needed because rotateInGlobalFrame is about CM of alignable, not Tracker 00382 align::GlobalVector::BasicVectorType lpvgf = cmDiff.basicVector(); 00383 align::GlobalVector moveV( rot.multiplyInverse(lpvgf) - lpvgf); 00384 align::GlobalVector theRprime(theR + moveV); 00385 00386 AlgebraicVector TrackerCommonTR(6); 00387 TrackerCommonTR(1) = theRprime.x(); TrackerCommonTR(2) = theRprime.y(); TrackerCommonTR(3) = theRprime.z(); 00388 TrackerCommonTR(4) = _TrackerCommonR(1); TrackerCommonTR(5) = _TrackerCommonR(2); TrackerCommonTR(6) = _TrackerCommonR(3); 00389 00390 align::moveAlignable(currentTracker, TrackerCommonTR ); 00391 00392 }
void TrackerGeometryCompare::surveyToTracker | ( | AlignableTracker * | ali, | |
Alignments * | alignVals, | |||
AlignmentErrors * | alignErrors | |||
) | [private] |
Definition at line 528 of file TrackerGeometryCompare.cc.
References edmNew::copy(), AlignableTracker::endcapGeomDets(), i, AlignableTracker::innerBarrelGeomDets(), j, k, Alignments::m_align, AlignmentErrors::m_alignError, AlignableTracker::outerBarrelGeomDets(), AlignableTracker::pixelEndcapGeomDets(), AlignableTracker::pixelHalfBarrelGeomDets(), SurveyDet::position(), rot, SurveyDet::rotation(), python::multivaluedict::sort(), and AlignableTracker::TIDGeomDets().
00528 { 00529 00530 //getting the right alignables for the alignment record 00531 std::vector<Alignable*> detPB = ali->pixelHalfBarrelGeomDets(); 00532 std::vector<Alignable*> detPEC = ali->pixelEndcapGeomDets(); 00533 std::vector<Alignable*> detTIB = ali->innerBarrelGeomDets(); 00534 std::vector<Alignable*> detTID = ali->TIDGeomDets(); 00535 std::vector<Alignable*> detTOB = ali->outerBarrelGeomDets(); 00536 std::vector<Alignable*> detTEC = ali->endcapGeomDets(); 00537 00538 std::vector<Alignable*> allGeomDets; 00539 std::copy(detPB.begin(), detPB.end(), std::back_inserter(allGeomDets)); 00540 std::copy(detPEC.begin(), detPEC.end(), std::back_inserter(allGeomDets)); 00541 std::copy(detTIB.begin(), detTIB.end(), std::back_inserter(allGeomDets)); 00542 std::copy(detTID.begin(), detTID.end(), std::back_inserter(allGeomDets)); 00543 std::copy(detTOB.begin(), detTOB.end(), std::back_inserter(allGeomDets)); 00544 std::copy(detTEC.begin(), detTEC.end(), std::back_inserter(allGeomDets)); 00545 00546 std::vector<Alignable*> rcdAlis; 00547 for (std::vector<Alignable*>::iterator i = allGeomDets.begin(); i!= allGeomDets.end(); i++){ 00548 if ((*i)->components().size() == 1){ 00549 rcdAlis.push_back((*i)); 00550 } 00551 else if ((*i)->components().size() > 1){ 00552 rcdAlis.push_back((*i)); 00553 std::vector<Alignable*> comp = (*i)->components(); 00554 for (std::vector<Alignable*>::iterator j = comp.begin(); j != comp.end(); j++){ 00555 rcdAlis.push_back((*j)); 00556 } 00557 } 00558 } 00559 00560 //turning them into alignments 00561 for(std::vector<Alignable*>::iterator k = rcdAlis.begin(); k != rcdAlis.end(); k++){ 00562 00563 const SurveyDet* surveyInfo = (*k)->survey(); 00564 align::PositionType pos(surveyInfo->position()); 00565 align::RotationType rot(surveyInfo->rotation()); 00566 Hep3Vector clhepVector(pos.x(),pos.y(),pos.z()); 00567 HepRotation clhepRotation( HepRep3x3(rot.xx(),rot.xy(),rot.xz(),rot.yx(),rot.yy(),rot.yz(),rot.zx(),rot.zy(),rot.zz())); 00568 AlignTransform transform(clhepVector, clhepRotation, (*k)->id()); 00569 AlignTransformError transformError(HepSymMatrix(3,1), (*k)->id()); 00570 alignVals->m_align.push_back(transform); 00571 alignErrors->m_alignError.push_back(transformError); 00572 } 00573 00574 //to get the right order 00575 std::sort( alignVals->m_align.begin(), alignVals->m_align.end(), lessAlignmentDetId<AlignTransform>() ); 00576 std::sort( alignErrors->m_alignError.begin(), alignErrors->m_alignError.end(), lessAlignmentDetId<AlignTransformError>() ); 00577 00578 }
TTree* TrackerGeometryCompare::_alignTree [private] |
Definition at line 114 of file TrackerGeometryCompare.h.
Referenced by beginJob(), fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_alphaVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_betaVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
Definition at line 106 of file TrackerGeometryCompare.h.
Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().
float TrackerGeometryCompare::_dalphaVal [private] |
Definition at line 122 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dbetaVal [private] |
Definition at line 122 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_detDim [private] |
Definition at line 120 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
bool TrackerGeometryCompare::_detIdFlag [private] |
Definition at line 99 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_detIdFlagFile [private] |
std::vector< uint32_t > TrackerGeometryCompare::_detIdFlagVector [private] |
Definition at line 105 of file TrackerGeometryCompare.h.
Referenced by passIdCut(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dgammaVal [private] |
Definition at line 122 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dphiVal [private] |
Definition at line 122 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_drVal [private] |
Definition at line 122 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dxVal [private] |
Definition at line 122 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dyVal [private] |
Definition at line 122 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_dzVal [private] |
Definition at line 122 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_etaVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_filename [private] |
float TrackerGeometryCompare::_gammaVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_id [private] |
Definition at line 120 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
uint32_t TrackerGeometryCompare::_identifiers[6] [private] |
Definition at line 124 of file TrackerGeometryCompare.h.
Referenced by fillIdentifiers(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_inputFilename1 [private] |
Definition at line 93 of file TrackerGeometryCompare.h.
Referenced by createROOTGeometry(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_inputFilename2 [private] |
Definition at line 94 of file TrackerGeometryCompare.h.
Referenced by createROOTGeometry(), and TrackerGeometryCompare().
TFile* TrackerGeometryCompare::_inputRootFile1 [private] |
TFile* TrackerGeometryCompare::_inputRootFile2 [private] |
TTree* TrackerGeometryCompare::_inputTree1 [private] |
TTree* TrackerGeometryCompare::_inputTree2 [private] |
std::string TrackerGeometryCompare::_inputTreename [private] |
Definition at line 95 of file TrackerGeometryCompare.h.
Referenced by createROOTGeometry(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_level [private] |
Definition at line 120 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_mid [private] |
Definition at line 120 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_mlevel [private] |
Definition at line 120 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_phiVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_rVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_setCommonTrackerSystem [private] |
Definition at line 98 of file TrackerGeometryCompare.h.
Referenced by beginJob(), setCommonTrackerSystem(), and TrackerGeometryCompare().
int TrackerGeometryCompare::_sublevel [private] |
Definition at line 120 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_surLength [private] |
Definition at line 123 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
double TrackerGeometryCompare::_surRot[9] [private] |
Definition at line 125 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_surWidth [private] |
Definition at line 123 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
TFile* TrackerGeometryCompare::_theFile [private] |
Definition at line 113 of file TrackerGeometryCompare.h.
Referenced by beginJob(), and TrackerGeometryCompare().
Definition at line 109 of file TrackerGeometryCompare.h.
Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().
Definition at line 108 of file TrackerGeometryCompare.h.
Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().
Definition at line 107 of file TrackerGeometryCompare.h.
Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().
int TrackerGeometryCompare::_useDetId [private] |
Definition at line 120 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_weightBy [private] |
Definition at line 97 of file TrackerGeometryCompare.h.
Referenced by compareGeometries(), diffCommonTrackerSystem(), and TrackerGeometryCompare().
bool TrackerGeometryCompare::_weightById [private] |
Definition at line 101 of file TrackerGeometryCompare.h.
Referenced by compareGeometries(), diffCommonTrackerSystem(), and TrackerGeometryCompare().
std::string TrackerGeometryCompare::_weightByIdFile [private] |
std::vector< unsigned int > TrackerGeometryCompare::_weightByIdVector [private] |
Definition at line 103 of file TrackerGeometryCompare.h.
Referenced by compareGeometries(), diffCommonTrackerSystem(), and TrackerGeometryCompare().
bool TrackerGeometryCompare::_writeToDB [private] |
Definition at line 96 of file TrackerGeometryCompare.h.
Referenced by beginJob(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_xVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_yVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
float TrackerGeometryCompare::_zVal [private] |
Definition at line 121 of file TrackerGeometryCompare.h.
Referenced by fillTree(), and TrackerGeometryCompare().
Definition at line 86 of file TrackerGeometryCompare.h.
Referenced by beginJob(), createROOTGeometry(), and setCommonTrackerSystem().
Definition at line 85 of file TrackerGeometryCompare.h.
Definition at line 62 of file TrackerGeometryCompare.h.
Definition at line 84 of file TrackerGeometryCompare.h.
Referenced by beginJob(), createROOTGeometry(), and setCommonTrackerSystem().
std::vector<align::StructureType> TrackerGeometryCompare::theLevels [private] |
Definition at line 63 of file TrackerGeometryCompare.h.
Referenced by compareGeometries(), diffCommonTrackerSystem(), and TrackerGeometryCompare().
const SurveyErrors* TrackerGeometryCompare::theSurveyErrors [private] |
unsigned int TrackerGeometryCompare::theSurveyIndex [private] |
const Alignments* TrackerGeometryCompare::theSurveyValues [private] |