CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
AlcaBeamSpotHarvester Class Reference

#include <AlcaBeamSpotHarvester.h>

Inheritance diagram for AlcaBeamSpotHarvester:
edm::EDAnalyzer

Public Member Functions

 AlcaBeamSpotHarvester (const edm::ParameterSet &)
 Constructor. More...
 
virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob (void)
 
virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
virtual void endJob (void)
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
virtual ~AlcaBeamSpotHarvester ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

std::string beamSpotOutputBase_
 
std::string outputrecordName_
 
double sigmaZValue_
 
AlcaBeamSpotManager theAlcaBeamSpotManager_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

No description available.

Date:
2011/02/16 12:40:30
Revision:
1.6
Author
L. Uplegger F. Yumiceva - Fermilab

Definition at line 17 of file AlcaBeamSpotHarvester.h.

Constructor & Destructor Documentation

AlcaBeamSpotHarvester::AlcaBeamSpotHarvester ( const edm::ParameterSet iConfig)

Constructor.

Definition at line 38 of file AlcaBeamSpotHarvester.cc.

38  :
39  beamSpotOutputBase_ (iConfig.getParameter<ParameterSet>("AlcaBeamSpotHarvesterParameters").getUntrackedParameter<std::string>("BeamSpotOutputBase")),
40  outputrecordName_ (iConfig.getParameter<ParameterSet>("AlcaBeamSpotHarvesterParameters").getUntrackedParameter<std::string>("outputRecordName", "BeamSpotObjectsRcd")),
41  sigmaZValue_ (iConfig.getParameter<ParameterSet>("AlcaBeamSpotHarvesterParameters").getUntrackedParameter<double>("SigmaZValue")),
42  theAlcaBeamSpotManager_(iConfig) {
43 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
AlcaBeamSpotManager theAlcaBeamSpotManager_
AlcaBeamSpotHarvester::~AlcaBeamSpotHarvester ( )
virtual

Destructor.

Definition at line 46 of file AlcaBeamSpotHarvester.cc.

46 {}

Member Function Documentation

void AlcaBeamSpotHarvester::analyze ( const edm::Event iEvent,
const edm::EventSetup  
)
virtual

Implements edm::EDAnalyzer.

Definition at line 55 of file AlcaBeamSpotHarvester.cc.

55  {
56 // edm::LogInfo("AlcaBeamSpotHarvester")
57 // << "Lumi: " << iEvent.luminosityBlock()
58 // << " Time: " << iEvent.time().unixTime()
59 // << std::endl;
60 }
void AlcaBeamSpotHarvester::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 49 of file AlcaBeamSpotHarvester.cc.

49 {}
void AlcaBeamSpotHarvester::beginLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup  
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 161 of file AlcaBeamSpotHarvester.cc.

161 {}
void AlcaBeamSpotHarvester::beginRun ( const edm::Run ,
const edm::EventSetup  
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 63 of file AlcaBeamSpotHarvester.cc.

References AlcaBeamSpotManager::reset(), and theAlcaBeamSpotManager_.

63  {
65 }
AlcaBeamSpotManager theAlcaBeamSpotManager_
void AlcaBeamSpotHarvester::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file AlcaBeamSpotHarvester.cc.

52 {}
void AlcaBeamSpotHarvester::endLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup  
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 164 of file AlcaBeamSpotHarvester.cc.

References AlcaBeamSpotManager::readLumi(), and theAlcaBeamSpotManager_.

164  {
166 }
void readLumi(const edm::LuminosityBlock &)
AlcaBeamSpotManager theAlcaBeamSpotManager_
void AlcaBeamSpotHarvester::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 68 of file AlcaBeamSpotHarvester.cc.

References beamSpotOutputBase_, AlcaBeamSpotManager::createWeightedPayloads(), AlcaBeamSpotManager::getPayloads(), i, edm::RunBase::id(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), j, outputrecordName_, edm::RunID::run(), BeamSpotObjects::SetBeamWidthX(), BeamSpotObjects::SetBeamWidthY(), BeamSpotObjects::SetBetaStar(), BeamSpotObjects::SetCovariance(), BeamSpotObjects::Setdxdz(), BeamSpotObjects::Setdydz(), BeamSpotObjects::SetEmittanceX(), BeamSpotObjects::SetEmittanceY(), BeamSpotObjects::SetPosition(), BeamSpotObjects::SetSigmaZ(), BeamSpotObjects::SetType(), sigmaZValue_, theAlcaBeamSpotManager_, and cond::service::PoolDBOutputService::writeOne().

68  {
70  std::map<edm::LuminosityBlockNumber_t,reco::BeamSpot> beamSpotMap = theAlcaBeamSpotManager_.getPayloads();
72 // cond::ExportIOVUtilities utilities;
73  if(poolDbService.isAvailable() ) {
74  for(AlcaBeamSpotManager::bsMap_iterator it=beamSpotMap.begin(); it!=beamSpotMap.end();it++){
75  BeamSpotObjects *aBeamSpot = new BeamSpotObjects();
76  aBeamSpot->SetType(it->second.type());
77  aBeamSpot->SetPosition(it->second.x0(),it->second.y0(),it->second.z0());
78  if(sigmaZValue_ == -1){
79  aBeamSpot->SetSigmaZ(it->second.sigmaZ());
80  }
81  else{
82  aBeamSpot->SetSigmaZ(sigmaZValue_);
83  }
84  aBeamSpot->Setdxdz(it->second.dxdz());
85  aBeamSpot->Setdydz(it->second.dydz());
86  aBeamSpot->SetBeamWidthX(it->second.BeamWidthX());
87  aBeamSpot->SetBeamWidthY(it->second.BeamWidthY());
88  aBeamSpot->SetEmittanceX(it->second.emittanceX());
89  aBeamSpot->SetEmittanceY(it->second.emittanceY());
90  aBeamSpot->SetBetaStar(it->second.betaStar() );
91 
92  for (int i=0; i<7; ++i) {
93  for (int j=0; j<7; ++j) {
94  aBeamSpot->SetCovariance(i,j,it->second.covariance(i,j));
95  }
96  }
97 
98  if(sigmaZValue_ > 0){
99  aBeamSpot->SetCovariance(3,3,0.000025);
100  }
101 
102  cond::Time_t thisIOV = 1;
103 
104 
105 
106  // run based
107  if (beamSpotOutputBase_ == "runbased" ) {
108  thisIOV = (cond::Time_t) iRun.id().run();
109  }
110  // lumi based
111  else if (beamSpotOutputBase_ == "lumibased" ) {
112  edm::LuminosityBlockID lu(iRun.id().run(),it->first);
113  thisIOV = (cond::Time_t)(lu.value());
114  }
115  if (poolDbService->isNewTagRequest(outputrecordName_) ) {
116  edm::LogInfo("AlcaBeamSpotHarvester")
117  << "new tag requested" << std::endl;
118  //poolDbService->createNewIOV<BeamSpotObjects>(aBeamSpot, poolDbService->beginOfTime(),poolDbService->endOfTime(),"BeamSpotObjectsRcd");
119 
120  //poolDbService->createNewIOV<BeamSpotObjects>(aBeamSpot, poolDbService->currentTime(), poolDbService->endOfTime(),"BeamSpotObjectsRcd");
121  poolDbService->writeOne<BeamSpotObjects>(aBeamSpot, thisIOV, outputrecordName_);
122  }
123  else {
124  edm::LogInfo("AlcaBeamSpotHarvester")
125  << "no new tag requested, appending IOV" << std::endl;
126  //poolDbService->appendSinceTime<BeamSpotObjects>(aBeamSpot, poolDbService->currentTime(),"BeamSpotObjectsRcd");
127  poolDbService->writeOne<BeamSpotObjects>(aBeamSpot, thisIOV, outputrecordName_);
128  }
129 
130 
131 
132 
133 /*
134  int argc = 15;
135  const char* argv[] = {"endRun"
136  ,"-d","sqlite_file:combined.db"
137  ,"-s","sqlite_file:testbs2.db"
138  ,"-l","sqlite_file:log.db"
139  ,"-i","TestLSBasedBS"
140  ,"-t","TestLSBasedBS"
141  ,"-b","1"
142  ,"-e","10"
143  };
144 
145  edm::LogInfo("AlcaBeamSpotHarvester")
146  << "Running utilities!"
147  << utilities.run(argc,(char**)argv);
148  edm::LogInfo("AlcaBeamSpotHarvester")
149  << "Run utilities!"
150  << std::endl;
151 */
152  }
153 
154 
155 
156 
157  }
158 }
int i
Definition: DBlmapReader.cc:9
RunID const & id() const
Definition: RunBase.h:41
RunNumber_t run() const
Definition: RunID.h:44
void SetSigmaZ(double val)
set sigma Z, RMS bunch length
std::map< edm::LuminosityBlockNumber_t, reco::BeamSpot >::iterator bsMap_iterator
void SetCovariance(int i, int j, double val)
set i,j element of the full covariance matrix 7x7
void Setdydz(double val)
set dydz slope, crossing angle in XZ
const std::map< edm::LuminosityBlockNumber_t, reco::BeamSpot > & getPayloads(void)
unsigned long long Time_t
Definition: Time.h:16
bool isNewTagRequest(const std::string &recordName)
void SetEmittanceX(double val)
set emittance
bool isAvailable() const
Definition: Service.h:47
int j
Definition: DBlmapReader.cc:9
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
void Setdxdz(double val)
set dxdz slope, crossing angle
void SetBetaStar(double val)
set beta star
void SetType(int type)
set beam type
void SetEmittanceY(double val)
set emittance
void SetBeamWidthX(double val)
set average transverse beam width X
void SetBeamWidthY(double val)
set average transverse beam width Y
AlcaBeamSpotManager theAlcaBeamSpotManager_
void SetPosition(double x, double y, double z)
set XYZ position

Member Data Documentation

std::string AlcaBeamSpotHarvester::beamSpotOutputBase_
private

Definition at line 38 of file AlcaBeamSpotHarvester.h.

Referenced by endRun().

std::string AlcaBeamSpotHarvester::outputrecordName_
private

Definition at line 39 of file AlcaBeamSpotHarvester.h.

Referenced by endRun().

double AlcaBeamSpotHarvester::sigmaZValue_
private

Definition at line 40 of file AlcaBeamSpotHarvester.h.

Referenced by endRun().

AlcaBeamSpotManager AlcaBeamSpotHarvester::theAlcaBeamSpotManager_
private

Definition at line 43 of file AlcaBeamSpotHarvester.h.

Referenced by beginRun(), endLuminosityBlock(), and endRun().