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 std::vector< Alignable * > Alignables
 
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

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 Read from DB and print survey info. More...
 
virtual void endJob ()
 
 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 ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & itemsToGetFromEvent () 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
 
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 &)
 
- 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 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 50 of file TrackerGeometryCompare.h.

Member Typedef Documentation

Definition at line 54 of file TrackerGeometryCompare.h.

Definition at line 52 of file TrackerGeometryCompare.h.

Definition at line 53 of file TrackerGeometryCompare.h.

Constructor & Destructor Documentation

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

Do nothing. Required by framework.

Definition at line 61 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(), hcalTTPDigis_cfi::id, cuy::ii, m_h1, m_nBins, m_rangeHigh, m_rangeLow, m_vtkmap, TFileDirectory::make(), TFileService::mkdir(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

942  {
943 
944  const std::vector<Alignable*>& comp = ali->components();
945 
946  unsigned int nComp = comp.size();
947 
948  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo(comp[i]);
949 
951 
952  if ( ali->geomDetId().rawId() != error.rawId() ||
953  ali->alignableObjectId() != error.structureType() )
954  {
955  throw cms::Exception("DatabaseError")
956  << "Error reading survey info from DB. Mismatched id!";
957  }
958 
959  const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[theSurveyIndex].translation();
960  const CLHEP::HepRotation& rot = theSurveyValues->m_align[theSurveyIndex].rotation();
961 
962  AlignableSurface surf( align::PositionType( pos.x(), pos.y(), pos.z() ),
963  align::RotationType( rot.xx(), rot.xy(), rot.xz(),
964  rot.yx(), rot.yy(), rot.yz(),
965  rot.zx(), rot.zy(), rot.zz() ) );
966 
967  surf.setWidth( ali->surface().width() );
968  surf.setLength( ali->surface().length() );
969 
970  ali->setSurvey( new SurveyDet( surf, error.matrix() ) );
971 
972  ++theSurveyIndex;
973 
974 }
align::Scalar width() const
ErrorMatrix matrix() const
Definition: SurveyError.h:76
const Alignments * theSurveyValues
void addSurveyInfo(Alignable *ali)
uint8_t structureType() const
Definition: SurveyError.h:66
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
virtual Alignables components() const =0
Return vector of all direct components.
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:356
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 
)
virtual

Definition at line 226 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().

226  {
227 
228  if (firstEvent_) {
229 
230  //Retrieve tracker topology from geometry
231  edm::ESHandle<TrackerTopology> tTopoHandle;
232  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
233  const TrackerTopology* const tTopo = tTopoHandle.product();
234 
235  //upload the ROOT geometries
236  createROOTGeometry(iSetup);
237 
238  //setting the levels being used in the geometry comparator
239  edm::LogInfo("TrackerGeometryCompare") << "levels: " << _levelStrings.size();
240  for (const auto& level: _levelStrings){
242  edm::LogInfo("TrackerGeometryCompare") << "level: " << level;
243  edm::LogInfo("TrackerGeometryCompare")
244  << "structure type: "
246  }
247 
248 
249  //set common tracker system first
250  // if setting the tracker common system
251  if (_setCommonTrackerSystem != "NONE"){
253  }
254 
255  //compare the goemetries
258 
259  //write out ntuple
260  //might be better to do within output module
261 
262  if (_writeToDB){
263  Alignments* myAlignments = currentTracker->alignments();
264  AlignmentErrorsExtended* myAlignmentErrorsExtended = currentTracker->alignmentErrors();
265 
266  // 2. Store alignment[Error]s to DB
268  // Call service
269  if( !poolDbService.isAvailable() ) // Die if not available
270  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
271 
272  poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), "TrackerAlignmentRcd");
273  poolDbService->writeOne<AlignmentErrorsExtended>(&(*myAlignmentErrorsExtended), poolDbService->beginOfTime(), "TrackerAlignmentErrorExtendedRcd");
274 
275  }
276 
277  firstEvent_ = false;
278  }
279 }
align::StructureType stringToId(const char *) const
void compareGeometries(Alignable *refAli, Alignable *curAli, const TrackerTopology *tTopo, const edm::EventSetup &iSetup)
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
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
const T & get() const
Definition: EventSetup.h:56
AlignableTracker * referenceTracker
void createROOTGeometry(const edm::EventSetup &iSetup)
Alignments * alignments() const
Return alignments, sorted by DetId.
T const * product() const
Definition: ESHandle.h:86
void compareSurfaceDeformations(TTree *_inputTree11, TTree *_inputTree12)
void TrackerGeometryCompare::beginJob ( void  )
virtual

