CMS 3D CMS Logo

DTSurveyConvert.cc
Go to the documentation of this file.
1 #include <fstream>
2 
8 // #include "FWCore/ParameterSet/interface/ParameterSet.h"
11 
13 
15 {
16  //now do what ever initialization is needed
17  nameWheel_m2 = iConfig.getUntrackedParameter<std::string>("nameWheel_m2");
18  nameWheel_m1 = iConfig.getUntrackedParameter<std::string>("nameWheel_m1");
19  nameWheel_0 = iConfig.getUntrackedParameter<std::string>("nameWheel_0");
20  nameWheel_p1 = iConfig.getUntrackedParameter<std::string>("nameWheel_p1");
21  nameWheel_p2 = iConfig.getUntrackedParameter<std::string>("nameWheel_p2");
22 
23  nameChambers_m2 = iConfig.getUntrackedParameter<std::string>("nameChambers_m2");
24  nameChambers_m1 = iConfig.getUntrackedParameter<std::string>("nameChambers_m1");
25  nameChambers_0 = iConfig.getUntrackedParameter<std::string>("nameChambers_0");
26  nameChambers_p1 = iConfig.getUntrackedParameter<std::string>("nameChambers_p1");
27  nameChambers_p2 = iConfig.getUntrackedParameter<std::string>("nameChambers_p2");
28 
29  wheel_m2 = iConfig.getUntrackedParameter<bool>("wheel_m2");
30  wheel_m1 = iConfig.getUntrackedParameter<bool>("wheel_m1");
31  wheel_0 = iConfig.getUntrackedParameter<bool>("wheel_0");
32  wheel_p1 = iConfig.getUntrackedParameter<bool>("wheel_p1");
33  wheel_p2 = iConfig.getUntrackedParameter<bool>("wheel_p2");
34 
35  outputFileName = iConfig.getUntrackedParameter<std::string>("OutputTextFile");
36  WriteToDB = iConfig.getUntrackedParameter<bool>("writeToDB");
37 
38 }
39 
40 // ------------ method called to for each event ------------
41 void
43 {
44 
46  iSetup.get<MuonGeometryRecord>().get( pDD );
47 
48  std::ofstream outFile(outputFileName.c_str());
49 
50  if (wheel_m2 == true) {
52  wheel->ReadChambers(pDD);
53  wheel->CalculateChambers();
54  outFile << *wheel;
55  wheelList.push_back(wheel);
56  }
57  if (wheel_m1 == true) {
59  wheel->ReadChambers(pDD);
60  wheel->CalculateChambers();
61  outFile << *wheel;
62  wheelList.push_back(wheel);
63  }
64  if (wheel_0 == true) {
66  wheel->ReadChambers(pDD);
67  wheel->CalculateChambers();
68  outFile << *wheel;
69  wheelList.push_back(wheel);
70  }
71  if (wheel_p1 == true) {
73  wheel->ReadChambers(pDD);
74  wheel->CalculateChambers();
75  outFile << *wheel;
76  wheelList.push_back(wheel);
77  }
78  if(wheel_p2 == true) {
80  wheel->ReadChambers(pDD);
81  wheel->CalculateChambers();
82  outFile << *wheel;
83  wheelList.push_back(wheel);
84  }
85  outFile.close();
86 
87  if(WriteToDB == true) {
88  // Instantiate the helper class
89  MuonAlignment align(iSetup);
90  std::ifstream inFile(outputFileName.c_str());
91  while(!inFile.eof()) {
92  float dx, dy, dz, sigma_dx, sigma_dy, sigma_dz;
93  float alpha, beta, gamma, sigma_alpha, sigma_beta, sigma_gamma;
94  inFile >> dx >> sigma_dx >> dy >> sigma_dy >> dz >> sigma_dz
95  >> alpha >> sigma_alpha >> beta >> sigma_beta >> gamma >> sigma_gamma;
96  if(inFile.eof()) break;
97  std::vector<float> displacement;
98  displacement.push_back(dx);
99  displacement.push_back(dy);
100  displacement.push_back(dz);
101  displacement.push_back(-alpha);
102  displacement.push_back(-beta);
103  displacement.push_back(-gamma);
104  }
105  inFile.close();
106  align.saveToDB();
107  }
108 }
109 
const double beta
T getUntrackedParameter(std::string const &, T const &) const
std::string nameWheel_p2
float alpha
Definition: AMPTWrapper.h:95
std::string nameChambers_0
void ReadChambers(edm::ESHandle< DTGeometry >)
Definition: DTSurvey.cc:41
std::string nameChambers_p2
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::string nameChambers_p1
std::string nameWheel_m2
std::string nameWheel_p1
std::string outputFileName
void CalculateChambers()
Definition: DTSurvey.cc:28
std::string nameChambers_m2
const T & get() const
Definition: EventSetup.h:59
std::vector< DTSurvey * > wheelList
std::string nameWheel_0
void analyze(const edm::Event &, const edm::EventSetup &) override
DTSurveyConvert(const edm::ParameterSet &)
std::string nameWheel_m1
std::string nameChambers_m1