CMS 3D CMS Logo

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 }
FP420TrackMain::pitchYW_
double pitchYW_
Definition: FP420TrackMain.h:61
FP420TrackMain::dYY_
double dYY_
Definition: FP420TrackMain.h:71
TrackCollectionFP420::put
void put(Range input, unsigned int stationID)
Definition: TrackCollectionFP420.cc:13
FP420TrackMain::trackMode_
std::string trackMode_
Definition: FP420TrackMain.h:32
input
static const std::string input
Definition: EdmProvDump.cc:48
FP420TrackMain::finderParameters_
TrackProducerFP420 * finderParameters_
Definition: FP420TrackMain.h:31
FP420TrackMain::pn0_
int pn0_
Definition: FP420TrackMain.h:42
FP420TrackMain::UseHalfPitchShiftInXW_
bool UseHalfPitchShiftInXW_
Definition: FP420TrackMain.h:51
TrackFP420::chi2y
double chi2y() const
Definition: TrackFP420.h:20
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TrackCollectionFP420::ContainerIterator
std::vector< TrackFP420 >::const_iterator ContainerIterator
Definition: TrackCollectionFP420.h:11
TrackFP420
Definition: TrackFP420.h:6
TrackFP420::nclustery
int nclustery() const
Definition: TrackFP420.h:21
FP420TrackMain.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
FP420TrackMain::gapBlade_
double gapBlade_
Definition: FP420TrackMain.h:68
edm::Handle
Definition: AssociativeIterator.h:50
TrackFP420::ax
double ax() const
Definition: TrackFP420.h:14
pileupCalc.inputRange
inputRange
Definition: pileupCalc.py:218
TrackCollectionFP420
Definition: TrackCollectionFP420.h:9
TrackFP420.h
FP420TrackMain::pitchY_
double pitchY_
Definition: FP420TrackMain.h:59
TrackFP420::ay
double ay() const
Definition: TrackFP420.h:18
FP420TrackMain::pitchXW_
double pitchXW_
Definition: FP420TrackMain.h:60
FP420TrackMain::UseHalfPitchShiftInX_
bool UseHalfPitchShiftInX_
Definition: FP420TrackMain.h:48
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
FP420TrackMain::zinibeg_
double zinibeg_
Definition: FP420TrackMain.h:75
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FP420TrackMain::zBlade_
double zBlade_
Definition: FP420TrackMain.h:67
FP420TrackMain::verbosity
int verbosity
Definition: FP420TrackMain.h:36
FP420TrackMain::chiCutY_
double chiCutY_
Definition: FP420TrackMain.h:73
FP420TrackMain::dn0
int dn0
Definition: FP420TrackMain.h:38
TrackProducerFP420.h
edm::ParameterSet
Definition: ParameterSet.h:47
FP420TrackMain::FP420TrackMain
FP420TrackMain(const edm::ParameterSet &conf)
Definition: FP420TrackMain.cc:23
TrackCollectionFP420::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: TrackCollectionFP420.h:12
FP420TrackMain::UseHalfPitchShiftInY_
bool UseHalfPitchShiftInY_
Definition: FP420TrackMain.h:49
FP420TrackMain::dXX_
double dXX_
Definition: FP420TrackMain.h:70
FP420TrackMain::conf_
edm::ParameterSet conf_
Definition: FP420TrackMain.h:30
FP420TrackMain::ZSiStep_
double ZSiStep_
Definition: FP420TrackMain.h:64
TrackFP420::chi2x
double chi2x() const
Definition: TrackFP420.h:16
FP420TrackMain::zD2_
double zD2_
Definition: FP420TrackMain.h:56
ClusterFP420.h
FP420TrackMain::YsensorSize_
double YsensorSize_
Definition: FP420TrackMain.h:78
FP420TrackMain::run
void run(edm::Handle< ClusterCollectionFP420 > &input, TrackCollectionFP420 *toutput)
Runs the algorithm.
Definition: FP420TrackMain.cc:151
FP420TrackMain::chiCutX_
double chiCutX_
Definition: FP420TrackMain.h:72
std
Definition: JetResolutionObject.h:76
FP420TrackMain::rn0_
int rn0_
Definition: FP420TrackMain.h:44
TrackFP420::bx
double bx() const
Definition: TrackFP420.h:15
FP420TrackMain::UseHalfPitchShiftInYW_
bool UseHalfPitchShiftInYW_
Definition: FP420TrackMain.h:52
TrackProducerFP420
Definition: TrackProducerFP420.h:24
FP420TrackMain::ZSiDet_
double ZSiDet_
Definition: FP420TrackMain.h:66
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
FP420TrackMain::~FP420TrackMain
~FP420TrackMain()
Definition: FP420TrackMain.cc:145
FP420TrackMain::sn0_
int sn0_
Definition: FP420TrackMain.h:40
TrackProducerFP420::trackFinderSophisticated
std::vector< TrackFP420 > trackFinderSophisticated(edm::Handle< ClusterCollectionFP420 > input, int det)
Definition: TrackProducerFP420.cc:106
FP420TrackMain::z420_
double z420_
Definition: FP420TrackMain.h:55
TrackFP420::by
double by() const
Definition: TrackFP420.h:19
FP420TrackMain::ZGapLDet_
double ZGapLDet_
Definition: FP420TrackMain.h:62
FP420TrackMain::ZSiPlane_
double ZSiPlane_
Definition: FP420TrackMain.h:65
FP420TrackMain::validTrackerizer_
bool validTrackerizer_
Definition: FP420TrackMain.h:34
ParameterSet.h
TrackFP420::nclusterx
int nclusterx() const
Definition: TrackFP420.h:17
FP420TrackMain::xytype_
int xytype_
Definition: FP420TrackMain.h:46
FP420TrackMain::zD3_
double zD3_
Definition: FP420TrackMain.h:57
TrackCollectionFP420::get
const Range get(unsigned int stationID) const
Definition: TrackCollectionFP420.cc:69
FP420TrackMain::XsensorSize_
double XsensorSize_
Definition: FP420TrackMain.h:77
FP420TrackMain::pitchX_
double pitchX_
Definition: FP420TrackMain.h:58