CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TrackerGeometryCompare Class Reference

#include <TrackerGeometryCompare.h>

Inheritance diagram for TrackerGeometryCompare:
edm::EDAnalyzer

Public Types

typedef std::vector< Alignable * > Alignables
 
typedef AlignTransform SurveyValue
 
typedef Alignments SurveyValues
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 Read from DB and print survey info. More...
 
 TrackerGeometryCompare (const edm::ParameterSet &)
 Do nothing. Required by framework. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

void addSurveyInfo (Alignable *ali)
 
void compareGeometries (Alignable *refAli, Alignable *curAli)
 
void createROOTGeometry (const edm::EventSetup &iSetup)
 
void diffCommonTrackerSystem (Alignable *refAli, Alignable *curAli)
 
void fillIdentifiers (int subdetlevel, int rawid)
 
void fillTree (Alignable *refAli, AlgebraicVector diff)
 
bool passIdCut (uint32_t)
 
void setCommonTrackerSystem ()
 
void surveyToTracker (AlignableTracker *ali, Alignments *alignVals, AlignmentErrors *alignErrors)
 

Private Attributes

TTree * _alignTree
 
float _alphaVal
 
float _betaVal
 
align::StructureType _commonTrackerLevel
 
float _dalphaVal
 
float _daVal
 
float _dbetaVal
 
float _dbVal
 
int _detDim
 
bool _detIdFlag
 
std::string _detIdFlagFile
 
std::vector< uint32_t > _detIdFlagVector
 
float _dgammaVal
 
float _dgVal
 
float _dphiVal
 
float _drVal
 
float _duVal
 
float _dvVal
 
float _dwVal
 
float _dxVal
 
float _dyVal
 
float _dzVal
 
float _etaVal
 
std::string _filename
 
float _gammaVal
 
int _id
 
uint32_t _identifiers [6]
 
std::string _inputFilename1
 
std::string _inputFilename2
 
TFile * _inputRootFile1
 
TFile * _inputRootFile2
 
TTree * _inputTree1
 
TTree * _inputTree2
 
std::string _inputTreename
 
int _level
 
int _mid
 
int _mlevel
 
float _phiVal
 
float _rVal
 
std::string _setCommonTrackerSystem
 
int _sublevel
 
float _surLength
 
double _surRot [9]
 
float _surWidth
 
TFile * _theFile
 
align::PositionType _TrackerCommonCM
 
align::GlobalVector _TrackerCommonR
 
align::GlobalVector _TrackerCommonT
 
int _useDetId
 
std::string _weightBy
 
bool _weightById
 
std::string _weightByIdFile
 
std::vector< unsigned int > _weightByIdVector
 
bool _writeToDB
 
float _xVal
 
float _yVal
 
float _zVal
 
AlignableTrackercurrentTracker
 
AlignableTrackerdummyTracker
 
bool firstEvent_
 
edm::ParameterSet m_params
 
AlignableTrackerreferenceTracker
 
std::vector< align::StructureTypetheLevels
 
const SurveyErrorstheSurveyErrors
 
unsigned int theSurveyIndex
 
const AlignmentstheSurveyValues
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Module that reads survey info from DB and prints them out.

Usage: module comparator = TrackerGeometryCompare {

lots of stuff

} path p = { comparator }

Date:
2009/07/24 13:48:19
Revision:
1.9
Author
Nhan Tran

Definition at line 35 of file TrackerGeometryCompare.h.

Member Typedef Documentation

Definition at line 41 of file TrackerGeometryCompare.h.

Definition at line 39 of file TrackerGeometryCompare.h.

Definition at line 40 of file TrackerGeometryCompare.h.

Constructor & Destructor Documentation

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(), ExpressReco_HICollisions_FallBack::id, prof2calltree::l, and theLevels.

