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

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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

edm::FileInPath fp_
 
uint32_t printdebug_
 

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
CurrentProcessingContext const * currentContext () const
 

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(), 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(), getGTfromDQMFile::obj, printdebug_, SiStripNoises::put(), matplotRender::reader, edm::EventID::run(), DTTTrigCorrFirst::run, SiStripNoises::setData(), and strip().

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:42
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:44
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
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:56
std::string fullPath() const
Definition: FileInPath.cc:171
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().