CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
FP420RecoMain Class Reference

#include <FP420RecoMain.h>

Public Member Functions

 FP420RecoMain (const edm::ParameterSet &conf)
 
void run (edm::Handle< TrackCollectionFP420 > &input, RecoCollectionFP420 *toutput, double VtxX, double VtxY, double VtxZ)
 Runs the algorithm. More...
 
 ~FP420RecoMain ()
 

Private Attributes

edm::ParameterSet conf_
 
int dn0
 
RecoProducerFP420finderParameters_
 
double m_rpp420_b
 
double m_rpp420_f
 
double m_zrefb
 
double m_zreff
 
int verbosity
 
double zinibeg_
 

Detailed Description

Definition at line 22 of file FP420RecoMain.h.

Constructor & Destructor Documentation

FP420RecoMain::FP420RecoMain ( const edm::ParameterSet conf)

Definition at line 27 of file FP420RecoMain.cc.

References conf_, gather_cfg::cout, dn0, finderParameters_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_rpp420_b, m_rpp420_f, m_zrefb, m_zreff, verbosity, and zinibeg_.

27  :conf_(conf) {
28 
29  verbosity = conf_.getUntrackedParameter<int>("VerbosityLevel");
30  m_rpp420_f = conf_.getParameter<double>("RP420f");//mm
31  m_rpp420_b = conf_.getParameter<double>("RP420b");//mm
32  m_zreff = conf_.getParameter<double>("zreff");//mm
33  m_zrefb = conf_.getParameter<double>("zrefb");//mm
34  dn0 = conf_.getParameter<int>("NumberFP420Detectors");
35 
36  if (verbosity > 0) {
37  std::cout << "FP420RecoMain constructor::" << std::endl;
38  std::cout << "m_rpp420_f=" << m_rpp420_f << " m_rpp420_b=" << m_rpp420_b << std::endl;
39  std::cout << "m_zreff=" << m_zreff << " m_zrefb=" << m_zrefb<< std::endl;
40  }
41 
42  double eee1=11.;
43  double eee2=12.;
44 // zinibeg_ = (eee1-eee2)/2.;
45  zinibeg_ = 0.;
46 //
47  if (verbosity > 1) {
48  std::cout << "FP420RecoMain constructor::" << std::endl;
49  std::cout << " eee1=" << eee1 << " eee2=" << eee2 << " zinibeg =" << zinibeg_ << std::endl;
50  }
53 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet conf_
Definition: FP420RecoMain.h:38
double m_rpp420_f
Definition: FP420RecoMain.h:43
RecoProducerFP420 * finderParameters_
Definition: FP420RecoMain.h:39
double m_rpp420_b
Definition: FP420RecoMain.h:44
FP420RecoMain::~FP420RecoMain ( )

Definition at line 55 of file FP420RecoMain.cc.

References finderParameters_.

55  {
56  if ( finderParameters_ != 0 ) {
57  delete finderParameters_;
58  }
59 }
RecoProducerFP420 * finderParameters_
Definition: FP420RecoMain.h:39

Member Function Documentation

void FP420RecoMain::run ( edm::Handle< TrackCollectionFP420 > &  input,
RecoCollectionFP420 toutput,
double  VtxX,
double  VtxY,
double  VtxZ 
)

Runs the algorithm.

Definition at line 63 of file FP420RecoMain.cc.

References TrackFP420::ax(), TrackFP420::ay(), TrackFP420::bx(), TrackFP420::by(), gather_cfg::cout, RecoFP420::direction(), dn0, RecoFP420::e0(), finderParameters_, plotBeamSpotDB::first, RecoCollectionFP420::get(), TrackCollectionFP420::get(), m_rpp420_b, m_rpp420_f, m_zrefb, m_zreff, RecoCollectionFP420::put(), RecoFP420::q20(), RecoProducerFP420::reconstruct(), RecoFP420::tx0(), RecoFP420::ty0(), verbosity, RecoFP420::x0(), RecoFP420::y0(), FP420Track_cfi::z420, and zinibeg_.

Referenced by cms::ReconstructerFP420::produce().

64 {
65  // initialization
66  bool first = true;
67  // finderParameters_->clear();
68  // finderParameters_->setIP( 0., 0., 0. );
69  std::vector<TrackFP420> rhits;
70  int restracks = 10;// max # tracks
71  rhits.reserve(restracks);
72  rhits.clear();
73 
74  // loop over detunits:
75  for (int number_detunits=1; number_detunits<dn0; number_detunits++) {
76  unsigned int StID = number_detunits;
77  std::vector<RecoFP420> rcollector;
78  int restracks = 10;// max # tracks
79  rcollector.reserve(restracks);
80  rcollector.clear();
81 
83  std::vector<TrackFP420> collector;
84  collector.clear();
85  TrackCollectionFP420::Range outputRange;
86  unsigned int StIDTrack = 1111;
87  double z420 = m_rpp420_f;
88  double zref1 = m_zreff;
89  double zinibeg = zinibeg_;
90  double VtxXcur = VtxX;
91  double VtxYcur = VtxY;
92  double VtxZcur = VtxZ;
93  if(StID==2) {
94  StIDTrack = 2222;
95  z420 = -m_rpp420_b;
96  zref1 = -m_zrefb;
97  zinibeg = -zinibeg_;
98  // VtxXcur = -VtxX;
99  // VtxYcur = -VtxY;
100  // VtxZcur = -VtxZ;
101  }
102  double z1 = z420+zinibeg-VtxZcur;
103  double z2 = z420+zinibeg+zref1-VtxZcur;
104  if (verbosity > 1) {
105  std::cout << "FP420RecoMain: StIDTrack=" << StIDTrack << std::endl;
106  }
107  outputRange = input->get(StIDTrack);
108  //
109  // fill output in collector vector (for may be sorting? or other checks)
110  //
111  TrackCollectionFP420::ContainerIterator sort_begin = outputRange.first;
112  TrackCollectionFP420::ContainerIterator sort_end = outputRange.second;
113  //
114  for ( ;sort_begin != sort_end; ++sort_begin ) {
115  collector.push_back(*sort_begin);
116  } // for sort_begin
117  if (verbosity > 1) {
118  std::cout << "FP420RecoMain: track collector.size=" << collector.size() << std::endl;
119  }
120  std::vector<TrackFP420>::const_iterator simHitIter = collector.begin();
121  std::vector<TrackFP420>::const_iterator simHitIterEnd = collector.end();
122  for (;simHitIter != simHitIterEnd; ++simHitIter) {
123  const TrackFP420 itrack = *simHitIter;
124  double x1 = ( itrack.bx()*z1 + (itrack.ax()-VtxXcur) )*1000.;//um
125  double y1 = ( itrack.by()*z1 + (itrack.ay()-VtxYcur) )*1000.;//um
126  double x2 = ( itrack.bx()*z2 + (itrack.ax()-VtxXcur) )*1000.;//um
127  double y2 = ( itrack.by()*z2 + (itrack.ay()-VtxYcur) )*1000.;//um
129  if (verbosity == -49) {
130  std::cout << "==================================================================== " << std::endl;
131  std::cout << "FP420RecoMain: StID= " << StID << std::endl;
132  std::cout << "input coord. in mm: z1= " << z1 << std::endl;
133  std::cout << "input coord. in mm: z2= " << z2 << std::endl;
134  std::cout << "input: itrack.bx()= " << itrack.bx() << std::endl;
135  std::cout << "input: itrack.ax()= " << itrack.ax() << std::endl;
136  std::cout << "input: itrack.by()= " << itrack.by() << std::endl;
137  std::cout << "input: itrack.ay()= " << itrack.ay() << std::endl;
138 
139  std::cout << "input: in um X1noVtx= " << (itrack.bx()*(z420+zinibeg)+itrack.ax())*1000. << std::endl;
140  std::cout << "input: in um Y1noVtx= " << (itrack.by()*(z420+zinibeg)+itrack.ay())*1000. << std::endl;
141  std::cout << "input: in um X2noVtx= " << (itrack.bx()*(z420+zinibeg+zref1)+itrack.ax())*1000. << std::endl;
142  std::cout << "input: in um Y2noVtx= " << (itrack.by()*(z420+zinibeg+zref1)+itrack.ay())*1000. << std::endl;
143 
144 
145  std::cout << "input: in mm VtxXcur= " << VtxXcur << std::endl;
146  std::cout << "input: in mm VtxYcur= " << VtxYcur << std::endl;
147  std::cout << "input: in mm VtxZcur= " << VtxZcur << std::endl;
148  std::cout << "input coord. in um: x1= " << x1 << std::endl;
149  std::cout << "input coord. in um: y1= " << y1 << std::endl;
150  std::cout << "input coord. in um: x2= " << x2 << std::endl;
151  std::cout << "input coord. in um: y2= " << y2 << std::endl;
152  }
153  double zz1=fabs(z1);
154  double zz2=fabs(z2);
155  rcollector = finderParameters_->reconstruct(StID, x1,y1,x2,y2,zz1,zz2); // x1,y1,x2,y2 input coord. in um; z1, z2 in mm
156  }
158 
159 
160 
161  if (verbosity > 1) {
162  std::cout << "FP420RecoMain: track rcollector.size=" << rcollector.size() << std::endl;
163  }
164  if (rcollector.size()>0){
165  RecoCollectionFP420::Range rinputRange;
166  rinputRange.first = rcollector.begin();
167  rinputRange.second = rcollector.end();
168 
169  if ( first ) {
170  // use it only if RecoCollectionFP420 is the RecoCollection of one event, otherwise, do not use (loose 1st cl. of 1st event only)
171  first = false;
172  unsigned int StID0 = 0;
173  toutput->put(rinputRange,StID0); // !!! put into adress 0 for detID which will not be used never
174  if (verbosity > 1) {
175  std::cout << "FP420RecoMain: put(rinputRange,StID0)" << std::endl;
176  }
177  } //if ( first )
178 
179  // !!! put !!! put
180  toutput->put(rinputRange,StID);
181  if (verbosity > 1) {
182  std::cout << "FP420RecoMain: put(rinputRange,StID)" << std::endl;
183  }
184 
185  } // if rcollector.size
186 
187  }// for loop over detunits
188 
189 
190 
191 
192 
193 
194  if (verbosity > 1) {
195  // check of access to the zcollector:
196  for (int number_detunits=1; number_detunits<dn0; number_detunits++) {
197  int StID = number_detunits;
198  if (verbosity > 1) {
199  std::cout <<" ===" << std::endl;
200  std::cout <<" ===" << std::endl;
201  std::cout << "FP420RecoMain: re-new StID= " << StID << std::endl;
202  }
203  std::vector<RecoFP420> zcollector;
204  zcollector.clear();
205  RecoCollectionFP420::Range zoutputRange;
206  zoutputRange = toutput->get(StID);
207  // fill output in zcollector vector (for may be sorting? or other checks)
208  RecoCollectionFP420::ContainerIterator sort_begin = zoutputRange.first;
209  RecoCollectionFP420::ContainerIterator sort_end = zoutputRange.second;
210  for ( ;sort_begin != sort_end; ++sort_begin ) {
211  zcollector.push_back(*sort_begin);
212  } // for
213  std::cout <<"=======FP420RecoMain:check of re-new zcollector size = " << zcollector.size() << std::endl;
214  std::cout <<" ===" << std::endl;
215  std::cout <<" ===" << std::endl;
216  std::vector<RecoFP420>::const_iterator simHitIter = zcollector.begin();
217  std::vector<RecoFP420>::const_iterator simHitIterEnd = zcollector.end();
218  // loop in recoess
219  for (;simHitIter != simHitIterEnd; ++simHitIter) {
220  const RecoFP420 itrack = *simHitIter;
221  //double e0, double x0, double y0, double tx0, double ty0, double q20, int direction
222  std::cout << "FP420RecoMain:check: direction = " << itrack.direction() << std::endl;
223  std::cout << " e0 = " << itrack.e0() << " q20 = " << itrack.q20() << std::endl;
224  std::cout << " tx0 = " << itrack.tx0() << " ty0 = " << itrack.ty0() << std::endl;
225  std::cout << " x0= " << itrack.x0() << " y0= " << itrack.y0() << std::endl;
226  std::cout <<" ===" << std::endl;
227  std::cout <<" ===" << std::endl;
228  std::cout <<" =======================" << std::endl;
229  }
230  }
231 
232  //==================================
233 
234  // end of check of access to the strip collection
235  std::cout <<"======= FP420RecoMain: end of check " << std::endl;
236 
237  }//if (verbos
238 
239 
240 
241 
242 
243 
244 
245 }
std::pair< ContainerIterator, ContainerIterator > Range
double ty0() const
Definition: RecoFP420.h:18
double ax() const
Definition: TrackFP420.h:14
double by() const
Definition: TrackFP420.h:19
std::pair< ContainerIterator, ContainerIterator > Range
double m_rpp420_f
Definition: FP420RecoMain.h:43
std::vector< RecoFP420 >::const_iterator ContainerIterator
double q20() const
Definition: RecoFP420.h:19
double ay() const
Definition: TrackFP420.h:18
std::vector< TrackFP420 >::const_iterator ContainerIterator
RecoProducerFP420 * finderParameters_
Definition: FP420RecoMain.h:39
double bx() const
Definition: TrackFP420.h:15
const Range get(unsigned int stationID) const
const Range get(unsigned int stationID) const
int direction() const
Definition: RecoFP420.h:20
void put(Range input, unsigned int stationID)
double m_rpp420_b
Definition: FP420RecoMain.h:44
std::vector< RecoFP420 > reconstruct(int, double, double, double, double, double, double)
double x0() const
Definition: RecoFP420.h:15
double tx0() const
Definition: RecoFP420.h:17
double y0() const
Definition: RecoFP420.h:16
double e0() const
Definition: RecoFP420.h:14

Member Data Documentation

edm::ParameterSet FP420RecoMain::conf_
private

Definition at line 38 of file FP420RecoMain.h.

Referenced by FP420RecoMain().

int FP420RecoMain::dn0
private

Definition at line 47 of file FP420RecoMain.h.

Referenced by FP420RecoMain(), and run().

RecoProducerFP420* FP420RecoMain::finderParameters_
private

Definition at line 39 of file FP420RecoMain.h.

Referenced by FP420RecoMain(), run(), and ~FP420RecoMain().

double FP420RecoMain::m_rpp420_b
private

Definition at line 44 of file FP420RecoMain.h.

Referenced by FP420RecoMain(), and run().

double FP420RecoMain::m_rpp420_f
private

Definition at line 43 of file FP420RecoMain.h.

Referenced by FP420RecoMain(), and run().

double FP420RecoMain::m_zrefb
private

Definition at line 46 of file FP420RecoMain.h.

Referenced by FP420RecoMain(), and run().

double FP420RecoMain::m_zreff
private

Definition at line 45 of file FP420RecoMain.h.

Referenced by FP420RecoMain(), and run().

int FP420RecoMain::verbosity
private

Definition at line 41 of file FP420RecoMain.h.

Referenced by FP420RecoMain(), and run().

double FP420RecoMain::zinibeg_
private

Definition at line 49 of file FP420RecoMain.h.

Referenced by FP420RecoMain(), and run().