CMS 3D CMS Logo

SiPixelPhase1MonitorTrackSoA.cc
Go to the documentation of this file.
1 // -*- C++ -*-
3 // Package: SiPixelPhase1MonitorTrackSoA
4 // Class: SiPixelPhase1MonitorTrackSoA
5 //
8 //
9 // Author: Suvankar Roy Chowdhury
10 //
20 // DQM Histograming
25 // for string manipulations
26 #include <fmt/printf.h>
27 
29 public:
31  ~SiPixelPhase1MonitorTrackSoA() override = default;
32  void bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) override;
33  void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
34  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
35 
36 private:
58 };
59 
60 //
61 // constructors
62 //
63 
65  tokenSoATrack_ = consumes<PixelTrackHeterogeneous>(iConfig.getParameter<edm::InputTag>("pixelTrackSrc"));
66  topFolderName_ = iConfig.getParameter<std::string>("topFolderName"); //"SiPixelHeterogeneous/PixelTrackSoA";
67  useQualityCut_ = iConfig.getParameter<bool>("useQualityCut");
69 }
70 
71 //
72 // -- Analyze
73 //
75  const auto& tsoaHandle = iEvent.getHandle(tokenSoATrack_);
76  if (!tsoaHandle.isValid()) {
77  edm::LogWarning("SiPixelPhase1MonitorTrackSoA") << "No Track SoA found \n returning!" << std::endl;
78  return;
79  }
80 
81  auto const& tsoa = *((tsoaHandle.product())->get());
82  auto maxTracks = tsoa.stride();
83  auto const* quality = tsoa.qualityData();
84  int32_t nTracks = 0;
85  int32_t nLooseAndAboveTracks = 0;
86 
87  for (int32_t it = 0; it < maxTracks; ++it) {
88  auto nHits = tsoa.nHits(it);
89  auto nLayers = tsoa.nLayers(it);
90  if (nHits == 0)
91  break; // this is a guard
92  float pt = tsoa.pt(it);
93  if (!(pt > 0.))
94  continue;
95 
96  // fill the quality for all tracks
97  pixelTrack::Quality qual = tsoa.quality(it);
98  hquality->Fill(int(qual));
99  nTracks++;
100 
101  if (useQualityCut_ && quality[it] < minQuality_)
102  continue;
103 
104  // fill parameters only for quality >= loose
105  float chi2 = tsoa.chi2(it);
106  float phi = tsoa.phi(it);
107  float zip = tsoa.zip(it);
108  float eta = tsoa.eta(it);
109  float tip = tsoa.tip(it);
110 
111  hchi2->Fill(chi2);
112  hChi2VsPhi->Fill(phi, chi2);
113  hChi2VsEta->Fill(eta, chi2);
114  hnHits->Fill(nHits);
120  hpt->Fill(pt);
121  heta->Fill(eta);
122  hphi->Fill(phi);
123  hz->Fill(zip);
124  htip->Fill(tip);
125  nLooseAndAboveTracks++;
126  }
128  hnLooseAndAboveTracks->Fill(nLooseAndAboveTracks);
129 }
130 
131 //
132 // -- Book Histograms
133 //
135  edm::Run const& iRun,
136  edm::EventSetup const& iSetup) {
137  iBook.cd();
139 
140  // clang-format off
141  std::string toRep = "Number of tracks";
142  hnTracks = iBook.book1D("nTracks", fmt::sprintf(";%s per event;#events",toRep), 1001, -0.5, 1000.5);
143  hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::sprintf(";%s (quality #geq loose) per event;#events",toRep), 1001, -0.5, 1000.5);
144 
145  toRep = "Number of all RecHits per track (quality #geq loose)";
146  hnHits = iBook.book1D("nRecHits", fmt::sprintf(";%s;#tracks",toRep), 15, -0.5, 14.5);
147  hnHitsVsPhi = iBook.bookProfile("nHitsPerTrackVsPhi", fmt::sprintf("%s vs track #phi;Track #phi;%s",toRep,toRep), 30, -M_PI, M_PI,0., 15.);
148  hnHitsVsEta = iBook.bookProfile("nHitsPerTrackVsEta", fmt::sprintf("%s vs track #eta;Track #eta;%s",toRep,toRep), 30, -3., 3., 0., 15.);
149 
150  toRep = "Number of all layers per track (quality #geq loose)";
151  hnLayers = iBook.book1D("nLayers", fmt::sprintf(";%s;#tracks",toRep), 15, -0.5, 14.5);
152  hnLayersVsPhi = iBook.bookProfile("nLayersPerTrackVsPhi", fmt::sprintf("%s vs track #phi;Track #phi;%s",toRep,toRep), 30, -M_PI, M_PI,0., 15.);
153  hnLayersVsEta = iBook.bookProfile("nLayersPerTrackVsEta", fmt::sprintf("%s vs track #eta;Track #eta;%s",toRep,toRep), 30, -3., 3., 0., 15.);
154 
155  toRep = "Track (quality #geq loose) #chi^{2}/ndof";
156  hchi2 = iBook.book1D("nChi2ndof", fmt::sprintf(";%s;#tracks",toRep), 40, 0., 20.);
157  hChi2VsPhi = iBook.bookProfile("nChi2ndofVsPhi", fmt::sprintf("%s vs track #phi;Track #phi;%s",toRep,toRep), 30, -M_PI, M_PI, 0., 20.);
158  hChi2VsEta = iBook.bookProfile("nChi2ndofVsEta", fmt::sprintf("%s vs track #eta;Track #eta;%s",toRep,toRep), 30, -3., 3., 0., 20.);
159  // clang-format on
160 
161  hpt = iBook.book1D("pt", ";Track (quality #geq loose) p_{T} [GeV];#tracks", 200, 0., 200.);
162  heta = iBook.book1D("eta", ";Track (quality #geq loose) #eta;#tracks", 30, -3., 3.);
163  hphi = iBook.book1D("phi", ";Track (quality #geq loose) #phi;#tracks", 30, -M_PI, M_PI);
164  hz = iBook.book1D("z", ";Track (quality #geq loose) z [cm];#tracks", 30, -30., 30.);
165  htip = iBook.book1D("tip", ";Track (quality #geq loose) TIP [cm];#tracks", 100, -0.5, 0.5);
166  hquality = iBook.book1D("quality", ";Track Quality;#tracks", 7, -0.5, 6.5);
167  uint i = 1;
168  for (const auto& q : pixelTrack::qualityName) {
169  hquality->setBinLabel(i, q, 1);
170  i++;
171  }
172 }
173 
175  // monitorpixelTrackSoA
177  desc.add<edm::InputTag>("pixelTrackSrc", edm::InputTag("pixelTracksSoA"));
178  desc.add<std::string>("topFolderName", "SiPixelHeterogeneous/PixelTrackSoA");
179  desc.add<bool>("useQualityCut", true);
180  desc.add<std::string>("minQuality", "loose");
181  descriptions.addWithDefaultLabel(desc);
182 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
Quality qualityByName(std::string const &name)
const std::string qualityName[qualitySize]
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void Fill(long long x)
SiPixelPhase1MonitorTrackSoA(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:224
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
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)
edm::EDGetTokenT< PixelTrackHeterogeneous > tokenSoATrack_
#define M_PI
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
Log< level::Warning, false > LogWarning
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
string quality
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
~SiPixelPhase1MonitorTrackSoA() override=default
Definition: Run.h:45