Skip to content

Commit

Permalink
Merge pull request #18841 from DryRun/CMSSW_9_2_X_hcaldqm_prod
Browse files Browse the repository at this point in the history
HCALDQM: fix RecHitTask crash, adc2fC from DB, fix TPTask, add plots
  • Loading branch information
cmsbuild committed Jul 3, 2017
2 parents 514d35a + 8aa0326 commit b0da358
Show file tree
Hide file tree
Showing 39 changed files with 1,091 additions and 719 deletions.
83 changes: 63 additions & 20 deletions DQM/HcalCommon/interface/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,72 @@ namespace hcaldqm
// use conversion functions in Utilities.h
// For fast look up
// This is for uTCA Crates/FEDs only - no other way...
int const FED_uTCA_MAX_REAL = 50;
uint16_t const FED2CRATE[FED_uTCA_MAX_REAL] = {
24, 0, 20, 0, 21, 0, 25, 0, 31, 0,
35, 0, 37, 0, 34, 0, 30, 0, 22,22,
29,29, 32,32, 0, 0, 0, 0, 0, 0,
0, 0, 38, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
std::map<unsigned int, unsigned int> const crate2fed_map = {
{24, 1100},
{20, 1102},
{21, 1104},
{25, 1106},
{31, 1108},
{35, 1110},
{37, 1112},
{34, 1114},
{30, 1116},
{22, 1118},
{29, 1120},
{32, 1122},
{38, 1134},
{3, 724},
{7, 726},
{6, 728},
{13, 730},
};
uint16_t const CRATE2FED[50] = {
// 2017 values:
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
1102,1104,1118,0,1100,1106,0,0,0,1120,
1116,1108,1122,0,1114,1110,0,1112,1132,0,
0,0,0,0,0,0,0,0,0,0
// 2016 values:
//0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
//0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
//1102, 1104, 1118, 0, 1100, 1106, 0, 0, 0, 1120,
//1116, 1108, 1122, 0, 1114, 1110, 1132, 1112, 0, 0,
//0, 0, 0, 0, 0, 0, 0, 0, 0, 0

std::map<unsigned int, unsigned int> const fed2crate_map = {
{724, 3},
{725, 3},
{726, 7},
{727, 7},
{728, 6},
{729, 6},
{730, 13},
{731, 13},
{1100, 24},
{1101, 24},
{1102, 20},
{1103, 20},
{1104, 21},
{1105, 21},
{1106, 25},
{1107, 25},
{1108, 31},
{1109, 31},
{1110, 35},
{1111, 35},
{1112, 37},
{1113, 37},
{1114, 34},
{1115, 34},
{1116, 30},
{1117, 30},
{1118, 22},
{1119, 22},
{1120, 29},
{1121, 29},
{1122, 32},
{1123, 32},
{1134, 38},
{1135, 38},
};

std::vector<unsigned int> const fedList = {724,725,726,727,728,729,730,731,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122,1123,1134,1135};
std::vector<unsigned int> const fedListuTCA = {1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122,1123,1134,1135};
std::vector<unsigned int> const fedListVME = {724,725,726,727,728,729,730,731};
std::vector<unsigned int> const crateList = {3,6,7,13,20,21,22,24,25,29,30,31,32,34,35,37,38};
std::vector<unsigned int> const crateListuTCA = {20,21,22,24,25,29,30,31,32,34,35,37,38};
std::vector<unsigned int> const crateListVME = {3,6,7,13};
std::vector<unsigned int> const crateListHF = {22,29,32};

int const FED_uTCA_MAX_REAL = 50;

// FEDs use the first 50 uTCA FED numbers only everywhere
int const FED_VME_MIN = FEDNumbering::MINHCALFEDID;
Expand Down
4 changes: 4 additions & 0 deletions DQM/HcalCommon/interface/DQTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ namespace hcaldqm
// Tags and corresponding Tokens
edm::InputTag _tagRaw;
edm::EDGetTokenT<FEDRawDataCollection> _tokRaw;

// Conditions and emap
edm::ESHandle<HcalDbService> _dbService;
HcalElectronicsMap const* _emap;
};
}

