Skip to content

Commit

Permalink
Merge branch 'master' into AddingHLTEl50PFJet165
Browse files Browse the repository at this point in the history
  • Loading branch information
UBParker authored Jul 4, 2017
2 parents 9b599be + e4d2a49 commit 0c63302
Show file tree
Hide file tree
Showing 176 changed files with 26,536 additions and 21,523 deletions.
3 changes: 3 additions & 0 deletions CalibCalorimetry/EcalTPGTools/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<use name="FWCore/Framework"/>
<use name="FWCore/Utilities"/>
<use name="CondCore/DBOutputService"/>
<use name="Geometry/Records"/>
<use name="Geometry/CaloTopology"/>
<use name="Geometry/EcalMapping"/>
<export>
<lib name="1"/>
</export>
28 changes: 28 additions & 0 deletions CalibCalorimetry/EcalTPGTools/interface/EcalReadoutTools.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef CalibCalorimetry_EcalTPGTools_EcalReadoutTools_H
#define CalibCalorimetry_EcalTPGTools_EcalReadoutTools_H

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"

#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h"
#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
#include "Geometry/EcalMapping/interface/EcalMappingRcd.h"

class EcalReadoutTools {

private:
const EcalTrigTowerConstituentsMap * triggerTowerMap_;
const EcalElectronicsMapping* elecMap_;

public:
EcalReadoutTools(const edm::Event &iEvent, const edm::EventSetup &iSetup);
EcalReadoutTools(const EcalReadoutTools&) = delete;
EcalReadoutTools& operator=(const EcalReadoutTools&) = delete;

EcalTrigTowerDetId readOutUnitOf(const EBDetId& xtalId) const;
EcalScDetId readOutUnitOf(const EEDetId& xtalId) const;
};

#endif
26 changes: 26 additions & 0 deletions CalibCalorimetry/EcalTPGTools/src/EcalReadoutTools.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "CalibCalorimetry/EcalTPGTools/interface/EcalReadoutTools.h"

EcalReadoutTools::EcalReadoutTools(const edm::Event &iEvent, const edm::EventSetup &iSetup) {

edm::ESHandle<EcalTrigTowerConstituentsMap> hTriggerTowerMap;
iSetup.get<IdealGeometryRecord>().get(hTriggerTowerMap);
triggerTowerMap_ = hTriggerTowerMap.product();

edm::ESHandle< EcalElectronicsMapping > ecalmapping;
iSetup.get< EcalMappingRcd >().get(ecalmapping);
elecMap_ = ecalmapping.product();

}

EcalTrigTowerDetId EcalReadoutTools::readOutUnitOf(const EBDetId& xtalId) const{
return triggerTowerMap_->towerOf(xtalId);
}

EcalScDetId EcalReadoutTools::readOutUnitOf(const EEDetId& xtalId) const{
const EcalElectronicsId& EcalElecId = elecMap_->getElectronicsId(xtalId);
int iDCC= EcalElecId.dccId();
int iDccChan = EcalElecId.towerId();
const bool ignoreSingle = true;
const std::vector<EcalScDetId> id = elecMap_->getEcalScDetId(iDCC, iDccChan, ignoreSingle);
return id.size()>0?id[0]:EcalScDetId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
ecalTrgHLT = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone(
# eventSetupPathsKey='AlCa_EcalPhiSym*', # this is the HLT path that can be used
eventSetupPathsKey='EcalTrg',
throw = cms.bool( False ),
)

seqALCARECOEcalTrg = cms.Sequence(ecalTrgHLT)
9 changes: 7 additions & 2 deletions CondCore/CondDB/src/IOVSchema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,15 @@ namespace cond {
q1.addCondition<INSERTION_TIME>( snapshotTime,"<=" );
}
q1.addCondition<SINCE>( end, "<=");
q1.addOrderClause<SINCE>();
q1.addOrderClause<INSERTION_TIME>( false );
size_t initialSize = iovs.size();
for( auto row: q1 ){
iovs.push_back( row );
// starting from the second iov in the array, skip the rows with older timestamp
if( iovs.size()-initialSize && std::get<0>(iovs.back()) == std::get<0>(row) ) continue;
iovs.push_back( row );
}
return iovs.size();
return iovs.size()-initialSize;
}

