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

#include <SiStripQualityHotStripIdentifier.h>

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

Public Member Functions

 SiStripQualityHotStripIdentifier (const edm::ParameterSet &)
 
 ~SiStripQualityHotStripIdentifier ()
 
- 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void algoAnalyze (const edm::Event &, const edm::EventSetup &)
 
void algoBeginJob (const edm::EventSetup &)
 
void algoBeginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
void algoBeginRun (const edm::Run &, const edm::EventSetup &)
 
void algoEndJob ()
 
void bookHistos ()
 
void fillHisto (uint32_t detid, float value)
 
SiStripBadStripgetNewObject ()
 
void resetHistos ()
 

Private Attributes

edm::InputTag Cluster_src_
 
SiStrip::QualityHistosMap ClusterPositionHistoMap
 
const edm::ParameterSet conf_
 
std::string dataLabel_
 
edm::FileInPath fp_
 
unsigned long long m_cacheID_
 
unsigned short MaxClusterWidth_
 
unsigned short MinClusterWidth_
 
SiStripDetInfoFileReaderreader
 
edm::ESHandle< SiStripQualitySiStripQuality_
 
edm::InputTag Track_src_
 
bool tracksCollection_in_EventTree
 
const TrackerTopologytTopo
 

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 22 of file SiStripQualityHotStripIdentifier.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file SiStripQualityHotStripIdentifier.cc.

References bookHistos(), fp_, edm::FileInPath::fullPath(), edm::ParameterSet::getUntrackedParameter(), MaxClusterWidth_, MinClusterWidth_, reader, and OfflineSiStripConfigDb_cff::SiStripDetInfoFileReader.

