Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:13

0001 #include <sstream>
0002 
0003 #include "TNtuple.h"
0004 
0005 #include "Alignment/CommonAlignment/interface/Alignable.h"
0006 // #include "Alignment/CommonAlignment/interface/AlignmentParameters.h"
0007 
0008 #include "Alignment/SurveyAnalysis/interface/SurveyOutput.h"
0009 
0010 SurveyOutput::SurveyOutput(const align::Alignables& alignables, const std::string& fileName)
0011     : theAlignables(alignables), theFile(fileName.c_str(), "RECREATE") {}
0012 
0013 void SurveyOutput::write(unsigned int iter) {
0014   std::ostringstream o;
0015 
0016   o << 't' << iter;
0017 
0018   TNtuple* nt = new TNtuple(o.str().c_str(), "", "x:y:z:a:b:g");
0019 
0020   unsigned int N = theAlignables.size();
0021 
0022   for (unsigned int i = 0; i < N; ++i) {
0023     const Alignable* ali = theAlignables[i];
0024 
0025     align::GlobalVector shifts = ali->displacement() * 1e4;  // cm to um
0026 
0027     align::EulerAngles angles = align::toAngles(ali->rotation()) * 1e3;  // to mrad
0028 
0029     nt->Fill(shifts.x(), shifts.y(), shifts.z(), angles(1), angles(2), angles(3));
0030     //     const AlgebraicVector& pars = ali->alignmentParameters()->parameters();
0031 
0032     //     nt->Fill(pars[0], pars[1], pars[2], pars[3], pars[4], pars[5]);
0033   }
0034 
0035   theFile.Write();
0036 
0037   delete nt;
0038 }