53 {
54 
55  //input is ROOT
56  _inputFilename1 = cfg.getUntrackedParameter< std::string > ("inputROOTFile1");
57  _inputFilename2 = cfg.getUntrackedParameter< std::string > ("inputROOTFile2");
58  _inputTreename = cfg.getUntrackedParameter< std::string > ("treeName");
59 
60  //output file
61  _filename = cfg.getUntrackedParameter< std::string > ("outputFile");
62 
63  _writeToDB = cfg.getUntrackedParameter< bool > ("writeToDB" );
64 
65  const std::vector<std::string>& levels = cfg.getUntrackedParameter< std::vector<std::string> > ("levels");
66 
67  _weightBy = cfg.getUntrackedParameter< std::string > ("weightBy");
68  _setCommonTrackerSystem = cfg.getUntrackedParameter< std::string > ("setCommonTrackerSystem");
69  _detIdFlag = cfg.getUntrackedParameter< bool > ("detIdFlag");
70  _detIdFlagFile = cfg.getUntrackedParameter< std::string > ("detIdFlagFile");
71  _weightById = cfg.getUntrackedParameter< bool > ("weightById");
72  _weightByIdFile = cfg.getUntrackedParameter< std::string > ("weightByIdFile");
73 
74  //setting the levels being used in the geometry comparator
75  AlignableObjectId dummy;
76  edm::LogInfo("TrackerGeometryCompare") << "levels: " << levels.size();
77  for (unsigned int l = 0; l < levels.size(); ++l){
78  theLevels.push_back( dummy.nameToType(levels[l]));
79  edm::LogInfo("TrackerGeometryCompare") << "level: " << levels[l];
80  }
81 
82 
83  // if want to use, make id cut list
84  if (_detIdFlag){
85  ifstream fin;
86  fin.open( _detIdFlagFile.c_str() );
87 
88  while (!fin.eof() && fin.good() ){
89 
90  uint32_t id;
91  fin >> id;
92  _detIdFlagVector.push_back(id);
93  }
94  fin.close();
95  }
96 
97  // turn weightByIdFile into weightByIdVector
98  if (_weightById){
99  std::ifstream inFile;
100  inFile.open( _weightByIdFile.c_str() );
101  int ctr = 0;
102  while ( !inFile.eof() ){
103  ctr++;
104  unsigned int listId;
105  inFile >> listId;
106  inFile.ignore(256, '\n');
107 
108  _weightByIdVector.push_back( listId );
109  }
110  inFile.close();
111  }
112 
113 
114  //root configuration
115  _theFile = new TFile(_filename.c_str(),"RECREATE");
116  _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");
117  _alignTree->Branch("id", &_id, "id/I");
118  _alignTree->Branch("level", &_level, "level/I");
119  _alignTree->Branch("mid", &_mid, "mid/I");
120  _alignTree->Branch("mlevel", &_mlevel, "mlevel/I");
121  _alignTree->Branch("sublevel", &_sublevel, "sublevel/I");
122  _alignTree->Branch("x", &_xVal, "x/F");
123  _alignTree->Branch("y", &_yVal, "y/F");
124  _alignTree->Branch("z", &_zVal, "z/F");
125  _alignTree->Branch("r", &_rVal, "r/F");
126  _alignTree->Branch("phi", &_phiVal, "phi/F");
127  _alignTree->Branch("eta", &_etaVal, "eta/F");
128  _alignTree->Branch("alpha", &_alphaVal, "alpha/F");
129  _alignTree->Branch("beta", &_betaVal, "beta/F");
130  _alignTree->Branch("gamma", &_gammaVal, "gamma/F");
131  _alignTree->Branch("dx", &_dxVal, "dx/F");
132  _alignTree->Branch("dy", &_dyVal, "dy/F");
133  _alignTree->Branch("dz", &_dzVal, "dz/F");
134  _alignTree->Branch("dr", &_drVal, "dr/F");
135  _alignTree->Branch("dphi", &_dphiVal, "dphi/F");
136  _alignTree->Branch("dalpha", &_dalphaVal, "dalpha/F");
137  _alignTree->Branch("dbeta", &_dbetaVal, "dbeta/F");
138  _alignTree->Branch("dgamma", &_dgammaVal, "dgamma/F");
139  _alignTree->Branch("du", &_duVal, "du/F");
140  _alignTree->Branch("dv", &_dvVal, "dv/F");
141  _alignTree->Branch("dw", &_dwVal, "dw/F");
142  _alignTree->Branch("da", &_daVal, "da/F");
143  _alignTree->Branch("db", &_dbVal, "db/F");
144  _alignTree->Branch("dg", &_dgVal, "dg/F");
145  _alignTree->Branch("useDetId", &_useDetId, "useDetId/I");
146  _alignTree->Branch("detDim", &_detDim, "detDim/I");
147  _alignTree->Branch("surW", &_surWidth, "surW/F");
148  _alignTree->Branch("surL", &_surLength, "surL/F");
149  _alignTree->Branch("surRot", &_surRot, "surRot[9]/D");
150  _alignTree->Branch("identifiers", &_identifiers, "identifiers[6]/I");
151 
152 
153 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< align::StructureType > theLevels
std::vector< uint32_t > _detIdFlagVector
Allows conversion between type and name, and vice-versa.
std::vector< unsigned int > _weightByIdVector

Member Function Documentation

void TrackerGeometryCompare::addSurveyInfo ( Alignable ali)
private

Definition at line 617 of file TrackerGeometryCompare.cc.

References Alignable::alignableObjectId(), Alignable::components(), error, edm::hlt::Exception, Alignable::geomDetId(), i, AlignableSurface::length(), Alignments::m_align, SurveyErrors::m_surveyErrors, SurveyError::matrix(), pos, SurveyError::rawId(), DetId::rawId(), AlignableSurface::setLength(), Alignable::setSurvey(), AlignableSurface::setWidth(), SurveyError::structureType(), Alignable::surface(), theSurveyErrors, theSurveyIndex, theSurveyValues, and AlignableSurface::width().

617  {
618 
619  const std::vector<Alignable*>& comp = ali->components();
620 
621  unsigned int nComp = comp.size();
622 
623  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo(comp[i]);
624 
626 
627  if ( ali->geomDetId().rawId() != error.rawId() ||
628  ali->alignableObjectId() != error.structureType() )
629  {
630  throw cms::Exception("DatabaseError")
631  << "Error reading survey info from DB. Mismatched id!";
632  }
633 
634  const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[theSurveyIndex].translation();
635  const CLHEP::HepRotation& rot = theSurveyValues->m_align[theSurveyIndex].rotation();
636 
637  AlignableSurface surf( align::PositionType( pos.x(), pos.y(), pos.z() ),
638  align::RotationType( rot.xx(), rot.xy(), rot.xz(),
639  rot.yx(), rot.yy(), rot.yz(),
640  rot.zx(), rot.zy(), rot.zz() ) );
641 
642  surf.setWidth( ali->surface().width() );
643  surf.setLength( ali->surface().length() );
644 
645  ali->setSurvey( new SurveyDet( surf, error.matrix() ) );
646 
647  ++theSurveyIndex;
648 
649 }
align::Scalar width() const
int i
Definition: DBlmapReader.cc:9
ErrorMatrix matrix() const
Definition: SurveyError.h:72
const Alignments * theSurveyValues
void addSurveyInfo(Alignable *ali)
uint8_t structureType() const
Definition: SurveyError.h:62
virtual Alignables components() const =0
Return vector of all direct components.
std::vector< AlignTransform > m_align
Definition: Alignments.h:14
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
align::ID rawId() const
Definition: SurveyError.h:67
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
align::Scalar length() const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:243
const SurveyErrors * theSurveyErrors
std::vector< SurveyError > m_surveyErrors
Definition: SurveyErrors.h:21
const DetId & geomDetId() const
Definition: Alignable.h:177
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(), cond::service::PoolDBOutputService::beginOfTime(), compareGeometries(), createROOTGeometry(), currentTracker, firstEvent_, edm::Service< T >::isAvailable(), referenceTracker, setCommonTrackerSystem(), and cond::service::PoolDBOutputService::writeOne().

159  {
160 
161  if (firstEvent_) {
162 
163  //upload the ROOT geometries
164  createROOTGeometry(iSetup);
165 
166  //set common tracker system first
167  // if setting the tracker common system
168  if (_setCommonTrackerSystem != "NONE"){
170  }
171 
172 
173  //compare the goemetries
175 
176  //write out ntuple
177  //might be better to do within output module
178  _theFile->cd();
179  _alignTree->Write();
180  _theFile->Close();
181 
182 
183  if (_writeToDB){
184  Alignments* myAlignments = currentTracker->alignments();
185  AlignmentErrors* myAlignmentErrors = currentTracker->alignmentErrors();
186 
187  // 2. Store alignment[Error]s to DB
189  // Call service
190  if( !poolDbService.isAvailable() ) // Die if not available
191  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
192 
193  poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), "TrackerAlignmentRcd");
194  poolDbService->writeOne<AlignmentErrors>(&(*myAlignmentErrors), poolDbService->beginOfTime(), "TrackerAlignmentErrorRcd");
195 
196  }
197 
198  firstEvent_ = false;
199  }
200 }
void compareGeometries(Alignable *refAli, Alignable *curAli)
bool isAvailable() const
Definition: Service.h:47
AlignmentErrors * alignmentErrors() const
Return alignment errors, sorted by DetId.
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
AlignableTracker * currentTracker
AlignableTracker * referenceTracker
void createROOTGeometry(const edm::EventSetup &iSetup)
Alignments * alignments() const
Return alignments, sorted by DetId.
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_.