void IOV::Table::insertOne( const std::string& tag,
Expand Down
53 changes: 26 additions & 27 deletions Configuration/AlCa/python/autoCond.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,59 @@

### NEW KEYS ###
# GlobalTag for MC production with perfectly aligned and calibrated detector for Run1
'run1_design' : '92X_mcRun1_design_v1',
'run1_design' : '92X_mcRun1_design_v2',
# GlobalTag for MC production (pp collisions) with realistic alignment and calibrations for Run1
'run1_mc' : '92X_mcRun1_realistic_v1',
'run1_mc' : '92X_mcRun1_realistic_v2',
# GlobalTag for MC production (Heavy Ions collisions) with realistic alignment and calibrations for Run1
'run1_mc_hi' : '92X_mcRun1_HeavyIon_v1',
'run1_mc_hi' : '92X_mcRun1_HeavyIon_v2',
# GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run1
'run1_mc_pa' : '92X_mcRun1_pA_v1',
'run1_mc_pa' : '92X_mcRun1_pA_v2',
# GlobalTag for MC production with perfectly aligned and calibrated detector for Run2
'run2_design' : '92X_mcRun2_design_v1',
'run2_design' : '92X_mcRun2_design_v2',
# GlobalTag for MC production with pessimistic alignment and calibrations for Run2
'run2_mc_50ns' : '92X_mcRun2_startup_v1',
'run2_mc_50ns' : '92X_mcRun2_startup_v2',
#GlobalTag for MC production with optimistic alignment and calibrations for Run2
'run2_mc' : '92X_mcRun2_asymptotic_v1',
'run2_mc' : '92X_mcRun2_asymptotic_v2',
# GlobalTag for MC production (cosmics) with starup-like alignment and calibrations for Run2, Strip tracker in peak mode
'run2_mc_cosmics' : '92X_mcRun2cosmics_startup_deco_v1',
'run2_mc_cosmics' : '92X_mcRun2cosmics_startup_deco_v2',
# GlobalTag for MC production (Heavy Ions collisions) with optimistic alignment and calibrations for Run2
'run2_mc_hi' : '92X_mcRun2_HeavyIon_v1',
'run2_mc_hi' : '92X_mcRun2_HeavyIon_v2',
# GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run2
'run2_mc_pa' : '92X_mcRun2_pA_v1',
'run2_mc_pa' : '92X_mcRun2_pA_v2',
# GlobalTag for Run1 data reprocessing
'run1_data' : '92X_dataRun2_v1',
'run1_data' : '92X_dataRun2_v2',
# GlobalTag for Run2 data reprocessing
'run2_data' : '92X_dataRun2_v1',
'run2_data' : '92X_dataRun2_v2',
# GlobalTag for Run2 data relvals: allows customization to run with fixed L1 menu
'run2_data_relval' : '92X_dataRun2_relval_v1',
'run2_data_relval' : '92X_dataRun2_relval_v2',
# GlobalTag for Run2 data 2016H relvals only: Prompt Conditions + fixed L1 menu (to be removed)
'run2_data_promptlike' : '92X_dataRun2_PromptLike_v0',

'run2_data_promptlike' : '92X_dataRun2_PromptLike_v3',
# GlobalTag for Run1 HLT: it points to the online GT
'run1_hlt' : '92X_dataRun2_HLT_frozen_v1',
'run1_hlt' : '92X_dataRun2_HLT_frozen_v2',
# GlobalTag for Run2 HLT: it points to the online GT
'run2_hlt' : '92X_dataRun2_HLT_frozen_v1',
'run2_hlt' : '92X_dataRun2_HLT_frozen_v2',
# GlobalTag for Run2 HLT RelVals: customizations to run with fixed L1 Menu
'run2_hlt_relval' : '92X_dataRun2_HLT_relval_v3',
'run2_hlt_relval' : '92X_dataRun2_HLT_relval_v4',
# GlobalTag for Run2 HLT for HI: it points to the online GT
'run2_hlt_hi' : '92X_dataRun2_HLTHI_frozen_v2',
'run2_hlt_hi' : '92X_dataRun2_HLTHI_frozen_v3',
# GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot)
'phase1_2017_design' : '92X_upgrade2017_design_IdealBS_v5',
'phase1_2017_design' : '92X_upgrade2017_design_IdealBS_v7',
# GlobalTag for MC production with realistic conditions for Phase1 2017 detector
'phase1_2017_realistic' : '92X_upgrade2017_realistic_v5',
'phase1_2017_realistic' : '92X_upgrade2017_realistic_v7',
# GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in DECO mode
'phase1_2017_cosmics' : '92X_upgrade2017cosmics_realistic_deco_v5',
'phase1_2017_cosmics' : '92X_upgrade2017cosmics_realistic_deco_v7',
# GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in PEAK mode
'phase1_2017_cosmics_peak' : '92X_upgrade2017cosmics_realistic_peak_v5',
'phase1_2017_cosmics_peak' : '92X_upgrade2017cosmics_realistic_peak_v7',
# GlobalTag for MC production with perfectly aligned and calibrated detector for full Phase1 2018 (and 0,0,0-centred beamspot)
'phase1_2018_design' : '92X_upgrade2018_design_IdealBS_v4',
'phase1_2018_design' : '92X_upgrade2018_design_IdealBS_v6',
# GlobalTag for MC production with realistic conditions for full Phase1 2018 detector
'phase1_2018_realistic' : '92X_upgrade2018_realistic_v5',
'phase1_2018_realistic' : '92X_upgrade2018_realistic_v7',
# GlobalTag for MC production (cosmics) with realistic conditions for full Phase1 2018 detector, Strip tracker in DECO mode
'phase1_2018_cosmics' : '92X_upgrade2018cosmics_realistic_deco_v5',
'phase1_2018_cosmics' : '92X_upgrade2018cosmics_realistic_deco_v7',
# GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2019
'phase1_2019_design' : 'DES19_70_V2', # placeholder (GT not meant for standard RelVal)
# GlobalTag for MC production with realistic conditions for Phase2 2023
'phase2_realistic' : '92X_upgrade2023_realistic_v0'
'phase2_realistic' : '92X_upgrade2023_realistic_v1'
}

aliases = {
Expand Down
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 0c63302

Please sign in to comment.