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",
312 static constexpr
float cmToum = 10000.;
339 if (!trajTrackCollectionHandle->
empty()) {
341 it != trajTrackCollectionHandle->
end();
347 std::vector<TrajectoryMeasurement> tmColl = traj.
measurements();
362 bool pixeltrack =
false;
365 for (
const auto& itTraj : tmColl) {
366 if (!itTraj.updatedState().isValid())
371 unsigned int subDetID = (
recHit->geographicalId().subdetId());
387 float ypitch_ = topol->
pitch().second;
432 if (trackdirection.
z() == 0)
442 float cotalpha = trackdirection.
x() / trackdirection.
z();
443 float cotbeta = trackdirection.
y() / trackdirection.
z();
445 if (fabs(cotbeta) <= cotbeta_min)
447 double drdz =
sqrt(1. + cotalpha * cotalpha + cotbeta * cotbeta);
450 auto detId = detIdObj.
rawId();
451 int DetId_index = -1;
463 float locBx = (cotbeta < 0.) ? -1 : 1.;
464 float locBz = (cotalpha < 0.) ? -locBx : locBx;
467 theTemplate.
interpolate(TemplID, cotalpha, cotbeta, locBz, locBx);
488 bool large_pix =
false;
492 colpos % 52 == 0 || colpos % 52 == 51) {
501 double hypitch_ = ypitch_ / 2.;
518 if (ylim2 < ypixhigh)
523 if (ylim1 < ypixhigh)
526 float ypixavg = 0.5f * (ypixlow + ypixhigh);
529 float dy = (ypixavg - ylim1) *
cmToum;
533 if (isNewMod ==
false) {
542 int i_index_merge = i_index + 1;
549 int i_index_merge = i_index - 1;
615 if (trackdirection.
z() == 0)
624 float cotalpha = trackdirection.
x() / trackdirection.
z();
625 float cotbeta = trackdirection.
y() / trackdirection.
z();
627 auto detId = detIdObj.
rawId();
633 float locBx = (cotbeta < 0.) ? -1 : 1.;
634 float locBz = (cotalpha < 0.) ? -locBx : locBx;
637 theTemplate.
interpolate(TemplID, cotalpha, cotbeta, locBz, locBx);
672 <<
"Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " 673 << (*templateDBobject_).version();
691 if (modulename.find(
"BPix_") != std::string::npos) {
693 const auto& detId = bn.
getDetId(tTopo);
698 }
else if (modulename.find(
"FPix_") != std::string::npos) {
700 const auto& detId = en.
getDetId(tTopo);
718 "h_bySectorOccupancy",
"hit occupancy by sector;pixel sector;hits on track", maxSect, -0.5, maxSect - 0.5);
721 static constexpr
double min_depth_ = -100.;
722 static constexpr
double max_depth_ = 400.;
723 static constexpr
double min_drift_ = -500.;
724 static constexpr
double max_drift_ = 500.;
729 for (
int i_layer = 1; i_layer <=
iHists.
nlay; i_layer++) {
730 for (
int i_module = 1; i_module <=
iHists.
nModules_[i_layer - 1]; i_module++) {
731 unsigned int i_index = i_module + (i_layer - 1) *
iHists.
nModules_[i_layer - 1];
732 std::string binName = fmt::sprintf(
"BPix Lay%i Mod%i", i_layer, i_module);
733 LogDebug(
"SiPixelLorentzAnglePCLWorker") <<
" i_index: " << i_index <<
" bin name: " << binName
734 <<
" (i_layer: " << i_layer <<
" i_module:" << i_module <<
")";
738 sprintf(
name,
"h_mean_layer%i_module%i", i_layer, i_module);
740 "average drift vs depth layer%i module%i; production depth [#mum]; #LTdrift#GT [#mum]",
749 "average drift vs depth %s; production depth [#mum]; #LTdrift#GT [#mum]",
760 for (
int i_layer = 1; i_layer <=
iHists.
nlay; i_layer++) {
762 for (
int i_module = 1; i_module <=
iHists.
nModules_[i_layer - 1]; i_module++) {
763 unsigned int i_index = i_module + (i_layer - 1) *
iHists.
nModules_[i_layer - 1];
765 sprintf(
name,
"h_drift_depth_adc_layer%i_module%i", i_layer, i_module);
766 sprintf(
title,
"depth vs drift (ADC) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
770 sprintf(
name,
"h_drift_depth_adc2_layer%i_module%i", i_layer, i_module);
772 title,
"depth vs drift (ADC^{2}) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
776 sprintf(
name,
"h_drift_depth_noadc_layer%i_module%i", i_layer, i_module);
778 title,
"depth vs drift (no ADC) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
782 sprintf(
name,
"h_drift_depth_layer%i_module%i", i_layer, i_module);
783 sprintf(
title,
"depth vs drift layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
802 "depth vs drift (ADC^{2}) %s; drift [#mum]; production depth [#mum]",
809 "depth vs drift (no ADC)%s; drift [#mum]; production depth [#mum]",
842 const std::vector<SiPixelCluster::Pixel>& pixvector = LocPix.
pixels();
844 for (std::vector<SiPixelCluster::Pixel>::const_iterator itPix = pixvector.begin(); itPix != pixvector.end();
846 pixinfo.
row[pixinfo.
npix] = itPix->x;
847 pixinfo.
col[pixinfo.
npix] = itPix->y;
848 pixinfo.
adc[pixinfo.
npix] = itPix->adc;
850 pixinfo.
x[pixinfo.
npix] = lp.
x();
851 pixinfo.
y[pixinfo.
npix] = lp.
y();
864 std::pair<float, float> pixels_track = topol->
pixel(trackposition, localTrackAngles);
865 std::pair<float, float> pixels_rechit = topol->
pixel(recHitPix->
localPosition(), localTrackAngles);
871 std::pair<LocalPoint, LocalPoint> lps = std::make_pair(lp_track, lp_rechit);
878 desc.setComment(
"Worker module of the SiPixel Lorentz Angle PCL monitoring workflow");
879 desc.add<
std::string>(
"folder",
"AlCaReco/SiPixelLorentzAngle")->setComment(
"directory of PCL Worker output");
880 desc.add<
bool>(
"notInPCL",
false)->setComment(
"create TTree (true) or not (false)");
881 desc.add<
std::string>(
"fileName",
"testrun.root")->setComment(
"name of the TTree file if notInPCL = true");
882 desc.add<std::vector<std::string>>(
"newmodulelist", {})->setComment(
"the list of DetIds for new sensors");
884 desc.add<
double>(
"ptMin", 3.)->setComment(
"minimum pt on tracks");
885 desc.add<
double>(
"normChi2Max", 2.)->setComment(
"maximum reduced chi squared");
886 desc.add<std::vector<int>>(
"clustSizeYMin", {4, 3, 3, 2})
887 ->setComment(
"minimum cluster size on Y axis for all Barrel Layers");
888 desc.add<
int>(
"clustSizeXMax", 5)->setComment(
"maximum cluster size on X axis");
889 desc.add<
double>(
"residualMax", 0.005)->setComment(
"maximum residual");
890 desc.add<
double>(
"clustChargeMaxPerLength", 50000)
891 ->setComment(
"maximum cluster charge per unit length of pixel depth (z)");
892 desc.add<
int>(
"binsDepth", 50)->setComment(
"# bins for electron production depth axis");
893 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_
#define DEFINE_FWK_MODULE(type)
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
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_
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())
static constexpr float cmToum
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