CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 
16 
17 #include "CLHEP/Random/RandFlat.h"
18 
19 using namespace std;
20 
21 //#define mytrackdebug0
22 
23 //FP420TrackMain::FP420TrackMain(){
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 
51  UseHalfPitchShiftInX_ = true;
52  UseHalfPitchShiftInXW_ = true;
53  UseHalfPitchShiftInY_ = true;
54  UseHalfPitchShiftInYW_ = true;
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_
89  << std::endl;
90  std::cout << " UseHalfPitchShiftInXW=" << UseHalfPitchShiftInXW_
91  << " UseHalfPitchShiftInYW=" << UseHalfPitchShiftInYW_ << std::endl;
92  std::cout << " pitchX=" << pitchX_ << " pitchY=" << pitchY_ << std::endl;
93  std::cout << " pitchXW=" << pitchXW_ << " pitchYW=" << pitchYW_ << std::endl;
94  std::cout << " zBlade_=" << zBlade_ << " gapBlade_=" << gapBlade_ << std::endl;
95  std::cout << " ZKapton=" << ZKapton << " ZBoundDet=" << ZBoundDet << std::endl;
96  std::cout << " ZSiElectr=" << ZSiElectr << " ZCeramDet=" << ZCeramDet << std::endl;
97  std::cout << " ZSiDet=" << ZSiDet_ << " gapSupplane=" << gapSupplane << std::endl;
98  }
100 
101  if (trackMode_ == "TrackProducerSophisticatedFP420") {
102  //trackMode_ == "TrackProducerVar1FP420" ||
103  //trackMode_ == "TrackProducerVar2FP420" ||
104 
105  // if ( trackMode_ == "TrackProducerMaxAmplitudeFP420" ||
106  // trackMode_ == "TrackProducerMaxAmplitude2FP420" ||
107  // trackMode_ == "TrackProducerSophisticatedFP420" ||
108  // trackMode_ == "TrackProducer3DFP420" ) {
109 
110  finderParameters_ = new TrackProducerFP420(sn0_,
111  pn0_,
112  rn0_,
113  xytype_,
114  z420_,
115  zD2_,
116  zD3_,
117  pitchX_,
118  pitchY_,
119  pitchXW_,
120  pitchYW_,
121  ZGapLDet_,
122  ZSiStep_,
123  ZSiPlane_,
124  ZSiDet_,
125  zBlade_,
126  gapBlade_,
127  UseHalfPitchShiftInX_,
128  UseHalfPitchShiftInY_,
129  UseHalfPitchShiftInXW_,
130  UseHalfPitchShiftInYW_,
131  dXX_,
132  dYY_,
133  chiCutX_,
134  chiCutY_,
135  zinibeg_,
136  verbosity,
137  XsensorSize_,
138  YsensorSize_);
139  validTrackerizer_ = true;
140  } else {
141  std::cout << "ERROR:FP420TrackMain: No valid finder selected" << std::endl;
142  validTrackerizer_ = false;
143  }
144 }
145 
147  if (finderParameters_ != nullptr) {
148  delete finderParameters_;
149  }
150 }
151 
153  if (validTrackerizer_) {
154  int number_detunits = 0;
155  int number_localelectroderechits = 0;
156  /*
157  for (int sector=1; sector<sn0_; sector++) {
158  for (int zmodule=1; zmodule<pn0_; zmodule++) {
159  for (int zside=1; zside<rn0_; zside++) {
160  int sScale = 2*(pn0-1);
161  // int index = FP420NumberingScheme::packFP420Index(det, zside, sector, zmodule);
162  // intindex is a continues numbering of FP420
163  int zScale=2; unsigned int detID = sScale*(sector - 1)+zScale*(zmodule - 1)+zside;
164  ClusterMap.clear();
165  ClusterCollectionFP420::Range clusterRange;
166  clusterRange = input.get(detID);
167  ClusterCollectionFP420::ContainerIterator clusterRangeIteratorBegin = clusterRange.first;
168  ClusterCollectionFP420::ContainerIterator clusterRangeIteratorEnd = clusterRange.second;
169  for ( ;sort_begin != sort_end; ++sort_begin ) {
170  ClusterMap.push_back(*sort_begin);
171  } // for
172 
173  }//for
174  }//for
175  }//for
176  */
177  // get vector of detunit ids
178  // const std::vector<unsigned int> detIDs = input->detIDs();
179 
180  // to be used in put (besause of 0 in track collection for: 1) 1st track and 2) case of no track)
181  // ignore 0, but to save info for 1st track record it second time on place 1 .
182 
183  bool first = true;
184  // loop over detunits
185  for (int det = 1; det < dn0; det++) {
186  ++number_detunits;
187  int StID = 1111;
188  if (det == 2)
189  StID = 2222;
190  std::vector<TrackFP420> collector;
191  // std::vector<TrackFP420> collector;
192  collector.clear();
193 
194  // if ( trackMode_ == "TrackProducerMaxAmplitudeFP420") {
195  // collector = finderParameters_->trackFinderMaxAmplitude(input); //std::vector<TrackFP420> collector;
196  // }// if ( trackMode
197  // else if (trackMode_ == "TrackProducerMaxAmplitude2FP420" ) {
198  // collector = finderParameters_->trackFinderMaxAmplitude2(input); //
199  // }// if ( trackMode
200  /*
201  else if (trackMode_ == "TrackProducerVar1FP420" ) {
202  collector = finderParameters_->trackFinderVar1(input); //
203  }// if ( trackMode
204  else if (trackMode_ == "TrackProducerVar2FP420" ) {
205  collector = finderParameters_->trackFinderVar2(input); //
206  }// if ( trackMode
207  */
208  if (trackMode_ == "TrackProducerSophisticatedFP420") {
209  collector = finderParameters_->trackFinderSophisticated(input, det); //
210  } // if ( trackMode
211 
212  // else if (trackMode_ == "TrackProducer3DFP420" ) {
213  // collector = finderParameters_->trackFinder3D(input); //
214  // }// if ( trackMode
215 
216  if (!collector.empty()) {
218  inputRange.first = collector.begin();
219  inputRange.second = collector.end();
220 
221  if (first) {
222  // use it only if TrackCollectionFP420 is the TrackCollection of one event, otherwise, do not use (loose 1st cl. of 1st event only)
223  first = false;
224  unsigned int StID0 = 0;
225  toutput->put(inputRange, StID0); // !!! put into adress 0 for detID which will not be used never
226  } //if ( first )
227 
228  // !!! put !!! put
229  toutput->put(inputRange, StID);
230 
231  number_localelectroderechits += collector.size();
232  } // if collector.size
233  } //for det loop
234 
235  if (verbosity > 0) {
236  std::cout << "FP420TrackMain: execution in mode " << trackMode_ << " generating " << number_localelectroderechits
237  << " tracks in " << number_detunits << " detectors" << std::endl;
238  }
239 
240  if (verbosity == -29) {
241  // check of access to the collector:
242  // loop over detunits
243  for (int det = 1; det < dn0; det++) {
244  int StID = 1111;
245  if (det == 2)
246  StID = 2222;
247  std::vector<TrackFP420> collector;
248  collector.clear();
249  TrackCollectionFP420::Range outputRange;
250  outputRange = toutput->get(StID);
251  // fill output in collector vector (for may be sorting? or other checks)
252  TrackCollectionFP420::ContainerIterator sort_begin = outputRange.first;
253  TrackCollectionFP420::ContainerIterator sort_end = outputRange.second;
254  for (; sort_begin != sort_end; ++sort_begin) {
255  collector.push_back(*sort_begin);
256  } // for
257  std::cout << " ===" << std::endl;
258  std::cout << " ===" << std::endl;
259  std::cout << "=======FP420TrackMain:check size = " << collector.size() << " det = " << det << std::endl;
260  std::cout << " ===" << std::endl;
261  std::cout << " ===" << std::endl;
262  vector<TrackFP420>::const_iterator simHitIter = collector.begin();
263  vector<TrackFP420>::const_iterator simHitIterEnd = collector.end();
264  // loop in #tracks
265  for (; simHitIter != simHitIterEnd; ++simHitIter) {
266  const TrackFP420 itrack = *simHitIter;
267 
268  std::cout << "FP420TrackMain:check: nclusterx = " << itrack.nclusterx()
269  << " nclustery = " << itrack.nclustery() << std::endl;
270  std::cout << " ax = " << itrack.ax() << " bx = " << itrack.bx() << std::endl;
271  std::cout << " ay = " << itrack.ay() << " by = " << itrack.by() << std::endl;
272  std::cout << " chi2x= " << itrack.chi2x() << " chi2y= " << itrack.chi2y() << std::endl;
273  std::cout << " ===" << std::endl;
274  std::cout << " ===" << std::endl;
275  std::cout << " =======================" << std::endl;
276  }
277 
278  //==================================
279 
280  // end of check of access to the strip collection
281  std::cout << "======= FP420TrackMain: end of check " << std::endl;
282 
283  } //for det
284  } // if verbosity
285 
286  } // if ( validTrackerizer_
287 }
T getUntrackedParameter(std::string const &, T const &) const
int nclusterx() const
Definition: TrackFP420.h:17
double ax() const
Definition: TrackFP420.h:14
double by() const
Definition: TrackFP420.h:19
std::pair< ContainerIterator, ContainerIterator > Range
double chi2x() const
Definition: TrackFP420.h:16
static std::string const input
Definition: EdmProvDump.cc:47
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
const Range get(unsigned int stationID) const
tuple inputRange
Definition: pileupCalc.py:168
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void put(Range input, unsigned int stationID)
int nclustery() const
Definition: TrackFP420.h:21
void run(edm::Handle< ClusterCollectionFP420 > &input, TrackCollectionFP420 *toutput) const
Runs the algorithm.
tuple cout
Definition: gather_cfg.py:144