Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce PCL-like workflows for SiStrip Lorentz Angle Monitoring (and potentially calibration) #42574

Merged
merged 3 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#ifndef CalibTracker_SiStripLorentzAngle_SiStripLorentzAngleCalibrationHelper_h
#define CalibTracker_SiStripLorentzAngle_SiStripLorentzAngleCalibrationHelper_h

// user includes
#include "CondFormats/SiStripObjects/interface/SiStripLatency.h"
#include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"

// system includes
#include <string>

// for ROOT
#include "TString.h"
#include "TFitResult.h"
#include "TF1.h"

namespace siStripLACalibration {

inline std::string moduleLocationType(const uint32_t& mod, const TrackerTopology* tTopo) {
const SiStripDetId detid(mod);
std::string subdet = "";
unsigned int layer = 0;
if (detid.subDetector() == SiStripDetId::TIB) {
subdet = "TIB";
layer = tTopo->layer(mod);
}

if (detid.subDetector() == SiStripDetId::TOB) {
subdet = "TOB";
layer = tTopo->layer(mod);
}

std::string type = (detid.stereo() ? "s" : "a");
std::string d_l_t = Form("%s_L%d%s", subdet.c_str(), layer, type.c_str());

if (layer == 0)
return subdet;
return d_l_t;
}

// SiStripLatency::singleReadOutMode() returns
// 1: all in peak, 0: all in deco, -1: mixed state
enum { k_DeconvolutionMode = 0, k_PeakMode = 1 };

//_____________________________________________________________________
inline const std::string fieldAsString(const float& inputField) {
std::string theMagFieldStr = std::to_string(inputField);
size_t dotPosition = theMagFieldStr.find('.');
if (dotPosition != std::string::npos) {
theMagFieldStr = theMagFieldStr.substr(0, dotPosition + 2); // +2 to include one decimal place
}
return theMagFieldStr;
}

//_____________________________________________________________________
inline const std::string apvModeAsString(const SiStripLatency* latency) {
if (latency) {
switch (latency->singleReadOutMode()) {
case k_PeakMode:
return "PEAK"; // peak mode
case k_DeconvolutionMode:
return "DECO"; // deco mode
default:
return "UNDEF"; // undefined
}
} else {
return "UNDEF";
}
}

//_____________________________________________________________________
inline double fitFunction(double* x, double* par) {
double a = par[0];
double thetaL = par[1];
double b = par[2];

double tanThetaL = std::tan(thetaL);
double value = a * std::abs(std::tan(x[0]) - tanThetaL) + b;

//TF1::RejectPoint(); // Reject points outside the fit range
return value;
}
} // namespace siStripLACalibration
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#ifndef CalibTracker_SiStripLorentzAngle_SiStripLorentzAngleCalibrationStruct_h
#define CalibTracker_SiStripLorentzAngle_SiStripLorentzAngleCalibrationStruct_h

// system includes
#include <map>
#include <vector>

// user includes
#include "DQMServices/Core/interface/DQMStore.h"

struct SiStripLorentzAngleCalibrationHistograms {
public:
SiStripLorentzAngleCalibrationHistograms() = default;

// B field
std::string bfield_;

// APV mode
std::string apvmode_;

std::map<uint32_t, int> orientation_;
std::map<uint32_t, float> la_db_;
std::map<uint32_t, std::string> moduleLocationType_;

// histogramming
std::map<std::string, dqm::reco::MonitorElement*> h1_;
std::map<std::string, dqm::reco::MonitorElement*> h2_;
std::map<std::string, dqm::reco::MonitorElement*> p_;

// These are vectors since std:map::find is expensive
// we're going to profi of the dense indexing offered by
// SiStripHashedDetId and index the histogram position
// with the natural booking order
std::vector<dqm::reco::MonitorElement*> h2_ct_w_m_;
std::vector<dqm::reco::MonitorElement*> h2_ct_var2_m_;
std::vector<dqm::reco::MonitorElement*> h2_ct_var3_m_;

std::vector<dqm::reco::MonitorElement*> h2_t_w_m_;
std::vector<dqm::reco::MonitorElement*> h2_t_var2_m_;
std::vector<dqm::reco::MonitorElement*> h2_t_var3_m_;

std::map<std::string, dqm::reco::MonitorElement*> hp_;

// info
std::map<std::string, int> nlayers_;
std::vector<std::string> modtypes_;
std::map<std::string, float> la_;
};

#endif
19 changes: 10 additions & 9 deletions CalibTracker/SiStripLorentzAngle/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<use name="CalibTracker/SiStripCommon"/>
<use name="CalibTracker/SiStripLorentzAngle"/>
<use name="CalibTracker/StandaloneTrackerTopology"/>
<use name="CondFormats/DataRecord"/>
<use name="CondFormats/SiStripObjects"/>
<use name="DQM/SiStripCommon"/>
<use name="DQMServices/Core"/>
<use name="DataFormats/Common"/>
<use name="DataFormats/GeometryVector"/>
<use name="DataFormats/TrackerRecHit2D"/>
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/ServiceRegistry"/>
<use name="Geometry/CommonDetUnit"/>
<use name="Geometry/CommonTopologies"/>
<use name="Geometry/Records"/>
<use name="Geometry/TrackerGeometryBuilder"/>
<use name="clhep"/>
<use name="rootcore"/>
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="CondFormats/DataRecord"/>
<use name="CondFormats/SiStripObjects"/>
<use name="CalibTracker/SiStripCommon"/>
<use name="CalibTracker/SiStripLorentzAngle"/>
<use name="CalibTracker/StandaloneTrackerTopology"/>
<use name="MagneticField/Engine"/>
<use name="RecoLocalTracker/SiStripClusterizer"/>
<use name="TrackingTools/PatternTools"/>
<use name="clhep"/>
<use name="rootcore"/>
<use name="rootgraphics"/>
<library file="*.cc" name="CalibTrackerSiStripLorentzAnglePlugins">
<flags EDM_PLUGIN="1"/>
Expand Down
Loading