38 const double lum = 2.0e34;
39 const double dabseta = 1.0;
40 const double dpt = 1.0;
41 const double afactor = 1.0e-34 * lum * dabseta * dpt;
42 const double a = 2 * 1.3084E6;
43 const double mu = -0.725;
44 const double sigma = 0.4333;
45 const double s2 = 2 * sigma * sigma;
48 ptlog10 = log10(pt_GeV);
49 double ex = (ptlog10 -
mu) * (ptlog10 -
mu) / s2;
50 double rate = (
a *
exp(-ex) * afactor);
74 simMuPtSpectrum =
new TH1F(
"simMuPtSpectrum",
"simMuPtSpectrum", 800, 0, 400);
77 edm::LogError(
"l1tOmtfEventPrint") <<
"simTracksTag not found !!!" << std::endl;
83 edm::LogVerbatim(
"l1tOmtfEventPrint") << __FUNCTION__ <<
": " << __LINE__ <<
" called!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " 85 for (
int patNum =
goldenPatterns.size() - 1; patNum >= 0; patNum--) {
89 <<
"cmsRun runThresholdCalc.py " << patNum <<
" " << (patNum + 1) <<
" _" <<
RPCConst::iptFromPt(
pt) <<
"_";
95 edm::LogVerbatim(
"l1tOmtfEventPrint") <<
" > out" << patNum <<
".txt" << std::endl;
101 std::unique_ptr<l1t::RegionalMuonCandBxCollection>& finalCandidates) {
126 gStyle->SetOptStat(111111);
129 <<
" outfile->GetName() " <<
outfile.GetName() <<
" writeLayerStat " 137 outfile.mkdir(
"patternsPdfs")->cd();
138 outfile.mkdir(
"patternsPdfs/canvases");
140 ostringstream ostrName;
141 ostringstream ostrTtle;
142 vector<TH1F*> classProbHists;
143 for (
unsigned int iRefLayer = 0; iRefLayer <
goldenPatterns[0]->getPdf()[0].size(); ++iRefLayer) {
145 ostrName <<
"Neg_RefLayer_" << iRefLayer;
147 ostrTtle <<
"Neg_RefLayer_" << iRefLayer;
148 classProbHists.push_back(
new TH1F(
152 ostrName <<
"Pos_RefLayer_" << iRefLayer;
154 ostrTtle <<
"Pos_RefLayer_" << iRefLayer;
155 classProbHists.push_back(
new TH1F(
161 if (
gp->key().thePt == 0)
165 ostrName <<
"PatNum_" <<
gp->key().theNumber;
167 ostrTtle <<
"PatNum_" <<
gp->key().theNumber <<
"_ptCode_" <<
gp->key().thePt <<
"_Pt_" << patternPt.
ptFrom <<
"_" 168 << patternPt.
ptTo <<
"_GeV";
169 TCanvas*
canvas =
new TCanvas(ostrName.str().c_str(), ostrTtle.str().c_str(), 1200, 1000);
170 canvas->Divide(
gp->getPdf().size(),
gp->getPdf()[0].size(), 0, 0);
172 for (
unsigned int iLayer = 0; iLayer <
gp->getPdf().size(); ++iLayer) {
173 for (
unsigned int iRefLayer = 0; iRefLayer <
gp->getPdf()[iLayer].size(); ++iRefLayer) {
174 canvas->cd(1 + iLayer + iRefLayer *
gp->getPdf().size());
176 ostrName <<
"PatNum_" <<
gp->key().theNumber <<
"_refLayer_" << iRefLayer <<
"_Layer_" << iLayer;
178 ostrTtle <<
"PatNum " <<
gp->key().theNumber <<
" ptCode " <<
gp->key().thePt <<
" refLayer " << iRefLayer
179 <<
" Layer " << iLayer <<
" meanDistPhi " <<
gp->meanDistPhi[iLayer][iRefLayer][0]
180 <<
" distPhiBitShift " 181 <<
gp->getDistPhiBitShift(iLayer, iRefLayer);
183 TH1F*
hist =
new TH1F(
185 for (
unsigned int iPdf = 0; iPdf <
gp->getPdf()[iLayer][iRefLayer].size(); iPdf++) {
186 hist->Fill(iPdf,
gp->pdfAllRef[iLayer][iRefLayer][iPdf]);
189 hist->SetLineColor(kGreen);
199 string histName =
"histLayerStat_" + ostrName.str();
200 unsigned int binCnt =
gp->getStatistics()[iLayer][iRefLayer].size();
201 TH1I* histLayerStat =
new TH1I(histName.c_str(), histName.c_str(), binCnt, -0.5, binCnt - 0.5);
202 for (
unsigned int iBin = 0; iBin < binCnt; iBin++) {
203 histLayerStat->Fill(iBin,
gp->getStatistics()[iLayer][iRefLayer][iBin][0]);
207 histLayerStat->Write();
211 outfile.cd(
"patternsPdfs/canvases");
216 for (
unsigned int iRefLayer = 0; iRefLayer <
gp->getPdf()[0].size(); ++iRefLayer) {
218 if (
gp->key().theCharge == -1) {
219 classProbHists[2 * iRefLayer]->Fill(
gp->key().theNumber,
gp->pdfAllRef[refLayerLogicNumber][iRefLayer][iPdf]);
221 classProbHists[2 * iRefLayer + 1]->Fill(
gp->key().theNumber,
222 gp->pdfAllRef[refLayerLogicNumber][iRefLayer][iPdf]);
227 for (
auto& classProbHist : classProbHists) {
228 classProbHist->Write();
Log< level::Info, true > LogVerbatim
~PatternOptimizerBase() override
T getParameter(std::string const &) const
AlgoMuons::value_type omtfCand
void writeGPs(const GoldenPatternVec< GoldenPatternType > &goldenPats, std::string fName)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
unsigned int getPatternNum(double pt, int charge) const
charge: -1 - negative, +1 - positive
static double vxIntegMuRate(double pt_GeV, double dpt, double etaFrom, double etaTo)
TH1I * simMuFoundByOmtfPt
const math::XYZTLorentzVectorD & momentum() const
int type() const
particle type (HEP PDT convension)
void observeEventEnd(const edm::Event &iEvent, std::unique_ptr< l1t::RegionalMuonCandBxCollection > &finalCandidates) override
virtual double getEventRateWeight(double pt)
static double vxMuRate(double pt_GeV)
Abs< T >::type abs(const T &t)
Log< level::Error, true > LogImportant
const std::vector< int > & getRefToLogicNumber() const
virtual void saveHists(TFile &outfile)
std::vector< std::unique_ptr< GoldenPatternType > > GoldenPatternVec
GoldenPatternVec< GoldenPatternWithStat > & goldenPatterns
PatternPt getPatternPtRange(unsigned int patNum) const
PatternOptimizerBase(const edm::ParameterSet &edmCfg, const OMTFConfiguration *omtfConfig, GoldenPatternVec< GoldenPatternWithStat > &gps)
void savePatternsInRoot(std::string rootFileName)
static int iptFromPt(const double pt)
unsigned int nPdfBins() const
const OMTFConfiguration * omtfConfig