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 Types | Private Member Functions | Private Attributes
SiStripBadChannelBuilder Class Reference

#include <SiStripBadChannelBuilder.h>

Inheritance diagram for SiStripBadChannelBuilder:
ConditionDBWriter< SiStripBadStrip > edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void algoAnalyze (const edm::Event &event, const edm::EventSetup &iSetup)
 
 SiStripBadChannelBuilder (const edm::ParameterSet &)
 
 ~SiStripBadChannelBuilder ()
 
- Public Member Functions inherited from ConditionDBWriter< SiStripBadStrip >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
virtual ~ConditionDBWriter ()
 
- 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 (const std::string &iProcessName, std::vector< const char * > &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 Types

typedef std::vector
< edm::ParameterSet
Parameters
 

Private Member Functions

SiStripBadStripgetNewObject ()
 

Private Attributes

Parameters BadComponentList_
 
edm::FileInPath fp_
 
SiStripBadStripobj
 
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 ConditionDBWriter< SiStripBadStrip >
void setDoStore (const bool doStore)
 When set to false the payload will not be written to the db. More...
 
void storeOnDbNow ()
 
cond::Time_t timeOfLastIOV ()
 
- 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 19 of file SiStripBadChannelBuilder.h.

Member Typedef Documentation

Definition at line 37 of file SiStripBadChannelBuilder.h.

Constructor & Destructor Documentation

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

Definition at line 8 of file SiStripBadChannelBuilder.cc.

References BadComponentList_, fp_, edm::ParameterSet::getUntrackedParameter(), and printdebug_.

9 
10  fp_ = iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"));
11  printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug",false);
12  BadComponentList_ = iConfig.getUntrackedParameter<Parameters>("BadComponentList");
13 }
T getUntrackedParameter(std::string const &, T const &) const
vector< ParameterSet > Parameters
SiStripBadChannelBuilder::~SiStripBadChannelBuilder ( )

Definition at line 16 of file SiStripBadChannelBuilder.cc.

16  {
17 }

Member Function Documentation

void SiStripBadChannelBuilder::algoAnalyze ( const edm::Event event,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 19 of file SiStripBadChannelBuilder.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), BadComponentList_, cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), TauDecayModes::dec, SiStripBadStrip::encode(), cond::service::PoolDBOutputService::endOfTime(), fp_, edm::FileInPath::fullPath(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), obj, printdebug_, SiStripBadStrip::put(), matplotRender::reader, and DTTTrigCorrFirst::run.

19  {
20 
21  unsigned int run=event.id().run();
22 
23  edm::LogInfo("SiStripBadChannelBuilder") << "... creating dummy SiStripBadStrip Data for Run " << run << "\n " << std::endl;
24 
26 
28 
29  const std::vector<uint32_t> DetIds = reader.getAllDetIds();
30 
31  for(Parameters::iterator iBadComponent = BadComponentList_.begin(); iBadComponent != BadComponentList_.end(); ++iBadComponent ) {
32 
33  uint32_t BadModule_ = iBadComponent->getParameter<uint32_t>("BadModule");
34  std::vector<uint32_t> BadChannelList_ = iBadComponent->getParameter<std::vector<uint32_t> >("BadChannelList");
35 
36  std::vector<unsigned int> theSiStripVector;
37  unsigned int NStrips=reader.getNumberOfApvsAndStripLength(BadModule_).first*128;
38 
39  uint32_t lastBad=999;
40  unsigned short firstBadStrip=0, NconsecutiveBadStrips=0;
41  unsigned int theBadStripRange;
42 
43  for(std::vector<uint32_t>::const_iterator is=BadChannelList_.begin(); is!=BadChannelList_.end(); ++is){
44  if (*is>NStrips-1)
45  break;
46  if (*is!=lastBad+1){
47  //new set
48 
49  if ( lastBad!=999 ){
50  //save previous set
51  theBadStripRange = obj->encode(firstBadStrip,NconsecutiveBadStrips);
52 
53  if (printdebug_)
54  edm::LogInfo("SiStripBadChannelBuilder") << "detid " << BadModule_ << " \t"
55  << " firstBadStrip " << firstBadStrip << "\t "
56  << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t "
57  << " packed integer " << std::hex << theBadStripRange << std::dec
58  << std::endl;
59 
60  theSiStripVector.push_back(theBadStripRange);
61  }
62 
63  firstBadStrip=*is;
64  NconsecutiveBadStrips=0;
65  }
66  NconsecutiveBadStrips++;
67  lastBad=*is;
68  }
69 
70  theBadStripRange = obj->encode(firstBadStrip,NconsecutiveBadStrips);
71  if (printdebug_)
72  edm::LogInfo("SiStripBadChannelBuilder") << "detid " << BadModule_ << " \t"
73  << " firstBadStrip " << firstBadStrip << "\t "
74  << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t "
75  << " packed integer " << std::hex << theBadStripRange << std::dec
76  << std::endl;
77 
78  theSiStripVector.push_back(theBadStripRange);
79 
80  SiStripBadStrip::Range range(theSiStripVector.begin(),theSiStripVector.end());
81  if ( ! obj->put(BadModule_,range) )
82  edm::LogError("SiStripBadChannelBuilder")<<"[SiStripBadChannelBuilder::analyze] detid already exists"<<std::endl;
83  }
84  //End now write sistripbadChannel data in DB
86 
87  if( mydbservice.isAvailable() ){
88  if ( mydbservice->isNewTagRequest("SiStripBadStripRcd") ){
89  mydbservice->createNewIOV<SiStripBadStrip>(obj,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripBadStripRcd");
90  } else {
91  //mydbservice->createNewIOV<SiStripBadStrip>(obj,mydbservice->currentTime(),"SiStripBadStripRcd");
92  mydbservice->appendSinceTime<SiStripBadStrip>(obj,mydbservice->currentTime(),"SiStripBadStripRcd");
93  }
94  }else{
95  edm::LogError("SiStripBadStripBuilder")<<"Service is unavailable"<<std::endl;
96  }
97 
98 }
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)
std::pair< ContainerIterator, ContainerIterator > Range
std::string fullPath() const
Definition: FileInPath.cc:165
bool put(const uint32_t &detID, const InputVector &vect)
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
SiStripBadStrip* SiStripBadChannelBuilder::getNewObject ( )
inlineprivatevirtual

Implements ConditionDBWriter< SiStripBadStrip >.

Definition at line 30 of file SiStripBadChannelBuilder.h.

References obj.

30 {return obj;}

Member Data Documentation

Parameters SiStripBadChannelBuilder::BadComponentList_
private

Definition at line 38 of file SiStripBadChannelBuilder.h.

Referenced by algoAnalyze(), and SiStripBadChannelBuilder().

edm::FileInPath SiStripBadChannelBuilder::fp_
private

Definition at line 33 of file SiStripBadChannelBuilder.h.

Referenced by algoAnalyze(), and SiStripBadChannelBuilder().

SiStripBadStrip* SiStripBadChannelBuilder::obj
private

Definition at line 35 of file SiStripBadChannelBuilder.h.

Referenced by algoAnalyze(), and getNewObject().

bool SiStripBadChannelBuilder::printdebug_
private

Definition at line 34 of file SiStripBadChannelBuilder.h.

Referenced by algoAnalyze(), and SiStripBadChannelBuilder().