CMS 3D CMS Logo

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 edm::EDConsumerBase

Public Types

typedef AlignTransform SurveyValue
 
typedef Alignments SurveyValues
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 Read from DB and print survey info. More...
 
void endJob () override
 
 TrackerGeometryCompare (const edm::ParameterSet &)
 Do nothing. Required by framework. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

TTree * _alignTree
 
float _alphaVal
 
int _badModuleQuality
 
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]
 
int _inModuleList
 
std::string _inputFilename1
 
std::string _inputFilename2
 
TFile * _inputRootFile1
 
TFile * _inputRootFile2
 
TTree * _inputTree01
 
TTree * _inputTree02
 
TTree * _inputTree11
 
TTree * _inputTree12
 
std::string _inputTreenameAlign
 
std::string _inputTreenameDeform
 
int _level
 
const std::vector< std::string > _levelStrings
 
int _mid
 
int _mlevel
 
int _moduleInList
 
std::vector< int > _moduleList
 
std::ifstream _moduleListFile
 
std::string _moduleListName
 
float _phiVal
 
float _rVal
 
std::string _setCommonTrackerSystem
 
int _sublevel
 
double _surfDeform [13]
 
float _surLength
 
double _surRot [9]
 
float _surWidth
 
TFile * _theFile
 
align::PositionType _TrackerCommonCM
 
align::GlobalVector _TrackerCommonR
 
align::GlobalVector _TrackerCommonT
 
int _type
 
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_
 
std::map< std::string, TH1D * > m_h1
 
int m_nBins
 
double m_rangeHigh
 
double m_rangeLow
 
std::vector< align::StructureTypem_theLevels
 
std::vector< TrackerMapm_vtkmap
 
AlignableTrackerreferenceTracker
 
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)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

Usage: module comparator = TrackerGeometryCompare {

lots of stuff

} path p = { comparator }

Date
2012/12/02 22:13:12
Revision
1.14
Author
Nhan Tran

******** Including surface deformations in the geometry comparison ********


Definition at line 49 of file TrackerGeometryCompare.h.

Member Typedef Documentation

Definition at line 51 of file TrackerGeometryCompare.h.

Definition at line 52 of file TrackerGeometryCompare.h.

Constructor & Destructor Documentation

TrackerGeometryCompare::TrackerGeometryCompare ( const edm::ParameterSet cfg)

Do nothing. Required by framework.

Definition at line 60 of file TrackerGeometryCompare.cc.

References _alignTree, _alphaVal, _badModuleQuality, _betaVal, _dalphaVal, _daVal, _dbetaVal, _dbVal, _detDim, _detIdFlag, _detIdFlagFile, _detIdFlagVector, _dgammaVal, _dgVal, _dphiVal, _drVal, _duVal, _dvVal, _dwVal, _dxVal, _dyVal, _dzVal, _etaVal, _filename, _gammaVal, _id, _identifiers, _inModuleList, _inputFilename1, _inputFilename2, _inputTreenameAlign, _inputTreenameDeform, _level, _mid, _mlevel, _moduleListName, _phiVal, _rVal, _setCommonTrackerSystem, _sublevel, _surfDeform, _surLength, _surRot, _surWidth, _theFile, _type, _useDetId, _weightBy, _weightById, _weightByIdFile, _weightByIdVector, _xVal, _yVal, _zVal, groupFilesInBlocks::fin, edm::ParameterSet::getUntrackedParameter(), triggerObjects_cff::id, cuy::ii, m_h1, m_nBins, m_rangeHigh, m_rangeLow, m_vtkmap, TFileDirectory::make(), TFileService::mkdir(), and AlCaHLTBitMon_QueryRunRegistry::string.

60  :
61  referenceTracker(nullptr),
62  dummyTracker(nullptr),
63  currentTracker(nullptr),
64  theSurveyIndex(0),
65  theSurveyValues(nullptr),
66  theSurveyErrors(nullptr),
67  _levelStrings(cfg.getUntrackedParameter< std::vector<std::string> >("levels")),
68  _writeToDB(cfg.getUntrackedParameter<bool>("writeToDB")),
70  _moduleListFile(nullptr),
71  _moduleList(0),
72  _inputRootFile1(nullptr),
73  _inputRootFile2(nullptr),
74  _inputTree01(nullptr),
75  _inputTree02(nullptr),
76  _inputTree11(nullptr),
77  _inputTree12(nullptr),
78  m_nBins(10000),
79  m_rangeLow(-.1),
80  m_rangeHigh(.1),
81  firstEvent_(true),
82  m_vtkmap(13)
83 {
84  _moduleListName = cfg.getUntrackedParameter< std::string > ("moduleList");
85 
86  //input is ROOT
87  _inputFilename1 = cfg.getUntrackedParameter< std::string > ("inputROOTFile1");
88  _inputFilename2 = cfg.getUntrackedParameter< std::string > ("inputROOTFile2");
89  _inputTreenameAlign = cfg.getUntrackedParameter< std::string > ("treeNameAlign");
90  _inputTreenameDeform = cfg.getUntrackedParameter< std::string > ("treeNameDeform");
91 
92  //output file
93  _filename = cfg.getUntrackedParameter< std::string > ("outputFile");
94 
95 
96  _weightBy = cfg.getUntrackedParameter< std::string > ("weightBy");
97  _setCommonTrackerSystem = cfg.getUntrackedParameter< std::string > ("setCommonTrackerSystem");
98  _detIdFlag = cfg.getUntrackedParameter< bool > ("detIdFlag");
99  _detIdFlagFile = cfg.getUntrackedParameter< std::string > ("detIdFlagFile");
100  _weightById = cfg.getUntrackedParameter< bool > ("weightById");
101  _weightByIdFile = cfg.getUntrackedParameter< std::string > ("weightByIdFile");
102 
103 
104  // if want to use, make id cut list
105  if (_detIdFlag){
106  std::ifstream fin;
107  fin.open( _detIdFlagFile.c_str() );
108 
109  while (!fin.eof() && fin.good() ){
110 
111  uint32_t id;
112  fin >> id;
113  _detIdFlagVector.push_back(id);
114  }
115  fin.close();
116  }
117 
118  // turn weightByIdFile into weightByIdVector
119  if (_weightById){
120  std::ifstream inFile;
121  inFile.open( _weightByIdFile.c_str() );
122  int ctr = 0;
123  while ( !inFile.eof() ){
124  ctr++;
125  unsigned int listId;
126  inFile >> listId;
127  inFile.ignore(256, '\n');
128 
129  _weightByIdVector.push_back( listId );
130  }
131  inFile.close();
132  }
133 
134  //root configuration
135  _theFile = new TFile(_filename.c_str(),"RECREATE");
136  _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");
137  _alignTree->Branch("id", &_id, "id/I");
138  _alignTree->Branch("badModuleQuality", &_badModuleQuality, "badModuleQuality/I");
139  _alignTree->Branch("inModuleList", &_inModuleList, "inModuleList/I");
140  _alignTree->Branch("level", &_level, "level/I");
141  _alignTree->Branch("mid", &_mid, "mid/I");
142  _alignTree->Branch("mlevel", &_mlevel, "mlevel/I");
143  _alignTree->Branch("sublevel", &_sublevel, "sublevel/I");
144  _alignTree->Branch("x", &_xVal, "x/F");
145  _alignTree->Branch("y", &_yVal, "y/F");
146  _alignTree->Branch("z", &_zVal, "z/F");
147  _alignTree->Branch("r", &_rVal, "r/F");
148  _alignTree->Branch("phi", &_phiVal, "phi/F");
149  _alignTree->Branch("eta", &_etaVal, "eta/F");
150  _alignTree->Branch("alpha", &_alphaVal, "alpha/F");
151  _alignTree->Branch("beta", &_betaVal, "beta/F");
152  _alignTree->Branch("gamma", &_gammaVal, "gamma/F");
153  _alignTree->Branch("dx", &_dxVal, "dx/F");
154  _alignTree->Branch("dy", &_dyVal, "dy/F");
155  _alignTree->Branch("dz", &_dzVal, "dz/F");
156  _alignTree->Branch("dr", &_drVal, "dr/F");
157  _alignTree->Branch("dphi", &_dphiVal, "dphi/F");
158  _alignTree->Branch("dalpha", &_dalphaVal, "dalpha/F");
159  _alignTree->Branch("dbeta", &_dbetaVal, "dbeta/F");
160  _alignTree->Branch("dgamma", &_dgammaVal, "dgamma/F");
161  _alignTree->Branch("du", &_duVal, "du/F");
162  _alignTree->Branch("dv", &_dvVal, "dv/F");
163  _alignTree->Branch("dw", &_dwVal, "dw/F");
164  _alignTree->Branch("da", &_daVal, "da/F");
165  _alignTree->Branch("db", &_dbVal, "db/F");
166  _alignTree->Branch("dg", &_dgVal, "dg/F");
167  _alignTree->Branch("useDetId", &_useDetId, "useDetId/I");
168  _alignTree->Branch("detDim", &_detDim, "detDim/I");
169  _alignTree->Branch("surW", &_surWidth, "surW/F");
170  _alignTree->Branch("surL", &_surLength, "surL/F");
171  _alignTree->Branch("surRot", &_surRot, "surRot[9]/D");
172  _alignTree->Branch("identifiers", &_identifiers, "identifiers[6]/I");
173  _alignTree->Branch("type", &_type, "type/I");
174  _alignTree->Branch("surfDeform", &_surfDeform, "surfDeform[13]/D");
175 
176  for (std::vector<TrackerMap>::iterator it = m_vtkmap.begin(); it != m_vtkmap.end(); ++it) {
177  it->setPalette(1) ;
178  it->addPixel(true) ;
179  }
180 
182  TFileDirectory subDir_All = fs->mkdir( "AllSubdetectors" );
183  TFileDirectory subDir_PXB = fs->mkdir( "PixelBarrel" );
184  TFileDirectory subDir_PXF = fs->mkdir( "PixelEndcap" );
185  for (int ii = 0; ii < 13; ++ii) {
186  std::stringstream histname0 ;
187  histname0 << "SurfDeform_Par_" << ii ;
188  m_h1[histname0.str()] = subDir_All.make<TH1D>((histname0.str()).c_str(),(histname0.str()).c_str(),m_nBins,m_rangeLow,m_rangeHigh);
189 
190  std::stringstream histname1 ;
191  histname1 << "SurfDeform_PixelBarrel_Par_" << ii ;
192  m_h1[histname1.str()] = subDir_PXB.make<TH1D>((histname1.str()).c_str(),(histname1.str()).c_str(),m_nBins,m_rangeLow,m_rangeHigh);
193 
194  std::stringstream histname2 ;
195  histname2 << "SurfDeform_PixelEndcap_Par_" << ii ;
196  m_h1[histname2.str()] = subDir_PXF.make<TH1D>((histname2.str()).c_str(),(histname2.str()).c_str(),m_nBins,m_rangeLow,m_rangeHigh);
197  }
198 
199 }
T getUntrackedParameter(std::string const &, T const &) const
const Alignments * theSurveyValues
std::vector< TrackerMap > m_vtkmap
AlignableTracker * dummyTracker
std::map< std::string, TH1D * > m_h1
std::vector< uint32_t > _detIdFlagVector
T * make(const Args &...args) const
make new ROOT object
align::StructureType _commonTrackerLevel
ii
Definition: cuy.py:590
AlignableTracker * currentTracker
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
const std::vector< std::string > _levelStrings
AlignableTracker * referenceTracker
const SurveyErrors * theSurveyErrors
std::vector< unsigned int > _weightByIdVector
std::vector< int > _moduleList