Expand Down
36 changes: 18 additions & 18 deletions DQM/HcalCommon/interface/ElectronicsQuantity.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ namespace hcaldqm
{fFiberuTCATPFiberChuTCATP,"TPF-TPFCh"},
};
const std::map<ElectronicsQuantityType, double> min_eid = {
{fFED,0.},
{fFEDuTCA,0.},
{fFEDVME,0.},
{fCrate,0.},
{fCrateuTCA,0.},
{fCrateVME,0.},
{fFED,-0.5},
{fFEDuTCA,-0.5},
{fFEDVME,-0.5},
{fCrate,-0.5},
{fCrateuTCA,-0.5},
{fCrateVME,-0.5},
{fSlotuTCA,0.},
{fSlotVME,0.},
{fSpigot,0.},
Expand All @@ -287,12 +287,12 @@ namespace hcaldqm
{fFiberuTCATPFiberChuTCATP,0.},
};
const std::map<ElectronicsQuantityType, double> max_eid = {
{fFED,FED_TOTAL_NUM},
{fFEDuTCA,FED_uTCA_NUM},
{fFEDVME,FED_VME_NUM},
{fCrate,CRATE_TOTAL_NUM},
{fCrateuTCA,CRATE_uTCA_NUM},
{fCrateVME,CRATE_VME_NUM},
{fFED,fedList.size() - 0.5},
{fFEDuTCA,fedListuTCA.size() - 0.5},
{fFEDVME,fedListVME.size() - 0.5},
{fCrate,crateList.size() - 0.5},
{fCrateuTCA,crateListuTCA.size() - 0.5},
{fCrateVME,crateListVME.size() - 0.5},
{fSlotuTCA,SLOT_uTCA_NUM},
{fSlotVME,SLOT_VME_NUM},
{fSpigot,SPIGOT_NUM},
Expand All @@ -311,12 +311,12 @@ namespace hcaldqm
{fFiberuTCATPFiberChuTCATP,TPFIBER_NUM*TPFIBERCH_NUM},
};
const std::map<ElectronicsQuantityType, double> nbins_eid = {
{fFED,FED_TOTAL_NUM},
{fFEDuTCA,FED_uTCA_NUM},
{fFEDVME,FED_VME_NUM},
{fCrate,CRATE_TOTAL_NUM},
{fCrateuTCA,CRATE_uTCA_NUM},
{fCrateVME,CRATE_VME_NUM},
{fFED,fedList.size()},
{fFEDuTCA,fedListuTCA.size()},
{fFEDVME,fedListVME.size()},
{fCrate,crateList.size()},
{fCrateuTCA,crateListuTCA.size()},
{fCrateVME,crateListVME.size()},
{fSlotuTCA,SLOT_uTCA_NUM},
{fSlotVME,SLOT_VME_NUM},
{fSpigot,SPIGOT_NUM},
Expand Down
1 change: 1 addition & 0 deletions DQM/HcalCommon/interface/HcalCommonHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
#include "CalibFormats/HcalObjects/interface/HcalDbService.h"
#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
#include "DataFormats/Scalers/interface/DcsStatus.h"
#include "DataFormats/Common/interface/TriggerResults.h"
Expand Down
43 changes: 43 additions & 0 deletions DQM/HcalCommon/interface/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,49 @@ namespace hcaldqm
using namespace constants;
namespace utilities
{
/*
* adc2fC lookup from conditions
* fC values are stored in CaloSamples tool
*/
template<class Digi>
CaloSamples loadADC2fCDB(const edm::ESHandle<HcalDbService>& conditions, const HcalDetId did, const Digi& digi) {
CaloSamples calo_samples;
const HcalQIECoder* channelCoder = conditions->getHcalCoder(did);
const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
HcalCoderDb coder(*channelCoder, *shape);
coder.adc2fC(digi, calo_samples);
return calo_samples;
}

// Get pedestal-subtracted charge
template<class Digi>
double adc2fCDBMinusPedestal(const edm::ESHandle<HcalDbService>& conditions, const CaloSamples& calo_samples, const HcalDetId did, const Digi& digi, unsigned int n) {
HcalCalibrations calibrations = conditions->getHcalCalibrations(did);
int capid = digi[n].capid();
return calo_samples[n] - calibrations.pedestal(capid);
}

template<class Digi>
double aveTSDB(const edm::ESHandle<HcalDbService>& conditions, const CaloSamples& calo_samples, const HcalDetId did, const Digi& digi, unsigned int i_start, unsigned int i_end) {
double sumQ = 0;
double sumQT = 0;
for (unsigned int i = i_start; i <+ i_end; ++i) {
double q = adc2fCDBMinusPedestal(conditions, calo_samples, did, digi, i);
sumQ += q;
sumQT += (i+1)*q;
}
return (sumQ > 0 ? sumQT/sumQ-1 : GARBAGE_VALUE);
}

template<class Digi>
double sumQDB(const edm::ESHandle<HcalDbService>& conditions, const CaloSamples& calo_samples, const HcalDetId did, const Digi& digi, unsigned int i_start, unsigned int i_end) {
double sumQ = 0;
for (unsigned int i = i_start; i <+ i_end; ++i) {
sumQ += adc2fCDBMinusPedestal(conditions, calo_samples, did, digi, i);
}
return sumQ;
}

/*
* Some useful functions for QIE10/11 Data Frames
*/
Expand Down
Loading

0 comments on commit b0da358

Please sign in to comment.