Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22455 from tocheng/SiPixelQualityPCL_For_CMSSW_10…
…_1_X SiPixel Quality PCL for cmssw 10_1_X
- Loading branch information
Showing
34 changed files
with
2,426 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/PluginManager"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="DataFormats/DetId"/> | ||
<use name="Geometry/TrackerGeometryBuilder"/> | ||
<use name="Geometry/Records"/> | ||
<use name="DataFormats/SiPixelDetId"/> | ||
<use name="DataFormats/FEDRawData"/> | ||
<use name="CondFormats/DataRecord"/> | ||
<use name="DQM/SiPixelPhase1Common"/> | ||
<use name="clhep"/> | ||
<use name="boost"/> | ||
<use name="root"/> | ||
<export> | ||
<lib name="1"/> | ||
</export> |
100 changes: 100 additions & 0 deletions
100
CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#ifndef SIPIXELDETECTORSTATUS_h | ||
#define SIPIXELDETECTORSTATUS_h | ||
|
||
#include <ctime> | ||
#include <map> | ||
#include <string> | ||
|
||
#include "CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h" | ||
|
||
// ---------------------------------------------------------------------- | ||
class SiPixelDetectorStatus { | ||
|
||
public: | ||
|
||
SiPixelDetectorStatus(); | ||
~SiPixelDetectorStatus(); | ||
|
||
// file I/O | ||
void readFromFile(std::string filename); | ||
void dumpToFile(std::string filename); | ||
|
||
// add SiPixelModuleStatus for detID, specifying nrocs | ||
void addModule(int detid, int nrocs); | ||
// add a SiPixelModuleStatus obj for detID | ||
void addModule(int detid, SiPixelModuleStatus a); | ||
|
||
// fill hit in double idc in ROC roc into module detid | ||
void fillDIGI(int detid, int roc, int idc); | ||
// fill stuck TBM info | ||
void fillStuckTBM(int detid, PixelFEDChannel ch, std::time_t time); | ||
|
||
std::map<int, std::vector<int>> getStuckTBMsRocs(); | ||
|
||
// determine detector average nhits and RMS | ||
void digiOccupancy(); | ||
double perRocDigiOcc(){ digiOccupancy(); return fDetAverage; } | ||
double perRocDigiOccVar(){ digiOccupancy(); return fDetSigma; } | ||
unsigned long int digiOccDET(){ return fDetHits; } | ||
|
||
// number of modules in detector | ||
int nmodules(); | ||
|
||
// get a Module | ||
bool findModule(int detid); | ||
SiPixelModuleStatus* getModule(int detid); | ||
|
||
// provide for iterating over the entire detector | ||
std::map<int, SiPixelModuleStatus>::iterator begin(); | ||
std::map<int, SiPixelModuleStatus>::iterator next(); | ||
std::map<int, SiPixelModuleStatus>::iterator end(); | ||
|
||
// set the time stamps | ||
void setRunRange(int run0, int run1) {fRun0 = run0;fRun1 = run1;} | ||
std::pair<int,int> getRunRange() {return std::make_pair(fRun0,fRun1);} | ||
void setLSRange(int ls0, int ls1) {fLS0 = ls0; fLS1 = ls1;} | ||
std::pair<int,int> getLSRange() {return std::make_pair(fLS0,fLS1);} | ||
void setRefTime(std::time_t refTime0, std::time_t refTime1) {fTime0 = refTime0; fTime1 = refTime1;} | ||
std::pair<std::time_t,std::time_t> getRefTime() {return std::make_pair(fTime0,fTime1);} | ||
|
||
// total processed events | ||
void setNevents(unsigned long int N){ fNevents = N; } | ||
unsigned long int getNevents(){ return fNevents; } | ||
|
||
void resetDetectorStatus() { fModules.clear(); fDetAverage=0; fDetSigma=0; fDetHits=0; fNevents=0; | ||
fRun0 = 99999999; fRun1 = 0; fLS0 = 99999999; fLS1 = 0; | ||
fTime0 = 0; fTime1 = 0; | ||
} | ||
|
||
// combine detector status | ||
void updateDetectorStatus(SiPixelDetectorStatus newData); | ||
SiPixelDetectorStatus combineDetectorStatus(SiPixelDetectorStatus newData); | ||
|
||
// detector status | ||
std::map<int, SiPixelModuleStatus> getDetectorStatus(){ return fModules; } | ||
|
||
private: | ||
|
||
std::map<int, SiPixelModuleStatus> fModules; | ||
|
||
// first and last lumisection seen in this instance | ||
int fLS0, fLS1; | ||
|
||
// first and last run seen in this instance (likely to be the same number!) | ||
int fRun0, fRun1; | ||
|
||
// being and end time stamp | ||
std::time_t fTime0, fTime1; | ||
|
||
// number of events processed | ||
unsigned long int fNevents; | ||
|
||
// average (per module) number of hits over entire detector | ||
double fDetAverage, fDetSigma; | ||
|
||
// total hits in detector | ||
unsigned long int fDetHits; | ||
|
||
}; | ||
|
||
#endif |
61 changes: 61 additions & 0 deletions
61
CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#ifndef SIPIXELMODULESTATUS_h | ||
#define SIPIXELMODULESTATUS_h | ||
|
||
#include "CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h" | ||
#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" | ||
|
||
#include <vector> | ||
|
||
|
||
// ---------------------------------------------------------------------- | ||
class SiPixelModuleStatus { | ||
|
||
public: | ||
|
||
SiPixelModuleStatus(int det = 0, int nrocs = 16); | ||
~SiPixelModuleStatus(); | ||
|
||
/// fill with online coordinates | ||
void fillDIGI(int iroc, int idc); | ||
|
||
/// fill with online coordinates (nhit > 1) | ||
void updateDIGI(int iroc, int idc, unsigned long nhit); | ||
|
||
/// fill stuck TBM | ||
void fillStuckTBM( PixelFEDChannel ch, std::time_t time ); | ||
|
||
/// return DC status of a ROC (=hits on DC idc on ROC iroc) | ||
unsigned long int digiOccDC(int iroc, int idc); | ||
|
||
/// return ROC status (= hits on ROC iroc) | ||
unsigned long int digiOccROC(int iroc); | ||
|
||
/// return module status (= hits on module) | ||
unsigned long int digiOccMOD(); | ||
|
||
/// get a ROC | ||
SiPixelRocStatus* getRoc(int i); | ||
|
||
/// accessors and setters | ||
int detid(); | ||
int nrocs(); | ||
void setNrocs(int iroc); | ||
|
||
/// calculate (averaged over this module's ROCs) mean hit number and its sigma | ||
void digiOccupancy(); | ||
double perRocDigiOcc(); | ||
double perRocDigiOccVar(); | ||
|
||
/// combine new data to update(topup) module status | ||
void updateModuleDIGI(int roc, int dc, unsigned long int nhits); | ||
void updateModuleStatus(SiPixelModuleStatus newData); | ||
|
||
private: | ||
|
||
int fDetid, fNrocs; | ||
double fModAverage, fModSigma; | ||
std::vector<SiPixelRocStatus> fRocs; | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef SIPIXELROCSTATUS_h | ||
#define SIPIXELROCSTATUS_h | ||
|
||
#include <ctime> | ||
|
||
// ---------------------------------------------------------------------- | ||
class SiPixelRocStatus { | ||
public: | ||
SiPixelRocStatus(); | ||
~SiPixelRocStatus(); | ||
void fillDIGI(int idc); | ||
void updateDIGI(int idc, unsigned long int hits); | ||
|
||
void fillStuckTBM(unsigned int fed, unsigned int link, std::time_t time); | ||
void updateStuckTBM(unsigned int fed, unsigned int link, std::time_t time, unsigned long int freq); | ||
|
||
// stuckTBM | ||
bool isStuckTBM(){ return isStuckTBM_; } | ||
unsigned int getBadFed(){ return badFed_; } | ||
unsigned int getBadLink(){ return badLink_; } | ||
std::time_t getStartBadTime(){ return startBadTime_; } | ||
unsigned long int getBadFreq(){ return badFreq_; } | ||
|
||
// occpancy | ||
unsigned long int digiOccDC(int idc); | ||
unsigned long int digiOccROC(); | ||
|
||
int nDC(){ return nDC_;} | ||
|
||
|
||
private: | ||
const int nDC_ = 26; | ||
unsigned long int fDC[26]; | ||
|
||
bool isStuckTBM_; | ||
unsigned int badFed_; | ||
unsigned int badLink_; | ||
std::time_t startBadTime_; | ||
unsigned long int badFreq_; | ||
|
||
}; | ||
|
||
#endif |
62 changes: 62 additions & 0 deletions
62
CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#ifndef SiPixelStatusManager_H | ||
#define SiPixelStatusManager_H | ||
|
||
/** \class SiPixelStatusManager | ||
* | ||
* | ||
* \author | ||
*/ | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Framework/interface/LuminosityBlock.h" | ||
#include "FWCore/Framework/interface/ConsumesCollector.h" | ||
#include "DataFormats/Provenance/interface/LuminosityBlockID.h" | ||
#include <string> | ||
#include <map> | ||
#include <utility> | ||
#include <iostream> | ||
|
||
//Data format | ||
#include "CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h" | ||
|
||
class SiPixelStatusManager { | ||
|
||
public: | ||
SiPixelStatusManager (); | ||
SiPixelStatusManager (const edm::ParameterSet&, edm::ConsumesCollector&&); | ||
virtual ~SiPixelStatusManager(); | ||
|
||
void reset(); | ||
void readLumi(const edm::LuminosityBlock&); | ||
|
||
void createStuckTBMs(); | ||
void createBadComponents(); | ||
|
||
void createPayloads(){ | ||
createStuckTBMs(); | ||
createBadComponents(); | ||
} | ||
|
||
const std::map<edm::LuminosityBlockNumber_t,SiPixelDetectorStatus>& getBadComponents(){return siPixelStatusMap_; } | ||
const std::map<edm::LuminosityBlockNumber_t,std::map<int, std::vector<int>> >& getStuckTBMsRocs(){return stuckTBMsMap_;} | ||
|
||
typedef std::map<edm::LuminosityBlockNumber_t,SiPixelDetectorStatus>::iterator siPixelStatusMap_iterator; | ||
typedef std::map<edm::LuminosityBlockNumber_t,std::map<int, std::vector<int>> >::iterator stuckTBMsMap_iterator; | ||
|
||
private: | ||
|
||
std::map<edm::LuminosityBlockNumber_t, SiPixelDetectorStatus> siPixelStatusMap_; | ||
std::map<edm::LuminosityBlockNumber_t, std::map<int, std::vector<int>> > stuckTBMsMap_; | ||
|
||
std::string outputBase_; | ||
int aveDigiOcc_; | ||
int nLumi_; | ||
std::string moduleName_; | ||
std::string label_; | ||
|
||
edm::EDGetTokenT<SiPixelDetectorStatus> siPixelStatusToken_; | ||
|
||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/PluginManager"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="DataFormats/DetId"/> | ||
<use name="Geometry/TrackerGeometryBuilder"/> | ||
<use name="Geometry/Records"/> | ||
<use name="DataFormats/SiPixelDetId"/> | ||
<use name="DataFormats/FEDRawData"/> | ||
<use name="CondFormats/DataRecord"/> | ||
<use name="CondFormats/SiPixelObjects"/> | ||
<use name="DQM/SiPixelPhase1Common"/> | ||
<use name="CalibTracker/SiPixelQuality"/> | ||
<use name="boost"/> | ||
<use name="root"/> | ||
|
||
<library file="SiPixelStatusProducer.cc" name="SiPixelStatusProducer"> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> | ||
<library file="SiPixelStatusHarvester.cc" name="SiPixelStatusHarvester"> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> |
Oops, something went wrong.