-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 #25466 from CMSTrackerDPG/StuckTBM_from-CMSSW_10_4…
…_X_2018-12-07-2300 Simulation of the pixel bad components on the FED channel basis
- Loading branch information
Showing
47 changed files
with
2,083 additions
and
39 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
CalibTracker/Records/interface/SiPixelFEDChannelContainerESProducerRcd.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,11 @@ | ||
#ifndef CALIBTRACKER_RECORDS_SIPIXELFEDCHANNELCONTAINERESPRODUCERRCD_H | ||
#define CALIBTRACKER_RECORDS_SIPIXELFEDCHANNELCONTAINERESPRODUCERRCD_H | ||
|
||
#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" | ||
#include "FWCore/Framework/interface/DependentRecordImplementation.h" | ||
#include "boost/mpl/vector.hpp" | ||
#include "CondFormats/DataRecord/interface/SiPixelStatusScenariosRcd.h" | ||
|
||
class SiPixelFEDChannelContainerESProducerRcd : public edm::eventsetup::DependentRecordImplementation<SiPixelFEDChannelContainerESProducerRcd,boost::mpl::vector<SiPixelStatusScenariosRcd> > {}; | ||
|
||
#endif |
5 changes: 5 additions & 0 deletions
5
CalibTracker/Records/src/SiPixelFEDChannelContainerESProducerRcd.cc
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,5 @@ | ||
#include "CalibTracker/Records/interface/SiPixelFEDChannelContainerESProducerRcd.h" | ||
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" | ||
#include "FWCore/Utilities/interface/typelookup.h" | ||
|
||
EVENTSETUP_RECORD_REG(SiPixelFEDChannelContainerESProducerRcd); |
100 changes: 100 additions & 0 deletions
100
CalibTracker/SiPixelESProducers/plugins/PixelFEDChannelCollectionProducer.cc
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 @@ | ||
// -*- C++ -*- | ||
// | ||
// Package: CalibTracker/PixelFEDChannelCollectionProducer | ||
// Class: PixelFEDChannelCollectionProducer | ||
// | ||
/**\class PixelFEDChannelCollectionProducer | ||
Description: [one line class summary] | ||
Implementation: | ||
[Notes on implementation] | ||
*/ | ||
// | ||
// Original Author: Marco Musich | ||
// Created: Thu, 13 Dec 2018 08:48:22 GMT | ||
// | ||
// | ||
|
||
// system include files | ||
#include <memory> | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/ModuleFactory.h" | ||
#include "FWCore/Framework/interface/ESProducer.h" | ||
|
||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "CondFormats/DataRecord/interface/SiPixelStatusScenariosRcd.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelFEDChannelContainer.h" | ||
#include "CalibTracker/Records/interface/SiPixelFEDChannelContainerESProducerRcd.h" | ||
|
||
// Need to add #include statements for definitions of | ||
// the data type and record type here | ||
|
||
// | ||
// class declaration | ||
// | ||
|
||
class PixelFEDChannelCollectionProducer : public edm::ESProducer { | ||
public: | ||
PixelFEDChannelCollectionProducer(const edm::ParameterSet&); | ||
~PixelFEDChannelCollectionProducer() override; | ||
|
||
typedef std::unordered_map<std::string,PixelFEDChannelCollection> PixelFEDChannelCollectionMap; | ||
using ReturnType = std::unique_ptr<PixelFEDChannelCollectionMap>; | ||
|
||
ReturnType produce(const SiPixelFEDChannelContainerESProducerRcd &); | ||
private: | ||
// ----------member data --------------------------- | ||
}; | ||
|
||
|
||
PixelFEDChannelCollectionProducer::PixelFEDChannelCollectionProducer(const edm::ParameterSet& iConfig) | ||
{ | ||
//the following line is needed to tell the framework what | ||
// data is being produced | ||
setWhatProduced(this); | ||
|
||
//now do what ever other initialization is needed | ||
} | ||
|
||
|
||
PixelFEDChannelCollectionProducer::~PixelFEDChannelCollectionProducer() | ||
{ | ||
|
||
// do anything here that needs to be done at destruction time | ||
// (e.g. close files, deallocate resources etc.) | ||
|
||
} | ||
|
||
// | ||
// member functions | ||
// | ||
|
||
// ------------ method called to produce the data ------------ | ||
PixelFEDChannelCollectionProducer::ReturnType | ||
PixelFEDChannelCollectionProducer::produce(const SiPixelFEDChannelContainerESProducerRcd& iRecord) | ||
{ | ||
edm::ESHandle<SiPixelFEDChannelContainer> qualityCollectionHandle; | ||
iRecord.getRecord<SiPixelStatusScenariosRcd>().get(qualityCollectionHandle); | ||
|
||
PixelFEDChannelCollectionMap out; | ||
|
||
for(const auto& it : qualityCollectionHandle->getScenarioMap()){ | ||
|
||
std::string scenario = it.first; | ||
PixelFEDChannelCollection disabled_channelcollection; | ||
auto SiPixelBadFedChannels = it.second; | ||
for(const auto &entry : SiPixelBadFedChannels){ | ||
disabled_channelcollection.insert(entry.first, entry.second.data(), entry.second.size()); | ||
} | ||
out.emplace(scenario,disabled_channelcollection); | ||
} | ||
|
||
auto product = std::make_unique<PixelFEDChannelCollectionMap>(out); | ||
return product; | ||
} | ||
|
||
//define this as a plug-in | ||
DEFINE_FWK_EVENTSETUP_MODULE(PixelFEDChannelCollectionProducer); |
3 changes: 3 additions & 0 deletions
3
CalibTracker/SiPixelESProducers/python/PixelFEDChannelCollectionProducer_cfi.py
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,3 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
SiPixelFEDChannelContainerESProducer = cms.ESProducer("PixelFEDChannelCollectionProducer") |
84 changes: 84 additions & 0 deletions
84
CalibTracker/SiPixelESProducers/test/PixelFEDChannelCollectionMapTestReader.cc
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,84 @@ | ||
#include <string> | ||
#include <iostream> | ||
#include <map> | ||
#include "FWCore/Framework/interface/one/EDAnalyzer.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" | ||
#include "CalibTracker/Records/interface/SiPixelFEDChannelContainerESProducerRcd.h" | ||
|
||
class PixelFEDChannelCollectionMapTestReader : public edm::one::EDAnalyzer<> { | ||
public: | ||
|
||
typedef std::unordered_map<std::string,PixelFEDChannelCollection> PixelFEDChannelCollectionMap; | ||
explicit PixelFEDChannelCollectionMapTestReader(edm::ParameterSet const& p); | ||
~PixelFEDChannelCollectionMapTestReader(); | ||
|
||
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); | ||
|
||
private: | ||
|
||
virtual void analyze(const edm::Event& e, const edm::EventSetup& c) override; | ||
|
||
// ----------member data --------------------------- | ||
const bool printdebug_; | ||
const std::string formatedOutput_; | ||
|
||
}; | ||
|
||
PixelFEDChannelCollectionMapTestReader::PixelFEDChannelCollectionMapTestReader(edm::ParameterSet const& p): | ||
printdebug_(p.getUntrackedParameter<bool>("printDebug",true)), | ||
formatedOutput_(p.getUntrackedParameter<std::string>("outputFile","")) | ||
{ | ||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader")<<"PixelFEDChannelCollectionMapTestReader"<<std::endl; | ||
} | ||
|
||
PixelFEDChannelCollectionMapTestReader::~PixelFEDChannelCollectionMapTestReader() { | ||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader")<<"~PixelFEDChannelCollectionMapTestReader "<<std::endl; | ||
} | ||
|
||
void | ||
PixelFEDChannelCollectionMapTestReader::analyze(const edm::Event& e, const edm::EventSetup& context){ | ||
|
||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader") <<"### PixelFEDChannelCollectionMapTestReader::analyze ###"<<std::endl; | ||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader") <<" I AM IN RUN NUMBER "<<e.id().run() <<std::endl; | ||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader") <<" ---EVENT NUMBER "<<e.id().event() <<std::endl; | ||
|
||
edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("'SiPixelFEDChannelContainerESProducerRcd")); | ||
|
||
if( recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { | ||
//record not found | ||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader") <<"Record \"SiPixelFEDChannelContainerESProducerRcd"<<"\" does not exist "<<std::endl; | ||
} | ||
|
||
//this part gets the handle of the event source and the record (i.e. the Database) | ||
edm::ESHandle<PixelFEDChannelCollectionMap> PixelFEDChannelCollectionMapHandle; | ||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader") <<"got eshandle"<<std::endl; | ||
|
||
context.get<SiPixelFEDChannelContainerESProducerRcd>().get(PixelFEDChannelCollectionMapHandle); | ||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader") <<"got context"<<std::endl; | ||
|
||
const PixelFEDChannelCollectionMap* quality_map=PixelFEDChannelCollectionMapHandle.product(); | ||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader") <<"got SiPixelFEDChannelContainer* "<< std::endl; | ||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader") << "print pointer address : " ; | ||
//edm::LogInfo("PixelFEDChannelCollectionMapTestReader") << quality_map << std::endl; | ||
|
||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader") << "Size " << quality_map->size() << std::endl; | ||
edm::LogInfo("PixelFEDChannelCollectionMapTestReader") <<"Content of myQuality_Map "<<std::endl; | ||
|
||
} | ||
|
||
void | ||
PixelFEDChannelCollectionMapTestReader::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
desc.setComment("Reads payloads of type SiPixelFEDChannelContainer"); | ||
desc.addUntracked<bool>("printDebug",true); | ||
desc.addUntracked<std::string>("outputFile",""); | ||
descriptions.add("PixelFEDChannelCollectionMapTestReader",desc); | ||
} | ||
|
||
DEFINE_FWK_MODULE(PixelFEDChannelCollectionMapTestReader); |
79 changes: 79 additions & 0 deletions
79
CalibTracker/SiPixelESProducers/test/PixelFEDChannelCollectionMapTestReader_cfg.py
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,79 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
process = cms.Process("ProcessOne") | ||
|
||
## | ||
## MessageLogger | ||
## | ||
process.load('FWCore.MessageService.MessageLogger_cfi') | ||
process.MessageLogger.categories.append("SiPixelFEDChannelContainer") | ||
process.MessageLogger.categories.append("PixelFEDChannelCollectionMapTestReader") | ||
process.MessageLogger.destinations = cms.untracked.vstring("cout") | ||
process.MessageLogger.cout = cms.untracked.PSet( | ||
threshold = cms.untracked.string("INFO"), | ||
default = cms.untracked.PSet(limit = cms.untracked.int32(0)), | ||
FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1), | ||
reportEvery = cms.untracked.int32(1000) | ||
), | ||
SiPixelFEDChannelContainer = cms.untracked.PSet( limit = cms.untracked.int32(-1)), | ||
PixelFEDChannelCollectionMapTestReader = cms.untracked.PSet( limit = cms.untracked.int32(-1)) | ||
) | ||
process.MessageLogger.statistics.append('cout') | ||
|
||
## | ||
## Empty Source | ||
## | ||
process.source = cms.Source("EmptyIOVSource", | ||
timetype = cms.string('runnumber'), | ||
firstValue = cms.uint64(1), | ||
lastValue = cms.uint64(1), | ||
interval = cms.uint64(1) | ||
) | ||
## | ||
## Get the payload | ||
## | ||
from CondCore.CondDB.CondDB_cfi import * | ||
CondDBQualityCollection = CondDB.clone(connect = cms.string("sqlite_file:SiPixelStatusScenarios_v1.db")) | ||
|
||
process.dbInput = cms.ESSource("PoolDBESSource", | ||
CondDBQualityCollection, | ||
toGet = cms.VPSet(cms.PSet(record = cms.string('SiPixelStatusScenariosRcd'), | ||
tag = cms.string('SiPixelFEDChannelContainer_StuckTBM_2018_v1_mc') # choose tag you want | ||
) | ||
) | ||
) | ||
|
||
#from CalibTracker.SiPixelESProducers.PixelFEDChannelCollectionProducer_cfi import * | ||
process.load("CalibTracker.SiPixelESProducers.PixelFEDChannelCollectionProducer_cfi") | ||
#process.SiPixelFEDChannelContainerESProducer = cms.ESProducer("PixelFEDChannelCollectionProducer") | ||
|
||
|
||
## Retrieve it and check it's available in the ES | ||
## | ||
process.get = cms.EDAnalyzer("EventSetupRecordDataGetter", | ||
toGet = cms.VPSet(cms.PSet(record = cms.string('SiPixelFEDChannelContainerESProducerRcd'), | ||
data = cms.vstring('PixelFEDChannelCollectionMap') | ||
) | ||
), | ||
verbose = cms.untracked.bool(True) | ||
) | ||
|
||
## | ||
## Retrieve it and check it's available in the ES | ||
## | ||
# process.get = cms.EDAnalyzer("EventSetupRecordDataGetter", | ||
# toGet = cms.VPSet(cms.PSet(record = cms.string('SiPixelStatusScenariosRcd'), | ||
# data = cms.vstring('SiPixelFEDChannelContainer') | ||
# ) | ||
# ), | ||
# verbose = cms.untracked.bool(True) | ||
# ) | ||
|
||
## | ||
## Read it back | ||
## | ||
process.ReadDB = cms.EDAnalyzer("PixelFEDChannelCollectionMapTestReader") | ||
process.ReadDB.printDebug = cms.untracked.bool(True) | ||
process.ReadDB.outputFile = cms.untracked.string('PixelFEDChannelCollectionMap.log') | ||
|
||
process.p = cms.Path(process.get+process.ReadDB) |
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
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
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
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
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
19 changes: 19 additions & 0 deletions
19
CondFormats/DataRecord/interface/SiPixelStatusScenarioProbabilityRcd.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,19 @@ | ||
#ifndef SiPixelStatusScenarioProbabilityRcd_SiPixelStatusScenarioProbabilityRcd_h | ||
#define SiPixelStatusScenarioProbabilityRcd_SiPixelStatusScenarioProbabilityRcd_h | ||
// -*- C++ -*- | ||
// | ||
// Package: CondFormats/DataRecord | ||
// Class : SiPixelStatusScenarioProbabilityRcd | ||
// | ||
/**\class SiPixelStatusScenarioProbabilityRcd SiPixelStatusScenarioProbabilityRcd.h CondFormats/DataRecord/interface/SiPixelStatusScenarioProbabilityRcd.h | ||
Description: [one line class summary] | ||
Usage: | ||
<usage> | ||
*/ | ||
// | ||
// Author: Marco Musich | ||
// Created: Wed, 30 Nov 2018 11:44:30 GMT | ||
// | ||
#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" | ||
class SiPixelStatusScenarioProbabilityRcd : public edm::eventsetup::EventSetupRecordImplementation<SiPixelStatusScenarioProbabilityRcd> {}; | ||
#endif |
19 changes: 19 additions & 0 deletions
19
CondFormats/DataRecord/interface/SiPixelStatusScenariosRcd.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,19 @@ | ||
#ifndef SiPixelStatusScenariosRcd_SiPixelStatusScenariosRcd_h | ||
#define SiPixelStatusScenariosRcd_SiPixelStatusScenariosRcd_h | ||
// -*- C++ -*- | ||
// | ||
// Package: CondFormats/DataRecord | ||
// Class : SiPixelStatusScenariosRcd | ||
// | ||
/**\class SiPixelStatusScenariosRcd SiPixelStatusScenariosRcd.h CondFormats/DataRecord/interface/SiPixelStatusScenariosRcd.h | ||
Description: [one line class summary] | ||
Usage: | ||
<usage> | ||
*/ | ||
// | ||
// Author: Marco Musich | ||
// Created: Wed, 28 Nov 2018 10:31:30 GMT | ||
// | ||
#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" | ||
class SiPixelStatusScenariosRcd : public edm::eventsetup::EventSetupRecordImplementation<SiPixelStatusScenariosRcd> {}; | ||
#endif |
13 changes: 13 additions & 0 deletions
13
CondFormats/DataRecord/src/SiPixelStatusScenarioProbabilityRcd.cc
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,13 @@ | ||
// -*- C++ -*- | ||
// | ||
// Package: CondFormats/DataRecord | ||
// Class : SiPixelStatusScenarioProbabilityRcd | ||
// | ||
// Implementation: | ||
// [Notes on implementation] | ||
// | ||
// Author: Marco Musich | ||
// Created: Wed, 22 Feb 2017 10:31:30 GMT | ||
#include "CondFormats/DataRecord/interface/SiPixelStatusScenarioProbabilityRcd.h" | ||
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" | ||
EVENTSETUP_RECORD_REG(SiPixelStatusScenarioProbabilityRcd); |
Oops, something went wrong.