CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
cms::HICFTSfromL1orL2 Class Reference

#include <HICFTSfromL1orL2.h>

Public Member Functions

std::vector< FreeTrajectoryStatecreateFTSfromL1 (std::vector< L1MuGMTExtendedCand > &)
 
std::vector< FreeTrajectoryStatecreateFTSfromL1orL2 (std::vector< L1MuGMTExtendedCand > &gmt, const reco::RecoChargedCandidateCollection &recmuons)
 
std::vector< FreeTrajectoryStatecreateFTSfromL2 (const reco::RecoChargedCandidateCollection &rc)
 
std::vector< FreeTrajectoryStatecreateFTSfromL2 (const reco::TrackCollection &rc)
 
std::vector< FreeTrajectoryStatecreateFTSfromStandAlone (const reco::TrackCollection &rc)
 
 HICFTSfromL1orL2 (const MagneticField *mf)
 
virtual ~HICFTSfromL1orL2 ()
 

Private Member Functions

FreeTrajectoryState FTSfromL1 (const L1MuGMTExtendedCand &gmt)
 
FreeTrajectoryState FTSfromL2 (const reco::RecoChargedCandidate &gmt)
 
FreeTrajectoryState FTSfromStandAlone (const reco::Track &gmt)
 

Private Attributes

const MagneticFieldfield
 

Detailed Description

Definition at line 40 of file HICFTSfromL1orL2.h.

Constructor & Destructor Documentation

cms::HICFTSfromL1orL2::HICFTSfromL1orL2 ( const MagneticField mf)
inline

Definition at line 45 of file HICFTSfromL1orL2.h.

References field.

45 {field = mf;}
const MagneticField * field
virtual cms::HICFTSfromL1orL2::~HICFTSfromL1orL2 ( )
inlinevirtual

Definition at line 46 of file HICFTSfromL1orL2.h.

46 {}

Member Function Documentation

vector< FreeTrajectoryState > cms::HICFTSfromL1orL2::createFTSfromL1 ( std::vector< L1MuGMTExtendedCand > &  gmt)

Definition at line 12 of file HICFTSfromL1orL2.cc.

References gather_cfg::cout.

13 {
14 // ========================================================================================
15 //
16 // Switch on L1 muon trigger.
17 //
18 
19  vector<FreeTrajectoryState> ftsL1;
20 
21  int ngmt = gmt.size();
22 #ifdef DEBUG
23  cout << "Number of muons found by the L1 Global Muon TRIGGER : "
24  << ngmt << endl;
25 #endif
26  if(ngmt<0) {
27  return ftsL1;
28  }
29 
30  for ( vector<L1MuGMTExtendedCand>::const_iterator gmt_it = gmt.begin(); gmt_it != gmt.end(); gmt_it++ )
31  {
32  ftsL1.push_back(FTSfromL1((*gmt_it)));
33  }
34  return ftsL1;
35 } // end createFTSfromL1
FreeTrajectoryState FTSfromL1(const L1MuGMTExtendedCand &gmt)
tuple cout
Definition: gather_cfg.py:121
vector< FreeTrajectoryState > cms::HICFTSfromL1orL2::createFTSfromL1orL2 ( std::vector< L1MuGMTExtendedCand > &  gmt,
const reco::RecoChargedCandidateCollection recmuons 
)

Definition at line 117 of file HICFTSfromL1orL2.cc.

References abs, gather_cfg::cout, spr::find(), pi, and mathSSE::sqrt().

