BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcCalibData.cxx
Go to the documentation of this file.
1#include "CalibData/Mdc/MdcCalibData.h"
2//typedef std::map<int, double>::value_type valType;
3#include "GaudiKernel/MsgStream.h"
4namespace CalibData {
6 newXtTreesBuf = NULL;
7 r2tTreesBuf = NULL;
8 newXtTreesArray = NULL;
9 r2tTreesArray = NULL;
10 for(int layid=0; layid<43; layid++){
11 m_r2t[layid] = NULL;
12 for(int entr=0; entr<18; entr++){
13 for(int lr=0; lr<2; lr++){
14 m_newxt[layid][entr][lr] = NULL;
15 }//end lr
16 }//end entr
17 }//end for layid
18 }
19
21 for(int layid=0; layid<43; layid++){
22 delete m_r2t[layid];
23 for(int entr=0; entr<18; entr++){
24 for(int lr=0; lr<2; lr++){
25 if(m_newxt[layid][entr][lr]!=NULL) delete m_newxt[layid][entr][lr];
26 }
27 }
28 }
29 if(newXtTreesBuf!=NULL) newXtTreesBuf->Clear();
30 if(r2tTreesBuf!=NULL) r2tTreesBuf->Clear();
31 if(newXtTreesArray!=NULL) delete newXtTreesArray;
32 if(r2tTreesArray!=NULL) delete r2tTreesArray;
33 }
34
35 StatusCode MdcCalibData::update(CalibBase1& other, MsgStream* log)
36 {
37 MdcCalibData& other1 = dynamic_cast<MdcCalibData& >(other);
38 std::cout<<"\n"<<"here is the update in the MdcCalConst"<<std::endl;
39 CalibBase1::update(other, log);
40 clear();
41 m_xtmap = other1.m_xtmap;
42 m_t0 = other1.m_t0;
43 m_delt0 = other1.m_delt0;
44 m_qtpar0 = other1.m_qtpar0;
45 m_qtpar1 = other1.m_qtpar1;
46 m_sdmap = other1.m_sdmap;
47 return StatusCode::SUCCESS;
48}
49
50void MdcCalibData::setXtpar(int xtkey,double val){
51 m_xtmap.insert( valType( int(xtkey), val) );
52}
53
54void MdcCalibData::setNewXtpar(TObjArray* newXtTrees){
55 //put TObjArray to temp buffer
56 TBufferFile* tempBuf = new TBufferFile(TBuffer::kWrite);
57 newXtTrees->Streamer(*tempBuf);
58
59 //put content of buffer to array
60 newXtTreesBuf = new TBufferFile(TBuffer::kRead);
61 newXtTreesBuf->SetBuffer(tempBuf->Buffer(), tempBuf->BufferSize());
62
63 newXtTreesArray = new TObjArray();
64 newXtTreesArray->Streamer(*newXtTreesBuf);
65 for(int layid=0; layid<43; layid++){
66 for(int entr=0; entr<18; entr++){
67 for(int lr=0; lr<2; lr++){
68 char newXtTreeName[20];
69 sprintf(newXtTreeName,"trNewXt%02d_%02d_%d",layid,entr,lr);
70 m_newxt[layid][entr][lr] = (TTree*)newXtTreesArray->FindObject(newXtTreeName);;
71 }
72 }
73 }
74 delete tempBuf;
75}
76
77void MdcCalibData::setR2tpar(TObjArray* r2tTrees){
78 //put TObjArray to temp buffer
79 TBufferFile* tempBuf = new TBufferFile(TBuffer::kWrite);
80 r2tTrees->Streamer(*tempBuf);
81
82 //put content of buffer to array
83 r2tTreesBuf = new TBufferFile(TBuffer::kRead);
84 r2tTreesBuf->SetBuffer(tempBuf->Buffer(), tempBuf->BufferSize());
85
86 r2tTreesArray = new TObjArray();
87 r2tTreesArray->Streamer(*r2tTreesBuf);
88 for(int layid=0; layid<43; layid++){
89 char r2tTreeName[20];
90 sprintf(r2tTreeName,"r2t%02d",layid);
91 m_r2t[layid] = (TTree*)r2tTreesArray->FindObject(r2tTreeName);;
92 }
93 delete tempBuf;
94}
95
96void MdcCalibData::setT0(double val){
97 m_t0.push_back( val );
98}
99void MdcCalibData::setDelT0( double val){
100 m_delt0.push_back( val );
101}
102
103void MdcCalibData::setQtpar0(double val){
104 m_qtpar0.push_back( val );
105}
106
107void MdcCalibData::setQtpar1(double val){
108 m_qtpar1.push_back( val );
109}
110
111void MdcCalibData::setSdpar(int sdkey, double val){
112 m_sdmap.insert( valType( int(sdkey), val) );
113}
114
115// wulh updated on 08-3-24
116double MdcCalibData::getXtpar(int layid, int entr, int lr, int order){
117 double xtpar = -999.0;
118 int key = getXtKey(layid, entr, lr, order);
119 if( 1 == m_xtmap.count(key) )
120 xtpar = m_xtmap[key];
121
122 return xtpar;
123}
124
125// yzhang add 2011-12-12
126TTree* MdcCalibData::getNewXtpar(int layid, int entr, int lr){
127 return m_newxt[layid][entr][lr];
128}
129
130// yzhang add 2011-12-15
131TTree* MdcCalibData::getR2tpar(int layid){
132 return m_r2t[layid];
133}
134
135// wulh updated on 08-3-24
136double MdcCalibData::getSdpar(int layid, int entr, int lr, int bin){
137 double sdpar = -999.0;
138 int key = getSdKey(layid, entr, lr, bin);
139 if( 1 == m_sdmap.count(key) ){
140 return m_sdmap[key];
141 }
142
143 return sdpar;
144}
145
146// wulh updated on 08-3-24
147int MdcCalibData::getXtKey(int layid, int entr, int lr, int order){
148 int key;
149
150 key = ( (layid << XTLAYER_INDEX) & XTLAYER_MASK ) |
151 ( (entr << XTENTRA_INDEX) & XTENTRA_MASK ) |
152 ( (lr << XTLR_INDEX) & XTLR_MASK ) |
153 ( (order << XTORDER_INDEX) & XTORDER_MASK );
154
155 return key;
156}
157
158// wulh updated on 08-3-24
159int MdcCalibData::getSdKey(int layid, int entr, int lr, int bin){
160 int key;
161
162 key = ( (layid << SDLAYER_INDEX) & SDLAYER_MASK ) |
163 ( (entr << SDENTRA_INDEX) & SDENTRA_MASK ) |
164 ( (lr << SDLR_INDEX) & SDLR_MASK ) |
165 ( (bin << SDBIN_INDEX) & SDBIN_MASK );
166
167 return key;
168}
169
171 m_xtiter = m_xtmap.begin();
172}
173
174int MdcCalibData::getNextXtpar(int& key, double& xtpar){
175 if( m_xtiter != m_xtmap.end() ){
176 key = (*m_xtiter).first;
177 xtpar = (*m_xtiter).second;
178 m_xtiter++;
179 return 1;
180 }
181 else return 0;
182}
183
185 m_sditer = m_sdmap.begin();
186}
187
188int MdcCalibData::getNextSdpar(int& key, double& sdpar){
189 if( m_sditer != m_sdmap.end() ){
190 key = (*m_sditer).first;
191 sdpar = (*m_sditer).second;
192 m_sditer++;
193 return 1;
194 }
195 else return 0;
196}
198 m_xtmap.clear();
199 m_t0.clear();
200 m_delt0.clear();
201 m_qtpar0.clear();
202 m_qtpar1.clear();
203 m_sdmap.clear();
204}
205
206}
std::map< int, double >::value_type valType
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per bin
Definition: FoamA.h:85
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Definition: Taupair.h:42
virtual StatusCode update(CalibBase1 &obj, MsgStream *)
Definition: CalibBase1.cxx:33
void setR2tpar(TObjArray *r2tTrees)
void setQtpar1(double val)
void setXtpar(int xtkey, double val)
void setNewXtpar(TObjArray *newXtTrees)
int getNextXtpar(int &key, double &xtpar)
virtual StatusCode update(CalibBase1 &other, MsgStream *log)
void setT0(double val)
double getXtpar(int layid, int entr, int lr, int order)
TTree * getR2tpar(int layid)
void setSdpar(int sdkey, double val)
void setDelT0(double val)
double getSdpar(int layid, int entr, int lr, int bin)
int getXtKey(int layid, int entr, int lr, int order)
int getNextSdpar(int &key, double &sdpar)
int getSdKey(int layid, int entr, int lr, int bin)
TTree * getNewXtpar(int layid, int entr, int lr)
void setQtpar0(double val)