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

#include <SiStripBadModuleGenerator.h>

Inheritance diagram for SiStripBadModuleGenerator:
SiStripCondObjBuilderBase< SiStripBadStrip >

Public Member Functions

void getObj (SiStripBadStrip *&obj)
 
 SiStripBadModuleGenerator (const edm::ParameterSet &, const edm::ActivityRegistry &)
 
 ~SiStripBadModuleGenerator ()
 
- Public Member Functions inherited from SiStripCondObjBuilderBase< SiStripBadStrip >
virtual bool checkForCompatibility (std::string ss)
 
virtual void getMetaDataString (std::stringstream &ss)
 
virtual void initialize ()
 
 SiStripCondObjBuilderBase (const edm::ParameterSet &pset)
 
virtual ~SiStripCondObjBuilderBase ()
 

Private Types

typedef std::vector
< edm::ParameterSet
Parameters
 

Private Member Functions

void createObject ()
 
bool isTECDetector (const uint32_t &therawid, uint32_t requested_side, uint32_t requested_wheel, uint32_t requested_petal_bkw_frw, uint32_t requested_petal, uint32_t requested_ring, uint32_t requested_ster, uint32_t requested_detid) const
 
bool isTIBDetector (const uint32_t &therawid, uint32_t requested_layer, uint32_t requested_bkw_frw, uint32_t requested_int_ext, uint32_t requested_string, uint32_t requested_ster, uint32_t requested_detid) const
 
bool isTIDDetector (const uint32_t &therawid, uint32_t requested_side, uint32_t requested_wheel, uint32_t requested_ring, uint32_t requested_ster, uint32_t requested_detid) const
 
bool isTOBDetector (const uint32_t &therawid, uint32_t requested_layer, uint32_t requested_bkw_frw, uint32_t requested_rod, uint32_t requested_ster, uint32_t requested_detid) const
 
void selectDetectors (const std::vector< uint32_t > &, std::vector< uint32_t > &)
 

Private Attributes

Parameters BadComponentList_
 
bool printdebug_
 

Additional Inherited Members

- Protected Attributes inherited from SiStripCondObjBuilderBase< SiStripBadStrip >
edm::ParameterSet _pset
 
SiStripBadStripobj_
 

Detailed Description

Definition at line 10 of file SiStripBadModuleGenerator.h.

Member Typedef Documentation

Definition at line 56 of file SiStripBadModuleGenerator.h.

Constructor & Destructor Documentation

SiStripBadModuleGenerator::SiStripBadModuleGenerator ( const edm::ParameterSet iConfig,
const edm::ActivityRegistry aReg 
)
explicit

Definition at line 16 of file SiStripBadModuleGenerator.cc.

16  :
18 {
19  edm::LogInfo("SiStripBadModuleGenerator") << "[SiStripBadModuleGenerator::SiStripBadModuleGenerator]";
20 }
SiStripCondObjBuilderBase(const edm::ParameterSet &pset)
SiStripBadModuleGenerator::~SiStripBadModuleGenerator ( )

Definition at line 23 of file SiStripBadModuleGenerator.cc.

23  {
24  edm::LogInfo("SiStripBadModuleGenerator") << "[SiStripBadModuleGenerator::~SiStripBadModuleGenerator]";
25 }

Member Function Documentation

void SiStripBadModuleGenerator::createObject ( )
private

Definition at line 28 of file SiStripBadModuleGenerator.cc.

References SiStripCondObjBuilderBase< SiStripBadStrip >::_pset, BadComponentList_, SiStripQuality::cleanUp(), SiStripBadStrip::encode(), edm::FileInPath::fullPath(), SiStripQuality::getBadComponentList(), edm::ParameterSet::getUntrackedParameter(), getGTfromDQMFile::obj, SiStripCondObjBuilderBase< SiStripBadStrip >::obj_, printdebug_, SiStripBadStrip::put(), matplotRender::reader, selectDetectors(), and AlCaHarvesting_cff::SiStripQuality.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::dropEvent(), and getObj().

