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 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 Member Functions

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

Private Attributes

double m_alpha
 
double m_beta
 
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_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
 
AlignmentstheAlignments
 
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)
 
- 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 53 of file TrackerGeometryIntoNtuples.cc.

Constructor & Destructor Documentation

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

Definition at line 93 of file TrackerGeometryIntoNtuples.cc.

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

94 {
95  m_outputFile = iConfig.getUntrackedParameter< std::string > ("outputFile");
96  m_outputTreename = iConfig.getUntrackedParameter< std::string > ("outputTreename");
97  m_file = new TFile(m_outputFile.c_str(),"RECREATE");
98  m_tree = new TTree(m_outputTreename.c_str(),m_outputTreename.c_str());
99  //char errorTreeName[256];
100  //sprintf(errorTreeName, "%sErrors", m_outputTreename);
101  //m_treeErrors = new TTree(errorTreeName,errorTreeName);
102  m_treeErrors = new TTree("alignTreeErrors","alignTreeErrors");
103 
104 }
T getUntrackedParameter(std::string const &, T const &) const
TrackerGeometryIntoNtuples::~TrackerGeometryIntoNtuples ( )

Definition at line 107 of file TrackerGeometryIntoNtuples.cc.

108 {}

Member Function Documentation

void TrackerGeometryIntoNtuples::addBranches ( )
private

Definition at line 200 of file TrackerGeometryIntoNtuples.cc.

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

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

200  {
201 
202  m_tree->Branch("rawid", &m_rawid, "rawid/I");
203  m_tree->Branch("x", &m_x, "x/D");
204  m_tree->Branch("y", &m_y, "y/D");
205  m_tree->Branch("z", &m_z, "z/D");
206  m_tree->Branch("alpha", &m_alpha, "alpha/D");
207  m_tree->Branch("beta", &m_beta, "beta/D");
208  m_tree->Branch("gamma", &m_gamma, "gamma/D");
209 
210 
211  m_treeErrors->Branch("rawid", &m_rawid, "rawid/I");
212  m_treeErrors->Branch("subdetid", &m_subdetid, "subdetid/I");
213  m_treeErrors->Branch("xx", &m_xx, "xx/D");
214  m_treeErrors->Branch("yy", &m_yy, "yy/D");
215  m_treeErrors->Branch("zz", &m_zz, "zz/D");
216  m_treeErrors->Branch("xy", &m_xy, "xy/D");
217  m_treeErrors->Branch("xz", &m_xz, "xz/D");
218  m_treeErrors->Branch("yz", &m_yz, "yz/D");
219 
220 }
void TrackerGeometryIntoNtuples::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 116 of file TrackerGeometryIntoNtuples.cc.

References addBranches(), GeometryAligner::applyAlignments(), TrackerGeomBuilderFromGeometricDet::build(), align::DetectorGlobalPosition(), cond::rpcobgas::detid, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), i, Alignments::m_align, m_alpha, m_beta, m_file, m_gamma, m_rawid, m_subdetid, m_tree, m_treeErrors, m_x, m_xx, m_xy, m_xz, m_y, m_yy, m_yz, m_z, m_zz, DetId::subdetId(), theAlignments, theCurrentTracker, and DetId::Tracker.

