19 #include <fmt/printf.h> 211 : analysisType_(convertStringToLorentzAngleAnalysisTypeEnum(iConfig.getParameter<
std::
string>(
"analysisType"))),
213 notInPCL_(iConfig.getParameter<
bool>(
"notInPCL")),
214 filename_(iConfig.getParameter<
std::
string>(
"fileName")),
216 ptmin_(iConfig.getParameter<double>(
"ptMin")),
217 normChi2Max_(iConfig.getParameter<double>(
"normChi2Max")),
218 clustSizeYMin_(iConfig.getParameter<
std::
vector<
int>>(
"clustSizeYMin")),
219 clustSizeXMax_(iConfig.getParameter<
int>(
"clustSizeXMax")),
220 residualMax_(iConfig.getParameter<double>(
"residualMax")),
221 clustChargeMaxPerLength_(iConfig.getParameter<double>(
"clustChargeMaxPerLength")),
222 hist_depth_(iConfig.getParameter<
int>(
"binsDepth")),
223 hist_drift_(iConfig.getParameter<
int>(
"binsDrift")),
240 std::make_unique<TTree>(
"SiPixelLorentzAngleTreeBarrel_",
"SiPixel LorentzAngle tree barrel", bufsize);
266 "x/F:y/F:charge/F:size_x/I:size_y/I:maxPixelCol/I:maxPixelRow:minPixelCol/I:minPixelRow/I",
277 std::make_unique<TTree>(
"SiPixelLorentzAngleTreeForward_",
"SiPixel LorentzAngle tree forward", bufsize);
304 "x/F:y/F:charge/F:size_x/I:size_y/I:maxPixelCol/I:maxPixelRow:minPixelCol/I:minPixelRow/I",
350 if (!trajTrackCollectionHandle->
empty()) {
352 it != trajTrackCollectionHandle->
end();
358 std::vector<TrajectoryMeasurement> tmColl = traj.
measurements();
373 bool pixeltrack =
false;
376 for (
const auto& itTraj : tmColl) {
377 if (!itTraj.updatedState().isValid())
382 unsigned int subDetID = (
recHit->geographicalId().subdetId());
398 float ypitch_ = topol->
pitch().second;
443 if (trackdirection.
z() == 0)
453 float cotalpha = trackdirection.
x() / trackdirection.
z();
454 float cotbeta = trackdirection.
y() / trackdirection.
z();
456 if (
std::abs(cotbeta) <= cotbeta_min)
458 double drdz =
sqrt(1. + cotalpha * cotalpha + cotbeta * cotbeta);
462 int DetId_index = -1;
474 float locBx = (cotbeta < 0.) ? -1 : 1.;
475 float locBz = (cotalpha < 0.) ? -locBx : locBx;
478 theTemplate.
interpolate(TemplID, cotalpha, cotbeta, locBz, locBx);
501 bool large_pix =
false;
505 colpos % 52 == 0 || colpos % 52 == 51) {
514 double hypitch_ = ypitch_ / 2.;
531 if (ylim2 < ypixhigh)
536 if (ylim1 < ypixhigh)
539 float ypixavg = 0.5f * (ypixlow + ypixhigh);
546 if (isNewMod ==
false) {
555 int i_index_merge = i_index + 1;
562 int i_index_merge = i_index - 1;
628 if (trackdirection.
z() == 0)
637 float cotalpha = trackdirection.
x() / trackdirection.
z();
638 float cotbeta = trackdirection.
y() / trackdirection.
z();
646 float locBx = (cotbeta < 0.) ? -1 : 1.;
647 float locBz = (cotalpha < 0.) ? -locBx : locBx;
650 theTemplate.
interpolate(TemplID, cotalpha, cotbeta, locBz, locBx);
673 if (theMagField < 37 || theMagField > 39)
681 bool large_pix =
false;
685 colpos % 52 == 0 || colpos % 52 == 51) {
699 int ringIdx =
bladeF_ <= 22 ? 0 : 1;
752 if (modulename.find(
"BPix_") != std::string::npos) {
759 }
else if (modulename.find(
"FPix_") != std::string::npos) {
782 "h_bySectorOccupancy",
"hit occupancy by sector;pixel sector;hits on track", maxSect, -0.5, maxSect - 0.5);
785 static constexpr
double min_depth_ = -100.;
786 static constexpr
double max_depth_ = 400.;
787 static constexpr
double min_drift_ = -500.;
788 static constexpr
double max_drift_ = 500.;
791 for (
int i_layer = 1; i_layer <=
iHists.
nlay; i_layer++) {
792 for (
int i_module = 1; i_module <=
iHists.
nModules_[i_layer - 1]; i_module++) {
793 unsigned int i_index = i_module + (i_layer - 1) *
iHists.
nModules_[i_layer - 1];
794 std::string binName = fmt::sprintf(
"BPix Lay%i Mod%i", i_layer, i_module);
795 LogDebug(
"SiPixelLorentzAnglePCLWorker") <<
" i_index: " << i_index <<
" bin name: " << binName
796 <<
" (i_layer: " << i_layer <<
" i_module:" << i_module <<
")";
800 name = fmt::sprintf(
"h_mean_layer%i_module%i", i_layer, i_module);
801 title = fmt::sprintf(
802 "average drift vs depth layer%i module%i; production depth [#mum]; #LTdrift#GT [#mum]", i_layer, i_module);
808 title = fmt::sprintf(
"average drift vs depth %s; production depth [#mum]; #LTdrift#GT [#mum]",
813 LogDebug(
"SiPixelLorentzAnglePCLWorker")
820 for (
int i_layer = 1; i_layer <=
iHists.
nlay; i_layer++) {
822 for (
int i_module = 1; i_module <=
iHists.
nModules_[i_layer - 1]; i_module++) {
823 unsigned int i_index = i_module + (i_layer - 1) *
iHists.
nModules_[i_layer - 1];
825 name = fmt::sprintf(
"h_drift_depth_adc_layer%i_module%i", i_layer, i_module);
826 title = fmt::sprintf(
827 "depth vs drift (ADC) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
831 name = fmt::sprintf(
"h_drift_depth_adc2_layer%i_module%i", i_layer, i_module);
832 title = fmt::sprintf(
833 "depth vs drift (ADC^{2}) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
837 name = fmt::sprintf(
"h_drift_depth_noadc_layer%i_module%i", i_layer, i_module);
838 title = fmt::sprintf(
839 "depth vs drift (no ADC) layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
843 name = fmt::sprintf(
"h_drift_depth_layer%i_module%i", i_layer, i_module);
845 fmt::sprintf(
"depth vs drift layer%i module%i; drift [#mum]; production depth [#mum]", i_layer, i_module);
857 title = fmt::sprintf(
"depth vs drift (ADC) %s; drift [#mum]; production depth [#mum]",
863 title = fmt::sprintf(
"depth vs drift (ADC^{2}) %s; drift [#mum]; production depth [#mum]",
869 title = fmt::sprintf(
"depth vs drift (no ADC)%s; drift [#mum]; production depth [#mum]",
875 title = fmt::sprintf(
"depth vs drift %s; drift [#mum]; production depth [#mum]",
889 baseName = fmt::sprintf(
"R%d_P%d_z%d",
r + 1,
p + 1,
s + 1);
891 baseTitle = fmt::sprintf(
"Ring%d_Panel%d_z-",
r + 1,
p + 1);
893 baseTitle = fmt::sprintf(
"Ring%d_Panel%d_z+",
r + 1,
p + 1);
898 name = fmt::sprintf(
"%s_alphaMean", baseName);
899 title = fmt::sprintf(
"%s_alphaMean;cot(#alpha); Average cluster size x (pixel)", baseTitle);
901 name = fmt::sprintf(
"%s_betaMean", baseName);
902 title = fmt::sprintf(
"%s_betaMean;cot(#beta); Average cluster size y (pixel)", baseTitle);
912 baseName = fmt::sprintf(
"R%d_P%d_z%d",
r + 1,
p + 1,
s + 1);
914 baseTitle = fmt::sprintf(
"Ring%d_Panel%d_z-",
r + 1,
p + 1);
916 baseTitle = fmt::sprintf(
"Ring%d_Panel%d_z+",
r + 1,
p + 1);
921 name = fmt::sprintf(
"%s_alpha", baseName);
922 title = fmt::sprintf(
"%s_alpha;cot(#alpha); Cluster size x (pixel)", baseTitle);
924 name = fmt::sprintf(
"%s_beta", baseName);
925 title = fmt::sprintf(
"%s_beta;cot(#beta); Cluster size y (pixel) ", baseTitle);
927 for (
int m = 0;
m < 3; ++
m) {
928 name = fmt::sprintf(
"%s_B%d", baseName,
m);
929 char bComp =
m == 0 ?
'x' : (
m == 1 ?
'y' :
'z');
930 title = fmt::sprintf(
"%s_magField%d;B_{%c} [T];Entries", baseTitle,
m, bComp);
960 const std::vector<SiPixelCluster::Pixel>& pixvector = LocPix.
pixels();
962 for (std::vector<SiPixelCluster::Pixel>::const_iterator itPix = pixvector.begin(); itPix != pixvector.end();
964 pixinfo.
row[pixinfo.
npix] = itPix->x;
965 pixinfo.
col[pixinfo.
npix] = itPix->y;
966 pixinfo.
adc[pixinfo.
npix] = itPix->adc;
968 pixinfo.
x[pixinfo.
npix] = lp.
x();
969 pixinfo.
y[pixinfo.
npix] = lp.
y();
982 std::pair<float, float> pixels_track = topol->
pixel(trackposition, localTrackAngles);
983 std::pair<float, float> pixels_rechit = topol->
pixel(recHitPix->
localPosition(), localTrackAngles);
989 std::pair<LocalPoint, LocalPoint> lps = std::make_pair(lp_track, lp_rechit);
1001 desc.setComment(
"Worker module of the SiPixel Lorentz Angle PCL monitoring workflow");
1003 ->setComment(
"analysis type - GrazingAngle (default) or MinimumClusterSize");
1004 desc.add<
std::string>(
"folder",
"AlCaReco/SiPixelLorentzAngle")->setComment(
"directory of PCL Worker output");
1005 desc.add<
bool>(
"notInPCL",
false)->setComment(
"create TTree (true) or not (false)");
1006 desc.add<
std::string>(
"fileName",
"testrun.root")->setComment(
"name of the TTree file if notInPCL = true");
1007 desc.add<std::vector<std::string>>(
"newmodulelist", {})->setComment(
"the list of DetIds for new sensors");
1009 desc.add<
double>(
"ptMin", 3.)->setComment(
"minimum pt on tracks");
1010 desc.add<
double>(
"normChi2Max", 2.)->setComment(
"maximum reduced chi squared");
1011 desc.add<std::vector<int>>(
"clustSizeYMin", {4, 3, 3, 2})
1012 ->setComment(
"minimum cluster size on Y axis for all Barrel Layers");
1013 desc.add<
int>(
"clustSizeXMax", 5)->setComment(
"maximum cluster size on X axis");
1014 desc.add<
double>(
"residualMax", 0.005)->setComment(
"maximum residual");
1015 desc.add<
double>(
"clustChargeMaxPerLength", 50000)
1016 ->setComment(
"maximum cluster charge per unit length of pixel depth (z)");
1017 desc.add<
int>(
"binsDepth", 50)->setComment(
"# bins for electron production depth axis");
1018 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
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< std::vector< SiPixelTemplateStore >, SiPixelTemplateDBObjectESProducerRcd > siPixelTemplateStoreEsToken_
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
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
const std::vector< SiPixelTemplateStore > * thePixelTemp_
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)
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
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