CMS 3D CMS Logo

BeamSpotWrite2DB Class Reference

_________________________________________________________________ class: BeamSpotWrite2DB.h package: RecoVertex/BeamSpotProducer More...

#include <RecoVertex/BeamSpotProducer/interface/BeamSpotWrite2DB.h>

Inheritance diagram for BeamSpotWrite2DB:

edm::EDAnalyzer

List of all members.

Public Member Functions

 BeamSpotWrite2DB (const edm::ParameterSet &)
 _________________________________________________________________ class: BeamSpotWrite2DB.cc package: RecoVertex/BeamSpotProducer
 ~BeamSpotWrite2DB ()

Private Member Functions

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

Private Attributes

std::ifstream fasciiFile
std::string fasciiFileName


Detailed Description

_________________________________________________________________ class: BeamSpotWrite2DB.h package: RecoVertex/BeamSpotProducer

author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)

version

Id
BeamSpotWrite2DB.h,v 1.1 2008/05/14 15:39:17 yumiceva Exp

________________________________________________________________

Definition at line 32 of file BeamSpotWrite2DB.h.


Constructor & Destructor Documentation

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

_________________________________________________________________ class: BeamSpotWrite2DB.cc package: RecoVertex/BeamSpotProducer

author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)

version

Id
BeamSpotWrite2DB.cc,v 1.1 2008/05/14 15:39:18 yumiceva Exp

________________________________________________________________

Definition at line 28 of file BeamSpotWrite2DB.cc.

References fasciiFile, fasciiFileName, and edm::ParameterSet::getUntrackedParameter().

00029 {
00030 
00031   fasciiFileName = iConfig.getUntrackedParameter<std::string>("OutputFileName");
00032   
00033   fasciiFile.open(fasciiFileName.c_str());
00034   
00035 }

BeamSpotWrite2DB::~BeamSpotWrite2DB (  ) 

Definition at line 38 of file BeamSpotWrite2DB.cc.

00039 {
00040 }


Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 44 of file BeamSpotWrite2DB.cc.

00045 {
00046 }

void BeamSpotWrite2DB::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 51 of file BeamSpotWrite2DB.cc.

00052 {
00053 }

void BeamSpotWrite2DB::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file BeamSpotWrite2DB.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), fasciiFile, i, edm::Service< T >::isAvailable(), j, BeamSpotObjects::SetBeamWidth(), BeamSpotObjects::SetCovariance(), BeamSpotObjects::Setdxdz(), BeamSpotObjects::Setdydz(), BeamSpotObjects::SetPosition(), BeamSpotObjects::SetSigmaZ(), ecalRecalibSequence_cff::tag, x, y, and z.

00056                          {
00057 
00058         std::cout << " Read beam spot data from flat file " << std::endl;
00059         
00060         
00061         // extract from file
00062         double x,y,z,sigmaZ,dxdz,dydz,beamWidth;
00063         std::string tag;
00064         double cov[7][7];
00065 
00066         fasciiFile >> tag >> x;
00067         fasciiFile >> tag >> y;
00068         fasciiFile >> tag >> z;
00069         fasciiFile >> tag >> sigmaZ;
00070         fasciiFile >> tag >> dxdz;
00071         fasciiFile >> tag >> dydz;
00072         fasciiFile >> tag >> beamWidth;
00073         fasciiFile >> tag >> cov[0][0] >> cov[0][1] >> cov[0][2]>> cov[0][3] >> cov[0][4]>> cov[0][5] >> cov[0][6];
00074         fasciiFile >> tag >> cov[1][0] >> cov[1][1] >> cov[1][2] >> cov[1][3]>> cov[1][4] >> cov[1][5]>> cov[1][6];
00075         fasciiFile >> tag >> cov[2][0]  >> cov[2][1] >> cov[2][2] >> cov[2][3]>> cov[2][4] >> cov[2][5]>> cov[2][6];
00076         fasciiFile >> tag >> cov[3][0]  >> cov[3][1] >> cov[3][2] >> cov[3][3]>> cov[3][4] >> cov[3][5]>> cov[3][6];
00077         fasciiFile >> tag >> cov[4][0] >> cov[4][1] >> cov[4][2] >> cov[4][3]>> cov[4][4] >> cov[4][5]>> cov[4][6];
00078         fasciiFile >> tag >> cov[5][0] >> cov[5][1] >> cov[5][2] >> cov[5][3]>> cov[5][4] >> cov[5][5]>> cov[5][6];
00079         fasciiFile >> tag >> cov[6][0] >> cov[6][1] >> cov[6][2] >> cov[6][3]>> cov[6][4] >> cov[6][5]>> cov[6][6];
00080 
00081         
00082         BeamSpotObjects *abeam = new BeamSpotObjects();
00083         
00084         abeam->SetPosition(x,y,z);
00085         abeam->SetSigmaZ(sigmaZ);
00086         abeam->Setdxdz(dxdz);
00087         abeam->Setdydz(dydz);
00088         abeam->SetBeamWidth(beamWidth);
00089 
00090         for (int i=0; i<7; ++i) {
00091           for (int j=0; j<7; ++j) {
00092             abeam->SetCovariance(i,j,cov[i][j]);
00093           }
00094         }
00095 
00096         std::cout << " write results to DB..." << std::endl;
00097 
00098         edm::Service<cond::service::PoolDBOutputService> poolDbService;
00099         if( poolDbService.isAvailable() ) {
00100           std::cout << "poolDBService available"<<std::endl;
00101           if ( poolDbService->isNewTagRequest( "BeamSpotObjectsRcd" ) ) {
00102             std::cout << "new tag requested" << std::endl;
00103             poolDbService->createNewIOV<BeamSpotObjects>( abeam, poolDbService->beginOfTime(),poolDbService->endOfTime(),
00104                                                                   "BeamSpotObjectsRcd"  );
00105           }
00106           else {
00107             std::cout << "no new tag requested" << std::endl;
00108             poolDbService->appendSinceTime<BeamSpotObjects>( abeam, poolDbService->currentTime(),
00109                                                              "BeamSpotObjectsRcd" );
00110           }
00111           
00112         }
00113 
00114         std::cout << "[BeamSpotWrite2DB] endJob done \n" << std::endl;
00115 }


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:15:01 2009 for CMSSW by  doxygen 1.5.4