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 edm::EDConsumerBase

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

No description available.

Author
L. Uplegger F. Yumiceva - Fermilab

Definition at line 15 of file AlcaBeamSpotHarvester.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 37 of file AlcaBeamSpotHarvester.cc.

37  :
38  beamSpotOutputBase_ (iConfig.getParameter<ParameterSet>("AlcaBeamSpotHarvesterParameters").getUntrackedParameter<std::string>("BeamSpotOutputBase")),
39  outputrecordName_ (iConfig.getParameter<ParameterSet>("AlcaBeamSpotHarvesterParameters").getUntrackedParameter<std::string>("outputRecordName", "BeamSpotObjectsRcd")),
40  sigmaZValue_ (iConfig.getParameter<ParameterSet>("AlcaBeamSpotHarvesterParameters").getUntrackedParameter<double>("SigmaZValue")),
42 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
AlcaBeamSpotManager theAlcaBeamSpotManager_
AlcaBeamSpotHarvester::~AlcaBeamSpotHarvester ( )
virtual

Destructor.

Definition at line 45 of file AlcaBeamSpotHarvester.cc.

45 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 54 of file AlcaBeamSpotHarvester.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file AlcaBeamSpotHarvester.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 160 of file AlcaBeamSpotHarvester.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file AlcaBeamSpotHarvester.cc.

References AlcaBeamSpotManager::reset(), and theAlcaBeamSpotManager_.

62  {
64 }
AlcaBeamSpotManager theAlcaBeamSpotManager_
void AlcaBeamSpotHarvester::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 51 of file AlcaBeamSpotHarvester.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 163 of file AlcaBeamSpotHarvester.cc.

References AlcaBeamSpotManager::readLumi(), and theAlcaBeamSpotManager_.

163  {
165 }
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 67 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().

67  {
69  std::map<edm::LuminosityBlockNumber_t,reco::BeamSpot> beamSpotMap = theAlcaBeamSpotManager_.getPayloads();
71 // cond::ExportIOVUtilities utilities;
72  if(poolDbService.isAvailable() ) {
73  for(AlcaBeamSpotManager::bsMap_iterator it=beamSpotMap.begin(); it!=beamSpotMap.end();it++){
74  BeamSpotObjects *aBeamSpot = new BeamSpotObjects();
75  aBeamSpot->SetType(it->second.type());
76  aBeamSpot->SetPosition(it->second.x0(),it->second.y0(),it->second.z0());
77  if(sigmaZValue_ == -1){
78  aBeamSpot->SetSigmaZ(it->second.sigmaZ());
79  }
80  else{
81  aBeamSpot->SetSigmaZ(sigmaZValue_);
82  }
83  aBeamSpot->Setdxdz(it->second.dxdz());
84  aBeamSpot->Setdydz(it->second.dydz());
85  aBeamSpot->SetBeamWidthX(it->second.BeamWidthX());
86  aBeamSpot->SetBeamWidthY(it->second.BeamWidthY());
87  aBeamSpot->SetEmittanceX(it->second.emittanceX());
88  aBeamSpot->SetEmittanceY(it->second.emittanceY());
89  aBeamSpot->SetBetaStar(it->second.betaStar() );
90 
91  for (int i=0; i<7; ++i) {
92  for (int j=0; j<7; ++j) {
93  aBeamSpot->SetCovariance(i,j,it->second.covariance(i,j));
94  }
95  }
96 
97  if(sigmaZValue_ > 0){
98  aBeamSpot->SetCovariance(3,3,0.000025);
99  }
100 
101  cond::Time_t thisIOV = 1;
102 
103 
104 
105  // run based
106  if (beamSpotOutputBase_ == "runbased" ) {
107  thisIOV = (cond::Time_t) iRun.id().run();
108  }
109  // lumi based
110  else if (beamSpotOutputBase_ == "lumibased" ) {
111  edm::LuminosityBlockID lu(iRun.id().run(),it->first);
112  thisIOV = (cond::Time_t)(lu.value());
113  }
114  if (poolDbService->isNewTagRequest(outputrecordName_) ) {
115  edm::LogInfo("AlcaBeamSpotHarvester")
116  << "new tag requested" << std::endl;
117  //poolDbService->createNewIOV<BeamSpotObjects>(aBeamSpot, poolDbService->beginOfTime(),poolDbService->endOfTime(),"BeamSpotObjectsRcd");
118 
119  //poolDbService->createNewIOV<BeamSpotObjects>(aBeamSpot, poolDbService->currentTime(), poolDbService->endOfTime(),"BeamSpotObjectsRcd");
120  poolDbService->writeOne<BeamSpotObjects>(aBeamSpot, thisIOV, outputrecordName_);
121  }
122  else {
123  edm::LogInfo("AlcaBeamSpotHarvester")
124  << "no new tag requested, appending IOV" << std::endl;
125  //poolDbService->appendSinceTime<BeamSpotObjects>(aBeamSpot, poolDbService->currentTime(),"BeamSpotObjectsRcd");
126  poolDbService->writeOne<BeamSpotObjects>(aBeamSpot, thisIOV, outputrecordName_);
127  }
128 
129 
130 
131 
132 /*
133  int argc = 15;
134  const char* argv[] = {"endRun"
135  ,"-d","sqlite_file:combined.db"
136  ,"-s","sqlite_file:testbs2.db"
137  ,"-l","sqlite_file:log.db"
138  ,"-i","TestLSBasedBS"
139  ,"-t","TestLSBasedBS"
140  ,"-b","1"
141  ,"-e","10"
142  };
143 
144  edm::LogInfo("AlcaBeamSpotHarvester")
145  << "Running utilities!"
146  << utilities.run(argc,(char**)argv);
147  edm::LogInfo("AlcaBeamSpotHarvester")
148  << "Run utilities!"
149  << std::endl;
150 */
151  }
152 
153 
154 
155 
156  }
157 }
int i
Definition: DBlmapReader.cc:9
RunID const & id() const
Definition: RunBase.h:41
RunNumber_t run() const
Definition: RunID.h:43
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:46
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 36 of file AlcaBeamSpotHarvester.h.

Referenced by endRun().

std::string AlcaBeamSpotHarvester::outputrecordName_
private

Definition at line 37 of file AlcaBeamSpotHarvester.h.

Referenced by endRun().

double AlcaBeamSpotHarvester::sigmaZValue_
private

Definition at line 38 of file AlcaBeamSpotHarvester.h.

Referenced by endRun().

AlcaBeamSpotManager AlcaBeamSpotHarvester::theAlcaBeamSpotManager_
private

Definition at line 41 of file AlcaBeamSpotHarvester.h.

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