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