00001
00002
00003 #include "TMath.h"
00004 #include "TString.h"
00005 #include "DQM/HLTEvF/interface/TrigResRateMon.h"
00006 #include "FWCore/Common/interface/TriggerNames.h"
00007 #include "DataFormats/Scalers/interface/LumiScalers.h"
00008
00009 #include <map>
00010 #include <utility>
00011
00012
00013 using namespace edm;
00014 using namespace trigger;
00015 using namespace std;
00016
00017 TrigResRateMon::TrigResRateMon(const edm::ParameterSet& iConfig): currentRun_(-99)
00018 {
00019
00020 LogDebug("TrigResRateMon") << "constructor...." ;
00021
00022 fIsSetup = false;
00023
00024 dbe_ = Service < DQMStore > ().operator->();
00025 if ( ! dbe_ ) {
00026 LogInfo("TrigResRateMon") << "unabel to get DQMStore service?";
00027 }
00028 if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
00029 dbe_->setVerbose(0);
00030 }
00031
00032 dirname_ = iConfig.getUntrackedParameter("dirname", std::string("HLT/TrigResults/"));
00033
00034
00035 if (dbe_ != 0 ) {
00036 dbe_->setCurrentFolder(dirname_);
00037 }
00038
00039 doCombineRuns_ = iConfig.getUntrackedParameter<bool>("doCombineRuns", false);
00040 doVBTFMuon_ = iConfig.getUntrackedParameter<bool>("doVBTFMuon", true);
00041
00042 processname_ = iConfig.getParameter<std::string>("processname");
00043 fCustomBXPath = iConfig.getUntrackedParameter<std::string>("customBXPath", std::string("HLT_MinBiasBSC"));
00044
00045 referenceBX_ = iConfig.getUntrackedParameter<unsigned int>("referenceBX",51);
00046 Nbx_ = iConfig.getUntrackedParameter<unsigned int>("Nbx",3564);
00047
00048
00049 ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
00050 ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",1000.);
00051 nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",20);
00052 nBins2D_ = iConfig.getUntrackedParameter<unsigned int>("Nbins2D",40);
00053 dRMax_ = iConfig.getUntrackedParameter<double>("dRMax",1.0);
00054 dRMaxElectronMuon_ = iConfig.getUntrackedParameter<double>("dRMaxElectronMuon",0.3);
00055 nBinsDR_ = iConfig.getUntrackedParameter<unsigned int>("NbinsDR",10);
00056 nBinsOneOverEt_ = iConfig.getUntrackedParameter<unsigned int>("NbinsOneOverEt",10000);
00057 nLS_ = iConfig.getUntrackedParameter<unsigned int>("NLuminositySegments",10);
00058 LSsize_ = iConfig.getUntrackedParameter<double>("LuminositySegmentSize",23);
00059 thresholdFactor_ = iConfig.getUntrackedParameter<double>("thresholdFactor",1.0);
00060
00061
00062 plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
00063
00064 std::vector<edm::ParameterSet> paths =
00065 iConfig.getParameter<std::vector<edm::ParameterSet> >("paths");
00066
00067 for(std::vector<edm::ParameterSet>::iterator pathconf = paths.begin() ; pathconf != paths.end(); pathconf++) {
00068
00069 custompathnamepairs_.push_back(
00070 make_pair(
00071 pathconf->getParameter<std::string>("pathname"),
00072 pathconf->getParameter<std::string>("denompathname")
00073 )
00074 );
00075
00076 }
00077
00078 if (hltPaths_.size() > 0)
00079 {
00080
00081 scalersSelect = dbe_->book1D("selectedScalers","Selected Scalers", hltPaths_.size(), 0.0, (double)hltPaths_.size());
00082
00083 }
00084
00085 triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
00086 triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 sumEtMin_ = iConfig.getUntrackedParameter<double>("sumEtMin",10.0);
00139
00140
00141 dxyCut_ = iConfig.getUntrackedParameter<double>("DxyCut", 0.2);
00142 normalizedChi2Cut_ = iConfig.getUntrackedParameter<double>("NormalizedChi2Cut", 10.);
00143 trackerHitsCut_ = iConfig.getUntrackedParameter<int>("TrackerHitsCut", 11);
00144 pixelHitsCut_ = iConfig.getUntrackedParameter<int>("PixelHitsCut", 1);
00145 muonHitsCut_ = iConfig.getUntrackedParameter<int>("MuonHitsCut", 1);
00146 isAlsoTrackerMuon_ = iConfig.getUntrackedParameter<bool>("IsAlsoTrackerMuon", true);
00147 nMatchesCut_ = iConfig.getUntrackedParameter<int>("NMatchesCut", 2);
00148
00149 specialPaths_ = iConfig.getParameter<std::vector<std::string > >("SpecialPaths");
00150
00151 testPathsFolder_ = iConfig.getUntrackedParameter ("testPathsFolder",std::string("HLT/TrigResults/testPaths/"));
00152 pathsSummaryFolder_ = iConfig.getUntrackedParameter ("pathsSummaryFolder",std::string("HLT/TrigResults/PathsSummary/HLT Counts/"));
00153 pathsSummaryStreamsFolder_ = iConfig.getUntrackedParameter ("pathsSummaryFolder",std::string("HLT/TrigResults/PathsSummary/"));
00154
00155 pathsSummaryHLTCorrelationsFolder_ = iConfig.getUntrackedParameter ("hltCorrelationsFolder",std::string("HLT/TrigResults/PathsSummary/HLT Correlations/"));
00156 pathsSummaryFilterCountsFolder_ = iConfig.getUntrackedParameter ("filterCountsFolder",std::string("HLT/TrigResults/PathsSummary/Filters Counts/"));
00157
00158 pathsSummaryHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("individualPathsPerLSFolder",std::string("HLT/TrigResults/PathsSummary/HLT LS/"));
00159 pathsIndividualHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("individualPathsPerLSFolder",std::string("HLT/TrigResults/PathsSummary/HLT LS/Paths/"));
00160 pathsSummaryHLTPathsPerBXFolder_ = iConfig.getUntrackedParameter ("individualPathsPerBXFolder",std::string("HLT/TrigResults/PathsSummary/HLT BX/"));
00161
00162
00163
00164
00165 maskedPaths_ = iConfig.getParameter<std::vector<std::string > >("MaskedPaths");
00166
00167 referenceTrigInput_ = iConfig.getParameter<std::string> ("ReferenceTrigger");
00168 foundReferenceTrigger_ = false;
00169
00170
00171 testPaths_ = iConfig.getParameter<std::vector<std::string > >("testPaths");
00172
00173 fLumiFlag = true;
00174 ME_HLTAll_LS = NULL;
00175 ME_HLT_BX = NULL;
00176 ME_HLT_CUSTOM_BX = NULL;
00177
00178
00179
00180 recHitsEBTag_ = iConfig.getUntrackedParameter<edm::InputTag>("RecHitsEBTag",edm::InputTag("reducedEcalRecHitsEB"));
00181 recHitsEETag_ = iConfig.getUntrackedParameter<edm::InputTag>("RecHitsEETag",edm::InputTag("reducedEcalRecHitsEE"));
00182
00183
00184 jmsDebug = false;
00185 jmsFakeZBCounts = false;
00186 found_zbIndex = false;
00187 if (jmsDebug ) std::cout << "Printing extra info " << std::endl;
00188
00189 }
00190
00191
00192 TrigResRateMon::~TrigResRateMon()
00193 {
00194
00195
00196
00197
00198 }
00199
00200
00201
00202
00203
00204
00205
00206 void
00207 TrigResRateMon::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00208 {
00209
00210
00211
00212 using namespace edm;
00213 using namespace trigger;
00214 ++nev_;
00215 LogDebug("TrigResRateMon")<< " analyze...." ;
00216
00217
00218 edm::Handle<TriggerResults> triggerResults;
00219 iEvent.getByLabel(triggerResultsLabel_,triggerResults);
00220 if(!triggerResults.isValid()) {
00221 edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
00222 iEvent.getByLabel(triggerResultsLabelFU,triggerResults);
00223 if(!triggerResults.isValid()) {
00224 edm::LogInfo("TrigResRateMon") << "TriggerResults not found, "
00225 "skipping event";
00226 return;
00227 }
00228 }
00229 triggerResults_ = triggerResults;
00230 const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
00231
00232
00233 nStream_++;
00234 passAny = false ;
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267 fillHltMatrix(triggerNames, iEvent, iSetup);
00268
00269
00270
00271
00273
00274
00275
00276
00278
00279 edm::Handle<LumiScalersCollection> lumiScalers;
00280 bool lumiHandleOK = iEvent.getByLabel(InputTag("hltScalersRawToDigi","",""), lumiScalers);
00281
00282 if (jmsDebug) std::cout << "Tried to get lumi handle result = " << lumiHandleOK << std::endl;
00283
00284 if (lumiHandleOK) {
00285 if (jmsDebug) std::cout << "LumiScalers size is: " << lumiScalers->size() << std::endl;
00286
00287 if (lumiScalers->size()) {
00288 LumiScalersCollection::const_iterator it3 = lumiScalers->begin();
00289 unsigned int lumisection = it3->sectionNumber();
00290 if(lumisection){
00291
00292 if (jmsDebug) std::cout << "Instanteous Lumi is " << it3->instantLumi() << std::endl;
00293 if (jmsDebug) std::cout << "Instanteous Lumi Error is " <<it3->instantLumiErr() << std::endl;
00294 if (jmsDebug) std::cout << "Lumi Fill is " <<it3->lumiFill() << std::endl;
00295 if (jmsDebug) std::cout << "Lumi Fill is " <<it3->lumiRun() << std::endl;
00296 if (jmsDebug) std::cout << "Live Lumi Fill is " <<it3->liveLumiFill() << std::endl;
00297 if (jmsDebug) std::cout << "Live Lumi Run is " <<it3->liveLumiRun() << std::endl;
00298
00299 addLumiToAverage(it3->instantLumi());
00300
00301
00302 }
00303 }
00304
00305 }
00306
00307
00308 fillCountsPerPath(iEvent, iSetup);
00309
00310 if (passAny) nPass_ ++ ;
00311
00312 return;
00313
00314 }
00315
00316
00317
00318
00319 void
00320 TrigResRateMon::beginJob()
00321 {
00322 nev_ = 0;
00323 DQMStore *dbe = 0;
00324 dbe = Service<DQMStore>().operator->();
00325
00326 if (dbe) {
00327 dbe->setCurrentFolder(dirname_);
00328 }
00329
00330
00331 MonitorElement* reportSummaryME = dbe->book1D("reportSummaryMap","report Summary Map",2,0,2);
00332 if(reportSummaryME) reportSummaryME->Fill(1);
00333
00334
00335 }
00336
00337
00338 void
00339 TrigResRateMon::endJob()
00340 {
00341 LogInfo("TrigResRateMon") << "analyzed " << nev_ << " events";
00342 return;
00343 }
00344
00345
00346
00347 void TrigResRateMon::beginRun(const edm::Run& run, const edm::EventSetup& c)
00348 {
00349
00350 LogDebug("TrigResRateMon") << "beginRun, run " << run.id();
00351
00352 if(fIsSetup) return;
00353
00354
00355 bool changed=false;
00356
00357 if (!hltConfig_.init(run, c, processname_, changed)) {
00358
00359 processname_ = "FU";
00360
00361
00362 if (!hltConfig_.init(run, c, processname_, changed)){
00363
00364 if (jmsDebug) std::cout << "HLTConfigProvider failed to initialize.";
00365
00366 } else {
00367 if (jmsDebug) std::cout << "Initialized HLTConfigProvider with name FU " << std::endl;
00368 }
00369
00370
00371
00372
00373 } else {
00374 if (jmsDebug) std::cout << "Initialized HLTConfigProvider with name HLT " << std::endl;
00375 }
00376
00377 if (1) {
00378
00379 DQMStore *dbe = 0;
00380 dbe = Service<DQMStore>().operator->();
00381
00382 if (dbe) {
00383 dbe->setCurrentFolder(dirname_);
00384 }
00385
00386
00387
00388
00389 TotalDroppedCounts = 0;
00390
00391 meDiagnostic = dbe->book1D("DroppedCounts Diagnose", "LSs vs Status;Status;LSs", 3, -0.5,2.5 );
00392 meCountsDroppedPerLS = dbe->book1D("CountsDroppedVsLS", "Counts vs LumiSec;LS;Dropped Stream Counts", nLS_, 0.5, nLS_+0.5);
00393 meCountsPassPerLS = dbe->book1D("CountsPassVsLS", "Counts vs LumiSec;LS;Passed Stream Counts", nLS_, 0.5, nLS_+0.5);
00394 meCountsStreamPerLS = dbe->book1D("CountsStreamVsLS", "Counts vs LumiSec;LS;Stream Counts", nLS_, 0.5, nLS_+0.5);
00395 meXsecStreamPerLS = dbe->book1D("XsecStreamVsLS", "Xsec vs LumiSec;LS;Stream Xsec", nLS_, 0.5, nLS_+0.5);
00396
00397
00398
00399
00400
00401
00402
00403 bookTestHisto();
00404 dbe->setCurrentFolder(dirname_);
00405
00406
00407 bookCountsPerPath();
00408 clearLumiAverage();
00409 averageInstLumi3LS = 0 ;
00410 findReferenceTriggerIndex();
00411 meAverageLumiPerLS = dbe->book1D("InstLumiVsLS", "Instantaneous Luminosity vs LumiSec;LS;#mub^{-1}*s^{-1}", nLS_, 0.5, nLS_+0.5);
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588 vector<string> allPaths;
00589
00590
00591 for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
00592
00593 std::string pathName = v->getPath();
00594
00595
00596 vector<int> tempCount(5,0);
00597
00598 fPathTempCountPair.push_back(make_pair(pathName,0));
00599 fPathBxTempCountPair.push_back(make_pair(pathName,tempCount));
00600
00601 allPaths.push_back(pathName);
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628 }
00629
00630 fPathTempCountPair.push_back(make_pair("HLT_Any",0));
00631
00632 fGroupName.push_back("AllSelectedPaths");
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642 for(unsigned int g=0; g<fGroupName.size(); g++) {
00643
00644
00645
00646
00647 }
00648
00649 dbe_->setCurrentFolder(pathsSummaryFolder_.c_str());
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00670
00671 vector<string> datasetNames = hltConfig_.streamContent("A") ;
00672 for (unsigned int i=0;i<datasetNames.size();i++) {
00673
00674 vector<string> datasetPaths = hltConfig_.datasetContent(datasetNames[i]);
00675 fGroupNamePathsPair.push_back(make_pair(datasetNames[i],datasetPaths));
00676
00677 DatasetInfo tempDS;
00678 tempDS.datasetName = datasetNames[i];
00679 tempDS.setPaths(datasetPaths);
00680 tempDS.countsPerPathME_Name = pathsSummaryFolder_ + "HLT_" + datasetNames[i] + "_Pass_Any";
00681 tempDS.xsecPerPathME_Name = pathsSummaryFolder_ + "HLT_" + datasetNames[i] + "_Xsec";
00682 tempDS.rawCountsPerPathME_Name = pathsSummaryFolder_ + "HLT_" + datasetNames[i] + "_RawCounts";
00683 tempDS.scaledXsecPerPathME_Name = pathsSummaryFolder_ + "HLT_" + datasetNames[i] + "_XsecScaled";
00684 tempDS.ratePerLSME_Name = pathsSummaryFolder_ + "HLT_" + datasetNames[i] + "_Rate";
00685 tempDS.setMaskedPaths(maskedPaths_);
00686 if (jmsDebug) tempDS.printMaskedPaths();
00687 primaryDataSetInformation.push_back(tempDS);
00688
00689 rawCountsPerPD.push_back(0);
00690 }
00691
00692
00693 fGroupNamePathsPair.push_back(make_pair("A",datasetNames));
00694
00695
00696 for (unsigned int g=0;g<fGroupNamePathsPair.size();g++) {
00697
00698 fGroupTempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
00699 fGroupL1TempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
00700 setupHltMatrix(fGroupNamePathsPair[g].first,fGroupNamePathsPair[g].second);
00701
00702 }
00703
00704
00705
00706
00707
00708
00709
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004 }
01005
01006
01007
01008
01009
01010 if(doCombineRuns_) fIsSetup = true;
01011
01012 return;
01013
01014 }
01015
01017 void TrigResRateMon::endRun(const edm::Run& run, const edm::EventSetup& c)
01018 {
01019
01020 LogDebug("TrigResRateMon") << "endRun, run " << run.id();
01021
01022 }
01023
01024
01025 void TrigResRateMon::setupHltMatrix(const std::string& label, vector<std::string>& paths) {
01026
01027
01028
01029
01030 paths.push_back("");
01031 paths.push_back("Total "+label);
01032
01033
01034 string h_name;
01035 string h_title;
01036
01037 dbe_->setCurrentFolder(pathsSummaryFolder_.c_str());
01038
01039
01040
01041
01042
01043
01044
01045
01046 h_name= "HLT_"+label+"_Pass_Any";
01047 h_title = "HLT_"+label+"_Pass -- Prescale*Counts Per Path;Path;PS*Counts";
01048 MonitorElement* ME_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
01049 paths.size(), -0.5, paths.size()-0.5);
01050
01051
01052
01053 h_name= "HLT_"+label+"_RawCounts";
01054 h_title = "HLT_"+label+"_Pass (x=Pass, An) normalized to HLT_Any Pass;;Counts";
01055 MonitorElement* ME_RawCounts = dbe_->book1D(h_name.c_str(), h_title.c_str(),
01056 paths.size(), -0.5, paths.size()-0.5);
01057
01058
01059
01060
01061 h_name= "HLT_"+label+"_Xsec";
01062 h_title = "HLT_"+label+"_Xsec -- Profile shows Average Xsec per path;;#sigma (#mu b)";
01063
01064 TProfile tempProfile(h_name.c_str(), h_title.c_str(),
01065 paths.size(), -0.5, paths.size()-0.5);
01066 MonitorElement* ME_Xsec = dbe_->bookProfile(h_name.c_str(), &tempProfile);
01067
01068
01069
01070
01071
01072 h_name= "HLT_"+label+"_XsecScaled";
01073 h_title = "HLT_"+label+"_Xsec -- Profile shows Average Xsec per path Scaled to Reference;;Ratio (#sigma/#sigma_{ref}";
01074
01075 TProfile tempProfileScaled(h_name.c_str(), h_title.c_str(),
01076 paths.size(), -0.5, paths.size()-0.5);
01077 MonitorElement* ME_XsecScaled = dbe_->bookProfile(h_name.c_str(), &tempProfileScaled);
01078
01080 h_name= "HLT_"+label+"_Rate";
01081 h_title = "HLT_"+label+"_Rate -- histogram shows Average Rate per LS;LS;Rate [Hz]";
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134 for(unsigned int i = 0; i < paths.size(); i++){
01135
01136
01137
01138
01139
01140
01141
01142
01143 ME_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01144 ME_Xsec->getTProfile()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01145 ME_XsecScaled->getTProfile()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01146 ME_RawCounts->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01147 }
01148
01149 }
01150
01151
01152 void TrigResRateMon::setupStreamMatrix(const std::string& label, vector<std::string>& paths) {
01153
01154
01155 paths.push_back("");
01156 paths.push_back("HLT_"+label+"_Any");
01157
01158 string h_name;
01159 string h_title;
01160
01161 dbe_->setCurrentFolder(pathsSummaryFolder_.c_str());
01162
01163 h_name= "HLT_"+label+"_PassPass";
01164 h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass)";
01165 MonitorElement* ME = dbe_->book2D(h_name.c_str(), h_title.c_str(),
01166 paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
01167
01168 h_name= "HLT_"+label+"_Pass_Any";
01169 h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
01170 MonitorElement* ME_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
01171 paths.size(), -0.5, paths.size()-0.5);
01172
01173 dbe_->setCurrentFolder(pathsSummaryHLTCorrelationsFolder_.c_str());
01174 h_name= "HLT_"+label+"_PassPass_Normalized";
01175 h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass) normalized to xBin=Pass";
01176 MonitorElement* ME_Normalized = dbe_->book2D(h_name.c_str(), h_title.c_str(),
01177 paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
01178 h_name= "HLT_"+label+"_Pass_Normalized_Any";
01179 h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
01180 MonitorElement* ME_Normalized_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
01181 paths.size(), -0.5, paths.size()-0.5);
01182
01183 for(unsigned int i = 0; i < paths.size(); i++){
01184
01185 ME->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01186 ME->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01187
01188 ME_Normalized->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01189 ME_Normalized->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01190
01191 ME_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01192 ME_Normalized_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01193
01194 }
01195
01196 }
01197
01198 void TrigResRateMon::fillHltMatrix(const edm::TriggerNames & triggerNames, const edm::Event& iEvent, const edm::EventSetup& iSetup) {
01199
01200 string fullPathToME;
01201 std::vector <std::pair<std::string, bool> > groupAcceptPair;
01202
01203
01204 std::pair<int,int> psValueCombo;
01205
01206
01207 for (unsigned int mi=0;mi<fGroupNamePathsPair.size()-1;mi++) {
01208
01209
01210
01211
01212 fullPathToME = pathsSummaryFolder_ + "HLT_"+fGroupNamePathsPair[mi].first+"_Pass_Any";
01213 MonitorElement* ME_1d = dbe_->get(fullPathToME);
01214
01215 if(!ME_1d) {
01216 LogTrace("TrigResRateMon") << " ME not valid although I gave full path" << endl;
01217 continue;
01218
01219 }
01220
01221
01222 TH1F * hist_1d = ME_1d->getTH1F();
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261 bool groupPassed = false;
01262
01263
01264
01265
01266
01267
01268 for (unsigned int i=0; i< fGroupNamePathsPair[mi].second.size(); i++)
01269 {
01270
01271
01272 string hltPathName = fGroupNamePathsPair[mi].second[i];
01273
01274
01275
01276 unsigned int pathByIndex = triggerNames.triggerIndex(fGroupNamePathsPair[mi].second[i]);
01277 if(pathByIndex >= triggerResults_->size() ) continue;
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287 if(triggerResults_->accept(pathByIndex)){
01288
01289 groupPassed = true;
01290
01291
01292
01293
01294
01295
01296
01297
01298 if (jmsDebug) std::cout << "Trying to get prescales... " << std::endl;
01299
01300 psValueCombo = hltConfig_.prescaleValues(iEvent, iSetup, hltPathName);
01301
01302 if (jmsDebug) std::cout << "Path " << hltPathName
01303 << " L1 PS " << psValueCombo.first
01304 << " and hlt ps " << psValueCombo.second << std::endl;
01305
01306 if ( (psValueCombo.first > 0) && (psValueCombo.second > 0) ){
01307 hist_1d->Fill(i, psValueCombo.first * psValueCombo.second );
01308 } else {
01309 hist_1d->Fill(i);
01310 }
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332 }
01333
01334
01335 }
01336
01337 if(groupPassed) {
01338
01339 rawCountsPerPD[mi]++ ;
01340
01341
01342
01343
01344
01345 }
01346
01347
01348
01349 bool isGroupFromStreamA = false;
01350
01351 vector<string> streamDatasetNames = hltConfig_.streamContent("A") ;
01352 for (unsigned int g=0;g<streamDatasetNames.size();g++) {
01353
01354 if(streamDatasetNames[g] == fGroupNamePathsPair[mi].first)
01355 {
01356
01357 isGroupFromStreamA = true;
01358 break;
01359
01360 }
01361 }
01362
01363 if(isGroupFromStreamA) groupAcceptPair.push_back(make_pair(fGroupNamePathsPair[mi].first,groupPassed));
01364
01365
01366
01367
01368
01369
01370
01371
01372 }
01373
01374
01375
01376 fullPathToME = pathsSummaryFolder_ + "HLT_A_Pass_Any";
01377 MonitorElement* ME_1d_Stream = dbe_->get(fullPathToME);
01378
01379 if(!ME_1d_Stream) {
01380
01381 LogTrace("TrigResRateMon") << " ME not valid although I gave full path" << endl;
01382 return;
01383
01384 }
01385 else {
01386
01387
01388 TH1F * hist_1d_Stream = ME_1d_Stream->getTH1F();
01389
01390 int streamBinNumber = hist_1d_Stream->GetXaxis()->GetLast();
01391
01392 bool acceptedStreamA = false;
01393
01394
01395 for (unsigned int i=0;i<groupAcceptPair.size();i++) {
01396
01397 if(groupAcceptPair[i].second) {
01398
01399 acceptedStreamA = true;
01400
01401
01402 int groupBinNumber_i = hist_1d_Stream->GetXaxis()->FindBin(groupAcceptPair[i].first.c_str());
01403
01404
01405 hist_1d_Stream->Fill(groupBinNumber_i-1);
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424 }
01425
01426 }
01427
01428 if(acceptedStreamA) {
01429
01430
01431 hist_1d_Stream->Fill(streamBinNumber-1);
01432
01433 passAny = true ;
01434
01435 }
01436
01437 }
01438
01439 }
01440
01441
01442
01443 void TrigResRateMon::fillCountsPerPath(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
01444
01445
01446 if (jmsDebug) std::cout << "Filling counts per path" << std::endl;
01447
01448 if (!triggerResults_.isValid()) {
01449 if (jmsDebug) std::cout << "Trigger Results not valid, sorry" << std::endl;
01450 return;
01451 }
01452
01453 for (unsigned iName = 0; iName < hltConfig_.size(); iName++) {
01454 if ( triggerResults_ -> accept ( iName ) ){
01455 rawCountsPerPath[iName]++;
01456
01457
01458 std::string thisName = hltConfig_.triggerName(iName);
01459
01460 std::pair<int,int> psValueCombo = hltConfig_.prescaleValues(iEvent, iSetup, thisName);
01461
01462 if ( (psValueCombo.first > 0) && (psValueCombo.second > 0) ){
01463 finalCountsPerPath[iName] += psValueCombo.first * psValueCombo.second;
01464 } else {
01465 finalCountsPerPath[iName]++;
01466 }
01467
01468
01469 if ( (iName == referenceTrigIndex_) && (foundReferenceTrigger_) ) {
01470
01471 std::pair<int,int> psValueCombo = hltConfig_.prescaleValues(iEvent, iSetup, referenceTrigName_);
01472
01473 if ( (psValueCombo.first > 0) && (psValueCombo.second > 0) ){
01474 referenceTrigCountsPS_ += psValueCombo.first * psValueCombo.second;
01475 } else {
01476 referenceTrigCountsPS_++;
01477 }
01478
01479 }
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496 }
01497 }
01498
01499
01500 for (std::vector<DatasetInfo>::iterator iDS = primaryDataSetInformation.begin();
01501 iDS != primaryDataSetInformation.end();
01502 iDS++) {
01503
01504
01505
01506 for (std::vector<std::string>::iterator iPath = iDS->pathNames.begin();
01507 iPath != iDS->pathNames.end();
01508 iPath++){
01509
01510 unsigned trigIndex = hltConfig_.triggerIndex(*iPath);
01511
01512 if ( triggerResults_ -> accept ( trigIndex ) ){
01513
01514
01515 MonitorElement * thisRawCountsPlot = dbe_->get(iDS->rawCountsPerPathME_Name);
01516 if (thisRawCountsPlot){
01517 iDS->fillRawCountsForPath(thisRawCountsPlot, *iPath);
01518 } else {
01519 if (jmsDebug) std::cout << "sorry but couldn't find this raw counts plot"<< iDS->datasetName << std::endl;
01520 }
01521
01522
01523
01524
01525 std::pair<int,int> psValueCombo = hltConfig_.prescaleValues(iEvent, iSetup, *iPath);
01526
01527
01528 if ( (psValueCombo.first > 0) && (psValueCombo.second > 0) ){
01529 iDS->incrementCountsForPath(*iPath, psValueCombo.first*psValueCombo.second);
01530 } else {
01531 iDS->incrementCountsForPath(*iPath);
01532 }
01533
01534 }
01535 }
01536
01537 }
01538
01539
01540
01541
01542 }
01543
01544 void TrigResRateMon::bookCountsPerPath() {
01545
01546
01547 for (unsigned iName = 0; iName < hltConfig_.size(); iName++) {
01548
01549 rawCountsPerPath.push_back(0);
01550 finalCountsPerPath.push_back(0);
01551
01552 }
01553
01554
01555 }
01556
01557
01558 void TrigResRateMon::findReferenceTriggerIndex() {
01559
01560 if (jmsDebug) std::cout << "Looking for reference trigger " << referenceTrigInput_ << std::endl;
01561 for (unsigned iName = 0; iName < hltConfig_.size(); iName++) {
01562
01563 std::string thisName = hltConfig_.triggerName(iName);
01564 TString tempThisName(thisName.c_str());
01565 if (tempThisName.Contains(referenceTrigInput_)){
01566 referenceTrigName_ = thisName;
01567 if (jmsDebug) std::cout << "Using Reference trigger " << referenceTrigName_ << std::endl;
01568 referenceTrigIndex_ = iName;
01569 foundReferenceTrigger_ = true;
01570 referenceTrigCountsPS_ = 0;
01571 break;
01572 }
01573 }
01574
01575 if (!foundReferenceTrigger_) {
01576 std::cout << "Sorry, we couldn't find a trigger like " << referenceTrigInput_ << std::endl;
01577 }
01578
01579 }
01580
01581
01582 void TrigResRateMon::printCountsPerPathThisLumi() {
01583
01584 std::cout << "===> COUNTS THIS LUMI <===" << std::endl;
01585
01586 for (unsigned iName = 0; iName < hltConfig_.size() ; iName++) {
01587 std::cout << hltConfig_.triggerName(iName)
01588 << " = " << rawCountsPerPath[iName]
01589 << "finalCounts = " << finalCountsPerPath[iName]
01590 << std::endl;
01591 }
01592
01593 std::cout << "+++ Reference trigger " << referenceTrigName_ << " index " << referenceTrigIndex_ << " counts " << referenceTrigCountsPS_ << std::endl;
01594
01595
01596 for (std::vector<DatasetInfo>::const_iterator iDS = primaryDataSetInformation.begin();
01597 iDS != primaryDataSetInformation.end();
01598 iDS++) {
01599
01600 iDS->printCountsPerPath();
01601
01602 }
01603
01604
01605 }
01606
01607 void TrigResRateMon::clearCountsPerPath() {
01608
01609
01610
01611
01612
01613
01614
01615
01616
01617 referenceTrigCountsPS_ = 0 ;
01618
01619
01620 for (std::vector<DatasetInfo>::iterator iDS = primaryDataSetInformation.begin();
01621 iDS != primaryDataSetInformation.end();
01622 iDS++) {
01623 iDS->clearCountsPerPath();
01624 }
01625
01626
01627 }
01628
01629 void TrigResRateMon::clearLumiAverage() {
01630
01631 averageInstLumi = 0;
01632
01633 }
01634
01635 void TrigResRateMon::addLumiToAverage(double lumi) {
01636
01637 if (averageInstLumi == 0) {
01638 averageInstLumi = lumi;
01639 } else {
01640 averageInstLumi = (averageInstLumi + lumi) / 2;
01641 }
01642
01643 }
01644
01645 void TrigResRateMon::fillXsecPerDataset(const int& lumi) {
01646
01647
01648
01649 double refTrigXSec = referenceTrigCountsPS_ / ( averageInstLumi * LSsize_);
01650
01651
01652
01653
01654
01655 int iPD = 0;
01656
01657 for (std::vector<DatasetInfo>::iterator iDS = primaryDataSetInformation.begin();
01658 iDS != primaryDataSetInformation.end();
01659 iDS++) {
01660 MonitorElement * thisXsecPlot = dbe_->get(iDS->xsecPerPathME_Name);
01661 MonitorElement * scaledXsecPlot = dbe_->get(iDS->scaledXsecPerPathME_Name);
01662 if (thisXsecPlot){
01663 iDS->fillXsecPlot(thisXsecPlot, averageInstLumi, LSsize_);
01664 } else {
01665 if (jmsDebug) std::cout << "sorry but couldn't find this xsec plot"<< iDS->datasetName << std::endl;
01666 }
01667
01668 if (scaledXsecPlot){
01669 iDS->fillXsecPlot(scaledXsecPlot, averageInstLumi, LSsize_, refTrigXSec);
01670 } else {
01671 if (jmsDebug) std::cout << "sorry but couldn't find this scaled xsec plot"<< iDS->datasetName << std::endl;
01672 }
01673
01675 MonitorElement * thisRatePlot = dbe_->get(iDS->ratePerLSME_Name);
01676 if (thisRatePlot) {
01677
01678 double rate = rawCountsPerPD[iPD] / LSsize_ ;
01679
01680 TH1F* rateHist = thisRatePlot->getTH1F();
01681 rateHist->SetBinContent(lumi, rate);
01682 }
01683 else {
01684 if (jmsDebug) std::cout << "sorry but couldn't find this rate plot"<< iDS->datasetName << std::endl;
01685 }
01686
01687 rawCountsPerPD[iPD] = 0 ;
01688 iPD++;
01689 }
01690
01691 }
01692
01693
01694 void TrigResRateMon::setupHltBxPlots()
01695 {
01696
01697
01698
01699 dbe_->setCurrentFolder(pathsSummaryFolder_);
01700
01701
01702 unsigned int npaths = hltPathsDiagonal_.size();
01703
01704 ME_HLT_BX = dbe_->book2D("HLT_bx",
01705 "HLT counts vs Event bx",
01706 Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
01707 ME_HLT_CUSTOM_BX = dbe_->book2D("HLT_Custom_bx",
01708 "HLT counts vs Event bx",
01709 Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
01710 ME_HLT_BX->setAxisTitle("Bunch Crossing");
01711 ME_HLT_CUSTOM_BX->setAxisTitle("Bunch Crossing");
01712
01713
01714
01715 for(unsigned int i = 0; i < npaths; i++){
01716
01717 ME_HLT_BX->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
01718 ME_HLT_CUSTOM_BX->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
01719
01720 }
01721
01722
01723 }
01724
01725 void TrigResRateMon::setupHltLsPlots()
01726 {
01727
01728 unsigned int npaths = hltPathsDiagonal_.size();
01729
01730
01731
01732 dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_);
01733
01734 ME_HLTAll_LS = dbe_->book2D("AllSelectedPaths_count_LS",
01735 "AllSelectedPaths paths rate [Hz]",
01736 nLS_, 0, nLS_, npaths+1, -0.5, npaths+1-0.5);
01737 ME_HLTAll_LS->setAxisTitle("Luminosity Section");
01738
01739
01740 for(unsigned int i = 0; i < npaths; i++){
01741
01742 ME_HLTAll_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
01743
01744 }
01745
01746 unsigned int i = npaths;
01747 ME_HLTAll_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, "HLT_Any");
01748
01749 int nBinsPerLSHisto = 20;
01750 int nLSHistos = npaths/nBinsPerLSHisto;
01751 for (int nh=0;nh<nLSHistos+1;nh++) {
01752
01753 char name[200];
01754 char title[200];
01755
01756 sprintf(name, "Group_%d_paths_count_LS",nLSHistos-nh);
01757 sprintf(title, "Group %d, paths rate [Hz]",nLSHistos-nh);
01758
01759 MonitorElement* tempME = dbe_->book2D(name,title,
01760 nLS_, 0, nLS_, nBinsPerLSHisto+3, -0.5, nBinsPerLSHisto+3-0.5);
01761
01762 tempME->setAxisTitle("LS");
01763
01764
01765 for(int i = nh*nBinsPerLSHisto; i < (nh+1)*nBinsPerLSHisto; i++){
01766
01767 if (i == int(npaths)) break;
01768
01769 int bin;
01770 if(nh == 0){
01771
01772 bin = i;
01773
01774 }
01775 else {
01776
01777 bin = i % nBinsPerLSHisto;
01778
01779 }
01780
01781 tempME->setBinLabel(bin+1, hltPathsDiagonal_[i].getPath().c_str(), 2);
01782
01783 }
01784
01785 tempME->setBinLabel(nBinsPerLSHisto+3, "HLT_Any", 2);
01786 tempME->setBinLabel(nBinsPerLSHisto+2, "HLT_PhysicsDeclared", 2);
01787
01788 v_ME_HLTAll_LS.push_back(tempME);
01789
01790 }
01791
01792
01793 }
01794
01795
01796 void TrigResRateMon::bookTestHisto()
01797 {
01798
01799 unsigned int npaths = testPaths_.size();
01800
01801
01802
01803
01804 dbe_->setCurrentFolder(testPathsFolder_);
01805
01806 TProfile tempProfile("XsecVsTestPath", "Xsec vs Test Path;;Xsec #mub", npaths, 0.5, npaths+0.5);
01807 meXsecPerTestPath = dbe_->bookProfile("XsecVsTestPath", &tempProfile);
01808
01809
01810 for(unsigned int i = 0; i < npaths; i++){
01811 const char* pname = testPaths_[i].c_str() ;
01812 TString pathname = testPaths_[i].c_str() ;
01813 meXsecPerTestPath->getTProfile()->GetXaxis()->SetBinLabel(i+1, pathname );
01814
01816 char name[200];
01817 char title[200];
01818
01819 sprintf(name, "path_%s_XsecVsLS", pname);
01820 sprintf(title, "path_%s_XsecVsLS;LS;Xsec #mub", pname);
01821
01822 MonitorElement* tempME = dbe_->book1D(name,title, nLS_, 0, nLS_ );
01823
01824 tempME->setAxisTitle("LS");
01825
01826 v_ME_XsecPerLS.push_back(tempME);
01827
01828 char name2[200];
01829 char title2[200];
01830
01831 sprintf(name2, "path_%s_countsVsLS", pname);
01832 sprintf(title2, "path_%s_countsVsLS;LS;Counts", pname);
01833
01834 MonitorElement* tempME2 = dbe_->book1D(name2, title2, nLS_, 0, nLS_ );
01835
01836 tempME2->setAxisTitle("LS");
01837
01838 v_ME_CountsPerLS.push_back(tempME2);
01839
01840 }
01841
01842 MonitorElement* meXsec1 = dbe_->book1D("Xsec_HLT_IsoMu30_eta2p1", "HLT_IsoMu30_eta2p1 Xsec;Xsec #mub;number of LS", 10, 0.008, 0.012);
01843 MonitorElement* meXsec2 = dbe_->book1D("Xsec_HLT_Ele65_CaloIdVT_TrkIdT", "HLT_Ele65_CaloIdVT_TrkIdT Xsec;Xsec #mub;number of LS", 10, 0.002, 0.0025);
01844 MonitorElement* meXsec3 = dbe_->book1D("Xsec_HLT_MET200", "HLT_MET200 Xsec;Xsec #mub;number of LS", 10, 0.0004, 0.0008);
01845 MonitorElement* meXsec4 = dbe_->book1D("Xsec_HLT_Jet370", "HLT_Jet370 Xsec;Xsec #mub;number of LS", 10, 0.0006, 0.0008);
01846 MonitorElement* meXsec5 = dbe_->book1D("Xsec_HLT_HT600", "HLT_HT600 Xsec;Xsec #mub;number of LS", 10, 0.004, 0.005);
01847 MonitorElement* meXsec6 = dbe_->book1D("Xsec_HLT_Photon26_R9Id_Photon18_R9Id", "HLT_Photon26_R9Id_Photon18_R9Id Xsec;Xsec #mub;number of LS", 10, 0.002, 0.004);
01848 MonitorElement* meXsec7 = dbe_->book1D("Xsec_HLT_IsoMu15_eta2p1_LooseIsoPFTau20", "HLT_IsoMu15_eta2p1_LooseIsoPFTau20 Xsec;Xsec #mub;number of LS", 10, 0.0022, 0.003);
01849 MonitorElement* meXsec8 = dbe_->book1D("Xsec_HLT_PFMHT150", "HLT_PFMHT150 Xsec;Xsec #mub;number of LS", 10, 0.0005, 0.001);
01850 MonitorElement* meXsec9 = dbe_->book1D("Xsec_HLT_Photon90_CaloIdVL_IsoL", "HLT_Photon90_CaloIdVL_IsoL Xsec;Xsec #mub;number of LS", 10, 0.0015, 0.0025);
01851
01852
01853 v_ME_Xsec.push_back(meXsec1);
01854 v_ME_Xsec.push_back(meXsec2);
01855 v_ME_Xsec.push_back(meXsec3);
01856 v_ME_Xsec.push_back(meXsec4);
01857 v_ME_Xsec.push_back(meXsec5);
01858 v_ME_Xsec.push_back(meXsec6);
01859 v_ME_Xsec.push_back(meXsec7);
01860 v_ME_Xsec.push_back(meXsec8);
01861 v_ME_Xsec.push_back(meXsec9);
01862
01863
01864 }
01865
01866 void TrigResRateMon::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c){
01867
01868
01869
01870
01871
01872 if (jmsDebug) std::cout << "Inside begin lumi block" << std::endl;
01873
01874 clearCountsPerPath();
01875 clearLumiAverage();
01876 nStream_ = 0 ;
01877 nPass_ = 0 ;
01878
01879 }
01880
01881 void TrigResRateMon::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c)
01882 {
01883
01884 int lumi = int(lumiSeg.id().luminosityBlock());
01885 LogTrace("TrigResRateMon") << " end lumiSection number " << lumi << endl;
01886
01887
01888
01889
01890
01891
01892
01893
01894
01895 if (jmsDebug) printCountsPerPathThisLumi();
01896 if (jmsDebug) std::cout << "Average lumi is " << averageInstLumi << std::endl;
01897
01898 if (averageInstLumi > 500) {
01899
01900
01901
01902
01903 fillXsecPerDataset(lumi);
01904
01905 filltestHisto(lumi);
01906 }
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927 TH1F* tempCountsStreamPerLS = meCountsStreamPerLS->getTH1F();
01928
01929 tempCountsStreamPerLS->SetBinContent(lumi, nStream_);
01930
01931
01932 MonitorElement* tempDroppedEvents = dbe_->get("SM_SMPS_Stats/droppedEventsCount_HLTTrigerResults DQM Consumer" );
01933 if (tempDroppedEvents) {
01934 TH1F* tempDiagnostic = meDiagnostic->getTH1F();
01935 if (tempDroppedEvents->kind() == MonitorElement::DQM_KIND_INT){
01936 tempDiagnostic->Fill(2);
01937 int64_t tempDroppedCounts = tempDroppedEvents->getIntValue();
01938 int64_t currentDroppedCounts = tempDroppedCounts - TotalDroppedCounts;
01939 TotalDroppedCounts = tempDroppedCounts ;
01940 TH1F* tempCountsDroppedPerLS = meCountsDroppedPerLS->getTH1F();
01941 tempCountsDroppedPerLS->SetBinContent(lumi, currentDroppedCounts);
01942 }
01943 else tempDiagnostic->Fill(1);
01944 }
01945 else {
01946 TH1F* tempDiagnostic = meDiagnostic->getTH1F();
01947 tempDiagnostic->Fill(0);
01948 }
01949
01950 TH1F* tempXsecStreamPerLS = meXsecStreamPerLS->getTH1F();
01951 double xsecStream = 1.0 ;
01952 if (averageInstLumi > 0){
01953 xsecStream = nStream_ / (averageInstLumi*LSsize_);
01954 tempXsecStreamPerLS->SetBinContent(lumi, xsecStream);
01955 }
01956
01957 TH1F* tempCountsPassPerLS = meCountsPassPerLS->getTH1F();
01958
01959 tempCountsPassPerLS->SetBinContent(lumi, nPass_);
01960
01961
01962
01963
01964
01965 TH1F* tempLumiPerLS = meAverageLumiPerLS->getTH1F();
01966 tempLumiPerLS->SetBinContent(lumi, averageInstLumi);
01967 tempLumiPerLS->SetBinError(lumi, averageInstLumi*0.06);
01968
01969
01970 }
01971
01972
01973 void TrigResRateMon::filltestHisto(const int& lumi) {
01974
01975 averageInstLumi3LS += averageInstLumi;
01976
01977 if (lumi%3 == 0){
01978 unsigned int npaths = testPaths_.size();
01979 for(unsigned int i = 0; i < npaths; i++){
01980 TString pathname = testPaths_[i].c_str() ;
01981 pathname += "_v" ;
01982
01983 int index = 0 ;
01984 int rawCount = 0 ;
01985 int finalCount = 0;
01986 double xsec = 0 ;
01987
01988
01989
01990 for (unsigned iName = 0; iName < hltConfig_.size(); iName++) {
01991
01992 std::string thisName = hltConfig_.triggerName(iName);
01993 TString checkName(thisName.c_str());
01994 if (checkName.Contains(pathname)){
01995 index = iName ;
01996
01997 break ;
01998 }
01999 }
02000
02001 MonitorElement* testME_XsecPerLS = v_ME_XsecPerLS[i];
02002 MonitorElement* testME_rawCountsPerLS = v_ME_CountsPerLS[i];
02003 MonitorElement* testME_Xsec = v_ME_Xsec[i];
02004
02005
02006 rawCount = rawCountsPerPath[index];
02007 finalCount = finalCountsPerPath[index];
02008
02009 testME_rawCountsPerLS->getTH1F()->SetBinContent(lumi, rawCount);
02010
02011 if (averageInstLumi > 0 ) {
02012 xsec = finalCount/ (averageInstLumi3LS*LSsize_);
02013
02014 testME_XsecPerLS->getTH1F()->SetBinContent(lumi, xsec);
02015
02016 testME_Xsec->getTH1F()->Fill(xsec);
02017
02018 meXsecPerTestPath->getTProfile()->Fill(i+1,xsec);
02019 }
02020 }
02021
02022 for (unsigned iName = 0; iName < hltConfig_.size() ; iName++) {
02023
02024 rawCountsPerPath[iName] = 0;
02025 finalCountsPerPath[iName] = 0;
02026 }
02027 averageInstLumi3LS = 0 ;
02028
02029 }
02030
02031 }
02032
02033
02034 void TrigResRateMon::countHLTGroupBXHitsEndLumiBlock(const int& lumi)
02035 {
02036
02037 LogTrace("TrigResRateMon") << " countHLTGroupBXHitsEndLumiBlock() lumiSection number " << lumi << endl;
02038
02039 if(! ME_HLT_BX) return;
02040
02041 TH2F * hist_2d_bx = ME_HLT_BX->getTH2F();
02042
02043 for (std::vector<std::pair<std::string, vector<int> > >::iterator ip = fPathBxTempCountPair.begin(); ip != fPathBxTempCountPair.end(); ++ip) {
02044
02045
02046 std::string pathname = ip->first;
02047 vector<int> prevCount = ip->second;
02048
02049
02050 vector<int> currCount (5,0);
02051 vector<int> diffCount (5,0);
02052
02053
02054 int pathBin = hist_2d_bx->GetYaxis()->FindBin(pathname.c_str());
02055
02056 if(pathBin > hist_2d_bx->GetNbinsY()) {
02057
02058 LogTrace("TrigResRateMon") << " Cannot find the bin for path " << pathname << endl;
02059 continue;
02060
02061 }
02062
02063 for (unsigned int b =0;b<currCount.size();b++) {
02064
02065 int bxOffset = b-2;
02066 int bunch = referenceBX_+bxOffset;
02067 if(bunch < 1) bunch += Nbx_ ;
02068 int bxBin = bunch +1;
02069
02070
02071 currCount[b] = int(hist_2d_bx->GetBinContent(bxBin, pathBin));
02072
02073 LogTrace("TrigResRateMon") << "currCount = " << currCount[b] << endl;
02074
02075
02076 diffCount[b] = currCount[b] - prevCount[b];
02077
02078 LogTrace("TrigResRateMon") << " lumi = " << lumi << " path " << pathname << "bxOffset = " << bxOffset << " count = " << diffCount[b] << endl;
02079
02080 }
02081
02082
02083 ip->second = currCount;
02084
02086
02088 LogTrace("TrigResRateMon") << "Find " << pathname << endl;
02089
02090
02091
02092 for (unsigned int j=0;j<v_ME_Total_BX.size();j++)
02093 {
02094
02095 bool isMember = false;
02096
02097 LogTrace("TrigResRateMon") << " ---- Group " << fGroupNamePathsPair[j].first << endl;
02098
02099
02100 for (unsigned int k = 0; k<(fGroupNamePathsPair[j].second).size();k++) {
02101
02102 LogTrace("TrigResRateMon") << " comparing to " << fGroupNamePathsPair[j].second[k] << endl;
02103
02104 if(fGroupNamePathsPair[j].second[k] == pathname) {
02105
02106 isMember = true;
02107 break;
02108
02109 }
02110
02111 }
02112
02113 if(!isMember) {
02114
02115 LogTrace("TrigResRateMon") << "Could not find a group to which the path belongs, path = " << pathname << " group = " << fGroupNamePathsPair[j].first << endl;
02116 continue;
02117
02118 }
02119
02120 MonitorElement* ME_2d = v_ME_Total_BX[j];
02121
02122 if (! ME_2d) {
02123
02124 LogDebug("TrigResRateMon") << " cannot find ME_2d for group " << fGroupNamePathsPair[j].first << endl;
02125 continue;
02126
02127 }
02128
02129 vector<int> updatedLumiCount(5,0);
02130
02131 float entireBXWindowUpdatedLumiCount = 0;
02132
02133 TH2F* hist_All = ME_2d->getTH2F();
02134
02135 for (unsigned int b = 0; b<diffCount.size();b++) {
02136
02137
02138 int binNumber = b+1;
02139
02140
02141 int currentLumiCount = int(hist_All->GetBinContent(lumi+1,binNumber));
02142 updatedLumiCount[b] = currentLumiCount + diffCount[b];
02143 hist_All->SetBinContent(lumi+1,binNumber,updatedLumiCount[b]);
02144
02145 entireBXWindowUpdatedLumiCount += updatedLumiCount[b];
02146
02147 }
02148
02149 MonitorElement* ME_2d_Norm = v_ME_Total_BX_Norm[j];
02150
02151 if (! ME_2d_Norm) {
02152
02153 LogDebug("TrigResRateMon") << " cannot find ME_2d_Norm for group " << fGroupNamePathsPair[j].first << endl;
02154 continue;
02155
02156 }
02157
02158 TH2F* hist_All_Norm = ME_2d_Norm->getTH2F();
02159
02160 for (unsigned int b = 0; b<diffCount.size();b++) {
02161
02162
02163 int binNumber = b+1;
02164
02165
02166 hist_All_Norm->SetBinContent(lumi+1,binNumber,float(updatedLumiCount[b])/entireBXWindowUpdatedLumiCount);
02167
02168 }
02169
02170 }
02171
02172 }
02173
02174 }
02175
02176 void TrigResRateMon::countHLTGroupL1HitsEndLumiBlock(const int& lumi)
02177 {
02178
02179 LogTrace("TrigResRateMon") << " countHLTGroupL1HitsEndLumiBlock() lumiSection number " << lumi << endl;
02180
02181 for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
02182
02183
02184 string fullPathToME = pathsSummaryFolder_ + "HLT_" + fGroupNamePathsPair[i].first+ "_Pass_Any";
02185 MonitorElement* ME_1d = dbe_->get(fullPathToME);
02186
02187 if(! ME_1d) {
02188
02189 LogTrace("TrigResRateMon") << " could not find 1d matrix " << fullPathToME << endl;
02190
02191 continue;
02192
02193 }
02194
02195 LogTrace("TrigResRateMon") << " Looking in histogram " << fullPathToME << endl;
02196
02197 TH1F * hist_1d = ME_1d->getTH1F();
02198
02199 for (std::vector<std::pair<std::string, float> >::iterator ip = fGroupL1TempCountPair.begin(); ip != fGroupL1TempCountPair.end(); ++ip) {
02200
02201
02202 string pathname = ip->first;
02203 float prevCount = ip->second;
02204
02205 string binLabel = "HLT_"+pathname+"_L1_Any";
02206
02207 LogTrace("TrigResRateMon") << " Looking for binLabel = " << binLabel << endl;
02208
02209 int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
02210
02211 LogTrace("TrigResRateMon") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << endl;
02212 if(pathBin == -1) {
02213
02214 LogTrace("TrigResRateMon") << " Cannot find the bin for path " << pathname << endl;
02215 continue;
02216
02217 }
02218
02219 float currCount = hist_1d->GetBinContent(pathBin)/LSsize_;
02220
02221
02222 float diffCount = currCount - prevCount;
02223
02224 LogTrace("TrigResRateMon") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << endl;
02225
02226
02227 ip->second = currCount;
02228
02229
02231
02233 string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_L1_Total_LS";
02234 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
02235 if ( ME_1d) {
02236
02237
02238 float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
02239 float updatedLumiCount = currentLumiCount + diffCount;
02240 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
02241
02242 }
02243 else {
02244
02245 LogDebug("TrigResRateMon") << " cannot find ME " << fullPathToME_count << endl;
02246
02247 }
02248
02249 }
02250
02251 }
02252
02253 }
02254
02255
02256 void TrigResRateMon::countHLTGroupHitsEndLumiBlock(const int& lumi)
02257 {
02258
02259 LogTrace("TrigResRateMon") << " countHLTGroupHitsEndLumiBlock() lumiSection number " << lumi << endl;
02260 for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
02261
02262
02263 string fullPathToME = pathsSummaryFolder_ + "HLT_" + fGroupNamePathsPair[i].first + "_Pass_Any";
02264 MonitorElement* ME_1d = dbe_->get(fullPathToME);
02265
02266 if(! ME_1d) {
02267
02268 LogTrace("TrigResRateMon") << " could not find 1d matrix " << fullPathToME << endl;
02269
02270 continue;
02271
02272 }
02273
02274 LogTrace("TrigResRateMon") << " Looking in histogram " << fullPathToME << endl;
02275
02276 TH1F * hist_1d = ME_1d->getTH1F();
02277
02278 for (std::vector<std::pair<std::string, float> >::iterator ip = fGroupTempCountPair.begin(); ip != fGroupTempCountPair.end(); ++ip) {
02279
02280
02281 string pathname = ip->first;
02282 float prevCount = ip->second;
02283
02284 string binLabel = "Total "+pathname;
02285
02286 LogTrace("TrigResRateMon") << " Looking for binLabel = " << binLabel << endl;
02287
02288
02289 int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
02290
02291 LogTrace("TrigResRateMon") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << endl;
02292 if(pathBin == -1) {
02293
02294 binLabel = pathname;
02295 int alternativePathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
02296
02297 if(alternativePathBin == -1) {
02298
02299 LogTrace("TrigResRateMon") << " Cannot find the bin for path " << pathname << endl;
02300
02301 continue;
02302
02303 }
02304 else {
02305
02306 pathBin = alternativePathBin;
02307
02308 }
02309
02310 }
02311
02312 float currCount = hist_1d->GetBinContent(pathBin)/LSsize_;
02313
02314
02315 float diffCount = currCount - prevCount;
02316
02317 LogTrace("TrigResRateMon") << " lumi = " << lumi << " path " << pathname << " diffCount " << diffCount << endl;
02318
02319
02320 ip->second = currCount;
02321
02323
02325 string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_Total_LS";
02326 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
02327
02328 string fullPathToME_2D_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_LS";
02329 MonitorElement* ME_2d = dbe_->get(fullPathToME_2D_count);
02330
02331 string fullPathToME_Stream_A_2D_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_A_LS";
02332 MonitorElement* ME_Stream_A_2d = dbe_->get(fullPathToME_Stream_A_2D_count);
02333
02334 if ( ME_1d && ME_2d && ME_Stream_A_2d) {
02335
02336
02337
02338 float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
02339 float updatedLumiCount = currentLumiCount + diffCount;
02340 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
02341
02342 string groupBinLabel = "Total " + fGroupNamePathsPair[i].first;
02343 int groupBin = ME_2d->getTH2F()->GetYaxis()->FindBin(groupBinLabel.c_str());
02344 if(groupBin != -1) ME_2d->getTH2F()->SetBinContent(lumi+1,groupBin,updatedLumiCount);
02345
02346
02347 groupBinLabel = fGroupNamePathsPair[i].first;
02348 groupBin = ME_Stream_A_2d->getTH2F()->GetYaxis()->FindBin(groupBinLabel.c_str());
02349 if(groupBin != -1) ME_Stream_A_2d->getTH2F()->SetBinContent(lumi+1,groupBin,updatedLumiCount);
02350
02351 }
02352 else {
02353
02354 LogDebug("TrigResRateMon") << " cannot find ME " << fullPathToME_count << endl;
02355
02356 }
02357
02358 }
02359
02360 }
02361
02362 }
02363
02364
02365 void TrigResRateMon::countHLTPathHitsEndLumiBlock(const int& lumi)
02366 {
02367
02368 LogTrace("TrigResRateMon") << " countHLTPathHitsEndLumiBlock() lumiSection number " << lumi << endl;
02369
02370 string fullPathToME = pathsSummaryFolder_ + "HLT_AllSelectedPaths_PassPass";
02371 MonitorElement* ME_2d = dbe_->get(fullPathToME);
02372
02373 if(! ME_2d) {
02374
02375 LogTrace("TrigResRateMon") << " could not fine 2d matrix " << fullPathToME << endl;
02376
02377 return;
02378
02379 }
02380
02381 TH2F * hist_2d = ME_2d->getTH2F();
02382
02383 for (std::vector<std::pair<std::string, float> >::iterator ip = fPathTempCountPair.begin(); ip != fPathTempCountPair.end(); ++ip) {
02384
02385
02386 std::string pathname = ip->first;
02387 float prevCount = ip->second;
02388
02389
02390 float pathBin = hist_2d->GetXaxis()->FindBin(pathname.c_str());
02391
02392 if(pathBin > hist_2d->GetNbinsX()) {
02393
02394 LogTrace("TrigResRateMon") << " Cannot find the bin for path " << pathname << endl;
02395 continue;
02396
02397 }
02398
02399 float currCount = hist_2d->GetBinContent(pathBin, pathBin)/LSsize_;
02400
02401
02402 float diffCount = currCount - prevCount;
02403
02404 LogTrace("TrigResRateMon") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << endl;
02405
02406
02407 ip->second = currCount;
02408
02410
02412 if ( ME_HLTAll_LS) {
02413
02414 TH2F* hist_All = ME_HLTAll_LS->getTH2F();
02415
02416
02417 int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
02418
02419
02420 float currentLumiCount = hist_All->GetBinContent(lumi+1,pathBinNumber);
02421 float updatedLumiCount = currentLumiCount + diffCount;
02422 hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
02423
02424 }
02425 else {
02426
02427 LogDebug("TrigResRateMon") << " cannot find ME_HLTAll_LS" << endl;
02428
02429 }
02430
02431 for (unsigned int i=0 ; i< v_ME_HLTAll_LS.size(); i++) {
02432
02433 MonitorElement* tempME = v_ME_HLTAll_LS[i];
02434
02435 if ( tempME ) {
02436
02437 TH2F* hist_All = tempME->getTH2F();
02438
02439
02440 int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
02441
02442 float currentLumiCount = hist_All->GetBinContent(lumi+1,pathBinNumber);
02443 float updatedLumiCount = currentLumiCount + diffCount;
02444 hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
02445
02446 }
02447 else {
02448
02449 LogDebug("TrigResRateMon") << " cannot find tempME " << endl;
02450
02451 }
02452
02453 }
02454
02455
02457
02459 string fullPathToME_count = pathsIndividualHLTPathsPerLSFolder_ + pathname + "_count_per_LS";
02460 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
02461 if ( ME_1d) {
02462
02463
02464 float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
02465 float updatedLumiCount = currentLumiCount + diffCount;
02466 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
02467
02468 }
02469 else {
02470
02471 LogDebug("TrigResRateMon") << " cannot find ME " << fullPathToME_count << endl;
02472
02473 }
02474
02475 }
02476
02477 }
02478
02479 int TrigResRateMon::getTriggerTypeParsePathName(const string& pathname)
02480 {
02481
02482 int objectType = 0;
02483
02484 if (pathname.find("MET") != std::string::npos)
02485 objectType = trigger::TriggerMET;
02486 if (pathname.find("SumET") != std::string::npos)
02487 objectType = trigger::TriggerTET;
02488 if (pathname.find("HT") != std::string::npos)
02489 objectType = trigger::TriggerTET;
02490 if (pathname.find("Jet") != std::string::npos)
02491 objectType = trigger::TriggerJet;
02492 if (pathname.find("Mu") != std::string::npos)
02493 objectType = trigger::TriggerMuon;
02494 if (pathname.find("Ele") != std::string::npos)
02495 objectType = trigger::TriggerElectron;
02496 if (pathname.find("Photon") != std::string::npos)
02497 objectType = trigger::TriggerPhoton;
02498 if (pathname.find("EG") != std::string::npos)
02499 objectType = trigger::TriggerPhoton;
02500 if (pathname.find("Tau") != std::string::npos)
02501 objectType = trigger::TriggerTau;
02502 if (pathname.find("IsoTrack") != std::string::npos)
02503 objectType = trigger::TriggerTrack;
02504 if (pathname.find("BTag") != std::string::npos)
02505 objectType = trigger::TriggerBJet;
02506
02507 return objectType;
02508 }
02509
02510 const string TrigResRateMon::getL1ConditionModuleName(const string& pathname)
02511 {
02512
02513
02514
02515
02516 string l1pathname = "dummy";
02517
02518 vector<string> numpathmodules = hltConfig_.moduleLabels(pathname);
02519
02520 for(vector<string>::iterator numpathmodule = numpathmodules.begin();
02521 numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
02522
02523 if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
02524
02525 l1pathname = *numpathmodule;
02526 break;
02527
02528 }
02529
02530 }
02531
02532 return l1pathname;
02533
02534 }
02535
02536
02537 bool TrigResRateMon::hasL1Passed(const string& pathname, const edm::TriggerNames & triggerNames)
02538 {
02539
02540 bool rc = false;
02541 int l1ModuleIndex = 999;
02542
02543 for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
02544
02545 if(v->getPath() == pathname ) l1ModuleIndex = v->getL1ModuleIndex();
02546
02547 }
02548
02549 unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
02550 if(pathByIndex >= triggerResults_->size() ) return rc;
02551
02552
02553 int lastModule = triggerResults_->index(pathByIndex);
02554
02555
02556
02557 rc = (l1ModuleIndex < lastModule);
02558
02559 return rc;
02560
02561 }
02562
02563 bool TrigResRateMon::hasHLTPassed(const string& pathname, const edm::TriggerNames & triggerNames)
02564 {
02565
02566 bool rc = false;
02567
02568 unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
02569 if(pathByIndex >= triggerResults_->size() ) return rc;
02570
02571 rc = triggerResults_->accept(pathByIndex);
02572 return rc;
02573
02574 }
02575
02576
02577 int TrigResRateMon::getThresholdFromName(const string & name)
02578 {
02579
02580 std::string pathname = name;
02581
02582
02583
02584
02585 if(pathname.find("L1") != std::string::npos) pathname.replace(pathname.find("L1"),2,"");
02586
02587 if(pathname.find("L2") != std::string::npos) pathname.replace(pathname.find("L2"),2,"");
02588
02589 if(pathname.find("8E29") != std::string::npos) pathname.replace(pathname.find("8E29"),4,"");
02590
02591 int digitLocation=0;
02592 for (unsigned int i=0; i < pathname.length(); i++)
02593 {
02594 if (isdigit(pathname.at(i))) {
02595
02596 digitLocation = i;
02597 break;
02598
02599 }
02600 }
02601
02602
02603 string hltThresholdString = pathname.substr(digitLocation);
02604
02605 int hltThreshold = 0;
02606
02607
02608 sscanf (hltThresholdString.c_str(),"%d%*s",&hltThreshold);
02609
02610
02611 return hltThreshold;
02612
02613 }
02614
02615 void TrigResRateMon::normalizeHLTMatrix() {
02616
02617 string fullPathToME;
02618
02619
02620
02621 vector<string> datasetNames = hltConfig_.streamContent("A") ;
02622
02623
02624 for (unsigned int i=0;i<datasetNames.size();i++) {
02625
02626 fullPathToME = pathsSummaryFolder_ +"HLT_"+datasetNames[i]+"_PassPass";
02627 v_ME_HLTPassPass.push_back( dbe_->get(fullPathToME));
02628
02629 fullPathToME = pathsSummaryHLTCorrelationsFolder_+"HLT_"+datasetNames[i]+"_PassPass_Normalized";
02630 v_ME_HLTPassPass_Normalized.push_back( dbe_->get(fullPathToME));
02631
02632 fullPathToME = pathsSummaryHLTCorrelationsFolder_+"HLT_"+datasetNames[i]+"_Pass_Normalized_Any";
02633 v_ME_HLTPass_Normalized_Any.push_back( dbe_->get(fullPathToME));
02634
02635 }
02636
02637
02638 fullPathToME = pathsSummaryFolder_ +"HLT_A_PassPass";
02639 v_ME_HLTPassPass.push_back( dbe_->get(fullPathToME));
02640
02641 fullPathToME = pathsSummaryHLTCorrelationsFolder_+"HLT_A_PassPass_Normalized";
02642 v_ME_HLTPassPass_Normalized.push_back( dbe_->get(fullPathToME));
02643
02644 fullPathToME = pathsSummaryHLTCorrelationsFolder_+"HLT_A_Pass_Normalized_Any";
02645 v_ME_HLTPass_Normalized_Any.push_back( dbe_->get(fullPathToME));
02646
02647 for (unsigned int i =0;i<v_ME_HLTPassPass.size();i++) {
02648
02649 MonitorElement* ME_HLTPassPass = v_ME_HLTPassPass[i];
02650 MonitorElement* ME_HLTPassPass_Normalized = v_ME_HLTPassPass_Normalized[i];
02651 MonitorElement* ME_HLTPass_Normalized_Any = v_ME_HLTPass_Normalized_Any[i];
02652
02653 if(!ME_HLTPassPass || !ME_HLTPassPass_Normalized || !ME_HLTPass_Normalized_Any) return;
02654
02655 float passCount = 0;
02656 unsigned int nBinsX = ME_HLTPassPass->getTH2F()->GetNbinsX();
02657 unsigned int nBinsY = ME_HLTPassPass->getTH2F()->GetNbinsY();
02658
02659 for(unsigned int binX = 0; binX < nBinsX+1; binX++) {
02660
02661 passCount = ME_HLTPassPass->getTH2F()->GetBinContent(binX,binX);
02662
02663
02664 for(unsigned int binY = 0; binY < nBinsY+1; binY++) {
02665
02666 if(passCount != 0) {
02667
02668
02669 float normalizedBinContentPassPass = (ME_HLTPassPass->getTH2F()->GetBinContent(binX,binY))/passCount;
02670
02671
02672 ME_HLTPassPass_Normalized->getTH2F()->SetBinContent(binX,binY,normalizedBinContentPassPass);
02673
02674
02675 if(binX == nBinsX) {
02676
02677 ME_HLTPass_Normalized_Any->getTH1F()->SetBinContent(binY,normalizedBinContentPassPass);
02678
02679 }
02680
02681 }
02682 else {
02683
02684 ME_HLTPassPass_Normalized->getTH2F()->SetBinContent(binX,binY,0);
02685
02686
02687 }
02688
02689 }
02690
02691 }
02692
02693 }
02694
02695 }