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