00001
00002
00003
00004
00005
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <memory>
00020 #include <string>
00021
00022
00023 #include "FWCore/Framework/interface/Frameworkfwd.h"
00024 #include "FWCore/Framework/interface/EDAnalyzer.h"
00025
00026 #include "FWCore/Framework/interface/Event.h"
00027 #include "FWCore/Framework/interface/MakerMacros.h"
00028
00029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00030 #include "FWCore/Utilities/interface/InputTag.h"
00031
00032 #include "DataFormats/Common/interface/Handle.h"
00033 #include "DataFormats/L1Trigger/interface/L1EmParticle.h"
00034 #include "DataFormats/L1Trigger/interface/L1JetParticle.h"
00035 #include "DataFormats/L1Trigger/interface/L1MuonParticle.h"
00036 #include "DataFormats/L1Trigger/interface/L1EtMissParticle.h"
00037 #include "DataFormats/L1Trigger/interface/L1ParticleMap.h"
00038 #include "DataFormats/L1Trigger/interface/L1ParticleMapFwd.h"
00039 #include "DataFormats/L1Trigger/interface/L1HFRings.h"
00040 #include "DataFormats/L1Trigger/interface/L1HFRingsFwd.h"
00041 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00042
00043 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00044
00045 #include "TH1.h"
00046 #include "TFile.h"
00047
00048 using namespace std ;
00049
00050
00051
00052
00053
00054 class L1ExtraTestAnalyzer : public edm::EDAnalyzer {
00055 public:
00056 explicit L1ExtraTestAnalyzer(const edm::ParameterSet&);
00057 ~L1ExtraTestAnalyzer();
00058
00059
00060 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00061 private:
00062
00063
00064 edm::InputTag isoEmSource_ ;
00065 edm::InputTag nonIsoEmSource_ ;
00066 edm::InputTag cenJetSource_ ;
00067 edm::InputTag forJetSource_ ;
00068 edm::InputTag tauJetSource_ ;
00069 edm::InputTag muonSource_ ;
00070 edm::InputTag etMissSource_ ;
00071 edm::InputTag htMissSource_ ;
00072 edm::InputTag hfRingsSource_ ;
00073 edm::InputTag gtReadoutSource_ ;
00074 edm::InputTag particleMapSource_ ;
00075
00076 TFile file_ ;
00077 TH1F hist_ ;
00078 };
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 L1ExtraTestAnalyzer::L1ExtraTestAnalyzer(const edm::ParameterSet& iConfig)
00092 : isoEmSource_( iConfig.getParameter< edm::InputTag >(
00093 "isolatedEmSource" ) ),
00094 nonIsoEmSource_( iConfig.getParameter< edm::InputTag >(
00095 "nonIsolatedEmSource" ) ),
00096 cenJetSource_( iConfig.getParameter< edm::InputTag >(
00097 "centralJetSource" ) ),
00098 forJetSource_( iConfig.getParameter< edm::InputTag >(
00099 "forwardJetSource" ) ),
00100 tauJetSource_( iConfig.getParameter< edm::InputTag >(
00101 "tauJetSource" ) ),
00102 muonSource_( iConfig.getParameter< edm::InputTag >(
00103 "muonSource" ) ),
00104 etMissSource_( iConfig.getParameter< edm::InputTag >(
00105 "etMissSource" ) ),
00106 htMissSource_( iConfig.getParameter< edm::InputTag >(
00107 "htMissSource" ) ),
00108 hfRingsSource_( iConfig.getParameter< edm::InputTag >(
00109 "hfRingsSource" ) ),
00110 gtReadoutSource_( iConfig.getParameter< edm::InputTag >(
00111 "gtReadoutSource" ) ),
00112 particleMapSource_( iConfig.getParameter< edm::InputTag >(
00113 "particleMapSource" ) ),
00114 file_( "l1extra.root", "RECREATE" ),
00115 hist_( "triggers", "Triggers",
00116 2*l1extra::L1ParticleMap::kNumOfL1TriggerTypes + 1,
00117 -0.75,
00118 l1extra::L1ParticleMap::kNumOfL1TriggerTypes + 0.5 - 0.75 )
00119 {
00120
00121
00122 }
00123
00124
00125 L1ExtraTestAnalyzer::~L1ExtraTestAnalyzer()
00126 {
00127
00128
00129
00130 file_.cd() ;
00131 hist_.Write() ;
00132 }
00133
00134
00135
00136
00137
00138
00139
00140 void
00141 L1ExtraTestAnalyzer::analyze(const edm::Event& iEvent,
00142 const edm::EventSetup& iSetup)
00143 {
00144 using namespace edm ;
00145 using namespace l1extra ;
00146
00147 static int iev = 0 ;
00148 cout << "EVENT " << ++iev << endl ;
00149
00150 cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl ;
00151
00152
00153 Handle< L1EmParticleCollection > isoEmColl ;
00154 iEvent.getByLabel( isoEmSource_, isoEmColl ) ;
00155 cout << "Number of isolated EM " << isoEmColl->size() << endl ;
00156
00157 for( L1EmParticleCollection::const_iterator emItr = isoEmColl->begin() ;
00158 emItr != isoEmColl->end() ;
00159 ++emItr )
00160 {
00161 cout << " p4 (" << emItr->px()
00162 << ", " << emItr->py()
00163 << ", " << emItr->pz()
00164 << ", " << emItr->energy()
00165 << ") et " << emItr->et()
00166 << " eta " << emItr->eta()
00167 << " phi " << emItr->phi()
00168 << endl ;
00169 }
00170
00171
00172 Handle< L1EmParticleCollection > nonIsoEmColl ;
00173 iEvent.getByLabel( nonIsoEmSource_, nonIsoEmColl ) ;
00174 cout << "Number of non-isolated EM " << nonIsoEmColl->size() << endl ;
00175
00176 for( L1EmParticleCollection::const_iterator emItr = nonIsoEmColl->begin() ;
00177 emItr != nonIsoEmColl->end() ;
00178 ++emItr )
00179 {
00180 cout << " p4 (" << emItr->px()
00181 << ", " << emItr->py()
00182 << ", " << emItr->pz()
00183 << ", " << emItr->energy()
00184 << ") et " << emItr->et()
00185 << " eta " << emItr->eta()
00186 << " phi " << emItr->phi()
00187 << endl ;
00188 }
00189
00190
00191 Handle< L1JetParticleCollection > cenJetColl ;
00192 iEvent.getByLabel( cenJetSource_, cenJetColl ) ;
00193 cout << "Number of central jets " << cenJetColl->size() << endl ;
00194
00195 for( L1JetParticleCollection::const_iterator jetItr = cenJetColl->begin() ;
00196 jetItr != cenJetColl->end() ;
00197 ++jetItr )
00198 {
00199 cout << " p4 (" << jetItr->px()
00200 << ", " << jetItr->py()
00201 << ", " << jetItr->pz()
00202 << ", " << jetItr->energy()
00203 << ") et " << jetItr->et()
00204 << " eta " << jetItr->eta()
00205 << " phi " << jetItr->phi()
00206 << endl ;
00207 }
00208
00209 Handle< L1JetParticleCollection > forJetColl ;
00210 iEvent.getByLabel( forJetSource_, forJetColl ) ;
00211 cout << "Number of forward jets " << forJetColl->size() << endl ;
00212
00213 for( L1JetParticleCollection::const_iterator jetItr = forJetColl->begin() ;
00214 jetItr != forJetColl->end() ;
00215 ++jetItr )
00216 {
00217 cout << " p4 (" << jetItr->px()
00218 << ", " << jetItr->py()
00219 << ", " << jetItr->pz()
00220 << ", " << jetItr->energy()
00221 << ") et " << jetItr->et()
00222 << " eta " << jetItr->eta()
00223 << " phi " << jetItr->phi()
00224 << endl ;
00225 }
00226
00227 Handle< L1JetParticleCollection > tauColl ;
00228 iEvent.getByLabel( tauJetSource_, tauColl ) ;
00229 cout << "Number of tau jets " << tauColl->size() << endl ;
00230
00231 for( L1JetParticleCollection::const_iterator tauItr = tauColl->begin() ;
00232 tauItr != tauColl->end() ;
00233 ++tauItr )
00234 {
00235 cout << " p4 (" << tauItr->px()
00236 << ", " << tauItr->py()
00237 << ", " << tauItr->pz()
00238 << ", " << tauItr->energy()
00239 << ") et " << tauItr->et()
00240 << " eta " << tauItr->eta()
00241 << " phi " << tauItr->phi()
00242 << endl ;
00243 }
00244
00245
00246 Handle< L1MuonParticleCollection > muColl ;
00247 iEvent.getByLabel( muonSource_, muColl ) ;
00248 cout << "Number of muons " << muColl->size() << endl ;
00249
00250 for( L1MuonParticleCollection::const_iterator muItr = muColl->begin() ;
00251 muItr != muColl->end() ;
00252 ++muItr )
00253 {
00254 cout << " q " << muItr->charge()
00255 << " p4 (" << muItr->px()
00256 << ", " << muItr->py()
00257 << ", " << muItr->pz()
00258 << ", " << muItr->energy()
00259 << ") et " << muItr->et()
00260 << " eta " << muItr->eta() << endl
00261 << " phi " << muItr->phi()
00262 << " iso " << muItr->isIsolated()
00263 << " mip " << muItr->isMip()
00264 << " fwd " << muItr->isForward()
00265 << " rpc " << muItr->isRPC()
00266 << endl ;
00267 }
00268
00269
00270 Handle< L1EtMissParticleCollection > etMissColl ;
00271 iEvent.getByLabel( etMissSource_, etMissColl ) ;
00272 cout << "MET Coll (" << etMissColl->begin()->px()
00273 << ", " << etMissColl->begin()->py()
00274 << ", " << etMissColl->begin()->pz()
00275 << ", " << etMissColl->begin()->energy()
00276 << ") phi " << etMissColl->begin()->phi()
00277 << " EtTot " << etMissColl->begin()->etTotal()
00278 << endl ;
00279
00280
00281 Handle< L1EtMissParticleCollection > htMissColl ;
00282 iEvent.getByLabel( htMissSource_, htMissColl ) ;
00283 cout << "MHT Coll (" << htMissColl->begin()->px()
00284 << ", " << htMissColl->begin()->py()
00285 << ", " << htMissColl->begin()->pz()
00286 << ", " << htMissColl->begin()->energy()
00287 << ") phi " << htMissColl->begin()->phi()
00288 << " HtTot " << htMissColl->begin()->etTotal()
00289 << endl ;
00290
00291
00292 Handle< L1HFRingsCollection > hfRingsColl ;
00293 iEvent.getByLabel( hfRingsSource_, hfRingsColl ) ;
00294 cout << "HF Rings:" << endl ;
00295 for( int i = 0 ; i < L1HFRings::kNumRings ; ++i )
00296 {
00297 cout << " " << i << ": et sum = "
00298 << hfRingsColl->begin()->hfEtSum( (L1HFRings::HFRingLabels) i )
00299 << ", bit count = "
00300 << hfRingsColl->begin()->hfBitCount( (L1HFRings::HFRingLabels) i )
00301 << endl ;
00302 }
00303 cout << endl ;
00304
00305
00306
00307
00308
00309
00310 cout << endl ;
00311 }
00312
00313
00314 DEFINE_FWK_MODULE(L1ExtraTestAnalyzer);