Skip to content

Commit

Permalink
Updated the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Govinda Stahl Leiton committed May 23, 2024
1 parent b1d0770 commit d503705
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 15 deletions.
1 change: 1 addition & 0 deletions CondCore/Utilities/plugins/Module_2XML.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) {
PAYLOAD_2XML_CLASS(CastorRecoParams);
PAYLOAD_2XML_CLASS(CastorSaturationCorrs);
PAYLOAD_2XML_CLASS(CentralityTable);
PAYLOAD_2XML_CLASS(DeDxCalibration);
PAYLOAD_2XML_CLASS(DTCCBConfig);
PAYLOAD_2XML_CLASS(DTDeadFlag);
PAYLOAD_2XML_CLASS(DTHVStatus);
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondDBFetch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ namespace cond {
FETCH_PAYLOAD_CASE(CastorRecoParams)
FETCH_PAYLOAD_CASE(CastorSaturationCorrs)
FETCH_PAYLOAD_CASE(CentralityTable)
FETCH_PAYLOAD_CASE(DeDxCalibration)
FETCH_PAYLOAD_CASE(DTCCBConfig)
FETCH_PAYLOAD_CASE(DTDeadFlag)
FETCH_PAYLOAD_CASE(DTHVStatus)
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondDBImport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ namespace cond {
IMPORT_PAYLOAD_CASE(CastorRecoParams)
IMPORT_PAYLOAD_CASE(CastorSaturationCorrs)
IMPORT_PAYLOAD_CASE(CentralityTable)
IMPORT_PAYLOAD_CASE(DeDxCalibration)
IMPORT_PAYLOAD_CASE(DTCCBConfig)
IMPORT_PAYLOAD_CASE(DTDeadFlag)
IMPORT_PAYLOAD_CASE(DTHVStatus)
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
#include "CondFormats/PhysicsToolsObjects/interface/PerformancePayloadFromBinnedTFormula.h"
#include "CondFormats/PPSObjects/interface/TotemAnalysisMask.h"
#include "CondFormats/PPSObjects/interface/TotemDAQMapping.h"
#include "CondFormats/SiStripObjects/interface/DeDxCalibration.h"
#include "CondFormats/SiStripObjects/interface/SiStripConfObject.h"
#include "CondFormats/SiStripObjects/interface/SiStripLatency.h"
#include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h"
Expand Down
4 changes: 2 additions & 2 deletions CondFormats/DataRecord/interface/DeDxCalibrationRcd.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DEDXCALIBRATIONRCD_H
#define DEDXCALIBRATIONRCD_H
#ifndef CondFormats_DataRecord_DeDxCalibrationRcd_h
#define CondFormats_DataRecord_DeDxCalibrationRcd_h

#include "FWCore/Framework/interface/EventSetupRecordImplementation.h"
class DeDxCalibrationRcd : public edm::eventsetup::EventSetupRecordImplementation<DeDxCalibrationRcd> {};
Expand Down
5 changes: 3 additions & 2 deletions CondFormats/DataRecord/interface/SiStripCondDataRecords.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ class SiStripConfObjectRcd : public edm::eventsetup::EventSetupRecordImplementat
class SiStripApvSimulationParametersRcd
: public edm::eventsetup::EventSetupRecordImplementation<SiStripApvSimulationParametersRcd> {};

/*Record for dEdx calibration*/
class DeDxCalibrationRcd : public edm::eventsetup::EventSetupRecordImplementation<DeDxCalibrationRcd> {};

/*Records for upgrade */
class Phase2TrackerCablingRcd : public edm::eventsetup::EventSetupRecordImplementation<Phase2TrackerCablingRcd> {};

class DeDxCalibrationRcd : public edm::eventsetup::EventSetupRecordImplementation<DeDxCalibrationRcd> {};

#endif
4 changes: 2 additions & 2 deletions CondFormats/SiStripObjects/interface/DeDxCalibration.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DEDXCALIBRATION_H
#define DEDXCALIBRATION_H
#ifndef CondFormats_SiStripObjects_DeDxCalibration_h
#define CondFormats_SiStripObjects_DeDxCalibration_h
#include "CondFormats/Serialization/interface/Serializable.h"

#include <vector>
Expand Down
4 changes: 2 additions & 2 deletions RecoTracker/DeDx/interface/LikelihoodFitDeDxEstimator.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _LikelihoodFitDeDxEstimator_h_
#define _LikelihoodFitDeDxEstimator_h_
#ifndef RecoTracker_DeDx_LikelihoodFitDeDxEstimator_h
#define RecoTracker_DeDx_LikelihoodFitDeDxEstimator_h

#include "RecoTracker/DeDx/interface/BaseDeDxEstimator.h"
#include "DataFormats/TrackReco/interface/DeDxHit.h"
Expand Down
2 changes: 1 addition & 1 deletion RecoTracker/DeDx/plugins/DeDxCalibrationDbCreator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class DeDxCalibrationDbCreator : public edm::one::EDAnalyzer<edm::one::SharedResources> {
public:
typedef std::pair<uint32_t, unsigned char> ChipId;
enum AllDetector { PXB = 0, PXF = 1, TIB = 2, TID = 3, TOB = 4, TEC3 = 5, TEC5 = 6, nDets };
enum AllDetector { PXB = 0, PXF = 1, TIB = 2, TID = 3, TOB = 4, TECThin = 5, TECThick = 6, nDets };

explicit DeDxCalibrationDbCreator(const edm::ParameterSet&);
~DeDxCalibrationDbCreator() override{};
Expand Down
15 changes: 9 additions & 6 deletions RecoTracker/DeDx/plugins/DeDxHitCalibrator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class DeDxHitCalibrator : public edm::stream::EDProducer<> {
public:
enum { isNormal, isBelow, isOver };
enum AllDetector { PXB = 0, PXF = 1, TIB = 2, TID = 3, TOB = 4, TEC3 = 5, TEC5 = 6, nDets };
enum AllDetector { PXB = 0, PXF = 1, TIB = 2, TID = 3, TOB = 4, TECThin = 5, TECThick = 6, nDets };
typedef std::pair<uint32_t, unsigned char> ChipId;

explicit DeDxHitCalibrator(const edm::ParameterSet&);
Expand Down Expand Up @@ -52,6 +52,7 @@ class DeDxHitCalibrator : public edm::stream::EDProducer<> {
std::pair<double, double> fitStripCluster(const std::vector<std::pair<double, int> >&, const double&, const double&);

const bool applyGain_;
const double MeVPerElectron_;
const edm::EDGetTokenT<reco::TrackCollection> tracksToken_;
const edm::EDGetTokenT<reco::DeDxHitInfoAss> dedxHitInfoToken_;
const edm::ESGetToken<DeDxCalibration, DeDxCalibrationRcd> dedxCalibToken_;
Expand All @@ -63,6 +64,7 @@ class DeDxHitCalibrator : public edm::stream::EDProducer<> {

DeDxHitCalibrator::DeDxHitCalibrator(const edm::ParameterSet& iConfig)
: applyGain_(iConfig.getParameter<bool>("applyGain")),
MeVPerElectron_(iConfig.getParameter<double>("MeVPerElectron")),
tracksToken_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("trackProducer"))),
dedxHitInfoToken_(consumes<reco::DeDxHitInfoAss>(iConfig.getParameter<edm::InputTag>("dedxHitInfo"))),
dedxCalibToken_(esConsumes<DeDxCalibration, DeDxCalibrationRcd, edm::Transition::BeginRun>()),
Expand All @@ -75,6 +77,7 @@ DeDxHitCalibrator::DeDxHitCalibrator(const edm::ParameterSet& iConfig)
void DeDxHitCalibrator::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<bool>("applyGain", true);
desc.add<double>("MeVPerElectron", 3.61e-06);
desc.add<edm::InputTag>("trackProducer", edm::InputTag("generalTracks"));
desc.add<edm::InputTag>("dedxHitInfo", edm::InputTag("dedxHitInfo"));
descriptions.add("dedxHitCalibrator", desc);
Expand Down Expand Up @@ -146,8 +149,8 @@ void DeDxHitCalibrator::processHitInfo(const reco::DeDxHitInfo& info,
// Fit
const auto& result = fitStripCluster(b, dedxCalib_->alpha[det], 1. / dedxCalib_->sigma[det]);
// ADC -> e- -> MeV
const auto& energy = correctEnergy(result.first * 217 * 3.61e-6, chipId);
const auto& esigma = correctEnergy(result.second * 217 * 3.61e-6, chipId);
const auto& energy = correctEnergy(result.first * 217 * MeVPerElectron_, chipId);
const auto& esigma = correctEnergy(result.second * 217 * MeVPerElectron_, chipId);
// Compute charge
const auto& charge = pathLength != 0. ? energy / pathLength : 0.;
stripHits.emplace_back(charge, trackMomentum, pathLength, 0, esigma);
Expand All @@ -164,7 +167,7 @@ void DeDxHitCalibrator::processHitInfo(const reco::DeDxHitInfo& info,
bool isSaturated(false);
for (size_t j = 0; j < pixelCluster->pixelADC().size(); j++) {
const auto& elec = pixelCluster->pixelADC()[j];
delta += elec * 3.61e-6;
delta += elec * MeVPerElectron_;
// ( pos , (x , y) )
const auto& row = pixelCluster->minPixelRow() + pixelCluster->pixelOffset()[2 * j];
const auto& col = pixelCluster->minPixelCol() + pixelCluster->pixelOffset()[2 * j + 1];
Expand Down Expand Up @@ -195,8 +198,8 @@ void DeDxHitCalibrator::processHitInfo(const reco::DeDxHitInfo& info,
/*****************************************************************************/
int DeDxHitCalibrator::getDetId(const uint32_t& id, const float& thickness) {
const auto& subdet = int((id >> 25) & 0x7) - 1;
if (subdet == TEC3 && thickness > 400e-4)
return TEC5;
if (subdet == TECThin && thickness > 400e-4)
return TECThick;
return subdet;
}

Expand Down

0 comments on commit d503705

Please sign in to comment.