Go to the documentation of this file.00001
00002
00003
00004
00005
00007 #include <memory>
00008 #include <string>
00009
00010 #include "FWCore/Framework/interface/Frameworkfwd.h"
00011 #include "FWCore/Framework/interface/EDProducer.h"
00012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00013 #include "FWCore/Framework/interface/Event.h"
00014 #include "FWCore/Framework/interface/MakerMacros.h"
00015 #include "FWCore/Framework/interface/EventSetup.h"
00016 #include "FWCore/Framework/interface/ESHandle.h"
00017
00018 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00019 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
00020 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00021 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
00022
00023 #include "DataFormats/Common/interface/DetSetVector.h"
00024
00025
00026
00027 #include "RecoRomanPot/RecoFP420/interface/ClusterizerFP420.h"
00028 #include "DataFormats/FP420Digi/interface/DigiCollectionFP420.h"
00029 #include "DataFormats/FP420Cluster/interface/ClusterCollectionFP420.h"
00030 #include "RecoRomanPot/RecoFP420/interface/ClusterNoiseFP420.h"
00031
00032
00033 #include "FWCore/ServiceRegistry/interface/Service.h"
00034 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
00035 #include "FWCore/Utilities/interface/Exception.h"
00036 #include "CLHEP/Random/RandomEngine.h"
00037
00038 #include <cstdlib>
00039 #include <iostream>
00040 using namespace std;
00041
00042 namespace cms
00043 {
00044 ClusterizerFP420::ClusterizerFP420(const edm::ParameterSet& conf):
00045 conf_(conf) {
00046
00047
00048 std::string alias ( conf.getParameter<std::string>("@module_label") );
00049
00050 produces<ClusterCollectionFP420>().setBranchAlias( alias );
00051
00052 trackerContainers.clear();
00053 trackerContainers = conf.getParameter<std::vector<std::string> >("ROUList");
00054
00055 verbosity = conf_.getUntrackedParameter<int>("VerbosityLevel");
00056 dn0 = conf_.getParameter<int>("NumberFP420Detectors");
00057 sn0 = conf_.getParameter<int>("NumberFP420Stations");
00058 pn0 = conf_.getParameter<int>("NumberFP420SPlanes");
00059 rn0 = 7;
00060 if (verbosity > 0) {
00061 std::cout << "Creating a ClusterizerFP420" << std::endl;
00062 std::cout << "ClusterizerFP420: dn0=" << dn0 << " sn0=" << sn0 << " pn0=" << pn0 << " rn0=" << rn0 << std::endl;
00063 }
00064
00065 sClusterizerFP420_ = new FP420ClusterMain(conf_,dn0,sn0,pn0,rn0);
00066 }
00067
00068
00069 ClusterizerFP420::~ClusterizerFP420() {
00070 delete sClusterizerFP420_;
00071 }
00072
00073
00074 void ClusterizerFP420::beginJob() {
00075 if (verbosity > 0) {
00076 std::cout << "BeginJob method " << std::endl;
00077 }
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106 }
00107
00108 void ClusterizerFP420::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00109 {
00110
00111
00112 using namespace edm;
00113 using namespace std;
00114 if (verbosity > 0) {
00115 std::cout << "ClusterizerFP420: produce" << std::endl;
00116 }
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 Handle<DigiCollectionFP420> input;
00138 try{
00139
00140 iEvent.getByLabel( trackerContainers[0] , input);
00141 } catch(const Exception&)
00142 {
00143
00144 throw cms::Exception("InvalidReference")
00145 << "Invalid reference to DigiCollectionFP420 \n";
00146 }
00147
00148 if (verbosity > 0) {
00149 std::cout << "ClusterizerFP420: OK1" << std::endl;
00150 }
00151
00152
00153 std::auto_ptr<ClusterCollectionFP420> soutput(new ClusterCollectionFP420);
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188 for (int det=1; det<dn0; det++) {
00189 for (int sector=1; sector<sn0; sector++) {
00190 for (int zmodule=1; zmodule<pn0; zmodule++) {
00191 for (int zside=1; zside<rn0; zside++) {
00192
00193 unsigned int detID = theFP420NumberingScheme->FP420NumberingScheme::packMYIndex(rn0, pn0, sn0, det, zside, sector, zmodule);
00194 std::vector<ClusterFP420> collector;
00195 collector.clear();
00196 ClusterCollectionFP420::Range inputRange;
00197 inputRange.first = collector.begin();
00198 inputRange.second = collector.end();
00199
00200 soutput->putclear(inputRange,detID);
00201
00202 }
00203 }
00204 }
00205 }
00206
00207
00208
00209
00210 soutput->clear();
00211
00212
00213
00214 if (verbosity > 0) {
00215 std::cout << "ClusterizerFP420: OK2" << std::endl;
00216 }
00217 sClusterizerFP420_->run(input, soutput, noise);
00218
00219 if (verbosity > 0) {
00220 std::cout << "ClusterizerFP420: OK3" << std::endl;
00221 }
00222
00223
00224
00225
00226
00227
00228 iEvent.put(soutput);
00229 if (verbosity > 0) {
00230 std::cout << "ClusterizerFP420: OK4" << std::endl;
00231 }
00232 }
00233
00234 }
00235