CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Alignment/SurveyAnalysis/src/SurveyOutput.cc

Go to the documentation of this file.
00001 #include <sstream>
00002 
00003 #include "TNtuple.h"
00004 
00005 #include "Alignment/CommonAlignment/interface/Alignable.h"
00006 // #include "Alignment/CommonAlignment/interface/AlignmentParameters.h"
00007 
00008 #include "Alignment/SurveyAnalysis/interface/SurveyOutput.h"
00009 
00010 SurveyOutput::SurveyOutput(const std::vector<Alignable*>& alignables,
00011                            const std::string& fileName):
00012   theAlignables(alignables),
00013   theFile(fileName.c_str(), "RECREATE")
00014 {
00015 }
00016 
00017 void SurveyOutput::write(unsigned int iter)
00018 {
00019   std::ostringstream o;
00020 
00021   o << 't' << iter;
00022 
00023   TNtuple* nt = new TNtuple(o.str().c_str(), "", "x:y:z:a:b:g");
00024 
00025   unsigned int N = theAlignables.size();
00026 
00027   for (unsigned int i = 0; i < N; ++i)
00028   {
00029     const Alignable* ali = theAlignables[i];
00030 
00031     align::GlobalVector shifts = ali->displacement() * 1e4; // cm to um
00032 
00033     align::EulerAngles angles = align::toAngles( ali->rotation() ) * 1e3; // to mrad
00034 
00035     nt->Fill( shifts.x(), shifts.y(), shifts.z(),
00036               angles(1), angles(2), angles(3) );
00037 //     const AlgebraicVector& pars = ali->alignmentParameters()->parameters();
00038 
00039 //     nt->Fill(pars[0], pars[1], pars[2], pars[3], pars[4], pars[5]);
00040   }
00041 
00042   theFile.Write();
00043 
00044   delete nt;
00045 }