CMS 3D CMS Logo

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

#include <TrackerGeometryIntoNtuples.cc>

Inheritance diagram for TrackerGeometryIntoNtuples:
edm::EDAnalyzer

Public Member Functions

 TrackerGeometryIntoNtuples (const edm::ParameterSet &)
 
 ~TrackerGeometryIntoNtuples ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Types

enum  { kMaxNumPar = 20 }
 

Private Member Functions

void addBranches ()
 
virtual void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 

Private Attributes

Float_t deformationValues_ [kMaxNumPar]
 
double m_alpha
 
double m_beta
 
double m_d1
 
double m_d2
 
double m_d3
 
int m_dNpar
 
int m_dtype
 
TFile * m_file
 
double m_gamma
 
std::string m_outputFile
 
std::string m_outputTreename
 
uint32_t m_rawid
 
int m_subdetid
 
TTree * m_tree
 
TTree * m_treeDeformations
 
TTree * m_treeErrors
 
double m_x
 
double m_xx
 
double m_xy
 
double m_xz
 
double m_y
 
double m_yy
 
double m_yz
 
double m_z
 
double m_zz
 
std::vector< double > * mp_dpar
 
UInt_t numDeformationValues_
 
AlignableTrackertheCurrentTracker
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: Takes a set of alignment constants and turns them into a ROOT file

Implementation: <Notes on="" implementation>="">

Definition at line 71 of file TrackerGeometryIntoNtuples.cc.

Member Enumeration Documentation

anonymous enum
private
Enumerator
kMaxNumPar 

Definition at line 99 of file TrackerGeometryIntoNtuples.cc.

99 {kMaxNumPar = 20}; // slighly above 'two bowed surfaces' limit

Constructor & Destructor Documentation

TrackerGeometryIntoNtuples::TrackerGeometryIntoNtuples ( const edm::ParameterSet iConfig)
explicit

Definition at line 121 of file TrackerGeometryIntoNtuples.cc.

References edm::ParameterSet::getUntrackedParameter(), m_file, m_outputFile, m_outputTreename, m_tree, m_treeDeformations, and m_treeErrors.

121  :
123  m_rawid(0),
124  m_x(0.), m_y(0.), m_z(0.),
125  m_alpha(0.), m_beta(0.), m_gamma(0.),
126  m_subdetid(0),
127  m_xx(0.), m_xy(0.), m_yy(0.), m_xz(0.), m_yz(0.), m_zz(0.),
128  m_dNpar(0),
129  m_d1(0.), m_d2(0.), m_d3(0.),
130  m_dtype(0),
131  mp_dpar(0)
132 {
133  m_outputFile = iConfig.getUntrackedParameter< std::string > ("outputFile");
134  m_outputTreename = iConfig.getUntrackedParameter< std::string > ("outputTreename");
135  m_file = new TFile(m_outputFile.c_str(),"RECREATE");
136  m_tree = new TTree(m_outputTreename.c_str(),m_outputTreename.c_str());
137  m_treeDeformations = new TTree("alignTreeDeformations","alignTreeDeformations");
138  //char errorTreeName[256];
139  //snprintf(errorTreeName, sizeof(errorTreeName), "%sErrors", m_outputTreename);
140  //m_treeErrors = new TTree(errorTreeName,errorTreeName);
141  m_treeErrors = new TTree("alignTreeErrors","alignTreeErrors");
142 
143 }
T getUntrackedParameter(std::string const &, T const &) const
TrackerGeometryIntoNtuples::~TrackerGeometryIntoNtuples ( )

Definition at line 146 of file TrackerGeometryIntoNtuples.cc.

References theCurrentTracker.

147 {
148  delete theCurrentTracker;
149 }

Member Function Documentation

void TrackerGeometryIntoNtuples::addBranches ( )
private

Definition at line 278 of file TrackerGeometryIntoNtuples.cc.

References m_alpha, m_beta, m_dNpar, m_dtype, m_gamma, m_rawid, m_subdetid, m_tree, m_treeDeformations, m_treeErrors, m_x, m_xx, m_xy, m_xz, m_y, m_yy, m_yz, m_z, m_zz, and mp_dpar.

