BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcRecTofDigitCalib.cxx
Go to the documentation of this file.
1//
2// Tof digit to hit
3//
4// He Miao 2006, 9,26
5//
6#include "EmcRec/EmcRecTofDigitCalib.h"
7#include "Identifier/TofID.h"
8#include "RawEvent/RawDataUtil.h"
9
11
13
15 TofDigiCol::iterator iter2;
16 for ( iter2 = tofDigiCol->begin(); iter2 != tofDigiCol->end(); iter2++, iter2++ )
17 {
18
19 Identifier id = ( *iter2 )->identify();
20 bool is_barrel = TofID::is_barrel( id );
21 int layer = TofID::layer( id );
22 int im = TofID::phi_module( id );
23
24 if ( !is_barrel ) return;
25
26 double adc0 = RawDataUtil::TofCharge( ( *iter2 )->getChargeChannel() ) * 2;
27 double tdc0 = RawDataUtil::TofTime( ( *iter2 )->getTimeChannel() );
28 double adc1 = RawDataUtil::TofCharge( ( *( iter2 + 1 ) )->getChargeChannel() ) * 2;
29 double tdc1 = RawDataUtil::TofTime( ( *( iter2 + 1 ) )->getTimeChannel() );
30
31 double rand0 = (double)( rand() % 100 ) / 1000. - 0.05; //-0.05 --> 0.05
32 double rand1 = (double)( rand() % 100 ) / 1000. - 0.05; //-0.05 --> 0.05
33
34 // smear 5%
35 adc0 *= ( 1 + rand0 );
36 adc1 *= ( 1 + rand1 );
37
38 double zpos, energy, e0, e1;
39 zpos = 0.08331 * ( tdc1 - tdc0 );
40 if ( fabs( zpos ) > 1.15 ) continue;
41
42 // ADC->energy
43 if ( ( adc0 > 46. && adc0 < 920. ) && ( adc1 <= 46. || adc1 >= 920. ) )
44 { energy = adc0 / exp( 2.783 + 0.3133 * zpos ); }
45 else if ( ( adc1 > 46. && adc1 < 920. ) && ( adc0 <= 46. || adc0 >= 920. ) )
46 { energy = adc1 / exp( 2.784 - 0.3079 * zpos ); }
47 else if ( ( adc0 > 46. && adc0 < 920. ) && ( adc1 > 46. && adc1 < 920. ) )
48 {
49 e0 = adc0 / exp( 2.783 + 0.3133 * zpos );
50 e1 = adc1 / exp( 2.784 - 0.3079 * zpos );
51 energy = ( e0 + e1 ) / 2;
52 }
53 else if ( adc0 >= 920. && adc1 >= 920. )
54 {
55 e0 = 920. / exp( 2.783 + 0.3133 * zpos );
56 e1 = 920. / exp( 2.784 - 0.3079 * zpos );
57 energy = e0 > e1 ? e0 : e1;
58 }
59 else { continue; }
60
61 double phi, r;
62 if ( layer == 0 )
63 {
64 phi = ( im + 0.5 ) * CLHEP::twopi / 88.;
65 r = 838.5;
66 }
67 else
68 {
69 phi = im * CLHEP::twopi / 88.;
70 r = 895.5;
71 }
72
73 zpos *= 1000; // zpos: m->mm
74 HepPoint3D pos( r * cos( phi ), r * sin( phi ), zpos );
75
76 tofHitMap[im + layer * 88] = RecEmcTofHit( id, energy, pos );
77 }
78}
HepGeom::Point3D< double > HepPoint3D
Double_t e1
map< int, RecEmcTofHit, less< int > > RecEmcTofHitMap
EvtComplex exp(const EvtComplex &c)
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition KK2f.h:50
void Convert(TofDigiCol *tofDigiCol, RecEmcTofHitMap &tofHitMap)
static double TofTime(unsigned int timeChannel)
static double TofCharge(unsigned int chargeChannel)
static bool is_barrel(const Identifier &id)
Test for barrel.
Definition TofID.cxx:40
static int phi_module(const Identifier &id)
Definition TofID.cxx:65
static int layer(const Identifier &id)
Definition TofID.cxx:59