CMS 3D CMS Logo

TrackerGeometryIntoNtuples Class Reference

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

#include <TrackerGeometryIntoNtuples.cc>

Inheritance diagram for TrackerGeometryIntoNtuples:

edm::EDAnalyzer

List of all members.

Public Member Functions

 TrackerGeometryIntoNtuples (const edm::ParameterSet &)
 ~TrackerGeometryIntoNtuples ()

Private Member Functions

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

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
TTree * m_tree
TTree * m_treeErrors
double m_x
double m_xx
double m_y
double m_yx
double m_yy
double m_z
double m_zx
double m_zy
double m_zz
AlignmentstheAlignments
AlignableTrackertheCurrentTracker


Detailed Description

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

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

Definition at line 51 of file TrackerGeometryIntoNtuples.cc.


Constructor & Destructor Documentation

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

Definition at line 92 of file TrackerGeometryIntoNtuples.cc.

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

00093 {
00094         m_outputFile = iConfig.getUntrackedParameter< std::string > ("outputFile");
00095         m_outputTreename = iConfig.getUntrackedParameter< std::string > ("outputTreename");
00096         m_file = new TFile(m_outputFile.c_str(),"RECREATE");
00097         m_tree = new TTree(m_outputTreename.c_str(),m_outputTreename.c_str());
00098 
00099         
00100 }

TrackerGeometryIntoNtuples::~TrackerGeometryIntoNtuples (  ) 

Definition at line 103 of file TrackerGeometryIntoNtuples.cc.

00104 {}


Member Function Documentation

void TrackerGeometryIntoNtuples::addBranches (  )  [private]

Definition at line 175 of file TrackerGeometryIntoNtuples.cc.

References m_alpha, m_beta, m_gamma, m_rawid, m_tree, m_x, m_y, and m_z.

Referenced by beginJob().

00175                                              {
00176 
00177    m_tree->Branch("rawid", &m_rawid, "rawid/I");
00178    m_tree->Branch("x", &m_x, "x/D");
00179    m_tree->Branch("y", &m_y, "y/D");
00180    m_tree->Branch("z", &m_z, "z/D");
00181          m_tree->Branch("alpha", &m_alpha, "alpha/D");
00182          m_tree->Branch("beta", &m_beta, "beta/D");
00183          m_tree->Branch("gamma", &m_gamma, "gamma/D");
00184 
00185 }

void TrackerGeometryIntoNtuples::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 112 of file TrackerGeometryIntoNtuples.cc.

00113 {}

void TrackerGeometryIntoNtuples::beginJob ( const edm::EventSetup iSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 117 of file TrackerGeometryIntoNtuples.cc.

References addBranches(), GeometryAligner::applyAlignments(), TrackerGeomBuilderFromGeometricDet::build(), align::DetectorGlobalPosition(), lat::endl(), edm::EventSetup::get(), i, Alignments::m_align, m_alpha, m_beta, m_file, m_gamma, m_rawid, m_tree, m_x, m_y, m_z, theAlignments, theCurrentTracker, and DetId::Tracker.

00118 {
00119         edm::LogInfo("beginJob") << "Begin Job" << std::endl;
00120         
00121         //accessing the initial geometry
00122         edm::ESHandle<GeometricDet> theGeometricDet;
00123         iSetup.get<IdealGeometryRecord>().get(theGeometricDet);
00124         TrackerGeomBuilderFromGeometricDet trackerBuilder;
00125         //currernt tracker
00126         TrackerGeometry* theCurTracker = trackerBuilder.build(&*theGeometricDet); 
00127 
00128         
00129         //build the tracker
00130         edm::ESHandle<Alignments> alignments;
00131         edm::ESHandle<AlignmentErrors> alignmentErrors;
00132         
00133         iSetup.get<TrackerAlignmentRcd>().get(alignments);
00134         iSetup.get<TrackerAlignmentErrorRcd>().get(alignmentErrors);
00135         
00136         //apply the latest alignments
00137         edm::ESHandle<Alignments> globalPositionRcd;
00138         iSetup.get<TrackerDigiGeometryRecord>().getRecord<GlobalPositionRcd>().get(globalPositionRcd);
00139         GeometryAligner aligner;
00140         aligner.applyAlignments<TrackerGeometry>( &(*theCurTracker), &(*alignments), &(*alignmentErrors),
00141                                                   align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)));
00142         
00143         
00144         theCurrentTracker = new AlignableTracker(&(*theCurTracker));    
00145         
00146         Alignments* theAlignments = theCurrentTracker->alignments();
00147         //not used AlignmentErrors* theAlignmentErrors = theCurrentTracker->alignmentErrors();  
00148         //alignments
00149         addBranches();
00150         for (std::vector<AlignTransform>::const_iterator i = theAlignments->m_align.begin(); i != theAlignments->m_align.end(); ++i){
00151 
00152                 m_rawid = i->rawId();
00153                 Hep3Vector translation = i->translation();
00154                 m_x = translation.x();
00155                 m_y = translation.y();
00156                 m_z = translation.z();
00157 
00158                 
00159                 HepRotation rotation = i->rotation();
00160                 m_alpha = rotation.getPhi();
00161                 m_beta = rotation.getTheta();
00162                 m_gamma = rotation.getPsi();
00163                 m_tree->Fill();
00164                 
00165         }
00166 
00167         //write out 
00168         m_file->cd();
00169         m_tree->Write();
00170         m_file->Close();
00171 }

