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 std::vector<MissingCollectionInfo> missing;
00416
00417
00418 getCollection( iEvent, missing, recoBeamSpotHandle, BSProducer_ , "Beam Spot handle");
00419
00420 reco::BeamSpot::Point BSPosition(0,0,0);
00421 BSPosition = recoBeamSpotHandle->position();
00422
00423 getCollection( iEvent, missing, hltjets, hltjets_, kHLTjets );
00424 getCollection( iEvent, missing, hltcorjets, hltcorjets_, kHLTCorjets );
00425 getCollection( iEvent, missing, hltcorL1L2L3jets,hltcorL1L2L3jets_, kHLTCorL1L2L3jets );
00426 getCollection( iEvent, missing, rho, rho_, kRho );
00427 getCollection( iEvent, missing, recjets, recjets_, kRecjets );
00428 getCollection( iEvent, missing, reccorjets, reccorjets_, kRecCorjets );
00429 getCollection( iEvent, missing, genjets, genjets_, kGenjets );
00430 getCollection( iEvent, missing, recmet, recmet_, kRecmet );
00431 getCollection( iEvent, missing, recoPFMet, recoPFMet_, kPFMet );
00432 getCollection( iEvent, missing, genmet, genmet_, kGenmet );
00433 getCollection( iEvent, missing, caloTowers, calotowers_, kCaloTowers );
00434 getCollection( iEvent, missing, caloTowersCleanerUpperR45, calotowersUpperR45_, kCaloTowersUpperR45 );
00435 getCollection( iEvent, missing, caloTowersCleanerLowerR45, calotowersLowerR45_, kCaloTowersLowerR45 );
00436 getCollection( iEvent, missing, caloTowersCleanerNoR45, calotowersNoR45_, kCaloTowersNoR45 );
00437 getCollection( iEvent, missing, ht, ht_, kHt );
00438 getCollection( iEvent, missing, recoPFJets, recoPFJets_, kRecoPFJets );
00439 getCollection( iEvent, missing, muon, muon_, kMuon );
00440 getCollection( iEvent, missing, pfmuon, pfmuon_, kpfMuon );
00441 getCollection( iEvent, missing, l2taus, L2Tau_, kTaus );
00442 getCollection( iEvent, missing, taus, HLTTau_, kTaus );
00443 getCollection( iEvent, missing, pftaus, PFTau_, kPFTaus );
00444 getCollection( iEvent, missing, pftausTightCone, PFTauTightCone_, kPFTausTightCone );
00445 getCollection( iEvent, missing, pfjets, PFJets_, kPFJets );
00446 getCollection( iEvent, missing, recoPftaus, RecoPFTau_, kRecoPFTaus );
00447 getCollection( iEvent, missing, theRecoPFTauDiscrByTanCOnePercent, RecoPFTauDiscrByTanCOnePercent_, ktheRecoPFTauDiscrByTanCOnePercent);
00448 getCollection( iEvent, missing, theRecoPFTauDiscrByTanCHalfPercent, RecoPFTauDiscrByTanCHalfPercent_, ktheRecoPFTauDiscrByTanCHalfPercent);
00449 getCollection( iEvent, missing, theRecoPFTauDiscrByTanCQuarterPercent, RecoPFTauDiscrByTanCQuarterPercent_, ktheRecoPFTauDiscrByTanCQuarterPercent);
00450 getCollection( iEvent, missing, theRecoPFTauDiscrByTanCTenthPercent, RecoPFTauDiscrByTanCTenthPercent_, ktheRecoPFTauDiscrByTanCTenthPercent);
00451 getCollection( iEvent, missing, theRecoPFTauDiscrByIsolation, RecoPFTauDiscrByIso_, ktheRecoPFTauDiscrByIsolation);
00452 getCollection( iEvent, missing, theRecoPFTauDiscrAgainstMuon, RecoPFTauAgainstMuon_, ktheRecoPFTauDiscrAgainstMuon);
00453 getCollection( iEvent, missing, theRecoPFTauDiscrAgainstElec, RecoPFTauAgainstElec_, ktheRecoPFTauDiscrAgainstElec);
00454 getCollection( iEvent, missing, hltresults, hltresults_, kHltresults );
00455 getCollection( iEvent, missing, l1extemi, m_l1extraemi, kL1extemi );
00456 getCollection( iEvent, missing, l1extemn, m_l1extraemn, kL1extemn );
00457 getCollection( iEvent, missing, l1extmu, m_l1extramu, kL1extmu );
00458 getCollection( iEvent, missing, l1extjetc, m_l1extrajetc, kL1extjetc );
00459 getCollection( iEvent, missing, l1extjetf, m_l1extrajetf, kL1extjetf );
00460 getCollection( iEvent, missing, l1extjet, m_l1extrajet, kL1extjet );
00461 getCollection( iEvent, missing, l1exttaujet, m_l1extrataujet, kL1exttaujet );
00462 getCollection( iEvent, missing, l1extmet, m_l1extramet, kL1extmet );
00463 getCollection( iEvent, missing, l1extmht, m_l1extramht, kL1extmht );
00464 getCollection( iEvent, missing, l1GtRR, gtReadoutRecord_, kL1GtRR );
00465 getCollection( iEvent, missing, gctBitCounts, gctBitCounts_, kL1GctBitCounts );
00466 getCollection( iEvent, missing, gctRingSums, gctRingSums_, kL1GctRingSums );
00467 getCollection( iEvent, missing, mctruth, mctruth_, kMctruth );
00468 getCollection( iEvent, missing, simTracks, simhits_, kSimhit );
00469 getCollection( iEvent, missing, simVertices, simhits_, kSimhit );
00470 getCollection( iEvent, missing, genEventInfo, genEventInfo_, kGenEventInfo );
00471 getCollection( iEvent, missing, mucands2, MuCandTag2_, kMucands2 );
00472 getCollection( iEvent, missing, munovtxcands2, MuNoVtxCandTag2_, kMunovtxcands2 );
00473 getCollection( iEvent, missing, mucands3, MuCandTag3_, kMucands3 );
00474 getCollection( iEvent, missing, oniaPixelCands, oniaPixelTag_, kOniaPixelCands );
00475 getCollection( iEvent, missing, oniaTrackCands, oniaTrackTag_, kOniaTrackCands );
00476 getCollection( iEvent, missing, trkmucands, TrackerMuonTag_, kTrkMucands );
00477 getCollection( iEvent, missing, dimuvtxcands3, DiMuVtx_, kDimuvtxcands3 );
00478 getCollection( iEvent, missing, isoMap2, MuIsolTag2_, kIsoMap2 );
00479 getCollection( iEvent, missing, isoMap3, MuIsolTag3_, kIsoMap3 );
00480 getCollection( iEvent, missing, isoTrk10Map3, MuTrkIsolTag3_, kIsoTrk10Map3 );
00481 getCollection( iEvent, missing, hRawBJets, m_rawBJets, kBTagJets );
00482 getCollection( iEvent, missing, hCorrectedBJets, m_correctedBJets, kBTagCorrectedJets );
00483 getCollection( iEvent, missing, hCorrectedBJetsL1FastJet, m_correctedBJetsL1FastJet, kBTagCorrectedJetsL1FastJet );
00484 getCollection( iEvent, missing, hPFBJets, m_pfBJets, kBTagPFJets );
00485 getCollection( iEvent, missing, hLifetimeBJetsL25, m_lifetimeBJetsL25, kBTagLifetimeBJetsL25 );
00486 getCollection( iEvent, missing, hLifetimeBJetsL3, m_lifetimeBJetsL3, kBTagLifetimeBJetsL3 );
00487 getCollection( iEvent, missing, hLifetimeBJetsL25L1FastJet, m_lifetimeBJetsL25L1FastJet, kBTagLifetimeBJetsL25L1FastJet );
00488 getCollection( iEvent, missing, hLifetimeBJetsL3L1FastJet, m_lifetimeBJetsL3L1FastJet, kBTagLifetimeBJetsL3L1FastJet );
00489 getCollection( iEvent, missing, hLifetimePFBJetsL3, m_lifetimePFBJetsL3, kBTagLifetimePFBJetsL3 );
00490 getCollection( iEvent, missing, hLifetimeBJetsL25SingleTrack, m_lifetimeBJetsL25SingleTrack, kBTagLifetimeBJetsL25SingleTrack );
00491 getCollection( iEvent, missing, hLifetimeBJetsL3SingleTrack, m_lifetimeBJetsL3SingleTrack, kBTagLifetimeBJetsL3SingleTrack );
00492 getCollection( iEvent, missing, hLifetimeBJetsL25SingleTrackL1FastJet, m_lifetimeBJetsL25SingleTrackL1FastJet, kBTagLifetimeBJetsL25SingleTrackL1FastJet );
00493 getCollection( iEvent, missing, hLifetimeBJetsL3SingleTrackL1FastJet, m_lifetimeBJetsL3SingleTrackL1FastJet, kBTagLifetimeBJetsL3SingleTrackL1FastJet );
00494 getCollection( iEvent, missing, hPerformanceBJetsL25, m_performanceBJetsL25, kBTagPerformanceBJetsL25 );
00495 getCollection( iEvent, missing, hPerformanceBJetsL3, m_performanceBJetsL3, kBTagPerformanceBJetsL3 );
00496 getCollection( iEvent, missing, hPerformanceBJetsL25L1FastJet,m_performanceBJetsL25L1FastJet, kBTagPerformanceBJetsL25L1FastJet );
00497 getCollection( iEvent, missing, hPerformanceBJetsL3L1FastJet, m_performanceBJetsL3L1FastJet, kBTagPerformanceBJetsL3L1FastJet );
00498 getCollection( iEvent, missing, electrons, Electron_, kElectrons );
00499 getCollection( iEvent, missing, photons, Photon_, kPhotons );
00500 getCollection( iEvent, missing, ActivityCandsHandle, ECALActivity_, kECALActivity);
00501 getCollection( iEvent, missing, ActivityEcalIsoHandle, ActivityEcalIso_, kECALActivityEcalIso);
00502 getCollection( iEvent, missing, ActivityHcalIsoHandle, ActivityHcalIso_, kECALActivityHcalIso);
00503 getCollection( iEvent, missing, ActivityTrackIsoHandle, ActivityTrackIso_, kECALActivityTrackIso);
00504 getCollection( iEvent, missing, ActivityR9Handle, ActivityR9_, kECALActivityR9);
00505 getCollection( iEvent, missing, ActivityR9IDHandle, ActivityR9ID_, kECALActivityR9ID);
00506 getCollection( iEvent, missing, ActivityHoverEHHandle, ActivityHoverEH_, kECALActivityHoverEH);
00507
00508
00509 std::vector<edm::Handle<edm::ValueMap<float> > > eIDValueMap(4);
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520 getCollection( iEvent, missing, recoIsolecalcands, CandIso_, kCandIso);
00521 getCollection( iEvent, missing, recoNonIsolecalcands, CandNonIso_, kCandNonIso);
00522 getCollection( iEvent, missing, EcalIsolMap, EcalIso_, kEcalIso);
00523 getCollection( iEvent, missing, EcalNonIsolMap, EcalNonIso_, kEcalNonIso);
00524 getCollection( iEvent, missing, HcalIsolMap, HcalIsoPho_, kHcalIsoPho);
00525 getCollection( iEvent, missing, HcalNonIsolMap, HcalNonIsoPho_, kHcalNonIsoPho);
00526 getCollection( iEvent, missing, photonR9IsoHandle, IsoR9_, kIsoR9);
00527 getCollection( iEvent, missing, photonR9NonIsoHandle, NonIsoR9_, kNonIsoR9);
00528 getCollection( iEvent, missing, photonR9IDIsoHandle, IsoR9ID_, kIsoR9ID);
00529 getCollection( iEvent, missing, photonR9IDNonIsoHandle, NonIsoR9ID_, kNonIsoR9ID);
00530 getCollection( iEvent, missing, photonHoverEHIsoHandle, IsoHoverEH_, kIsoHoverEH);
00531 getCollection( iEvent, missing, photonHoverEHNonIsoHandle,NonIsoHoverEH_, kNonIsoHoverEH);
00532 getCollection( iEvent, missing, electronIsoHandle, IsoElectron_, kIsoElectron);
00533 getCollection( iEvent, missing, HcalEleIsolMap, IsoEleHcal_, kIsoEleHcal);
00534 getCollection( iEvent, missing, TrackEleIsolMap, IsoEleTrackIsol_, kIsoEleTrackIsol);
00535 getCollection( iEvent, missing, L1IsoPixelSeedsMap, L1IsoPixelSeeds_, kL1IsoPixelSeeds);
00536 getCollection( iEvent, missing, L1NonIsoPixelSeedsMap, L1NonIsoPixelSeeds_, kL1NonIsoPixelSeeds);
00537 getCollection( iEvent, missing, electronNonIsoHandle, NonIsoElectron_, kNonIsoElectron);
00538 getCollection( iEvent, missing, HcalEleNonIsolMap, NonIsoEleHcal_, kIsoEleHcal);
00539 getCollection( iEvent, missing, NonIsoTrackEleIsolMap, NonIsoEleTrackIsol_, kNonIsoEleTrackIsol);
00540 getCollection( iEvent, missing, TrackNonIsolMap, NonIsoPhoTrackIsol_, kNonIsoPhoTrackIsol);
00541 getCollection( iEvent, missing, TrackIsolMap, IsoPhoTrackIsol_, kIsoPhoTrackIsol);
00542 getCollection( iEvent, missing, electronR9IsoHandle, IsoR9_, kIsoR9);
00543 getCollection( iEvent, missing, electronR9NonIsoHandle, NonIsoR9_, kNonIsoR9);
00544 getCollection( iEvent, missing, electronR9IDIsoHandle, IsoR9ID_, kIsoR9ID);
00545 getCollection( iEvent, missing, electronR9IDNonIsoHandle, NonIsoR9ID_, kNonIsoR9ID);
00546 getCollection( iEvent, missing, electronHFClusterHandle, HFECALClusters_, kHFECALClusters);
00547 getCollection( iEvent, missing, electronHFElectronHandle, HFElectrons_, kHFElectrons);
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557 getCollection( iEvent, missing, isopixeltracksL3, IsoPixelTrackTagL3_, kIsoPixelTracksL3 );
00558 getCollection( iEvent, missing, isopixeltracksL2, IsoPixelTrackTagL2_, kIsoPixelTracksL2 );
00559 getCollection( iEvent, missing, isopixeltrackPixVertices, IsoPixelTrackVerticesTag_, kIsoPixelTrackVertices );
00560 getCollection( iEvent, missing, pixeltracksL3, PixelTracksTagL3_, kPixelTracksL3 );
00561 getCollection( iEvent, missing, pixelfedsize, PixelFEDSizeTag_, kPixelFEDSize );
00562 getCollection( iEvent, missing, pixelclusters, PixelClustersTag_, kPixelClusters );
00563 getCollection( iEvent, missing, recoVertexsHLT, VertexTagHLT_, kRecoVerticesHLT );
00564 getCollection( iEvent, missing, recoVertexsOffline0, VertexTagOffline0_, kRecoVerticesOffline0 );
00565
00566 double ptHat=-1.;
00567 if (genEventInfo.isValid()) {ptHat=genEventInfo->qScale();}
00568
00569
00570
00571 if (not missing.empty() and (errCnt < errMax())) {
00572 errCnt++;
00573 std::stringstream out;
00574 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):";
00575 BOOST_FOREACH(const MissingCollectionInfo & entry, missing)
00576 out << "\n\t" << entry.first << ": " << entry.second->encode();
00577 edm::LogPrint("OpenHLT") << out.str() << std::endl;
00578 if (errCnt == errMax())
00579 edm::LogWarning("OpenHLT") << "Maximum error count reached -- No more messages will be printed.";
00580 }
00581
00582
00583 jet_analysis_.analyze(iEvent,
00584 hltjets,
00585 hltcorjets,
00586 hltcorL1L2L3jets,
00587 rho,
00588 recjets,
00589 reccorjets,
00590 genjets,
00591 recmet,
00592 genmet,
00593 ht,
00594 l2taus,
00595 taus,
00596 pftaus,
00597 pftausTightCone,
00598 pfjets,
00599 recoPftaus,
00600 theRecoPFTauDiscrByTanCOnePercent,
00601 theRecoPFTauDiscrByTanCHalfPercent,
00602 theRecoPFTauDiscrByTanCQuarterPercent,
00603 theRecoPFTauDiscrByTanCTenthPercent,
00604 theRecoPFTauDiscrByIsolation,
00605 theRecoPFTauDiscrAgainstMuon,
00606 theRecoPFTauDiscrAgainstElec,
00607 recoPFJets,
00608 caloTowers,
00609 caloTowersCleanerUpperR45,
00610 caloTowersCleanerLowerR45,
00611 caloTowersCleanerNoR45,
00612 recoPFMet,
00613 towerThreshold_,
00614 _MinPtGammas,
00615 _MinPtChargedHadrons,
00616 HltTree);
00617
00618 muon_analysis_.analyze(
00619 muon,
00620 pfmuon,
00621 l1extmu,
00622 mucands2,
00623 isoMap2,
00624 mucands3,
00625 isoMap3,
00626 isoTrk10Map3,
00627 oniaPixelCands,
00628 oniaTrackCands,
00629 dimuvtxcands3,
00630 munovtxcands2,
00631 trkmucands,
00632 theMagField,
00633 recoBeamSpotHandle,
00634
00635 HltTree);
00636
00637 elm_analysis_.analyze(
00638 electrons,
00639 photons,
00640 electronIsoHandle,
00641 electronNonIsoHandle,
00642 NonIsoTrackEleIsolMap,
00643 TrackEleIsolMap,
00644 L1IsoPixelSeedsMap,
00645 L1NonIsoPixelSeedsMap,
00646 recoIsolecalcands,
00647 recoNonIsolecalcands,
00648 EcalIsolMap,
00649 EcalNonIsolMap,
00650 HcalEleIsolMap,
00651 HcalEleNonIsolMap,
00652 HcalIsolMap,
00653 HcalNonIsolMap,
00654 TrackIsolMap,
00655 TrackNonIsolMap,
00656 lazyTools,
00657 theMagField,
00658 BSPosition,
00659 eIDValueMap,
00660 photonR9IsoHandle,
00661 photonR9NonIsoHandle,
00662 electronR9IsoHandle,
00663 electronR9NonIsoHandle,
00664 photonHoverEHIsoHandle,
00665 photonHoverEHNonIsoHandle,
00666 photonR9IDIsoHandle,
00667 photonR9IDNonIsoHandle,
00668 electronR9IDIsoHandle,
00669 electronR9IDNonIsoHandle,
00670 electronHFClusterHandle,
00671 electronHFElectronHandle,
00672 electronHFClusterAssociation,
00673 ActivityCandsHandle,
00674 ActivityEcalIsoHandle,
00675 ActivityHcalIsoHandle,
00676 ActivityTrackIsoHandle,
00677 ActivityR9Handle,
00678 ActivityR9IDHandle,
00679 ActivityHoverEHHandle,
00680 HltTree);
00681
00682 mct_analysis_.analyze(
00683 mctruth,
00684 ptHat,
00685 simTracks,
00686 simVertices,
00687 HltTree);
00688 track_analysis_.analyze(
00689 isopixeltracksL3,
00690 isopixeltracksL2,
00691 isopixeltrackPixVertices,
00692 pixeltracksL3,
00693 pixelfedsize,
00694 pixelclusters,
00695 HltTree);
00696
00697 hlt_analysis_.analyze(
00698 hltresults,
00699 l1extemi,
00700 l1extemn,
00701 l1extmu,
00702 l1extjetc,
00703 l1extjetf,
00704 l1extjet,
00705 l1exttaujet,
00706 l1extmet,
00707 l1extmht,
00708 l1GtRR,
00709 gctBitCounts,
00710 gctRingSums,
00711 iSetup,
00712 iEvent,
00713 HltTree);
00714
00715 bjet_analysis_.analyze(
00716 hRawBJets,
00717 hCorrectedBJets,
00718 hCorrectedBJetsL1FastJet,
00719 hPFBJets,
00720 hLifetimeBJetsL25,
00721 hLifetimeBJetsL3,
00722 hLifetimeBJetsL25L1FastJet,
00723 hLifetimeBJetsL3L1FastJet,
00724 hLifetimePFBJetsL3,
00725 hLifetimeBJetsL25SingleTrack,
00726 hLifetimeBJetsL3SingleTrack,
00727 hLifetimeBJetsL25SingleTrackL1FastJet,
00728 hLifetimeBJetsL3SingleTrackL1FastJet,
00729 hPerformanceBJetsL25,
00730 hPerformanceBJetsL3,
00731 hPerformanceBJetsL25L1FastJet,
00732 hPerformanceBJetsL3L1FastJet,
00733 HltTree);
00734
00735 vrt_analysisHLT_.analyze(
00736 recoVertexsHLT,
00737 HltTree);
00738
00739 vrt_analysisOffline0_.analyze(
00740 recoVertexsOffline0,
00741 HltTree);
00742
00743 evt_header_.analyze(iEvent, HltTree);
00744
00745
00746
00747
00748 if (m_file)
00749 m_file->cd();
00750 HltTree->Fill();
00751 }
00752
00753
00754 void HLTAnalyzer::endJob() {
00755
00756 if (m_file)
00757 m_file->cd();
00758
00759 const edm::ParameterSet &thepset = edm::getProcessParameterSet();
00760 TList *list = HltTree->GetUserInfo();
00761 list->Add(new TObjString(thepset.dump().c_str()));
00762
00763 HltTree->SetWeight(treeWeight);
00764 HltTree->Write();
00765 delete HltTree;
00766 HltTree = 0;
00767
00768 if (m_file) {
00769 m_file->Write();
00770 delete m_file;
00771 m_file = 0;
00772 }
00773
00774 }