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
SiPixelLorentzAngleDB Class Reference

#include <SiPixelLorentzAngleDB.h>

Inheritance diagram for SiPixelLorentzAngleDB:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &e, const edm::EventSetup &c)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 SiPixelLorentzAngleDB (const edm::ParameterSet &conf)
 
virtual ~SiPixelLorentzAngleDB ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

float bPixLorentzAnglePerTesla_
 
edm::ParameterSet conf_
 
std::vector< std::pair
< uint32_t, float > > 
detid_la
 
std::string fileName_
 
float fPixLorentzAnglePerTesla_
 
double magneticField_
 
std::string recordName_
 
bool useFile_
 

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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

Definition at line 23 of file SiPixelLorentzAngleDB.h.

Constructor & Destructor Documentation

SiPixelLorentzAngleDB::SiPixelLorentzAngleDB ( const edm::ParameterSet conf)
explicit

Definition at line 24 of file SiPixelLorentzAngleDB.cc.

References bPixLorentzAnglePerTesla_, conf_, fileName_, fPixLorentzAnglePerTesla_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), magneticField_, recordName_, AlCaHLTBitMon_QueryRunRegistry::string, and useFile_.

24  :
25  conf_(conf){
26  magneticField_ = conf_.getParameter<double>("magneticField");
27  recordName_ = conf_.getUntrackedParameter<std::string>("record","SiPixelLorentzAngleRcd");
28  bPixLorentzAnglePerTesla_ = (float)conf_.getParameter<double>("bPixLorentzAnglePerTesla");
29  fPixLorentzAnglePerTesla_ = (float)conf_.getParameter<double>("fPixLorentzAnglePerTesla");
30  useFile_ = conf_.getParameter<bool>("useFile");
31  fileName_ = conf_.getParameter<string>("fileName");
32 
33 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
SiPixelLorentzAngleDB::~SiPixelLorentzAngleDB ( )
virtual

Definition at line 42 of file SiPixelLorentzAngleDB.cc.

42  {
43 
44 }

Member Function Documentation

void SiPixelLorentzAngleDB::analyze ( const edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 48 of file SiPixelLorentzAngleDB.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), bPixLorentzAnglePerTesla_, gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), cond::rpcobgas::detid, cond::service::PoolDBOutputService::endOfTime(), cppFunctionSkipper::exception, fPixLorentzAnglePerTesla_, edm::EventSetup::get(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, SiPixelLorentzAngle::putLorentzAngle(), DetId::rawId(), recordName_, DetId::subdetId(), useFile_, and cms::Exception::what().

49 {
50 
51  SiPixelLorentzAngle* LorentzAngle = new SiPixelLorentzAngle();
52 
53 
55  es.get<TrackerDigiGeometryRecord>().get( pDD );
56  edm::LogInfo("SiPixelLorentzAngle") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl;
57 
58  for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){
59 
60  if( dynamic_cast<PixelGeomDetUnit*>((*it))!=0){
61  DetId detid=(*it)->geographicalId();
62 
63  // fill bpix values for LA
64  if(detid.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) {
65 
66  if(!useFile_){
67  if ( ! LorentzAngle->putLorentzAngle(detid.rawId(),bPixLorentzAnglePerTesla_) )
68  edm::LogError("SiPixelLorentzAngleDB")<<"[SiPixelLorentzAngleDB::analyze] detid already exists"<<std::endl;
69  } else {
70  cout << "method for reading file not implemented yet" << endl;
71  }
72 
73 
74  // fill bpix values for LA
75  } else if(detid.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap)) {
76 
77  if ( ! LorentzAngle->putLorentzAngle(detid.rawId(),fPixLorentzAnglePerTesla_) )
78  edm::LogError("SiPixelLorentzAngleDB")<<"[SiPixelLorentzAngleDB::analyze] detid already exists"<<std::endl;
79  } else {
80  edm::LogError("SiPixelLorentzAngleDB")<<"[SiPixelLorentzAngleDB::analyze] detid is Pixel but neither bpix nor fpix"<<std::endl;
81  }
82 
83  }
84 
85  }
86 
87 
89  if( mydbservice.isAvailable() ){
90  try{
91  if( mydbservice->isNewTagRequest(recordName_) ){
92  mydbservice->createNewIOV<SiPixelLorentzAngle>(LorentzAngle,
93  mydbservice->beginOfTime(),
94  mydbservice->endOfTime(),
95  recordName_);
96  } else {
97  mydbservice->appendSinceTime<SiPixelLorentzAngle>(LorentzAngle,
98  mydbservice->currentTime(),
99  recordName_);
100  }
101  }catch(const cond::Exception& er){
102  edm::LogError("SiPixelLorentzAngleDB")<<er.what()<<std::endl;
103  }catch(const std::exception& er){
104  edm::LogError("SiPixelLorentzAngleDB")<<"caught std::exception "<<er.what()<<std::endl;
105  }catch(...){
106  edm::LogError("SiPixelLorentzAngleDB")<<"Funny error"<<std::endl;
107  }
108  }else{
109  edm::LogError("SiPixelLorentzAngleDB")<<"Service is unavailable"<<std::endl;
110  }
111 
112 
113 }
virtual char const * what() const
Definition: Exception.cc:141
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:47
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
bool putLorentzAngle(const uint32_t &, float &)
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
Definition: DetId.h:20
tuple cout
Definition: gather_cfg.py:121
void SiPixelLorentzAngleDB::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 37 of file SiPixelLorentzAngleDB.cc.

37  {
38 
39 }
void SiPixelLorentzAngleDB::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 115 of file SiPixelLorentzAngleDB.cc.

115  {
116 
117 
118 }

Member Data Documentation

float SiPixelLorentzAngleDB::bPixLorentzAnglePerTesla_
private

Definition at line 46 of file SiPixelLorentzAngleDB.h.

Referenced by analyze(), and SiPixelLorentzAngleDB().

edm::ParameterSet SiPixelLorentzAngleDB::conf_
private

Definition at line 43 of file SiPixelLorentzAngleDB.h.

Referenced by SiPixelLorentzAngleDB().

std::vector< std::pair<uint32_t, float> > SiPixelLorentzAngleDB::detid_la
private

Definition at line 42 of file SiPixelLorentzAngleDB.h.

std::string SiPixelLorentzAngleDB::fileName_
private

Definition at line 48 of file SiPixelLorentzAngleDB.h.

Referenced by SiPixelLorentzAngleDB().

float SiPixelLorentzAngleDB::fPixLorentzAnglePerTesla_
private

Definition at line 47 of file SiPixelLorentzAngleDB.h.

Referenced by analyze(), and SiPixelLorentzAngleDB().

double SiPixelLorentzAngleDB::magneticField_
private

Definition at line 44 of file SiPixelLorentzAngleDB.h.

Referenced by SiPixelLorentzAngleDB().

std::string SiPixelLorentzAngleDB::recordName_
private

Definition at line 45 of file SiPixelLorentzAngleDB.h.

Referenced by analyze(), and SiPixelLorentzAngleDB().

bool SiPixelLorentzAngleDB::useFile_
private

Definition at line 49 of file SiPixelLorentzAngleDB.h.

Referenced by analyze(), and SiPixelLorentzAngleDB().