CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripBadStripFromASCIIFile Class Reference

#include <SiStripBadStripFromASCIIFile.h>

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

Public Member Functions

 SiStripBadStripFromASCIIFile (const edm::ParameterSet &iConfig)
 
 ~SiStripBadStripFromASCIIFile () override
 
- Public Member Functions inherited from ConditionDBWriter< SiStripBadStrip >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
 ~ConditionDBWriter () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

std::unique_ptr< SiStripBadStripgetNewObject () override
 

Private Attributes

edm::FileInPath fp_
 
bool 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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 11 of file SiStripBadStripFromASCIIFile.h.

Constructor & Destructor Documentation

◆ SiStripBadStripFromASCIIFile()

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

Definition at line 26 of file SiStripBadStripFromASCIIFile.cc.

28  printdebug_(iConfig.getUntrackedParameter<bool>("printDebug", false)) {
30  "file", edm::FileInPath("CalibTracker/SiStripQuality/data/DefectsFromConstructionDB.dat"));
31 }

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

◆ ~SiStripBadStripFromASCIIFile()

SiStripBadStripFromASCIIFile::~SiStripBadStripFromASCIIFile ( )
inlineoverride

Definition at line 15 of file SiStripBadStripFromASCIIFile.h.

15 {};

Member Function Documentation

◆ getNewObject()

std::unique_ptr< SiStripBadStrip > SiStripBadStripFromASCIIFile::getNewObject ( )
overrideprivatevirtual

Implements ConditionDBWriter< SiStripBadStrip >.

Definition at line 33 of file SiStripBadStripFromASCIIFile.cc.

33  {
34  auto SiStripBadStrip_ = std::make_unique<SiStripBadStrip>();
35 
36  // open file and fill DB
37  ifstream infile((fp_.fullPath()).c_str());
38  if (!infile) {
39  std::cout << "Problem while trying to open File: " << (fp_.fullPath()).c_str() << std::endl;
40  }
41 
42  //variables needed for reading file and filling of SiStripBadStripObject
43  uint32_t detid;
44  short flag;
45  short channel;
46 
47  bool firstrun = true;
48  short tempchannel = 0;
49  int count = 0;
50  std::vector<unsigned int> theSiStripVector;
51  short tempflag = 0;
52  uint32_t tempdetid = 0;
53 
54  while (!infile.eof()) {
55  // get data from file:
56  //infile >> detid >> channel >> flag;
57 
58  //if no flag is available, use the following:
59  infile >> detid >> channel;
60  flag = 1;
61 
62  unsigned int theBadStripRange = 0;
63 
64  // first loop ?
65  if (firstrun) {
66  tempdetid = detid;
67  tempchannel = channel;
68  tempflag = flag;
69  count = 0;
70  firstrun = false;
71  }
72 
73  if (detid == tempdetid) {
74  if (channel != tempchannel + count || flag != tempflag) {
75  // 1.badstrip, nconsectrips, flag
76  theBadStripRange = SiStripBadStrip_->encode(
77  tempchannel - 1,
78  count,
79  tempflag); // In the quality object, strips are counted from 0 to 767!!! Therefore "tempchannel-1"!
80  // In the input txt-file, they have to be from 1 to 768 instead!!!
81  edm::LogInfo("SiStripBadStripFromASCIIFile")
82  << "detid " << tempdetid << " \t"
83  << " firstBadStrip " << tempchannel << "\t "
84  << " NconsecutiveBadStrips " << count << "\t "
85  << "flag " << tempflag << "\t"
86  << " packed integer " << std::hex << theBadStripRange << std::dec << std::endl;
87 
88  theSiStripVector.push_back(theBadStripRange);
89 
90  if (infile.eof()) { // Don't forget to save the last strip before eof!!!
91  SiStripBadStrip::Range range(theSiStripVector.begin(), theSiStripVector.end());
92  if (!SiStripBadStrip_->put(tempdetid, range))
93  edm::LogError("SiStripBadStripFromASCIIFile")
94  << "[SiStripBadStripFromASCIIFile::GetNewObject] detid already exists" << std::endl;
95  theSiStripVector.clear();
96  }
97 
98  count = 1;
99  tempchannel = channel;
100  tempflag = flag;
101 
102  } else {
103  count++;
104  }
105  }
106 
107  if (detid != tempdetid) {
108  // 1.badstrip, nconsectrips, flag
109  theBadStripRange = SiStripBadStrip_->encode(
110  tempchannel - 1,
111  count,
112  tempflag); // In the quality object, strips are counted from 0 to 767!!! Therefore "tempchannel-1"!
113  // In the input txt-file, they have to be from 1 to 768 instead!!!
114  edm::LogInfo("SiStripBadStripFromASCIIFile")
115  << "detid " << tempdetid << " \t"
116  << " firstBadStrip " << tempchannel << "\t "
117  << " NconsecutiveBadStrips " << count << "\t "
118  << "flag " << tempflag << "\t"
119  << " packed integer " << std::hex << theBadStripRange << std::dec << std::endl;
120 
121  theSiStripVector.push_back(theBadStripRange);
122 
123  // populate db object
124  SiStripBadStrip::Range range(theSiStripVector.begin(), theSiStripVector.end());
125  if (!SiStripBadStrip_->put(tempdetid, range))
126  edm::LogError("SiStripBadStripFromASCIIFile")
127  << "[SiStripBadStripFromASCIIFile::GetNewObject] detid already exists" << std::endl;
128  theSiStripVector.clear();
129 
130  count = 1;
131  tempdetid = detid;
132  tempchannel = channel;
133  tempflag = flag;
134  }
135  }
136 
137  return SiStripBadStrip_;
138 }

References submitPVResolutionJobs::count, gather_cfg::cout, TauDecayModes::dec, writedatasetfile::firstrun, RemoveAddSevLevel::flag, fp_, edm::FileInPath::fullPath(), timingPdfMaker::infile, and FastTimerService_cff::range.

Member Data Documentation

◆ fp_

edm::FileInPath SiStripBadStripFromASCIIFile::fp_
private

Definition at line 19 of file SiStripBadStripFromASCIIFile.h.

Referenced by getNewObject(), and SiStripBadStripFromASCIIFile().

◆ printdebug_

bool SiStripBadStripFromASCIIFile::printdebug_
private

Definition at line 20 of file SiStripBadStripFromASCIIFile.h.

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiStripBadStripFromASCIIFile::printdebug_
bool printdebug_
Definition: SiStripBadStripFromASCIIFile.h:20
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::FileInPath
Definition: FileInPath.h:64
SiStripBadStrip::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripBadStrip.h:53
ConditionDBWriter< SiStripBadStrip >
SiStripBadStripFromASCIIFile::fp_
edm::FileInPath fp_
Definition: SiStripBadStripFromASCIIFile.h:19
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
writedatasetfile.firstrun
firstrun
Definition: writedatasetfile.py:27
timingPdfMaker.infile
infile
Definition: timingPdfMaker.py:350
edm::Log
Definition: MessageLogger.h:70
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116