118 {
119  double pi=4.*atan(1.);
120  double twopi=8.*atan(1.);
121 
122  vector<FreeTrajectoryState> ftsL1orL2;
123  vector<FreeTrajectoryState> ftsL1 = createFTSfromL1(gmt);
124  vector<FreeTrajectoryState> ftsL2 = createFTSfromL2(recmuons);
125 //
126 // Clean candidates if L1 and L2 pointed to one muon.
127 //
128  vector<FreeTrajectoryState*>::iterator itused;
129  vector<FreeTrajectoryState*> used;
130 
131  for(vector<FreeTrajectoryState>::iterator tl1 = ftsL1.begin(); tl1 != ftsL1.end(); tl1++)
132  {
133  // float ptL1 = (*tl1).parameters().momentum().perp();
134  float etaL1 = (*tl1).parameters().momentum().eta();
135  float phiL1 = (*tl1).parameters().momentum().phi();
136  if( phiL1 < 0.) phiL1 = twopi + phiL1;
137  // int chargeL1 = (*tl1).charge();
138  int L2 = 0; // there is no L2 muon.
139 
140  for(vector<FreeTrajectoryState>::iterator tl2 = ftsL2.begin(); tl2 != ftsL2.end(); tl2++)
141  {
142  itused = find(used.begin(),used.end(),&(*tl2));
143  // float ptL2 = (*tl2).parameters().momentum().perp();
144  float etaL2 = (*tl2).parameters().momentum().eta();
145  float phiL2 = (*tl2).parameters().momentum().phi();
146  if( phiL2 < 0.) phiL2 = twopi + phiL2;
147  // int chargeL2 = (*tl2).charge();
148  float dphi = abs(phiL1-phiL2);
149  if( dphi > pi ) dphi = twopi - dphi;
150  float dr = sqrt((etaL1 - etaL2)*(etaL1 - etaL2)+dphi*dphi);
151 
152 #ifdef OK_DEBUG
153  cout<<" ===== Trigger Level 1 candidate: ptL1 "<<ptL1<<" EtaL1 "<<etaL1<<" PhiL1 "<<phiL1<<
154  " chargeL1 "<<chargeL1<<endl;
155  cout<<" ===== Trigger Level 2 candidate: ptL2 "<<ptL2<<" EtaL2 "<<etaL2<<" PhiL2 "<<phiL2<<
156  " chargeL2 "<<chargeL2<<endl;
157  cout<<" abs(EtaL1 - EtaL2) "<<abs(etaL1 - etaL2)<<" dphi "<<dphi<<" dr "<<dr<<
158  " dQ "<<chargeL1 - chargeL2
159  <<" the same muon or not L2 "<<L2<<endl;
160 #endif
161 
162  if ( itused != used.end() ) {
163 // cout<<" L2 is already used in primary cycle"<<endl;
164  continue;
165  }
166 
167 
168 
169  float drmax = 0.5;
170  if( abs(etaL1) > 1.9 ) drmax = 0.6;
171 
172 #ifdef OK_DEBUG
173  cout<<" Drmax= "<<drmax<<endl;
174 #endif
175  L2 = 0;
176  if( dr < drmax )
177  { // it is the same muon. Take L2 trigger.
178 // if ( chargeL1 == chargeL2 )
179 // { // The same muon. Take L2 candidate.
180  L2 = 1;
181  ftsL1orL2.push_back((*tl2));
182  used.push_back(&(*tl2));
183 // cout<<" add L2 for same muon"<<endl;
184  break;
185 // } // endif
186 // else
187 // { // Probably different muons in the same cell. Try to recover on L3.
188 // ftsL1orL2.push_back((*tl1));
189 // ftsL1orL2.push_back((*tl2));
190 // cout<<" add L2 for diff muon"<<endl;
191 // used.push_back(&(*tl2));
192 // } // endelse
193  } // endif
194  } // end for L2
195  if( L2 == 0 )
196  {
197 // cout<<" add L1 for no L2 muon"<<endl;
198  ftsL1orL2.push_back((*tl1)); // No L1 candidate. Take L1 candidate.
199  }
200  } // end for L1
201 
202  // cout<<" Add the last L2 candidates that have not corresponding L1 "<<endl;
203 
204  if( ftsL2.size() > 0 )
205  { // just add the ramains L2 candidates
206  for(vector<FreeTrajectoryState>::iterator tl2 = ftsL2.begin(); tl2 != ftsL2.end(); tl2++)
207  {
208  itused = find(used.begin(),used.end(),&(*tl2));
209  if ( itused != used.end() )
210  {
211 // cout<<" L2 is already used in secondary cycle"<<endl;
212  continue;
213  }
214  ftsL1orL2.push_back((*tl2));
215  } // end for L2
216  }
217  // cout<<" The number of trajectories in muon stations "<<ftsL1orL2.size()<<endl;
218  return ftsL1orL2;
219 }
std::vector< FreeTrajectoryState > createFTSfromL2(const reco::RecoChargedCandidateCollection &rc)
#define abs(x)
Definition: mlp_lapack.h:159
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
T sqrt(T t)
Definition: SSEVec.h:46
std::vector< FreeTrajectoryState > createFTSfromL1(std::vector< L1MuGMTExtendedCand > &)
tuple cout
Definition: gather_cfg.py:121
double pi
vector< FreeTrajectoryState > cms::HICFTSfromL1orL2::createFTSfromL2 ( const reco::RecoChargedCandidateCollection rc)

