CMS 3D CMS Logo

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

#include <TrackerGeometryCompare.h>

Inheritance diagram for TrackerGeometryCompare:
edm::EDAnalyzer 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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
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, _writeToDB, _xVal, _yVal, _zVal, groupFilesInBlocks::fin, edm::ParameterSet::getUntrackedParameter(), cuy::ii, prof2calltree::l, m_h1, m_nBins, m_rangeHigh, m_rangeLow, m_theLevels, m_vtkmap, TFileDirectory::make(), TFileService::mkdir(), AlCaHLTBitMon_QueryRunRegistry::string, and AlignableObjectId::stringToId().

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

References Alignable::alignableObjectId(), AlCaHLTBitMon_QueryRunRegistry::comp, Alignable::components(), relativeConstraints::error, Exception, Alignable::geomDetId(), 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().

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

Implements edm::EDAnalyzer.

Definition at line 238 of file TrackerGeometryCompare.cc.

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

238  {
239 
240  if (firstEvent_) {
241 
242  //Retrieve tracker topology from geometry
243  edm::ESHandle<TrackerTopology> tTopoHandle;
244  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
245  const TrackerTopology* const tTopo = tTopoHandle.product();
246 
247  //upload the ROOT geometries
248  createROOTGeometry(iSetup);
249 
250  //set common tracker system first
251  // if setting the tracker common system
252  if (_setCommonTrackerSystem != "NONE"){
254  }
255 
256  //compare the goemetries
259 
260  //write out ntuple
261  //might be better to do within output module
262 
263  if (_writeToDB){
264  Alignments* myAlignments = currentTracker->alignments();
265  AlignmentErrorsExtended* myAlignmentErrorsExtended = currentTracker->alignmentErrors();
266 
267  // 2. Store alignment[Error]s to DB
269  // Call service
270  if( !poolDbService.isAvailable() ) // Die if not available
271  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
272 
273  poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), "TrackerAlignmentRcd");
274  poolDbService->writeOne<AlignmentErrorsExtended>(&(*myAlignmentErrorsExtended), poolDbService->beginOfTime(), "TrackerAlignmentErrorExtendedRcd");
275 
276  }
277 
278  firstEvent_ = false;
279  }
280 }
void compareGeometries(Alignable *refAli, Alignable *curAli, const TrackerTopology *tTopo, const edm::EventSetup &iSetup)
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
bool isAvailable() const
Definition: Service.h:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
AlignableTracker * currentTracker
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
AlignableTracker * referenceTracker
void createROOTGeometry(const edm::EventSetup &iSetup)
Alignments * alignments() const
Return alignments, sorted by DetId.
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 214 of file TrackerGeometryCompare.cc.

References firstEvent_.

214  {
215  firstEvent_ = true;
216 }
void TrackerGeometryCompare::compareGeometries ( Alignable refAli,
Alignable curAli,
const TrackerTopology tTopo,
const edm::EventSetup iSetup 
)
private

Definition at line 612 of file TrackerGeometryCompare.cc.

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

Referenced by analyze().

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

Definition at line 469 of file TrackerGeometryCompare.cc.

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

Referenced by analyze().

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

Definition at line 282 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, Alignable::deepComponents(), align::DetectorGlobalPosition(), edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), i, geometryCSVtoXML::line, Alignments::m_align, AlignmentErrorsExtended::m_alignError, edm::ESHandle< class >::product(), referenceTracker, python.multivaluedict::sort(), AlCaHLTBitMon_QueryRunRegistry::string, and DetId::Tracker.

Referenced by analyze().

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

Definition at line 723 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(), i, and makeMuonMisalignmentScenario::rot.

Referenced by setCommonTrackerSystem().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 218 of file TrackerGeometryCompare.cc.

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

218  {
219 
220  int iname(0) ;
221  for (std::vector<TrackerMap>::iterator it = m_vtkmap.begin(); it != m_vtkmap.end(); ++it) {
222  std::stringstream mapname ;
223  mapname << "TkMap_SurfDeform" << iname << ".png" ;
224  it->save(true,0,0,mapname.str());
225  mapname.str( std::string() );
226  mapname.clear() ;
227  mapname << "TkMap_SurfDeform" << iname << ".pdf" ;
228  it->save(true,0,0,mapname.str());
229  ++iname ;
230  }
231 
232  _theFile->cd();
233  _alignTree->Write();
234  _theFile->Close();
235 
236 }
std::vector< TrackerMap > m_vtkmap
void TrackerGeometryCompare::fillIdentifiers ( int  subdetlevel,
int  rawid,
const TrackerTopology tTopo 
)
private

