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

#include <SiStripApvGainBuilder.h>

Inheritance diagram for SiStripApvGainBuilder:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
 SiStripApvGainBuilder (const edm::ParameterSet &iConfig)
 
 ~SiStripApvGainBuilder ()
 
- 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::FileInPath fp_
 
bool printdebug_
 

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

Definition at line 17 of file SiStripApvGainBuilder.h.

Constructor & Destructor Documentation

SiStripApvGainBuilder::SiStripApvGainBuilder ( const edm::ParameterSet iConfig)
explicit

Definition at line 6 of file SiStripApvGainBuilder.cc.

6  :
7  fp_(iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))),
8  printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug",1)){}
T getUntrackedParameter(std::string const &, T const &) const
SiStripApvGainBuilder::~SiStripApvGainBuilder ( )
inline

Definition at line 23 of file SiStripApvGainBuilder.h.

23 {};

Member Function Documentation

void SiStripApvGainBuilder::analyze ( const edm::Event evt,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 10 of file SiStripApvGainBuilder.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), prof2calltree::count, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), cond::service::PoolDBOutputService::endOfTime(), fp_, edm::FileInPath::fullPath(), edm::EventBase::id(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), j, getGTfromDQMFile::obj, printdebug_, SiStripApvGain::put(), matplotRender::reader, edm::EventID::run(), and DTTTrigCorrFirst::run.

10  {
11 
12  unsigned int run=evt.id().run();
13 
14  edm::LogInfo("SiStripApvGainBuilder") << "... creating dummy SiStripApvGain Data for Run " << run << "\n " << std::endl;
15 
17 
19 
20  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos = reader.getAllData();
21 
22  int count=-1;
23  for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){
24  count++;
25  //Generate Gain for det detid
26  std::vector<float> theSiStripVector;
27  for(unsigned short j=0; j<it->second.nApvs; j++){
28  float gain= (j+1)*1000+ (CLHEP::RandFlat::shoot(1.)*100);
29  if (count<printdebug_)
30  edm::LogInfo("SiStripApvGainBuilder") << "detid " << it->first << " \t"
31  << " apv " << j << " \t"
32  << gain << " \t"
33  << std::endl;
34  theSiStripVector.push_back(gain);
35  }
36 
37 
38  SiStripApvGain::Range range(theSiStripVector.begin(),theSiStripVector.end());
39  if ( ! obj->put(it->first,range) )
40  edm::LogError("SiStripApvGainBuilder")<<"[SiStripApvGainBuilder::analyze] detid already exists"<<std::endl;
41  }
42 
43 
44  //End now write sistripnoises data in DB
46 
47  if( mydbservice.isAvailable() ){
48  if( mydbservice->isNewTagRequest("SiStripApvGainRcd") ){
49  mydbservice->createNewIOV<SiStripApvGain>(obj,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripApvGainRcd");
50  } else {
51  mydbservice->appendSinceTime<SiStripApvGain>(obj,mydbservice->currentTime(),"SiStripApvGainRcd");
52  }
53  }else{
54  edm::LogError("SiStripApvGainBuilder")<<"Service is unavailable"<<std::endl;
55  }
56 }
RunNumber_t run() const
Definition: EventID.h:42
bool put(const uint32_t &detID, Range input)
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:46
std::pair< ContainerIterator, ContainerIterator > Range
int j
Definition: DBlmapReader.cc:9
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
edm::EventID id() const
Definition: EventBase.h:56
std::string fullPath() const
Definition: FileInPath.cc:171

Member Data Documentation

edm::FileInPath SiStripApvGainBuilder::fp_
private

Definition at line 28 of file SiStripApvGainBuilder.h.

Referenced by analyze().

bool SiStripApvGainBuilder::printdebug_
private

Definition at line 29 of file SiStripApvGainBuilder.h.

Referenced by analyze().