1 |
bpollack |
1.1 |
// -*- C++ -*-
|
2 |
|
|
//
|
3 |
|
|
// Package: Dummy
|
4 |
|
|
// Class: Dummy
|
5 |
|
|
//
|
6 |
|
|
/**\class Dummy Dummy.cc src/Dummy.cc
|
7 |
|
|
|
8 |
|
|
Description: Dummy analyzer. Counts events - very important!
|
9 |
|
|
|
10 |
|
|
*/
|
11 |
|
|
//
|
12 |
|
|
// Original Author: Andrey Pozdnyakov
|
13 |
|
|
// Created: Wed Jul 8 11:08:04 CEST 2009
|
14 |
|
|
// $Id: Dummy.cc,v 1.1 2011/07/05 18:32:32 andrey Exp $
|
15 |
|
|
//
|
16 |
|
|
//
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
// system include files
|
20 |
|
|
#include <memory>
|
21 |
|
|
|
22 |
|
|
// user include files
|
23 |
|
|
#include "FWCore/FramewoFrameworkfwd.h"
|
24 |
|
|
#include "FWCore/FramewoEDAnalyzer.h"
|
25 |
|
|
#include "FWCore/FramewoESHandle.h"
|
26 |
|
|
|
27 |
|
|
#include "FWCore/FramewoEvent.h"
|
28 |
|
|
#include "FWCore/FramewoMakerMacros.h"
|
29 |
|
|
|
30 |
|
|
#include "FWCore/FramewoRun.h"
|
31 |
|
|
#include "FWCore/ParameterSParameterSet.h"
|
32 |
|
|
#include "FWCore/ServiceRegistService.h"
|
33 |
|
|
#include "CommonTools/UtilAlgTFileService.h"
|
34 |
|
|
|
35 |
|
|
#include "SimDataFormats/GeneratorProducGenRunInfoProduct.h"
|
36 |
|
|
|
37 |
|
|
#include "TROOT.h"
|
38 |
|
|
#include "TSystem.h"
|
39 |
|
|
#include "TFile.h"
|
40 |
|
|
#include "TH1.h"
|
41 |
|
|
|
42 |
|
|
using namespace edm;
|
43 |
|
|
using namespace std;
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
class Dummy : public edm::EDAnalyzer {
|
47 |
|
|
public:
|
48 |
|
|
explicit Dummy(const edm::ParameterSet&);
|
49 |
|
|
~Dummy();
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
private:
|
53 |
|
|
virtual void beginJob() ;
|
54 |
|
|
virtual void analyze(const edm::Event&, const edm::EventSetup&);
|
55 |
|
|
virtual void endJob() ;
|
56 |
|
|
|
57 |
|
|
TH1F *EV;
|
58 |
|
|
// TTree *gTree;
|
59 |
|
|
float cs;
|
60 |
|
|
edm::Service<TFileService> fs;
|
61 |
|
|
|
62 |
|
|
};
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
Dummy::Dummy(const edm::ParameterSet& iConfig)
|
66 |
|
|
{}
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
Dummy::~Dummy()
|
70 |
|
|
{}
|
71 |
|
|
|
72 |
|
|
void Dummy::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
|
73 |
|
|
{
|
74 |
|
|
using namespace edm;
|
75 |
|
|
|
76 |
|
|
Bool_t isRealData = iEvent.isRealData();
|
77 |
|
|
|
78 |
|
|
double sigma =10.;
|
79 |
|
|
|
80 |
|
|
if (!isRealData)
|
81 |
|
|
{
|
82 |
|
|
//That stuff doesn't wark at 310pre10. Uncomment later.
|
83 |
|
|
edm::Handle<GenRunInfoProduct> gi;
|
84 |
|
|
//iEvent.getRun().getByType(gi);
|
85 |
|
|
iEvent.getRun().getByLabel("generator", gi );
|
86 |
|
|
sigma = gi->externalXSecLO();
|
87 |
|
|
|
88 |
|
|
// double external_cross_section = gi->external_cross_section();
|
89 |
|
|
// double filter_eff = gi->filter_efficiency();
|
90 |
|
|
// cout << "Cross Section: "<< sigma <<" fil_eff: "<<filter_eff<<" ext_cs: "<<external_cross_section<<endl;
|
91 |
|
|
//double sigma = gi->cross_section();
|
92 |
|
|
|
93 |
|
|
}
|
94 |
|
|
cs= sigma;
|
95 |
|
|
//cout<<"Hello World "<<sigma<<endl;
|
96 |
|
|
EV -> Fill(log10(sigma));
|
97 |
|
|
// gTree -> Fill();
|
98 |
|
|
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
void Dummy::beginJob()
|
102 |
|
|
{
|
103 |
|
|
// gTree = fs->make<TTree>("gTree","gTree");
|
104 |
|
|
// gTree->Branch("cs", &cs, "cs/F");
|
105 |
|
|
EV = fs->make<TH1F>("EV", "cross section, log scale", 5000, -10., 2.);
|
106 |
|
|
|
107 |
|
|
}
|
108 |
|
|
|
109 |
|
|
void Dummy::endJob() {}
|
110 |
|
|
|
111 |
|
|
//define this as a plug-in
|
112 |
|
|
DEFINE_FWK_MODULE(Dummy);
|