Go to the documentation of this file.00001
00002
00003
00004
00005
00007 #include <vector>
00008 #include <iostream>
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010
00011 #include "RecoRomanPot/RecoFP420/interface/FP420TrackMain.h"
00012 #include "DataFormats/FP420Cluster/interface/ClusterFP420.h"
00013 #include "DataFormats/FP420Cluster/interface/TrackFP420.h"
00014 #include "RecoRomanPot/RecoFP420/interface/TrackProducerFP420.h"
00015
00016 #include "CLHEP/Random/RandFlat.h"
00017
00018 using namespace std;
00019
00020
00021
00022
00023 FP420TrackMain::FP420TrackMain(const edm::ParameterSet& conf):conf_(conf) {
00024
00025 verbosity = conf_.getUntrackedParameter<int>("VerbosityLevel");
00026 trackMode_ = conf_.getParameter<std::string>("TrackModeFP420");
00027 dn0 = conf_.getParameter<int>("NumberFP420Detectors");
00028 sn0_ = conf_.getParameter<int>("NumberFP420Stations");
00029 pn0_ = conf_.getParameter<int>("NumberFP420SPlanes");
00030 rn0_ = 7;
00031 xytype_ = conf_.getParameter<int>("NumberFP420SPTypes");
00032 z420_ = conf_.getParameter<double>("z420");
00033 zD2_ = conf_.getParameter<double>("zD2");
00034 zD3_ = conf_.getParameter<double>("zD3");
00035 dXX_ = conf_.getParameter<double>("dXXFP420");
00036 dYY_ = conf_.getParameter<double>("dYYFP420");
00037 chiCutX_ = conf_.getParameter<double>("chiCutX420");
00038 chiCutY_ = conf_.getParameter<double>("chiCutY420");
00039
00040 if (verbosity > 0) {
00041 std::cout << "FP420TrackMain constructor::" << std::endl;
00042 std::cout << "sn0=" << sn0_ << " pn0=" << pn0_ << " xytype=" << xytype_ << std::endl;
00043 std::cout << "trackMode = " << trackMode_ << std::endl;
00044 std::cout << "dXX=" << dXX_ << " dYY=" << dYY_ << std::endl;
00045 std::cout << "chiCutX=" << chiCutX_ << " chiCutY=" << chiCutY_ << std::endl;
00046 }
00048
00049
00050
00051 UseHalfPitchShiftInX_= true;
00052 UseHalfPitchShiftInXW_= true;
00053 UseHalfPitchShiftInY_= true;
00054 UseHalfPitchShiftInYW_= true;
00055
00056 pitchX_= 0.050;
00057 pitchY_= 0.050;
00058 pitchXW_= 0.400;
00059 pitchYW_= 0.400;
00060
00061 XsensorSize_=8.0;
00062 YsensorSize_=7.2;
00063
00064
00065 zBlade_ = 5.00;
00066 gapBlade_ = 1.6;
00067 double gapSupplane = 1.6;
00068 ZSiPlane_=2*zBlade_+gapBlade_+gapSupplane;
00069
00070 double ZKapton = 0.1;
00071 ZSiStep_=ZSiPlane_+ZKapton;
00072
00073 double ZBoundDet = 0.020;
00074 double ZSiElectr = 0.250;
00075 double ZCeramDet = 0.500;
00076
00077 double eee1=11.;
00078 double eee2=12.;
00079 zinibeg_ = (eee1-eee2)/2.;
00080
00081 ZSiDet_ = 0.250;
00082
00083 ZGapLDet_= zBlade_/2-(ZSiDet_+ZSiElectr+ZBoundDet+ZCeramDet/2);
00084
00085 if (verbosity > 1) {
00086 std::cout << "FP420TrackMain constructor::" << std::endl;
00087 std::cout << " zD2=" << zD2_ << " zD3=" << zD3_ << " zinibeg =" << zinibeg_ << std::endl;
00088 std::cout << " UseHalfPitchShiftInX=" << UseHalfPitchShiftInX_ << " UseHalfPitchShiftInY=" << UseHalfPitchShiftInY_ << std::endl;
00089 std::cout << " UseHalfPitchShiftInXW=" << UseHalfPitchShiftInXW_ << " UseHalfPitchShiftInYW=" << UseHalfPitchShiftInYW_ << std::endl;
00090 std::cout << " pitchX=" << pitchX_ << " pitchY=" << pitchY_ << std::endl;
00091 std::cout << " pitchXW=" << pitchXW_ << " pitchYW=" << pitchYW_ << std::endl;
00092 std::cout << " zBlade_=" << zBlade_ << " gapBlade_=" << gapBlade_ << std::endl;
00093 std::cout << " ZKapton=" << ZKapton << " ZBoundDet=" << ZBoundDet << std::endl;
00094 std::cout << " ZSiElectr=" << ZSiElectr << " ZCeramDet=" << ZCeramDet << std::endl;
00095 std::cout << " ZSiDet=" << ZSiDet_ << " gapSupplane=" << gapSupplane << std::endl;
00096 }
00098
00099
00100
00101 if ( trackMode_ == "TrackProducerSophisticatedFP420" ) {
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 finderParameters_ = new TrackProducerFP420(sn0_, pn0_, rn0_, xytype_, z420_, zD2_, zD3_,
00113 pitchX_, pitchY_,
00114 pitchXW_, pitchYW_,
00115 ZGapLDet_, ZSiStep_,
00116 ZSiPlane_, ZSiDet_,zBlade_,gapBlade_,
00117 UseHalfPitchShiftInX_, UseHalfPitchShiftInY_,
00118 UseHalfPitchShiftInXW_, UseHalfPitchShiftInYW_,
00119 dXX_,dYY_,chiCutX_,chiCutY_,zinibeg_,verbosity,
00120 XsensorSize_,YsensorSize_);
00121 validTrackerizer_ = true;
00122 }
00123 else {
00124 std::cout << "ERROR:FP420TrackMain: No valid finder selected" << std::endl;
00125 validTrackerizer_ = false;
00126 }
00127 }
00128
00129 FP420TrackMain::~FP420TrackMain() {
00130 if ( finderParameters_ != 0 ) {
00131 delete finderParameters_;
00132 }
00133 }
00134
00135
00136
00137 void FP420TrackMain::run(edm::Handle<ClusterCollectionFP420> &input, std::auto_ptr<TrackCollectionFP420> &toutput )
00138 {
00139
00140 if ( validTrackerizer_ ) {
00141
00142 int number_detunits = 0;
00143 int number_localelectroderechits = 0;
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171 bool first = true;
00172
00173 for (int det=1; det<dn0; det++) {
00174 ++number_detunits;
00175 int StID = 1111;
00176 if(det==2) StID = 2222;
00177 std::vector<TrackFP420> collector;
00178
00179 collector.clear();
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195 if (trackMode_ == "TrackProducerSophisticatedFP420" ) {
00196 collector = finderParameters_->trackFinderSophisticated(input,det);
00197 }
00198
00199
00200
00201
00202
00203
00204 if (collector.size()>0){
00205 TrackCollectionFP420::Range inputRange;
00206 inputRange.first = collector.begin();
00207 inputRange.second = collector.end();
00208
00209 if ( first ) {
00210
00211 first = false;
00212 unsigned int StID0 = 0;
00213 toutput->put(inputRange,StID0);
00214 }
00215
00216
00217 toutput->put(inputRange,StID);
00218
00219 number_localelectroderechits += collector.size();
00220 }
00221 }
00222
00223
00224 if (verbosity > 0) {
00225 std::cout << "FP420TrackMain: execution in mode " << trackMode_ << " generating " << number_localelectroderechits << " tracks in " << number_detunits << " detectors" << std::endl;
00226 }
00227
00228
00229 if (verbosity ==-29) {
00230
00231
00232 for (int det=1; det<dn0; det++) {
00233 int StID = 1111;
00234 if(det==2) StID = 2222;
00235 std::vector<TrackFP420> collector;
00236 collector.clear();
00237 TrackCollectionFP420::Range outputRange;
00238 outputRange = toutput->get(StID);
00239
00240 TrackCollectionFP420::ContainerIterator sort_begin = outputRange.first;
00241 TrackCollectionFP420::ContainerIterator sort_end = outputRange.second;
00242 for ( ;sort_begin != sort_end; ++sort_begin ) {
00243 collector.push_back(*sort_begin);
00244 }
00245 std::cout <<" ===" << std::endl;
00246 std::cout <<" ===" << std::endl;
00247 std::cout <<"=======FP420TrackMain:check size = " << collector.size() << " det = " << det << std::endl;
00248 std::cout <<" ===" << std::endl;
00249 std::cout <<" ===" << std::endl;
00250 vector<TrackFP420>::const_iterator simHitIter = collector.begin();
00251 vector<TrackFP420>::const_iterator simHitIterEnd = collector.end();
00252
00253 for (;simHitIter != simHitIterEnd; ++simHitIter) {
00254 const TrackFP420 itrack = *simHitIter;
00255
00256 std::cout << "FP420TrackMain:check: nclusterx = " << itrack.nclusterx() << " nclustery = " << itrack.nclustery() << std::endl;
00257 std::cout << " ax = " << itrack.ax() << " bx = " << itrack.bx() << std::endl;
00258 std::cout << " ay = " << itrack.ay() << " by = " << itrack.by() << std::endl;
00259 std::cout << " chi2x= " << itrack.chi2x() << " chi2y= " << itrack.chi2y() << std::endl;
00260 std::cout <<" ===" << std::endl;
00261 std::cout <<" ===" << std::endl;
00262 std::cout <<" =======================" << std::endl;
00263 }
00264
00265
00266
00267
00268 std::cout <<"======= FP420TrackMain: end of check " << std::endl;
00269
00270 }
00271 }
00272
00273
00274
00275
00276 }
00277
00278
00279
00280 }