Referenced by Vispa.Plugins.EdmBrowser.EventContentDataAccessor.EventContentDataAccessor::addContentFile(), and analyze().

278  {
279 
280  m_tree->Branch("rawid", &m_rawid, "rawid/I");
281  m_tree->Branch("x", &m_x, "x/D");
282  m_tree->Branch("y", &m_y, "y/D");
283  m_tree->Branch("z", &m_z, "z/D");
284  m_tree->Branch("alpha", &m_alpha, "alpha/D");
285  m_tree->Branch("beta", &m_beta, "beta/D");
286  m_tree->Branch("gamma", &m_gamma, "gamma/D");
287 
288  m_treeDeformations->Branch("irawid", &m_rawid, "irawid/I");
289  m_treeDeformations->Branch("subdetid", &m_subdetid, "subdetid/I");
290  m_treeDeformations->Branch("dNpar", &m_dNpar, "dNpar/I");
291  //m_treeDeformations->Branch("d1", &m_d1, "d1/D");
292  //m_treeDeformations->Branch("d2", &m_d2, "d2/D");
293  //m_treeDeformations->Branch("d3", &m_d3, "d3/D");
294  m_treeDeformations->Branch("dtype", &m_dtype);
295  m_treeDeformations->Branch("dpar", "std::vector<double>", &mp_dpar);
296 
297  m_treeErrors->Branch("rawid", &m_rawid, "rawid/I");
298  m_treeErrors->Branch("subdetid", &m_subdetid, "subdetid/I");
299  m_treeErrors->Branch("xx", &m_xx, "xx/D");
300  m_treeErrors->Branch("yy", &m_yy, "yy/D");
301  m_treeErrors->Branch("zz", &m_zz, "zz/D");
302  m_treeErrors->Branch("xy", &m_xy, "xy/D");
303  m_treeErrors->Branch("xz", &m_xz, "xz/D");
304  m_treeErrors->Branch("yz", &m_yz, "yz/D");
305 
306 
307  //m_tree->Branch("NumDeform", &numDeformationValues_, "NumDeform/i");
308  //m_tree->Branch("DeformValues", deformationValues_, "DeformValues[NumDeform]/F");
309 
310 }
void TrackerGeometryIntoNtuples::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 157 of file TrackerGeometryIntoNtuples.cc.

References addBranches(), GeometryAligner::applyAlignments(), GeometryAligner::attachSurfaceDeformations(), TrackerGeomBuilderFromGeometricDet::build(), align::DetectorGlobalPosition(), cond::rpcobgas::detid, TrackerGeometry::detUnits(), edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), i, Alignments::m_align, m_alpha, m_beta, m_d1, m_d2, m_d3, m_dNpar, m_dtype, m_file, m_gamma, m_rawid, m_subdetid, m_tree, m_treeDeformations, m_treeErrors, m_x, m_xx, m_xy, m_xz, m_y, m_yy, m_yz, m_z, m_zz, mp_dpar, Parameters::parameters, DetId::rawId(), idealTransformation::rotation, DetId::subdetId(), GeomDetUnit::surfaceDeformation(), theCurrentTracker, and DetId::Tracker.