21  m_cacheID_(0),
22  dataLabel_(iConfig.getUntrackedParameter<std::string>("dataLabel","")),
23  conf_(iConfig),
24  fp_(iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))),
25  Cluster_src_(iConfig.getParameter<edm::InputTag>( "Cluster_src" )),
26  Track_src_(iConfig.getUntrackedParameter<edm::InputTag>( "Track_src" )),
27  tracksCollection_in_EventTree(iConfig.getUntrackedParameter<bool>("RemoveTrackClusters",false)),
28  tTopo(nullptr)
29 {
31 
32  edm::ParameterSet pset=iConfig.getUntrackedParameter< edm::ParameterSet > ("ClusterSelection",edm::ParameterSet());
33  MinClusterWidth_=pset.getUntrackedParameter<uint32_t>("minWidth",1);
34  MaxClusterWidth_=pset.getUntrackedParameter<uint32_t>("maxWidth",1000);
35 
36  bookHistos();
37 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string fullPath() const
Definition: FileInPath.cc:171
SiStripQualityHotStripIdentifier::~SiStripQualityHotStripIdentifier ( )

Definition at line 39 of file SiStripQualityHotStripIdentifier.cc.

39  {
40 }

Member Function Documentation

void SiStripQualityHotStripIdentifier::algoAnalyze ( const edm::Event e,
const edm::EventSetup eSetup 
)
privatevirtual

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 143 of file SiStripQualityHotStripIdentifier.cc.

References edm::DetSetVector< T >::begin(), Cluster_src_, edm::DetSetVector< T >::end(), fillHisto(), spr::find(), edm::Event::getByLabel(), i, edm::isDebugEnabled(), TrackingRecHit::isValid(), edm::HandleBase::isValid(), LogTrace, MaxClusterWidth_, ProjectedSiStripRecHit2D::originalHit(), edm::Handle< T >::product(), edm::DetSet< T >::size(), findQualityFiles::size, Track_src_, and tracksCollection_in_EventTree.

143  {
145  e.getByLabel( Cluster_src_, dsv_SiStripCluster);
146 
147  edm::Handle<reco::TrackCollection> trackCollection;
149  e.getByLabel(Track_src_, trackCollection);
150  if(!trackCollection.isValid()){
151  edm::LogError("SiStripQualityHotStripIdentifier")<<" [SiStripQualityHotStripIdentifier::algoAnalyze] missing trackCollection with label " << Track_src_ <<std::endl;
152  }
153  }
154 
155  std::set<const void*> vPSiStripCluster;
156  //Perform track study
158 
159  const reco::TrackCollection tC = *(trackCollection.product());
160  int i=0;
161  for (reco::TrackCollection::const_iterator track=tC.begin(); track!=tC.end(); track++){
162  LogTrace("SiStripQualityHotStripIdentifier")
163  << "Track number "<< i+1
164  << "\n\tmomentum: " << track->momentum()
165  << "\n\tPT: " << track->pt()
166  << "\n\tvertex: " << track->vertex()
167  << "\n\timpact parameter: " << track->d0()
168  << "\n\tcharge: " << track->charge()
169  << "\n\tnormalizedChi2: " << track->normalizedChi2()
170  <<"\n\tFrom EXTRA : "
171  <<"\n\t\touter PT "<< track->outerPt()<<std::endl;
172 
173  //Loop on rechits
174  for (trackingRecHit_iterator it = track->recHitsBegin(); it != track->recHitsEnd(); ++it){
175  const TrackingRecHit* recHit = &(**it);
176 
177  if (!recHit->isValid()){
178  LogTrace("SiStripQualityHotStripIdentifier") <<"\t\t Invalid Hit "<<std::endl;
179  continue;
180  }
181 
182  const SiStripRecHit2D* singleHit=dynamic_cast<const SiStripRecHit2D*>(recHit);
183  const SiStripMatchedRecHit2D* matchedHit=dynamic_cast<const SiStripMatchedRecHit2D*>(recHit);
184  const ProjectedSiStripRecHit2D* projectedHit=dynamic_cast<const ProjectedSiStripRecHit2D*>(recHit);
185 
186  if(matchedHit){
187  vPSiStripCluster.insert((void *)&(matchedHit->monoCluster()));
188  vPSiStripCluster.insert((void *)&(matchedHit->stereoCluster()));
189  } else if(projectedHit){
190  vPSiStripCluster.insert((void *)&*(projectedHit->originalHit().cluster()));
191  } else if(singleHit){
192  vPSiStripCluster.insert((void*)&*(singleHit->cluster()));
193  }else{
194  LogTrace("SiStripQualityHotStripIdentifier") << "NULL hit" << std::endl;
195  }
196  }
197  }
198  }
199 
200  std::stringstream ss;
201  //Loop on Det Clusters
202  edm::DetSetVector<SiStripCluster>::const_iterator DSViter=dsv_SiStripCluster->begin();
203  for (; DSViter!=dsv_SiStripCluster->end();DSViter++){
205  edm::DetSet<SiStripCluster>::const_iterator ClusIterEnd = DSViter->data.end();
206  for(; ClusIter!=ClusIterEnd; ++ClusIter) {
207  if (MinClusterWidth_<=ClusIter->amplitudes().size() && ClusIter->amplitudes().size()<=MaxClusterWidth_) {
208  if (std::find(vPSiStripCluster.begin(),vPSiStripCluster.end(),(void*) &*ClusIter) == vPSiStripCluster.end()){
209  if ( edm::isDebugEnabled() )
210  ss << " adding cluster to histo for detid " << DSViter->id << " with barycenter "<< ClusIter->barycenter() << std::endl;
211  fillHisto(DSViter->id,ClusIter->barycenter());
212  }
213  }
214  }
215  }
216  LogTrace("SiStripQualityHotStripIdentifier") << ss.str();
217 }
bool isDebugEnabled()
int i
Definition: DBlmapReader.cc:9
void fillHisto(uint32_t detid, float value)
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
size_type size() const
Definition: DetSet.h:63
edmNew::DetSet< SiStripCluster >::const_iterator ClusIter
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
#define LogTrace(id)
bool isValid() const
T const * product() const
Definition: Handle.h:81
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:341
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
const SiStripRecHit2D & originalHit() const
tuple size
Write out results.
void SiStripQualityHotStripIdentifier::algoBeginJob ( const edm::EventSetup )
inlineprivatevirtual

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 32 of file SiStripQualityHotStripIdentifier.h.

32 {}
void SiStripQualityHotStripIdentifier::algoBeginLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup  
)
inlineprivatevirtual
void SiStripQualityHotStripIdentifier::algoBeginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 85 of file SiStripQualityHotStripIdentifier.cc.

References dataLabel_, edm::EventSetup::get(), m_cacheID_, edm::ESHandle< class >::product(), resetHistos(), SiStripQuality_, and tTopo.

85  {
86  //Retrieve tracker topology from geometry
88  iSetup.get<IdealGeometryRecord>().get(tTopoHandle);
89  tTopo = tTopoHandle.product();
90 
91  resetHistos();
92  unsigned long long cacheID = iSetup.get<SiStripQualityRcd>().cacheIdentifier();
93 
94  if (m_cacheID_ == cacheID)
95  return;
96 
97  m_cacheID_ = cacheID;
98 
100 
101 }
edm::ESHandle< SiStripQuality > SiStripQuality_
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
void SiStripQualityHotStripIdentifier::algoEndJob ( )
privatevirtual

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 103 of file SiStripQualityHotStripIdentifier.cc.