Definition at line 39 of file HICFTSfromL1orL2.cc.

References gather_cfg::cout.

Referenced by cms::HITrackVertexMaker::produceTracks().

40 {
41 // ========================================================================================
42 //
43 // Switch on L2 muon trigger.
44 //
45 
46  vector<FreeTrajectoryState> ftsL2;
47 // RecQuery q(localRecAlgo);
48 
49  RecoChargedCandidateCollection::const_iterator recmuon = recmuons.begin();
50 
51 // int nrec = recmuons.size();
52 #ifdef DEBUG
53  cout << "Number of muons found by the L2 TRIGGER : "
54  << nrec << endl;
55 #endif
56  for(recmuon=recmuons.begin(); recmuon!=recmuons.end(); recmuon++)
57  {
58  ftsL2.push_back(FTSfromL2((*recmuon)));
59  } // endfor
60  return ftsL2;
61 } // end createFTSfromL2
FreeTrajectoryState FTSfromL2(const reco::RecoChargedCandidate &gmt)
tuple cout
Definition: gather_cfg.py:121
vector< FreeTrajectoryState > cms::HICFTSfromL1orL2::createFTSfromL2 ( const reco::TrackCollection rc)

Definition at line 88 of file HICFTSfromL1orL2.cc.

References gather_cfg::cout.

89 {
90 // ========================================================================================
91 //
92 // Switch on L2 muon trigger.
93 //
94 
95  vector<FreeTrajectoryState> ftsL2;
96 // RecQuery q(localRecAlgo);
97 
98  TrackCollection::const_iterator recmuon = recmuons.begin();
99 
100 // int nrec = recmuons.size();
101 #ifdef DEBUG
102  cout << "Number of muons found by the StandAlone : "
103  << nrec << endl;
104 #endif
105  for(recmuon=recmuons.begin(); recmuon!=recmuons.end(); recmuon++)
106  {
107  ftsL2.push_back(FTSfromStandAlone((*recmuon)));
108  } // endfor
109  return ftsL2;
110 } // end createFTSfromStandAlone
FreeTrajectoryState FTSfromStandAlone(const reco::Track &gmt)
tuple cout
Definition: gather_cfg.py:121
vector< FreeTrajectoryState > cms::HICFTSfromL1orL2::createFTSfromStandAlone ( const reco::TrackCollection rc)

Definition at line 64 of file HICFTSfromL1orL2.cc.

References gather_cfg::cout.

65 {
66 // ========================================================================================
67 //
68 // Switch on L2 muon trigger.
69 //
70 
71  vector<FreeTrajectoryState> ftsL2;
72 // RecQuery q(localRecAlgo);
73 
74  TrackCollection::const_iterator recmuon = recmuons.begin();
75 
76  // int nrec = recmuons.size();
77 #ifdef DEBUG
78  cout << "Number of muons found by the StandAlone : "
79  << nrec << endl;
80 #endif
81  for(recmuon=recmuons.begin(); recmuon!=recmuons.end(); recmuon++)
82  {
83  ftsL2.push_back(FTSfromStandAlone((*recmuon)));
84  } // endfor
85  return ftsL2;
86 } // end createFTSfromStandAlone
FreeTrajectoryState FTSfromStandAlone(const reco::Track &gmt)
tuple cout
Definition: gather_cfg.py:121
FreeTrajectoryState cms::HICFTSfromL1orL2::FTSfromL1 ( const L1MuGMTExtendedCand gmt)
private

Definition at line 223 of file HICFTSfromL1orL2.cc.