Read from DB and print survey info.

Reimplemented from edm::EDAnalyzer.

Definition at line 202 of file TrackerGeometryCompare.cc.

References firstEvent_.

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

Definition at line 611 of file TrackerGeometryCompare.cc.

References _weightBy, _weightById, _weightByIdVector, Alignable::alignableObjectId(), trackerTree::check(), Alignable::components(), mps_update::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 RecoTauCleanerPlugins::tolerance.

Referenced by analyze().

611  {
612 
613  using namespace align ;
614 
615  const std::vector<Alignable*>& refComp = refAli->components();
616  const std::vector<Alignable*>& curComp = curAli->components();
617 
618  unsigned int nComp = refComp.size();
619  //only perform for designate levels
620  bool useLevel = false;
621  for (unsigned int i = 0; i < m_theLevels.size(); ++i){
622  if (refAli->alignableObjectId() == m_theLevels[i]) useLevel = true;
623  }
624 
625  //another added level for difference between det and detunit
626  //if ((refAli->alignableObjectId()==2)&&(nComp == 1)) useLevel = false;
627 
628  //coordinate matching, etc etc
629  if (useLevel){
630  DetId detid(refAli->id());
631 
632  CLHEP::Hep3Vector Rtotal, Wtotal, lRtotal, lWtotal;
633  Rtotal.set(0.,0.,0.);
634  Wtotal.set(0.,0.,0.);
635  lRtotal.set(0.,0.,0.);
636  lWtotal.set(0.,0.,0.);
637 
638  for (int i = 0; i < 100; i++){
640  CLHEP::Hep3Vector dR(diff[0],diff[1],diff[2]);
641  Rtotal+=dR;
642  CLHEP::Hep3Vector dW(diff[3],diff[4],diff[5]);
643  CLHEP::HepRotation rot(Wtotal.unit(),Wtotal.mag());
644  CLHEP::HepRotation drot(dW.unit(),dW.mag());
645  rot*=drot;
646  Wtotal.set(rot.axis().x()*rot.delta(), rot.axis().y()*rot.delta(), rot.axis().z()*rot.delta());
647  // local coordinates
648  lRtotal.set(diff[6],diff[7],diff[8]);
649  lWtotal.set(diff[9],diff[10],diff[11]);
650 
651  align::moveAlignable(curAli, diff);
652  float tolerance = 1e-7;
654  align::GlobalVector checkR(check[0],check[1],check[2]);
655  align::GlobalVector checkW(check[3],check[4],check[5]);
656  if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){
657  edm::LogInfo("TrackerGeometryCompare") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId()
658  << ", rawId: " << refAli->geomDetId().rawId()
659  << ", subdetId: "<< detid.subdetId() << "): " << diff;
660  throw cms::Exception("Tolerance in TrackerGeometryCompare exceeded");
661  }
662  else{
663  break;
664  }
665  }
666 
667  AlgebraicVector TRtot(12);
668  // global
669  TRtot(1) = Rtotal.x(); TRtot(2) = Rtotal.y(); TRtot(3) = Rtotal.z();
670  TRtot(4) = Wtotal.x(); TRtot(5) = Wtotal.y(); TRtot(6) = Wtotal.z();
671  // local
672  TRtot(7) = lRtotal.x(); TRtot(8) = lRtotal.y(); TRtot(9) = lRtotal.z();
673  TRtot(10) = lWtotal.x(); TRtot(11) = lWtotal.y(); TRtot(12) = lWtotal.z();
674 
675  fillTree(refAli, TRtot, tTopo, iSetup);
676  }
677 
678  // another added level for difference between det and detunit
679  for (unsigned int i = 0; i < nComp; ++i)
680  compareGeometries(refComp[i],curComp[i],tTopo,iSetup);
681 
682 }
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
AlgebraicVector diffAlignables(Alignable *refAli, Alignable *curAli, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
Definition: AlignTools.cc:10
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
virtual Alignables components() const =0
Return vector of all direct components.
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 468 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 reco::return().

Referenced by analyze().

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

Definition at line 281 of file TrackerGeometryCompare.cc.

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

Referenced by analyze().

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

Definition at line 722 of file TrackerGeometryCompare.cc.

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

Referenced by setCommonTrackerSystem().

722  {
723 
724  const std::vector<Alignable*>& refComp = refAli->components();
725  const std::vector<Alignable*>& curComp = curAli->components();
726 
727  unsigned int nComp = refComp.size();
728  //only perform for designate levels
729  bool useLevel = false;
730  if (refAli->alignableObjectId() == _commonTrackerLevel) useLevel = true;
731 
732  //useLevel = false;
733  if (useLevel){
734  CLHEP::Hep3Vector Rtotal, Wtotal;
735  Rtotal.set(0.,0.,0.); Wtotal.set(0.,0.,0.);
736 
738  CLHEP::Hep3Vector dR(diff[0],diff[1],diff[2]);
739  Rtotal+=dR;
740  CLHEP::Hep3Vector dW(diff[3],diff[4],diff[5]);
741  CLHEP::HepRotation rot(Wtotal.unit(),Wtotal.mag());
742  CLHEP::HepRotation drot(dW.unit(),dW.mag());
743  rot*=drot;
744  Wtotal.set(rot.axis().x()*rot.delta(), rot.axis().y()*rot.delta(), rot.axis().z()*rot.delta());
745  /*
746  //std::cout << "a";
747  //if (refAli->alignableObjectId() == 1) std::cout << "DIFF: " << diff << std::endl;
748  align::moveAlignable(curAli, diff);
749  float tolerance = 1e-7;
750  AlgebraicVector check = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector);
751  align::GlobalVector checkR(check[0],check[1],check[2]);
752  align::GlobalVector checkW(check[3],check[4],check[5]);
753  DetId detid(refAli->id());
754  if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){
755  edm::LogInfo("TrackerGeometryCompare") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId()
756  << ", rawId: " << refAli->geomDetId().rawId()
757  << ", subdetId: "<< detid.subdetId() << "): " << diff;
758  }
759  else{
760  break;
761  }
762  }
763  */
764 
765  //_TrackerCommonT.set(Rtotal.x(), Rtotal.y(), Rtotal.z());
766  _TrackerCommonT = align::GlobalVector(Rtotal.x(), Rtotal.y(), Rtotal.z());
767  _TrackerCommonR = align::GlobalVector(Wtotal.x(), Wtotal.y(), Wtotal.z());
768  _TrackerCommonCM = curAli->globalPosition();
769  //_TrackerCommonTR(1) = Rtotal.x(); _TrackerCommonTR(2) = Rtotal.y(); _TrackerCommonTR(3) = Rtotal.z();
770  //_TrackerCommonTR(4) = Wtotal.x(); _TrackerCommonTR(5) = Wtotal.y(); _TrackerCommonTR(6) = Wtotal.z();
771 
772 
773  }
774  else{
775  for (unsigned int i = 0; i < nComp; ++i) diffCommonTrackerSystem(refComp[i],curComp[i]);
776  }
777 
778 
779 }
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 StructureType alignableObjectId() const =0
Return the alignable type identifier.
virtual Alignables components() const =0
Return vector of all direct components.
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  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 206 of file TrackerGeometryCompare.cc.

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

Referenced by o2olib.O2ORunMgr::executeJob().

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

Definition at line 989 of file TrackerGeometryCompare.cc.

References _identifiers, gather_cfg::cout, 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().

989  {
990 
991 
992  switch( subdetlevel ){
993 
994  case 1:
995  {
996 
997  _identifiers[0] = tTopo->pxbModule( rawid );
998  _identifiers[1] = tTopo->pxbLadder( rawid );
999  _identifiers[2] = tTopo->pxbLayer( rawid );
1000  _identifiers[3] = 999;
1001  _identifiers[4] = 999;
1002  _identifiers[5] = 999;
1003  break;
1004  }
1005  case 2:
1006  {
1007 
1008  _identifiers[0] = tTopo->pxfModule( rawid );
1009  _identifiers[1] = tTopo->pxfPanel( rawid );
1010  _identifiers[2] = tTopo->pxfBlade( rawid );
1011  _identifiers[3] = tTopo->pxfDisk( rawid );
1012  _identifiers[4] = tTopo->pxfSide( rawid );
1013  _identifiers[5] = 999;
1014  break;
1015  }
1016  case 3:
1017  {
1018 
1019  _identifiers[0] = tTopo->tibModule( rawid );
1020  _identifiers[1] = tTopo->tibStringInfo( rawid )[0];
1021  _identifiers[2] = tTopo->tibStringInfo( rawid )[1];
1022  _identifiers[3] = tTopo->tibStringInfo( rawid )[2];
1023  _identifiers[4] = tTopo->tibLayer( rawid );
1024  _identifiers[5] = 999;
1025  break;
1026  }
1027  case 4:
1028  {
1029 
1030  _identifiers[0] = tTopo->tidModuleInfo( rawid )[0];
1031  _identifiers[1] = tTopo->tidModuleInfo( rawid )[1];
1032  _identifiers[2] = tTopo->tidRing( rawid );
1033  _identifiers[3] = tTopo->tidWheel( rawid );
1034  _identifiers[4] = tTopo->tidSide( rawid );
1035  _identifiers[5] = 999;
1036  break;
1037  }
1038  case 5:
1039  {
1040 
1041  _identifiers[0] = tTopo->tobModule( rawid );
1042  _identifiers[1] = tTopo->tobRodInfo( rawid )[0];
1043  _identifiers[2] = tTopo->tobRodInfo( rawid )[1];
1044  _identifiers[3] = tTopo->tobLayer( rawid );
1045  _identifiers[4] = 999;
1046  _identifiers[5] = 999;
1047  break;
1048  }
1049  case 6:
1050  {
1051 
1052  _identifiers[0] = tTopo->tecModule( rawid );
1053  _identifiers[1] = tTopo->tecRing( rawid );
1054  _identifiers[2] = tTopo->tecPetalInfo( rawid )[0];
1055  _identifiers[3] = tTopo->tecPetalInfo( rawid )[1];
1056  _identifiers[4] = tTopo->tecWheel( rawid );
1057  _identifiers[5] = tTopo->tecSide( rawid );
1058  break;
1059  }
1060  default:
1061  {
1062  std::cout << "Error: bad subdetid!!" << std::endl;
1063  break;
1064  }
1065 
1066  }
1067 }
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 781 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().

781  {
782 
783  //Get bad modules
784  edm::ESHandle<SiPixelQuality> SiPixelModules;
785  iSetup.get<SiPixelQualityRcd>().get(SiPixelModules);
786  edm::ESHandle<SiStripQuality> SiStripModules;
787  iSetup.get<SiStripQualityRcd>().get(SiStripModules);
788 
789  _id = refAli->id();
790 
791  _badModuleQuality = 0;
792  //check if module has a bad quality tag
793  if (SiPixelModules->IsModuleBad(_id)){
794  _badModuleQuality = 1;
795 
796  }
797  if (SiStripModules->IsModuleBad(_id)){
798  _badModuleQuality = 1;
799  }
800 
801  //check if module is in a given list of bad/untouched etc. modules
802  _inModuleList = 0;
803  for (unsigned int i = 0 ; i< _moduleList.size(); i++){
804  if ( _moduleList[i] == _id)
805  {
806  _inModuleList = 1;
807  break;
808  }
809  }
810 
811  _level = refAli->alignableObjectId();
812  //need if ali has no mother
813  if (refAli->mother()){
814  _mid = refAli->mother()->geomDetId().rawId();
815  _mlevel = refAli->mother()->alignableObjectId();
816  }
817  else{
818  _mid = -1;
819  _mlevel = -1;
820  }
821  DetId detid(_id);
822  _sublevel = detid.subdetId();
823  fillIdentifiers(_sublevel, _id , tTopo);
824  _xVal = refAli->globalPosition().x();
825  _yVal = refAli->globalPosition().y();
826  _zVal = refAli->globalPosition().z();
828  _rVal = vec.perp();
829  _phiVal = vec.phi();
830  _etaVal = vec.eta();
832  align::EulerAngles eulerAngles = align::toAngles(rot);
833  _alphaVal = eulerAngles[0];
834  _betaVal = eulerAngles[1];
835  _gammaVal = eulerAngles[2];
836  // global
837  _dxVal = diff[0];
838  _dyVal = diff[1];
839  _dzVal = diff[2];
840  // local
841  _duVal = diff[6];
842  _dvVal = diff[7];
843  _dwVal = diff[8];
844  //...TODO...
846  //getting dR and dPhi
849  _drVal = vCur.perp() - vRef.perp();
850  _dphiVal = vCur.phi() - vRef.phi();
851  // global
852  _dalphaVal = diff[3];
853  _dbetaVal = diff[4];
854  _dgammaVal = diff[5];
855  // local
856  _daVal = diff[9];
857  _dbVal = diff[10];
858  _dgVal = diff[11];
859 
860  //detIdFlag
861  if (refAli->alignableObjectId() == align::AlignableDetUnit){
862  if (_detIdFlag){
863  if ((passIdCut(refAli->id()))||(passIdCut(refAli->mother()->id()))){
864  _useDetId = 1;
865  }
866  else{
867  _useDetId = 0;
868  }
869  }
870  }
871  // det module dimension
872  if (refAli->alignableObjectId() == align::AlignableDetUnit){
873  if (refAli->mother()->alignableObjectId() != align::AlignableDet) _detDim = 1;
874  else if (refAli->mother()->alignableObjectId() == align::AlignableDet) _detDim = 2;
875  }
876  else _detDim = 0;
877 
878  _surWidth = refAli->surface().width();
879  _surLength = refAli->surface().length();
880  align::RotationType rt = refAli->globalRotation();
881  _surRot[0] = rt.xx(); _surRot[1] = rt.xy(); _surRot[2] = rt.xz();
882  _surRot[3] = rt.yx(); _surRot[4] = rt.yy(); _surRot[5] = rt.yz();
883  _surRot[6] = rt.zx(); _surRot[7] = rt.zy(); _surRot[8] = rt.zz();
884 
885  //Fill
886  _alignTree->Fill();
887 
888 }
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
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
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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
const T & get() const
Definition: EventSetup.h:56
void fillIdentifiers(int subdetlevel, int rawid, const TrackerTopology *tTopo)
T xz() const
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 976 of file TrackerGeometryCompare.cc.

References _detIdFlagVector, and mps_fire::i.

Referenced by fillTree().

976  {
977 
978  bool pass = false;
979  int nEntries = _detIdFlagVector.size();
980 
981  for (int i = 0; i < nEntries; i++){
982  if (_detIdFlagVector[i] == id) pass = true;
983  }
984 
985  return pass;
986 
987 }
std::vector< uint32_t > _detIdFlagVector
void TrackerGeometryCompare::setCommonTrackerSystem ( )
private

Definition at line 684 of file TrackerGeometryCompare.cc.

References _commonTrackerLevel, _setCommonTrackerSystem, _TrackerCommonCM, _TrackerCommonR, _TrackerCommonT, gather_cfg::cout, currentTracker, diffCommonTrackerSystem(), Alignable::globalPosition(), align::moveAlignable(), TkRotation< T >::multiplyInverse(), 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().

684  {
685 
686  edm::LogInfo("TrackerGeometryCompare") << "Setting Common Tracker System....";
687 
688  // DM_534??AlignableObjectId dummy;
689  // DM_534??_commonTrackerLevel = dummy.nameToType(_setCommonTrackerSystem);
691 
693 
694  align::EulerAngles dOmega(3); dOmega[0] = _TrackerCommonR.x() ; dOmega[1] = _TrackerCommonR.y(); dOmega[2] = _TrackerCommonR.z();
697 
698  std::cout << "what we get from overlaying the pixels..." << theR << ", " << rot << std::endl;
699 
700  //transform to the Tracker System
702  align::GlobalVector cmDiff( trackerCM.x()-_TrackerCommonCM.x(), trackerCM.y()-_TrackerCommonCM.y(), trackerCM.z()-_TrackerCommonCM.z() );
703 
704  std::cout << "Pixel CM: " << _TrackerCommonCM << ", tracker CM: " << trackerCM << std::endl;
705 
706  //adjust translational difference factoring in different rotational CM
707  //needed because rotateInGlobalFrame is about CM of alignable, not Tracker
708  align::GlobalVector::BasicVectorType lpvgf = cmDiff.basicVector();
709  align::GlobalVector moveV( rot.multiplyInverse(lpvgf) - lpvgf);
710  align::GlobalVector theRprime(theR + moveV);
711 
712  AlgebraicVector TrackerCommonTR(6);
713  TrackerCommonTR(1) = theRprime.x(); TrackerCommonTR(2) = theRprime.y(); TrackerCommonTR(3) = theRprime.z();
714  TrackerCommonTR(4) = _TrackerCommonR.x(); TrackerCommonTR(5) = _TrackerCommonR.y(); TrackerCommonTR(6) = _TrackerCommonR.z();
715 
716  std::cout << "and after the transformation: " << TrackerCommonTR << std::endl;
717 
718  align::moveAlignable(currentTracker, TrackerCommonTR );
719 
720 }
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
Basic3DVector< T > multiplyInverse(const Basic3DVector< T > &v) const
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 890 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.

890  {
891 
892  //getting the right alignables for the alignment record
893  std::vector<Alignable*> detPB = ali->pixelHalfBarrelGeomDets();
894  std::vector<Alignable*> detPEC = ali->pixelEndcapGeomDets();
895  std::vector<Alignable*> detTIB = ali->innerBarrelGeomDets();
896  std::vector<Alignable*> detTID = ali->TIDGeomDets();
897  std::vector<Alignable*> detTOB = ali->outerBarrelGeomDets();
898  std::vector<Alignable*> detTEC = ali->endcapGeomDets();
899 
900  std::vector<Alignable*> allGeomDets;
901  std::copy(detPB.begin(), detPB.end(), std::back_inserter(allGeomDets));
902  std::copy(detPEC.begin(), detPEC.end(), std::back_inserter(allGeomDets));
903  std::copy(detTIB.begin(), detTIB.end(), std::back_inserter(allGeomDets));
904  std::copy(detTID.begin(), detTID.end(), std::back_inserter(allGeomDets));
905  std::copy(detTOB.begin(), detTOB.end(), std::back_inserter(allGeomDets));
906  std::copy(detTEC.begin(), detTEC.end(), std::back_inserter(allGeomDets));
907 
908  std::vector<Alignable*> rcdAlis;
909  for (std::vector<Alignable*>::iterator i = allGeomDets.begin(); i!= allGeomDets.end(); i++){
910  if ((*i)->components().size() == 1){
911  rcdAlis.push_back((*i));
912  }
913  else if ((*i)->components().size() > 1){
914  rcdAlis.push_back((*i));
915  std::vector<Alignable*> comp = (*i)->components();
916  for (std::vector<Alignable*>::iterator j = comp.begin(); j != comp.end(); j++){
917  rcdAlis.push_back((*j));
918  }
919  }
920  }
921 
922  //turning them into alignments
923  for(std::vector<Alignable*>::iterator k = rcdAlis.begin(); k != rcdAlis.end(); k++){
924 
925  const SurveyDet* surveyInfo = (*k)->survey();
926  align::PositionType pos(surveyInfo->position());
927  align::RotationType rot(surveyInfo->rotation());
928  CLHEP::Hep3Vector clhepVector(pos.x(),pos.y(),pos.z());
929  CLHEP::HepRotation clhepRotation( CLHEP::HepRep3x3(rot.xx(),rot.xy(),rot.xz(),rot.yx(),rot.yy(),rot.yz(),rot.zx(),rot.zy(),rot.zz()));
930  AlignTransform transform(clhepVector, clhepRotation, (*k)->id());
931  AlignTransformErrorExtended transformError(CLHEP::HepSymMatrix(3,1), (*k)->id());
932  alignVals->m_align.push_back(transform);
933  alignErrors->m_alignError.push_back(transformError);
934  }
935 
936  //to get the right order
937  std::sort( alignVals->m_align.begin(), alignVals->m_align.end(), lessAlignmentDetId<AlignTransform>() );
938  std::sort( alignErrors->m_alignError.begin(), alignErrors->m_alignError.end(), lessAlignmentDetId<AlignTransformErrorExtended>() );
939 
940 }
Alignables & pixelHalfBarrelGeomDets()
Return pixel barrel GeomDets.
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

Member Data Documentation

TTree* TrackerGeometryCompare::_alignTree
private

Definition at line 136 of file TrackerGeometryCompare.h.

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

float TrackerGeometryCompare::_alphaVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_badModuleQuality
private

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_betaVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

align::StructureType TrackerGeometryCompare::_commonTrackerLevel
private

Definition at line 124 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

float TrackerGeometryCompare::_dalphaVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_daVal
private

Definition at line 150 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dbetaVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dbVal
private

Definition at line 150 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_detDim
private

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

bool TrackerGeometryCompare::_detIdFlag
private

Definition at line 117 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

std::string TrackerGeometryCompare::_detIdFlagFile
private

Definition at line 118 of file TrackerGeometryCompare.h.

Referenced by TrackerGeometryCompare().

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

Definition at line 123 of file TrackerGeometryCompare.h.

Referenced by passIdCut(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dgammaVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dgVal
private

Definition at line 150 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dphiVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_drVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_duVal
private

Definition at line 150 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dvVal
private

Definition at line 150 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dwVal
private

Definition at line 150 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dxVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dyVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dzVal
private

Definition at line 148 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_etaVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

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

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_id
private

\ Tree variables

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

uint32_t TrackerGeometryCompare::_identifiers[6]
private

Definition at line 152 of file TrackerGeometryCompare.h.

Referenced by fillIdentifiers(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_inModuleList
private

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

Referenced by compareSurfaceDeformations(), and createROOTGeometry().

TFile* TrackerGeometryCompare::_inputRootFile2
private

Definition at line 138 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree01
private

Definition at line 139 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree02
private

Definition at line 140 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree11
private

Definition at line 141 of file TrackerGeometryCompare.h.

Referenced by analyze(), and createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree12
private

Definition at line 142 of file TrackerGeometryCompare.h.

Referenced by analyze(), and createROOTGeometry().

std::string TrackerGeometryCompare::_inputTreenameAlign
private

Definition at line 112 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry(), and TrackerGeometryCompare().

std::string TrackerGeometryCompare::_inputTreenameDeform
private
int TrackerGeometryCompare::_level
private
const std::vector<std::string> TrackerGeometryCompare::_levelStrings
private

Definition at line 108 of file TrackerGeometryCompare.h.

Referenced by analyze().

int TrackerGeometryCompare::_mid
private

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_mlevel
private

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_moduleInList
private

Definition at line 131 of file TrackerGeometryCompare.h.

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

Definition at line 130 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry(), and fillTree().

std::ifstream TrackerGeometryCompare::_moduleListFile
private

Definition at line 129 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry().

std::string TrackerGeometryCompare::_moduleListName
private

Definition at line 109 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_phiVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_rVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

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

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

double TrackerGeometryCompare::_surfDeform[13]
private

Definition at line 155 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_surLength
private

Definition at line 151 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

double TrackerGeometryCompare::_surRot[9]
private

Definition at line 153 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_surWidth
private

Definition at line 151 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

TFile* TrackerGeometryCompare::_theFile
private

Definition at line 135 of file TrackerGeometryCompare.h.

Referenced by endJob(), and TrackerGeometryCompare().

align::PositionType TrackerGeometryCompare::_TrackerCommonCM
private

Definition at line 127 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

align::GlobalVector TrackerGeometryCompare::_TrackerCommonR
private

Definition at line 126 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

align::GlobalVector TrackerGeometryCompare::_TrackerCommonT
private

Definition at line 125 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

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

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

Referenced by TrackerGeometryCompare().

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

Definition at line 114 of file TrackerGeometryCompare.h.

Referenced by analyze().

float TrackerGeometryCompare::_xVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_yVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_zVal
private

Definition at line 146 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

AlignableTracker* TrackerGeometryCompare::currentTracker
private

Definition at line 101 of file TrackerGeometryCompare.h.

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

AlignableTracker* TrackerGeometryCompare::dummyTracker
private

Definition at line 100 of file TrackerGeometryCompare.h.

bool TrackerGeometryCompare::firstEvent_
private

Definition at line 161 of file TrackerGeometryCompare.h.

Referenced by analyze(), and beginJob().

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

Definition at line 165 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

int TrackerGeometryCompare::m_nBins
private

Definition at line 157 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

double TrackerGeometryCompare::m_rangeHigh
private

Definition at line 159 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

double TrackerGeometryCompare::m_rangeLow
private

Definition at line 158 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

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

Definition at line 75 of file TrackerGeometryCompare.h.

Referenced by analyze(), and compareGeometries().

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

Definition at line 99 of file TrackerGeometryCompare.h.

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

const SurveyErrors* TrackerGeometryCompare::theSurveyErrors
private

Definition at line 105 of file TrackerGeometryCompare.h.

Referenced by addSurveyInfo().

unsigned int TrackerGeometryCompare::theSurveyIndex
private

Definition at line 103 of file TrackerGeometryCompare.h.

Referenced by addSurveyInfo().

const Alignments* TrackerGeometryCompare::theSurveyValues
private

Definition at line 104 of file TrackerGeometryCompare.h.

Referenced by addSurveyInfo().