158 {
159  edm::LogInfo("beginJob") << "Begin Job" << std::endl;
160 
161  //accessing the initial geometry
162  edm::ESHandle<GeometricDet> theGeometricDet;
163  iSetup.get<IdealGeometryRecord>().get(theGeometricDet);
164  TrackerGeomBuilderFromGeometricDet trackerBuilder;
165  //currernt tracker
166  TrackerGeometry* theCurTracker = trackerBuilder.build(&*theGeometricDet);
167 
168  //build the tracker
169  edm::ESHandle<Alignments> alignments;
170  edm::ESHandle<AlignmentErrors> alignmentErrors;
172 
173  iSetup.get<TrackerAlignmentRcd>().get(alignments);
174  iSetup.get<TrackerAlignmentErrorRcd>().get(alignmentErrors);
175  iSetup.get<TrackerSurfaceDeformationRcd>().get(surfaceDeformations);
176 
177  //apply the latest alignments
178  edm::ESHandle<Alignments> globalPositionRcd;
179  iSetup.get<TrackerDigiGeometryRecord>().getRecord<GlobalPositionRcd>().get(globalPositionRcd);
180  GeometryAligner aligner;
181  aligner.applyAlignments<TrackerGeometry>( &(*theCurTracker), &(*alignments), &(*alignmentErrors),
182  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)));
183  aligner.attachSurfaceDeformations<TrackerGeometry>( &(*theCurTracker), &(*surfaceDeformations)) ;
184 
185 
186  theCurrentTracker = new AlignableTracker(&(*theCurTracker));
187 
188  Alignments* theAlignments = theCurrentTracker->alignments();
189  //AlignmentErrors* theAlignmentErrors = theCurrentTracker->alignmentErrors();
190 
191  //alignments
192  addBranches();
193  for (std::vector<AlignTransform>::const_iterator i = theAlignments->m_align.begin(); i != theAlignments->m_align.end(); ++i){
194 
195  m_rawid = i->rawId();
196  CLHEP::Hep3Vector translation = i->translation();
197  m_x = translation.x();
198  m_y = translation.y();
199  m_z = translation.z();
200 
201 
202  CLHEP::HepRotation rotation = i->rotation();
203  m_alpha = rotation.getPhi();
204  m_beta = rotation.getTheta();
205  m_gamma = rotation.getPsi();
206  m_tree->Fill();
207 
208  //DetId detid(m_rawid);
209  //if (detid.subdetId() > 2){
210  //PXFDetId pxfid( m_rawid );
211  //std::cout << " panel: " << pxfid.panel() << ", module: " << pxfid.module() << std::endl;
212  //if ((pxfid.panel() == 1) && (pxfid.module() == 4)) std::cout << m_rawid << ", ";
213  //std::cout << m_rawid << std::setprecision(9) << " " << m_x << " " << m_y << " " << m_z;
214  //std::cout << std::setprecision(9) << " " << m_alpha << " " << m_beta << " " << m_gamma << std::endl;
215  //}
216 
217  }
218 
219  delete theAlignments;
220 
221  std::vector<AlignTransformError> alignErrors = alignmentErrors->m_alignError;
222  for (std::vector<AlignTransformError>::const_iterator i = alignErrors.begin(); i != alignErrors.end(); ++i){
223 
224  m_rawid = i->rawId();
225  CLHEP::HepSymMatrix errMatrix = i->matrix();
227  m_subdetid = detid.subdetId();
228  m_xx = errMatrix[0][0];
229  m_xy = errMatrix[0][1];
230  m_xz = errMatrix[0][2];
231  m_yy = errMatrix[1][1];
232  m_yz = errMatrix[1][2];
233  m_zz = errMatrix[2][2];
234  m_treeErrors->Fill();
235  }
236 
237  // Get GeomDetUnits for the current tracker
238  std::vector<GeomDetUnit*>detUnits = theCurTracker->detUnits() ;
239  int detUnit(0) ;
240  //\\for (unsigned int iDet = 0; iDet < detUnits.size(); ++iDet) {
241  for (std::vector<GeomDetUnit*>::const_iterator iunit = detUnits.begin(); iunit != detUnits.end(); ++iunit) {
242 
243  DetId detid = (*iunit)->geographicalId();
244  m_rawid = detid.rawId() ;
245  m_subdetid = detid.subdetId();
246 
247  ++detUnit ;
248  //\\GeomDetUnit* geomDetUnit = detUnits.at(iDet) ;
249  GeomDetUnit* geomDetUnit = *iunit ;
250 
251  // Get SurfaceDeformation for this GeomDetUnit
252  if ( geomDetUnit->surfaceDeformation() ) {
253  std::vector<double> surfaceDeformParams = (geomDetUnit->surfaceDeformation())->parameters() ;
254  //edm::LogInfo("surfaceDeformParamsSize") << " surfaceDeformParams size = " << surfaceDeformParams.size() << std::endl ;
255  m_dNpar = surfaceDeformParams.size() ;
256  m_dtype = (geomDetUnit->surfaceDeformation())->type() ;
257  m_d1 = surfaceDeformParams.at(0) ;
258  m_d2 = surfaceDeformParams.at(1) ;
259  m_d3 = surfaceDeformParams.at(2) ;
260  mp_dpar->clear() ;
261  for (std::vector<double>::const_iterator it = surfaceDeformParams.begin(); it != surfaceDeformParams.end(); ++it) {
262  mp_dpar->push_back((*it)) ;
263  //edm::LogInfo("surfaceDeformParamsContent") << " surfaceDeformParam = " << (*it) << std::endl ;
264  }
265  m_treeDeformations->Fill() ;
266  }
267  }
268 
269  //write out
270  m_file->cd();
271  m_tree->Write();
272  m_treeDeformations->Write();
273  m_treeErrors->Write();
274  m_file->Close();
275 }
type
Definition: HCALResponse.h:22
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
Class to update a given geometry with a set of alignments.
virtual const SurfaceDeformation * surfaceDeformation() const
Definition: GeomDetUnit.h:37
std::vector< AlignTransform > m_align
Definition: Alignments.h:14
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
virtual const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
void get(HolderT &iHolder) const
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
const T & get() const
Definition: EventSetup.h:55
TrackerGeometry * build(const GeometricDet *gd)
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)

