![]() |
![]() |
#include <TrackerGeometryIntoNtuples.cc>
Public Member Functions | |
TrackerGeometryIntoNtuples (const edm::ParameterSet &) | |
~TrackerGeometryIntoNtuples () | |
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_ |
AlignableTracker * | theCurrentTracker |
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.
anonymous enum [private] |
Definition at line 99 of file TrackerGeometryIntoNtuples.cc.
{kMaxNumPar = 20}; // slighly above 'two bowed surfaces' limit
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.
: theCurrentTracker(0), m_rawid(0), m_x(0.), m_y(0.), m_z(0.), m_alpha(0.), m_beta(0.), m_gamma(0.), m_subdetid(0), m_xx(0.), m_xy(0.), m_yy(0.), m_xz(0.), m_yz(0.), m_zz(0.), m_dNpar(0), m_d1(0.), m_d2(0.), m_d3(0.), m_dtype(0), mp_dpar(0) { m_outputFile = iConfig.getUntrackedParameter< std::string > ("outputFile"); m_outputTreename = iConfig.getUntrackedParameter< std::string > ("outputTreename"); m_file = new TFile(m_outputFile.c_str(),"RECREATE"); m_tree = new TTree(m_outputTreename.c_str(),m_outputTreename.c_str()); m_treeDeformations = new TTree("alignTreeDeformations","alignTreeDeformations"); //char errorTreeName[256]; //snprintf(errorTreeName, sizeof(errorTreeName), "%sErrors", m_outputTreename); //m_treeErrors = new TTree(errorTreeName,errorTreeName); m_treeErrors = new TTree("alignTreeErrors","alignTreeErrors"); }
TrackerGeometryIntoNtuples::~TrackerGeometryIntoNtuples | ( | ) |
Definition at line 146 of file TrackerGeometryIntoNtuples.cc.
References theCurrentTracker.
{ delete theCurrentTracker; }
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 analyze().
{ m_tree->Branch("rawid", &m_rawid, "rawid/I"); m_tree->Branch("x", &m_x, "x/D"); m_tree->Branch("y", &m_y, "y/D"); m_tree->Branch("z", &m_z, "z/D"); m_tree->Branch("alpha", &m_alpha, "alpha/D"); m_tree->Branch("beta", &m_beta, "beta/D"); m_tree->Branch("gamma", &m_gamma, "gamma/D"); m_treeDeformations->Branch("irawid", &m_rawid, "irawid/I"); m_treeDeformations->Branch("subdetid", &m_subdetid, "subdetid/I"); m_treeDeformations->Branch("dNpar", &m_dNpar, "dNpar/I"); //m_treeDeformations->Branch("d1", &m_d1, "d1/D"); //m_treeDeformations->Branch("d2", &m_d2, "d2/D"); //m_treeDeformations->Branch("d3", &m_d3, "d3/D"); m_treeDeformations->Branch("dtype", &m_dtype); m_treeDeformations->Branch("dpar", "std::vector<double>", &mp_dpar); m_treeErrors->Branch("rawid", &m_rawid, "rawid/I"); m_treeErrors->Branch("subdetid", &m_subdetid, "subdetid/I"); m_treeErrors->Branch("xx", &m_xx, "xx/D"); m_treeErrors->Branch("yy", &m_yy, "yy/D"); m_treeErrors->Branch("zz", &m_zz, "zz/D"); m_treeErrors->Branch("xy", &m_xy, "xy/D"); m_treeErrors->Branch("xz", &m_xz, "xz/D"); m_treeErrors->Branch("yz", &m_yz, "yz/D"); //m_tree->Branch("NumDeform", &numDeformationValues_, "NumDeform/i"); //m_tree->Branch("DeformValues", deformationValues_, "DeformValues[NumDeform]/F"); }
void TrackerGeometryIntoNtuples::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
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.
{ edm::LogInfo("beginJob") << "Begin Job" << std::endl; //accessing the initial geometry edm::ESHandle<GeometricDet> theGeometricDet; iSetup.get<IdealGeometryRecord>().get(theGeometricDet); TrackerGeomBuilderFromGeometricDet trackerBuilder; //currernt tracker TrackerGeometry* theCurTracker = trackerBuilder.build(&*theGeometricDet); //build the tracker edm::ESHandle<Alignments> alignments; edm::ESHandle<AlignmentErrors> alignmentErrors; edm::ESHandle<AlignmentSurfaceDeformations> surfaceDeformations; iSetup.get<TrackerAlignmentRcd>().get(alignments); iSetup.get<TrackerAlignmentErrorRcd>().get(alignmentErrors); iSetup.get<TrackerSurfaceDeformationRcd>().get(surfaceDeformations); //apply the latest alignments edm::ESHandle<Alignments> globalPositionRcd; iSetup.get<TrackerDigiGeometryRecord>().getRecord<GlobalPositionRcd>().get(globalPositionRcd); GeometryAligner aligner; aligner.applyAlignments<TrackerGeometry>( &(*theCurTracker), &(*alignments), &(*alignmentErrors), align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker))); aligner.attachSurfaceDeformations<TrackerGeometry>( &(*theCurTracker), &(*surfaceDeformations)) ; theCurrentTracker = new AlignableTracker(&(*theCurTracker)); Alignments* theAlignments = theCurrentTracker->alignments(); //AlignmentErrors* theAlignmentErrors = theCurrentTracker->alignmentErrors(); //alignments addBranches(); for (std::vector<AlignTransform>::const_iterator i = theAlignments->m_align.begin(); i != theAlignments->m_align.end(); ++i){ m_rawid = i->rawId(); CLHEP::Hep3Vector translation = i->translation(); m_x = translation.x(); m_y = translation.y(); m_z = translation.z(); CLHEP::HepRotation rotation = i->rotation(); m_alpha = rotation.getPhi(); m_beta = rotation.getTheta(); m_gamma = rotation.getPsi(); m_tree->Fill(); //DetId detid(m_rawid); //if (detid.subdetId() > 2){ //PXFDetId pxfid( m_rawid ); //std::cout << " panel: " << pxfid.panel() << ", module: " << pxfid.module() << std::endl; //if ((pxfid.panel() == 1) && (pxfid.module() == 4)) std::cout << m_rawid << ", "; //std::cout << m_rawid << std::setprecision(9) << " " << m_x << " " << m_y << " " << m_z; //std::cout << std::setprecision(9) << " " << m_alpha << " " << m_beta << " " << m_gamma << std::endl; //} } delete theAlignments; std::vector<AlignTransformError> alignErrors = alignmentErrors->m_alignError; for (std::vector<AlignTransformError>::const_iterator i = alignErrors.begin(); i != alignErrors.end(); ++i){ m_rawid = i->rawId(); CLHEP::HepSymMatrix errMatrix = i->matrix(); DetId detid(m_rawid); m_subdetid = detid.subdetId(); m_xx = errMatrix[0][0]; m_xy = errMatrix[0][1]; m_xz = errMatrix[0][2]; m_yy = errMatrix[1][1]; m_yz = errMatrix[1][2]; m_zz = errMatrix[2][2]; m_treeErrors->Fill(); } // Get GeomDetUnits for the current tracker std::vector<GeomDetUnit*>detUnits = theCurTracker->detUnits() ; int detUnit(0) ; //\\for (unsigned int iDet = 0; iDet < detUnits.size(); ++iDet) { for (std::vector<GeomDetUnit*>::const_iterator iunit = detUnits.begin(); iunit != detUnits.end(); ++iunit) { DetId detid = (*iunit)->geographicalId(); m_rawid = detid.rawId() ; m_subdetid = detid.subdetId(); ++detUnit ; //\\GeomDetUnit* geomDetUnit = detUnits.at(iDet) ; GeomDetUnit* geomDetUnit = *iunit ; // Get SurfaceDeformation for this GeomDetUnit if ( geomDetUnit->surfaceDeformation() ) { std::vector<double> surfaceDeformParams = (geomDetUnit->surfaceDeformation())->parameters() ; //edm::LogInfo("surfaceDeformParamsSize") << " surfaceDeformParams size = " << surfaceDeformParams.size() << std::endl ; m_dNpar = surfaceDeformParams.size() ; m_dtype = (geomDetUnit->surfaceDeformation())->type() ; m_d1 = surfaceDeformParams.at(0) ; m_d2 = surfaceDeformParams.at(1) ; m_d3 = surfaceDeformParams.at(2) ; mp_dpar->clear() ; for (std::vector<double>::const_iterator it = surfaceDeformParams.begin(); it != surfaceDeformParams.end(); ++it) { mp_dpar->push_back((*it)) ; //edm::LogInfo("surfaceDeformParamsContent") << " surfaceDeformParam = " << (*it) << std::endl ; } m_treeDeformations->Fill() ; } } //write out m_file->cd(); m_tree->Write(); m_treeDeformations->Write(); m_treeErrors->Write(); m_file->Close(); }
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.
Definition at line 84 of file TrackerGeometryIntoNtuples.cc.
Referenced by analyze(), and ~TrackerGeometryIntoNtuples().