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