155  {
156  firstEvent_ = true;
157 }
void TrackerGeometryCompare::compareGeometries ( Alignable refAli,
Alignable curAli 
)
private

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(), ExpressReco_HICollisions_FallBack::e, edm::hlt::Exception, fillTree(), Alignable::geomDetId(), i, Alignable::id(), PV3DBase< T, PVType, FrameType >::mag(), align::moveAlignable(), DetId::rawId(), and theLevels.

Referenced by analyze().

310  {
311 
312  const std::vector<Alignable*>& refComp = refAli->components();
313  const std::vector<Alignable*>& curComp = curAli->components();
314 
315  unsigned int nComp = refComp.size();
316  //only perform for designate levels
317  bool useLevel = false;
318  for (unsigned int i = 0; i < theLevels.size(); ++i){
319  if (refAli->alignableObjectId() == theLevels[i]) useLevel = true;
320  }
321 
322  //another added level for difference between det and detunit
323  //if ((refAli->alignableObjectId()==2)&&(nComp == 1)) useLevel = false;
324 
325  //coordinate matching, etc etc
326  if (useLevel){
327  //std::cout << "ali identifiers: " << refAli->id() << ", " << refAli->alignableObjectId() << std::endl;
328  //std::cout << "diff pos" << (refAli->globalPosition() - curAli->globalPosition()) << std::endl;
329  //std::cout <<"z";
330 
331  CLHEP::Hep3Vector Rtotal, Wtotal, lRtotal, lWtotal;
332 
333  Rtotal.set(0.,0.,0.); Wtotal.set(0.,0.,0.);
334  lRtotal.set(0.,0.,0.); lWtotal.set(0.,0.,0.);
335  for (int i = 0; i < 100; i++){
337  CLHEP::Hep3Vector dR(diff[0],diff[1],diff[2]);
338  Rtotal+=dR;
339  CLHEP::Hep3Vector dW(diff[3],diff[4],diff[5]);
340  CLHEP::HepRotation rot(Wtotal.unit(),Wtotal.mag());
341  CLHEP::HepRotation drot(dW.unit(),dW.mag());
342  rot*=drot;
343  Wtotal.set(rot.axis().x()*rot.delta(), rot.axis().y()*rot.delta(), rot.axis().z()*rot.delta());
344  // local coordinates
345  lRtotal.set(diff[6],diff[7],diff[8]);
346  lWtotal.set(diff[9],diff[10],diff[11]);
347  //std::cout << "a";
348  //if (refAli->alignableObjectId() == 1) std::cout << "DIFF: " << diff << std::endl;
349  align::moveAlignable(curAli, diff);
350  float tolerance = 1e-7;
352  align::GlobalVector checkR(check[0],check[1],check[2]);
353  align::GlobalVector checkW(check[3],check[4],check[5]);
354  DetId detid(refAli->id());
355  if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){
356  edm::LogInfo("TrackerGeometryCompare") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId()
357  << ", rawId: " << refAli->geomDetId().rawId()
358  << ", subdetId: "<< detid.subdetId() << "): " << diff;
359  throw cms::Exception("Tolerance in TrackerGeometryCompare exceeded");
360  }
361  else{
362  break;
363  }
364  }
365 
366  AlgebraicVector TRtot(12);
367  // global
368  TRtot(1) = Rtotal.x(); TRtot(2) = Rtotal.y(); TRtot(3) = Rtotal.z();
369  TRtot(4) = Wtotal.x(); TRtot(5) = Wtotal.y(); TRtot(6) = Wtotal.z();
370  // local
371  TRtot(7) = lRtotal.x(); TRtot(8) = lRtotal.y(); TRtot(9) = lRtotal.z();
372  TRtot(10) = lWtotal.x(); TRtot(11) = lWtotal.y(); TRtot(12) = lWtotal.z();
373  fillTree(refAli, TRtot);
374  }
375 
376  //another added level for difference between det and detunit
377  for (unsigned int i = 0; i < nComp; ++i)
378  compareGeometries(refComp[i],curComp[i]);
379 }
void compareGeometries(Alignable *refAli, Alignable *curAli)
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
int i
Definition: DBlmapReader.cc:9
std::vector< align::StructureType > theLevels
AlgebraicVector diffAlignables(Alignable *refAli, Alignable *curAli, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
Definition: AlignTools.cc:10
virtual Alignables components() const =0
Return vector of all direct components.
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
void fillTree(Alignable *refAli, AlgebraicVector diff)
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
Definition: DetId.h:20
CLHEP::HepVector AlgebraicVector
std::vector< unsigned int > _weightByIdVector
void moveAlignable(Alignable *ali, AlgebraicVector diff)
Moves the alignable by the AlgebraicVector.
Definition: AlignTools.cc:81
const DetId & geomDetId() const
Definition: Alignable.h:177
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().

202  {
203 
204  int inputRawId1, inputRawId2;
205  double inputX1, inputY1, inputZ1, inputX2, inputY2, inputZ2;
206  double inputAlpha1, inputBeta1, inputGamma1, inputAlpha2, inputBeta2, inputGamma2;
207 
208  //declare alignments
209  Alignments* alignments1 = new Alignments();
210  AlignmentErrors* alignmentErrors1 = new AlignmentErrors();
211  if (_inputFilename1 != "IDEAL"){
212  _inputRootFile1 = new TFile(_inputFilename1.c_str());
213  TTree* _inputTree1 = (TTree*) _inputRootFile1->Get(_inputTreename.c_str());
214  _inputTree1->SetBranchAddress("rawid", &inputRawId1);
215  _inputTree1->SetBranchAddress("x", &inputX1);
216  _inputTree1->SetBranchAddress("y", &inputY1);
217  _inputTree1->SetBranchAddress("z", &inputZ1);
218  _inputTree1->SetBranchAddress("alpha", &inputAlpha1);
219  _inputTree1->SetBranchAddress("beta", &inputBeta1);
220  _inputTree1->SetBranchAddress("gamma", &inputGamma1);
221 
222  int nEntries1 = _inputTree1->GetEntries();
223  //fill alignments
224  for (int i = 0; i < nEntries1; ++i){
225 
226  _inputTree1->GetEntry(i);
227  CLHEP::Hep3Vector translation1(inputX1, inputY1, inputZ1);
228  CLHEP::HepEulerAngles eulerangles1(inputAlpha1,inputBeta1,inputGamma1);
229  uint32_t detid1 = inputRawId1;
230  AlignTransform transform1(translation1, eulerangles1, detid1);
231  alignments1->m_align.push_back(transform1);
232 
233  //dummy errors
234  CLHEP::HepSymMatrix clhepSymMatrix(3,0);
235  AlignTransformError transformError(clhepSymMatrix, detid1);
236  alignmentErrors1->m_alignError.push_back(transformError);
237  }
238 
239  // to get the right order
240  std::sort( alignments1->m_align.begin(), alignments1->m_align.end(), lessAlignmentDetId<AlignTransform>() );
241  std::sort( alignmentErrors1->m_alignError.begin(), alignmentErrors1->m_alignError.end(), lessAlignmentDetId<AlignTransformError>() );
242  }
243  //------------------
244  Alignments* alignments2 = new Alignments();
245  AlignmentErrors* alignmentErrors2 = new AlignmentErrors();
246  if (_inputFilename2 != "IDEAL"){
247  _inputRootFile2 = new TFile(_inputFilename2.c_str());
248  TTree* _inputTree2 = (TTree*) _inputRootFile2->Get(_inputTreename.c_str());
249  _inputTree2->SetBranchAddress("rawid", &inputRawId2);
250  _inputTree2->SetBranchAddress("x", &inputX2);
251  _inputTree2->SetBranchAddress("y", &inputY2);
252  _inputTree2->SetBranchAddress("z", &inputZ2);
253  _inputTree2->SetBranchAddress("alpha", &inputAlpha2);
254  _inputTree2->SetBranchAddress("beta", &inputBeta2);
255  _inputTree2->SetBranchAddress("gamma", &inputGamma2);
256 
257  int nEntries2 = _inputTree2->GetEntries();
258  //fill alignments
259  for (int i = 0; i < nEntries2; ++i){
260 
261  _inputTree2->GetEntry(i);
262  CLHEP::Hep3Vector translation2(inputX2, inputY2, inputZ2);
263  CLHEP::HepEulerAngles eulerangles2(inputAlpha2,inputBeta2,inputGamma2);
264  uint32_t detid2 = inputRawId2;
265  AlignTransform transform2(translation2, eulerangles2, detid2);
266  alignments2->m_align.push_back(transform2);
267 
268  //dummy errors
269  CLHEP::HepSymMatrix clhepSymMatrix(3,0);
270  AlignTransformError transformError(clhepSymMatrix, detid2);
271  alignmentErrors2->m_alignError.push_back(transformError);
272  }
273 
274  //to get the right order
275  std::sort( alignments2->m_align.begin(), alignments2->m_align.end(), lessAlignmentDetId<AlignTransform>() );
276  std::sort( alignmentErrors2->m_alignError.begin(), alignmentErrors2->m_alignError.end(), lessAlignmentDetId<AlignTransformError>() );
277  }
278 
279  //accessing the initial geometry
281  iSetup.get<IdealGeometryRecord>().get(cpv);
282  edm::ESHandle<GeometricDet> theGeometricDet;
283  iSetup.get<IdealGeometryRecord>().get(theGeometricDet);
284  TrackerGeomBuilderFromGeometricDet trackerBuilder;
285 
286  edm::ESHandle<Alignments> globalPositionRcd;
287  iSetup.get<TrackerDigiGeometryRecord>().getRecord<GlobalPositionRcd>().get(globalPositionRcd);
288 
289  //reference tracker
290  TrackerGeometry* theRefTracker = trackerBuilder.build(&*theGeometricDet);
291  if (_inputFilename1 != "IDEAL"){
292  GeometryAligner aligner1;
293  aligner1.applyAlignments<TrackerGeometry>( &(*theRefTracker), &(*alignments1), &(*alignmentErrors1),
294  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)));
295  }
296  referenceTracker = new AlignableTracker(&(*theRefTracker));
297 
298  //currernt tracker
299  TrackerGeometry* theCurTracker = trackerBuilder.build(&*theGeometricDet);
300  if (_inputFilename2 != "IDEAL"){
301  GeometryAligner aligner2;
302  aligner2.applyAlignments<TrackerGeometry>( &(*theCurTracker), &(*alignments2), &(*alignmentErrors2),
303  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)));
304  }
305  currentTracker = new AlignableTracker(&(*theCurTracker));
306 
307 
308 }
int i
Definition: DBlmapReader.cc:9
Class to update a given geometry with a set of alignments.
std::vector< AlignTransformError > m_alignError
std::vector< AlignTransform > m_align
Definition: Alignments.h:14
void get(HolderT &iHolder) const
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
Definition: DetId.h:20
AlignableTracker * currentTracker
const T & get() const
Definition: EventSetup.h:55
TrackerGeometry * build(const GeometricDet *gd)
AlignableTracker * referenceTracker
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
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().

