CMS 3D CMS Logo

SiStripBadFiberBuilder.cc
Go to the documentation of this file.
2 
4 
5 #include <iostream>
6 #include <fstream>
7 #include <sstream>
8 
10 
11  fp_ = iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"));
12  printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug",false);
13  BadComponentList_ = iConfig.getUntrackedParameter<Parameters>("BadComponentList");
14 }
15 
16 
18 }
19 
21 
22  unsigned int run=event.id().run();
23 
24  edm::LogInfo("SiStripBadFiberBuilder") << "... creating dummy SiStripBadStrip Data for Run " << run << "\n " << std::endl;
25 
26  obj = new SiStripBadStrip();
27 
29 
30  std::stringstream ss;
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> BadApvList_ = iBadComponent->getParameter<std::vector<uint32_t> >("BadApvList");
35 
36  std::vector<unsigned int> theSiStripVector;
37 
38  unsigned short firstBadStrip=0, NconsecutiveBadStrips=0;
39  unsigned int theBadStripRange;
40 
41  for(std::vector<uint32_t>::const_iterator is=BadApvList_.begin(); is!=BadApvList_.end(); ++is){
42 
43  firstBadStrip=(*is)*128;
44  NconsecutiveBadStrips=128;
45 
46  theBadStripRange = obj->encode(firstBadStrip,NconsecutiveBadStrips);
47 
48  if (printdebug_)
49  ss << "detid " << BadModule_ << " \t"
50  << " firstBadStrip " << firstBadStrip << "\t "
51  << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t "
52  << " packed integer " << std::hex << theBadStripRange << std::dec
53  << std::endl;
54 
55  theSiStripVector.push_back(theBadStripRange);
56  }
57 
58  SiStripBadStrip::Range range(theSiStripVector.begin(),theSiStripVector.end());
59  if ( ! obj->put(BadModule_,range) )
60  edm::LogError("SiStripBadFiberBuilder")<<"[SiStripBadFiberBuilder::analyze] detid already exists"<<std::endl;
61  }
62  if (printdebug_)
63  edm::LogInfo("SiStripBadFiberBuilder") << ss.str();
64 }
65 
66 
T getUntrackedParameter(std::string const &, T const &) const
SiStripBadFiberBuilder(const edm::ParameterSet &)
void algoAnalyze(const edm::Event &event, const edm::EventSetup &iSetup) override
std::vector< edm::ParameterSet > Parameters
std::pair< ContainerIterator, ContainerIterator > Range
std::string fullPath() const
Definition: FileInPath.cc:184
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)
Definition: event.py:1