#include <BeamSpotWrite2DB.h>
Public Member Functions | |
BeamSpotWrite2DB (const edm::ParameterSet &) | |
~BeamSpotWrite2DB () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
virtual void | endJob () |
Private Attributes | |
std::ifstream | fasciiFile |
std::string | fasciiFileName |
_________________________________________________________________ class: BeamSpotWrite2DB.h package: RecoVertex/BeamSpotProducer
author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)
version
________________________________________________________________
Definition at line 32 of file BeamSpotWrite2DB.h.
BeamSpotWrite2DB::BeamSpotWrite2DB | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
_________________________________________________________________ class: BeamSpotWrite2DB.cc package: RecoVertex/BeamSpotProducer
author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)
version
________________________________________________________________
Definition at line 28 of file BeamSpotWrite2DB.cc.
References fasciiFile, fasciiFileName, and edm::ParameterSet::getUntrackedParameter().
{ fasciiFileName = iConfig.getUntrackedParameter<std::string>("OutputFileName"); fasciiFile.open(fasciiFileName.c_str()); }
BeamSpotWrite2DB::~BeamSpotWrite2DB | ( | ) |
Definition at line 38 of file BeamSpotWrite2DB.cc.
{ }
void BeamSpotWrite2DB::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
void BeamSpotWrite2DB::beginJob | ( | void | ) | [private, virtual] |
void BeamSpotWrite2DB::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 56 of file BeamSpotWrite2DB.cc.
References gather_cfg::cout, fasciiFile, fasciiFileName, i, edm::Service< T >::isAvailable(), j, BeamSpotObjects::SetBeamWidthX(), BeamSpotObjects::SetBeamWidthY(), BeamSpotObjects::SetBetaStar(), BeamSpotObjects::SetCovariance(), BeamSpotObjects::Setdxdz(), BeamSpotObjects::Setdydz(), BeamSpotObjects::SetEmittanceX(), BeamSpotObjects::SetEmittanceY(), BeamSpotObjects::SetPosition(), BeamSpotObjects::SetSigmaZ(), BeamSpotObjects::SetType(), GlobalPosition_Frontier_DevDB_cff::tag, x, detailsBasic3DVector::y, and z.
{ std::cout << " Read beam spot data from text file: " << fasciiFileName << std::endl; std::cout << " please see plugins/BeamSpotWrite2DB.cc for format of text file." << std::endl; /* std::cout << " Content of the file is expected to have this format with the first column as a keyword:" << std::endl; std::cout << " x\n y\n z\n sigmaZ\n dxdz\n dydz\n beamWidthX\n beamWidthY" << std::endl; for (int i =0; i<7; i++) { for (int j=0; j<7; j++ ) { std::cout << " cov["<<i<<"]["<<j<<"] cov["<<i<<"]["<<j<<"] cov["<<i<<"]["<<j<<"] cov["<<i<<"]["<<j<<"] cov["<<i<<"]["<<j<<"] cov["<<j<<"]["<<j<<"] cov["<<i<<"]["<<j<<"]" << std::endl; } } */ // extract from file double x,y,z,sigmaZ,dxdz,dydz,beamWidthX,beamWidthY,emittanceX,emittanceY,betastar; std::string tag; double cov[7][7]; int type; fasciiFile >> tag >> type; fasciiFile >> tag >> x; fasciiFile >> tag >> y; fasciiFile >> tag >> z; fasciiFile >> tag >> sigmaZ; fasciiFile >> tag >> dxdz; fasciiFile >> tag >> dydz; fasciiFile >> tag >> beamWidthX; fasciiFile >> tag >> beamWidthY; fasciiFile >> tag >> cov[0][0] >> cov[0][1] >> cov[0][2]>> cov[0][3] >> cov[0][4]>> cov[0][5] >> cov[0][6]; fasciiFile >> tag >> cov[1][0] >> cov[1][1] >> cov[1][2] >> cov[1][3]>> cov[1][4] >> cov[1][5]>> cov[1][6]; fasciiFile >> tag >> cov[2][0] >> cov[2][1] >> cov[2][2] >> cov[2][3]>> cov[2][4] >> cov[2][5]>> cov[2][6]; fasciiFile >> tag >> cov[3][0] >> cov[3][1] >> cov[3][2] >> cov[3][3]>> cov[3][4] >> cov[3][5]>> cov[3][6]; fasciiFile >> tag >> cov[4][0] >> cov[4][1] >> cov[4][2] >> cov[4][3]>> cov[4][4] >> cov[4][5]>> cov[4][6]; fasciiFile >> tag >> cov[5][0] >> cov[5][1] >> cov[5][2] >> cov[5][3]>> cov[5][4] >> cov[5][5]>> cov[5][6]; fasciiFile >> tag >> cov[6][0] >> cov[6][1] >> cov[6][2] >> cov[6][3]>> cov[6][4] >> cov[6][5]>> cov[6][6]; fasciiFile >> tag >> emittanceX; fasciiFile >> tag >> emittanceY; fasciiFile >> tag >> betastar; BeamSpotObjects *abeam = new BeamSpotObjects(); abeam->SetType(type); abeam->SetPosition(x,y,z); abeam->SetSigmaZ(sigmaZ); abeam->Setdxdz(dxdz); abeam->Setdydz(dydz); abeam->SetBeamWidthX(beamWidthX); abeam->SetBeamWidthY(beamWidthY); abeam->SetEmittanceX( emittanceX ); abeam->SetEmittanceY( emittanceY ); abeam->SetBetaStar( betastar ); for (int i=0; i<7; ++i) { for (int j=0; j<7; ++j) { abeam->SetCovariance(i,j,cov[i][j]); } } std::cout << " write results to DB..." << std::endl; edm::Service<cond::service::PoolDBOutputService> poolDbService; if( poolDbService.isAvailable() ) { std::cout << "poolDBService available"<<std::endl; if ( poolDbService->isNewTagRequest( "BeamSpotObjectsRcd" ) ) { std::cout << "new tag requested" << std::endl; poolDbService->createNewIOV<BeamSpotObjects>( abeam, poolDbService->beginOfTime(),poolDbService->endOfTime(), "BeamSpotObjectsRcd" ); } else { std::cout << "no new tag requested" << std::endl; poolDbService->appendSinceTime<BeamSpotObjects>( abeam, poolDbService->currentTime(), "BeamSpotObjectsRcd" ); } } std::cout << "[BeamSpotWrite2DB] endJob done \n" << std::endl; }
std::ifstream BeamSpotWrite2DB::fasciiFile [private] |
Definition at line 43 of file BeamSpotWrite2DB.h.
Referenced by BeamSpotWrite2DB(), and endJob().
std::string BeamSpotWrite2DB::fasciiFileName [private] |
Definition at line 44 of file BeamSpotWrite2DB.h.
Referenced by BeamSpotWrite2DB(), and endJob().