117 {
118  edm::LogInfo("beginJob") << "Begin Job" << std::endl;
119 
120  //accessing the initial geometry
121  edm::ESHandle<GeometricDet> theGeometricDet;
122  iSetup.get<IdealGeometryRecord>().get(theGeometricDet);
123  TrackerGeomBuilderFromGeometricDet trackerBuilder;
124  //currernt tracker
125  TrackerGeometry* theCurTracker = trackerBuilder.build(&*theGeometricDet);
126 
127 
128  //build the tracker
129  edm::ESHandle<Alignments> alignments;
130  edm::ESHandle<AlignmentErrors> alignmentErrors;
131 
132  iSetup.get<TrackerAlignmentRcd>().get(alignments);
133  iSetup.get<TrackerAlignmentErrorRcd>().get(alignmentErrors);
134 
135  //apply the latest alignments
136  edm::ESHandle<Alignments> globalPositionRcd;
137  iSetup.get<TrackerDigiGeometryRecord>().getRecord<GlobalPositionRcd>().get(globalPositionRcd);
138  GeometryAligner aligner;
139  aligner.applyAlignments<TrackerGeometry>( &(*theCurTracker), &(*alignments), &(*alignmentErrors),
140  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)));
141 
142 
143  theCurrentTracker = new AlignableTracker(&(*theCurTracker));
144 
145  Alignments* theAlignments = theCurrentTracker->alignments();
146  //AlignmentErrors* theAlignmentErrors = theCurrentTracker->alignmentErrors();
147 
148  //alignments
149  addBranches();
150  for (std::vector<AlignTransform>::const_iterator i = theAlignments->m_align.begin(); i != theAlignments->m_align.end(); ++i){
151 
152  m_rawid = i->rawId();
153  CLHEP::Hep3Vector translation = i->translation();
154  m_x = translation.x();
155  m_y = translation.y();
156  m_z = translation.z();
157 
158 
159  CLHEP::HepRotation rotation = i->rotation();
160  m_alpha = rotation.getPhi();
161  m_beta = rotation.getTheta();
162  m_gamma = rotation.getPsi();
163  m_tree->Fill();
164 
165  //DetId detid(m_rawid);
166  //if (detid.subdetId() > 2){
167  //PXFDetId pxfid( m_rawid );
168  //std::cout << " panel: " << pxfid.panel() << ", module: " << pxfid.module() << std::endl;
169  //if ((pxfid.panel() == 1) && (pxfid.module() == 4)) std::cout << m_rawid << ", ";
170  //std::cout << m_rawid << std::setprecision(9) << " " << m_x << " " << m_y << " " << m_z;
171  //std::cout << std::setprecision(9) << " " << m_alpha << " " << m_beta << " " << m_gamma << std::endl;
172  //}
173 
174  }
175 
176  std::vector<AlignTransformError> alignErrors = alignmentErrors->m_alignError;
177  for (std::vector<AlignTransformError>::const_iterator i = alignErrors.begin(); i != alignErrors.end(); ++i){
178 
179  m_rawid = i->rawId();
180  CLHEP::HepSymMatrix errMatrix = i->matrix();
182  m_subdetid = detid.subdetId();
183  m_xx = errMatrix[0][0];
184  m_xy = errMatrix[0][1];
185  m_xz = errMatrix[0][2];
186  m_yy = errMatrix[1][1];
187  m_yz = errMatrix[1][2];
188  m_zz = errMatrix[2][2];
189  m_treeErrors->Fill();
190  }
191 
192  //write out
193  m_file->cd();
194  m_tree->Write();
195  m_treeErrors->Write();
196  m_file->Close();
197 }
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:14
void get(HolderT &iHolder) const
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
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

double TrackerGeometryIntoNtuples::m_alpha
private

Definition at line 71 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_beta
private

Definition at line 71 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

TFile* TrackerGeometryIntoNtuples::m_file
private

Definition at line 79 of file TrackerGeometryIntoNtuples.cc.

Referenced by analyze(), and TrackerGeometryIntoNtuples().

double TrackerGeometryIntoNtuples::m_gamma
private

Definition at line 71 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

std::string TrackerGeometryIntoNtuples::m_outputFile
private

Definition at line 77 of file TrackerGeometryIntoNtuples.cc.

Referenced by TrackerGeometryIntoNtuples().

std::string TrackerGeometryIntoNtuples::m_outputTreename
private

Definition at line 78 of file TrackerGeometryIntoNtuples.cc.

Referenced by TrackerGeometryIntoNtuples().

uint32_t TrackerGeometryIntoNtuples::m_rawid
private

Definition at line 69 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

int TrackerGeometryIntoNtuples::m_subdetid
private

Definition at line 72 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

TTree* TrackerGeometryIntoNtuples::m_tree
private

Definition at line 75 of file TrackerGeometryIntoNtuples.cc.

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

TTree* TrackerGeometryIntoNtuples::m_treeErrors
private

Definition at line 76 of file TrackerGeometryIntoNtuples.cc.

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

double TrackerGeometryIntoNtuples::m_x
private

Definition at line 70 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_xx
private

Definition at line 73 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_xy
private

Definition at line 73 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_xz
private

Definition at line 73 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_y
private

Definition at line 70 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_yy
private

Definition at line 73 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_yz
private

Definition at line 73 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_z
private

Definition at line 70 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

double TrackerGeometryIntoNtuples::m_zz
private

Definition at line 73 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and analyze().

Alignments* TrackerGeometryIntoNtuples::theAlignments
private

Definition at line 66 of file TrackerGeometryIntoNtuples.cc.

Referenced by analyze().

AlignableTracker* TrackerGeometryIntoNtuples::theCurrentTracker
private

Definition at line 67 of file TrackerGeometryIntoNtuples.cc.

Referenced by analyze().