CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FP420TrackMain.cc
Go to the documentation of this file.
1 // File: FP420TrackMain.cc
3 // Date: 12.2006
4 // Description: FP420TrackMain for FP420
5 // Modifications:
7 #include <vector>
8 #include <iostream>
10 
15 
16 #include "CLHEP/Random/RandFlat.h"
17 
18 using namespace std;
19 
20 //#define mytrackdebug0
21 
22 //FP420TrackMain::FP420TrackMain(){
24 
25  verbosity = conf_.getUntrackedParameter<int>("VerbosityLevel");
26  trackMode_ = conf_.getParameter<std::string>("TrackModeFP420");
27  dn0 = conf_.getParameter<int>("NumberFP420Detectors");
28  sn0_ = conf_.getParameter<int>("NumberFP420Stations");
29  pn0_ = conf_.getParameter<int>("NumberFP420SPlanes");
30  rn0_ = 7;
31  xytype_ = conf_.getParameter<int>("NumberFP420SPTypes");
32  z420_ = conf_.getParameter<double>("z420");
33  zD2_ = conf_.getParameter<double>("zD2");
34  zD3_ = conf_.getParameter<double>("zD3");
35  dXX_ = conf_.getParameter<double>("dXXFP420");
36  dYY_ = conf_.getParameter<double>("dYYFP420");
37  chiCutX_ = conf_.getParameter<double>("chiCutX420");
38  chiCutY_ = conf_.getParameter<double>("chiCutY420");
39 
40  if (verbosity > 0) {
41  std::cout << "FP420TrackMain constructor::" << std::endl;
42  std::cout << "sn0=" << sn0_ << " pn0=" << pn0_ << " xytype=" << xytype_ << std::endl;
43  std::cout << "trackMode = " << trackMode_ << std::endl;
44  std::cout << "dXX=" << dXX_ << " dYY=" << dYY_ << std::endl;
45  std::cout << "chiCutX=" << chiCutX_ << " chiCutY=" << chiCutY_ << std::endl;
46  }
48  // zD2_ = 1000.; // dist between centers of 1st and 2nd stations
49  // zD3_ = 8000.; // dist between centers of 1st and 3rd stations
50 
55 
56  pitchX_= 0.050;
57  pitchY_= 0.050;//
58  pitchXW_= 0.400;
59  pitchYW_= 0.400;//
60 
61  XsensorSize_=8.0;
62  YsensorSize_=7.2;
63 
64 //
65  zBlade_ = 5.00;
66  gapBlade_ = 1.6;
67  double gapSupplane = 1.6;
68  ZSiPlane_=2*zBlade_+gapBlade_+gapSupplane;
69 
70  double ZKapton = 0.1;
71  ZSiStep_=ZSiPlane_+ZKapton;
72 
73  double ZBoundDet = 0.020;
74  double ZSiElectr = 0.250;
75  double ZCeramDet = 0.500;
76 
77  double eee1=11.;
78  double eee2=12.;
79  zinibeg_ = (eee1-eee2)/2.;
80 //
81  ZSiDet_ = 0.250;
82 //
83  ZGapLDet_= zBlade_/2-(ZSiDet_+ZSiElectr+ZBoundDet+ZCeramDet/2);
84 //
85  if (verbosity > 1) {
86  std::cout << "FP420TrackMain constructor::" << std::endl;
87  std::cout << " zD2=" << zD2_ << " zD3=" << zD3_ << " zinibeg =" << zinibeg_ << std::endl;
88  std::cout << " UseHalfPitchShiftInX=" << UseHalfPitchShiftInX_ << " UseHalfPitchShiftInY=" << UseHalfPitchShiftInY_ << std::endl;
89  std::cout << " UseHalfPitchShiftInXW=" << UseHalfPitchShiftInXW_ << " UseHalfPitchShiftInYW=" << UseHalfPitchShiftInYW_ << std::endl;
90  std::cout << " pitchX=" << pitchX_ << " pitchY=" << pitchY_ << std::endl;
91  std::cout << " pitchXW=" << pitchXW_ << " pitchYW=" << pitchYW_ << std::endl;
92  std::cout << " zBlade_=" << zBlade_ << " gapBlade_=" << gapBlade_ << std::endl;
93  std::cout << " ZKapton=" << ZKapton << " ZBoundDet=" << ZBoundDet << std::endl;
94  std::cout << " ZSiElectr=" << ZSiElectr << " ZCeramDet=" << ZCeramDet << std::endl;
95  std::cout << " ZSiDet=" << ZSiDet_ << " gapSupplane=" << gapSupplane << std::endl;
96  }
98 
99 
100 
101  if ( trackMode_ == "TrackProducerSophisticatedFP420" ) {
102 
103 
104  //trackMode_ == "TrackProducerVar1FP420" ||
105  //trackMode_ == "TrackProducerVar2FP420" ||
106 
107  // if ( trackMode_ == "TrackProducerMaxAmplitudeFP420" ||
108 // trackMode_ == "TrackProducerMaxAmplitude2FP420" ||
109 // trackMode_ == "TrackProducerSophisticatedFP420" ||
110 // trackMode_ == "TrackProducer3DFP420" ) {
111 
112  finderParameters_ = new TrackProducerFP420(sn0_, pn0_, rn0_, xytype_, z420_, zD2_, zD3_,
113  pitchX_, pitchY_,
119  dXX_,dYY_,chiCutX_,chiCutY_,zinibeg_,verbosity,
121  validTrackerizer_ = true;
122  }
123  else {
124  std::cout << "ERROR:FP420TrackMain: No valid finder selected" << std::endl;
125  validTrackerizer_ = false;
126  }
127 }
128 
130  if ( finderParameters_ != 0 ) {
131  delete finderParameters_;
132  }
133 }
134 
135 
136 
137 void FP420TrackMain::run(edm::Handle<ClusterCollectionFP420> &input, std::auto_ptr<TrackCollectionFP420> &toutput )
138 {
139 
140  if ( validTrackerizer_ ) {
141 
142  int number_detunits = 0;
143  int number_localelectroderechits = 0;
144  /*
145  for (int sector=1; sector<sn0_; sector++) {
146  for (int zmodule=1; zmodule<pn0_; zmodule++) {
147  for (int zside=1; zside<rn0_; zside++) {
148  int sScale = 2*(pn0-1);
149  // int index = FP420NumberingScheme::packFP420Index(det, zside, sector, zmodule);
150  // intindex is a continues numbering of FP420
151  int zScale=2; unsigned int detID = sScale*(sector - 1)+zScale*(zmodule - 1)+zside;
152  ClusterMap.clear();
153  ClusterCollectionFP420::Range clusterRange;
154  clusterRange = input.get(detID);
155  ClusterCollectionFP420::ContainerIterator clusterRangeIteratorBegin = clusterRange.first;
156  ClusterCollectionFP420::ContainerIterator clusterRangeIteratorEnd = clusterRange.second;
157  for ( ;sort_begin != sort_end; ++sort_begin ) {
158  ClusterMap.push_back(*sort_begin);
159  } // for
160 
161  }//for
162  }//for
163  }//for
164  */
165  // get vector of detunit ids
166  // const std::vector<unsigned int> detIDs = input->detIDs();
167 
168  // to be used in put (besause of 0 in track collection for: 1) 1st track and 2) case of no track)
169  // ignore 0, but to save info for 1st track record it second time on place 1 .
170 
171  bool first = true;
172  // loop over detunits
173  for (int det=1; det<dn0; det++) {
174  ++number_detunits;
175  int StID = 1111;
176  if(det==2) StID = 2222;
177  std::vector<TrackFP420> collector;
178  // std::vector<TrackFP420> collector;
179  collector.clear();
180 
181  // if ( trackMode_ == "TrackProducerMaxAmplitudeFP420") {
182  // collector = finderParameters_->trackFinderMaxAmplitude(input); //std::vector<TrackFP420> collector;
183  // }// if ( trackMode
184  // else if (trackMode_ == "TrackProducerMaxAmplitude2FP420" ) {
185  // collector = finderParameters_->trackFinderMaxAmplitude2(input); //
186  // }// if ( trackMode
187  /*
188  else if (trackMode_ == "TrackProducerVar1FP420" ) {
189  collector = finderParameters_->trackFinderVar1(input); //
190  }// if ( trackMode
191  else if (trackMode_ == "TrackProducerVar2FP420" ) {
192  collector = finderParameters_->trackFinderVar2(input); //
193  }// if ( trackMode
194  */
195  if (trackMode_ == "TrackProducerSophisticatedFP420" ) {
196  collector = finderParameters_->trackFinderSophisticated(input,det); //
197  }// if ( trackMode
198 
199 
200  // else if (trackMode_ == "TrackProducer3DFP420" ) {
201  // collector = finderParameters_->trackFinder3D(input); //
202  // }// if ( trackMode
203 
204  if (collector.size()>0){
206  inputRange.first = collector.begin();
207  inputRange.second = collector.end();
208 
209  if ( first ) {
210  // use it only if TrackCollectionFP420 is the TrackCollection of one event, otherwise, do not use (loose 1st cl. of 1st event only)
211  first = false;
212  unsigned int StID0 = 0;
213  toutput->put(inputRange,StID0); // !!! put into adress 0 for detID which will not be used never
214  } //if ( first )
215 
216  // !!! put !!! put
217  toutput->put(inputRange,StID);
218 
219  number_localelectroderechits += collector.size();
220  } // if collector.size
221  }//for det loop
222 
223 
224  if (verbosity > 0) {
225  std::cout << "FP420TrackMain: execution in mode " << trackMode_ << " generating " << number_localelectroderechits << " tracks in " << number_detunits << " detectors" << std::endl;
226  }
227 
228 
229  if (verbosity ==-29) {
230  // check of access to the collector:
231  // loop over detunits
232  for (int det=1; det<dn0; det++) {
233  int StID = 1111;
234  if(det==2) StID = 2222;
235  std::vector<TrackFP420> collector;
236  collector.clear();
237  TrackCollectionFP420::Range outputRange;
238  outputRange = toutput->get(StID);
239  // fill output in collector vector (for may be sorting? or other checks)
240  TrackCollectionFP420::ContainerIterator sort_begin = outputRange.first;
241  TrackCollectionFP420::ContainerIterator sort_end = outputRange.second;
242  for ( ;sort_begin != sort_end; ++sort_begin ) {
243  collector.push_back(*sort_begin);
244  } // for
245  std::cout <<" ===" << std::endl;
246  std::cout <<" ===" << std::endl;
247  std::cout <<"=======FP420TrackMain:check size = " << collector.size() << " det = " << det << std::endl;
248  std::cout <<" ===" << std::endl;
249  std::cout <<" ===" << std::endl;
250  vector<TrackFP420>::const_iterator simHitIter = collector.begin();
251  vector<TrackFP420>::const_iterator simHitIterEnd = collector.end();
252  // loop in #tracks
253  for (;simHitIter != simHitIterEnd; ++simHitIter) {
254  const TrackFP420 itrack = *simHitIter;
255 
256  std::cout << "FP420TrackMain:check: nclusterx = " << itrack.nclusterx() << " nclustery = " << itrack.nclustery() << std::endl;
257  std::cout << " ax = " << itrack.ax() << " bx = " << itrack.bx() << std::endl;
258  std::cout << " ay = " << itrack.ay() << " by = " << itrack.by() << std::endl;
259  std::cout << " chi2x= " << itrack.chi2x() << " chi2y= " << itrack.chi2y() << std::endl;
260  std::cout <<" ===" << std::endl;
261  std::cout <<" ===" << std::endl;
262  std::cout <<" =======================" << std::endl;
263  }
264 
265  //==================================
266 
267  // end of check of access to the strip collection
268  std::cout <<"======= FP420TrackMain: end of check " << std::endl;
269 
270  }//for det
271  }// if verbosity
272 
273 
274 
275 
276  }// if ( validTrackerizer_
277 
278 
279 
280 }
T getParameter(std::string const &) const
std::vector< TrackFP420 > trackFinderSophisticated(edm::Handle< ClusterCollectionFP420 > input, int det)
T getUntrackedParameter(std::string const &, T const &) const
int nclusterx() const
Definition: TrackFP420.h:17
inputRange
Get input source.
double ax() const
Definition: TrackFP420.h:14
bool UseHalfPitchShiftInY_
double by() const
Definition: TrackFP420.h:19
std::pair< ContainerIterator, ContainerIterator > Range
bool UseHalfPitchShiftInXW_
double chi2x() const
Definition: TrackFP420.h:16
static std::string const input
Definition: EdmProvDump.cc:44
double chi2y() const
Definition: TrackFP420.h:20
FP420TrackMain(const edm::ParameterSet &conf)
double ay() const
Definition: TrackFP420.h:18
std::vector< TrackFP420 >::const_iterator ContainerIterator
double bx() const
Definition: TrackFP420.h:15
void run(edm::Handle< ClusterCollectionFP420 > &input, std::auto_ptr< TrackCollectionFP420 > &toutput)
Runs the algorithm.
bool UseHalfPitchShiftInX_
bool first
Definition: L1TdeRCT.cc:75
tuple conf
Definition: dbtoconf.py:185
edm::ParameterSet conf_
int nclustery() const
Definition: TrackFP420.h:21
bool UseHalfPitchShiftInYW_
TrackProducerFP420 * finderParameters_
tuple cout
Definition: gather_cfg.py:121
std::string trackMode_