Definition at line 990 of file TrackerGeometryCompare.cc.

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

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

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

Definition at line 977 of file TrackerGeometryCompare.cc.

References _detIdFlagVector, and i.

Referenced by fillTree().

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

Definition at line 685 of file TrackerGeometryCompare.cc.

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

685  {
686 
687  edm::LogInfo("TrackerGeometryCompare") << "Setting Common Tracker System....";
688 
689  // DM_534??AlignableObjectId dummy;
690  // DM_534??_commonTrackerLevel = dummy.nameToType(_setCommonTrackerSystem);
692 
694 
695  align::EulerAngles dOmega(3); dOmega[0] = _TrackerCommonR.x() ; dOmega[1] = _TrackerCommonR.y(); dOmega[2] = _TrackerCommonR.z();
698 
699  std::cout << "what we get from overlaying the pixels..." << theR << ", " << rot << std::endl;
700 
701  //transform to the Tracker System
703  align::GlobalVector cmDiff( trackerCM.x()-_TrackerCommonCM.x(), trackerCM.y()-_TrackerCommonCM.y(), trackerCM.z()-_TrackerCommonCM.z() );
704 
705  std::cout << "Pixel CM: " << _TrackerCommonCM << ", tracker CM: " << trackerCM << std::endl;
706 
707  //adjust translational difference factoring in different rotational CM
708  //needed because rotateInGlobalFrame is about CM of alignable, not Tracker
709  align::GlobalVector::BasicVectorType lpvgf = cmDiff.basicVector();
710  align::GlobalVector moveV( rot.multiplyInverse(lpvgf) - lpvgf);
711  align::GlobalVector theRprime(theR + moveV);
712 
713  AlgebraicVector TrackerCommonTR(6);
714  TrackerCommonTR(1) = theRprime.x(); TrackerCommonTR(2) = theRprime.y(); TrackerCommonTR(3) = theRprime.z();
715  TrackerCommonTR(4) = _TrackerCommonR.x(); TrackerCommonTR(5) = _TrackerCommonR.y(); TrackerCommonTR(6) = _TrackerCommonR.z();
716 
717  std::cout << "and after the transformation: " << TrackerCommonTR << std::endl;
718 
719  align::moveAlignable(currentTracker, TrackerCommonTR );
720 
721 }
align::GlobalVector _TrackerCommonR
align::GlobalVector _TrackerCommonT
T y() const
Definition: PV3DBase.h:63
void diffCommonTrackerSystem(Alignable *refAli, Alignable *curAli)
static align::StructureType stringToId(const char *)
T z() const
Definition: PV3DBase.h:64
align::StructureType _commonTrackerLevel
align::PositionType _TrackerCommonCM
CLHEP::HepVector AlgebraicVector
AlgebraicVector EulerAngles
Definition: Definitions.h:36
AlignableTracker * currentTracker
AlignableTracker * referenceTracker
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:40
tuple cout
Definition: gather_cfg.py:121
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:134
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 891 of file TrackerGeometryCompare.cc.

References AlCaHLTBitMon_QueryRunRegistry::comp, filterCSVwithJSON::copy, AlignableTracker::endcapGeomDets(), i, AlignableTracker::innerBarrelGeomDets(), j, relval_steps::k, Alignments::m_align, AlignmentErrorsExtended::m_alignError, AlignableTracker::outerBarrelGeomDets(), AlignableTracker::pixelEndcapGeomDets(), AlignableTracker::pixelHalfBarrelGeomDets(), SurveyDet::position(), makeMuonMisalignmentScenario::rot, SurveyDet::rotation(), python.multivaluedict::sort(), AlignableTracker::TIDGeomDets(), and create_public_lumi_plots::transform.

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

Member Data Documentation

TTree* TrackerGeometryCompare::_alignTree
private

Definition at line 135 of file TrackerGeometryCompare.h.

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

float TrackerGeometryCompare::_alphaVal
private

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_badModuleQuality
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_betaVal
private

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

