19 #include <fmt/printf.h> 210 : analysisType_(convertStringToLorentzAngleAnalysisTypeEnum(iConfig.getParameter<
std::
string>(
"analysisType"))),
212 notInPCL_(iConfig.getParameter<
bool>(
"notInPCL")),
213 filename_(iConfig.getParameter<
std::
string>(
"fileName")),
215 ptmin_(iConfig.getParameter<double>(
"ptMin")),
216 normChi2Max_(iConfig.getParameter<double>(
"normChi2Max")),
217 clustSizeYMin_(iConfig.getParameter<
std::
vector<
int>>(
"clustSizeYMin")),
218 clustSizeXMax_(iConfig.getParameter<
int>(
"clustSizeXMax")),
219 residualMax_(iConfig.getParameter<double>(
"residualMax")),
220 clustChargeMaxPerLength_(iConfig.getParameter<double>(
"clustChargeMaxPerLength")),
221 hist_depth_(iConfig.getParameter<
int>(
"binsDepth")),
222 hist_drift_(iConfig.getParameter<
int>(
"binsDrift")),
238 std::make_unique<TTree>(
"SiPixelLorentzAngleTreeBarrel_",
"SiPixel LorentzAngle tree barrel", bufsize);
264 "x/F:y/F:charge/F:size_x/I:size_y/I:maxPixelCol/I:maxPixelRow:minPixelCol/I:minPixelRow/I",
275 std::make_unique<TTree>(
"SiPixelLorentzAngleTreeForward_",
"SiPixel LorentzAngle tree forward", bufsize);
302 "x/F:y/F:charge/F:size_x/I:size_y/I:maxPixelCol/I:maxPixelRow:minPixelCol/I:minPixelRow/I",
348 if (!trajTrackCollectionHandle->
empty()) {
350 it != trajTrackCollectionHandle->
end();
356 std::vector<TrajectoryMeasurement> tmColl = traj.
measurements();
371 bool pixeltrack =
false;
374 for (
const auto& itTraj : tmColl) {
375 if (!itTraj.updatedState().isValid())
380 unsigned int subDetID = (
recHit->geographicalId().subdetId());
396 float ypitch_ = topol->
pitch().second;
441 if (trackdirection.
z() == 0)
451 float cotalpha = trackdirection.
x() / trackdirection.
z();
452 float cotbeta = trackdirection.
y() / trackdirection.
z();
454 if (
std::abs(cotbeta) <= cotbeta_min)
456 double drdz =
sqrt(1. + cotalpha * cotalpha + cotbeta * cotbeta);
459 auto detId = detIdObj.
rawId();
460 int DetId_index = -1;
472 float locBx = (cotbeta < 0.) ? -1 : 1.;
473 float locBz = (cotalpha < 0.) ? -locBx : locBx;
476 theTemplate.
interpolate(TemplID, cotalpha, cotbeta, locBz, locBx);
499 bool large_pix =
false;
503 colpos % 52 == 0 || colpos % 52 == 51) {
512 double hypitch_ = ypitch_ / 2.;
529 if (ylim2 < ypixhigh)
534 if (ylim1 < ypixhigh)
537 float ypixavg = 0.5f * (ypixlow + ypixhigh);
544 if (isNewMod ==
false) {
553 int i_index_merge = i_index + 1;
560 int i_index_merge = i_index - 1;
626 if (trackdirection.
z() == 0)
635 float cotalpha = trackdirection.
x() / trackdirection.
z();
636 float cotbeta = trackdirection.
y() / trackdirection.
z();
638 auto detId = detIdObj.
rawId();
644 float locBx = (cotbeta < 0.) ? -1 : 1.;
645 float locBz = (cotalpha < 0.) ? -locBx : locBx;
648 theTemplate.
interpolate(TemplID, cotalpha, cotbeta, locBz, locBx);
671 if (theMagField < 37 || theMagField > 39)
679 bool large_pix =
false;
683 colpos % 52 == 0 || colpos % 52 == 51) {
697 int ringIdx =
bladeF_ <= 22 ? 0 : 1;
735 <<
"Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " 736 << (*templateDBobject_).version();
754 if (modulename.find(
"BPix_") != std::string::npos) {
756 const auto& detId = bn.
getDetId(tTopo);
761 }
else if (modulename.find(
"FPix_") != std::string::npos) {
763 const auto& detId = en.
getDetId(tTopo);
784 "h_bySectorOccupancy",
"hit occupancy by sector;pixel sector;hits on track", maxSect, -0.5, maxSect - 0.5);
787 static constexpr
double min_depth_ = -100.;
788 static constexpr
double max_depth_ = 400.;
789 static constexpr
double min_drift_ = -500.;
790 static constexpr
double max_drift_ = 500.;
793 for (
int i_layer = 1; i_layer <=
iHists.
nlay; i_layer++) {
794 for (
int i_module = 1; i_module <=
iHists.
nModules_[i_layer - 1]; i_module++) {
795 unsigned int i_index = i_module + (i_layer - 1) *
iHists.
nModules_[i_layer - 1];
796 std::string binName = fmt::sprintf(
"BPix Lay%i Mod%i", i_layer, i_module);
797 LogDebug(
"SiPixelLorentzAnglePCLWorker") <<
" i_index: " << i_index <<
" bin name: " << binName
798 <<
" (i_layer: " << i_layer <<
" i_module:" << i_module <<
")";
802 name = fmt::sprintf(
"h_mean_layer%i_module%i", i_layer, i_module);
803 title = fmt::sprintf(
804 "average drift vs depth layer%i module%i; production depth [#mum]; #LTdrift#GT [#mum]", i_layer, i_module);
810 title = fmt::sprintf(
"average drift vs depth %s; production depth [#mum]; #LTdrift#GT [#mum]",
815 LogDebug(
"SiPixelLorentzAnglePCLWorker")
822 for (
int i_layer = 1; i_layer <=
iHists.
nlay; i_layer++) {
824 for (
int i_module = 1; i_module <=
iHists.
nModules_[i_layer - 1]; i_module++) {
825 unsigned int i_index = i_module + (i_layer - 1) *
iHists.
nModules_[i_layer - 1];
827 name = fmt::sprintf(
"h_drift_depth_adc_layer%i_module%i", i_layer, i_module);
828 title = fmt::sprintf(
829 "depth vs drift (ADC) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
833 name = fmt::sprintf(
"h_drift_depth_adc2_layer%i_module%i", i_layer, i_module);
834 title = fmt::sprintf(
835 "depth vs drift (ADC^{2}) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
839 name = fmt::sprintf(
"h_drift_depth_noadc_layer%i_module%i", i_layer, i_module);
840 title = fmt::sprintf(
841 "depth vs drift (no ADC) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
845 name = fmt::sprintf(
"h_drift_depth_layer%i_module%i", i_layer, i_module);
847 fmt::sprintf(
"depth vs drift layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
859 title = fmt::sprintf(
"depth vs drift (ADC) %s; drift [#mum]; production depth [#mum]",
865 title = fmt::sprintf(
"depth vs drift (ADC^{2}) %s; drift [#mum]; production depth [#mum]",
871 title = fmt::sprintf(
"depth vs drift (no ADC)%s; drift [#mum]; production depth [#mum]",
877 title = fmt::sprintf(
"depth vs drift %s; drift [#mum]; production depth [#mum]",
891 baseName = fmt::sprintf(
"R%d_P%d_z%d",
r + 1,
p + 1,
s + 1);
893 baseTitle = fmt::sprintf(
"Ring%d_Panel%d_z-",
r + 1,
p + 1);
895 baseTitle = fmt::sprintf(
"Ring%d_Panel%d_z+",
r + 1,
p + 1);
900 name = fmt::sprintf(
"%s_alphaMean", baseName);
901 title = fmt::sprintf(
"%s_alphaMean;cot(#alpha); Average cluster size x (pixel)", baseTitle);
903 name = fmt::sprintf(
"%s_betaMean", baseName);
904 title = fmt::sprintf(
"%s_betaMean;cot(#beta); Average cluster size y (pixel)", baseTitle);
914 baseName = fmt::sprintf(
"R%d_P%d_z%d",
r + 1,
p + 1,
s + 1);
916 baseTitle = fmt::sprintf(
"Ring%d_Panel%d_z-",
r + 1,
p + 1);
918 baseTitle = fmt::sprintf(
"Ring%d_Panel%d_z+",
r + 1,
p + 1);
923 name = fmt::sprintf(
"%s_alpha", baseName);
924 title = fmt::sprintf(
"%s_alpha;cot(#alpha); Cluster size x (pixel)", baseTitle);
926 name = fmt::sprintf(
"%s_beta", baseName);
927 title = fmt::sprintf(
"%s_beta;cot(#beta); Cluster size y (pixel) ", baseTitle);
929 for (
int m = 0;
m < 3; ++
m) {
930 name = fmt::sprintf(
"%s_B%d", baseName,
m);
931 char bComp =
m == 0 ?
'x' : (
m == 1 ?
'y' :
'z');
932 title = fmt::sprintf(
"%s_magField%d;B_{%c} [T];Entries", baseTitle,
m, bComp);
962 const std::vector<SiPixelCluster::Pixel>& pixvector = LocPix.
pixels();
964 for (std::vector<SiPixelCluster::Pixel>::const_iterator itPix = pixvector.begin(); itPix != pixvector.end();
966 pixinfo.
row[pixinfo.
npix] = itPix->x;
967 pixinfo.
col[pixinfo.
npix] = itPix->y;
968 pixinfo.
adc[pixinfo.
npix] = itPix->adc;
970 pixinfo.
x[pixinfo.
npix] = lp.
x();
971 pixinfo.
y[pixinfo.
npix] = lp.
y();
984 std::pair<float, float> pixels_track = topol->
pixel(trackposition, localTrackAngles);
985 std::pair<float, float> pixels_rechit = topol->
pixel(recHitPix->
localPosition(), localTrackAngles);
991 std::pair<LocalPoint, LocalPoint> lps = std::make_pair(lp_track, lp_rechit);
1003 desc.setComment(
"Worker module of the SiPixel Lorentz Angle PCL monitoring workflow");
1005 ->setComment(
"analysis type - GrazingAngle (default) or MinimumClusterSize");
1006 desc.add<
std::string>(
"folder",
"AlCaReco/SiPixelLorentzAngle")->setComment(
"directory of PCL Worker output");
1007 desc.add<
bool>(
"notInPCL",
false)->setComment(
"create TTree (true) or not (false)");
1008 desc.add<
std::string>(
"fileName",
"testrun.root")->setComment(
"name of the TTree file if notInPCL = true");
1009 desc.add<std::vector<std::string>>(
"newmodulelist", {})->setComment(
"the list of DetIds for new sensors");
1011 desc.add<
double>(
"ptMin", 3.)->setComment(
"minimum pt on tracks");
1012 desc.add<
double>(
"normChi2Max", 2.)->setComment(
"maximum reduced chi squared");
1013 desc.add<std::vector<int>>(
"clustSizeYMin", {4, 3, 3, 2})
1014 ->setComment(
"minimum cluster size on Y axis for all Barrel Layers");
1015 desc.add<
int>(
"clustSizeXMax", 5)->setComment(
"maximum cluster size on X axis");
1016 desc.add<
double>(
"residualMax", 0.005)->setComment(
"maximum residual");
1017 desc.add<
double>(
"clustChargeMaxPerLength", 50000)
1018 ->setComment(
"maximum cluster charge per unit length of pixel depth (z)");
1019 desc.add<
int>(
"binsDepth", 50)->setComment(
"# bins for electron production depth axis");
1020 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
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
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
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
std::vector< std::string > FPixnewmodulename_
MonitorMap h_fpixAngleSize_
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)
LocalPoint toLocal(const GlobalPoint &gp) const
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_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
unsigned int pxfDisk(const DetId &id) const
Tan< T >::type tan(const T &t)
std::vector< std::string > newmodulelist_
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
dqm::reco::MonitorElement * h_bySectOccupancy_
LorentzAngleAnalysisTypeEnum convertStringToLorentzAngleAnalysisTypeEnum(std::string type)
SiPixelLorentzAnglePCLWorker(const edm::ParameterSet &)
static constexpr int nRings_
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.
const PositionType & position() const
dqm::reco::MonitorElement * h_trackPhi_
static constexpr int nPanels_
constexpr uint32_t rawId() const
get the raw id
int layerName() const
layer id
dqm::reco::MonitorElement * h_tracks_
SiPixelLorentzAngleCalibrationHistograms iHists
LorentzAngleAnalysisTypeEnum
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_
static constexpr int betaStartIdx_
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.
static constexpr int nSides_
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
LocalPoint localPosition() const override
edm::EDGetTokenT< TrajTrackAssociationCollection > t_trajTrack
MonitorMap h_fpixMagField_[3]
std::vector< std::string > BPixnewmodulename_
int nominalValue() const
The nominal field value for this map in kGauss.
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())
LorentzAngleAnalysisTypeEnum analysisType_
std::unique_ptr< TFile > hFile_
dqm::reco::MonitorElement * h_trackChi2_
PXBDetId getDetId()
return the DetId
Power< A, B >::type pow(const A &a, const B &b)
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