BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
RecEmcFraction.cxx
Go to the documentation of this file.
1//
2// Bes EMC Rec Shower Fraction
3// (a fraction of a hit)
4//
5// Created by Wang.Zhe 2003, 10, 1
6//
7
8#include <iostream>
9
10#include "EmcRecEventModel/RecEmcFraction.h"
11#include "Identifier/EmcID.h"
12
13//Constructors and destructors
15{
16 fFraction=-1;
17}
18
20{
21 fFraction=-1;
22}
23
25{
26 //nothing to do
27}
28
29//Copy and assignment
30//RecEmcFraction::RecEmcFraction(const RecEmcFraction& aFraction)
31//:ContainedObject(aFraction),RecEmcHit(aFraction)
32//{
33// //fCellId=aFraction.CellId();
34// //fEnergy=aFraction.Energy();
35// //fTime=aFraction.Time();
36// //
37// fFraction=aFraction.Fraction();
38//}
39//
40//RecEmcFraction& RecEmcFraction::operator=(const RecEmcFraction& aFraction)
41//{
42// if(this!=&aFraction)
43// {
44// fCellId=aFraction.CellId();
45// fEnergy=aFraction.Energy();
46// fTime=aFraction.Time();
47// //
48// fFraction=aFraction.Fraction();
49// }
50// return *this;
51//}
52
53//Other methods(read or write)
55{
56 return fFraction;
57}
58
60{
62 return fFraction;
63}
64
65//Distance to another hit
66double RecEmcFraction::Distance(const RecEmcID id) const
67{
68 unsigned int tht,phi;
69 unsigned int tht2,phi2;
70 unsigned int dtht,dphi;
71 double dist;
72
75 tht2=EmcID::theta_module(id);
77
78 dtht=tht>tht2 ? tht-tht2 : tht2-tht;
79 dphi=phi>phi2 ? phi-phi2 : phi2-phi;
80 if(dphi>(EmcID::getPHI_BARREL_MAX()+1)/2)
81 {
82 dphi=EmcID::getPHI_BARREL_MAX()+1-dphi;
83 }
84 dist=sqrt(double(dtht*dtht+dphi*dphi));
85
86 return dist;
87}
88
89//others
91{
92 cout<<"Fraction: ";
93
94 cout<<fCellId<<", ";
95
96 cout.width(12);
97 cout.setf(ios::right);
98 cout<<fEnergy<<", ";
99
100 cout.width(12);
101 cout.setf(ios::right);
102 cout<<fTime<<", ";
103
104 cout.width(12);
105 cout.setf(ios::right);
106 cout<<fFraction;
107
108 cout<<endl;
109}
110
111ostream& operator<<(ostream & os, const RecEmcFraction& aFraction)
112{
113 os<<"Fraction: ";
114
115 os<<aFraction.getCellId()<<", ";
116
117 os.width(12);
118 os.setf(ios::right);
119 os<<aFraction.getEnergy()<<", ";
120
121 os.width(12);
122 os.setf(ios::right);
123 os<<aFraction.getTime()<<", ";
124
125 os.width(12);
126 os.setf(ios::right);
127 os<<aFraction.getFraction()<<", ";
128
129 os.width(12);
130 os.setf(ios::right);
131 os<<aFraction.getEnergy()*aFraction.getFraction();
132
133 os<<endl;
134
135 return os;
136}
Double_t phi2
ostream & operator<<(ostream &os, const RecEmcFraction &aFraction)
static unsigned int getPHI_BARREL_MAX()
Definition: EmcID.cxx:107
static unsigned int theta_module(const Identifier &id)
Definition: EmcID.cxx:43
static unsigned int phi_module(const Identifier &id)
Definition: EmcID.cxx:48
void Dump() const
RecEmcFrac Fraction(const RecEmcFrac &Fraction)
double Distance(const RecEmcID id) const
RecEmcFrac getFraction() const