StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StChargedPionJet.cxx
1 // $Id: StChargedPionJet.cxx,v 1.6 2012/11/09 03:31:34 perev Exp $
2 
3 #include "StChargedPionJet.h"
4 
5 #include "TMath.h"
6 #include "StChargedPionEvent.h"
7 #include "StChargedPionJetParticle.h"
8 
9 ClassImp(StChargedPionJet)
10 
11 StChargedPionJet::StChargedPionJet() : TLorentzVector() { }
12 
13 StChargedPionJet::StChargedPionJet(const StChargedPionJet& t) : TLorentzVector(t), mParticles(t.mParticles) {
14  mCharge = t.mCharge;
15  mTpcCount = t.mTpcCount;
16  mBtowCount = t.mBtowCount;
17  mEtowCount = t.mEtowCount;
18  mTpcEtSum = t.mTpcEtSum;
19  mBtowEtSum = t.mBtowEtSum;
20  mEtowEtSum = t.mEtowEtSum;
21  mVertexZ = t.mVertexZ;
22 }
23 
24 StChargedPionJet::~StChargedPionJet() {
25  this->Clear();
26 }
27 
28 void StChargedPionJet::Clear(Option_t * o) {
29  mParticles.clear();
30  mGeomTriggers = 0;
31 }
32 
33 float StChargedPionJet::detectorEta() const {
34  return this->detectorEta(mVertexZ);
35 }
36 
37 float StChargedPionJet::detectorEta(float vz, float r) const {
38  float hold(0.),denom(0.);
39  if (Theta()==TMath::PiOver2()) { // if Jet Theta = 90 then tan is undefined
40  if (vz==0) {hold = TMath::PiOver2();}
41  else {hold = atan2(r,vz);}
42  }
43  else
44  {
45  denom = (r/tan(Theta()))+vz;
46  if (denom==0.) {hold = TMath::PiOver2();}
47  if (denom!=0.) {hold = atan2(r,denom);}
48  }
49  return -TMath::Log(TMath::Tan(hold/2));
50 }
51 
52 bool StChargedPionJet::isTrigger(unsigned int trigId) const {
53  return mGeomTriggers & StChargedPionEvent::triggerBit(trigId);
54 }
55 
56 void StChargedPionJet::addTrigger(unsigned int trigId) {
57  mGeomTriggers |= StChargedPionEvent::triggerBit(trigId);
58 }
59 
60 void StChargedPionJet::addParticle(StChargedPionJetParticle* p) {
61  mParticles.push_back(*p);
62 }
63 
64 const StChargedPionJetParticle& StChargedPionJet::leadingParticle() const {
65  const StChargedPionJetParticle *p = NULL;
66  for(unsigned i=0; i< particles().size(); i++) {
67  if(!p) p = &(particles()[i]);
68  else {
69  if(p->z(*this) < particles()[i].z(*this) )
70  p = &(particles()[i]);
71  }
72  }
73  return *p;
74 }
75 
76 /*****************************************************************************
77  * $Log: StChargedPionJet.cxx,v $
78  * Revision 1.6 2012/11/09 03:31:34 perev
79  * Cleanup
80  *
81  * Revision 1.5 2008/12/29 15:58:29 kocolosk
82  * removed commented code and added $Id: StChargedPionJet.cxx,v 1.6 2012/11/09 03:31:34 perev Exp $/$Log: StChargedPionJet.cxx,v $
83  * removed commented code and added $Id$/Revision 1.6 2012/11/09 03:31:34 perev
84  * removed commented code and added $Id$/Cleanup
85  * removed commented code and added $Id$/ as needed
86  *
87  *****************************************************************************/