BOSS 8.0.0
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
17
19 // nothing to do
20}
21
22// Copy and assignment
23// RecEmcFraction::RecEmcFraction(const RecEmcFraction& aFraction)
24//: ContainedObject(aFraction),RecEmcHit(aFraction)
25//{
26// //fCellId=aFraction.CellId();
27// //fEnergy=aFraction.Energy();
28// //fTime=aFraction.Time();
29// //
30// fFraction=aFraction.Fraction();
31//}
32//
33// RecEmcFraction& RecEmcFraction::operator=(const RecEmcFraction& aFraction)
34//{
35// if(this!=&aFraction)
36// {
37// fCellId=aFraction.CellId();
38// fEnergy=aFraction.Energy();
39// fTime=aFraction.Time();
40// //
41// fFraction=aFraction.Fraction();
42// }
43// return *this;
44//}
45
46// Other methods(read or write)
48
53
54// Distance to another hit
55double RecEmcFraction::Distance( const RecEmcID id ) const {
56 unsigned int tht, phi;
57 unsigned int tht2, phi2;
58 unsigned int dtht, dphi;
59 double dist;
60
63 tht2 = EmcID::theta_module( id );
64 phi2 = EmcID::phi_module( id );
65
66 dtht = tht > tht2 ? tht - tht2 : tht2 - tht;
67 dphi = phi > phi2 ? phi - phi2 : phi2 - phi;
68 if ( dphi > ( EmcID::getPHI_BARREL_MAX() + 1 ) / 2 )
69 { dphi = EmcID::getPHI_BARREL_MAX() + 1 - dphi; }
70 dist = sqrt( double( dtht * dtht + dphi * dphi ) );
71
72 return dist;
73}
74
75// others
77 cout << "Fraction: ";
78
79 cout << fCellId << ", ";
80
81 cout.width( 12 );
82 cout.setf( ios::right );
83 cout << fEnergy << ", ";
84
85 cout.width( 12 );
86 cout.setf( ios::right );
87 cout << fTime << ", ";
88
89 cout.width( 12 );
90 cout.setf( ios::right );
91 cout << fFraction;
92
93 cout << endl;
94}
95
96ostream& operator<<( ostream& os, const RecEmcFraction& aFraction ) {
97 os << "Fraction: ";
98
99 os << aFraction.getCellId() << ", ";
100
101 os.width( 12 );
102 os.setf( ios::right );
103 os << aFraction.getEnergy() << ", ";
104
105 os.width( 12 );
106 os.setf( ios::right );
107 os << aFraction.getTime() << ", ";
108
109 os.width( 12 );
110 os.setf( ios::right );
111 os << aFraction.getFraction() << ", ";
112
113 os.width( 12 );
114 os.setf( ios::right );
115 os << aFraction.getEnergy() * aFraction.getFraction();
116
117 os << endl;
118
119 return os;
120}
Double_t phi2
ostream & operator<<(ostream &os, const RecEmcFraction &aFraction)
static unsigned int getPHI_BARREL_MAX()
Definition EmcID.cxx:83
static unsigned int theta_module(const Identifier &id)
Definition EmcID.cxx:41
static unsigned int phi_module(const Identifier &id)
Definition EmcID.cxx:46
void Dump() const
RecEmcFrac Fraction(const RecEmcFrac &Fraction)
double Distance(const RecEmcID id) const
RecEmcFrac getFraction() const