28  {
29 
31 
32  edm::FileInPath fp_ = _pset.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"));
33  printdebug_ = _pset.getUntrackedParameter<bool>("printDebug",false);
35 
36 
38  const std::vector<uint32_t>& DetIds= reader.getAllDetIds();
39  std::vector<uint32_t> selDetIds;
40  selectDetectors(DetIds,selDetIds);
41 
42  edm::LogInfo("SiStripQualityConfigurableFakeESSource")<<"[produce] number of selected dets to be removed " << selDetIds.size() <<std::endl;
43 
44  std::stringstream ss;
45  std::vector<uint32_t>::const_iterator iter=selDetIds.begin();
46  std::vector<uint32_t>::const_iterator iterEnd=selDetIds.end();
47  for(;iter!=iterEnd;++iter){
48 
49  SiStripQuality::InputVector theSiStripVector;
50 
51  unsigned short firstBadStrip=0, NconsecutiveBadStrips=reader.getNumberOfApvsAndStripLength(*iter).first * 128;
52  unsigned int theBadStripRange;
53 
54  theBadStripRange = obj->encode(firstBadStrip,NconsecutiveBadStrips);
55 
56  if (printdebug_)
57  ss << "detid " << *iter << " \t"
58  << " firstBadStrip " << firstBadStrip << "\t "
59  << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t "
60  << " packed integer " << std::hex << theBadStripRange << std::dec
61  << std::endl;
62 
63  theSiStripVector.push_back(theBadStripRange);
64 
65  SiStripBadStrip::Range range(theSiStripVector.begin(),theSiStripVector.end());
66  if ( ! obj->put(*iter,range) )
67  edm::LogError("SiStripQualityConfigurableFakeESSource")<<"[produce] detid already exists"<<std::endl;
68  }
69  if (printdebug_)
70  edm::LogInfo("SiStripQualityConfigurableFakeESSource") << ss.str();
71 
72  obj->cleanUp();
73  //obj->fillBadComponents();
74 
75  std::stringstream ss1;
76  if (printdebug_){
77  for (std::vector<SiStripQuality::BadComponent>::const_iterator iter=obj->getBadComponentList().begin();iter!=obj->getBadComponentList().end();++iter)
78  ss1 << "bad module " << iter->detid << " " << iter->BadModule << "\n";
79  edm::LogInfo("SiStripQualityConfigurableFakeESSource") << ss1.str();
80  }
81 
82  obj_ = new SiStripBadStrip( *(dynamic_cast<SiStripBadStrip*> (obj)));
83  delete obj;
84 }
T getUntrackedParameter(std::string const &, T const &) const
bool cleanUp(bool force=false)
const std::vector< BadComponent > & getBadComponentList() const
void selectDetectors(const std::vector< uint32_t > &, std::vector< uint32_t > &)
vector< ParameterSet > Parameters
std::pair< ContainerIterator, ContainerIterator > Range
std::string fullPath() const
Definition: FileInPath.cc:171
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)
Container InputVector
void SiStripBadModuleGenerator::getObj ( SiStripBadStrip *&  obj)
inlinevirtual
bool SiStripBadModuleGenerator::isTECDetector ( const uint32_t &  therawid,
uint32_t  requested_side,
uint32_t  requested_wheel,
uint32_t  requested_petal_bkw_frw,
uint32_t  requested_petal,
uint32_t  requested_ring,
uint32_t  requested_ster,
uint32_t  requested_detid 
) const
private

Definition at line 255 of file SiStripBadModuleGenerator.cc.

References TECDetId::isFrontPetal(), TECDetId::isStereo(), TECDetId::isZPlusSide(), TECDetId::petalNumber(), DetId::rawId(), TECDetId::ringNumber(), SiStripDetId::subDetector(), SiStripDetId::TEC, and TECDetId::wheelNumber().

Referenced by selectDetectors().

262  {
263  TECDetId potentialDet = TECDetId(therawid); // build TECDetId, at this point is just DetId, but do not want to cast twice
264  if( potentialDet.subDetector() == SiStripDetId::TEC ){ // check if subdetector field is a TEC, both tested numbers are int
265  if( // check if TEC is from the ones requested
266  ( (potentialDet.wheelNumber()==requested_wheel) || requested_wheel==0 ) // take everything if default value is 0
267  &&
268  ( (potentialDet.isZPlusSide() && requested_side==2) || (!potentialDet.isZPlusSide() && requested_side==1) || requested_side==0)
269  &&
270  ( (potentialDet.isStereo() && requested_ster==1) || (!potentialDet.isStereo() && requested_ster==2) || requested_ster==0 )
271  &&
272  ( (potentialDet.isFrontPetal() && requested_petal_bkw_frw==2) || (!potentialDet.isFrontPetal() && requested_petal_bkw_frw==2) || requested_petal_bkw_frw==0 )
273  &&
274  ( (potentialDet.petalNumber()==requested_petal) || requested_petal==0 )
275  &&
276  ( (potentialDet.ringNumber()==requested_ring) || requested_ring==0 )
277  &&
278  ( (potentialDet.rawId()==requested_detid) || requested_detid==0 )
279  )
280  return 1;
281  }
282  return 0;
283 }
unsigned int petalNumber() const
Definition: TECDetId.h:94
unsigned int wheelNumber() const
Definition: TECDetId.h:90
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
bool isStereo()
Definition: TECDetId.h:118
bool isZPlusSide() const
Definition: TECDetId.h:82
SubDetector subDetector() const
Definition: SiStripDetId.h:114
unsigned int ringNumber() const
Definition: TECDetId.h:98
bool isFrontPetal() const
Definition: TECDetId.h:110
bool SiStripBadModuleGenerator::isTIBDetector ( const uint32_t &  therawid,
uint32_t  requested_layer,
uint32_t  requested_bkw_frw,
uint32_t  requested_int_ext,
uint32_t  requested_string,
uint32_t  requested_ster,
uint32_t  requested_detid 
) const
private

