CMS 3D CMS Logo

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
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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")),
41  sigmaZCut_ (iConfig.getParameter<ParameterSet>("AlcaBeamSpotHarvesterParameters").getUntrackedParameter<double>("SigmaZCut")),
43 }
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 46 of file AlcaBeamSpotHarvester.cc.

46 {}

Member Function Documentation

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

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

Definition at line 161 of file AlcaBeamSpotHarvester.cc.

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

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.

Referenced by o2olib.O2ORunMgr::executeJob().

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

Definition at line 164 of file AlcaBeamSpotHarvester.cc.

References DEFINE_FWK_MODULE, AlcaBeamSpotManager::readLumi(), and theAlcaBeamSpotManager_.

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

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:39
RunNumber_t run() const
Definition: RunID.h:39
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::sigmaZCut_
private

Definition at line 39 of file AlcaBeamSpotHarvester.h.

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