References abs, Reference_intrackfit_cff::barrel, DeDxDiscriminatorTools::charge(), L1MuGMTCand::charge(), funct::cos(), eta(), L1MuGMTCand::etaValue(), create_public_lumi_plots::exp, L1MuGMTExtendedCand::isFwd(), m, phi, L1MuGMTCand::phiValue(), pi, L1MuGMTCand::ptValue(), CosmicsPD_Skims::radius, funct::sin(), funct::tan(), theta(), x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

223  {
224  double pi=4.*atan(1.);
225  unsigned int det = gmt.isFwd();
226  double px,py,pz,x,y,z;
227  float pt = gmt.ptValue();
228  float eta = gmt.etaValue();
229  float theta = 2*atan(exp(-eta));
230  float phi = gmt.phiValue();
231  int charge = gmt.charge();
232 
233  bool barrel = true;
234  if(det) barrel = false;
235 //
236 // Take constant radius for barrel = 513 cm and constant z for endcap = 800 cm.
237 // hardcodded.
238 //
239  float radius = 513.;
240  if ( !barrel ) {
241  radius = 800.;
242  if(eta<0.) radius=-1.*radius;
243  }
244 
245  if ( barrel && pt < 3.5 ) pt = 3.5;
246  if ( !barrel && pt < 1.0 ) pt = 1.0;
247 
248 
249 // Calculate FTS for barrel and endcap
250 
251  if(barrel){
252 
253 // barrel
254 
255  if(abs(theta-pi/2.)<0.00001){
256  pz=0.;
257  z=0.;
258  }else{
259  pz=pt/tan(theta);
260  z=radius/tan(theta);
261  }
262  x=radius*cos(phi);
263  y=radius*sin(phi);
264 
265  } else {
266 
267 // endcap
268 
269  pz=pt/tan(theta);
270  z=radius;
271  x=z*tan(theta)*cos(phi);
272  y=z*tan(theta)*sin(phi);
273  }
274 
275  px=pt*cos(phi);
276  py=pt*sin(phi);
277 
278 // cout<<" CreateFts:x,y,x,px,py,pz "<<x<< " "<<y<<" "<<z<<" "<<px<<" "<<py<<" "<<pz<<endl;
279 
280  GlobalPoint aX(x,y,z);
281  GlobalVector aP(px,py,pz);
282  GlobalTrajectoryParameters gtp(aX,aP,charge,field);
283 
285  m(0,0)=0.6*pt; m(1,1)=1.; m(2,2)=1.;
286  m(3,3)=1.;m(4,4)=0.;
288 
289  FreeTrajectoryState fts(gtp,cte);
290  return fts;
291  }
float etaValue() const
Definition: L1MuGMTCand.cc:116
float phiValue() const
Definition: L1MuGMTCand.cc:102
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
#define abs(x)
Definition: mlp_lapack.h:159
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
T eta() const
double charge(const std::vector< uint8_t > &Ampls)
double double double z
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
float ptValue() const
Definition: L1MuGMTCand.cc:130
const MagneticField * field
double pi
Definition: DDAxes.h:10
bool isFwd() const
get forward bit (true=forward, false=barrel)
Definition: DDAxes.h:10
int charge() const
get charge (+1 -1)
Definition: L1MuGMTCand.h:137
FreeTrajectoryState cms::HICFTSfromL1orL2::FTSfromL2 ( const reco::RecoChargedCandidate gmt)
private

Definition at line 296 of file HICFTSfromL1orL2.cc.

References abs, corr, reco::LeafCandidate::get(), m, pos, createTree::pp, mathSSE::sqrt(), funct::tan(), and theta().

