|
This creates the transient representation of an object from the corresponding ROOT object. This actually does the "new" operation and deals with the attributes of the node. This base class implementation does nothing; it should not normally be called because it doesn't correspond to any TCDS class. Instead, i_createObj of some derived class will be called. - Parameters:
-
| fname | The ROOT file to be read in to be used to builds the object |
| refpObject | the object to be built |
- Returns:
- status depending on the completion of the call
Reimplemented from TreeCalBaseCnv. 00059 {
00060
00061 MsgStream log(msgSvc(), "TreeTofCalibDataCnv");
00062 log<<MSG::DEBUG<<"SetProperty"<<endreq;
00063
00064 TreeAddress* add = dynamic_cast<TreeAddress*>(addr);
00065
00066 DatabaseRecord *records=add->pp();
00067
00068 TBuffer *buf1 = new TBuffer(TBuffer::kRead);
00069 TBuffer *buf2 = new TBuffer(TBuffer::kRead);
00070 TBuffer *buf3 = new TBuffer(TBuffer::kRead);
00071 TBuffer *buf4 = new TBuffer(TBuffer::kRead);
00072
00073 buf1->SetBuffer((*records)["BarTofPar"],512000,kFALSE);
00074 buf2->SetBuffer((*records)["EndTofPar"],512000,kFALSE);
00075 buf3->SetBuffer((*records)["TofConPar"],512000,kFALSE);
00076 buf4->SetBuffer((*records)["BarTof"],512000,kFALSE);
00077
00078 std::cout<<" CalVerSft is "<<(*records)["CalParVer"];
00079 std::cout<<" File name is "<<(*records)["FileName"]<<std::endl;
00080
00081 TTree *btoftree= new TTree();
00082 TTree *etoftree= new TTree();
00083 TTree *btofcommontree = new TTree();
00084 TTree *CalibInfo = new TTree();
00085
00086 btoftree->Streamer(*buf1);
00087 etoftree->Streamer(*buf2);
00088 btofcommontree->Streamer(*buf3);
00089 CalibInfo->Streamer(*buf4);
00090
00091 int nentri = btoftree -> GetEntries();
00092 int nentri1 = etoftree -> GetEntries();
00093 int nentri2 = btofcommontree->GetEntries();
00094 int nentri3 = CalibInfo->GetEntries();
00095
00096 CalibData::bTofCalibBase bTof;
00097 CalibData::eTofCalibBase eTof;
00098 CalibData::bTofCommonCalibBase bTofCommon;
00099 CalibData::tofCalibInfoBase tofinfo;
00100
00101 std::vector<CalibData::bTofCalibBase> tmpbTof;
00102 std::vector<CalibData::eTofCalibBase> tmpeTof;
00103 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
00104 std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
00105
00106
00107 int cnt;
00108
00109 double cnvBarAtten[nBarAtten];
00110 double cnvBarSpeed[nBarSpeed];
00111 double cnvBarPar1[nBarPar];
00112 double cnvBarPar2[nBarPar];
00113 double cnvBarParOff1[nBarParOff];
00114 double cnvBarParOff2[nBarParOff];
00115 double cnvFLeft[nBarSigma];
00116 double cnvFRight[nBarSigma];
00117 double cnvFCount[nBarSigCnt];
00118
00119 char brname[10];
00120 for( unsigned int i=0; i<nBarAtten; i++ ) {
00121 sprintf( brname, "Atten%i", i );
00122 btoftree -> SetBranchAddress( brname, &cnvBarAtten[i] );
00123 }
00124 for( unsigned int i=0; i<nBarSpeed; i++ ) {
00125 sprintf( brname, "Speed%i", i );
00126 btoftree -> SetBranchAddress( brname, &cnvBarSpeed[i] );
00127 }
00128 for( unsigned int i=0; i<nBarPar; i++ ) {
00129 sprintf( brname, "P%i", i );
00130 btoftree -> SetBranchAddress( brname, &cnvBarPar1[i] );
00131 }
00132 for( unsigned int i=0; i<nBarPar; i++ ) {
00133 sprintf( brname, "P%i", i+nBarPar );
00134 btoftree -> SetBranchAddress( brname, &cnvBarPar2[i] );
00135 }
00136 for( unsigned int i=0; i<nBarParOff; i++ ) {
00137 sprintf( brname, "Poff%i", i );
00138 btoftree -> SetBranchAddress( brname, &cnvBarParOff1[i] );
00139 }
00140 for( unsigned int i=0; i<nBarParOff; i++ ) {
00141 sprintf( brname, "Poff%i", i+nBarParOff );
00142 btoftree -> SetBranchAddress( brname, &cnvBarParOff2[i] );
00143 }
00144 for( unsigned int i=0; i<nBarSigma; i++ ) {
00145 sprintf( brname, "FLeft%i", i );
00146 btoftree -> SetBranchAddress( brname, &cnvFLeft[i] );
00147 }
00148 for( unsigned int i=0; i<nBarSigma; i++ ) {
00149 sprintf( brname, "FRight%i", i );
00150 btoftree -> SetBranchAddress( brname, &cnvFRight[i] );
00151 }
00152 for( unsigned int i=0; i<nBarSigCnt; i++ ) {
00153 sprintf( brname, "FCounter%i", i );
00154 btoftree -> SetBranchAddress( brname, &cnvFCount[i] );
00155 }
00156
00157 for(cnt=0; cnt<176; cnt++){
00158 btoftree -> GetEntry(cnt);
00159 bTof.setAtten( cnvBarAtten );
00160 bTof.setSpeed( cnvBarSpeed );
00161 bTof.setP1( cnvBarPar1 );
00162 bTof.setP2( cnvBarPar2 );
00163 bTof.setPoff1( cnvBarParOff1 );
00164 bTof.setPoff2( cnvBarParOff2 );
00165 bTof.setFPleft( cnvFLeft );
00166 bTof.setFPright( cnvFRight );
00167 bTof.setFPcounter( cnvFCount );
00168 tmpbTof.push_back(bTof);
00169 }
00170
00171
00172 double cnvEndAtten[nEndAtten];
00173 double cnvEndSpeed[nEndSpeed];
00174 double cnvEndPar[nEndPar];
00175 double cnvEndFPar[nEndSigma];
00176
00177 char ecname[10];
00178 for( unsigned int i=0; i<nEndAtten; i++ ) {
00179 sprintf( ecname, "Atten%i", i );
00180 etoftree -> SetBranchAddress( ecname, &cnvEndAtten[i] );
00181 }
00182 for( unsigned int i=0; i<nEndSpeed; i++ ) {
00183 sprintf( ecname, "Speed%i", i );
00184 etoftree -> SetBranchAddress( ecname, &cnvEndSpeed[i] );
00185 }
00186 for( unsigned int i=0; i<nEndPar; i++ ) {
00187 sprintf( ecname, "P%i", i );
00188 etoftree -> SetBranchAddress( ecname, &cnvEndPar[i] );
00189 }
00190 for( unsigned int i=0; i<nEndSigma; i++ ) {
00191 sprintf( ecname, "FCounter%i", i );
00192 etoftree -> SetBranchAddress( ecname, &cnvEndFPar[i] );
00193 }
00194
00195 for(cnt=0; cnt<96; cnt++){
00196 etoftree -> GetEntry(cnt);
00197 eTof.setAtten( cnvEndAtten );
00198 eTof.setSpeed( cnvEndSpeed );
00199 eTof.setP( cnvEndPar );
00200 eTof.setFP( cnvEndFPar );
00201 tmpeTof.push_back(eTof);
00202 }
00203
00204
00205 double cnvBarSigCor[nBarSigCor];
00206 double cnvBarOffset[nBarOffset];
00207 for( unsigned int i=0; i<nBarSigCor; i++ ) {
00208 sprintf( brname, "sigmaCorr%i", i );
00209 btofcommontree-> SetBranchAddress( brname, &cnvBarSigCor[i] );
00210 }
00211 for( unsigned int i=0; i<nBarOffset; i++ ) {
00212 sprintf( brname, "t0offset%i", i );
00213 btofcommontree-> SetBranchAddress( brname, &cnvBarOffset[i]);
00214 }
00215
00216 int entries = btofcommontree->GetEntries();
00217 for(cnt=0;cnt<entries;cnt++){
00218 btofcommontree->GetEntry(cnt);
00219 bTofCommon.setSigmaCorr( cnvBarSigCor );
00220 bTofCommon.setOffset( cnvBarOffset );
00221 tmpbTofCommon.push_back(bTofCommon);
00222 }
00223
00224 int m_run1, m_run2, m_version;
00225 int m_qCorr, m_qElec, m_misLable;
00226 int m_tofidEast[5], m_tofidWest[5], m_tofidEndcap[5];
00227
00228
00229 CalibInfo->SetBranchAddress("Run1",&m_run1);
00230 CalibInfo->SetBranchAddress("Run2",&m_run2);
00231 CalibInfo->SetBranchAddress("Version",&m_version);
00232 CalibInfo->SetBranchAddress("ebrId0",&m_tofidEast[0]);
00233 CalibInfo->SetBranchAddress("ebrId1",&m_tofidEast[1]);
00234 CalibInfo->SetBranchAddress("ebrId2",&m_tofidEast[2]);
00235 CalibInfo->SetBranchAddress("ebrId3",&m_tofidEast[3]);
00236 CalibInfo->SetBranchAddress("ebrId4",&m_tofidEast[4]);
00237 CalibInfo->SetBranchAddress("ecId0",&m_tofidEndcap[0]);
00238 CalibInfo->SetBranchAddress("ecId1",&m_tofidEndcap[1]);
00239 CalibInfo->SetBranchAddress("ecId2",&m_tofidEndcap[2]);
00240 CalibInfo->SetBranchAddress("ecId3",&m_tofidEndcap[3]);
00241 CalibInfo->SetBranchAddress("ecId4",&m_tofidEndcap[4]);
00242 CalibInfo->SetBranchAddress("wbrId0",&m_tofidWest[0]);
00243 CalibInfo->SetBranchAddress("wbrId1",&m_tofidWest[1]);
00244 CalibInfo->SetBranchAddress("wbrId2",&m_tofidWest[2]);
00245 CalibInfo->SetBranchAddress("wbrId3",&m_tofidWest[3]);
00246 CalibInfo->SetBranchAddress("wbrId4",&m_tofidWest[4]);
00247 CalibInfo->SetBranchAddress("misLable",&m_misLable);
00248 CalibInfo->SetBranchAddress("qCorr",&m_qCorr);
00249 CalibInfo->SetBranchAddress("qElec",&m_qElec);
00250
00251 entries= CalibInfo->GetEntries();
00252 for(cnt=0;cnt<entries;cnt++){
00253 CalibInfo->GetEntry(cnt);
00254 tofinfo.setRunBegin(m_run1);
00255 tofinfo.setRunEnd(m_run2);
00256 tofinfo.setVersion(m_version);
00257 tofinfo.setQCorr(m_qCorr);
00258 tofinfo.setQElec(m_qElec);
00259 tofinfo.setMisLable(m_misLable);
00260 tofinfo.setBrEast(m_tofidEast);
00261 tofinfo.setBrWest(m_tofidWest);
00262 tofinfo.setEndcap(m_tofidEndcap);
00263 tofinfoCol.push_back(tofinfo);
00264 }
00265
00266 CalibData::TofCalibData *tmpObject = new CalibData::TofCalibData(&tmpbTof,&tmpbTofCommon,&tmpeTof,&tofinfoCol);
00267
00268 refpObject=tmpObject;
00269 delete btoftree;
00270 delete etoftree;
00271 delete btofcommontree;
00272 delete CalibInfo;
00273
00274 return StatusCode::SUCCESS;
00275 }
|