test
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
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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 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
 
- 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 &)
 
- 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 21 of file SiStripQualityHotStripIdentifier.cc.

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

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

Definition at line 40 of file SiStripQualityHotStripIdentifier.cc.

40  {
41 }

Member Function Documentation

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

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 144 of file SiStripQualityHotStripIdentifier.cc.

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

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

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

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

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 104 of file SiStripQualityHotStripIdentifier.cc.

References ClusterPositionHistoMap.

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

Definition at line 118 of file SiStripQualityHotStripIdentifier.cc.

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

Referenced by SiStripQualityHotStripIdentifier().

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

Definition at line 134 of file SiStripQualityHotStripIdentifier.cc.

References ClusterPositionHistoMap.

Referenced by algoAnalyze().

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

Implements ConditionDBWriter< SiStripBadStrip >.

Definition at line 43 of file SiStripQualityHotStripIdentifier.cc.

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

43  {
44 
46 
48  std::string AlgoName = parameters.getParameter<std::string>("AlgoName");
49  if (AlgoName=="SiStripHotStripAlgorithmFromClusterOccupancy"){
50 
51  edm::LogInfo("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::getNewObject] call to SiStripHotStripAlgorithmFromClusterOccupancy"<<std::endl;
52 
54  theIdentifier.setProbabilityThreshold(parameters.getUntrackedParameter<double>("ProbabilityThreshold",1.E-7));
55  theIdentifier.setMinNumEntries(parameters.getUntrackedParameter<uint32_t>("MinNumEntries",100));
56  theIdentifier.setMinNumEntriesPerStrip(parameters.getUntrackedParameter<uint32_t>("MinNumEntriesPerStrip",5));
57 
58  SiStripQuality* qobj = new SiStripQuality();
59  theIdentifier.extractBadStrips(qobj,ClusterPositionHistoMap,SiStripQuality_);
60 
61  edm::LogInfo("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::getNewObject] copy SiStripObject in SiStripBadStrip"<<std::endl;
62 
63  std::stringstream ss;
64 
67  for(;rIter!=rIterEnd;++rIter){
68  SiStripBadStrip::Range range(qobj->getDataVectorBegin()+rIter->ibegin,qobj->getDataVectorBegin()+rIter->iend);
69  if ( ! obj->put(rIter->detid,range) )
70  edm::LogError("SiStripQualityHotStripIdentifier")<<"[SiStripQualityHotStripIdentifier::getNewObject] detid already exists"<<std::endl;
71  }
72  edm::LogInfo("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::getNewObject] " << ss.str() << std::endl;
73 
74  } else {
75  edm::LogError("SiStripQualityHotStripIdentifier") <<" [SiStripQualityHotStripIdentifier::getNewObject] call for a unknow HotStrip identification algoritm"<<std::endl;
76 
77  std::vector<uint32_t> a;
78  SiStripBadStrip::Range range(a.begin(),a.end());
79  if ( ! obj->put(0xFFFFFFFF,range) )
80  edm::LogError("SiStripQualityHotStripIdentifier")<<"[SiStripQualityHotStripIdentifier::getNewObject] detid already exists"<<std::endl;
81  }
82 
83  return obj;
84 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
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 109 of file SiStripQualityHotStripIdentifier.cc.

References ClusterPositionHistoMap.

Referenced by algoBeginLuminosityBlock(), and algoBeginRun().

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

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().