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

#include <SiStripNoisesBuilder.h>

Inheritance diagram for SiStripNoisesBuilder:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
 SiStripNoisesBuilder (const edm::ParameterSet &iConfig)
 
 ~SiStripNoisesBuilder ()
 
- 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 ()
 
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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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_
 
uint32_t printdebug_
 

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

Definition at line 16 of file SiStripNoisesBuilder.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file SiStripNoisesBuilder.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
SiStripNoisesBuilder::~SiStripNoisesBuilder ( )
inline

Definition at line 22 of file SiStripNoisesBuilder.h.

22 {};

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 11 of file SiStripNoisesBuilder.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), KineDebug3::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(), HLT_FULL_cff::noise, getGTfromDQMFile::obj, printdebug_, SiStripNoises::put(), matplotRender::reader, edm::EventID::run(), DTTTrigCorrFirst::run, and SiStripNoises::setData().

11  {
12 
13  unsigned int run=evt.id().run();
14 
15  edm::LogInfo("SiStripNoisesBuilder") << "... creating dummy SiStripNoises Data for Run " << run << "\n " << std::endl;
16 
18 
20 
21  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos = reader.getAllData();
22 
23  int count=-1;
24  for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){
25  count++;
26  //Generate Noise for det detid
27  SiStripNoises::InputVector theSiStripVector;
28  for(int strip=0; strip<128*it->second.nApvs; ++strip){
29 
30  float MeanNoise = 5;
31  float RmsNoise = 1;
32  float noise = CLHEP::RandGauss::shoot(MeanNoise,RmsNoise);
33 
34  //double badStripProb = .5;
35  //bool disable = (CLHEP::RandFlat::shoot(1.) < badStripProb ? true:false);
36 
37  obj->setData(noise,theSiStripVector);
38  if (count<static_cast<int>(printdebug_))
39  edm::LogInfo("SiStripNoisesBuilder") << "detid " << it->first << " \t"
40  << " strip " << strip << " \t"
41  << noise << " \t"
42  << theSiStripVector.back()/10 << " \t"
43  << std::endl;
44  }
45 
46  if ( ! obj->put(it->first,theSiStripVector) )
47  edm::LogError("SiStripNoisesBuilder")<<"[SiStripNoisesBuilder::analyze] detid already exists"<<std::endl;
48  }
49 
50 
51  //End now write sistripnoises data in DB
53 
54  if( mydbservice.isAvailable() ){
55  if ( mydbservice->isNewTagRequest("SiStripNoisesRcd") ){
56  mydbservice->createNewIOV<SiStripNoises>(obj,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripNoisesRcd");
57  } else {
58  //mydbservice->createNewIOV<SiStripNoises>(obj,mydbservice->currentTime(),"SiStripNoisesRcd");
59  mydbservice->appendSinceTime<SiStripNoises>(obj,mydbservice->currentTime(),"SiStripNoisesRcd");
60  }
61  }else{
62  edm::LogError("SiStripNoisesBuilder")<<"Service is unavailable"<<std::endl;
63  }
64 }
RunNumber_t run() const
Definition: EventID.h:39
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:51
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
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
bool put(const uint32_t &detID, const InputVector &input)
edm::EventID id() const
Definition: EventBase.h:59
std::string fullPath() const
Definition: FileInPath.cc:184
void setData(float noise_, InputVector &vped)

Member Data Documentation

edm::FileInPath SiStripNoisesBuilder::fp_
private

Definition at line 27 of file SiStripNoisesBuilder.h.

Referenced by analyze().

uint32_t SiStripNoisesBuilder::printdebug_
private

Definition at line 28 of file SiStripNoisesBuilder.h.

Referenced by analyze().