Member Data Documentation

Float_t TrackerGeometryIntoNtuples::deformationValues_[kMaxNumPar]
private

Definition at line 100 of file TrackerGeometryIntoNtuples.cc.

double TrackerGeometryIntoNtuples::m_alpha
private

Definition at line 88 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_beta
private

Definition at line 88 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_d1
private

Definition at line 92 of file TrackerGeometryIntoNtuples.cc.

Referenced by analyze().

double TrackerGeometryIntoNtuples::m_d2
private

Definition at line 92 of file TrackerGeometryIntoNtuples.cc.

Referenced by analyze().

double TrackerGeometryIntoNtuples::m_d3
private

Definition at line 92 of file TrackerGeometryIntoNtuples.cc.

Referenced by analyze().

int TrackerGeometryIntoNtuples::m_dNpar
private

Definition at line 91 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

int TrackerGeometryIntoNtuples::m_dtype
private

Definition at line 93 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

TFile* TrackerGeometryIntoNtuples::m_file
private

Definition at line 107 of file TrackerGeometryIntoNtuples.cc.

Referenced by analyze(), and TrackerGeometryIntoNtuples().

double TrackerGeometryIntoNtuples::m_gamma
private

Definition at line 88 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

std::string TrackerGeometryIntoNtuples::m_outputFile
private

Definition at line 105 of file TrackerGeometryIntoNtuples.cc.

Referenced by TrackerGeometryIntoNtuples().

std::string TrackerGeometryIntoNtuples::m_outputTreename
private

Definition at line 106 of file TrackerGeometryIntoNtuples.cc.

Referenced by TrackerGeometryIntoNtuples().

uint32_t TrackerGeometryIntoNtuples::m_rawid
private

Definition at line 86 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

int TrackerGeometryIntoNtuples::m_subdetid
private

Definition at line 89 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

TTree* TrackerGeometryIntoNtuples::m_tree
private

Definition at line 102 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), analyze(), and TrackerGeometryIntoNtuples().

TTree* TrackerGeometryIntoNtuples::m_treeDeformations
private

Definition at line 103 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), analyze(), and TrackerGeometryIntoNtuples().

TTree* TrackerGeometryIntoNtuples::m_treeErrors
private

Definition at line 104 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), analyze(), and TrackerGeometryIntoNtuples().

double TrackerGeometryIntoNtuples::m_x
private

Definition at line 87 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_xx
private

Definition at line 90 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_xy
private

Definition at line 90 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_xz
private

Definition at line 90 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_y
private

Definition at line 87 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_yy
private

Definition at line 90 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_yz
private

Definition at line 90 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_z
private

Definition at line 87 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_zz
private

Definition at line 90 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

std::vector<double>* TrackerGeometryIntoNtuples::mp_dpar
private

Definition at line 95 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

UInt_t TrackerGeometryIntoNtuples::numDeformationValues_
private

Definition at line 98 of file TrackerGeometryIntoNtuples.cc.

AlignableTracker* TrackerGeometryIntoNtuples::theCurrentTracker
private

Definition at line 84 of file TrackerGeometryIntoNtuples.cc.

Referenced by analyze(), and ~TrackerGeometryIntoNtuples().