CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DTSurveyConvert Class Reference

#include <Alignment/DTSurveyConvert/src/DTSurveyConvert.cc>

Inheritance diagram for DTSurveyConvert:
edm::EDAnalyzer

List of all members.

Public Member Functions

 DTSurveyConvert (const edm::ParameterSet &)

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void endJob (const edm::EventSetup &)

Private Attributes

std::string nameChambers_0
std::string nameChambers_m1
std::string nameChambers_m2
std::string nameChambers_p1
std::string nameChambers_p2
std::string nameWheel_0
std::string nameWheel_m1
std::string nameWheel_m2
std::string nameWheel_p1
std::string nameWheel_p2
std::string outputFileName
bool wheel_0
bool wheel_m1
bool wheel_m2
bool wheel_p1
bool wheel_p2
std::vector< DTSurvey * > wheelList
bool WriteToDB

Detailed Description

Description: Reads survey information, process it and outputs a text file with results

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

Definition at line 27 of file DTSurveyConvert.h.


Constructor & Destructor Documentation

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

Definition at line 14 of file DTSurveyConvert.cc.

References edm::ParameterSet::getUntrackedParameter(), nameChambers_0, nameChambers_m1, nameChambers_m2, nameChambers_p1, nameChambers_p2, nameWheel_0, nameWheel_m1, nameWheel_m2, nameWheel_p1, nameWheel_p2, outputFileName, wheel_0, wheel_m1, wheel_m2, wheel_p1, wheel_p2, and WriteToDB.

{
   //now do what ever initialization is needed
   nameWheel_m2 = iConfig.getUntrackedParameter<std::string>("nameWheel_m2");
   nameWheel_m1 = iConfig.getUntrackedParameter<std::string>("nameWheel_m1");
   nameWheel_0 = iConfig.getUntrackedParameter<std::string>("nameWheel_0");
   nameWheel_p1 = iConfig.getUntrackedParameter<std::string>("nameWheel_p1");
   nameWheel_p2 = iConfig.getUntrackedParameter<std::string>("nameWheel_p2");
   
   nameChambers_m2 = iConfig.getUntrackedParameter<std::string>("nameChambers_m2");
   nameChambers_m1 = iConfig.getUntrackedParameter<std::string>("nameChambers_m1");
   nameChambers_0 = iConfig.getUntrackedParameter<std::string>("nameChambers_0");
   nameChambers_p1 = iConfig.getUntrackedParameter<std::string>("nameChambers_p1");
   nameChambers_p2 = iConfig.getUntrackedParameter<std::string>("nameChambers_p2");

   wheel_m2 = iConfig.getUntrackedParameter<bool>("wheel_m2");
   wheel_m1 = iConfig.getUntrackedParameter<bool>("wheel_m1");
   wheel_0 = iConfig.getUntrackedParameter<bool>("wheel_0");
   wheel_p1 = iConfig.getUntrackedParameter<bool>("wheel_p1");
   wheel_p2 = iConfig.getUntrackedParameter<bool>("wheel_p2");

   outputFileName = iConfig.getUntrackedParameter<std::string>("OutputTextFile");
   WriteToDB = iConfig.getUntrackedParameter<bool>("writeToDB");
  
}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 42 of file DTSurveyConvert.cc.

References DTSurvey::CalculateChambers(), edm::EventSetup::get(), nameChambers_0, nameChambers_m1, nameChambers_m2, nameChambers_p1, nameChambers_p2, nameWheel_0, nameWheel_m1, nameWheel_m2, nameWheel_p1, nameWheel_p2, outputFileName, DTSurvey::ReadChambers(), wheel_0, wheel_m1, wheel_m2, wheel_p1, wheel_p2, and wheelList.