Definition at line 178 of file SiStripBadModuleGenerator.cc.

References TIBDetId::isInternalString(), TIBDetId::isRPhi(), TIBDetId::isStereo(), TIBDetId::isZPlusSide(), TIBDetId::layerNumber(), DetId::rawId(), TIBDetId::stringNumber(), SiStripDetId::subDetector(), and SiStripDetId::TIB.

Referenced by selectDetectors().

184  {
185  TIBDetId potentialDet = TIBDetId(therawid); // build TIBDetId, at this point is just DetId, but do not want to cast twice
186  if( potentialDet.subDetector() == SiStripDetId::TIB ){ // check if subdetector field is a TIB, both tested numbers are int
187  if( // check if TIB is from the ones requested
188  ( (potentialDet.layerNumber()==requested_layer) || requested_layer==0 ) // take everything if default value is 0
189  &&
190  ( (potentialDet.isZPlusSide() && requested_bkw_frw==2) || (!potentialDet.isZPlusSide() && requested_bkw_frw==1) || requested_bkw_frw==0)
191  &&
192  ( (potentialDet.isInternalString() && requested_int_ext==1) || (!potentialDet.isInternalString() && requested_int_ext==2) || requested_int_ext==0 )
193  &&
194  ( (potentialDet.isStereo() && requested_ster==1) || (potentialDet.isRPhi() && requested_ster==2) || requested_ster==0 )
195  &&
196  ( (potentialDet.stringNumber()==requested_string) || requested_string==0 )
197  &&
198  ( (potentialDet.rawId()==requested_detid) || requested_detid==0 )
199  )
200  return 1;
201  }
202  return 0;
203 }
unsigned int stringNumber() const
Definition: TIBDetId.h:87
unsigned int layerNumber() const
Definition: TIBDetId.h:83
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
bool isZPlusSide() const
Definition: TIBDetId.h:75
SubDetector subDetector() const
Definition: SiStripDetId.h:114
bool isInternalString() const
Definition: TIBDetId.h:95
bool isStereo()
Definition: TIBDetId.h:107
bool isRPhi()
Definition: TIBDetId.h:103
bool SiStripBadModuleGenerator::isTIDDetector ( const uint32_t &  therawid,
uint32_t  requested_side,
uint32_t  requested_wheel,
uint32_t  requested_ring,
uint32_t  requested_ster,
uint32_t  requested_detid 
) const
private

Definition at line 230 of file SiStripBadModuleGenerator.cc.

References TIDDetId::diskNumber(), TIDDetId::isRPhi(), TIDDetId::isStereo(), TIDDetId::isZPlusSide(), DetId::rawId(), TIDDetId::ringNumber(), SiStripDetId::subDetector(), and SiStripDetId::TID.

Referenced by selectDetectors().

235  {
236  TIDDetId potentialDet = TIDDetId(therawid); // build TIDDetId, at this point is just DetId, but do not want to cast twice
237  if( potentialDet.subDetector() == SiStripDetId::TID ){ // check if subdetector field is a TID, both tested numbers are int
238  if( // check if TID is from the ones requested
239  ( (potentialDet.diskNumber()==requested_wheel) || requested_wheel==0 ) // take everything if default value is 0
240  &&
241  ( (potentialDet.isZPlusSide() && requested_side==2) || (!potentialDet.isZPlusSide() && requested_side==1) || requested_side==0)
242  &&
243  ( (potentialDet.isStereo() && requested_ster==1) || (potentialDet.isRPhi() && requested_ster==2) || requested_ster==0 )
244  &&
245  ( (potentialDet.ringNumber()==requested_ring) || requested_ring==0 )
246  &&
247  ( (potentialDet.rawId()==requested_detid) || requested_detid==0 )
248  )
249  return 1;
250  }
251  return 0;
252 }
bool isStereo()
Definition: TIDDetId.h:109
unsigned int ringNumber() const
Definition: TIDDetId.h:97
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
bool isRPhi()
Definition: TIDDetId.h:105
SubDetector subDetector() const
Definition: SiStripDetId.h:114
bool isZPlusSide() const
Definition: TIDDetId.h:77
unsigned int diskNumber() const
Definition: TIDDetId.h:93
bool SiStripBadModuleGenerator::isTOBDetector ( const uint32_t &  therawid,
uint32_t  requested_layer,
uint32_t  requested_bkw_frw,
uint32_t  requested_rod,
uint32_t  requested_ster,
uint32_t  requested_detid 
) const
private