align::StructureType TrackerGeometryCompare::_commonTrackerLevel
private

Definition at line 123 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

float TrackerGeometryCompare::_dalphaVal
private

Definition at line 147 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_daVal
private

Definition at line 149 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dbetaVal
private

Definition at line 147 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dbVal
private

Definition at line 149 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_detDim
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

bool TrackerGeometryCompare::_detIdFlag
private

Definition at line 116 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

std::string TrackerGeometryCompare::_detIdFlagFile
private

Definition at line 117 of file TrackerGeometryCompare.h.

Referenced by TrackerGeometryCompare().

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

Definition at line 122 of file TrackerGeometryCompare.h.

Referenced by passIdCut(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dgammaVal
private

Definition at line 147 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dgVal
private

Definition at line 149 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dphiVal
private

Definition at line 147 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_drVal
private

Definition at line 147 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_duVal
private

Definition at line 149 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dvVal
private

Definition at line 149 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dwVal
private

Definition at line 149 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dxVal
private

Definition at line 147 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dyVal
private

Definition at line 147 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_dzVal
private

Definition at line 147 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_etaVal
private

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

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

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_id
private

\ Tree variables

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

uint32_t TrackerGeometryCompare::_identifiers[6]
private

Definition at line 151 of file TrackerGeometryCompare.h.

Referenced by fillIdentifiers(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_inModuleList
private

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

Referenced by compareSurfaceDeformations(), and createROOTGeometry().

TFile* TrackerGeometryCompare::_inputRootFile2
private

Definition at line 137 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree01
private

Definition at line 138 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree02
private

Definition at line 139 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree11
private

Definition at line 140 of file TrackerGeometryCompare.h.

Referenced by analyze(), and createROOTGeometry().

TTree* TrackerGeometryCompare::_inputTree12
private

Definition at line 141 of file TrackerGeometryCompare.h.

Referenced by analyze(), and createROOTGeometry().

std::string TrackerGeometryCompare::_inputTreenameAlign
private

Definition at line 111 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry(), and TrackerGeometryCompare().

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

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_mlevel
private

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

int TrackerGeometryCompare::_moduleInList
private

Definition at line 130 of file TrackerGeometryCompare.h.

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

Definition at line 129 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry(), and fillTree().

std::ifstream TrackerGeometryCompare::_moduleListFile
private

Definition at line 128 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry().

std::string TrackerGeometryCompare::_moduleListName
private

Definition at line 108 of file TrackerGeometryCompare.h.

Referenced by createROOTGeometry(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_phiVal
private

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_rVal
private

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

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

Definition at line 144 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

double TrackerGeometryCompare::_surfDeform[13]
private

Definition at line 154 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_surLength
private

Definition at line 150 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

double TrackerGeometryCompare::_surRot[9]
private

Definition at line 152 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_surWidth
private

Definition at line 150 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

TFile* TrackerGeometryCompare::_theFile
private

Definition at line 134 of file TrackerGeometryCompare.h.

Referenced by endJob(), and TrackerGeometryCompare().

align::PositionType TrackerGeometryCompare::_TrackerCommonCM
private

Definition at line 126 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

align::GlobalVector TrackerGeometryCompare::_TrackerCommonR
private

Definition at line 125 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

align::GlobalVector TrackerGeometryCompare::_TrackerCommonT
private

Definition at line 124 of file TrackerGeometryCompare.h.

Referenced by diffCommonTrackerSystem(), and setCommonTrackerSystem().

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

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

Referenced by TrackerGeometryCompare().

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

Definition at line 113 of file TrackerGeometryCompare.h.

Referenced by analyze(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_xVal
private

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_yVal
private

Definition at line 145 of file TrackerGeometryCompare.h.

Referenced by fillTree(), and TrackerGeometryCompare().

float TrackerGeometryCompare::_zVal
private

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

Referenced by analyze(), and beginJob().

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

Definition at line 164 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

int TrackerGeometryCompare::m_nBins
private

Definition at line 156 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

double TrackerGeometryCompare::m_rangeHigh
private

Definition at line 158 of file TrackerGeometryCompare.h.

Referenced by compareSurfaceDeformations(), and TrackerGeometryCompare().

double TrackerGeometryCompare::m_rangeLow
private

Definition at line 157 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 compareGeometries(), and TrackerGeometryCompare().

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