418  {
419 
420  const std::vector<Alignable*>& refComp = refAli->components();
421  const std::vector<Alignable*>& curComp = curAli->components();
422 
423  unsigned int nComp = refComp.size();
424  //only perform for designate levels
425  bool useLevel = false;
426  if (refAli->alignableObjectId() == _commonTrackerLevel) useLevel = true;
427 
428  //useLevel = false;
429  if (useLevel){
430  CLHEP::Hep3Vector Rtotal, Wtotal;
431  Rtotal.set(0.,0.,0.); Wtotal.set(0.,0.,0.);
432 
434  CLHEP::Hep3Vector dR(diff[0],diff[1],diff[2]);
435  Rtotal+=dR;
436  CLHEP::Hep3Vector dW(diff[3],diff[4],diff[5]);
437  CLHEP::HepRotation rot(Wtotal.unit(),Wtotal.mag());
438  CLHEP::HepRotation drot(dW.unit(),dW.mag());
439  rot*=drot;
440  Wtotal.set(rot.axis().x()*rot.delta(), rot.axis().y()*rot.delta(), rot.axis().z()*rot.delta());
441  /*
442  //std::cout << "a";
443  //if (refAli->alignableObjectId() == 1) std::cout << "DIFF: " << diff << std::endl;
444  align::moveAlignable(curAli, diff);
445  float tolerance = 1e-7;
446  AlgebraicVector check = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector);
447  align::GlobalVector checkR(check[0],check[1],check[2]);
448  align::GlobalVector checkW(check[3],check[4],check[5]);
449  DetId detid(refAli->id());
450  if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){
451  edm::LogInfo("TrackerGeometryCompare") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId()
452  << ", rawId: " << refAli->geomDetId().rawId()
453  << ", subdetId: "<< detid.subdetId() << "): " << diff;
454  }
455  else{
456  break;
457  }
458  }
459  */
460 
461  //_TrackerCommonT.set(Rtotal.x(), Rtotal.y(), Rtotal.z());
462  _TrackerCommonT = align::GlobalVector(Rtotal.x(), Rtotal.y(), Rtotal.z());
463  _TrackerCommonR = align::GlobalVector(Wtotal.x(), Wtotal.y(), Wtotal.z());
464  _TrackerCommonCM = curAli->globalPosition();
465  //_TrackerCommonTR(1) = Rtotal.x(); _TrackerCommonTR(2) = Rtotal.y(); _TrackerCommonTR(3) = Rtotal.z();
466  //_TrackerCommonTR(4) = Wtotal.x(); _TrackerCommonTR(5) = Wtotal.y(); _TrackerCommonTR(6) = Wtotal.z();
467 
468 
469  }
470  else{
471  for (unsigned int i = 0; i < nComp; ++i) diffCommonTrackerSystem(refComp[i],curComp[i]);
472  }
473 
474 
475 }
int i
Definition: DBlmapReader.cc:9
align::GlobalVector _TrackerCommonR
Vector3DBase< Scalar, GlobalTag > GlobalVector
Definition: Definitions.h:33
align::GlobalVector _TrackerCommonT
AlgebraicVector diffAlignables(Alignable *refAli, Alignable *curAli, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
Definition: AlignTools.cc:10
void diffCommonTrackerSystem(Alignable *refAli, Alignable *curAli)
virtual Alignables components() const =0
Return vector of all direct components.
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
align::StructureType _commonTrackerLevel
align::PositionType _TrackerCommonCM
CLHEP::HepVector AlgebraicVector
std::vector< unsigned int > _weightByIdVector
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:129
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(), PXBDetId::layer(), TOBDetId::layer(), TIBDetId::layer(), PXBDetId::module(), PXFDetId::module(), TOBDetId::module(), TIBDetId::module(), TIDDetId::module(), TECDetId::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().

664  {
665 
666 
667  switch( subdetlevel ){
668 
669  case 1:
670  {
671  PXBDetId pxbid( rawid );
672  _identifiers[0] = pxbid.module();
673  _identifiers[1] = pxbid.ladder();
674  _identifiers[2] = pxbid.layer();
675  _identifiers[3] = 999;
676  _identifiers[4] = 999;
677  _identifiers[5] = 999;
678  break;
679  }
680  case 2:
681  {
682  PXFDetId pxfid( rawid );
683  _identifiers[0] = pxfid.module();
684  _identifiers[1] = pxfid.panel();
685  _identifiers[2] = pxfid.blade();
686  _identifiers[3] = pxfid.disk();
687  _identifiers[4] = pxfid.side();
688  _identifiers[5] = 999;
689  break;
690  }
691  case 3:
692  {
693  TIBDetId tibid( rawid );
694  _identifiers[0] = tibid.module();
695  _identifiers[1] = tibid.string()[0];
696  _identifiers[2] = tibid.string()[1];
697  _identifiers[3] = tibid.string()[2];
698  _identifiers[4] = tibid.layer();
699  _identifiers[5] = 999;
700  break;
701  }
702  case 4:
703  {
704  TIDDetId tidid( rawid );
705  _identifiers[0] = tidid.module()[0];
706  _identifiers[1] = tidid.module()[1];
707  _identifiers[2] = tidid.ring();
708  _identifiers[3] = tidid.wheel();
709  _identifiers[4] = tidid.side();
710  _identifiers[5] = 999;
711  break;
712  }
713  case 5:
714  {
715  TOBDetId tobid( rawid );
716  _identifiers[0] = tobid.module();
717  _identifiers[1] = tobid.rod()[0];
718  _identifiers[2] = tobid.rod()[1];
719  _identifiers[3] = tobid.layer();
720  _identifiers[4] = 999;
721  _identifiers[5] = 999;
722  break;
723  }
724  case 6:
725  {
726  TECDetId tecid( rawid );
727  _identifiers[0] = tecid.module();
728  _identifiers[1] = tecid.ring();
729  _identifiers[2] = tecid.petal()[0];
730  _identifiers[3] = tecid.petal()[1];
731  _identifiers[4] = tecid.wheel();
732  _identifiers[5] = tecid.side();
733  break;
734  }
735  default:
736  {
737  std::cout << "Error: bad subdetid!!" << std::endl;
738  break;
739  }
740 
741  }
742 }
tuple cout
Definition: gather_cfg.py:41
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(), PV3DBase< T, PVType, FrameType >::x(), TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), PV3DBase< T, PVType, FrameType >::y(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), PV3DBase< T, PVType, FrameType >::z(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().

Referenced by compareGeometries().

477  {
478 
479 
480  _id = refAli->id();
481  _level = refAli->alignableObjectId();
482  //need if ali has no mother
483  if (refAli->mother()){
484  _mid = refAli->mother()->geomDetId().rawId();
485  _mlevel = refAli->mother()->alignableObjectId();
486  }
487  else{
488  _mid = -1;
489  _mlevel = -1;
490  }
491  DetId detid(_id);
492  _sublevel = detid.subdetId();
494  _xVal = refAli->globalPosition().x();
495  _yVal = refAli->globalPosition().y();
496  _zVal = refAli->globalPosition().z();
498  _rVal = vec.perp();
499  _phiVal = vec.phi();
500  _etaVal = vec.eta();
501  align::RotationType rot = refAli->globalRotation();
502  align::EulerAngles eulerAngles = align::toAngles(rot);
503  _alphaVal = eulerAngles[0];
504  _betaVal = eulerAngles[1];
505  _gammaVal = eulerAngles[2];
506  // global
507  _dxVal = diff[0];
508  _dyVal = diff[1];
509  _dzVal = diff[2];
510  // local
511  _duVal = diff[6];
512  _dvVal = diff[7];
513  _dwVal = diff[8];
514  //...TODO...
516  align::LocalVector l = refAli->surface().toLocal(g);
517  //getting dR and dPhi
520  _drVal = vCur.perp() - vRef.perp();
521  _dphiVal = vCur.phi() - vRef.phi();
522  // global
523  _dalphaVal = diff[3];
524  _dbetaVal = diff[4];
525  _dgammaVal = diff[5];
526  // local
527  _daVal = diff[9];
528  _dbVal = diff[10];
529  _dgVal = diff[11];
530 
531  //detIdFlag
532  if (refAli->alignableObjectId() == align::AlignableDetUnit){
533  if (_detIdFlag){
534  if ((passIdCut(refAli->id()))||(passIdCut(refAli->mother()->id()))){
535  _useDetId = 1;
536  }
537  else{
538  _useDetId = 0;
539  }
540  }
541  }
542  // det module dimension
543  if (refAli->alignableObjectId() == align::AlignableDetUnit){
544  if (refAli->mother()->alignableObjectId() != align::AlignableDet) _detDim = 1;
545  else if (refAli->mother()->alignableObjectId() == align::AlignableDet) _detDim = 2;
546  }
547  else _detDim = 0;
548 
549 
550 
551 
552  _surWidth = refAli->surface().width();
553  _surLength = refAli->surface().length();
554  align::RotationType rt = refAli->globalRotation();
555  _surRot[0] = rt.xx(); _surRot[1] = rt.xy(); _surRot[2] = rt.xz();
556  _surRot[3] = rt.yx(); _surRot[4] = rt.yy(); _surRot[5] = rt.yz();
557  _surRot[6] = rt.zx(); _surRot[7] = rt.zy(); _surRot[8] = rt.zz();
558 
559 
560  //Fill
561  _alignTree->Fill();
562 
563 }
T xx() const
align::Scalar width() const
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
T y() const
Definition: PV3DBase.h:57
T yx() const
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:132
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
T zx() const
T xy() const
T zz() const
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
T z() const
Definition: PV3DBase.h:58
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
T zy() const
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:7
T yy() const
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
Definition: DetId.h:20
AlgebraicVector EulerAngles
Definition: Definitions.h:36
align::Scalar length() const
void fillIdentifiers(int subdetlevel, int rawid)
T xz() const
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:129
T x() const
Definition: PV3DBase.h:56
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:85
T yz() const
const DetId & geomDetId() const
Definition: Alignable.h:177
bool TrackerGeometryCompare::passIdCut ( uint32_t  id)
private

Definition at line 651 of file TrackerGeometryCompare.cc.

References _detIdFlagVector, and i.

Referenced by fillTree().

651  {
652 
653  bool pass = false;
654  int nEntries = _detIdFlagVector.size();
655 
656  for (int i = 0; i < nEntries; i++){
657  if (_detIdFlagVector[i] == id) pass = true;
658  }
659 
660  return pass;
661 
662 }
int i
Definition: DBlmapReader.cc:9
std::vector< uint32_t > _detIdFlagVector
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().

381  {
382 
383  edm::LogInfo("TrackerGeometryCompare") << "Setting Common Tracker System....";
384 
385  AlignableObjectId dummy;
387 
389 
390  align::EulerAngles dOmega(3); dOmega[0] = _TrackerCommonR.x() ; dOmega[1] = _TrackerCommonR.y(); dOmega[2] = _TrackerCommonR.z();
391  align::RotationType rot = align::toMatrix( dOmega );
393 
394  std::cout << "what we get from overlaying the pixels..." << theR << ", " << rot << std::endl;
395 
396  //transform to the Tracker System
398  align::GlobalVector cmDiff( trackerCM.x()-_TrackerCommonCM.x(), trackerCM.y()-_TrackerCommonCM.y(), trackerCM.z()-_TrackerCommonCM.z() );
399 
400  std::cout << "Pixel CM: " << _TrackerCommonCM << ", tracker CM: " << trackerCM << std::endl;
401 
402  //adjust translational difference factoring in different rotational CM
403  //needed because rotateInGlobalFrame is about CM of alignable, not Tracker
404  align::GlobalVector::BasicVectorType lpvgf = cmDiff.basicVector();
405  align::GlobalVector moveV( rot.multiplyInverse(lpvgf) - lpvgf);
406  align::GlobalVector theRprime(theR + moveV);
407 
408  AlgebraicVector TrackerCommonTR(6);
409  TrackerCommonTR(1) = theRprime.x(); TrackerCommonTR(2) = theRprime.y(); TrackerCommonTR(3) = theRprime.z();
410  TrackerCommonTR(4) = _TrackerCommonR.x(); TrackerCommonTR(5) = _TrackerCommonR.y(); TrackerCommonTR(6) = _TrackerCommonR.z();
411 
412  std::cout << "and after the transformation: " << TrackerCommonTR << std::endl;
413 
414  align::moveAlignable(currentTracker, TrackerCommonTR );
415 
416 }
align::GlobalVector _TrackerCommonR
align::GlobalVector _TrackerCommonT
T y() const
Definition: PV3DBase.h:57
void diffCommonTrackerSystem(Alignable *refAli, Alignable *curAli)
T z() const
Definition: PV3DBase.h:58
Allows conversion between type and name, and vice-versa.
const align::StructureType nameToType(const std::string &name) const
Convert name to type.
align::StructureType _commonTrackerLevel
align::PositionType _TrackerCommonCM
CLHEP::HepVector AlgebraicVector
AlgebraicVector EulerAngles
Definition: Definitions.h:36
AlignableTracker * currentTracker
AlignableTracker * referenceTracker
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:40
tuple cout
Definition: gather_cfg.py:41
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:129
Basic3DVector< T > multiplyInverse(const Basic3DVector< T > &v) const
T x() const
Definition: PV3DBase.h:56
void moveAlignable(Alignable *ali, AlgebraicVector diff)
Moves the alignable by the AlgebraicVector.
Definition: AlignTools.cc:81
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().

565  {
566 
567  //getting the right alignables for the alignment record
568  std::vector<Alignable*> detPB = ali->pixelHalfBarrelGeomDets();
569  std::vector<Alignable*> detPEC = ali->pixelEndcapGeomDets();
570  std::vector<Alignable*> detTIB = ali->innerBarrelGeomDets();
571  std::vector<Alignable*> detTID = ali->TIDGeomDets();
572  std::vector<Alignable*> detTOB = ali->outerBarrelGeomDets();
573  std::vector<Alignable*> detTEC = ali->endcapGeomDets();
574 
575  std::vector<Alignable*> allGeomDets;
576  std::copy(detPB.begin(), detPB.end(), std::back_inserter(allGeomDets));
577  std::copy(detPEC.begin(), detPEC.end(), std::back_inserter(allGeomDets));
578  std::copy(detTIB.begin(), detTIB.end(), std::back_inserter(allGeomDets));
579  std::copy(detTID.begin(), detTID.end(), std::back_inserter(allGeomDets));
580  std::copy(detTOB.begin(), detTOB.end(), std::back_inserter(allGeomDets));
581  std::copy(detTEC.begin(), detTEC.end(), std::back_inserter(allGeomDets));
582 
583  std::vector<Alignable*> rcdAlis;
584  for (std::vector<Alignable*>::iterator i = allGeomDets.begin(); i!= allGeomDets.end(); i++){
585  if ((*i)->components().size() == 1){
586  rcdAlis.push_back((*i));
587  }
588  else if ((*i)->components().size() > 1){
589  rcdAlis.push_back((*i));
590  std::vector<Alignable*> comp = (*i)->components();
591  for (std::vector<Alignable*>::iterator j = comp.begin(); j != comp.end(); j++){
592  rcdAlis.push_back((*j));
593  }
594  }
595  }
596 
597  //turning them into alignments
598  for(std::vector<Alignable*>::iterator k = rcdAlis.begin(); k != rcdAlis.end(); k++){
599 
600  const SurveyDet* surveyInfo = (*k)->survey();
601  align::PositionType pos(surveyInfo->position());
602  align::RotationType rot(surveyInfo->rotation());
603  CLHEP::Hep3Vector clhepVector(pos.x(),pos.y(),pos.z());
604  CLHEP::HepRotation clhepRotation( CLHEP::HepRep3x3(rot.xx(),rot.xy(),rot.xz(),rot.yx(),rot.yy(),rot.yz(),rot.zx(),rot.zy(),rot.zz()));
605  AlignTransform transform(clhepVector, clhepRotation, (*k)->id());
606  AlignTransformError transformError(CLHEP::HepSymMatrix(3,1), (*k)->id());
607  alignVals->m_align.push_back(transform);
608  alignErrors->m_alignError.push_back(transformError);
609  }
610 
611  //to get the right order
612  std::sort( alignVals->m_align.begin(), alignVals->m_align.end(), lessAlignmentDetId<AlignTransform>() );
613  std::sort( alignErrors->m_alignError.begin(), alignErrors->m_alignError.end(), lessAlignmentDetId<AlignTransformError>() );
614 
615 }
int i
Definition: DBlmapReader.cc:9
Alignables & pixelHalfBarrelGeomDets()
Return pixel barrel GeomDets.
std::vector< AlignTransformError > m_alignError
std::vector< AlignTransform > m_align
Definition: Alignments.h:14
const align::RotationType & rotation() const
Definition: SurveyDet.h:68
const align::PositionType & position() const
Definition: SurveyDet.h:63
Alignables & innerBarrelGeomDets()
Return inner barrel GeomDets.
Alignables & TIDGeomDets()
Return TID GeomDets.
int j
Definition: DBlmapReader.cc:9
Alignables & endcapGeomDets()
Return endcap GeomDets.
Alignables & pixelEndcapGeomDets()
Return pixel endcap GeomDets.
int k[5][pyjets_maxn]
Alignables & outerBarrelGeomDets()
Return outer barrel GeomDets.

Member Data Documentation

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().

align::StructureType TrackerGeometryCompare::_commonTrackerLevel
private

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 python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::_readHeaderInfo(), python.Vispa.Main.TabController.TabController::checkModificationTimestamp(), python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::configFile(), python.Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::dumpPython(), python.Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController::eventContent(), python.Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::exportDot(), python.Vispa.Main.TabController.TabController::filename(), python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::fullFilename(), python.Vispa.Main.TabController.TabController::getFileBasename(), python.Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::importConfig(), python.Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController::navigate(), python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::open(), python.Vispa.Main.TabController.TabController::open(), python.Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::open(), python.Vispa.Main.TabController.TabController::refresh(), python.Vispa.Main.TabController.TabController::save(), python.Vispa.Main.TabController.TabController::setFilename(), python.Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::startEditMode(), TrackerGeometryCompare(), and python.Vispa.Main.TabController.TabController::updateLabel().

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
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
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().

align::PositionType TrackerGeometryCompare::_TrackerCommonCM
private

Definition at line 107 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

align::GlobalVector TrackerGeometryCompare::_TrackerCommonR
private

Definition at line 106 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

align::GlobalVector TrackerGeometryCompare::_TrackerCommonT
private

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
bool TrackerGeometryCompare::_weightById
private
std::string TrackerGeometryCompare::_weightByIdFile
private

Definition at line 100 of file TrackerGeometryCompare.h.

Referenced by TrackerGeometryCompare().

std::vector< unsigned int > TrackerGeometryCompare::_weightByIdVector
private
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().

AlignableTracker* TrackerGeometryCompare::currentTracker
private

Definition at line 84 of file TrackerGeometryCompare.h.

Referenced by analyze(), createROOTGeometry(), and setCommonTrackerSystem().

AlignableTracker* TrackerGeometryCompare::dummyTracker
private

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().

edm::ParameterSet TrackerGeometryCompare::m_params
private

Definition at line 60 of file TrackerGeometryCompare.h.

AlignableTracker* TrackerGeometryCompare::referenceTracker
private

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().