Definition at line 205 of file SiStripBadModuleGenerator.cc.

References TOBDetId::isRPhi(), TOBDetId::isStereo(), TOBDetId::isZPlusSide(), TOBDetId::layerNumber(), DetId::rawId(), TOBDetId::rodNumber(), SiStripDetId::subDetector(), and SiStripDetId::TOB.

Referenced by selectDetectors().

210  {
211  TOBDetId potentialDet = TOBDetId(therawid); // build TOBDetId, at this point is just DetId, but do not want to cast twice
212  if( potentialDet.subDetector() == SiStripDetId::TOB ){ // check if subdetector field is a TOB, both tested numbers are int
213  if( // check if TOB is from the ones requested
214  ( (potentialDet.layerNumber()==requested_layer) || requested_layer==0 ) // take everything if default value is 0
215  &&
216  ( (potentialDet.isZPlusSide() && requested_bkw_frw==2) || (!potentialDet.isZPlusSide() && requested_bkw_frw==1) || requested_bkw_frw==0)
217  &&
218  ( (potentialDet.isStereo() && requested_ster==1) || (potentialDet.isRPhi() && requested_ster==2) || requested_ster==0 )
219  &&
220  ( (potentialDet.rodNumber()==requested_rod) || requested_rod==0 )
221  &&
222  ( (potentialDet.rawId()==requested_detid) || requested_detid==0 )
223  )
224  return 1;
225  }
226  return 0;
227 }
unsigned int rodNumber() const
Definition: TOBDetId.h:77
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
unsigned int layerNumber() const
Definition: TOBDetId.h:73
bool isStereo()
Definition: TOBDetId.h:89
SubDetector subDetector() const
Definition: SiStripDetId.h:114
bool isZPlusSide() const
Definition: TOBDetId.h:65
bool isRPhi()
Definition: TOBDetId.h:85
void SiStripBadModuleGenerator::selectDetectors ( const std::vector< uint32_t > &  DetIds,
std::vector< uint32_t > &  list 
)
private

Definition at line 87 of file SiStripBadModuleGenerator.cc.

References BadComponentList_, gather_cfg::cout, spr::find(), isTECDetector(), isTIBDetector(), isTIDDetector(), isTOBDetector(), printdebug_, DetId::rawId(), SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, SiStripDetId::TOB, DetId::Tracker, and SiStripDetId::UNKNOWN.

Referenced by createObject().

