Skip to content

Commit 214970d

Browse files
authored
Merge pull request #45665 from CMS-HGCAL/dev/hackathon_base_CMSSW_14_1_X
HGCal raw data handling: Unpacker, Geometry, Local Reco
2 parents 547258c + ed8369d commit 214970d

File tree

97 files changed

+3530
-2237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+3530
-2237
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef CondFormats_HGCalDenseIndexInfoRcd_h
2+
#define CondFormats_HGCalDenseIndexInfoRcd_h
3+
// -*- C++ -*-
4+
//
5+
// Package: CondFormats/DataRecord
6+
// Class : HGCalDenseIndexInfoRcd
7+
//
8+
/**\class HGCalDenseIndexInfoRcd HGCalDenseIndexInfoRcd.h CondFormats/DataRecord/interface/HGCalDenseIndexInfoRcd.h
9+
*
10+
* Description:
11+
* This record is used join information from the geometry and logical mapping
12+
* This record depends on the HGCalElectronicsMappingRcd and CaloGeometryRecord
13+
*
14+
*/
15+
//
16+
// Author: Pedro Da Silva, Izaak Neutelings
17+
// Created: Mon, 29 May 2023 09:13:07 GMT
18+
//
19+
20+
#include "FWCore/Framework/interface/DependentRecordImplementation.h"
21+
#include "FWCore/Utilities/interface/mplVector.h"
22+
#include "CondFormats/DataRecord/interface/HGCalElectronicsMappingRcd.h"
23+
#include "Geometry/Records/interface/CaloGeometryRecord.h"
24+
25+
class HGCalDenseIndexInfoRcd : public edm::eventsetup::DependentRecordImplementation<
26+
HGCalDenseIndexInfoRcd,
27+
edm::mpl::Vector<HGCalElectronicsMappingRcd, CaloGeometryRecord> > {};
28+
29+
#endif
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef CondFormats_HGCalModuleConfigurationRcd_h
2+
#define CondFormats_HGCalModuleConfigurationRcd_h
3+
// -*- C++ -*-
4+
//
5+
// Package: CondFormats/DataRecord
6+
// Class : HGCalModuleConfigurationRcd
7+
//
8+
/**\class HGCalModuleConfigurationRcd HGCalModuleConfigurationRcd.h CondFormats/DataRecord/interface/HGCalModuleConfigurationRcd.h
9+
*
10+
* Description:
11+
* This record is used for passing the configuration parameters to the calibration step in RAW -> RECO,
12+
* This record depends on the HGCalMappingModuleIndexerRcd.
13+
*
14+
*/
15+
//
16+
// Author: Pedro Da Silva, Izaak Neutelings
17+
// Created: Mon, 29 May 2023 09:13:07 GMT
18+
//
19+
20+
#include "FWCore/Framework/interface/DependentRecordImplementation.h"
21+
#include "FWCore/Utilities/interface/mplVector.h"
22+
#include "CondFormats/DataRecord/interface/HGCalElectronicsMappingRcd.h"
23+
24+
class HGCalModuleConfigurationRcd
25+
: public edm::eventsetup::DependentRecordImplementation<HGCalModuleConfigurationRcd,
26+
edm::mpl::Vector<HGCalElectronicsMappingRcd> > {};
27+
28+
#endif
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// -*- C++ -*-
2+
//
3+
// Package: CondFormats/DataRecord
4+
// Class : HGCalDenseIndexInfoRcd
5+
//
6+
// Implementation:
7+
// [Notes on implementation]
8+
//
9+
// Author: Pedro Da Silva, Izaak Neutelings
10+
// Created: Mon, 29 May 2023 09:13:07 GMT
11+
12+
#include "CondFormats/DataRecord/interface/HGCalDenseIndexInfoRcd.h"
13+
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h"
14+
15+
EVENTSETUP_RECORD_REG(HGCalDenseIndexInfoRcd);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// -*- C++ -*-
2+
//
3+
// Package: CondFormats/DataRecord
4+
// Class : HGCalModuleConfigurationRcd
5+
//
6+
// Implementation:
7+
// [Notes on implementation]
8+
//
9+
// Author: Pedro Da Silva, Izaak Neutelings
10+
// Created: Mon, 29 May 2023 09:13:07 GMT
11+
12+
#include "CondFormats/DataRecord/interface/HGCalModuleConfigurationRcd.h"
13+
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h"
14+
15+
EVENTSETUP_RECORD_REG(HGCalModuleConfigurationRcd);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#ifndef CondFormats_HGCalObjects_interface_HGCalCalibParamSoA_h
2+
#define CondFormats_HGCalObjects_interface_HGCalCalibParamSoA_h
3+
4+
#include <Eigen/Core>
5+
#include <Eigen/Dense>
6+
7+
#include "DataFormats/SoATemplate/interface/SoACommon.h"
8+
#include "DataFormats/SoATemplate/interface/SoALayout.h"
9+
#include "DataFormats/SoATemplate/interface/SoAView.h"
10+
11+
//#include "CondFormats/HGCalObjects/interface/HGCalMappingModuleIndexer.h"
12+
13+
namespace hgcalrechit {
14+
15+
// Generate structure of channel-level arrays (SoA) layout with RecHit dataformat
16+
GENERATE_SOA_LAYOUT(HGCalCalibParamSoALayout,
17+
SOA_COLUMN(float, ADC_ped), // ADC pedestals, O(91)
18+
SOA_COLUMN(float, Noise), // noise, O(3)
19+
SOA_COLUMN(float, CM_slope), // common mode slope, O(0.25)
20+
SOA_COLUMN(float, CM_ped), // common mode pedestal (offset), O(92)
21+
SOA_COLUMN(float, BXm1_slope), // leakage correction from previous bunch, O(0.0)
22+
SOA_COLUMN(float, TOTtoADC), // TOT linearization in ADC units, O(15)
23+
SOA_COLUMN(float, TOT_ped), // TOT pedestal (offset), O(9.0)
24+
SOA_COLUMN(float, TOT_lin), // threshold at which TOT is linear, O(200)
25+
SOA_COLUMN(float, TOT_P0), // coefficient pol2 in nonlinear region, O(145)
26+
SOA_COLUMN(float, TOT_P1), // coefficient pol2 in nonlinear region, O(1.0)
27+
SOA_COLUMN(float, TOT_P2), // coefficient pol2 in nonlinear region, O(0.004)
28+
SOA_COLUMN(float, TOAtops), // TOA conversion to time (ps)
29+
SOA_COLUMN(float, MIPS_scale), // MIPS scale
30+
SOA_COLUMN(unsigned char, valid) // only 1 bit used: if false = mask dead channel
31+
)
32+
using HGCalCalibParamSoA = HGCalCalibParamSoALayout<>;
33+
34+
} // namespace hgcalrechit
35+
36+
#endif // CondFormats_HGCalObjects_interface_HGCalCalibParamSoA_h
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef CondFormats_HGCalObjects_interface_HGCalCalibrationParameterHost_h
2+
#define CondFormats_HGCalObjects_interface_HGCalCalibrationParameterHost_h
3+
4+
#include "DataFormats/Portable/interface/PortableHostCollection.h"
5+
#include "CondFormats/HGCalObjects/interface/HGCalCalibParamSoA.h"
6+
#include "CondFormats/HGCalObjects/interface/HGCalConfigParamSoA.h"
7+
8+
namespace hgcalrechit {
9+
10+
// SoA with channel-level calibration parameters in host memory:
11+
// pedestal, CM_slope, CM_ped, BXm1_kappa
12+
using HGCalCalibParamHost = PortableHostCollection<HGCalCalibParamSoA>;
13+
14+
// SoA with ROC-level configuration parameters in host memory:
15+
// gain
16+
using HGCalConfigParamHost = PortableHostCollection<HGCalConfigParamSoA>;
17+
18+
} // namespace hgcalrechit
19+
20+
#endif // CondFormats_HGCalObjects_interface_HGCalCalibrationParameterHost_h
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#ifndef CondFormats_HGCalObjects_interface_HGCalConfigParamSoA_h
2+
#define CondFormats_HGCalObjects_interface_HGCalConfigParamSoA_h
3+
4+
#include <Eigen/Core>
5+
#include <Eigen/Dense>
6+
7+
#include "DataFormats/SoATemplate/interface/SoACommon.h"
8+
#include "DataFormats/SoATemplate/interface/SoALayout.h"
9+
#include "DataFormats/SoATemplate/interface/SoAView.h"
10+
11+
//#include "CondFormats/HGCalObjects/interface/HGCalMappingModuleIndexer.h"
12+
13+
namespace hgcalrechit {
14+
15+
// Generate structure of ROC-level arrays (SoA) layout with RecHit dataformat
16+
GENERATE_SOA_LAYOUT(HGCalConfigParamSoALayout,
17+
SOA_COLUMN(uint8_t, gain) // for ADC to charge (fC) conversion (80, 160, 320 fC)
18+
)
19+
using HGCalConfigParamSoA = HGCalConfigParamSoALayout<>;
20+
21+
} // namespace hgcalrechit
22+
23+
#endif // CondFormats_HGCalObjects_interface_HGCalConfigParamSoA_h
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Authors: Izaak Neutelings (May 2024)
2+
// Sources: https://docs.google.com/spreadsheets/d/13G7sOjssqw4B5AtOcQV3g0W01oZUOMM6Hm_DduxBEPU
3+
#ifndef CondFormats_HGCalObjects_HGCalConfiguraton_h
4+
#define CondFormats_HGCalObjects_HGCalConfiguraton_h
5+
#include "CondFormats/Serialization/interface/Serializable.h"
6+
#include "CondFormats/HGCalObjects/interface/HGCalMappingModuleIndexer.h"
7+
#include <map>
8+
#include <vector>
9+
10+
// @short configuration for ECON eRX (one half of HGROC)
11+
struct HGCalROCConfig {
12+
uint32_t charMode; // characterization mode; determines data fields in ROC dataframe
13+
uint8_t gain; // pre-amp gain used (1: 80 fC, 2: 160 fC, 4: 320 fC)
14+
//uint32_t clockPhase; // fine adjustment of the phase within the 40 MHz
15+
//uint32_t L1AcceptOffset; // coarse adjustment to get the peak in the right place
16+
//uint32_t injChannels; // injected channels for injection scan: 2b word to identify if connected or not+info no capacitor chosen
17+
//uint32_t injCharge; // injected charge for injection scan: convert it to a float in units of fC offline (DAC setting?)
18+
COND_SERIALIZABLE;
19+
};
20+
21+
// @short configuration for ECON-D module
22+
struct HGCalECONDConfig {
23+
//std::string typecode;
24+
uint32_t headerMarker; // begin of event marker/identifier for ECON-D
25+
uint32_t passThrough; //pass through mode (this is just as check as it'll be in the ECON-D header anyway)
26+
std::vector<HGCalROCConfig> rocs;
27+
COND_SERIALIZABLE;
28+
};
29+
30+
// @short configuration for FED
31+
struct HGCalFedConfig {
32+
bool mismatchPassthroughMode; // ignore ECON-D packet mismatches
33+
uint32_t cbHeaderMarker; // begin of event marker/identifier for capture block
34+
uint32_t slinkHeaderMarker; // begin of event marker/identifier for S-link
35+
//uint32_t delay; // delay
36+
std::vector<HGCalECONDConfig> econds;
37+
COND_SERIALIZABLE;
38+
};
39+
40+
/**
41+
* @short Main HGCal configuration with a tree structure of vectors of
42+
* HGCalFedConfig/HGCalECONDConfig/HGCalROCConfig structs as follows:
43+
% config.feds[dense_fed_idx].econds[dense_econd_idx].rocs[dense_eRx_idx]
44+
**/
45+
class HGCalConfiguration {
46+
public:
47+
std::vector<HGCalFedConfig> feds;
48+
49+
private:
50+
COND_SERIALIZABLE;
51+
};
52+
53+
inline std::ostream& operator<<(std::ostream& os, const HGCalConfiguration& config) {
54+
uint32_t nfed = config.feds.size();
55+
uint32_t ntotmod = 0;
56+
uint32_t ntotroc = 0;
57+
for (auto const& fed : config.feds) {
58+
ntotmod += fed.econds.size(); // number of ECON-D modules for this FED
59+
for (auto const& mod : fed.econds) {
60+
ntotroc += mod.rocs.size(); // number of eRx half-ROCs for this ECON-D module
61+
}
62+
}
63+
os << "HGCalConfiguration(nfed=" << nfed << ",ntotmod=" << ntotmod << ",ntotroc=" << ntotroc << ")";
64+
return os;
65+
}
66+
67+
#endif

0 commit comments

Comments
 (0)