Member Function Documentation

void TrackerGeometryCompare::addSurveyInfo ( Alignable ali)
private

Definition at line 964 of file TrackerGeometryCompare.cc.

References Alignable::alignableObjectId(), AlCaHLTBitMon_QueryRunRegistry::comp, Alignable::components(), relativeConstraints::error, Exception, Alignable::geomDetId(), mps_fire::i, AlignableSurface::length(), Alignments::m_align, SurveyErrors::m_surveyErrors, SurveyError::matrix(), SurveyError::rawId(), DetId::rawId(), makeMuonMisalignmentScenario::rot, AlignableSurface::setLength(), Alignable::setSurvey(), AlignableSurface::setWidth(), SurveyError::structureType(), Alignable::surface(), theSurveyErrors, theSurveyIndex, theSurveyValues, and AlignableSurface::width().

964  {
965 
966  const auto& comp = ali->components();
967 
968  unsigned int nComp = comp.size();
969 
970  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo(comp[i]);
971 
973 
974  if ( ali->geomDetId().rawId() != error.rawId() ||
975  ali->alignableObjectId() != error.structureType() )
976  {
977  throw cms::Exception("DatabaseError")
978  << "Error reading survey info from DB. Mismatched id!";
979  }
980 
981  const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[theSurveyIndex].translation();
982  const CLHEP::HepRotation& rot = theSurveyValues->m_align[theSurveyIndex].rotation();
983 
984  AlignableSurface surf( align::PositionType( pos.x(), pos.y(), pos.z() ),
985  align::RotationType( rot.xx(), rot.xy(), rot.xz(),
986  rot.yx(), rot.yy(), rot.yz(),
987  rot.zx(), rot.zy(), rot.zz() ) );
988 
989  surf.setWidth( ali->surface().width() );
990  surf.setLength( ali->surface().length() );
991 
992  ali->setSurvey( new SurveyDet( surf, error.matrix() ) );
993 
994  ++theSurveyIndex;
995 
996 }
align::Scalar width() const
ErrorMatrix matrix() const
Definition: SurveyError.h:76
const Alignments * theSurveyValues
void addSurveyInfo(Alignable *ali)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
virtual const Alignables & components() const =0
Return vector of all direct components.
uint8_t structureType() const
Definition: SurveyError.h:66
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
align::ID rawId() const
Definition: SurveyError.h:71
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:135
align::Scalar length() const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:340
const SurveyErrors * theSurveyErrors
std::vector< SurveyError > m_surveyErrors
Definition: SurveyErrors.h:23
const DetId & geomDetId() const
Definition: Alignable.h:186
void TrackerGeometryCompare::analyze ( const edm::Event ,
const edm::EventSetup iSetup 
)
override

Definition at line 225 of file TrackerGeometryCompare.cc.

References _inputTree11, _inputTree12, _levelStrings, _setCommonTrackerSystem, _writeToDB, AlignableTracker::alignmentErrors(), AlignableTracker::alignments(), cond::service::PoolDBOutputService::beginOfTime(), compareGeometries(), compareSurfaceDeformations(), createROOTGeometry(), currentTracker, firstEvent_, edm::EventSetup::get(), edm::Service< T >::isAvailable(), hcalDigis_cfi::level, m_theLevels, AlignableTracker::objectIdProvider(), edm::ESHandle< T >::product(), referenceTracker, setCommonTrackerSystem(), AlignableObjectId::stringToId(), and cond::service::PoolDBOutputService::writeOne().

225  {
226 
227  if (firstEvent_) {
228 
229  //Retrieve tracker topology from geometry
230  edm::ESHandle<TrackerTopology> tTopoHandle;
231  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
232  const TrackerTopology* const tTopo = tTopoHandle.product();
233 
234  //upload the ROOT geometries
235  createROOTGeometry(iSetup);
236 
237  //setting the levels being used in the geometry comparator
238  edm::LogInfo("TrackerGeometryCompare") << "levels: " << _levelStrings.size();
239  for (const auto& level: _levelStrings){
241  edm::LogInfo("TrackerGeometryCompare") << "level: " << level;
242  edm::LogInfo("TrackerGeometryCompare")
243  << "structure type: "
245  }
246 
247 
248  //set common tracker system first
249  // if setting the tracker common system
250  if (_setCommonTrackerSystem != "NONE"){
252  }
253 
254  //compare the goemetries
257 
258  //write out ntuple
259  //might be better to do within output module
260 
261  if (_writeToDB){
262  Alignments* myAlignments = currentTracker->alignments();
263  AlignmentErrorsExtended* myAlignmentErrorsExtended = currentTracker->alignmentErrors();
264 
265  // 2. Store alignment[Error]s to DB
267  // Call service
268  if( !poolDbService.isAvailable() ) // Die if not available
269  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
270 
271  poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), "TrackerAlignmentRcd");
272  poolDbService->writeOne<AlignmentErrorsExtended>(&(*myAlignmentErrorsExtended), poolDbService->beginOfTime(), "TrackerAlignmentErrorExtendedRcd");
273 
274  }
275 
276  firstEvent_ = false;
277  }
278 }
align::StructureType stringToId(const char *) const
void compareGeometries(Alignable *refAli, Alignable *curAli, const TrackerTopology *tTopo, const edm::EventSetup &iSetup)
std::vector< align::StructureType > m_theLevels
bool isAvailable() const
Definition: Service.h:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker&#39;s geometry.
AlignableTracker * currentTracker
const std::vector< std::string > _levelStrings
AlignableTracker * referenceTracker
Alignments * alignments() const override
Return alignments, sorted by DetId.
void createROOTGeometry(const edm::EventSetup &iSetup)
AlignmentErrorsExtended * alignmentErrors() const override
Return alignment errors, sorted by DetId.
T get() const
Definition: EventSetup.h:68
T const * product() const
Definition: ESHandle.h:84
void compareSurfaceDeformations(TTree *_inputTree11, TTree *_inputTree12)
void TrackerGeometryCompare::beginJob ( void  )
overridevirtual

Read from DB and print survey info.

Reimplemented from edm::EDAnalyzer.

Definition at line 201 of file TrackerGeometryCompare.cc.

References firstEvent_.

201  {
202  firstEvent_ = true;
203 }
void TrackerGeometryCompare::compareGeometries ( Alignable refAli,
Alignable curAli,
const TrackerTopology tTopo,
const edm::EventSetup iSetup 
)
private

Definition at line 607 of file TrackerGeometryCompare.cc.

