CMS 3D CMS Logo

Phase2ITRecHitHarvester.cc
Go to the documentation of this file.
12 public:
14  ~Phase2ITRecHitHarvester() override;
15  void dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) override;
16 
17  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
18 
19 private:
20  void gausFitslices(MonitorElement* srcME, MonitorElement* meanME, MonitorElement* sigmaME);
21  void dofitsForLayer(const std::string& iFolder, DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter);
22 
23  // ----------member data ---------------------------
26  const unsigned int nbarrelLayers_;
27  const unsigned int ndisk1Rings_; //FOR IT epix//FOR OT TEDD1 rings
28  const unsigned int ndisk2Rings_; //FOR IT epix//FOR OT TEDD2 rings
29  const unsigned int fitThreshold_;
30  const std::string ecapdisk1Name_; //FOR IT Epix//FOR OT TEDD_1
31  const std::string ecapdisk2Name_; //FOR IT Fpix//FOR OT TEDD_2
37 };
38 
40  : config_(iConfig),
41  topFolder_(iConfig.getParameter<std::string>("TopFolder")),
42  nbarrelLayers_(iConfig.getParameter<uint32_t>("NbarrelLayers")),
43  ndisk1Rings_(iConfig.getParameter<uint32_t>("NDisk1Rings")),
44  ndisk2Rings_(iConfig.getParameter<uint32_t>("NDisk2Rings")),
45  fitThreshold_(iConfig.getParameter<uint32_t>("NFitThreshold")),
46  ecapdisk1Name_(iConfig.getParameter<std::string>("EcapDisk1Name")),
47  ecapdisk2Name_(iConfig.getParameter<std::string>("EcapDisk2Name")),
48  deltaXvsEtaname_(iConfig.getParameter<std::string>("ResidualXvsEta")),
49  deltaXvsPhiname_(iConfig.getParameter<std::string>("ResidualXvsPhi")),
50  deltaYvsEtaname_(iConfig.getParameter<std::string>("ResidualYvsEta")),
51  deltaYvsPhiname_(iConfig.getParameter<std::string>("ResidualYvsPhi")) {}
52 
54 
56  for (unsigned int i = 1; i <= nbarrelLayers_; i++) {
57  std::string iFolder = topFolder_ + "/Barrel/Layer" + std::to_string(i);
58  dofitsForLayer(iFolder, ibooker, igetter);
59  }
60  for (unsigned int iSide = 1; iSide <= 2; iSide++) {
61  const std::string ecapbasedisk1 =
62  topFolder_ + "/EndCap_Side" + std::to_string(iSide) + "/" + ecapdisk1Name_ + "/Ring";
63  const std::string ecapbasedisk2 =
64  topFolder_ + "/EndCap_Side" + std::to_string(iSide) + "/" + ecapdisk2Name_ + "/Ring";
65  //EPix or TEDD_1
66  for (unsigned int epixr = 1; epixr <= ndisk1Rings_; epixr++) {
67  std::string iFolder = ecapbasedisk1 + std::to_string(epixr);
68  dofitsForLayer(iFolder, ibooker, igetter);
69  }
70  //FPix or TEDD_2
71  for (unsigned int fpixr = 1; fpixr <= ndisk2Rings_; fpixr++) {
72  std::string iFolder = ecapbasedisk2 + std::to_string(fpixr);
73  dofitsForLayer(iFolder, ibooker, igetter);
74  }
75  }
76 }
77 //Function for Layer/Ring
79  DQMStore::IBooker& ibooker,
80  DQMStore::IGetter& igetter) {
81  MonitorElement* deltaX_eta = igetter.get(iFolder + "/" + deltaXvsEtaname_);
82  MonitorElement* deltaX_phi = igetter.get(iFolder + "/" + deltaXvsPhiname_);
83  MonitorElement* deltaY_eta = igetter.get(iFolder + "/" + deltaYvsEtaname_);
84  MonitorElement* deltaY_phi = igetter.get(iFolder + "/" + deltaYvsPhiname_);
85 
86  std::string resFolder = iFolder + "/ResolutionFromFit/";
87 
88  ibooker.cd();
89  ibooker.setCurrentFolder(resFolder);
90  MonitorElement* sigmaX_eta =
92  MonitorElement* meanX_eta =
94 
95  gausFitslices(deltaX_eta, meanX_eta, sigmaX_eta);
96 
97  MonitorElement* sigmaY_eta =
99  MonitorElement* meanY_eta =
101  gausFitslices(deltaY_eta, meanY_eta, sigmaY_eta);
102 
103  MonitorElement* sigmaX_phi =
105  MonitorElement* meanX_phi =
107  gausFitslices(deltaX_phi, meanX_phi, sigmaX_phi);
108 
109  MonitorElement* sigmaY_phi =
111  MonitorElement* meanY_phi =
113  gausFitslices(deltaY_phi, meanY_phi, sigmaY_phi);
114 }
116  TH2F* histo = srcME->getTH2F();
117 
118  // Fit slices projected along Y from bins in X
119  const unsigned int cont_min = fitThreshold_; //Minimum number of entries
120  for (int i = 1; i <= srcME->getNbinsX(); i++) {
121  TString iString(i);
122  TH1* histoY = histo->ProjectionY(" ", i, i);
123  const unsigned int cont = histoY->GetEntries();
124 
125  if (cont >= cont_min) {
126  float minfit = histoY->GetMean() - histoY->GetRMS();
127  float maxfit = histoY->GetMean() + histoY->GetRMS();
128 
129  std::unique_ptr<TF1> fitFcn{new TF1(TString("g") + histo->GetName() + iString, "gaus", minfit, maxfit)};
130  histoY->Fit(fitFcn.get(), "QR0 SERIAL", "", minfit, maxfit);
131 
132  double* par = fitFcn->GetParameters();
133  const double* err = fitFcn->GetParErrors();
134 
135  meanME->setBinContent(i, par[1]);
136  meanME->setBinError(i, err[1]);
137 
138  sigmaME->setBinContent(i, par[2]);
139  sigmaME->setBinError(i, err[2]);
140 
141  if (histoY)
142  delete histoY;
143  } else {
144  if (histoY)
145  delete histoY;
146  continue;
147  }
148  }
149 }
150 
154  // phase2ITrechitHarvester
156  desc.add<std::string>("TopFolder", "TrackerPhase2ITRecHitV");
157  desc.add<unsigned int>("NbarrelLayers", 4);
158  desc.add<unsigned int>("NDisk1Rings", 5);
159  desc.add<unsigned int>("NDisk2Rings", 4);
160  desc.add<std::string>("EcapDisk1Name", "EPix");
161  desc.add<std::string>("EcapDisk2Name", "FPix");
162  desc.add<std::string>("ResidualXvsEta", "Delta_X_vs_Eta");
163  desc.add<std::string>("ResidualXvsPhi", "Delta_X_vs_Phi");
164  desc.add<std::string>("ResidualYvsEta", "Delta_Y_vs_Eta");
165  desc.add<std::string>("ResidualYvsPhi", "Delta_Y_vs_Phi");
166 
168  psd0.add<std::string>("name", "resolutionXFitvseta");
169  psd0.add<std::string>("title", ";|#eta|; X-Resolution from fit [#mum]");
170  psd0.add<int>("NxBins", 41);
171  psd0.add<double>("xmax", 4.1);
172  psd0.add<double>("xmin", 0.);
173  psd0.add<bool>("switch", true);
174  desc.add<edm::ParameterSetDescription>("resXvseta", psd0);
175 
177  psd1.add<std::string>("name", "resolutionYFitvseta");
178  psd1.add<std::string>("title", ";|#eta|; Y-Resolution from fit [#mum]");
179  psd1.add<int>("NxBins", 41);
180  psd1.add<double>("xmax", 4.1);
181  psd1.add<double>("xmin", 0.);
182  psd1.add<bool>("switch", true);
183  desc.add<edm::ParameterSetDescription>("resYvseta", psd1);
184 
186  psd2.add<std::string>("name", "resolutionXFitvsphi");
187  psd2.add<std::string>("title", ";#phi; X-Resolution from fit [#mum]");
188  psd2.add<int>("NxBins", 36);
189  psd2.add<double>("xmax", M_PI);
190  psd2.add<double>("xmin", -M_PI);
191  psd2.add<bool>("switch", true);
192  desc.add<edm::ParameterSetDescription>("resXvsphi", psd2);
193 
195  psd3.add<std::string>("name", "resolutionYFitvsphi");
196  psd3.add<std::string>("title", ";#phi; Y-Resolution from fit [#mum]");
197  psd3.add<int>("NxBins", 36);
198  psd3.add<double>("xmax", M_PI);
199  psd3.add<double>("xmin", -M_PI);
200  psd3.add<bool>("switch", true);
201  desc.add<edm::ParameterSetDescription>("resYvsphi", psd3);
202 
204  psd4.add<std::string>("name", "meanXFitvseta");
205  psd4.add<std::string>("title", ";|#eta|; Mean residual X from fit [#mum]");
206  psd4.add<int>("NxBins", 41);
207  psd4.add<double>("xmax", 4.1);
208  psd4.add<double>("xmin", 0.);
209  psd4.add<bool>("switch", true);
210  desc.add<edm::ParameterSetDescription>("meanXvseta", psd4);
211 
213  psd5.add<std::string>("name", "meanYFitvseta");
214  psd5.add<std::string>("title", ";|#eta|; Mean residual Y from fit [#mum]");
215  psd5.add<int>("NxBins", 41);
216  psd5.add<double>("xmax", 4.1);
217  psd5.add<double>("xmin", 0.);
218  psd5.add<bool>("switch", true);
219  desc.add<edm::ParameterSetDescription>("meanYvseta", psd5);
220 
222  psd6.add<std::string>("name", "meanXFitvsphi");
223  psd6.add<std::string>("title", ";#phi; Mean residual X from fit [#mum]");
224  psd6.add<int>("NxBins", 36);
225  psd6.add<double>("xmax", M_PI);
226  psd6.add<double>("xmin", -M_PI);
227  psd6.add<bool>("switch", true);
228  desc.add<edm::ParameterSetDescription>("meanXvsphi", psd6);
229 
231  psd7.add<std::string>("name", "meanYFitvsphi");
232  psd7.add<std::string>("title", ";#phi; Mean residual Y from fit [#mum]");
233  psd7.add<int>("NxBins", 36);
234  psd7.add<double>("xmax", M_PI);
235  psd7.add<double>("xmin", -M_PI);
236  psd7.add<bool>("switch", true);
237  desc.add<edm::ParameterSetDescription>("meanYvsphi", psd7);
238 
239  desc.add<unsigned int>("NFitThreshold", 100);
240 
241  descriptions.add("Phase2ITRechitHarvester", desc);
242  // or use the following to generate the label from the module's C++ type
243  //descriptions.addWithDefaultLabel(desc);
244 }
245 
246 //define this as a plug-in
ConfigurationDescriptions.h
DQMEDHarvester.h
Phase2ITRecHitHarvester::deltaXvsEtaname_
const std::string deltaXvsEtaname_
Definition: Phase2ITRecHitHarvester.cc:33
mps_fire.i
i
Definition: mps_fire.py:428
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
Phase2ITRecHitHarvester::histoPhiname_
const std::string histoPhiname_
Definition: Phase2ITRecHitHarvester.cc:32
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
Phase2ITRecHitHarvester::ecapdisk2Name_
const std::string ecapdisk2Name_
Definition: Phase2ITRecHitHarvester.cc:31
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:278
generateEDF.cont
cont
load Luminosity info ##
Definition: generateEDF.py:628
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
phase2tkharvestutil::book1DFromPSet
MonitorElement * book1DFromPSet(const edm::ParameterSet &hpars, DQMStore::IBooker &ibooker)
Definition: TrackerPhase2HarvestingUtil.cc:4
Phase2ITRecHitHarvester::deltaXvsPhiname_
const std::string deltaXvsPhiname_
Definition: Phase2ITRecHitHarvester.cc:34
Phase2ITRecHitHarvester::gausFitslices
void gausFitslices(MonitorElement *srcME, MonitorElement *meanME, MonitorElement *sigmaME)
Definition: Phase2ITRecHitHarvester.cc:115
Phase2ITRecHitHarvester::ndisk2Rings_
const unsigned int ndisk2Rings_
Definition: Phase2ITRecHitHarvester.cc:28
MakerMacros.h
Phase2ITRecHitHarvester::dqmEndJob
void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override
Definition: Phase2ITRecHitHarvester.cc:55
Phase2ITRecHitHarvester::topFolder_
const std::string topFolder_
Definition: Phase2ITRecHitHarvester.cc:25
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
Service.h
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
Phase2ITRecHitHarvester::config_
const edm::ParameterSet config_
Definition: Phase2ITRecHitHarvester.cc:24
Phase2ITRecHitHarvester::nbarrelLayers_
const unsigned int nbarrelLayers_
Definition: Phase2ITRecHitHarvester.cc:26
ParameterSetDescription.h
Phase2ITRecHitHarvester::Phase2ITRecHitHarvester
Phase2ITRecHitHarvester(const edm::ParameterSet &)
Definition: Phase2ITRecHitHarvester.cc:39
Phase2ITRecHitHarvester::ndisk1Rings_
const unsigned int ndisk1Rings_
Definition: Phase2ITRecHitHarvester.cc:27
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
Phase2ITRecHitHarvester::ecapdisk1Name_
const std::string ecapdisk1Name_
Definition: Phase2ITRecHitHarvester.cc:30
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
Phase2ITRecHitHarvester::fitThreshold_
const unsigned int fitThreshold_
Definition: Phase2ITRecHitHarvester.cc:29
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
TrackerPhase2HarvestingUtil.h
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Phase2ITRecHitHarvester::dofitsForLayer
void dofitsForLayer(const std::string &iFolder, DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
Definition: Phase2ITRecHitHarvester.cc:78
DQMEDHarvester
Definition: DQMEDHarvester.py:1
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:682
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
Phase2ITRecHitHarvester::deltaYvsEtaname_
const std::string deltaYvsEtaname_
Definition: Phase2ITRecHitHarvester.cc:35
Frameworkfwd.h
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::impl::MonitorElement::getNbinsX
virtual int getNbinsX() const
get # of bins in X-axis
Definition: MonitorElement.cc:565
dqm::impl::MonitorElement::setBinError
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
Definition: MonitorElement.cc:700
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Phase2ITRecHitHarvester
Definition: Phase2ITRecHitHarvester.cc:11
dqm::implementation::IBooker
Definition: DQMStore.h:43
Phase2ITRecHitHarvester::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: Phase2ITRecHitHarvester.cc:153
Phase2ITRecHitHarvester::~Phase2ITRecHitHarvester
~Phase2ITRecHitHarvester() override
Definition: Phase2ITRecHitHarvester.cc:53
ParameterSet.h
Phase2ITRecHitHarvester::deltaYvsPhiname_
const std::string deltaYvsPhiname_
Definition: Phase2ITRecHitHarvester.cc:36
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:491