References ClusterPositionHistoMap.

103  {
104  //Clear map
105  ClusterPositionHistoMap.clear();
106 }
void SiStripQualityHotStripIdentifier::bookHistos ( )
private

Definition at line 117 of file SiStripQualityHotStripIdentifier.cc.

References ClusterPositionHistoMap, SiStripDetInfoFileReader::getAllData(), and reader.

Referenced by SiStripQualityHotStripIdentifier().

117  {
118  edm::LogInfo("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::bookHistos] " << std::endl;
119  char hname[1024];
120  std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it =reader->getAllData().begin();
121  std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator iEnd =reader->getAllData().end();
122  for(; it!=iEnd; ++it){
123  sprintf(hname,"h_%d",it->first);
124  SiStrip::QualityHistosMap::iterator ref=ClusterPositionHistoMap.find(it->first);
125  if (ref==ClusterPositionHistoMap.end()){
126  ClusterPositionHistoMap[it->first]=boost::shared_ptr<TH1F>(new TH1F(hname,hname,it->second.nApvs*128,-0.5,it->second.nApvs*128-0.5));
127  }
128  else
129  edm::LogError("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::bookHistos] DetId " << it->first << " already found in map. Ignoring new data"<<std::endl;
130  }
131 }
const std::map< uint32_t, DetInfo > & getAllData() const
void SiStripQualityHotStripIdentifier::fillHisto ( uint32_t  detid,
float  value 
)
private

Definition at line 133 of file SiStripQualityHotStripIdentifier.cc.

References ClusterPositionHistoMap.

Referenced by algoAnalyze().

133  {
134 
135  SiStrip::QualityHistosMap::iterator ref=ClusterPositionHistoMap.find(detid);
136  if (ref!=ClusterPositionHistoMap.end())
137  ref->second->Fill(value);
138  else
139  edm::LogError("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::fillHisto] Histogram not found in the list for DetId " << detid << " Ignoring data value "<< value <<std::endl;
140 }
SiStripBadStrip * SiStripQualityHotStripIdentifier::getNewObject ( )
privatevirtual

Implements ConditionDBWriter< SiStripBadStrip >.

Definition at line 42 of file SiStripQualityHotStripIdentifier.cc.

References a, ClusterPositionHistoMap, conf_, SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips(), SiStripBadStrip::getDataVectorBegin(), edm::ParameterSet::getParameter(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), edm::ParameterSet::getUntrackedParameter(), getGTfromDQMFile::obj, Parameters::parameters, SiStripBadStrip::put(), SiStripHotStripAlgorithmFromClusterOccupancy::setMinNumEntries(), SiStripHotStripAlgorithmFromClusterOccupancy::setMinNumEntriesPerStrip(), SiStripHotStripAlgorithmFromClusterOccupancy::setProbabilityThreshold(), AlCaHarvesting_cff::SiStripQuality, SiStripQuality_, AlCaHLTBitMon_QueryRunRegistry::string, and tTopo.

42  {
43 
45 
47  std::string AlgoName = parameters.getParameter<std::string>("AlgoName");
48  if (AlgoName=="SiStripHotStripAlgorithmFromClusterOccupancy"){
49 
50  edm::LogInfo("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::getNewObject] call to SiStripHotStripAlgorithmFromClusterOccupancy"<<std::endl;
51 
53  theIdentifier.setProbabilityThreshold(parameters.getUntrackedParameter<double>("ProbabilityThreshold",1.E-7));
54  theIdentifier.setMinNumEntries(parameters.getUntrackedParameter<uint32_t>("MinNumEntries",100));
55  theIdentifier.setMinNumEntriesPerStrip(parameters.getUntrackedParameter<uint32_t>("MinNumEntriesPerStrip",5));
56 
57  SiStripQuality* qobj = new SiStripQuality();
58  theIdentifier.extractBadStrips(qobj,ClusterPositionHistoMap,SiStripQuality_);
59 
60  edm::LogInfo("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::getNewObject] copy SiStripObject in SiStripBadStrip"<<std::endl;
61 
62  std::stringstream ss;
63 
66  for(;rIter!=rIterEnd;++rIter){
67  SiStripBadStrip::Range range(qobj->getDataVectorBegin()+rIter->ibegin,qobj->getDataVectorBegin()+rIter->iend);
68  if ( ! obj->put(rIter->detid,range) )
69  edm::LogError("SiStripQualityHotStripIdentifier")<<"[SiStripQualityHotStripIdentifier::getNewObject] detid already exists"<<std::endl;
70  }
71  edm::LogInfo("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::getNewObject] " << ss.str() << std::endl;
72 
73  } else {
74  edm::LogError("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::getNewObject] call for a unknow HotStrip identification algoritm"<<std::endl;
75 
76  std::vector<uint32_t> a;
77  SiStripBadStrip::Range range(a.begin(),a.end());
78  if ( ! obj->put(0xFFFFFFFF,range) )
79  edm::LogError("SiStripQualityHotStripIdentifier")<<"[SiStripQualityHotStripIdentifier::getNewObject] detid already exists"<<std::endl;
80  }
81 
82  return obj;
83 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
dictionary parameters
Definition: Parameters.py:2
Registry::const_iterator RegistryIterator
RegistryIterator getRegistryVectorEnd() const
edm::ESHandle< SiStripQuality > SiStripQuality_
ContainerIterator getDataVectorBegin() const
RegistryIterator getRegistryVectorBegin() const
double a
Definition: hdecay.h:121
std::pair< ContainerIterator, ContainerIterator > Range
bool put(const uint32_t &detID, const InputVector &vect)
void SiStripQualityHotStripIdentifier::resetHistos ( )
private

Definition at line 108 of file SiStripQualityHotStripIdentifier.cc.

References ClusterPositionHistoMap.

Referenced by algoBeginLuminosityBlock(), and algoBeginRun().

108  {
109  edm::LogInfo("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::resetHistos] " << std::endl;
110  SiStrip::QualityHistosMap::iterator it=ClusterPositionHistoMap.begin();
111  SiStrip::QualityHistosMap::iterator iEnd=ClusterPositionHistoMap.end();
112  for (;it!=iEnd;++it){
113  it->second->Reset();
114  }
115 }

Member Data Documentation

edm::InputTag SiStripQualityHotStripIdentifier::Cluster_src_
private

Definition at line 58 of file SiStripQualityHotStripIdentifier.h.

Referenced by algoAnalyze().

SiStrip::QualityHistosMap SiStripQualityHotStripIdentifier::ClusterPositionHistoMap
private
const edm::ParameterSet SiStripQualityHotStripIdentifier::conf_
private

Definition at line 55 of file SiStripQualityHotStripIdentifier.h.

Referenced by getNewObject().

std::string SiStripQualityHotStripIdentifier::dataLabel_
private

Definition at line 53 of file SiStripQualityHotStripIdentifier.h.

Referenced by algoBeginRun().

edm::FileInPath SiStripQualityHotStripIdentifier::fp_
private

Definition at line 56 of file SiStripQualityHotStripIdentifier.h.

Referenced by SiStripQualityHotStripIdentifier().

unsigned long long SiStripQualityHotStripIdentifier::m_cacheID_
private

Definition at line 52 of file SiStripQualityHotStripIdentifier.h.

Referenced by algoBeginRun().

unsigned short SiStripQualityHotStripIdentifier::MaxClusterWidth_
private
unsigned short SiStripQualityHotStripIdentifier::MinClusterWidth_
private

Definition at line 63 of file SiStripQualityHotStripIdentifier.h.

Referenced by SiStripQualityHotStripIdentifier().

SiStripDetInfoFileReader* SiStripQualityHotStripIdentifier::reader
private
edm::ESHandle<SiStripQuality> SiStripQualityHotStripIdentifier::SiStripQuality_
private

Definition at line 54 of file SiStripQualityHotStripIdentifier.h.

Referenced by algoBeginRun(), and getNewObject().

edm::InputTag SiStripQualityHotStripIdentifier::Track_src_
private

Definition at line 59 of file SiStripQualityHotStripIdentifier.h.

Referenced by algoAnalyze().

bool SiStripQualityHotStripIdentifier::tracksCollection_in_EventTree
private

Definition at line 60 of file SiStripQualityHotStripIdentifier.h.

Referenced by algoAnalyze().

const TrackerTopology* SiStripQualityHotStripIdentifier::tTopo
private

Definition at line 61 of file SiStripQualityHotStripIdentifier.h.

Referenced by algoBeginRun(), and getNewObject().