References _weightBy, _weightById, _weightByIdVector, Alignable::alignableObjectId(), trackerTree::check(), Alignable::components(), diffTreeTool::diff, align::diffAlignables(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, MillePedeFileConverter_cfg::e, Exception, fillTree(), Alignable::geomDetId(), mps_fire::i, Alignable::id(), m_theLevels, PV3DBase< T, PVType, FrameType >::mag(), align::moveAlignable(), DetId::rawId(), makeMuonMisalignmentScenario::rot, and tolerance.

Referenced by analyze().

607  {
608 
609  using namespace align ;
610 
611  const auto& refComp = refAli->components();
612  const auto& curComp = curAli->components();
613 
614  unsigned int nComp = refComp.size();
615  //only perform for designate levels
616  bool useLevel = false;
617  for (unsigned int i = 0; i < m_theLevels.size(); ++i){
618  if (refAli->alignableObjectId() == m_theLevels[i]) useLevel = true;
619  }
620 
621  //another added level for difference between det and detunit
622  //if ((refAli->alignableObjectId()==2)&&(nComp == 1)) useLevel = false;
623 
624  //coordinate matching, etc etc
625  if (useLevel){
626  DetId detid(refAli->id());
627 
628  CLHEP::Hep3Vector Rtotal, Wtotal, lRtotal, lWtotal;
629  Rtotal.set(0.,0.,0.);
630  Wtotal.set(0.,0.,0.);
631  lRtotal.set(0.,0.,0.);
632  lWtotal.set(0.,0.,0.);
633 
634  bool converged = false;
635 
637 
638  for (int i = 0; i < 100; i++){
639 
640  // Get differences between alignments for rotations and translations
641  // both local and global
643 
644  // 'diffAlignables' returns 'refAli - curAli' for translations and 'curAli - refAli' for rotations.
645  // The plan is to unify this at some point, but a simple change of the sign for one of them was postponed
646  // to do some further checks to understand the rotations better
647  //Updated July 2018: as requested the sign in the translations has been changed to match the one in rotations. A test was done to change the diffAlignables function and solve the issue there, but proved quite time consuming. To unify the sign convention in the least amount of time the choice was made to change the sign here.
648  CLHEP::Hep3Vector dR(-diff[0],-diff[1],-diff[2]);
649  CLHEP::Hep3Vector dW(diff[3],diff[4],diff[5]);
650  CLHEP::Hep3Vector dRLocal(-diff[6],-diff[7],-diff[8]);
651  CLHEP::Hep3Vector dWLocal(diff[9],diff[10],diff[11]);
652 
653  // Translations
654  Rtotal+=dR;
655  lRtotal+=dRLocal;
656 
657  //Rotations
658  CLHEP::HepRotation rot(Wtotal.unit(),Wtotal.mag());
659  CLHEP::HepRotation drot(dW.unit(),dW.mag());
660  rot*=drot;
661  Wtotal.set(rot.axis().x()*rot.delta(), rot.axis().y()*rot.delta(), rot.axis().z()*rot.delta());
662 
663  CLHEP::HepRotation rotLocal(lWtotal.unit(),lWtotal.mag());
664  CLHEP::HepRotation drotLocal(dWLocal.unit(),dWLocal.mag());
665  rotLocal*=drotLocal;
666  lWtotal.set(rotLocal.axis().x()*rotLocal.delta(), rotLocal.axis().y()*rotLocal.delta(), rotLocal.axis().z()*rotLocal.delta());
667 
668  // Move current alignable by shift and check if difference
669  // is smaller than tolerance value
670  // if true, break the loop
671  align::moveAlignable(curAli, diff);
672  float tolerance = 1e-7;
674  align::GlobalVector checkR(check[0],check[1],check[2]);
675  align::GlobalVector checkW(check[3],check[4],check[5]);
676  if ((checkR.mag() < tolerance)&&(checkW.mag() < tolerance))
677  {
678  converged = true;
679  break;
680  }
681  }
682 
683  // give an exception if difference has not fallen below tolerance level
684  // i.e. method has not converged
685  if (!converged){
686  edm::LogInfo("TrackerGeometryCompare") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId()
687  << ", rawId: " << refAli->geomDetId().rawId()
688  << ", subdetId: "<< detid.subdetId() << "): " << diff << check;
689  throw cms::Exception("Tolerance in TrackerGeometryCompare exceeded");
690  }
691 
692  AlgebraicVector TRtot(12);
693  // global
694  TRtot(1) = Rtotal.x(); TRtot(2) = Rtotal.y(); TRtot(3) = Rtotal.z();
695  TRtot(4) = Wtotal.x(); TRtot(5) = Wtotal.y(); TRtot(6) = Wtotal.z();
696  // local
697  TRtot(7) = lRtotal.x(); TRtot(8) = lRtotal.y(); TRtot(9) = lRtotal.z();
698  TRtot(10) = lWtotal.x(); TRtot(11) = lWtotal.y(); TRtot(12) = lWtotal.z();
699 
700  fillTree(refAli, TRtot, tTopo, iSetup);
701  }
702 
703  // another added level for difference between det and detunit
704  for (unsigned int i = 0; i < nComp; ++i)
705  compareGeometries(refComp[i],curComp[i],tTopo,iSetup);
706 
707 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
void compareGeometries(Alignable *refAli, Alignable *curAli, const TrackerTopology *tTopo, const edm::EventSetup &iSetup)
std::vector< align::StructureType > m_theLevels
const double tolerance
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
AlgebraicVector diffAlignables(Alignable *refAli, Alignable *curAli, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
Definition: AlignTools.cc:10
virtual const Alignables & components() const =0
Return vector of all direct components.
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
void fillTree(Alignable *refAli, const AlgebraicVector &diff, const TrackerTopology *tTopo, const edm::EventSetup &iSetup)
Definition: DetId.h:18
CLHEP::HepVector AlgebraicVector
std::vector< unsigned int > _weightByIdVector
def check(config)
Definition: trackerTree.py:14
void moveAlignable(Alignable *ali, AlgebraicVector diff)
Moves the alignable by the AlgebraicVector.
Definition: AlignTools.cc:81
const DetId & geomDetId() const
Definition: Alignable.h:186
void TrackerGeometryCompare::compareSurfaceDeformations ( TTree *  _inputTree11,
TTree *  _inputTree12 
)
private

Definition at line 464 of file TrackerGeometryCompare.cc.

References _inputFilename1, _inputFilename2, _inputRootFile1, _inputRootFile2, _inputTreenameDeform, _surfDeform, Abs(), cuy::ii, createfilelist::int, m_h1, m_nBins, m_rangeHigh, m_rangeLow, m_vtkmap, and mathSSE::return().

Referenced by analyze().

464  {
465 
466  if (_inputFilename1 != "IDEAL" && _inputFilename2 != "IDEAL") {
467 
468  int inputRawid1;
469  int inputRawid2;
470  int inputSubdetid1, inputSubdetid2 ;
471  int inputDtype1, inputDtype2 ;
472  std::vector<double> inputDpar1;
473  std::vector<double> inputDpar2 ;
474  std::vector<double>* p_inputDpar1 = &inputDpar1;
475  std::vector<double>* p_inputDpar2 = &inputDpar2;
476 
477  TTree* refTree = (TTree*) _inputRootFile1->Get(_inputTreenameDeform.c_str());
478  refTree->SetBranchAddress("irawid", &inputRawid1);
479  refTree->SetBranchAddress("subdetid", &inputSubdetid1);
480  refTree->SetBranchAddress("dtype", &inputDtype1);
481  refTree->SetBranchAddress("dpar", &p_inputDpar1);
482 
483  TTree* curTree = (TTree*) _inputRootFile2->Get(_inputTreenameDeform.c_str());
484  curTree->SetBranchAddress("irawid", &inputRawid2);
485  curTree->SetBranchAddress("subdetid", &inputSubdetid2);
486  curTree->SetBranchAddress("dtype", &inputDtype2);
487  curTree->SetBranchAddress("dpar", &p_inputDpar2);
488 
489  unsigned int nEntries11 = refTree->GetEntries();
490  unsigned int nEntries12 = curTree->GetEntries();
491 
492  if (nEntries11 != nEntries12) {
493  edm::LogError("TrackerGeometryCompare") << " Surface deformation parameters in two geometries differ!\n" ;
494  return ;
495  }
496 
497  for (unsigned int iEntry = 0; iEntry < nEntries12; ++iEntry) {
498  refTree->GetEntry(iEntry) ;
499  curTree->GetEntry(iEntry) ;
500  for (int ii = 0; ii < 13; ++ii) { _surfDeform[ii] = -1.0 ; }
501  for (int npar = 0; npar < int(inputDpar2.size()); ++npar ) {
502  if (inputRawid1 == inputRawid2) {
503  _surfDeform[npar] = inputDpar2.at(npar) - inputDpar1.at(npar) ;
504  std::stringstream histname0 ;
505  histname0 << "SurfDeform_Par_" << npar ;
506  if ( TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow)/(10.*m_nBins) ) m_h1[histname0.str()]->Fill(_surfDeform[npar]) ;
507  if (inputSubdetid1 == 1 && inputSubdetid2 == 1) {
508  std::stringstream histname1 ;
509  histname1 << "SurfDeform_PixelBarrel_Par_" << npar ;
510  if ( TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow)/(10.*m_nBins) ) m_h1[histname1.str()]->Fill(_surfDeform[npar]) ;
511  }
512  if (inputSubdetid1 == 2 && inputSubdetid2 == 2) {
513  std::stringstream histname2 ;
514  histname2 << "SurfDeform_PixelEndcap_Par_" << npar ;
515  if ( TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow)/(10.*m_nBins) ) m_h1[histname2.str()]->Fill(_surfDeform[npar]) ;
516  }
517  (m_vtkmap.at(npar)).fill_current_val(inputRawid1,_surfDeform[npar]) ;
518  }
519  }
520  }
521 
522  } else if ( _inputFilename1 == "IDEAL" && _inputFilename2 != "IDEAL" ) {
523 
524  int inputRawid2;
525  int inputSubdetid2 ;
526  int inputDtype2 ;
527  std::vector<double> inputDpar2 ;
528  std::vector<double>* p_inputDpar2 = &inputDpar2;
529 
530  TTree* curTree = (TTree*) _inputRootFile2->Get(_inputTreenameDeform.c_str());
531  curTree->SetBranchAddress("irawid", &inputRawid2);
532  curTree->SetBranchAddress("subdetid", &inputSubdetid2);
533  curTree->SetBranchAddress("dtype", &inputDtype2);
534  curTree->SetBranchAddress("dpar", &p_inputDpar2);
535 
536  unsigned int nEntries12 = curTree->GetEntries();
537 
538  for (unsigned int iEntry = 0; iEntry < nEntries12; ++iEntry) {
539  curTree->GetEntry(iEntry) ;
540  for (int ii = 0; ii < 12; ++ii) { _surfDeform[ii] = -1.0 ; }
541  for (int npar = 0; npar < int(inputDpar2.size()); ++npar ) {
542  _surfDeform[npar] = inputDpar2.at(npar) ;
543  std::stringstream histname0 ;
544  histname0 << "SurfDeform_Par_" << npar ;
545  if ( TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow)/(10.*m_nBins) ) m_h1[histname0.str()]->Fill(_surfDeform[npar]) ;
546  if (inputSubdetid2 == 1) {
547  std::stringstream histname1 ;
548  histname1 << "SurfDeform_PixelBarrel_Par_" << npar ;
549  if ( TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow)/(10.*m_nBins) ) m_h1[histname1.str()]->Fill(_surfDeform[npar]) ;
550  }
551  if (inputSubdetid2 == 2) {
552  std::stringstream histname2 ;
553  histname2 << "SurfDeform_PixelEndcap_Par_" << npar ;
554  if ( TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow)/(10.*m_nBins) ) m_h1[histname2.str()]->Fill(_surfDeform[npar]) ;
555  }
556  (m_vtkmap.at(npar)).fill_current_val(inputRawid2,_surfDeform[npar]) ;
557  }
558  }
559 
560  } else if ( _inputFilename1 != "IDEAL" && _inputFilename2 == "IDEAL" ) {
561 
562  int inputRawid1;
563  int inputSubdetid1 ;
564  int inputDtype1 ;
565  std::vector<double> inputDpar1;
566  std::vector<double>* p_inputDpar1 = &inputDpar1;
567 
568  TTree* refTree = (TTree*) _inputRootFile1->Get(_inputTreenameDeform.c_str());
569  refTree->SetBranchAddress("irawid", &inputRawid1);
570  refTree->SetBranchAddress("subdetid", &inputSubdetid1);
571  refTree->SetBranchAddress("dtype", &inputDtype1);
572  refTree->SetBranchAddress("dpar", &p_inputDpar1);
573 
574  unsigned int nEntries11 = refTree->GetEntries();
575 
576  for (unsigned int iEntry = 0; iEntry < nEntries11; ++iEntry) {
577  refTree->GetEntry(iEntry) ;
578  for (int ii = 0; ii < 12; ++ii) { _surfDeform[ii] = -1.0 ; }
579  for (int npar = 0; npar < int(inputDpar1.size()); ++npar ) {
580  _surfDeform[npar] = - inputDpar1.at(npar) ;
581  std::stringstream histname0 ;
582  histname0 << "SurfDeform_Par_" << npar ;
583  if ( TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow)/(10.*m_nBins) ) m_h1[histname0.str()]->Fill(_surfDeform[npar]) ;
584  if (inputSubdetid1 == 1) {
585  std::stringstream histname1 ;
586  histname1 << "SurfDeform_PixelBarrel_Par_" << npar ;
587  if ( TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow)/(10.*m_nBins) ) m_h1[histname1.str()]->Fill(_surfDeform[npar]) ;
588  }
589  if (inputSubdetid1 == 2) {
590  std::stringstream histname2 ;
591  histname2 << "SurfDeform_PixelEndcap_Par_" << npar ;
592  if ( TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow)/(10.*m_nBins) ) m_h1[histname2.str()]->Fill(_surfDeform[npar]) ;
593  }
594  (m_vtkmap.at(npar)).fill_current_val(inputRawid1,_surfDeform[npar]) ;
595  }
596  }
597 
598  } else if ( _inputFilename1 == "IDEAL" && _inputFilename2 == "IDEAL" ) {
599 
600  edm::LogInfo("TrackerGeometryCompare") << ">>>> Comparing IDEAL with IDEAL: nothing to do! <<<<\n" ;
601 
602  }
603 
604  return ;
605 }
std::vector< TrackerMap > m_vtkmap
return((rh^lh)&mask)
std::map< std::string, TH1D * > m_h1
T Abs(T a)
Definition: MathUtil.h:49
ii
Definition: cuy.py:590
void TrackerGeometryCompare::createROOTGeometry ( const edm::EventSetup iSetup)
private