297  {
298 
299  TrackRef tk1 = gmt.get<TrackRef>();
300 
301  const math::XYZPoint pos0 = tk1->innerPosition();
302  const math::XYZVector mom0 = tk1->innerMomentum();
303 
304  double pp = sqrt(mom0.x()*mom0.x()+mom0.y()*mom0.y()+mom0.z()*mom0.z());
305  double pt = sqrt(mom0.x()*mom0.x()+mom0.y()*mom0.y());
306  double theta = mom0.theta();
307  double pz = mom0.z();
308 
309  GlobalVector mom(mom0.x(),mom0.y(),mom0.z());
310 
311  if( pt < 4.)
312  {
313  pt = 4.; if (abs(pz) > 0. ) pz = pt/tan(theta);
314  double corr = sqrt( pt*pt + pz*pz )/pp;
315  GlobalVector mom1( corr*mom0.x(), corr*mom0.y(), corr*mom0.z() );
316  mom = mom1;
317  }
318 
319  // cout<<" L2::Innermost state "<<pos0<<" new momentum "<<mom<<" old momentum "<<mom0<<endl;
320 
322  /*
323  double error;
324  if( abs(mom.eta()) < 1. )
325  {
326  error = 0.6*mom.perp();
327  }
328  else
329  {
330  error = 0.6*abs(mom.z());
331  }
332  */
333  m(0,0)=0.6*mom.perp(); m(1,1)=1.; m(2,2)=1.;
334  m(3,3)=1.;m(4,4)=0.;
336  GlobalPoint pos(pos0.x(),pos0.y(),pos0.z());
337 
338  GlobalTrajectoryParameters gtp(pos,mom,tk1->charge(), field);
339  FreeTrajectoryState fts(gtp,cte);
340 
341  return fts;
342  }
tuple pp
Definition: createTree.py:15
Geom::Theta< T > theta() const
#define abs(x)
Definition: mlp_lapack.h:159
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
T sqrt(T t)
Definition: SSEVec.h:46
T get() const
get a component
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
JetCorrectorParameters corr
Definition: classes.h:9
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
const MagneticField * field
FreeTrajectoryState cms::HICFTSfromL1orL2::FTSfromStandAlone ( const reco::Track gmt)
private

Definition at line 346 of file HICFTSfromL1orL2.cc.

References abs, reco::TrackBase::charge(), corr, reco::Track::innerMomentum(), reco::Track::innerPosition(), m, pos, createTree::pp, mathSSE::sqrt(), funct::tan(), and theta().

347  {
348 
349 // TrackRef tk1 = gmt.get<TrackRef>();
350 
351  const math::XYZPoint pos0 = tk1.innerPosition();
352  const math::XYZVector mom0 = tk1.innerMomentum();
353 
354  double pp = sqrt(mom0.x()*mom0.x()+mom0.y()*mom0.y()+mom0.z()*mom0.z());
355  double pt = sqrt(mom0.x()*mom0.x()+mom0.y()*mom0.y());
356  double theta = mom0.theta();
357  double pz = mom0.z();
358 
359  GlobalVector mom(mom0.x(),mom0.y(),mom0.z());
360 
361  if( pt < 4.)
362  {
363  pt = 4.; if (abs(pz) > 0. ) pz = pt/tan(theta);
364  double corr = sqrt( pt*pt + pz*pz )/pp;
365  GlobalVector mom1( corr*mom0.x(), corr*mom0.y(), corr*mom0.z() );
366  mom = mom1;
367  }
368 
369  //cout<<" StandAlone::Innermost state "<<pos0<<" new momentum "<<mom<<" old momentum "<<mom0<<endl;
370 
372  /*
373  double error;
374  if( abs(mom.eta()) < 1. )
375  {
376  error = 0.6*mom.perp();
377  }
378  else
379  {
380  error = 0.6*abs(mom.z());
381  }
382  */
383  m(0,0)=0.6*mom.perp(); m(1,1)=1.; m(2,2)=1.;
384  m(3,3)=1.;m(4,4)=0.;
386  GlobalPoint pos(pos0.x(),pos0.y(),pos0.z());
387 
388  GlobalTrajectoryParameters gtp(pos,mom,tk1.charge(), field);
389  FreeTrajectoryState fts(gtp,cte);
390 
391  return fts;
392  }
tuple pp
Definition: createTree.py:15
Geom::Theta< T > theta() const
#define abs(x)
Definition: mlp_lapack.h:159
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
T sqrt(T t)
Definition: SSEVec.h:46
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
JetCorrectorParameters corr
Definition: classes.h:9
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
const MagneticField * field

Member Data Documentation

const MagneticField* cms::HICFTSfromL1orL2::field
private

Definition at line 58 of file HICFTSfromL1orL2.h.

Referenced by HICFTSfromL1orL2().