19 #include <fmt/printf.h> 204 notInPCL_(iConfig.getParameter<
bool>(
"notInPCL")),
205 filename_(iConfig.getParameter<
std::
string>(
"fileName")),
207 ptmin_(iConfig.getParameter<double>(
"ptMin")),
208 normChi2Max_(iConfig.getParameter<double>(
"normChi2Max")),
209 clustSizeYMin_(iConfig.getParameter<
std::
vector<
int>>(
"clustSizeYMin")),
210 clustSizeXMax_(iConfig.getParameter<
int>(
"clustSizeXMax")),
211 residualMax_(iConfig.getParameter<double>(
"residualMax")),
212 clustChargeMaxPerLength_(iConfig.getParameter<double>(
"clustChargeMaxPerLength")),
213 hist_depth_(iConfig.getParameter<
int>(
"binsDepth")),
214 hist_drift_(iConfig.getParameter<
int>(
"binsDrift")),
230 std::make_unique<TTree>(
"SiPixelLorentzAngleTreeBarrel_",
"SiPixel LorentzAngle tree barrel", bufsize);
256 "x/F:y/F:charge/F:size_x/I:size_y/I:maxPixelCol/I:maxPixelRow:minPixelCol/I:minPixelRow/I",
267 std::make_unique<TTree>(
"SiPixelLorentzAngleTreeForward_",
"SiPixel LorentzAngle tree forward", bufsize);
294 "x/F:y/F:charge/F:size_x/I:size_y/I:maxPixelCol/I:maxPixelRow:minPixelCol/I:minPixelRow/I",
337 if (!trajTrackCollectionHandle->
empty()) {
339 it != trajTrackCollectionHandle->
end();
345 std::vector<TrajectoryMeasurement> tmColl = traj.
measurements();
360 bool pixeltrack =
false;
363 for (
const auto& itTraj : tmColl) {
364 if (!itTraj.updatedState().isValid())
369 unsigned int subDetID = (
recHit->geographicalId().subdetId());
385 float ypitch_ = topol->
pitch().second;
430 if (trackdirection.
z() == 0)
440 float cotalpha = trackdirection.
x() / trackdirection.
z();
441 float cotbeta = trackdirection.
y() / trackdirection.
z();
443 if (fabs(cotbeta) <= cotbeta_min)
445 double drdz =
sqrt(1. + cotalpha * cotalpha + cotbeta * cotbeta);
448 auto detId = detIdObj.
rawId();
449 int DetId_index = -1;
461 float locBx = (cotbeta < 0.) ? -1 : 1.;
462 float locBz = (cotalpha < 0.) ? -locBx : locBx;
465 theTemplate.
interpolate(TemplID, cotalpha, cotbeta, locBz, locBx);
486 bool large_pix =
false;
490 colpos % 52 == 0 || colpos % 52 == 51) {
499 double hypitch_ = ypitch_ / 2.;
516 if (ylim2 < ypixhigh)
521 if (ylim1 < ypixhigh)
524 float ypixavg = 0.5f * (ypixlow + ypixhigh);
531 if (isNewMod ==
false) {
540 int i_index_merge = i_index + 1;
547 int i_index_merge = i_index - 1;
613 if (trackdirection.
z() == 0)
622 float cotalpha = trackdirection.
x() / trackdirection.
z();
623 float cotbeta = trackdirection.
y() / trackdirection.
z();
625 auto detId = detIdObj.
rawId();
631 float locBx = (cotbeta < 0.) ? -1 : 1.;
632 float locBz = (cotalpha < 0.) ? -locBx : locBx;
635 theTemplate.
interpolate(TemplID, cotalpha, cotbeta, locBz, locBx);
670 <<
"Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " 671 << (*templateDBobject_).version();
689 if (modulename.find(
"BPix_") != std::string::npos) {
691 const auto& detId = bn.
getDetId(tTopo);
696 }
else if (modulename.find(
"FPix_") != std::string::npos) {
698 const auto& detId = en.
getDetId(tTopo);
716 "h_bySectorOccupancy",
"hit occupancy by sector;pixel sector;hits on track", maxSect, -0.5, maxSect - 0.5);
719 static constexpr
double min_depth_ = -100.;
720 static constexpr
double max_depth_ = 400.;
721 static constexpr
double min_drift_ = -500.;
722 static constexpr
double max_drift_ = 500.;
727 for (
int i_layer = 1; i_layer <=
iHists.
nlay; i_layer++) {
728 for (
int i_module = 1; i_module <=
iHists.
nModules_[i_layer - 1]; i_module++) {
729 unsigned int i_index = i_module + (i_layer - 1) *
iHists.
nModules_[i_layer - 1];
730 std::string binName = fmt::sprintf(
"BPix Lay%i Mod%i", i_layer, i_module);
731 LogDebug(
"SiPixelLorentzAnglePCLWorker") <<
" i_index: " << i_index <<
" bin name: " << binName
732 <<
" (i_layer: " << i_layer <<
" i_module:" << i_module <<
")";
736 sprintf(
name,
"h_mean_layer%i_module%i", i_layer, i_module);
738 "average drift vs depth layer%i module%i; production depth [#mum]; #LTdrift#GT [#mum]",
747 "average drift vs depth %s; production depth [#mum]; #LTdrift#GT [#mum]",
758 for (
int i_layer = 1; i_layer <=
iHists.
nlay; i_layer++) {
760 for (
int i_module = 1; i_module <=
iHists.
nModules_[i_layer - 1]; i_module++) {
761 unsigned int i_index = i_module + (i_layer - 1) *
iHists.
nModules_[i_layer - 1];
763 sprintf(
name,
"h_drift_depth_adc_layer%i_module%i", i_layer, i_module);
764 sprintf(
title,
"depth vs drift (ADC) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
768 sprintf(
name,
"h_drift_depth_adc2_layer%i_module%i", i_layer, i_module);
770 title,
"depth vs drift (ADC^{2}) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
774 sprintf(
name,
"h_drift_depth_noadc_layer%i_module%i", i_layer, i_module);
776 title,
"depth vs drift (no ADC) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
780 sprintf(
name,
"h_drift_depth_layer%i_module%i", i_layer, i_module);
781 sprintf(
title,
"depth vs drift layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
800 "depth vs drift (ADC^{2}) %s; drift [#mum]; production depth [#mum]",
807 "depth vs drift (no ADC)%s; drift [#mum]; production depth [#mum]",
840 const std::vector<SiPixelCluster::Pixel>& pixvector = LocPix.
pixels();
842 for (std::vector<SiPixelCluster::Pixel>::const_iterator itPix = pixvector.begin(); itPix != pixvector.end();
844 pixinfo.
row[pixinfo.
npix] = itPix->x;
845 pixinfo.
col[pixinfo.
npix] = itPix->y;
846 pixinfo.
adc[pixinfo.
npix] = itPix->adc;
848 pixinfo.
x[pixinfo.
npix] = lp.
x();
849 pixinfo.
y[pixinfo.
npix] = lp.
y();
862 std::pair<float, float> pixels_track = topol->
pixel(trackposition, localTrackAngles);
863 std::pair<float, float> pixels_rechit = topol->
pixel(recHitPix->
localPosition(), localTrackAngles);
869 std::pair<LocalPoint, LocalPoint> lps = std::make_pair(lp_track, lp_rechit);
876 desc.setComment(
"Worker module of the SiPixel Lorentz Angle PCL monitoring workflow");
877 desc.add<
std::string>(
"folder",
"AlCaReco/SiPixelLorentzAngle")->setComment(
"directory of PCL Worker output");
878 desc.add<
bool>(
"notInPCL",
false)->setComment(
"create TTree (true) or not (false)");
879 desc.add<
std::string>(
"fileName",
"testrun.root")->setComment(
"name of the TTree file if notInPCL = true");
880 desc.add<std::vector<std::string>>(
"newmodulelist", {})->setComment(
"the list of DetIds for new sensors");
882 desc.add<
double>(
"ptMin", 3.)->setComment(
"minimum pt on tracks");
883 desc.add<
double>(
"normChi2Max", 2.)->setComment(
"maximum reduced chi squared");
884 desc.add<std::vector<int>>(
"clustSizeYMin", {4, 3, 3, 2})
885 ->setComment(
"minimum cluster size on Y axis for all Barrel Layers");
886 desc.add<
int>(
"clustSizeXMax", 5)->setComment(
"maximum cluster size on X axis");
887 desc.add<
double>(
"residualMax", 0.005)->setComment(
"maximum residual");
888 desc.add<
double>(
"clustChargeMaxPerLength", 50000)
889 ->setComment(
"maximum cluster charge per unit length of pixel depth (z)");
890 desc.add<
int>(
"binsDepth", 50)->setComment(
"# bins for electron production depth axis");
891 desc.add<
int>(
"binsDrift", 100)->setComment(
"# bins for electron drift axis");
ClusterRef cluster() const
dqm::reco::MonitorElement * h_trackPt_
std::vector< int > BPixnewModule_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
unsigned int pxbLayer(const DetId &id) const
~SiPixelLorentzAnglePCLWorker() override=default
std::vector< SiPixelTemplateStore > thePixelTemp_
virtual std::pair< float, float > pixel(const LocalPoint &p) const =0
bool interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx)
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
LocalPoint localPosition() const
virtual void setCurrentFolder(std::string const &fullpath)
unsigned int pxfBlade(const DetId &id) const
friend struct const_iterator
std::vector< std::string > FPixnewmodulename_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoPerEventEsToken_
int bladeName() const
blade id
int moduleName() const
module id (index in z)
unsigned int pxfModule(const DetId &id) const
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomPerEventEsToken_
const LocalTrajectoryParameters & localParameters() const
edm::ESWatcher< SiPixelTemplateDBObjectESProducerRcd > watchSiPixelTemplateRcd_
std::vector< int > nModules_
unsigned int pxbLadder(const DetId &id) const
bool empty() const
return true if empty
Log< level::Error, false > LogError
MonitorMap h_drift_depth_
float r_qMeas_qTrue()
ratio of measured to true cluster charge
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< int > clustSizeYMin_
const Pixinfo fillPix(const SiPixelCluster &LocPix, const PixelTopology *topol) const
std::vector< int > FPixnewDetIds_
std::vector< unsigned int > BPixnewDetIds_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MonitorMap h_drift_depth_noadc_
DataContainer const & measurements() const
const_iterator end() const
last iterator over the map (read only)
const std::pair< LocalPoint, LocalPoint > surface_deformation(const PixelTopology *topol, TrajectoryStateOnSurface &tsos, const SiPixelRecHit *recHitPix) const
virtual float thickness() const =0
float qscale()
charge scaling factor
dqm::reco::MonitorElement * h_trackEta_
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
int ndof(bool bon=true) const
const SiPixelTemplateDBObject * templateDBobject_
int diskName() const
disk id
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
double clustChargeMaxPerLength_
const std::vector< Pixel > pixels() const
static constexpr float cmToum
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoEsToken_
LocalVector localDirection() const
std::unique_ptr< TTree > SiPixelLorentzAngleTreeBarrel_
unsigned int pxfDisk(const DetId &id) const
Tan< T >::type tan(const T &t)
std::vector< std::string > newmodulelist_
#define DEFINE_FWK_MODULE(type)
dqm::reco::MonitorElement * h_bySectOccupancy_
bool getData(T &iHolder) const
SiPixelLorentzAnglePCLWorker(const edm::ParameterSet &)
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
PXFDetId getDetId()
return DetId
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfSide(const DetId &id) const
const Plane & surface() const
The nominal surface of the GeomDet.
dqm::reco::MonitorElement * h_trackPhi_
constexpr uint32_t rawId() const
get the raw id
int layerName() const
layer id
dqm::reco::MonitorElement * h_tracks_
SiPixelLorentzAngleCalibrationHistograms iHists
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomEsToken_
short getTemplateID(const uint32_t &detid) const
MonitorMap h_drift_depth_adc_
std::vector< int > FPixnewBlade_
MonitorMap h_drift_depth_adc2_
bool check(const edm::EventSetup &iSetup)
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > &pixelTemp, std::string dir="CalibTracker/SiPixelESProducers/data/")
edm::ESGetToken< SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd > siPixelTemplateEsToken_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const_iterator begin() const
first iterator over the map (read only)
Pixel cluster – collection of neighboring pixels above threshold.
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
LocalPoint localPosition() const override
edm::EDGetTokenT< TrajTrackAssociationCollection > t_trajTrack
std::vector< std::string > BPixnewmodulename_
std::vector< int > FPixnewDisk_
virtual std::pair< float, float > pitch() const =0
std::vector< int > BPixnewLayer_
unsigned int pxbModule(const DetId &id) const
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::unique_ptr< TFile > hFile_
dqm::reco::MonitorElement * h_trackChi2_
PXBDetId getDetId()
return the DetId
void dqmEndRun(edm::Run const &, edm::EventSetup const &)
void analyze(edm::Event const &, edm::EventSetup const &) override
std::unique_ptr< TTree > SiPixelLorentzAngleTreeForward_
const Bounds & bounds() const
Point3DBase< float, LocalTag > Local3DPoint