Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
RecoRomanPot
RecoFP420
plugins
ReconstructerFP420.cc
Go to the documentation of this file.
1
// File: ReconstructerFP420.cc
3
// Date: 11.2007
4
// Description: ReconstructerFP420 for FP420
5
// Modifications:
7
#include <memory>
8
#include <string>
9
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
10
#include "
FWCore/Framework/interface/EDProducer.h
"
11
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
12
#include "
FWCore/Framework/interface/Event.h
"
13
#include "
FWCore/Framework/interface/MakerMacros.h
"
14
#include "
FWCore/Framework/interface/EventSetup.h
"
15
#include "
FWCore/Framework/interface/ESHandle.h
"
16
17
#include "
RecoRomanPot/RecoFP420/interface/ReconstructerFP420.h
"
18
#include "
DataFormats/FP420Cluster/interface/TrackCollectionFP420.h
"
19
#include "
DataFormats/FP420Cluster/interface/RecoCollectionFP420.h
"
20
21
//#include "SimDataFormats/HepMCProduct/interface/HepMCProduct.h"
22
//#include "HepMC/GenEvent.h"
23
24
#include <iostream>
25
using namespace
std;
26
27
//
28
namespace
cms
29
{
30
ReconstructerFP420::ReconstructerFP420(
const
edm::ParameterSet
& conf):conf_(conf) {
31
32
edm::LogInfo
(
"ReconstructerFP420 "
) <<
"Enter the FP420 Reco constructer"
;
33
34
35
verbosity
=
conf_
.
getUntrackedParameter
<
int
>(
"VerbosityLevel"
);
36
if
(
verbosity
> 0) {
37
std::cout
<<
"Constructor of ReconstructerFP420"
<< std::endl;
38
}
39
40
41
std::string
alias
( conf.
getParameter
<
std::string
>(
"@module_label"
) );
42
43
produces<RecoCollectionFP420>().setBranchAlias( alias );
44
45
trackerContainers
.clear();
46
trackerContainers
= conf.
getParameter
<std::vector<std::string> >(
"ROUList"
);
47
VtxFlag
= conf.
getParameter
<
int
>(
"VtxFlagGenRec"
);
48
m_genReadoutName
= conf.
getParameter
<
string
>(
"genReadoutName"
);
49
50
51
// Initialization:
52
sFP420RecoMain_
=
new
FP420RecoMain
(
conf_
);
53
54
}
55
56
// Virtual destructor needed.
57
ReconstructerFP420::~ReconstructerFP420
() {
58
if
(
verbosity
> 0) {
59
std::cout
<<
"ReconstructerFP420:delete FP420RecoMain"
<< std::endl;
60
}
61
delete
sFP420RecoMain_
;
62
}
63
64
//Get at the beginning
65
void
ReconstructerFP420::beginJob
() {
66
if
(
verbosity
> 0) {
67
std::cout
<<
"ReconstructerFP420:BeginJob method "
<< std::endl;
68
}
69
}
70
71
72
void
ReconstructerFP420::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
73
{
74
// beginJob;
75
// be lazy and include the appropriate namespaces
76
using namespace
edm;
77
using namespace
std;
78
79
// Get input
80
81
// Vtx info:
82
83
// define GEN Vtx of Signal
84
double
vtxGenX = 0.;
85
double
vtxGenY = 0.;
86
double
vtxGenZ = 0.;
87
88
/*
89
if(VtxFlag == 1) {
90
91
Handle<HepMCProduct> EvtHandle;
92
try{
93
iEvent.getByLabel(m_genReadoutName,EvtHandle);
94
}catch(const Exception&){
95
if(verbosity>0){
96
std::cout << "no HepMCProduct found"<< std::endl;
97
}
98
}
99
100
const HepMC::GenEvent* evt = EvtHandle->GetEvent() ;
101
HepMC::GenParticle* proton1 = 0;
102
HepMC::GenParticle* proton2 = 0;
103
double partmomcut=4000.;
104
double pz1max = 0.;
105
double pz2min = 0.;
106
for ( HepMC::GenEvent::particle_const_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p ) {
108
double pz = (*p)->momentum().pz();
109
// if (((*p)->pdg_id() == ipdgproton)&&((*p)->status() == 1)&&(pz > partmomcut)){
110
if( pz > partmomcut){
111
if(pz > pz1max){
112
proton1 = *p;pz1max=pz;
113
}
114
}
115
// else if(( (*p)->pdg_id() == ipdgproton)&&((*p)->status() == 1)&&(pz < -1.*partmomcut)) {
116
else if(pz < -1.*partmomcut) {
117
if(pz < pz2min){
118
proton2 = *p;pz2min=pz;
119
}
120
}
121
122
}// for
123
if(proton1 && !proton2){
124
vtxGenX = (proton1)->production_vertex()->position().x();
125
vtxGenY = (proton1)->production_vertex()->position().y();
126
vtxGenZ = (proton1)->production_vertex()->position().z();
127
}
128
else if(proton2 && !proton1){
129
vtxGenX = (proton2)->production_vertex()->position().x();
130
vtxGenY = (proton2)->production_vertex()->position().y();
131
vtxGenZ = (proton2)->production_vertex()->position().z();
132
}
133
else if(proton1 && proton2){
134
if(abs((proton1)->momentum().pz()) >= abs((proton2)->momentum().pz()) ) {
135
vtxGenX = (proton1)->production_vertex()->position().x();
136
vtxGenY = (proton1)->production_vertex()->position().y();
137
vtxGenZ = (proton1)->production_vertex()->position().z();
138
}
139
else {
140
vtxGenX = (proton2)->production_vertex()->position().x();
141
vtxGenY = (proton2)->production_vertex()->position().y();
142
vtxGenZ = (proton2)->production_vertex()->position().z();
143
}
144
}
145
}// if(VtxFlag == 1
146
147
*/
148
149
double
VtxX = 0.;
150
double
VtxY = 0.;
151
double
VtxZ = 0.;
152
if
(
VtxFlag
== 1) {
153
VtxX = vtxGenX;
// mm
154
VtxY = vtxGenY;
// mm
155
VtxZ = vtxGenZ;
// mm
156
}
157
158
159
160
161
// track collection:
162
//A
163
// edm::Handle<ClusterCollectionFP420> icf_simhit;
164
/*
165
Handle<ClusterCollectionFP420> cf_simhit;
166
std::vector<const ClusterCollectionFP420 *> cf_simhitvec;
167
for(uint32_t i = 0; i< trackerContainers.size();i++){
168
iEvent.getByLabel( trackerContainers[i], cf_simhit);
169
cf_simhitvec.push_back(cf_simhit.product()); }
170
std::auto_ptr<ClusterCollectionFP420 > input(new DigiCollectionFP420(cf_simhitvec));
171
*/
172
173
//B
174
175
Handle<TrackCollectionFP420>
input
;
176
iEvent.
getByLabel
(
trackerContainers
[0] ,
input
);
177
178
179
180
181
// Step C: create empty output collection
182
std::auto_ptr<RecoCollectionFP420> toutput(
new
RecoCollectionFP420
);
183
184
185
186
// put zero to container info from the beginning (important! because not any detID is updated with coming of new event !!!!!!
187
// clean info of container from previous event
188
189
std::vector<RecoFP420> collector;
190
collector.clear();
191
RecoCollectionFP420::Range
inputRange
;
192
inputRange
.first = collector.begin();
193
inputRange
.second = collector.end();
194
195
unsigned
int
detID = 0;
196
toutput->putclear(
inputRange
,detID);
197
198
unsigned
int
StID = 1;
199
toutput->putclear(
inputRange
,StID);
200
StID = 2;
201
toutput->putclear(
inputRange
,StID);
202
203
204
// !!!!!!
205
// if we want to keep Reco container/Collection for one event ---> uncomment the line below and vice versa
206
toutput->clear();
//container_.clear() --> start from the beginning of the container
207
208
// RUN now: !!!!!!
209
// startFP420RecoMain_.run(input, toutput);
210
sFP420RecoMain_
->
run
(
input
, toutput, VtxX, VtxY, VtxZ);
211
// std::cout <<"======= ReconstructerFP420: end of produce " << endl;
212
213
// Step D: write output to file
214
if
(
verbosity
> 0) {
215
std::cout
<<
"ReconstructerFP420: iEvent.put(toutput)"
<< std::endl;
216
}
217
iEvent.
put
(toutput);
218
if
(
verbosity
> 0) {
219
std::cout
<<
"ReconstructerFP420: iEvent.put(toutput) DONE"
<< std::endl;
220
}
221
}
//produce
222
223
}
// namespace cms
224
225
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
cms::ReconstructerFP420::beginJob
virtual void beginJob()
Definition:
ReconstructerFP420.cc:65
estimatePileup.inputRange
inputRange
Get input source.
Definition:
estimatePileup.py:240
RecoCollectionFP420::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition:
RecoCollectionFP420.h:14
cms::ReconstructerFP420::VtxFlag
int VtxFlag
Definition:
ReconstructerFP420.h:47
HLT_FULL_cff.alias
tuple alias
Definition:
HLT_FULL_cff.py:6432
Event.h
MakerMacros.h
edm::Handle
Definition:
AssociativeIterator.h:47
EventSetup.h
Frameworkfwd.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
input
static std::string const input
Definition:
EdmProvDump.cc:44
ParameterSet.h
cms::ReconstructerFP420::m_genReadoutName
std::string m_genReadoutName
Definition:
ReconstructerFP420.h:48
iEvent
int iEvent
Definition:
GenABIO.cc:230
cms::ReconstructerFP420::trackerContainers
vstring trackerContainers
Definition:
ReconstructerFP420.h:43
edm::Event::put
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition:
Event.h:121
cms::ReconstructerFP420::verbosity
int verbosity
Definition:
ReconstructerFP420.h:46
ReconstructerFP420.h
ESHandle.h
cms::ReconstructerFP420::sFP420RecoMain_
FP420RecoMain * sFP420RecoMain_
Definition:
ReconstructerFP420.h:45
edm::EventSetup
Definition:
EventSetup.h:45
TrackCollectionFP420.h
FP420RecoMain::run
void run(edm::Handle< TrackCollectionFP420 > &input, std::auto_ptr< RecoCollectionFP420 > &toutput, double VtxX, double VtxY, double VtxZ)
Runs the algorithm.
Definition:
FP420RecoMain.cc:63
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:418
cms::ReconstructerFP420::produce
virtual void produce(edm::Event &e, const edm::EventSetup &c)
Definition:
ReconstructerFP420.cc:72
edm::LogInfo
Definition:
MessageLogger.h:214
cms::ReconstructerFP420::conf_
edm::ParameterSet conf_
Definition:
ReconstructerFP420.h:42
EDProducer.h
RecoCollectionFP420.h
RecoCollectionFP420
Definition:
RecoCollectionFP420.h:9
cms::ReconstructerFP420::~ReconstructerFP420
virtual ~ReconstructerFP420()
Definition:
ReconstructerFP420.cc:57
edm::ParameterSet
Definition:
ParameterSet.h:36
gather_cfg.cout
tuple cout
Definition:
gather_cfg.py:145
FP420RecoMain
Definition:
FP420RecoMain.h:22
edm::Event
Definition:
Event.h:65
Generated for CMSSW Reference Manual by
1.8.5