Definition at line 280 of file TrackerGeometryCompare.cc.

References _inputFilename1, _inputFilename2, _inputRootFile1, _inputRootFile2, _inputTree01, _inputTree02, _inputTree11, _inputTree12, _inputTreenameAlign, _inputTreenameDeform, _moduleList, _moduleListFile, _moduleListName, GeometryAligner::applyAlignments(), TrackerGeomBuilderFromGeometricDet::build(), SurfaceDeformationFactory::create(), currentTracker, edm::EventSetup::get(), mps_fire::i, mps_splice::line, Alignments::m_align, AlignmentErrorsExtended::m_alignError, edm::ESHandle< T >::product(), referenceTracker, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

280  {
281 
282  int inputRawId1, inputRawId2;
283  double inputX1, inputY1, inputZ1, inputX2, inputY2, inputZ2;
284  double inputAlpha1, inputBeta1, inputGamma1, inputAlpha2, inputBeta2, inputGamma2;
285 
286  //Retrieve tracker topology from geometry
287  edm::ESHandle<TrackerTopology> tTopoHandle;
288  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
289  const TrackerTopology* const tTopo = tTopoHandle.product();
290 
291  // Fill module IDs from file into a list
293  if (_moduleListFile.is_open()){
295  while(!_moduleListFile.eof()){
296  std::getline(_moduleListFile,line);
297  _moduleList.push_back(std::atoi(line.c_str()));
298  }
299  }
300  else{
301  edm::LogInfo("TrackerGeometryCompare") << "Error: Module list not found! Please verify that given list exists!";
302  }
303 
304  //declare alignments
305  Alignments* alignments1 = new Alignments();
306  AlignmentErrorsExtended* alignmentErrors1 = new AlignmentErrorsExtended();
307  if (_inputFilename1 != "IDEAL"){
308  _inputRootFile1 = new TFile(_inputFilename1.c_str());
309  TTree* _inputTree01 = (TTree*) _inputRootFile1->Get(_inputTreenameAlign.c_str());
310  _inputTree01->SetBranchAddress("rawid", &inputRawId1);
311  _inputTree01->SetBranchAddress("x", &inputX1);
312  _inputTree01->SetBranchAddress("y", &inputY1);
313  _inputTree01->SetBranchAddress("z", &inputZ1);
314  _inputTree01->SetBranchAddress("alpha", &inputAlpha1);
315  _inputTree01->SetBranchAddress("beta", &inputBeta1);
316  _inputTree01->SetBranchAddress("gamma", &inputGamma1);
317 
318  int nEntries1 = _inputTree01->GetEntries();
319  //fill alignments
320  for (int i = 0; i < nEntries1; ++i){
321 
322  _inputTree01->GetEntry(i);
323  CLHEP::Hep3Vector translation1(inputX1, inputY1, inputZ1);
324  CLHEP::HepEulerAngles eulerangles1(inputAlpha1,inputBeta1,inputGamma1);
325  uint32_t detid1 = inputRawId1;
326  AlignTransform transform1(translation1, eulerangles1, detid1);
327  alignments1->m_align.push_back(transform1);
328 
329  //dummy errors
330  CLHEP::HepSymMatrix clhepSymMatrix(3,0);
331  AlignTransformErrorExtended transformError(clhepSymMatrix, detid1);
332  alignmentErrors1->m_alignError.push_back(transformError);
333  }
334 
335  // to get the right order, sort by rawId
336  std::sort( alignments1->m_align.begin(), alignments1->m_align.end());
337  std::sort( alignmentErrors1->m_alignError.begin(), alignmentErrors1->m_alignError.end());
338  }
339  //------------------
340  Alignments* alignments2 = new Alignments();
341  AlignmentErrorsExtended* alignmentErrors2 = new AlignmentErrorsExtended();
342  if (_inputFilename2 != "IDEAL"){
343  _inputRootFile2 = new TFile(_inputFilename2.c_str());
344  TTree* _inputTree02 = (TTree*) _inputRootFile2->Get(_inputTreenameAlign.c_str());
345  _inputTree02->SetBranchAddress("rawid", &inputRawId2);
346  _inputTree02->SetBranchAddress("x", &inputX2);
347  _inputTree02->SetBranchAddress("y", &inputY2);
348  _inputTree02->SetBranchAddress("z", &inputZ2);
349  _inputTree02->SetBranchAddress("alpha", &inputAlpha2);
350  _inputTree02->SetBranchAddress("beta", &inputBeta2);
351  _inputTree02->SetBranchAddress("gamma", &inputGamma2);
352 
353  int nEntries2 = _inputTree02->GetEntries();
354  //fill alignments
355  for (int i = 0; i < nEntries2; ++i){
356 
357  _inputTree02->GetEntry(i);
358  CLHEP::Hep3Vector translation2(inputX2, inputY2, inputZ2);
359  CLHEP::HepEulerAngles eulerangles2(inputAlpha2,inputBeta2,inputGamma2);
360  uint32_t detid2 = inputRawId2;
361  AlignTransform transform2(translation2, eulerangles2, detid2);
362  alignments2->m_align.push_back(transform2);
363 
364  //dummy errors
365  CLHEP::HepSymMatrix clhepSymMatrix(3,0);
366  AlignTransformErrorExtended transformError(clhepSymMatrix, detid2);
367  alignmentErrors2->m_alignError.push_back(transformError);
368  }
369 
370  // to get the right order, sort by rawId
371  std::sort( alignments2->m_align.begin(), alignments2->m_align.end());
372  std::sort( alignmentErrors2->m_alignError.begin(), alignmentErrors2->m_alignError.end());
373  }
374 
375  //accessing the initial geometry
377  iSetup.get<IdealGeometryRecord>().get(cpv);
378  edm::ESHandle<GeometricDet> theGeometricDet;
379  iSetup.get<IdealGeometryRecord>().get(theGeometricDet);
381  iSetup.get<PTrackerParametersRcd>().get( ptp );
382  TrackerGeomBuilderFromGeometricDet trackerBuilder;
383 
384  //reference tracker
385  TrackerGeometry* theRefTracker = trackerBuilder.build(&*theGeometricDet, *ptp, tTopo );
386  if (_inputFilename1 != "IDEAL"){
387  GeometryAligner aligner1;
388  aligner1.applyAlignments<TrackerGeometry>( &(*theRefTracker), &(*alignments1), &(*alignmentErrors1),
389  AlignTransform());
390  }
391  referenceTracker = new AlignableTracker(&(*theRefTracker), tTopo);
392  //referenceTracker->setSurfaceDeformation(surfDef1, true) ;
393 
394  int inputRawid1;
395  int inputRawid2;
396  int inputDtype1, inputDtype2 ;
397  std::vector<double> inputDpar1;
398  std::vector<double> inputDpar2 ;
399  std::vector<double>* p_inputDpar1 = &inputDpar1;
400  std::vector<double>* p_inputDpar2 = &inputDpar2;
401 
402  const auto& comp1 = referenceTracker->deepComponents();
403 
404  SurfaceDeformation * surfDef1;
405  if (_inputFilename1 != "IDEAL"){
406  TTree* _inputTree11 = (TTree*) _inputRootFile1->Get(_inputTreenameDeform.c_str());
407  _inputTree11->SetBranchAddress("irawid", &inputRawid1);
408  _inputTree11->SetBranchAddress("dtype", &inputDtype1);
409  _inputTree11->SetBranchAddress("dpar", &p_inputDpar1);
410 
411  unsigned int nEntries11 = _inputTree11->GetEntries();
412  edm::LogInfo("TrackerGeometryCompare") << " nentries11 = " << nEntries11;
413  for (unsigned int iEntry = 0; iEntry < nEntries11; ++iEntry) {
414  _inputTree11->GetEntry(iEntry) ;
415 
416  surfDef1 = SurfaceDeformationFactory::create( inputDtype1, inputDpar1);
417 
418  if (int(comp1[iEntry]->id()) == inputRawid1) {
419  comp1[iEntry]->setSurfaceDeformation(surfDef1, true) ;
420  }
421 
422  }
423  }
424 
425  //currernt tracker
426  TrackerGeometry* theCurTracker = trackerBuilder.build(&*theGeometricDet, *ptp, tTopo);
427  if (_inputFilename2 != "IDEAL"){
428  GeometryAligner aligner2;
429  aligner2.applyAlignments<TrackerGeometry>( &(*theCurTracker), &(*alignments2), &(*alignmentErrors2),
430  AlignTransform());
431  }
432  currentTracker = new AlignableTracker(&(*theCurTracker), tTopo);
433 
434  const auto& comp2 = currentTracker->deepComponents();
435 
436  SurfaceDeformation * surfDef2 ;
437  if (_inputFilename2 != "IDEAL"){
438  TTree* _inputTree12 = (TTree*) _inputRootFile2->Get(_inputTreenameDeform.c_str());
439  _inputTree12->SetBranchAddress("irawid", &inputRawid2);
440  _inputTree12->SetBranchAddress("dtype", &inputDtype2);
441  _inputTree12->SetBranchAddress("dpar", &p_inputDpar2);
442 
443  unsigned int nEntries12 = _inputTree12->GetEntries();
444  edm::LogInfo("TrackerGeometryCompare") << " nentries12 = " << nEntries12;
445  for (unsigned int iEntry = 0; iEntry < nEntries12; ++iEntry) {
446  _inputTree12->GetEntry(iEntry) ;
447 
448  surfDef2 = SurfaceDeformationFactory::create( inputDtype2, inputDpar2);
449 
450  if (int(comp2[iEntry]->id()) == inputRawid2) {
451  comp2[iEntry]->setSurfaceDeformation(surfDef2, true) ;
452  }
453 
454  }
455  }
456 
457  delete alignments1;
458  delete alignmentErrors1;
459  delete alignments2;
460  delete alignmentErrors2;
461 
462 }
Class to update a given geometry with a set of alignments.
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
AlignableTracker * currentTracker
std::vector< AlignTransformErrorExtended > m_alignError
AlignableTracker * referenceTracker
T get() const
Definition: EventSetup.h:68
std::vector< int > _moduleList
T const * product() const
Definition: ESHandle.h:84
SurfaceDeformation * create(int type, const std::vector< double > &params)
void TrackerGeometryCompare::diffCommonTrackerSystem ( Alignable refAli,
Alignable curAli 
)
private

