00001
00002
00003
00004
00005 #include <boost/foreach.hpp>
00006
00007 #include "HLTrigger/HLTanalyzers/interface/HLTAnalyzer.h"
00008 #include "HLTMessages.h"
00009
00010 typedef std::pair<const char *, const edm::InputTag *> MissingCollectionInfo;
00011
00012 template <class T>
00013 static inline
00014 bool getCollection(const edm::Event & event, std::vector<MissingCollectionInfo> & missing, edm::Handle<T> & handle, const edm::InputTag & name, const char * description)
00015 {
00016 event.getByLabel(name, handle);
00017 bool valid = handle.isValid();
00018 if (not valid) {
00019 missing.push_back( std::make_pair(description, & name) );
00020 handle.clear();
00021
00022 }
00023 return valid;
00024 }
00025
00026
00027 HLTAnalyzer::HLTAnalyzer(edm::ParameterSet const& conf) {
00028
00029
00030
00031
00032 std::cout << " Beginning HLTAnalyzer Analysis " << std::endl;
00033
00034 hltjets_ = conf.getParameter<edm::InputTag> ("hltjets");
00035 hltcorjets_ = conf.getParameter<edm::InputTag> ("hltcorjets");
00036 hltcorL1L2L3jets_ = conf.getParameter<edm::InputTag> ("hltcorL1L2L3jets");
00037 rho_ = edm::InputTag("hltKT6CaloJets", "rho");
00038 recjets_ = conf.getParameter<edm::InputTag> ("recjets");
00039 reccorjets_ = conf.getParameter<edm::InputTag> ("reccorjets");
00040 genjets_ = conf.getParameter<edm::InputTag> ("genjets");
00041 recmet_ = conf.getParameter<edm::InputTag> ("recmet");
00042 recoPFMet_ = conf.getParameter<edm::InputTag> ("pfmet");
00043 genmet_ = conf.getParameter<edm::InputTag> ("genmet");
00044 ht_ = conf.getParameter<edm::InputTag> ("ht");
00045 recoPFJets_ = conf.getParameter<edm::InputTag> ("recoPFJets");
00046 calotowers_ = conf.getParameter<edm::InputTag> ("calotowers");
00047 calotowersUpperR45_ = conf.getParameter<edm::InputTag> ("calotowersUpperR45");
00048 calotowersLowerR45_ = conf.getParameter<edm::InputTag> ("calotowersLowerR45");
00049 calotowersNoR45_ = conf.getParameter<edm::InputTag> ("calotowersNoR45");
00050 muon_ = conf.getParameter<edm::InputTag> ("muon");
00051 pfmuon_ = conf.getParameter<edm::InputTag> ("pfmuon");
00052 mctruth_ = conf.getParameter<edm::InputTag> ("mctruth");
00053 genEventInfo_ = conf.getParameter<edm::InputTag> ("genEventInfo");
00054 simhits_ = conf.getParameter<edm::InputTag> ("simhits");
00055 xSection_ = conf.getUntrackedParameter<double> ("xSection",1.);
00056 filterEff_ = conf.getUntrackedParameter<double> ("filterEff",1.);
00057 firstLumi_ = conf.getUntrackedParameter<int> ("firstLumi",0);
00058 lastLumi_ = conf.getUntrackedParameter<int> ("lastLumi",-1);
00059 towerThreshold_ = conf.getParameter<double>("caloTowerThreshold");
00060
00061
00062
00063
00064
00065
00066 l1extramu_ = conf.getParameter<std::string> ("l1extramu");
00067 m_l1extramu = edm::InputTag(l1extramu_, "");
00068
00069
00070 l1extramc_ = conf.getParameter<std::string> ("l1extramc");
00071 m_l1extraemi = edm::InputTag(l1extramc_, "Isolated");
00072 m_l1extraemn = edm::InputTag(l1extramc_, "NonIsolated");
00073 m_l1extrajetc = edm::InputTag(l1extramc_, "Central");
00074 m_l1extrajetf = edm::InputTag(l1extramc_, "Forward");
00075 m_l1extrajet = edm::InputTag("gctInternJetProducer","Internal","ANALYSIS");
00076 m_l1extrataujet = edm::InputTag(l1extramc_, "Tau");
00077 m_l1extramet = edm::InputTag(l1extramc_, "MET");
00078 m_l1extramht = edm::InputTag(l1extramc_, "MHT");
00079
00080 hltresults_ = conf.getParameter<edm::InputTag> ("hltresults");
00081 gtReadoutRecord_ = conf.getParameter<edm::InputTag> ("l1GtReadoutRecord");
00082
00083 gctBitCounts_ = edm::InputTag( conf.getParameter<edm::InputTag>("l1GctHFBitCounts").label(), "" );
00084 gctRingSums_ = edm::InputTag( conf.getParameter<edm::InputTag>("l1GctHFRingSums").label(), "" );
00085
00086 MuCandTag2_ = conf.getParameter<edm::InputTag> ("MuCandTag2");
00087 MuIsolTag2_ = conf.getParameter<edm::InputTag> ("MuIsolTag2");
00088 MuNoVtxCandTag2_ = conf.getParameter<edm::InputTag> ("MuNoVtxCandTag2");
00089 MuCandTag3_ = conf.getParameter<edm::InputTag> ("MuCandTag3");
00090 MuIsolTag3_ = conf.getParameter<edm::InputTag> ("MuIsolTag3");
00091 MuTrkIsolTag3_ = conf.getParameter<edm::InputTag> ("MuTrkIsolTag3");
00092 TrackerMuonTag_ = conf.getParameter<edm::InputTag> ("TrackerMuonTag");
00093 oniaPixelTag_ = conf.getParameter<edm::InputTag> ("OniaPixelTag");
00094 oniaTrackTag_ = conf.getParameter<edm::InputTag> ("OniaTrackTag");
00095 DiMuVtx_ = conf.getParameter<edm::InputTag> ("DiMuVtx");
00096 L2Tau_ = conf.getParameter<edm::InputTag> ("L2Tau");
00097 HLTTau_ = conf.getParameter<edm::InputTag> ("HLTTau");
00098 PFTau_ = conf.getParameter<edm::InputTag> ("HLTPFTau");
00099 PFTauTightCone_ = conf.getParameter<edm::InputTag> ("HLTPFTauTightCone");
00100 _MinPtChargedHadrons = conf.getParameter<double>("minPtChargedHadronsForTaus");
00101 _MinPtGammas = conf.getParameter<double>("minPtGammassForTaus");
00102
00103 PFJets_ = conf.getParameter<edm::InputTag> ("HLTPFJet");
00104
00105
00106 RecoPFTau_ = conf.getParameter<edm::InputTag> ("RecoPFTau");
00107 RecoPFTauDiscrByTanCOnePercent_ = conf.getParameter<edm::InputTag> ("RecoPFTauDiscrByTanCOnePercent");
00108 RecoPFTauDiscrByTanCHalfPercent_ = conf.getParameter<edm::InputTag> ("RecoPFTauDiscrByTanCHalfPercent");
00109 RecoPFTauDiscrByTanCQuarterPercent_ = conf.getParameter<edm::InputTag> ("RecoPFTauDiscrByTanCQuarterPercent");
00110 RecoPFTauDiscrByTanCTenthPercent_ = conf.getParameter<edm::InputTag> ("RecoPFTauDiscrByTanCTenthPercent");
00111 RecoPFTauDiscrByIso_ = conf.getParameter<edm::InputTag> ("RecoPFTauDiscrByIso");
00112 RecoPFTauAgainstMuon_ = conf.getParameter<edm::InputTag> ("RecoPFTauAgainstMuon");
00113 RecoPFTauAgainstElec_ = conf.getParameter<edm::InputTag> ("RecoPFTauAgainstElec");
00114
00115
00116
00117 m_rawBJets = conf.getParameter<edm::InputTag>("CommonBJetsL2");
00118 m_correctedBJets = conf.getParameter<edm::InputTag>("CorrectedBJetsL2");
00119 m_correctedBJetsL1FastJet = conf.getParameter<edm::InputTag>("CorrectedBJetsL2L1FastJet");
00120 m_pfBJets = conf.getParameter<edm::InputTag>("PFlowBJetsL2");
00121 m_lifetimeBJetsL25 = conf.getParameter<edm::InputTag>("LifetimeBJetsL25");
00122 m_lifetimeBJetsL3 = conf.getParameter<edm::InputTag>("LifetimeBJetsL3");
00123 m_lifetimeBJetsL25L1FastJet = conf.getParameter<edm::InputTag>("LifetimeBJetsL25L1FastJet");
00124 m_lifetimeBJetsL3L1FastJet = conf.getParameter<edm::InputTag>("LifetimeBJetsL3L1FastJet");
00125 m_lifetimePFBJetsL3 = conf.getParameter<edm::InputTag>("LifetimePFlowBJetsL3");
00126 m_lifetimeBJetsL25SingleTrack = conf.getParameter<edm::InputTag>("LifetimeBJetsL25SingleTrack");
00127 m_lifetimeBJetsL3SingleTrack = conf.getParameter<edm::InputTag>("LifetimeBJetsL3SingleTrack");
00128 m_lifetimeBJetsL25SingleTrackL1FastJet = conf.getParameter<edm::InputTag>("LifetimeBJetsL25SingleTrackL1FastJet");
00129 m_lifetimeBJetsL3SingleTrackL1FastJet = conf.getParameter<edm::InputTag>("LifetimeBJetsL3SingleTrackL1FastJet");
00130 m_performanceBJetsL25 = conf.getParameter<edm::InputTag>("PerformanceBJetsL25");
00131 m_performanceBJetsL3 = conf.getParameter<edm::InputTag>("PerformanceBJetsL3");
00132 m_performanceBJetsL25L1FastJet = conf.getParameter<edm::InputTag>("PerformanceBJetsL25L1FastJet");
00133 m_performanceBJetsL3L1FastJet = conf.getParameter<edm::InputTag>("PerformanceBJetsL3L1FastJet");
00134
00135
00136 Electron_ = conf.getParameter<edm::InputTag> ("Electron");
00137 Photon_ = conf.getParameter<edm::InputTag> ("Photon");
00138 CandIso_ = conf.getParameter<edm::InputTag> ("CandIso");
00139 CandNonIso_ = conf.getParameter<edm::InputTag> ("CandNonIso");
00140 EcalIso_ = conf.getParameter<edm::InputTag> ("EcalIso");
00141 EcalNonIso_ = conf.getParameter<edm::InputTag> ("EcalNonIso");
00142 HcalIsoPho_ = conf.getParameter<edm::InputTag> ("HcalIsoPho");
00143 HcalNonIsoPho_ = conf.getParameter<edm::InputTag> ("HcalNonIsoPho");
00144 IsoPhoTrackIsol_ = conf.getParameter<edm::InputTag> ("IsoPhoTrackIsol");
00145 NonIsoPhoTrackIsol_ = conf.getParameter<edm::InputTag> ("NonIsoPhoTrackIsol");
00146 IsoElectron_ = conf.getParameter<edm::InputTag> ("IsoElectrons");
00147 NonIsoElectron_ = conf.getParameter<edm::InputTag> ("NonIsoElectrons");
00148 IsoEleHcal_ = conf.getParameter<edm::InputTag> ("HcalIsoEle");
00149 NonIsoEleHcal_ = conf.getParameter<edm::InputTag> ("HcalNonIsoEle");
00150 IsoEleTrackIsol_ = conf.getParameter<edm::InputTag> ("IsoEleTrackIsol");
00151 NonIsoEleTrackIsol_ = conf.getParameter<edm::InputTag> ("NonIsoEleTrackIsol");
00152 L1IsoPixelSeeds_ = conf.getParameter<edm::InputTag> ("PixelSeedL1Iso");
00153 L1NonIsoPixelSeeds_ = conf.getParameter<edm::InputTag> ("PixelSeedL1NonIso");
00154 IsoR9_ = conf.getParameter<edm::InputTag> ("SpikeCleaningIsol");
00155 NonIsoR9_ = conf.getParameter<edm::InputTag> ("SpikeCleaningNonIsol");
00156 IsoHoverEH_ = conf.getParameter<edm::InputTag> ("HcalForHoverEIsol");
00157 NonIsoHoverEH_ = conf.getParameter<edm::InputTag> ("HcalForHoverENonIsol");
00158 IsoR9ID_ = conf.getParameter<edm::InputTag> ("R9IDIsol");
00159 NonIsoR9ID_ = conf.getParameter<edm::InputTag> ("R9IDNonIsol");
00160 HFECALClusters_ = conf.getParameter<edm::InputTag> ("HFECALClusters");
00161 HFElectrons_ = conf.getParameter<edm::InputTag> ("HFElectrons");
00162
00163
00164 ECALActivity_ = conf.getParameter<edm::InputTag> ("ECALActivity");
00165 ActivityEcalIso_ = conf.getParameter<edm::InputTag> ("ActivityEcalIso");
00166 ActivityHcalIso_ = conf.getParameter<edm::InputTag> ("ActivityHcalIso");
00167 ActivityTrackIso_ = conf.getParameter<edm::InputTag> ("ActivityTrackIso");
00168 ActivityR9_ = conf.getParameter<edm::InputTag> ("ActivityR9");
00169 ActivityR9ID_ = conf.getParameter<edm::InputTag> ("ActivityR9ID");
00170 ActivityHoverEH_ = conf.getParameter<edm::InputTag> ("ActivityHcalForHoverE");
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188 PixelTracksTagL3_ = conf.getParameter<edm::InputTag> ("PixelTracksL3");
00189 PixelFEDSizeTag_ = conf.getParameter<edm::InputTag> ("PixelFEDSize");
00190 PixelClustersTag_ = conf.getParameter<edm::InputTag> ("PixelClusters");
00191
00192
00193 VertexTagHLT_ = conf.getParameter<edm::InputTag> ("PrimaryVertices");
00194 VertexTagOffline0_ = conf.getParameter<edm::InputTag> ("OfflinePrimaryVertices0");
00195
00196 m_file = 0;
00197 errCnt = 0;
00198
00199
00200 edm::ParameterSet runParameters = conf.getParameter<edm::ParameterSet>("RunParameters");
00201 _HistName = runParameters.getUntrackedParameter<std::string>("HistogramFile", "test.root");
00202 _EtaMin = runParameters.getUntrackedParameter<double>("EtaMin", -5.2);
00203 _EtaMax = runParameters.getUntrackedParameter<double>("EtaMax", 5.2);
00204
00205
00206
00207
00208 m_file = new TFile(_HistName.c_str(), "RECREATE");
00209 if (m_file)
00210 m_file->cd();
00211
00212
00213 HltTree = new TTree("HltTree", "");
00214
00215 treeWeight=xSection_*filterEff_;
00216 std::cout << "\n Setting HltTree weight to " << treeWeight << " = " << xSection_ << "*" << filterEff_ << " (cross section * gen filter efficiency)\n" << std::endl;
00217
00218
00219 jet_analysis_.setup(conf, HltTree);
00220 bjet_analysis_.setup(conf, HltTree);
00221 elm_analysis_.setup(conf, HltTree);
00222 muon_analysis_.setup(conf, HltTree);
00223 track_analysis_.setup(conf, HltTree);
00224 mct_analysis_.setup(conf, HltTree);
00225 hlt_analysis_.setup(conf, HltTree);
00226 vrt_analysisHLT_.setup(conf, HltTree, "HLT");
00227 vrt_analysisOffline0_.setup(conf, HltTree, "Offline0");
00228 evt_header_.setup(HltTree);
00229 }
00230
00231 void HLTAnalyzer::beginRun(const edm::Run& run, const edm::EventSetup& c){
00232
00233 hlt_analysis_.beginRun(run, c);
00234 }
00235
00236
00237 void HLTAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) {
00238
00239
00240
00241
00242
00243
00244 int iLumi = iEvent.luminosityBlock();
00245 if (iLumi<firstLumi_) return;
00246 if (lastLumi_ != -1 && iLumi>lastLumi_) return;
00247
00248
00249
00250 edm::Handle<reco::CaloJetCollection> hltjets;
00251 edm::Handle<reco::CaloJetCollection> hltcorjets;
00252 edm::Handle<reco::CaloJetCollection> hltcorL1L2L3jets;
00253 edm::Handle<double> rho;
00254 edm::Handle<reco::CaloJetCollection> recjets;
00255 edm::Handle<reco::CaloJetCollection> reccorjets;
00256 edm::Handle<reco::GenJetCollection> genjets;
00257 edm::Handle<CaloTowerCollection> caloTowers;
00258 edm::Handle<CaloTowerCollection> caloTowersCleanerUpperR45;
00259 edm::Handle<CaloTowerCollection> caloTowersCleanerLowerR45;
00260 edm::Handle<CaloTowerCollection> caloTowersCleanerNoR45;
00261 edm::Handle<reco::CaloMETCollection> recmet;
00262 edm::Handle<reco::PFMETCollection> recoPFMet;
00263 edm::Handle<reco::GenMETCollection> genmet;
00264 edm::Handle<reco::METCollection> ht;
00265 edm::Handle<reco::PFJetCollection> recoPFJets;
00266 edm::Handle<reco::CandidateView> mctruth;
00267 edm::Handle<GenEventInfoProduct> genEventInfo;
00268 edm::Handle<std::vector<SimTrack> > simTracks;
00269 edm::Handle<std::vector<SimVertex> > simVertices;
00270 edm::Handle<reco::MuonCollection> muon;
00271 edm::Handle<reco::PFCandidateCollection> pfmuon;
00272 edm::Handle<edm::TriggerResults> hltresults;
00273 edm::Handle<l1extra::L1EmParticleCollection> l1extemi, l1extemn;
00274 edm::Handle<l1extra::L1MuonParticleCollection> l1extmu;
00275 edm::Handle<l1extra::L1JetParticleCollection> l1extjetc, l1extjetf, l1extjet, l1exttaujet;
00276
00277 edm::Handle<l1extra::L1EtMissParticleCollection> l1extmet,l1extmht;
00278 edm::Handle<L1GlobalTriggerReadoutRecord> l1GtRR;
00279 edm::Handle< L1GctHFBitCountsCollection > gctBitCounts ;
00280 edm::Handle< L1GctHFRingEtSumsCollection > gctRingSums ;
00281
00282 edm::Handle<reco::RecoChargedCandidateCollection> mucands2, mucands3, munovtxcands2;
00283 edm::Handle<reco::RecoChargedCandidateCollection> oniaPixelCands, oniaTrackCands;
00284 edm::Handle<reco::VertexCollection> dimuvtxcands3;
00285 edm::Handle<reco::MuonCollection> trkmucands;
00286 edm::Handle<edm::ValueMap<bool> > isoMap2, isoMap3, isoTrk10Map3;
00287 edm::Handle<reco::CaloJetCollection> l2taus;
00288 edm::Handle<reco::HLTTauCollection> taus;
00289 edm::Handle<reco::PFTauCollection> pftaus;
00290 edm::Handle<reco::PFTauCollection> pftausTightCone;
00291 edm::Handle<reco::PFJetCollection> pfjets;
00292
00293
00294 edm::Handle<reco::PFTauCollection> recoPftaus;
00295 edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrByTanCOnePercent;
00296 edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrByTanCHalfPercent;
00297 edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrByTanCQuarterPercent;
00298 edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrByTanCTenthPercent;
00299 edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrByIsolation;
00300 edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrAgainstMuon;
00301 edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrAgainstElec;
00302
00303
00304
00305 edm::Handle<edm::View<reco::Jet> > hRawBJets;
00306 edm::Handle<edm::View<reco::Jet> > hCorrectedBJets;
00307 edm::Handle<edm::View<reco::Jet> > hCorrectedBJetsL1FastJet;
00308 edm::Handle<edm::View<reco::Jet> > hPFBJets;
00309 edm::Handle<reco::JetTagCollection> hLifetimeBJetsL25;
00310 edm::Handle<reco::JetTagCollection> hLifetimeBJetsL3L1FastJet;
00311 edm::Handle<reco::JetTagCollection> hLifetimeBJetsL25L1FastJet;
00312 edm::Handle<reco::JetTagCollection> hLifetimeBJetsL3;
00313 edm::Handle<reco::JetTagCollection> hLifetimePFBJetsL3;
00314 edm::Handle<reco::JetTagCollection> hLifetimeBJetsL25SingleTrack;
00315 edm::Handle<reco::JetTagCollection> hLifetimeBJetsL3SingleTrack;
00316 edm::Handle<reco::JetTagCollection> hLifetimeBJetsL25SingleTrackL1FastJet;
00317 edm::Handle<reco::JetTagCollection> hLifetimeBJetsL3SingleTrackL1FastJet;
00318 edm::Handle<reco::JetTagCollection> hPerformanceBJetsL25;
00319 edm::Handle<reco::JetTagCollection> hPerformanceBJetsL3;
00320 edm::Handle<reco::JetTagCollection> hPerformanceBJetsL25L1FastJet;
00321 edm::Handle<reco::JetTagCollection> hPerformanceBJetsL3L1FastJet;
00322
00323
00324 edm::Handle<reco::GsfElectronCollection> electrons;
00325 edm::Handle<reco::PhotonCollection> photons;
00326 edm::Handle<reco::RecoEcalCandidateIsolationMap> photonR9IsoHandle;
00327 edm::Handle<reco::RecoEcalCandidateIsolationMap> photonR9NonIsoHandle;
00328 edm::Handle<reco::RecoEcalCandidateIsolationMap> photonR9IDIsoHandle;
00329 edm::Handle<reco::RecoEcalCandidateIsolationMap> photonR9IDNonIsoHandle;
00330 edm::Handle<reco::RecoEcalCandidateIsolationMap> photonHoverEHIsoHandle;
00331 edm::Handle<reco::RecoEcalCandidateIsolationMap> photonHoverEHNonIsoHandle;
00332 edm::Handle<reco::ElectronCollection> electronIsoHandle;
00333 edm::Handle<reco::ElectronCollection> electronNonIsoHandle;
00334 edm::Handle<reco::RecoEcalCandidateIsolationMap> electronR9IsoHandle;
00335 edm::Handle<reco::RecoEcalCandidateIsolationMap> electronR9NonIsoHandle;
00336 edm::Handle<reco::RecoEcalCandidateIsolationMap> electronR9IDIsoHandle;
00337 edm::Handle<reco::RecoEcalCandidateIsolationMap> electronR9IDNonIsoHandle;
00338 edm::Handle<reco::ElectronIsolationMap> NonIsoTrackEleIsolMap;
00339 edm::Handle<reco::ElectronIsolationMap> TrackEleIsolMap;
00340 edm::Handle<reco::ElectronSeedCollection> L1IsoPixelSeedsMap;
00341 edm::Handle<reco::ElectronSeedCollection> L1NonIsoPixelSeedsMap;
00342 edm::Handle<reco::RecoEcalCandidateCollection> recoIsolecalcands;
00343 edm::Handle<reco::RecoEcalCandidateCollection> recoNonIsolecalcands;
00344 edm::Handle<reco::RecoEcalCandidateIsolationMap> EcalIsolMap;
00345 edm::Handle<reco::RecoEcalCandidateIsolationMap> EcalNonIsolMap;
00346 edm::Handle<reco::RecoEcalCandidateIsolationMap> HcalEleIsolMap;
00347 edm::Handle<reco::RecoEcalCandidateIsolationMap> HcalEleNonIsolMap;
00348 edm::Handle<reco::RecoEcalCandidateIsolationMap> HcalIsolMap;
00349 edm::Handle<reco::RecoEcalCandidateIsolationMap> HcalNonIsolMap;
00350 edm::Handle<reco::RecoEcalCandidateIsolationMap> TrackIsolMap;
00351 edm::Handle<reco::RecoEcalCandidateIsolationMap> TrackNonIsolMap;
00352 edm::Handle<reco::SuperClusterCollection> electronHFClusterHandle;
00353 edm::Handle<reco::RecoEcalCandidateCollection> electronHFElectronHandle;
00354
00355 edm::Handle<reco::RecoEcalCandidateCollection> ActivityCandsHandle;
00356 edm::Handle<reco::RecoEcalCandidateIsolationMap> ActivityEcalIsoHandle;
00357 edm::Handle<reco::RecoEcalCandidateIsolationMap> ActivityHcalIsoHandle;
00358 edm::Handle<reco::RecoEcalCandidateIsolationMap> ActivityTrackIsoHandle;
00359 edm::Handle<reco::RecoEcalCandidateIsolationMap> ActivityR9Handle;
00360 edm::Handle<reco::RecoEcalCandidateIsolationMap> ActivityR9IDHandle;
00361 edm::Handle<reco::RecoEcalCandidateIsolationMap> ActivityHoverEHHandle;
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375 edm::Handle<reco::IsolatedPixelTrackCandidateCollection> isopixeltracksL3;
00376 edm::Handle<reco::IsolatedPixelTrackCandidateCollection> isopixeltracksL2;
00377 edm::Handle<reco::VertexCollection> isopixeltrackPixVertices;
00378 edm::Handle<reco::RecoChargedCandidateCollection> pixeltracksL3;
00379 edm::Handle<FEDRawDataCollection> pixelfedsize;
00380 edm::Handle<edmNew::DetSetVector<SiPixelCluster> > pixelclusters;
00381
00382
00383 edm::Handle<reco::VertexCollection> recoVertexsHLT;
00384 edm::Handle<reco::VertexCollection> recoVertexsOffline0;
00385
00386
00387 edm::InputTag ecalRechitEBTag (std::string("hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
00388 edm::InputTag ecalRechitEETag (std::string("hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
00389 EcalClusterLazyTools lazyTools( iEvent, iSetup, ecalRechitEBTag, ecalRechitEETag);
00390
00391 edm::Handle<reco::HFEMClusterShapeAssociationCollection> electronHFClusterAssociation;
00392 iEvent.getByLabel(edm::InputTag("hltHFEMClusters"),electronHFClusterAssociation);
00393
00394 edm::ESHandle<MagneticField> theMagField;
00395 iSetup.get<IdealMagneticFieldRecord>().get(theMagField);
00396
00397 edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
00398 edm::InputTag BSProducer_(std::string("hltOnlineBeamSpot"));
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416 edm::Handle<std::vector< PileupSummaryInfo > > pupInfo;
00417
00418
00419
00420 std::vector<MissingCollectionInfo> missing;
00421
00422
00423 getCollection( iEvent, missing, recoBeamSpotHandle, BSProducer_ , "Beam Spot handle");
00424
00425 reco::BeamSpot::Point BSPosition(0,0,0);
00426 BSPosition = recoBeamSpotHandle->position();
00427
00428 getCollection( iEvent, missing, hltjets, hltjets_, kHLTjets );
00429 getCollection( iEvent, missing, hltcorjets, hltcorjets_, kHLTCorjets );
00430 getCollection( iEvent, missing, hltcorL1L2L3jets,hltcorL1L2L3jets_, kHLTCorL1L2L3jets );
00431 getCollection( iEvent, missing, rho, rho_, kRho );
00432 getCollection( iEvent, missing, recjets, recjets_, kRecjets );
00433 getCollection( iEvent, missing, reccorjets, reccorjets_, kRecCorjets );
00434 getCollection( iEvent, missing, genjets, genjets_, kGenjets );
00435 getCollection( iEvent, missing, recmet, recmet_, kRecmet );
00436 getCollection( iEvent, missing, recoPFMet, recoPFMet_, kPFMet );
00437 getCollection( iEvent, missing, genmet, genmet_, kGenmet );
00438 getCollection( iEvent, missing, caloTowers, calotowers_, kCaloTowers );
00439 getCollection( iEvent, missing, caloTowersCleanerUpperR45, calotowersUpperR45_, kCaloTowersUpperR45 );
00440 getCollection( iEvent, missing, caloTowersCleanerLowerR45, calotowersLowerR45_, kCaloTowersLowerR45 );
00441 getCollection( iEvent, missing, caloTowersCleanerNoR45, calotowersNoR45_, kCaloTowersNoR45 );
00442 getCollection( iEvent, missing, ht, ht_, kHt );
00443 getCollection( iEvent, missing, recoPFJets, recoPFJets_, kRecoPFJets );
00444 getCollection( iEvent, missing, muon, muon_, kMuon );
00445 getCollection( iEvent, missing, pfmuon, pfmuon_, kpfMuon );
00446 getCollection( iEvent, missing, l2taus, L2Tau_, kTaus );
00447 getCollection( iEvent, missing, taus, HLTTau_, kTaus );
00448 getCollection( iEvent, missing, pftaus, PFTau_, kPFTaus );
00449 getCollection( iEvent, missing, pftausTightCone, PFTauTightCone_, kPFTausTightCone );
00450 getCollection( iEvent, missing, pfjets, PFJets_, kPFJets );
00451 getCollection( iEvent, missing, recoPftaus, RecoPFTau_, kRecoPFTaus );
00452 getCollection( iEvent, missing, theRecoPFTauDiscrByTanCOnePercent, RecoPFTauDiscrByTanCOnePercent_, ktheRecoPFTauDiscrByTanCOnePercent);
00453 getCollection( iEvent, missing, theRecoPFTauDiscrByTanCHalfPercent, RecoPFTauDiscrByTanCHalfPercent_, ktheRecoPFTauDiscrByTanCHalfPercent);
00454 getCollection( iEvent, missing, theRecoPFTauDiscrByTanCQuarterPercent, RecoPFTauDiscrByTanCQuarterPercent_, ktheRecoPFTauDiscrByTanCQuarterPercent);
00455 getCollection( iEvent, missing, theRecoPFTauDiscrByTanCTenthPercent, RecoPFTauDiscrByTanCTenthPercent_, ktheRecoPFTauDiscrByTanCTenthPercent);
00456 getCollection( iEvent, missing, theRecoPFTauDiscrByIsolation, RecoPFTauDiscrByIso_, ktheRecoPFTauDiscrByIsolation);
00457 getCollection( iEvent, missing, theRecoPFTauDiscrAgainstMuon, RecoPFTauAgainstMuon_, ktheRecoPFTauDiscrAgainstMuon);
00458 getCollection( iEvent, missing, theRecoPFTauDiscrAgainstElec, RecoPFTauAgainstElec_, ktheRecoPFTauDiscrAgainstElec);
00459 getCollection( iEvent, missing, hltresults, hltresults_, kHltresults );
00460 getCollection( iEvent, missing, l1extemi, m_l1extraemi, kL1extemi );
00461 getCollection( iEvent, missing, l1extemn, m_l1extraemn, kL1extemn );
00462 getCollection( iEvent, missing, l1extmu, m_l1extramu, kL1extmu );
00463 getCollection( iEvent, missing, l1extjetc, m_l1extrajetc, kL1extjetc );
00464 getCollection( iEvent, missing, l1extjetf, m_l1extrajetf, kL1extjetf );
00465 getCollection( iEvent, missing, l1extjet, m_l1extrajet, kL1extjet );
00466 getCollection( iEvent, missing, l1exttaujet, m_l1extrataujet, kL1exttaujet );
00467 getCollection( iEvent, missing, l1extmet, m_l1extramet, kL1extmet );
00468 getCollection( iEvent, missing, l1extmht, m_l1extramht, kL1extmht );
00469 getCollection( iEvent, missing, l1GtRR, gtReadoutRecord_, kL1GtRR );
00470 getCollection( iEvent, missing, gctBitCounts, gctBitCounts_, kL1GctBitCounts );
00471 getCollection( iEvent, missing, gctRingSums, gctRingSums_, kL1GctRingSums );
00472 getCollection( iEvent, missing, mctruth, mctruth_, kMctruth );
00473 getCollection( iEvent, missing, simTracks, simhits_, kSimhit );
00474 getCollection( iEvent, missing, simVertices, simhits_, kSimhit );
00475 getCollection( iEvent, missing, genEventInfo, genEventInfo_, kGenEventInfo );
00476 getCollection( iEvent, missing, mucands2, MuCandTag2_, kMucands2 );
00477 getCollection( iEvent, missing, munovtxcands2, MuNoVtxCandTag2_, kMunovtxcands2 );
00478 getCollection( iEvent, missing, mucands3, MuCandTag3_, kMucands3 );
00479 getCollection( iEvent, missing, oniaPixelCands, oniaPixelTag_, kOniaPixelCands );
00480 getCollection( iEvent, missing, oniaTrackCands, oniaTrackTag_, kOniaTrackCands );
00481 getCollection( iEvent, missing, trkmucands, TrackerMuonTag_, kTrkMucands );
00482 getCollection( iEvent, missing, dimuvtxcands3, DiMuVtx_, kDimuvtxcands3 );
00483 getCollection( iEvent, missing, isoMap2, MuIsolTag2_, kIsoMap2 );
00484 getCollection( iEvent, missing, isoMap3, MuIsolTag3_, kIsoMap3 );
00485 getCollection( iEvent, missing, isoTrk10Map3, MuTrkIsolTag3_, kIsoTrk10Map3 );
00486 getCollection( iEvent, missing, hRawBJets, m_rawBJets, kBTagJets );
00487 getCollection( iEvent, missing, hCorrectedBJets, m_correctedBJets, kBTagCorrectedJets );
00488 getCollection( iEvent, missing, hCorrectedBJetsL1FastJet, m_correctedBJetsL1FastJet, kBTagCorrectedJetsL1FastJet );
00489 getCollection( iEvent, missing, hPFBJets, m_pfBJets, kBTagPFJets );
00490 getCollection( iEvent, missing, hLifetimeBJetsL25, m_lifetimeBJetsL25, kBTagLifetimeBJetsL25 );
00491 getCollection( iEvent, missing, hLifetimeBJetsL3, m_lifetimeBJetsL3, kBTagLifetimeBJetsL3 );
00492 getCollection( iEvent, missing, hLifetimeBJetsL25L1FastJet, m_lifetimeBJetsL25L1FastJet, kBTagLifetimeBJetsL25L1FastJet );
00493 getCollection( iEvent, missing, hLifetimeBJetsL3L1FastJet, m_lifetimeBJetsL3L1FastJet, kBTagLifetimeBJetsL3L1FastJet );
00494 getCollection( iEvent, missing, hLifetimePFBJetsL3, m_lifetimePFBJetsL3, kBTagLifetimePFBJetsL3 );
00495 getCollection( iEvent, missing, hLifetimeBJetsL25SingleTrack, m_lifetimeBJetsL25SingleTrack, kBTagLifetimeBJetsL25SingleTrack );
00496 getCollection( iEvent, missing, hLifetimeBJetsL3SingleTrack, m_lifetimeBJetsL3SingleTrack, kBTagLifetimeBJetsL3SingleTrack );
00497 getCollection( iEvent, missing, hLifetimeBJetsL25SingleTrackL1FastJet, m_lifetimeBJetsL25SingleTrackL1FastJet, kBTagLifetimeBJetsL25SingleTrackL1FastJet );
00498 getCollection( iEvent, missing, hLifetimeBJetsL3SingleTrackL1FastJet, m_lifetimeBJetsL3SingleTrackL1FastJet, kBTagLifetimeBJetsL3SingleTrackL1FastJet );
00499 getCollection( iEvent, missing, hPerformanceBJetsL25, m_performanceBJetsL25, kBTagPerformanceBJetsL25 );
00500 getCollection( iEvent, missing, hPerformanceBJetsL3, m_performanceBJetsL3, kBTagPerformanceBJetsL3 );
00501 getCollection( iEvent, missing, hPerformanceBJetsL25L1FastJet,m_performanceBJetsL25L1FastJet, kBTagPerformanceBJetsL25L1FastJet );
00502 getCollection( iEvent, missing, hPerformanceBJetsL3L1FastJet, m_performanceBJetsL3L1FastJet, kBTagPerformanceBJetsL3L1FastJet );
00503 getCollection( iEvent, missing, electrons, Electron_, kElectrons );
00504 getCollection( iEvent, missing, photons, Photon_, kPhotons );
00505 getCollection( iEvent, missing, ActivityCandsHandle, ECALActivity_, kECALActivity);
00506 getCollection( iEvent, missing, ActivityEcalIsoHandle, ActivityEcalIso_, kECALActivityEcalIso);
00507 getCollection( iEvent, missing, ActivityHcalIsoHandle, ActivityHcalIso_, kECALActivityHcalIso);
00508 getCollection( iEvent, missing, ActivityTrackIsoHandle, ActivityTrackIso_, kECALActivityTrackIso);
00509 getCollection( iEvent, missing, ActivityR9Handle, ActivityR9_, kECALActivityR9);
00510 getCollection( iEvent, missing, ActivityR9IDHandle, ActivityR9ID_, kECALActivityR9ID);
00511 getCollection( iEvent, missing, ActivityHoverEHHandle, ActivityHoverEH_, kECALActivityHoverEH);
00512
00513
00514 std::vector<edm::Handle<edm::ValueMap<float> > > eIDValueMap(4);
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525 getCollection( iEvent, missing, recoIsolecalcands, CandIso_, kCandIso);
00526 getCollection( iEvent, missing, recoNonIsolecalcands, CandNonIso_, kCandNonIso);
00527 getCollection( iEvent, missing, EcalIsolMap, EcalIso_, kEcalIso);
00528 getCollection( iEvent, missing, EcalNonIsolMap, EcalNonIso_, kEcalNonIso);
00529 getCollection( iEvent, missing, HcalIsolMap, HcalIsoPho_, kHcalIsoPho);
00530 getCollection( iEvent, missing, HcalNonIsolMap, HcalNonIsoPho_, kHcalNonIsoPho);
00531 getCollection( iEvent, missing, photonR9IsoHandle, IsoR9_, kIsoR9);
00532 getCollection( iEvent, missing, photonR9NonIsoHandle, NonIsoR9_, kNonIsoR9);
00533 getCollection( iEvent, missing, photonR9IDIsoHandle, IsoR9ID_, kIsoR9ID);
00534 getCollection( iEvent, missing, photonR9IDNonIsoHandle, NonIsoR9ID_, kNonIsoR9ID);
00535 getCollection( iEvent, missing, photonHoverEHIsoHandle, IsoHoverEH_, kIsoHoverEH);
00536 getCollection( iEvent, missing, photonHoverEHNonIsoHandle,NonIsoHoverEH_, kNonIsoHoverEH);
00537 getCollection( iEvent, missing, electronIsoHandle, IsoElectron_, kIsoElectron);
00538 getCollection( iEvent, missing, HcalEleIsolMap, IsoEleHcal_, kIsoEleHcal);
00539 getCollection( iEvent, missing, TrackEleIsolMap, IsoEleTrackIsol_, kIsoEleTrackIsol);
00540 getCollection( iEvent, missing, L1IsoPixelSeedsMap, L1IsoPixelSeeds_, kL1IsoPixelSeeds);
00541 getCollection( iEvent, missing, L1NonIsoPixelSeedsMap, L1NonIsoPixelSeeds_, kL1NonIsoPixelSeeds);
00542 getCollection( iEvent, missing, electronNonIsoHandle, NonIsoElectron_, kNonIsoElectron);
00543 getCollection( iEvent, missing, HcalEleNonIsolMap, NonIsoEleHcal_, kIsoEleHcal);
00544 getCollection( iEvent, missing, NonIsoTrackEleIsolMap, NonIsoEleTrackIsol_, kNonIsoEleTrackIsol);
00545 getCollection( iEvent, missing, TrackNonIsolMap, NonIsoPhoTrackIsol_, kNonIsoPhoTrackIsol);
00546 getCollection( iEvent, missing, TrackIsolMap, IsoPhoTrackIsol_, kIsoPhoTrackIsol);
00547 getCollection( iEvent, missing, electronR9IsoHandle, IsoR9_, kIsoR9);
00548 getCollection( iEvent, missing, electronR9NonIsoHandle, NonIsoR9_, kNonIsoR9);
00549 getCollection( iEvent, missing, electronR9IDIsoHandle, IsoR9ID_, kIsoR9ID);
00550 getCollection( iEvent, missing, electronR9IDNonIsoHandle, NonIsoR9ID_, kNonIsoR9ID);
00551 getCollection( iEvent, missing, electronHFClusterHandle, HFECALClusters_, kHFECALClusters);
00552 getCollection( iEvent, missing, electronHFElectronHandle, HFElectrons_, kHFElectrons);
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562 getCollection( iEvent, missing, isopixeltracksL3, IsoPixelTrackTagL3_, kIsoPixelTracksL3 );
00563 getCollection( iEvent, missing, isopixeltracksL2, IsoPixelTrackTagL2_, kIsoPixelTracksL2 );
00564 getCollection( iEvent, missing, isopixeltrackPixVertices, IsoPixelTrackVerticesTag_, kIsoPixelTrackVertices );
00565 getCollection( iEvent, missing, pixeltracksL3, PixelTracksTagL3_, kPixelTracksL3 );
00566 getCollection( iEvent, missing, pixelfedsize, PixelFEDSizeTag_, kPixelFEDSize );
00567 getCollection( iEvent, missing, pixelclusters, PixelClustersTag_, kPixelClusters );
00568 getCollection( iEvent, missing, recoVertexsHLT, VertexTagHLT_, kRecoVerticesHLT );
00569 getCollection( iEvent, missing, recoVertexsOffline0, VertexTagOffline0_, kRecoVerticesOffline0 );
00570
00571 getCollection( iEvent, missing, pupInfo, pileupInfo_, kPileupInfo );
00572
00573 double ptHat=-1.;
00574 if (genEventInfo.isValid()) {ptHat=genEventInfo->qScale();}
00575
00576
00577
00578 if (not missing.empty() and (errCnt < errMax())) {
00579 errCnt++;
00580 std::stringstream out;
00581 out << "OpenHLT analyser - missing collections (This message is for information only. RECO collections will always be missing when running on RAW, MC collections will always be missing when running on data):";
00582 BOOST_FOREACH(const MissingCollectionInfo & entry, missing)
00583 out << "\n\t" << entry.first << ": " << entry.second->encode();
00584 edm::LogPrint("OpenHLT") << out.str() << std::endl;
00585 if (errCnt == errMax())
00586 edm::LogWarning("OpenHLT") << "Maximum error count reached -- No more messages will be printed.";
00587 }
00588
00589
00590 jet_analysis_.analyze(iEvent,
00591 hltjets,
00592 hltcorjets,
00593 hltcorL1L2L3jets,
00594 rho,
00595 recjets,
00596 reccorjets,
00597 genjets,
00598 recmet,
00599 genmet,
00600 ht,
00601 l2taus,
00602 taus,
00603 pftaus,
00604 pftausTightCone,
00605 pfjets,
00606 recoPftaus,
00607 theRecoPFTauDiscrByTanCOnePercent,
00608 theRecoPFTauDiscrByTanCHalfPercent,
00609 theRecoPFTauDiscrByTanCQuarterPercent,
00610 theRecoPFTauDiscrByTanCTenthPercent,
00611 theRecoPFTauDiscrByIsolation,
00612 theRecoPFTauDiscrAgainstMuon,
00613 theRecoPFTauDiscrAgainstElec,
00614 recoPFJets,
00615 caloTowers,
00616 caloTowersCleanerUpperR45,
00617 caloTowersCleanerLowerR45,
00618 caloTowersCleanerNoR45,
00619 recoPFMet,
00620 towerThreshold_,
00621 _MinPtGammas,
00622 _MinPtChargedHadrons,
00623 HltTree);
00624
00625 muon_analysis_.analyze(
00626 muon,
00627 pfmuon,
00628 l1extmu,
00629 mucands2,
00630 isoMap2,
00631 mucands3,
00632 isoMap3,
00633 isoTrk10Map3,
00634 oniaPixelCands,
00635 oniaTrackCands,
00636 dimuvtxcands3,
00637 munovtxcands2,
00638 trkmucands,
00639 theMagField,
00640 recoBeamSpotHandle,
00641
00642 HltTree);
00643
00644 elm_analysis_.analyze(
00645 electrons,
00646 photons,
00647 electronIsoHandle,
00648 electronNonIsoHandle,
00649 NonIsoTrackEleIsolMap,
00650 TrackEleIsolMap,
00651 L1IsoPixelSeedsMap,
00652 L1NonIsoPixelSeedsMap,
00653 recoIsolecalcands,
00654 recoNonIsolecalcands,
00655 EcalIsolMap,
00656 EcalNonIsolMap,
00657 HcalEleIsolMap,
00658 HcalEleNonIsolMap,
00659 HcalIsolMap,
00660 HcalNonIsolMap,
00661 TrackIsolMap,
00662 TrackNonIsolMap,
00663 lazyTools,
00664 theMagField,
00665 BSPosition,
00666 eIDValueMap,
00667 photonR9IsoHandle,
00668 photonR9NonIsoHandle,
00669 electronR9IsoHandle,
00670 electronR9NonIsoHandle,
00671 photonHoverEHIsoHandle,
00672 photonHoverEHNonIsoHandle,
00673 photonR9IDIsoHandle,
00674 photonR9IDNonIsoHandle,
00675 electronR9IDIsoHandle,
00676 electronR9IDNonIsoHandle,
00677 electronHFClusterHandle,
00678 electronHFElectronHandle,
00679 electronHFClusterAssociation,
00680 ActivityCandsHandle,
00681 ActivityEcalIsoHandle,
00682 ActivityHcalIsoHandle,
00683 ActivityTrackIsoHandle,
00684 ActivityR9Handle,
00685 ActivityR9IDHandle,
00686 ActivityHoverEHHandle,
00687 HltTree);
00688
00689 mct_analysis_.analyze(
00690 mctruth,
00691 ptHat,
00692 simTracks,
00693 simVertices,
00694 pupInfo,
00695 HltTree);
00696 track_analysis_.analyze(
00697 isopixeltracksL3,
00698 isopixeltracksL2,
00699 isopixeltrackPixVertices,
00700 pixeltracksL3,
00701 pixelfedsize,
00702 pixelclusters,
00703 HltTree);
00704
00705 hlt_analysis_.analyze(
00706 hltresults,
00707 l1extemi,
00708 l1extemn,
00709 l1extmu,
00710 l1extjetc,
00711 l1extjetf,
00712 l1extjet,
00713 l1exttaujet,
00714 l1extmet,
00715 l1extmht,
00716 l1GtRR,
00717 gctBitCounts,
00718 gctRingSums,
00719 iSetup,
00720 iEvent,
00721 HltTree);
00722
00723 bjet_analysis_.analyze(
00724 hRawBJets,
00725 hCorrectedBJets,
00726 hCorrectedBJetsL1FastJet,
00727 hPFBJets,
00728 hLifetimeBJetsL25,
00729 hLifetimeBJetsL3,
00730 hLifetimeBJetsL25L1FastJet,
00731 hLifetimeBJetsL3L1FastJet,
00732 hLifetimePFBJetsL3,
00733 hLifetimeBJetsL25SingleTrack,
00734 hLifetimeBJetsL3SingleTrack,
00735 hLifetimeBJetsL25SingleTrackL1FastJet,
00736 hLifetimeBJetsL3SingleTrackL1FastJet,
00737 hPerformanceBJetsL25,
00738 hPerformanceBJetsL3,
00739 hPerformanceBJetsL25L1FastJet,
00740 hPerformanceBJetsL3L1FastJet,
00741 HltTree);
00742
00743 vrt_analysisHLT_.analyze(
00744 recoVertexsHLT,
00745 HltTree);
00746
00747 vrt_analysisOffline0_.analyze(
00748 recoVertexsOffline0,
00749 HltTree);
00750
00751
00752 evt_header_.analyze(iEvent, HltTree);
00753
00754
00755
00756
00757 if (m_file)
00758 m_file->cd();
00759 HltTree->Fill();
00760 }
00761
00762
00763 void HLTAnalyzer::endJob() {
00764
00765 if (m_file)
00766 m_file->cd();
00767
00768 const edm::ParameterSet &thepset = edm::getProcessParameterSet();
00769 TList *list = HltTree->GetUserInfo();
00770 list->Add(new TObjString(thepset.dump().c_str()));
00771
00772 HltTree->SetWeight(treeWeight);
00773 HltTree->Write();
00774 delete HltTree;
00775 HltTree = 0;
00776
00777 if (m_file) {
00778 m_file->Write();
00779 delete m_file;
00780 m_file = 0;
00781 }
00782
00783 }