void TrackerGeometryIntoNtuples::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 189 of file TrackerGeometryIntoNtuples.cc.

00189                                         {
00190 }


Member Data Documentation

double TrackerGeometryIntoNtuples::m_alpha [private]

Definition at line 71 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and beginJob().

double TrackerGeometryIntoNtuples::m_beta [private]

Definition at line 71 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and beginJob().

TFile* TrackerGeometryIntoNtuples::m_file [private]

Definition at line 78 of file TrackerGeometryIntoNtuples.cc.

Referenced by beginJob(), and TrackerGeometryIntoNtuples().

double TrackerGeometryIntoNtuples::m_gamma [private]

Definition at line 71 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and beginJob().

std::string TrackerGeometryIntoNtuples::m_outputFile [private]

Definition at line 76 of file TrackerGeometryIntoNtuples.cc.

Referenced by TrackerGeometryIntoNtuples().

std::string TrackerGeometryIntoNtuples::m_outputTreename [private]

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

TTree* TrackerGeometryIntoNtuples::m_tree [private]

Definition at line 74 of file TrackerGeometryIntoNtuples.cc.

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

TTree* TrackerGeometryIntoNtuples::m_treeErrors [private]

Definition at line 75 of file TrackerGeometryIntoNtuples.cc.

double TrackerGeometryIntoNtuples::m_x [private]

Definition at line 70 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and beginJob().

double TrackerGeometryIntoNtuples::m_xx [private]

Definition at line 72 of file TrackerGeometryIntoNtuples.cc.

double TrackerGeometryIntoNtuples::m_y [private]

Definition at line 70 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and beginJob().

double TrackerGeometryIntoNtuples::m_yx [private]

Definition at line 72 of file TrackerGeometryIntoNtuples.cc.

double TrackerGeometryIntoNtuples::m_yy [private]

Definition at line 72 of file TrackerGeometryIntoNtuples.cc.

double TrackerGeometryIntoNtuples::m_z [private]

Definition at line 70 of file TrackerGeometryIntoNtuples.cc.

Referenced by addBranches(), and beginJob().

double TrackerGeometryIntoNtuples::m_zx [private]

Definition at line 72 of file TrackerGeometryIntoNtuples.cc.

double TrackerGeometryIntoNtuples::m_zy [private]

Definition at line 72 of file TrackerGeometryIntoNtuples.cc.

double TrackerGeometryIntoNtuples::m_zz [private]

Definition at line 72 of file TrackerGeometryIntoNtuples.cc.

Alignments* TrackerGeometryIntoNtuples::theAlignments [private]

Definition at line 66 of file TrackerGeometryIntoNtuples.cc.

Referenced by beginJob().

AlignableTracker* TrackerGeometryIntoNtuples::theCurrentTracker [private]

Definition at line 67 of file TrackerGeometryIntoNtuples.cc.

Referenced by beginJob().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:34:04 2009 for CMSSW by  doxygen 1.5.4