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
#include "
RecoRomanPot/RecoFP420/interface/ClusterizerFP420.h
"
27
#include "
DataFormats/FP420Digi/interface/DigiCollectionFP420.h
"
28
#include "
DataFormats/FP420Cluster/interface/ClusterCollectionFP420.h
"
29
#include "
RecoRomanPot/RecoFP420/interface/ClusterNoiseFP420.h
"
30
31
//Random Number
32
#include "
FWCore/ServiceRegistry/interface/Service.h
"
33
#include "
FWCore/Utilities/interface/RandomNumberGenerator.h
"
34
#include "
FWCore/Utilities/interface/Exception.h
"
35
#include "CLHEP/Random/RandomEngine.h"
36
37
#include <cstdlib>
38
#include <iostream>
39
using namespace
std
;
40
41
namespace
cms
{
42
ClusterizerFP420::ClusterizerFP420(
const
edm::ParameterSet
& conf) : conf_(conf) {
43
std::string
alias
(conf.
getParameter
<
std::string
>(
"@module_label"
));
44
45
produces<ClusterCollectionFP420>().setBranchAlias(
alias
);
46
47
trackerContainers
.clear();
48
trackerContainers
= conf.
getParameter
<std::vector<std::string> >(
"ROUList"
);
49
50
verbosity
=
conf_
.
getUntrackedParameter
<
int
>(
"VerbosityLevel"
);
51
dn0
=
conf_
.
getParameter
<
int
>(
"NumberFP420Detectors"
);
52
sn0
=
conf_
.
getParameter
<
int
>(
"NumberFP420Stations"
);
53
pn0
=
conf_
.
getParameter
<
int
>(
"NumberFP420SPlanes"
);
54
rn0
= 7;
55
if
(
verbosity
> 0) {
56
std::cout
<<
"Creating a ClusterizerFP420"
<< std::endl;
57
std::cout
<<
"ClusterizerFP420: dn0="
<<
dn0
<<
" sn0="
<<
sn0
<<
" pn0="
<<
pn0
<<
" rn0="
<<
rn0
<< std::endl;
58
}
59
60
sClusterizerFP420_
=
new
FP420ClusterMain
(
conf_
,
dn0
,
sn0
,
pn0
,
rn0
);
61
}
62
63
// Virtual destructor needed.
64
ClusterizerFP420::~ClusterizerFP420
() {
delete
sClusterizerFP420_
; }
65
66
//Get at the beginning
67
void
ClusterizerFP420::beginJob
() {
68
if
(
verbosity
> 0) {
69
std::cout
<<
"BeginJob method "
<< std::endl;
70
}
71
//Getting Calibration data (Noises and BadElectrodes Flag)
72
// bool UseNoiseBadElectrodeFlagFromDB_=conf_.getParameter<bool>("UseNoiseBadElectrodeFlagFromDB");
73
// if (UseNoiseBadElectrodeFlagFromDB_==true){
74
// iSetup.get<ClusterNoiseFP420Rcd>().get(noise);// AZ: do corrections for noise here
75
//=========================================================
76
//
77
// Debug: show noise for DetIDs
78
// ElectrodNoiseMapIterator mapit = noise->m_noises.begin();
79
// for (;mapit!=noise->m_noises.end();mapit++)
80
// {
81
// unsigned int detid = (*mapit).first;
82
// std::cout << "detid " << detid << " # Electrode " << (*mapit).second.size()<<std::endl;
83
// //ElectrodNoiseVector theElectrodVector = (*mapit).second;
84
// const ElectrodNoiseVector theElectrodVector = noise->getElectrodNoiseVector(detid);
85
86
// int electrode=0;
87
// ElectrodNoiseVectorIterator iter=theElectrodVector.begin();
88
// //for(; iter!=theElectrodVector.end(); iter++)
89
// {
90
// std::cout << " electrode " << electrode++ << " =\t"
91
// << iter->getNoise() << " \t"
92
// << iter->getDisable() << " \t"
93
// << std::endl;
94
// }
95
// }
96
//===========================================================
97
// }
98
}
99
100
void
ClusterizerFP420::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
101
// beginJob;
102
// be lazy and include the appropriate namespaces
103
using namespace
edm
;
104
using namespace
std
;
105
if
(
verbosity
> 0) {
106
std::cout
<<
"ClusterizerFP420: produce"
<< std::endl;
107
}
108
109
// Get input
110
//A
111
// edm::Handle<DigiCollectionFP420> icf_simhit;
112
/*
113
Handle<DigiCollectionFP420> cf_simhit;
114
std::vector<const DigiCollectionFP420 *> cf_simhitvec;
115
for(uint32_t i = 0; i< trackerContainers.size();i++){
116
iEvent.getByLabel( trackerContainers[i], cf_simhit);
117
cf_simhitvec.push_back(cf_simhit.product()); }
118
std::unique_ptr<DigiCollectionFP420 > digis(new DigiCollectionFP420(cf_simhitvec));
119
120
std::vector<HDigiFP420> input;
121
DigiCollectionFP420::iterator isim;
122
for (isim=digis->begin(); isim!= digis->end();isim++) {
123
input.push_back(*isim);
124
}
125
*/
126
//B
127
128
Handle<DigiCollectionFP420>
input
;
129
try
{
130
// iEvent.getByLabel( "FP420Digi" , digis);
131
iEvent
.getByLabel(
trackerContainers
[0],
input
);
132
}
catch
(
const
Exception
&) {
133
// in principal, should never happen, as it's taken care of by Framework
134
throw
cms::Exception
(
"InvalidReference"
) <<
"Invalid reference to DigiCollectionFP420 \n"
;
135
}
136
137
if
(
verbosity
> 0) {
138
std::cout
<<
"ClusterizerFP420: OK1"
<< std::endl;
139
}
140
141
// Step C: create empty output collection
142
auto
soutput
= std::make_unique<ClusterCollectionFP420>();
144
/*
145
std::vector<SimVertex> input;
146
Handle<DigiCollectionFP420> digis;
147
iEvent.getByLabel("FP420Digi",digis);
148
input.insert(input.end(),digis->begin(),digis->end());
149
150
151
152
std::vector<HDigiFP420> input;
153
for(std::vector<HDigiFP420>::const_iterator vsim=digis->begin();
154
vsim!=digis->end(); ++vsim){
155
input.push_back(*vsim);
156
}
157
theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
158
*/
159
// std::vector<HDigiFP420> input;
160
// DigiCollectionFP420 input;
161
//input.push_back(digis);
162
// input.insert(input.end(), digis->begin(), digis->end());
163
164
/*
165
std::vector<HDigiFP420> input;
166
input.clear();
167
DigiCollectionFP420::ContainerIterator sort_begin = digis->begin();
168
DigiCollectionFP420::ContainerIterator sort_end = digis->end();
169
for ( ;sort_begin != sort_end; ++sort_begin ) {
170
input.push_back(*sort_begin);
171
} // for
172
*/
173
174
// put zero to container info from the beginning (important! because not any detID is updated with coming of new event !!!!!!
175
// clean info of container from previous event
176
for
(
int
det = 1; det <
dn0
; det++) {
177
for
(
int
sector = 1; sector <
sn0
; sector++) {
178
for
(
int
zmodule = 1; zmodule <
pn0
; zmodule++) {
179
for
(
int
zside
= 1;
zside
<
rn0
;
zside
++) {
180
// intindex is a continues numbering of FP420
181
unsigned
int
detID =
FP420NumberingScheme::packMYIndex
(
rn0
,
pn0
,
sn0
, det,
zside
, sector, zmodule);
182
std::vector<ClusterFP420> collector;
183
collector.clear();
184
ClusterCollectionFP420::Range
inputRange
;
185
inputRange
.first = collector.begin();
186
inputRange
.second = collector.end();
187
188
soutput
->
putclear
(
inputRange
, detID);
189
190
}
//for
191
}
//for
192
}
//for
193
}
//for
194
195
// !!!!!!
196
// if we want to keep Cluster container/Collection for one event ---> uncomment the line below and vice versa
197
soutput
->
clear
();
//container_.clear() --> start from the beginning of the container
198
199
// RUN now: !!!!!!
200
// sClusterizerFP420_.run(input, soutput, noise);
201
if
(
verbosity
> 0) {
202
std::cout
<<
"ClusterizerFP420: OK2"
<< std::endl;
203
}
204
sClusterizerFP420_
->
run
(
input
,
soutput
.
get
(),
noise
);
205
206
if
(
verbosity
> 0) {
207
std::cout
<<
"ClusterizerFP420: OK3"
<< std::endl;
208
}
209
210
// if(collectorZS.data.size()>0){
211
212
// std::cout <<"======= ClusterizerFP420: end of produce " << std::endl;
213
214
// Step D: write output to file
215
iEvent
.put(
std::move
(
soutput
));
216
if
(
verbosity
> 0) {
217
std::cout
<<
"ClusterizerFP420: OK4"
<< std::endl;
218
}
219
}
//produce
220
221
}
// namespace cms
cms::ClusterizerFP420::beginJob
void beginJob() override
Definition:
ClusterizerFP420.cc:67
input
static const std::string input
Definition:
EdmProvDump.cc:48
TrackerGeometry.h
FP420ClusterMain
Definition:
FP420ClusterMain.h:25
EDProducer.h
ESHandle.h
ecaldqm::zside
int zside(DetId const &)
Definition:
EcalDQMCommonUtils.cc:189
edm
HLT enums.
Definition:
AlignableModifier.h:19
RandomNumberGenerator.h
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
cms::ClusterizerFP420::conf_
edm::ParameterSet conf_
Definition:
ClusterizerFP420.h:45
GeomDetType.h
cms::ClusterizerFP420::verbosity
int verbosity
Definition:
ClusterizerFP420.h:55
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition:
AssociativeIterator.h:50
pileupCalc.inputRange
inputRange
Definition:
pileupCalc.py:218
MakerMacros.h
ClusterCollectionFP420::clear
void clear()
Definition:
ClusterCollectionFP420.cc:97
Service.h
FP420ClusterMain::run
void run(edm::Handle< DigiCollectionFP420 > &input, ClusterCollectionFP420 *soutput, std::vector< ClusterNoiseFP420 > &noise)
Runs the algorithm.
Definition:
FP420ClusterMain.cc:112
cms::ClusterizerFP420::sn0
int sn0
Definition:
ClusterizerFP420.h:54
cms::ClusterizerFP420::dn0
int dn0
Definition:
ClusterizerFP420.h:54
cms::ClusterizerFP420::pn0
int pn0
Definition:
ClusterizerFP420.h:54
cms::ClusterizerFP420::rn0
int rn0
Definition:
ClusterizerFP420.h:54
FP420NumberingScheme::packMYIndex
static unsigned packMYIndex(int rn0, int pn0, int sn0, int det, int zside, int sector, int zmodule)
Definition:
FP420NumberingScheme.h:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
cms::ClusterizerFP420::sClusterizerFP420_
FP420ClusterMain * sClusterizerFP420_
Definition:
ClusterizerFP420.h:48
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
ClusterNoiseFP420.h
ClusterCollectionFP420.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
cms::ClusterizerFP420::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition:
ClusterizerFP420.cc:100
edm::EventSetup
Definition:
EventSetup.h:57
DetSetVector.h
GeometricDet.h
ClusterizerFP420.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
cms::ClusterizerFP420::soutput
ClusterCollectionFP420 * soutput
Definition:
ClusterizerFP420.h:50
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
Frameworkfwd.h
ClusterCollectionFP420::putclear
void putclear(Range input, unsigned int detID)
Definition:
ClusterCollectionFP420.cc:98
SiStripOfflineCRack_cfg.alias
alias
Definition:
SiStripOfflineCRack_cfg.py:129
Exception
Definition:
hltDiff.cc:246
ClusterCollectionFP420::get
const Range get(unsigned int detID) const
Definition:
ClusterCollectionFP420.cc:69
cms::ClusterizerFP420::~ClusterizerFP420
~ClusterizerFP420() override
Definition:
ClusterizerFP420.cc:64
EventSetup.h
DigiCollectionFP420.h
Exception.h
cms::ClusterizerFP420::noise
std::vector< ClusterNoiseFP420 > noise
Definition:
ClusterizerFP420.h:52
cms::Exception
Definition:
Exception.h:70
ParameterSet.h
edm::Event
Definition:
Event.h:73
ClusterCollectionFP420::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition:
ClusterCollectionFP420.h:12
cms
Namespace of DDCMS conversion namespace.
Definition:
ProducerAnalyzer.cc:21
cms::ClusterizerFP420::trackerContainers
vstring trackerContainers
Definition:
ClusterizerFP420.h:46
Generated for CMSSW Reference Manual by
1.8.16