Definition at line 747 of file TrackerGeometryCompare.cc.

References _commonTrackerLevel, _TrackerCommonCM, _TrackerCommonR, _TrackerCommonT, _weightBy, _weightById, _weightByIdVector, Alignable::alignableObjectId(), Alignable::components(), diffTreeTool::diff, align::diffAlignables(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, Alignable::globalPosition(), mps_fire::i, and makeMuonMisalignmentScenario::rot.

Referenced by setCommonTrackerSystem().

747  {
748 
749  const auto& refComp = refAli->components();
750  const auto& curComp = curAli->components();
751 
752  unsigned int nComp = refComp.size();
753  //only perform for designate levels
754  bool useLevel = false;
755  if (refAli->alignableObjectId() == _commonTrackerLevel) useLevel = true;
756 
757  //useLevel = false;
758  if (useLevel){
759  CLHEP::Hep3Vector Rtotal, Wtotal;
760  Rtotal.set(0.,0.,0.); Wtotal.set(0.,0.,0.);
761 
763  CLHEP::Hep3Vector dR(diff[0],diff[1],diff[2]);
764  Rtotal+=dR;
765  CLHEP::Hep3Vector dW(diff[3],diff[4],diff[5]);
766  CLHEP::HepRotation rot(Wtotal.unit(),Wtotal.mag());
767  CLHEP::HepRotation drot(dW.unit(),dW.mag());
768  rot*=drot;
769  Wtotal.set(rot.axis().x()*rot.delta(), rot.axis().y()*rot.delta(), rot.axis().z()*rot.delta());
770  /*
771  //std::cout << "a";
772  //if (refAli->alignableObjectId() == 1) std::cout << "DIFF: " << diff << std::endl;
773  align::moveAlignable(curAli, diff);
774  float tolerance = 1e-7;
775  AlgebraicVector check = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector);
776  align::GlobalVector checkR(check[0],check[1],check[2]);
777  align::GlobalVector checkW(check[3],check[4],check[5]);
778  DetId detid(refAli->id());
779  if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){
780  edm::LogInfo("TrackerGeometryCompare") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId()
781  << ", rawId: " << refAli->geomDetId().rawId()
782  << ", subdetId: "<< detid.subdetId() << "): " << diff;
783  }
784  else{
785  break;
786  }
787  }
788  */
789 
790  //_TrackerCommonT.set(Rtotal.x(), Rtotal.y(), Rtotal.z());
791  _TrackerCommonT = align::GlobalVector(Rtotal.x(), Rtotal.y(), Rtotal.z());
792  _TrackerCommonR = align::GlobalVector(Wtotal.x(), Wtotal.y(), Wtotal.z());
793  _TrackerCommonCM = curAli->globalPosition();
794  //_TrackerCommonTR(1) = Rtotal.x(); _TrackerCommonTR(2) = Rtotal.y(); _TrackerCommonTR(3) = Rtotal.z();
795  //_TrackerCommonTR(4) = Wtotal.x(); _TrackerCommonTR(5) = Wtotal.y(); _TrackerCommonTR(6) = Wtotal.z();
796 
797 
798  }
799  else{
800  for (unsigned int i = 0; i < nComp; ++i) diffCommonTrackerSystem(refComp[i],curComp[i]);
801  }
802 
803 
804 }
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 const 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:138
void TrackerGeometryCompare::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 205 of file TrackerGeometryCompare.cc.

References _alignTree, _theFile, m_vtkmap, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by o2olib.O2ORunMgr::executeJob().

205  {
206 
207  int iname(0) ;
208  for (std::vector<TrackerMap>::iterator it = m_vtkmap.begin(); it != m_vtkmap.end(); ++it) {
209  std::stringstream mapname ;
210  mapname << "TkMap_SurfDeform" << iname << ".png" ;
211  it->save(true,0,0,mapname.str());
212  mapname.str( std::string() );
213  mapname.clear() ;
214  mapname << "TkMap_SurfDeform" << iname << ".pdf" ;
215  it->save(true,0,0,mapname.str());
216  ++iname ;
217  }
218 
219  _theFile->cd();
220  _alignTree->Write();
221  _theFile->Close();
222 
223 }
std::vector< TrackerMap > m_vtkmap
void TrackerGeometryCompare::fillIdentifiers ( int  subdetlevel,
int  rawid,
const TrackerTopology tTopo 
)
private

Definition at line 1011 of file TrackerGeometryCompare.cc.

References _identifiers, DEFINE_FWK_MODULE, TrackerTopology::pxbLadder(), TrackerTopology::pxbLayer(), TrackerTopology::pxbModule(), TrackerTopology::pxfBlade(), TrackerTopology::pxfDisk(), TrackerTopology::pxfModule(), TrackerTopology::pxfPanel(), TrackerTopology::pxfSide(), TrackerTopology::tecModule(), TrackerTopology::tecPetalInfo(), TrackerTopology::tecRing(), TrackerTopology::tecSide(), TrackerTopology::tecWheel(), TrackerTopology::tibLayer(), TrackerTopology::tibModule(), TrackerTopology::tibStringInfo(), TrackerTopology::tidModuleInfo(), TrackerTopology::tidRing(), TrackerTopology::tidSide(), TrackerTopology::tidWheel(), TrackerTopology::tobLayer(), TrackerTopology::tobModule(), and TrackerTopology::tobRodInfo().

Referenced by fillTree().

1011  {
1012 
1013 
1014  switch( subdetlevel ){
1015 
1016  case 1:
1017  {
1018 
1019  _identifiers[0] = tTopo->pxbModule( rawid );
1020  _identifiers[1] = tTopo->pxbLadder( rawid );
1021  _identifiers[2] = tTopo->pxbLayer( rawid );
1022  _identifiers[3] = 999;
1023  _identifiers[4] = 999;
1024  _identifiers[5] = 999;
1025  break;
1026  }
1027  case 2:
1028  {
1029 
1030  _identifiers[0] = tTopo->pxfModule( rawid );
1031  _identifiers[1] = tTopo->pxfPanel( rawid );
1032  _identifiers[2] = tTopo->pxfBlade( rawid );
1033  _identifiers[3] = tTopo->pxfDisk( rawid );
1034  _identifiers[4] = tTopo->pxfSide( rawid );
1035  _identifiers[5] = 999;
1036  break;
1037  }
1038  case 3:
1039  {
1040 
1041  _identifiers[0] = tTopo->tibModule( rawid );
1042  _identifiers[1] = tTopo->tibStringInfo( rawid )[0];
1043  _identifiers[2] = tTopo->tibStringInfo( rawid )[1];
1044  _identifiers[3] = tTopo->tibStringInfo( rawid )[2];
1045  _identifiers[4] = tTopo->tibLayer( rawid );
1046  _identifiers[5] = 999;
1047  break;
1048  }
1049  case 4:
1050  {
1051 
1052  _identifiers[0] = tTopo->tidModuleInfo( rawid )[0];
1053  _identifiers[1] = tTopo->tidModuleInfo( rawid )[1];
1054  _identifiers[2] = tTopo->tidRing( rawid );
1055  _identifiers[3] = tTopo->tidWheel( rawid );
1056  _identifiers[4] = tTopo->tidSide( rawid );
1057  _identifiers[5] = 999;
1058  break;
1059  }
1060  case 5:
1061  {
1062 
1063  _identifiers[0] = tTopo->tobModule( rawid );
1064  _identifiers[1] = tTopo->tobRodInfo( rawid )[0];
1065  _identifiers[2] = tTopo->tobRodInfo( rawid )[1];
1066  _identifiers[3] = tTopo->tobLayer( rawid );
1067  _identifiers[4] = 999;
1068  _identifiers[5] = 999;
1069  break;
1070  }
1071  case 6:
1072  {
1073 
1074  _identifiers[0] = tTopo->tecModule( rawid );
1075  _identifiers[1] = tTopo->tecRing( rawid );
1076  _identifiers[2] = tTopo->tecPetalInfo( rawid )[0];
1077  _identifiers[3] = tTopo->tecPetalInfo( rawid )[1];
1078  _identifiers[4] = tTopo->tecWheel( rawid );
1079  _identifiers[5] = tTopo->tecSide( rawid );
1080  break;
1081  }
1082  default:
1083  {
1084  edm::LogInfo("TrackerGeometryCompare") << "Error: bad subdetid!!";
1085  break;
1086  }
1087 
1088  }
1089 }
unsigned int tibLayer(const DetId &id) const
unsigned int tidRing(const DetId &id) const
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
unsigned int pxbLadder(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
std::vector< unsigned int > tibStringInfo(const DetId &id) const
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
unsigned int tidSide(const DetId &id) const
std::vector< unsigned int > tobRodInfo(const DetId &id) const
unsigned int tibModule(const DetId &id) const
unsigned int pxfModule(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
unsigned int tecModule(const DetId &id) const
unsigned int tobModule(const DetId &id) const
unsigned int pxfSide(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const
void TrackerGeometryCompare::fillTree ( Alignable refAli,
const AlgebraicVector diff,
const TrackerTopology tTopo,
const edm::EventSetup iSetup 
)
private

Definition at line 806 of file TrackerGeometryCompare.cc.

References _alignTree, _alphaVal, _badModuleQuality, _betaVal, _dalphaVal, _daVal, _dbetaVal, _dbVal, _detDim, _detIdFlag, _dgammaVal, _dgVal, _dphiVal, _drVal, _duVal, _dvVal, _dwVal, _dxVal, _dyVal, _dzVal, _etaVal, _gammaVal, _id, _inModuleList, _level, _mid, _mlevel, _moduleList, _phiVal, _rVal, _sublevel, _surLength, _surRot, _surWidth, _useDetId, _xVal, _yVal, _zVal, align::AlignableDet, align::AlignableDetUnit, Alignable::alignableObjectId(), PV3DBase< T, PVType, FrameType >::eta(), fillIdentifiers(), g, Alignable::geomDetId(), edm::EventSetup::get(), Alignable::globalPosition(), Alignable::globalRotation(), mps_fire::i, Alignable::id(), SiStripQuality::IsModuleBad(), SiPixelQuality::IsModuleBad(), AlignableSurface::length(), Alignable::mother(), passIdCut(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), DetId::rawId(), makeMuonMisalignmentScenario::rot, DetId::subdetId(), Alignable::surface(), align::toAngles(), 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(), and core.AutoFillTreeProducer.AutoFillTreeProducer::process().

806  {
807 
808  //Get bad modules
809  edm::ESHandle<SiPixelQuality> SiPixelModules;
810  iSetup.get<SiPixelQualityRcd>().get(SiPixelModules);
811  edm::ESHandle<SiStripQuality> SiStripModules;
812  iSetup.get<SiStripQualityRcd>().get(SiStripModules);
813 
814  _id = refAli->id();
815 
816  _badModuleQuality = 0;
817  //check if module has a bad quality tag
818  if (SiPixelModules->IsModuleBad(_id)){
819  _badModuleQuality = 1;
820 
821  }
822  if (SiStripModules->IsModuleBad(_id)){
823  _badModuleQuality = 1;
824  }
825 
826  //check if module is in a given list of bad/untouched etc. modules
827  _inModuleList = 0;
828  for (unsigned int i = 0 ; i< _moduleList.size(); i++){
829  if ( _moduleList[i] == _id)
830  {
831  _inModuleList = 1;
832  break;
833  }
834  }
835 
836  _level = refAli->alignableObjectId();
837  //need if ali has no mother
838  if (refAli->mother()){
839  _mid = refAli->mother()->geomDetId().rawId();
840  _mlevel = refAli->mother()->alignableObjectId();
841  }
842  else{
843  _mid = -1;
844  _mlevel = -1;
845  }
846  DetId detid(_id);
847  _sublevel = detid.subdetId();
848  fillIdentifiers(_sublevel, _id , tTopo);
849  _xVal = refAli->globalPosition().x();
850  _yVal = refAli->globalPosition().y();
851  _zVal = refAli->globalPosition().z();
853  _rVal = vec.perp();
854  _phiVal = vec.phi();
855  _etaVal = vec.eta();
857  align::EulerAngles eulerAngles = align::toAngles(rot);
858  _alphaVal = eulerAngles[0];
859  _betaVal = eulerAngles[1];
860  _gammaVal = eulerAngles[2];
861  // global
862  _dxVal = diff[0];
863  _dyVal = diff[1];
864  _dzVal = diff[2];
865  // local
866  _duVal = diff[6];
867  _dvVal = diff[7];
868  _dwVal = diff[8];
869  //...TODO...
871  //getting dR and dPhi
874  _drVal = vCur.perp() - vRef.perp();
875  _dphiVal = vCur.phi() - vRef.phi();
876  // global
877  _dalphaVal = diff[3];
878  _dbetaVal = diff[4];
879  _dgammaVal = diff[5];
880  // local
881  _daVal = diff[9];
882  _dbVal = diff[10];
883  _dgVal = diff[11];
884 
885  //detIdFlag
886  if (refAli->alignableObjectId() == align::AlignableDetUnit){
887  if (_detIdFlag){
888  if ((passIdCut(refAli->id()))||(passIdCut(refAli->mother()->id()))){
889  _useDetId = 1;
890  }
891  else{
892  _useDetId = 0;
893  }
894  }
895  }
896  // det module dimension
897  if (refAli->alignableObjectId() == align::AlignableDetUnit){
898  if (refAli->mother()->alignableObjectId() != align::AlignableDet) _detDim = 1;
899  else if (refAli->mother()->alignableObjectId() == align::AlignableDet) _detDim = 2;
900  }
901  else _detDim = 0;
902 
903  _surWidth = refAli->surface().width();
904  _surLength = refAli->surface().length();
905  align::RotationType rt = refAli->globalRotation();
906  _surRot[0] = rt.xx(); _surRot[1] = rt.xy(); _surRot[2] = rt.xz();
907  _surRot[3] = rt.yx(); _surRot[4] = rt.yy(); _surRot[5] = rt.yz();
908  _surRot[6] = rt.zx(); _surRot[7] = rt.zy(); _surRot[8] = rt.zz();
909 
910  //Fill
911  _alignTree->Fill();
912 
913 }
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:189
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
T y() const
Definition: PV3DBase.h:63
T yx() const
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:141
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
T zx() const
T xy() const
T zz() const
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
T z() const
Definition: PV3DBase.h:64
T zy() const
bool IsModuleBad(const uint32_t &detid) const
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:9
T yy() const
bool IsModuleBad(const uint32_t &detid) const
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:135
Definition: DetId.h:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
align::Scalar length() const
void fillIdentifiers(int subdetlevel, int rawid, const TrackerTopology *tTopo)
T xz() const
T get() const
Definition: EventSetup.h:68
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:138
std::vector< int > _moduleList
T x() const
Definition: PV3DBase.h:62
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:94
T yz() const
const DetId & geomDetId() const
Definition: Alignable.h:186
bool TrackerGeometryCompare::passIdCut ( uint32_t  id)
private

Definition at line 998 of file TrackerGeometryCompare.cc.

References _detIdFlagVector, and mps_fire::i.

Referenced by fillTree().

998  {
999 
1000  bool pass = false;
1001  int nEntries = _detIdFlagVector.size();
1002 
1003  for (int i = 0; i < nEntries; i++){
1004  if (_detIdFlagVector[i] == id) pass = true;
1005  }
1006 
1007  return pass;
1008 
1009 }
std::vector< uint32_t > _detIdFlagVector
void TrackerGeometryCompare::setCommonTrackerSystem ( )
private

Definition at line 709 of file TrackerGeometryCompare.cc.

References _commonTrackerLevel, _setCommonTrackerSystem, _TrackerCommonCM, _TrackerCommonR, _TrackerCommonT, currentTracker, diffCommonTrackerSystem(), Alignable::globalPosition(), align::moveAlignable(), AlignableTracker::objectIdProvider(), referenceTracker, makeMuonMisalignmentScenario::rot, AlignableObjectId::stringToId(), align::toMatrix(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

709  {
710 
711  edm::LogInfo("TrackerGeometryCompare") << "Setting Common Tracker System....";
712 
713  // DM_534??AlignableObjectId dummy;
714  // DM_534??_commonTrackerLevel = dummy.nameToType(_setCommonTrackerSystem);
716 
718 
719  align::EulerAngles dOmega(3); dOmega[0] = _TrackerCommonR.x() ; dOmega[1] = _TrackerCommonR.y(); dOmega[2] = _TrackerCommonR.z();
722 
723  edm::LogInfo("TrackerGeometryCompare") << "what we get from overlaying the pixels..." << theR << ", " << rot;
724 
725  //transform to the Tracker System
727  align::GlobalVector cmDiff( trackerCM.x()-_TrackerCommonCM.x(), trackerCM.y()-_TrackerCommonCM.y(), trackerCM.z()-_TrackerCommonCM.z() );
728 
729  edm::LogInfo("TrackerGeometryCompare") << "Pixel CM: " << _TrackerCommonCM << ", tracker CM: " << trackerCM;
730 
731  //adjust translational difference factoring in different rotational CM
732  //needed because rotateInGlobalFrame is about CM of alignable, not Tracker
733  const align::GlobalVector::BasicVectorType& lpvgf = cmDiff.basicVector();
734  align::GlobalVector moveV( rot.multiplyInverse(lpvgf) - lpvgf);
735  align::GlobalVector theRprime(theR + moveV);
736 
737  AlgebraicVector TrackerCommonTR(6);
738  TrackerCommonTR(1) = theRprime.x(); TrackerCommonTR(2) = theRprime.y(); TrackerCommonTR(3) = theRprime.z();
739  TrackerCommonTR(4) = _TrackerCommonR.x(); TrackerCommonTR(5) = _TrackerCommonR.y(); TrackerCommonTR(6) = _TrackerCommonR.z();
740 
741  edm::LogInfo("TrackerGeometryCompare") << "and after the transformation: " << TrackerCommonTR;
742 
743  align::moveAlignable(currentTracker, TrackerCommonTR );
744 
745 }
align::StructureType stringToId(const char *) const
align::GlobalVector _TrackerCommonR
align::GlobalVector _TrackerCommonT
T y() const
Definition: PV3DBase.h:63
void diffCommonTrackerSystem(Alignable *refAli, Alignable *curAli)
T z() const
Definition: PV3DBase.h:64
align::StructureType _commonTrackerLevel
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker&#39;s geometry.
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:42
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:138
T x() const
Definition: PV3DBase.h:62
void moveAlignable(Alignable *ali, AlgebraicVector diff)
Moves the alignable by the AlgebraicVector.
Definition: AlignTools.cc:81
void TrackerGeometryCompare::surveyToTracker ( AlignableTracker ali,
Alignments alignVals,
AlignmentErrorsExtended alignErrors 
)
private

Definition at line 915 of file TrackerGeometryCompare.cc.

References AlCaHLTBitMon_QueryRunRegistry::comp, popcon2dropbox::copy(), AlignableTracker::endcapGeomDets(), mps_fire::i, AlignableTracker::innerBarrelGeomDets(), gen::k, Alignments::m_align, AlignmentErrorsExtended::m_alignError, AlignableTracker::outerBarrelGeomDets(), AlignableTracker::pixelEndcapGeomDets(), AlignableTracker::pixelHalfBarrelGeomDets(), SurveyDet::position(), makeMuonMisalignmentScenario::rot, SurveyDet::rotation(), AlignableTracker::TIDGeomDets(), and create_public_lumi_plots::transform.

915  {
916 
917  //getting the right alignables for the alignment record
918  auto detPB = ali->pixelHalfBarrelGeomDets();
919  auto detPEC = ali->pixelEndcapGeomDets();
920  auto detTIB = ali->innerBarrelGeomDets();
921  auto detTID = ali->TIDGeomDets();
922  auto detTOB = ali->outerBarrelGeomDets();
923  auto detTEC = ali->endcapGeomDets();
924 
925  align::Alignables allGeomDets;
926  std::copy(detPB.begin(), detPB.end(), std::back_inserter(allGeomDets));
927  std::copy(detPEC.begin(), detPEC.end(), std::back_inserter(allGeomDets));
928  std::copy(detTIB.begin(), detTIB.end(), std::back_inserter(allGeomDets));
929  std::copy(detTID.begin(), detTID.end(), std::back_inserter(allGeomDets));
930  std::copy(detTOB.begin(), detTOB.end(), std::back_inserter(allGeomDets));
931  std::copy(detTEC.begin(), detTEC.end(), std::back_inserter(allGeomDets));
932 
933  align::Alignables rcdAlis;
934  for (const auto& i: allGeomDets){
935  if (i->components().size() == 1){
936  rcdAlis.push_back(i);
937  }
938  else if (i->components().size() > 1){
939  rcdAlis.push_back(i);
940  const auto& comp = i->components();
941  for (const auto& j: comp) rcdAlis.push_back(j);
942  }
943  }
944 
945  //turning them into alignments
946  for(const auto& k: rcdAlis) {
947  const SurveyDet* surveyInfo = k->survey();
948  const align::PositionType& pos(surveyInfo->position());
949  align::RotationType rot(surveyInfo->rotation());
950  CLHEP::Hep3Vector clhepVector(pos.x(),pos.y(),pos.z());
951  CLHEP::HepRotation clhepRotation( CLHEP::HepRep3x3(rot.xx(),rot.xy(),rot.xz(),rot.yx(),rot.yy(),rot.yz(),rot.zx(),rot.zy(),rot.zz()));
952  AlignTransform transform(clhepVector, clhepRotation, k->id());
953  AlignTransformErrorExtended transformError(CLHEP::HepSymMatrix(3,1), k->id());
954  alignVals->m_align.push_back(transform);
955  alignErrors->m_alignError.push_back(transformError);
956  }
957 
958  // to get the right order, sort by rawId
959  std::sort( alignVals->m_align.begin(), alignVals->m_align.end());
960  std::sort( alignErrors->m_alignError.begin(), alignErrors->m_alignError.end());
961 
962 }
Alignables & pixelHalfBarrelGeomDets()
Return pixel barrel GeomDets.
def copy(args, dbName)
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
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.
Alignables & endcapGeomDets()
Return endcap GeomDets.
Alignables & pixelEndcapGeomDets()
Return pixel endcap GeomDets.
int k[5][pyjets_maxn]
Alignables & outerBarrelGeomDets()
Return outer barrel GeomDets.
std::vector< AlignTransformErrorExtended > m_alignError
std::vector< Alignable * > Alignables
Definition: Utilities.h:32

Member Data Documentation

TTree* TrackerGeometryCompare::_alignTree
private

Definition at line 134 of file TrackerGeometryCompare.h.

Referenced by endJob(), fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_alphaVal
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_badModuleQuality
private

Definition at line 143 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_betaVal
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

align::StructureType TrackerGeometryCompare::_commonTrackerLevel
private

Definition at line 122 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

float TrackerGeometryCompare::_dalphaVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_daVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dbetaVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dbVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_detDim
private

Definition at line 143 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

bool TrackerGeometryCompare::_detIdFlag
private

Definition at line 115 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

std::string TrackerGeometryCompare::_detIdFlagFile
private

Definition at line 116 of file TrackerGeometryCompare.h.

Referenced by TrackerGeometryCompare().

std::vector< uint32_t > TrackerGeometryCompare::_detIdFlagVector
private

Definition at line 121 of file TrackerGeometryCompare.h.

Referenced by passIdCut(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dgammaVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dgVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dphiVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_drVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_duVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dvVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dwVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dxVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dyVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dzVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_etaVal
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

std::string TrackerGeometryCompare::_filename
private
float TrackerGeometryCompare::_gammaVal
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_id
private

\ Tree variables

Definition at line 143 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

uint32_t TrackerGeometryCompare::_identifiers[6]
private

Definition at line 150 of file TrackerGeometryCompare.h.

Referenced by fillIdentifiers(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_inModuleList
private

Definition at line 143 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

std::string TrackerGeometryCompare::_inputFilename1
private
std::string TrackerGeometryCompare::_inputFilename2
private
TFile* TrackerGeometryCompare::_inputRootFile1
private

Definition at line 135 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and createROOTGeometry().

TFile* TrackerGeometryCompare::_inputRootFile2
private

Definition at line 136 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree01
private

Definition at line 137 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree02
private

Definition at line 138 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree11
private

Definition at line 139 of file TrackerGeometryCompare.h.

Referenced by analyze(), and createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree12
private

Definition at line 140 of file TrackerGeometryCompare.h.

Referenced by analyze(), and createROOTGeometry().

std::string TrackerGeometryCompare::_inputTreenameAlign
private

Definition at line 110 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry(), and TrackerGeometryCompare().

std::string TrackerGeometryCompare::_inputTreenameDeform
private
int TrackerGeometryCompare::_level
private

Definition at line 143 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

const std::vector<std::string> TrackerGeometryCompare::_levelStrings
private

Definition at line 106 of file TrackerGeometryCompare.h.

Referenced by analyze().

int TrackerGeometryCompare::_mid
private

Definition at line 143 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_mlevel
private

Definition at line 143 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_moduleInList
private

Definition at line 129 of file TrackerGeometryCompare.h.

std::vector< int > TrackerGeometryCompare::_moduleList
private

Definition at line 128 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry(), and fillTree().

std::ifstream TrackerGeometryCompare::_moduleListFile
private

Definition at line 127 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry().

std::string TrackerGeometryCompare::_moduleListName
private

Definition at line 107 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_phiVal
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_rVal
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

std::string TrackerGeometryCompare::_setCommonTrackerSystem
private
int TrackerGeometryCompare::_sublevel
private

Definition at line 143 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

double TrackerGeometryCompare::_surfDeform[13]
private

Definition at line 153 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_surLength
private

Definition at line 149 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

double TrackerGeometryCompare::_surRot[9]
private

Definition at line 151 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_surWidth
private

Definition at line 149 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

TFile* TrackerGeometryCompare::_theFile
private

Definition at line 133 of file TrackerGeometryCompare.h.

Referenced by endJob(), and TrackerGeometryCompare().

align::PositionType TrackerGeometryCompare::_TrackerCommonCM
private

Definition at line 125 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

align::GlobalVector TrackerGeometryCompare::_TrackerCommonR
private

Definition at line 124 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

align::GlobalVector TrackerGeometryCompare::_TrackerCommonT
private

Definition at line 123 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

int TrackerGeometryCompare::_type
private
int TrackerGeometryCompare::_useDetId
private

Definition at line 143 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 118 of file TrackerGeometryCompare.h.

Referenced by TrackerGeometryCompare().

std::vector< unsigned int > TrackerGeometryCompare::_weightByIdVector
private
bool TrackerGeometryCompare::_writeToDB
private

Definition at line 112 of file TrackerGeometryCompare.h.

Referenced by analyze().

float TrackerGeometryCompare::_xVal
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_yVal
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_zVal
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

AlignableTracker* TrackerGeometryCompare::currentTracker
private

Definition at line 99 of file TrackerGeometryCompare.h.

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

AlignableTracker* TrackerGeometryCompare::dummyTracker
private

Definition at line 98 of file TrackerGeometryCompare.h.

bool TrackerGeometryCompare::firstEvent_
private

Definition at line 159 of file TrackerGeometryCompare.h.

Referenced by analyze(), and beginJob().

std::map<std::string,TH1D*> TrackerGeometryCompare::m_h1
private

Definition at line 163 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

int TrackerGeometryCompare::m_nBins
private

Definition at line 155 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

double TrackerGeometryCompare::m_rangeHigh
private

Definition at line 157 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

double TrackerGeometryCompare::m_rangeLow
private

Definition at line 156 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

std::vector<align::StructureType> TrackerGeometryCompare::m_theLevels
private

Definition at line 73 of file TrackerGeometryCompare.h.

Referenced by analyze(), and compareGeometries().

std::vector<TrackerMap> TrackerGeometryCompare::m_vtkmap
private
AlignableTracker* TrackerGeometryCompare::referenceTracker
private

Definition at line 97 of file TrackerGeometryCompare.h.

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

const SurveyErrors* TrackerGeometryCompare::theSurveyErrors
private

Definition at line 103 of file TrackerGeometryCompare.h.

Referenced by addSurveyInfo().

unsigned int TrackerGeometryCompare::theSurveyIndex
private

Definition at line 101 of file TrackerGeometryCompare.h.

Referenced by addSurveyInfo().

const Alignments* TrackerGeometryCompare::theSurveyValues
private

Definition at line 102 of file TrackerGeometryCompare.h.

Referenced by addSurveyInfo().