Go to the documentation of this file.00001
00016 #include "DQMOffline/Trigger/interface/HLTTopPlotter.h"
00017
00018
00019
00020
00021 #include "DataFormats/Math/interface/deltaR.h"
00022
00023 #include "FWCore/ServiceRegistry/interface/Service.h"
00024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00025 #include "DataFormats/Common/interface/Handle.h"
00026 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
00027 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00028 #include "DataFormats/Candidate/interface/CandMatchMap.h"
00029 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00030 #include "DataFormats/VertexReco/interface/Vertex.h"
00031 #include "DataFormats/Common/interface/TriggerResults.h"
00032
00033
00034
00035 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
00036 #include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h"
00037
00038 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00039
00040 #include "TPRegexp.h"
00041 #include <iostream>
00042
00043 using namespace std;
00044 using namespace edm;
00045 using namespace reco;
00046 using namespace trigger;
00047 using namespace l1extra;
00048
00049
00050
00051 typedef std::vector< edm::ParameterSet > Parameters;
00052 typedef std::vector<reco::Muon> MuonCollection;
00053
00054
00055
00056
00057
00058
00059
00061 HLTTopPlotter::HLTTopPlotter
00062 ( const ParameterSet& pset, string triggerName, vector<string> moduleNames,
00063 MuonSelectionStruct inputSelection, string customName,
00064 vector<string> validTriggers,
00065 const edm::Run & currentRun,
00066 const edm::EventSetup & currentEventSetup)
00067 : HLTMuonMatchAndPlot(pset, triggerName, moduleNames, inputSelection, customName, validTriggers, currentRun, currentEventSetup)
00068
00069 {
00070
00071 CaloJetInputTag = pset.getParameter<edm::InputTag>("CaloJetInputTag");
00072 EtaCut_ = pset.getUntrackedParameter<double>("EtaCut");
00073 PtCut_ = pset.getUntrackedParameter<double>("PtCut");
00074 NJets_ = pset.getUntrackedParameter<int>("NJets");
00075 theJetMParameters = pset.getUntrackedParameter< vector<double> >("JetMParameters");
00076
00077
00078 LogTrace ("HLTMuonVal") << "\n\n Inside HLTTopPlotter Constructor";
00079 LogTrace ("HLTMuonVal") << "The trigger name is " << triggerName
00080 << "and we've done all the other intitializations";
00081
00082 LogTrace ("HLTMuonVal") << "exiting constructor\n\n";
00083
00084 }
00085
00086
00087
00088 void HLTTopPlotter::finish()
00089 {
00090
00091
00092
00093
00094
00095 HLTMuonMatchAndPlot::finish();
00096 }
00097
00098
00099
00100 void HLTTopPlotter::analyze( const Event & iEvent )
00101 {
00102
00103 LogTrace ("HLTMuonVal") << "Inside of TopPlotter analyze method!"
00104 << "calling my match and plot module's analyze..."
00105 << endl;
00106
00107
00108
00109
00110
00111
00112
00113 LogTrace ("HLTMuonVal") << "Do top-specific selection" << endl;
00114
00115
00116
00117 Handle<CaloJetCollection> jetsHandle;
00118 iEvent.getByLabel(CaloJetInputTag, jetsHandle);
00119
00120 int n_jets_20 = 0;
00121 CaloJetCollection selectedJets;
00122
00123 if (jetsHandle.isValid()) {
00124 LogTrace ("HLTMuonVal") << "Looking in jet collection" << endl;
00125
00126
00127
00128 const CaloJetCollection *jets = jetsHandle.product();
00129 CaloJetCollection::const_iterator jet;
00130
00131
00132
00133
00134
00135
00136 for (jet = jets->begin(); jet != jets->end(); jet++){
00137
00138 if (fabs(jet->eta()) <EtaCut_ && jet->et() > PtCut_) {
00139 n_jets_20++;
00140 selectedJets.push_back((*jet));
00141 }
00142
00143 }
00144
00145 }
00146
00147
00148
00149
00150 sortJets(selectedJets);
00151
00152
00153
00154 LogTrace ("HLTMuonVal") << "Number of jets in this event = "
00155 << n_jets_20
00156 << endl;
00157
00158
00159 if (n_jets_20 < NJets_ ) {
00160 LogTrace ("HLTMuonVal") << "Not enought jets in this event, skipping it"
00161 << endl;
00162
00163 return;
00164 }
00165
00166
00167
00169
00170
00171
00173
00174
00175
00176 LogTrace("HLTMuonVal") << "Calling analyze for muon ana" << endl;
00177 HLTMuonMatchAndPlot::analyze(iEvent);
00178
00179
00180 LogTrace ("HLTMuonVal") << "TOPPLOT: returned from muon ana, now in top module"
00181 << endl
00182 << "muon ana stored size rec muons = "
00183
00184 << endl;
00185
00186 vector<HLTMuonMatchAndPlot::MatchStruct>::const_iterator iRecMuon;
00187
00188 int numCands = 0;
00189 for ( unsigned int i = 0;
00190 i < recMatches.size();
00191 i++ ) {
00192
00193
00194 LogTrace ("HLTMuonVal") << "Cand " << numCands
00195 << ", Pt = "
00196 << recMatches[i].recCand->pt()
00197 << ", eta = "
00198 << recMatches[i].recCand->eta()
00199 << ", phi = "
00200 << recMatches[i].recCand->phi()
00201 << endl;
00202
00203
00204 double deltaRLeadJetLep = reco::deltaR (recMatches[i].recCand->eta(), recMatches[i].recCand->phi(),
00205 selectedJets[0].eta(), selectedJets[0].phi());
00206
00208
00209
00210
00212
00213 hDeltaRMaxJetLep[0]->Fill(deltaRLeadJetLep);
00214 hJetMultip[0]->Fill(n_jets_20);
00215
00216
00218
00219
00220
00222
00223
00224 if ( (recMatches[i].l1Cand.pt() > 0) && ((useFullDebugInformation) || (isL1Path)) ) {
00225 hDeltaRMaxJetLep[1]->Fill(deltaRLeadJetLep);
00226 hJetMultip[1]->Fill(n_jets_20);
00227 }
00228
00230
00231
00232
00234
00235 for ( size_t j = 0; j < recMatches[i].hltCands.size(); j++ ) {
00236 if ( recMatches[i].hltCands[j].pt() > 0 ) {
00237
00238 hDeltaRMaxJetLep[j+HLT_PLOT_OFFSET]->Fill(deltaRLeadJetLep);
00239 hJetMultip[j+HLT_PLOT_OFFSET]->Fill(n_jets_20);
00240
00241 }
00242 }
00243
00244
00245
00246 numCands++;
00247 }
00248
00249
00250 LogTrace ("HLTMuonVal") << "-----End of top plotter analyze method-----" << endl;
00251 }
00252
00253
00254
00255
00256 void HLTTopPlotter::begin()
00257 {
00258
00259 TString myLabel, newFolder;
00260 vector<TH1F*> h;
00261
00262 LogTrace ("HLTMuonVal") << "Inside begin for top analyzer" << endl;
00263
00264
00265 LogTrace ("HLTMuonVal") << "Calling begin for muon analyzer" << endl;
00266 HLTMuonMatchAndPlot::begin();
00267
00268 LogTrace ("HLTMuonVal") << "Continuing with top analyzer begin" << endl;
00269
00270 if ( dbe_ ) {
00271 dbe_->cd();
00272 dbe_->setCurrentFolder("HLT/Muon");
00273
00274
00275
00276
00277 myLabel = theL1CollectionLabel;
00278 myLabel = myLabel(myLabel.Index("L1"),myLabel.Length());
00279 myLabel = myLabel(0,myLabel.Index("Filtered")+8);
00280
00281
00282
00283
00284 newFolder = "HLT/Muon/Distributions/" + theTriggerName + "/" + mySelection.customLabel;
00285
00286
00287
00288 dbe_->setCurrentFolder( newFolder.Data() );
00289
00290 vector<string> binLabels;
00291 binLabels.push_back( theL1CollectionLabel.c_str() );
00292 for ( size_t i = 0; i < theHltCollectionLabels.size(); i++ )
00293 binLabels.push_back( theHltCollectionLabels[i].c_str() );
00294
00295
00296
00297
00298 if (useOldLabels) {
00299 myLabel = theL1CollectionLabel;
00300 myLabel = myLabel(myLabel.Index("L1"),myLabel.Length());
00301 myLabel = myLabel(0,myLabel.Index("Filtered")+8);
00302 } else {
00303 myLabel = "L1Filtered";
00304 }
00305
00306
00307
00308
00310
00311
00312
00314
00315 hDeltaRMaxJetLep.push_back (bookIt("topDeltaRMaxJetLep_All", "delta R between muon and highest pt jet", theDRParameters));
00316 if (useFullDebugInformation || isL1Path) hDeltaRMaxJetLep.push_back (bookIt("topDeltaRMaxJetLep_" + myLabel, "delta R between muon and highest pt jet", theDRParameters));
00317
00318 hJetMultip.push_back (bookIt("topJetMultip_All", "Jet multiplicity", theJetMParameters));
00319 if (useFullDebugInformation || isL1Path) hJetMultip.push_back(bookIt("topJetMultip_" + myLabel, "Jet multiplicity", theJetMParameters));
00320
00321
00323
00324
00325
00327
00328
00329
00330
00331 for ( unsigned int i = 0; i < theHltCollectionLabels.size(); i++ ) {
00332
00333 if (useOldLabels) {
00334 myLabel = theHltCollectionLabels[i];
00335 TString level = ( myLabel.Contains("L2") ) ? "L2" : "L3";
00336 myLabel = myLabel(myLabel.Index(level),myLabel.Length());
00337 myLabel = myLabel(0,myLabel.Index("Filtered")+8);
00338 } else {
00339 TString tempString = theHltCollectionLabels[i];
00340 TString level = ( tempString.Contains("L2") ) ? "L2" : "L3";
00341 myLabel = level + "Filtered";
00342 }
00343
00344
00345
00346 hDeltaRMaxJetLep.push_back (bookIt("topDeltaRMaxJetLep_" + myLabel, "delta R between muon and highest pt jet", theDRParameters)) ;
00347 hJetMultip.push_back (bookIt("topJetMultip_" + myLabel, "Jet Multiplicity", theJetMParameters)) ;
00348
00349
00350
00351 }
00352
00353 }
00354
00355 }
00356
00357
00358
00360
00361
00362
00364
00365
00366
00367
00368
00369
00370 void HLTTopPlotter::sortJets (CaloJetCollection & theJets) {
00371
00372
00373 LogTrace ("HLTMuonVal") << "Sorting Jets" << endl;
00374
00375
00376
00377 for ( unsigned int iJet = 0;
00378 iJet < theJets.size();
00379 iJet ++) {
00380
00381 for ( unsigned int jJet = iJet;
00382 jJet < theJets.size();
00383 jJet ++ ){
00384
00385 if ( theJets[jJet].et() > theJets[iJet].et() ) {
00386 reco::CaloJet tmpJet = theJets[iJet];
00387 theJets[iJet] = theJets[jJet];
00388 theJets[jJet] = tmpJet;
00389 }
00390
00391 }
00392
00393 }
00394
00395 for ( unsigned int iJet = 0;
00396 iJet != theJets.size();
00397 iJet ++ ) {
00398
00399 LogTrace ("HLTMuonVal") << "Jet # " << iJet
00400 << " Et = " << theJets[iJet].et()
00401 << endl;
00402
00403 }
00404
00405 }
00406
00407