Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
RecoRomanPot
RecoFP420
plugins
ClusterizerFP420.cc
Go to the documentation of this file.
1
// File: ClusterizerFP420.cc
3
// Date: 12.2006
4
// Description: ClusterizerFP420 for FP420
5
// Modifications:
7
#include <memory>
8
#include <string>
9
10
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
11
#include "
FWCore/Framework/interface/EDProducer.h
"
12
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
13
#include "
FWCore/Framework/interface/Event.h
"
14
#include "
FWCore/Framework/interface/MakerMacros.h
"
15
#include "
FWCore/Framework/interface/EventSetup.h
"
16
#include "
FWCore/Framework/interface/ESHandle.h
"
17
18
#include "
Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h
"
19
#include "
Geometry/CommonDetUnit/interface/GeomDetType.h
"
20
#include "
Geometry/Records/interface/TrackerDigiGeometryRecord.h
"
21
#include "
Geometry/TrackerNumberingBuilder/interface/GeometricDet.h
"
22
23
#include "
DataFormats/Common/interface/DetSetVector.h
"
24
//#include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h"
25
26
27
#include "
RecoRomanPot/RecoFP420/interface/ClusterizerFP420.h
"
28
#include "
DataFormats/FP420Digi/interface/DigiCollectionFP420.h
"
29
#include "
DataFormats/FP420Cluster/interface/ClusterCollectionFP420.h
"
30
#include "
RecoRomanPot/RecoFP420/interface/ClusterNoiseFP420.h
"
31
32
//Random Number
33
#include "
FWCore/ServiceRegistry/interface/Service.h
"
34
#include "
FWCore/Utilities/interface/RandomNumberGenerator.h
"
35
#include "
FWCore/Utilities/interface/Exception.h
"
36
#include "CLHEP/Random/RandomEngine.h"
37
38
#include <cstdlib>
39
#include <iostream>
40
using namespace
std;
41
42
namespace
cms
43
{
44
ClusterizerFP420::ClusterizerFP420(
const
edm::ParameterSet
&
conf
):
45
conf_(conf) {
46
47
48
std::string
alias ( conf.
getParameter
<
std::string
>(
"@module_label"
) );
49
50
produces<ClusterCollectionFP420>().setBranchAlias( alias );
51
52
trackerContainers
.clear();
53
trackerContainers
= conf.
getParameter
<std::vector<std::string> >(
"ROUList"
);
54
55
verbosity
=
conf_
.
getUntrackedParameter
<
int
>(
"VerbosityLevel"
);
56
dn0
=
conf_
.
getParameter
<
int
>(
"NumberFP420Detectors"
);
57
sn0
=
conf_
.
getParameter
<
int
>(
"NumberFP420Stations"
);
58
pn0
=
conf_
.
getParameter
<
int
>(
"NumberFP420SPlanes"
);
59
rn0
= 7;
60
if
(verbosity > 0) {
61
std::cout
<<
"Creating a ClusterizerFP420"
<< std::endl;
62
std::cout
<<
"ClusterizerFP420: dn0="
<< dn0 <<
" sn0="
<< sn0 <<
" pn0="
<< pn0 <<
" rn0="
<< rn0 << std::endl;
63
}
64
65
sClusterizerFP420_
=
new
FP420ClusterMain
(
conf_
,dn0,sn0,pn0,rn0);
66
}
67
68
// Virtual destructor needed.
69
ClusterizerFP420::~ClusterizerFP420
() {
70
delete
sClusterizerFP420_
;
71
}
72
73
//Get at the beginning
74
void
ClusterizerFP420::beginJob
() {
75
if
(
verbosity
> 0) {
76
std::cout
<<
"BeginJob method "
<< std::endl;
77
}
78
//Getting Calibration data (Noises and BadElectrodes Flag)
79
// bool UseNoiseBadElectrodeFlagFromDB_=conf_.getParameter<bool>("UseNoiseBadElectrodeFlagFromDB");
80
// if (UseNoiseBadElectrodeFlagFromDB_==true){
81
// iSetup.get<ClusterNoiseFP420Rcd>().get(noise);// AZ: do corrections for noise here
82
//=========================================================
83
//
84
// Debug: show noise for DetIDs
85
// ElectrodNoiseMapIterator mapit = noise->m_noises.begin();
86
// for (;mapit!=noise->m_noises.end();mapit++)
87
// {
88
// unsigned int detid = (*mapit).first;
89
// std::cout << "detid " << detid << " # Electrode " << (*mapit).second.size()<<std::endl;
90
// //ElectrodNoiseVector theElectrodVector = (*mapit).second;
91
// const ElectrodNoiseVector theElectrodVector = noise->getElectrodNoiseVector(detid);
92
93
94
// int electrode=0;
95
// ElectrodNoiseVectorIterator iter=theElectrodVector.begin();
96
// //for(; iter!=theElectrodVector.end(); iter++)
97
// {
98
// std::cout << " electrode " << electrode++ << " =\t"
99
// << iter->getNoise() << " \t"
100
// << iter->getDisable() << " \t"
101
// << std::endl;
102
// }
103
// }
104
//===========================================================
105
// }
106
}
107
108
void
ClusterizerFP420::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
109
{
110
// beginJob;
111
// be lazy and include the appropriate namespaces
112
using namespace
edm;
113
using namespace
std;
114
if
(
verbosity
> 0) {
115
std::cout
<<
"ClusterizerFP420: produce"
<< std::endl;
116
}
117
118
// Get input
119
//A
120
// edm::Handle<DigiCollectionFP420> icf_simhit;
121
/*
122
Handle<DigiCollectionFP420> cf_simhit;
123
std::vector<const DigiCollectionFP420 *> cf_simhitvec;
124
for(uint32_t i = 0; i< trackerContainers.size();i++){
125
iEvent.getByLabel( trackerContainers[i], cf_simhit);
126
cf_simhitvec.push_back(cf_simhit.product()); }
127
std::auto_ptr<DigiCollectionFP420 > digis(new DigiCollectionFP420(cf_simhitvec));
128
129
std::vector<HDigiFP420> input;
130
DigiCollectionFP420::iterator isim;
131
for (isim=digis->begin(); isim!= digis->end();isim++) {
132
input.push_back(*isim);
133
}
134
*/
135
//B
136
137
Handle<DigiCollectionFP420>
input
;
138
try
{
139
// iEvent.getByLabel( "FP420Digi" , digis);
140
iEvent.
getByLabel
(
trackerContainers
[0] ,
input
);
141
}
catch
(
const
Exception
&)
142
{
143
// in principal, should never happen, as it's taken care of by Framework
144
throw
cms::Exception
(
"InvalidReference"
)
145
<<
"Invalid reference to DigiCollectionFP420 \n"
;
146
}
147
148
if
(
verbosity
> 0) {
149
std::cout
<<
"ClusterizerFP420: OK1"
<< std::endl;
150
}
151
152
// Step C: create empty output collection
153
std::auto_ptr<ClusterCollectionFP420>
soutput
(
new
ClusterCollectionFP420
);
155
/*
156
std::vector<SimVertex> input;
157
Handle<DigiCollectionFP420> digis;
158
iEvent.getByLabel("FP420Digi",digis);
159
input.insert(input.end(),digis->begin(),digis->end());
160
161
162
163
std::vector<HDigiFP420> input;
164
for(std::vector<HDigiFP420>::const_iterator vsim=digis->begin();
165
vsim!=digis->end(); ++vsim){
166
input.push_back(*vsim);
167
}
168
theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
169
*/
170
// std::vector<HDigiFP420> input;
171
// DigiCollectionFP420 input;
172
//input.push_back(digis);
173
// input.insert(input.end(), digis->begin(), digis->end());
174
175
/*
176
std::vector<HDigiFP420> input;
177
input.clear();
178
DigiCollectionFP420::ContainerIterator sort_begin = digis->begin();
179
DigiCollectionFP420::ContainerIterator sort_end = digis->end();
180
for ( ;sort_begin != sort_end; ++sort_begin ) {
181
input.push_back(*sort_begin);
182
} // for
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
for
(
int
det=1; det<
dn0
; det++) {
189
for
(
int
sector=1; sector<
sn0
; sector++) {
190
for
(
int
zmodule=1; zmodule<
pn0
; zmodule++) {
191
for
(
int
zside
=1;
zside
<
rn0
;
zside
++) {
192
// intindex is a continues numbering of FP420
193
unsigned
int
detID =
FP420NumberingScheme::packMYIndex
(rn0, pn0, sn0, det,
zside
, sector, zmodule);
194
std::vector<ClusterFP420> collector;
195
collector.clear();
196
ClusterCollectionFP420::Range
inputRange
;
197
inputRange.first = collector.begin();
198
inputRange.second = collector.end();
199
200
soutput->putclear(inputRange,detID);
201
202
}
//for
203
}
//for
204
}
//for
205
}
//for
206
207
208
// !!!!!!
209
// if we want to keep Cluster container/Collection for one event ---> uncomment the line below and vice versa
210
soutput->clear();
//container_.clear() --> start from the beginning of the container
211
212
// RUN now: !!!!!!
213
// sClusterizerFP420_.run(input, soutput, noise);
214
if
(
verbosity
> 0) {
215
std::cout
<<
"ClusterizerFP420: OK2"
<< std::endl;
216
}
217
sClusterizerFP420_
->
run
(
input
, soutput,
noise
);
218
219
if
(
verbosity
> 0) {
220
std::cout
<<
"ClusterizerFP420: OK3"
<< std::endl;
221
}
222
223
// if(collectorZS.data.size()>0){
224
225
// std::cout <<"======= ClusterizerFP420: end of produce " << std::endl;
226
227
// Step D: write output to file
228
iEvent.
put
(soutput);
229
if
(
verbosity
> 0) {
230
std::cout
<<
"ClusterizerFP420: OK4"
<< std::endl;
231
}
232
}
//produce
233
234
}
// namespace cms
235
cms::ClusterizerFP420::produce
virtual void produce(edm::Event &e, const edm::EventSetup &c)
Definition:
ClusterizerFP420.cc:108
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
ClusterCollectionFP420.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
TrackerDigiGeometryRecord.h
estimatePileup.inputRange
inputRange
Get input source.
Definition:
estimatePileup.py:241
FP420ClusterMain::run
void run(edm::Handle< DigiCollectionFP420 > &input, std::auto_ptr< ClusterCollectionFP420 > &soutput, std::vector< ClusterNoiseFP420 > &noise)
Runs the algorithm.
Definition:
FP420ClusterMain.cc:119
RandomNumberGenerator.h
Event.h
MakerMacros.h
edm::Handle
Definition:
AssociativeIterator.h:47
EventSetup.h
ClusterizerFP420.h
cms::ClusterizerFP420::conf_
edm::ParameterSet conf_
Definition:
ClusterizerFP420.h:54
ecaldqm::zside
int zside(DetId const &)
Definition:
EcalDQMCommonUtils.cc:210
cms::ClusterizerFP420::verbosity
int verbosity
Definition:
ClusterizerFP420.h:64
Frameworkfwd.h
cms::ClusterizerFP420::dn0
int dn0
Definition:
ClusterizerFP420.h:63
cms::ClusterizerFP420::beginJob
virtual void beginJob()
Definition:
ClusterizerFP420.cc:74
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
cms::ClusterizerFP420::sn0
int sn0
Definition:
ClusterizerFP420.h:63
cms::ClusterizerFP420::~ClusterizerFP420
virtual ~ClusterizerFP420()
Definition:
ClusterizerFP420.cc:69
input
static std::string const input
Definition:
EdmProvDump.cc:44
DigiCollectionFP420.h
DetSetVector.h
ParameterSet.h
iEvent
int iEvent
Definition:
GenABIO.cc:230
GeometricDet.h
GeomDetType.h
FP420NumberingScheme::packMYIndex
static unsigned packMYIndex(int rn0, int pn0, int sn0, int det, int zside, int sector, int zmodule)
Definition:
FP420NumberingScheme.h:40
edm::Event::put
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition:
Event.h:113
ESHandle.h
cms::ClusterizerFP420::pn0
int pn0
Definition:
ClusterizerFP420.h:63
Service.h
cms::ClusterizerFP420::rn0
int rn0
Definition:
ClusterizerFP420.h:63
edm::EventSetup
Definition:
EventSetup.h:44
FP420ClusterMain
Definition:
FP420ClusterMain.h:26
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:402
dbtoconf.conf
tuple conf
Definition:
dbtoconf.py:185
cms::ClusterizerFP420::soutput
ClusterCollectionFP420 * soutput
Definition:
ClusterizerFP420.h:59
ClusterNoiseFP420.h
EDProducer.h
Exception.h
cms::ClusterizerFP420::sClusterizerFP420_
FP420ClusterMain * sClusterizerFP420_
Definition:
ClusterizerFP420.h:57
edm::hlt::Exception
error
Definition:
HLTenums.h:21
cms::Exception
Definition:
Exception.h:68
ClusterCollectionFP420
Definition:
ClusterCollectionFP420.h:9
TrackerGeometry.h
edm::ParameterSet
Definition:
ParameterSet.h:35
gather_cfg.cout
tuple cout
Definition:
gather_cfg.py:121
ClusterCollectionFP420::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition:
ClusterCollectionFP420.h:14
cms::ClusterizerFP420::trackerContainers
vstring trackerContainers
Definition:
ClusterizerFP420.h:55
edm::Event
Definition:
Event.h:59
cms::ClusterizerFP420::noise
std::vector< ClusterNoiseFP420 > noise
Definition:
ClusterizerFP420.h:61
Generated for CMSSW Reference Manual by
1.8.5