{

  edm::ESHandle<DTGeometry> pDD;
  iSetup.get<MuonGeometryRecord>().get( pDD );
 
  std::ofstream outFile(outputFileName.c_str());
  
  if (wheel_m2 == true) {
    DTSurvey *wheel = new DTSurvey(nameWheel_m2, nameChambers_m2, -2);
    wheel->ReadChambers(pDD);
    wheel->CalculateChambers();
    outFile << *wheel; 
    wheelList.push_back(wheel);
  } 
  if (wheel_m1 == true) {
    DTSurvey *wheel = new DTSurvey(nameWheel_m1, nameChambers_m1, -1);
    wheel->ReadChambers(pDD);
    wheel->CalculateChambers();
    outFile << *wheel; 
    wheelList.push_back(wheel);
  } 
  if (wheel_0 == true) {
    DTSurvey *wheel = new DTSurvey(nameWheel_0, nameChambers_0, 0);
    wheel->ReadChambers(pDD);
    wheel->CalculateChambers();
    outFile << *wheel; 
    wheelList.push_back(wheel);
  } 
  if (wheel_p1 == true) {
    DTSurvey *wheel = new DTSurvey(nameWheel_p1, nameChambers_p1, 1);
    wheel->ReadChambers(pDD);
    wheel->CalculateChambers();
    outFile << *wheel; 
    wheelList.push_back(wheel);
  } 
  if(wheel_p2 == true) {
    DTSurvey *wheel = new DTSurvey(nameWheel_p2, nameChambers_p2, 2);
    wheel->ReadChambers(pDD);
    wheel->CalculateChambers();
    outFile << *wheel; 
    wheelList.push_back(wheel);
  }
  outFile.close();
}
void DTSurveyConvert::endJob ( const edm::EventSetup eventSetup) [private, virtual]

Definition at line 90 of file DTSurveyConvert.cc.

References alpha, beta, outputFileName, MuonAlignment::saveToDB(), and WriteToDB.

                                                       {
  if(WriteToDB == true) {
    // Instantiate the helper class
    MuonAlignment align( eventSetup );
    std::ifstream inFile(outputFileName.c_str());
    while(!inFile.eof()) {
      float dx, dy, dz, sigma_dx, sigma_dy, sigma_dz;
      float alpha, beta, gamma, sigma_alpha, sigma_beta, sigma_gamma;
      inFile >> dx >> sigma_dx >> dy >> sigma_dy >> dz >> sigma_dz
             >> alpha >> sigma_alpha >> beta >> sigma_beta >> gamma >> sigma_gamma; 
      if(inFile.eof()) break;
      std::vector<float> displacement;
      displacement.push_back(dx);
      displacement.push_back(dy);
      displacement.push_back(dz);
      displacement.push_back(-alpha);
      displacement.push_back(-beta);
      displacement.push_back(-gamma);
    }
    inFile.close();
    align.saveToDB();
  }
}

Member Data Documentation

std::string DTSurveyConvert::nameChambers_0 [private]

Definition at line 43 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

std::string DTSurveyConvert::nameChambers_m1 [private]

Definition at line 42 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

std::string DTSurveyConvert::nameChambers_m2 [private]

Definition at line 41 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

std::string DTSurveyConvert::nameChambers_p1 [private]

Definition at line 44 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

std::string DTSurveyConvert::nameChambers_p2 [private]

Definition at line 45 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

std::string DTSurveyConvert::nameWheel_0 [private]

Definition at line 38 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

std::string DTSurveyConvert::nameWheel_m1 [private]

Definition at line 37 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

std::string DTSurveyConvert::nameWheel_m2 [private]

Definition at line 36 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

std::string DTSurveyConvert::nameWheel_p1 [private]

Definition at line 39 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

std::string DTSurveyConvert::nameWheel_p2 [private]

Definition at line 40 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

std::string DTSurveyConvert::outputFileName [private]

Definition at line 46 of file DTSurveyConvert.h.

Referenced by analyze(), DTSurveyConvert(), and endJob().

bool DTSurveyConvert::wheel_0 [private]

Definition at line 49 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

bool DTSurveyConvert::wheel_m1 [private]

Definition at line 48 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

bool DTSurveyConvert::wheel_m2 [private]

Definition at line 47 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

bool DTSurveyConvert::wheel_p1 [private]

Definition at line 50 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

bool DTSurveyConvert::wheel_p2 [private]

Definition at line 51 of file DTSurveyConvert.h.

Referenced by analyze(), and DTSurveyConvert().

std::vector<DTSurvey *> DTSurveyConvert::wheelList [private]

Definition at line 35 of file DTSurveyConvert.h.

Referenced by analyze().

Definition at line 52 of file DTSurveyConvert.h.

Referenced by DTSurveyConvert(), and endJob().