87  {
88 
89  SiStripSubStructure siStripSubStructure;
90  std::stringstream ss;
91 
92  for(Parameters::iterator iBadComponent = BadComponentList_.begin(); iBadComponent != BadComponentList_.end(); ++iBadComponent ) {
93 
94  if (printdebug_)
95  ss << "Bad SubDet " << iBadComponent->getParameter<std::string>("SubDet") << " \t";
96 
98  if (iBadComponent->getParameter<std::string>("SubDet")=="TIB")
99  subDet=SiStripDetId::TIB;
100  else if (iBadComponent->getParameter<std::string>("SubDet")=="TID")
101  subDet=SiStripDetId::TID;
102  else if (iBadComponent->getParameter<std::string>("SubDet")=="TOB")
103  subDet=SiStripDetId::TOB;
104  else if (iBadComponent->getParameter<std::string>("SubDet")=="TEC")
105  subDet=SiStripDetId::TEC;
106  std::vector<uint32_t> genericBadDetIds( iBadComponent->getUntrackedParameter<std::vector<uint32_t> >("detidList", std::vector<uint32_t>()) );
107 
108  bool anySubDet = true;
109  if( genericBadDetIds.empty() ) anySubDet = false;
110 
111  std::cout << "genericBadDetIds.size() = " << genericBadDetIds.size() << std::endl;
112 
113  uint32_t startDet=DetId(DetId::Tracker,subDet).rawId();
114  uint32_t stopDet=DetId(DetId::Tracker,subDet+1).rawId();
115 
116  if( anySubDet ) {
119  }
120 
121  std::vector<uint32_t>::const_iterator iter=lower_bound(DetIds.begin(),DetIds.end(),startDet);
122  std::vector<uint32_t>::const_iterator iterEnd=lower_bound(DetIds.begin(),DetIds.end(),stopDet);
123 
124  bool resp;
125  for ( ;iter!=iterEnd;++iter){
126 
127  resp=false;
128  if (iBadComponent->getParameter<std::string>("SubDet")=="TIB")
129  resp=isTIBDetector(*iter,
130  iBadComponent->getParameter<uint32_t>("layer"),
131  iBadComponent->getParameter<uint32_t>("bkw_frw"),
132  iBadComponent->getParameter<uint32_t>("int_ext"),
133  iBadComponent->getParameter<uint32_t>("ster"),
134  iBadComponent->getParameter<uint32_t>("string_"),
135  iBadComponent->getParameter<uint32_t>("detid")
136  );
137  else if (iBadComponent->getParameter<std::string>("SubDet")=="TID")
138  resp=isTIDDetector(*iter,
139  iBadComponent->getParameter<uint32_t>("side"),
140  iBadComponent->getParameter<uint32_t>("wheel"),
141  iBadComponent->getParameter<uint32_t>("ring"),
142  iBadComponent->getParameter<uint32_t>("ster"),
143  iBadComponent->getParameter<uint32_t>("detid")
144  );
145  else if (iBadComponent->getParameter<std::string>("SubDet")=="TOB")
146  resp=isTOBDetector(*iter,
147  iBadComponent->getParameter<uint32_t>("layer"),
148  iBadComponent->getParameter<uint32_t>("bkw_frw"),
149  iBadComponent->getParameter<uint32_t>("rod"),
150  iBadComponent->getParameter<uint32_t>("ster"),
151  iBadComponent->getParameter<uint32_t>("detid")
152  );
153  else if (iBadComponent->getParameter<std::string>("SubDet")=="TEC")
154  resp=isTECDetector(*iter,
155  iBadComponent->getParameter<uint32_t>("side"),
156  iBadComponent->getParameter<uint32_t>("wheel"),
157  iBadComponent->getParameter<uint32_t>("petal_bkw_frw"),
158  iBadComponent->getParameter<uint32_t>("petal"),
159  iBadComponent->getParameter<uint32_t>("ring"),
160  iBadComponent->getParameter<uint32_t>("ster"),
161  iBadComponent->getParameter<uint32_t>("detid")
162  );
163  if( anySubDet ) {
164  std::cout << "AnySubDet" << *iter << std::endl;
165  if( std::find(genericBadDetIds.begin(), genericBadDetIds.end(), *iter) == genericBadDetIds.end() ) resp = false;
166  else resp = true;
167  }
168 
169  if(resp)
170  list.push_back(*iter);
171  }
172  }
173  if (printdebug_)
174  edm::LogInfo("SiStripBadModuleGenerator") << ss.str();
175 }
bool isTIBDetector(const uint32_t &therawid, uint32_t requested_layer, uint32_t requested_bkw_frw, uint32_t requested_int_ext, uint32_t requested_string, uint32_t requested_ster, uint32_t requested_detid) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
Definition: DetId.h:20
bool isTECDetector(const uint32_t &therawid, uint32_t requested_side, uint32_t requested_wheel, uint32_t requested_petal_bkw_frw, uint32_t requested_petal, uint32_t requested_ring, uint32_t requested_ster, uint32_t requested_detid) const
bool isTOBDetector(const uint32_t &therawid, uint32_t requested_layer, uint32_t requested_bkw_frw, uint32_t requested_rod, uint32_t requested_ster, uint32_t requested_detid) const
tuple cout
Definition: gather_cfg.py:121
bool isTIDDetector(const uint32_t &therawid, uint32_t requested_side, uint32_t requested_wheel, uint32_t requested_ring, uint32_t requested_ster, uint32_t requested_detid) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run

Member Data Documentation

Parameters SiStripBadModuleGenerator::BadComponentList_
private

Definition at line 57 of file SiStripBadModuleGenerator.h.

Referenced by createObject(), and selectDetectors().

bool SiStripBadModuleGenerator::printdebug_
private

Definition at line 55 of file SiStripBadModuleGenerator.h.

Referenced by createObject(), and selectDetectors().