#include <map>
#include <stdlib.h>
#include <string>
#include <set>
#include <list>
#include "TKey.h"
#include <TRint.h>
#include <TTree.h>
#include <TFile.h>
#include <TChain.h>
#include <iostream>
#include <sstream>
#include "tools/Log.hh"
#include "tools/Toolbox.hh"
#include "root/MTRun.hh"
#include "root/MTChannel.hh"
#include "root/MTEvent.hh"
#include "MicroException.hh"
#include "mysql/Mysql.hh"
Include dependency graph for merge.cpp:
Go to the source code of this file.
Defines | |
#define | GLOBALTRIGGER 1 |
#define | DIFSYNCHRO 2 |
#define | BCIDABS 3 |
Functions | |
int | merge (TString rootFileName) |
bool | FillEvent (const MTEvent &evt, MTEvent *mergedEvt, bool init=false) |
bool | FillChannels (const MTEvent &evt, list< MTChannel * > *hits) |
int | main (int argc, char **argv) |
int merge | ( | TString | rootFileName | ) |
Definition at line 58 of file merge.cpp.
Referenced by main().
00059 { 00060 if ( init) 00061 { 00062 mergedEvt->SetTimeInfo(evt.GetTimeInfo()); 00063 FILE_LOG(logDEBUG) << "time info["<< evt.GetTimeInfo() << "]" << endl; 00064 00065 mergedEvt->SetTemperature(evt.GetTemperature()); 00066 FILE_LOG(logDEBUG) << "temperature ["<< evt.GetTemperature() << "]" << endl; 00067 00068 mergedEvt->SetPressure(evt.GetPressure()); 00069 FILE_LOG(logDEBUG) << "pressure ["<< evt.GetPressure() << "]" << endl; 00070 00071 mergedEvt->SetDifSynchro(evt.GetDifSynchro()); 00072 FILE_LOG(logDEBUG) << "DifSynchro ["<< evt.GetDifSynchro() << "]" << endl; 00073 00074 mergedEvt->SetTimestamp(evt.GetTimestamp()); 00075 FILE_LOG(logDEBUG) << "SetTimestamp ["<< evt.GetTimestamp() << "]" << endl; 00076 00077 mergedEvt->SetGlobalTriggerCounter(evt.GetGlobalTriggerCounter()); 00078 FILE_LOG(logDEBUG) << "SetGlobalTriggerCounter ["<< evt.GetGlobalTriggerCounter() << "]" << endl; 00079 00080 mergedEvt->SetDifTriggerCounter(evt.GetDifTriggerCounter()); 00081 FILE_LOG(logDEBUG) << "evt.GetDifTriggerCounter ["<< evt.GetDifTriggerCounter() << "]" << endl; 00082 00083 mergedEvt->SetTrack(evt.GetTrack()); 00084 } 00085 00086 if (evt.GetSquareEvt()) { mergedEvt->SetSquareEvt(true); FILE_LOG(logDEBUG) << "mergedEvt->SetSquareEvt(true)"<< endl; } 00087 if (evt.GetBorderEvt()) { mergedEvt->SetBorderEvt(true); FILE_LOG(logDEBUG) << "mergedEvt->SetBorderEvt(true)"<< endl; } 00088 if (evt.GetChipEvt()) { mergedEvt->SetChipEvt(true); FILE_LOG(logDEBUG) << "mergedEvt->SetChipEvt(true)" << endl; } 00089 if (! evt.GetCrcIsCorrect()) { mergedEvt->SetCrcIsCorrect(false); FILE_LOG(logDEBUG) << "mergedEvt->SetCrcIsCorrect(false)(true)" << endl; } 00090 if (evt.GetValidFlag()) { mergedEvt->SetValidFlag(evt.GetValidFlag(),evt.IsValid()); FILE_LOG(logDEBUG) << "mergedEvt->SetValidFlag(" << evt.GetValidFlag() << "," << evt.IsValid() << ")" << endl ;} 00091 00092 00093 const std::map<UInt_t, std::map<UInt_t, std::map<UInt_t, Float_t>* >* >& meshs = evt.GetMeshVoltage(); 00094 //for ( std::map<UInt_t, Float_t>::const_iterator iterMesh = meshs.begin(); iterMesh != meshs.end(); iterMesh++) 00095 for ( std::map<UInt_t, std::map<UInt_t, std::map<UInt_t, Float_t>* >* >::const_iterator iterChamber = meshs.begin(); iterChamber != meshs.end(); iterChamber++) 00096 { 00097 std::map<UInt_t, std::map<UInt_t, Float_t>* >&difContainer = *(iterChamber)->second; 00098 for ( std::map<UInt_t, std::map<UInt_t, Float_t>* >::const_iterator iterDif = difContainer.begin(); iterDif != difContainer.end(); iterDif++) 00099 { 00100 std::map<UInt_t, Float_t> &boardContainer = *(iterDif)->second; 00101 for ( std::map<UInt_t, Float_t>::const_iterator iterVoltage = boardContainer.begin(); iterVoltage != boardContainer.end(); iterVoltage++) 00102 { 00103 mergedEvt->SetMeshVoltage(iterChamber->first,iterDif->first,iterVoltage->first,iterVoltage->second); 00104 FILE_LOG(logDEBUG) << "SetMeshVoltage(chamber[" << iterChamber->first << "] difId[" << iterDif->first << "] boardId[" << iterVoltage->first << "] , voltage[" << iterVoltage->second << "]" <<endl; 00105 } 00106 } 00107 00108 } 00109 00110 const std::map<UInt_t, std::map<UInt_t, std::map<UInt_t, Float_t>* >* >& drifts = evt.GetDriftVoltage(); 00111 //for ( std::map<UInt_t, Float_t>::const_iterator iterMesh = meshs.begin(); iterMesh != meshs.end(); iterMesh++) 00112 for ( std::map<UInt_t, std::map<UInt_t, std::map<UInt_t, Float_t>* >* >::const_iterator iterChamber = drifts.begin(); iterChamber != drifts.end(); iterChamber++) 00113 { 00114 std::map<UInt_t, std::map<UInt_t, Float_t>* >&difContainer = *(iterChamber)->second; 00115 for ( std::map<UInt_t, std::map<UInt_t, Float_t>* >::const_iterator iterDif = difContainer.begin(); iterDif != difContainer.end(); iterDif++) 00116 { 00117 std::map<UInt_t, Float_t> &boardContainer = *(iterDif)->second; 00118 for ( std::map<UInt_t, Float_t>::const_iterator iterVoltage = boardContainer.begin(); iterVoltage != boardContainer.end(); iterVoltage++) 00119 { 00120 mergedEvt->SetDriftVoltage(iterChamber->first,iterDif->first,iterVoltage->first,iterVoltage->second); 00121 FILE_LOG(logDEBUG) << "SetMeshDrift(chamber[" << iterChamber->first << "] difId[" << iterDif->first << "] boardId[" << iterVoltage->first << "] , voltage[" << iterVoltage->second << "]" <<endl; 00122 } 00123 } 00124 00125 } 00126 00127 00128 const std::map<UInt_t,Float_t>& tempAsu1 = evt.GetTemperatureAsu1(); 00129 for ( std::map<UInt_t,Float_t>::const_iterator iterAsu1 = tempAsu1.begin(); iterAsu1 != tempAsu1.end(); iterAsu1++) 00130 { 00131 mergedEvt->SetTemperatureAsu1(iterAsu1->first,iterAsu1->second); 00132 FILE_LOG(logDEBUG) << "SetTemperatureAsu1(Dif[" << iterAsu1->first << "] temperature[" << iterAsu1->second << "]" <<endl; 00133 } 00134 00135 00136 const std::map<UInt_t,Float_t>& tempAsu2 = evt.GetTemperatureAsu2(); 00137 for ( std::map<UInt_t,Float_t>::const_iterator iterAsu2 = tempAsu2.begin(); iterAsu2 != tempAsu2.end(); iterAsu2++) 00138 { 00139 mergedEvt->SetTemperatureAsu2(iterAsu2->first,iterAsu2->second); 00140 FILE_LOG(logDEBUG) << "SetTemperatureAsu2(Dif[" << iterAsu2->first << "] temperature[" << iterAsu2->second << "]" <<endl; 00141 } 00142 00143 00144 const std::map<UInt_t,Float_t>& tempDif = evt.GetTemperatureDif(); 00145 for ( std::map<UInt_t,Float_t>::const_iterator iterDif = tempDif.begin(); iterDif != tempDif.end(); iterDif++) 00146 { 00147 mergedEvt->SetTemperatureDif(iterDif->first,iterDif->second); 00148 FILE_LOG(logDEBUG) << "SetTemperatureDif(Dif[" << iterDif->first << "] temperature[" << iterDif->second << "]" <<endl; 00149 } 00150 00151 }
Definition at line 155 of file merge.cpp.
Referenced by main().
00156 { 00157 // on tourne sur tous les MTChannel 00158 for(int i=0;i<evt.GetNchannel() ;i++) 00159 { 00160 MTChannel *channel = (MTChannel*)evt.GetChannels()->At(i); 00161 // On instancie une nouvelle zone memoire pour s'affranchir de ROOT 00162 MTChannel* tmpCh = new MTChannel(); 00163 00164 // On copie le contenu du channel 00165 *tmpCh = *channel; 00166 // on ajoute les channel a la liste pour ce bcId_abs 00167 hits->push_back(tmpCh); 00168 } 00169 00170 return true; 00171 }
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 175 of file merge.cpp.
00175 { 00176 00177 00178 00179 00180 if ( argc < 3 || argc > 4 ) { 00181 FILE_LOG(logERROR) << "usage:" << endl; 00182 FILE_LOG(logERROR) << "-sort by globalTrigger: merge -g rootFile" << endl; 00183 FILE_LOG(logERROR) << "-sort by bcidAbs: merge -b rootFile" << endl; 00184 FILE_LOG(logERROR) << "-sort by difSynchro : merge -d SlabsRootFile AHCALRootFile" << endl; 00185 exit(1); 00186 } 00187 00188 00189 // Get command arguments 00190 string opt; 00191 opt.assign(argv[1]); 00192 if ( opt.compare("-g") != 0 && opt.compare("-d") != 0 && opt.compare("-b") != 0 ) 00193 { 00194 FILE_LOG(logERROR) << "usage:" << endl; 00195 FILE_LOG(logERROR) << "-sort by globalTrigger: merge -g rootFile" << endl; 00196 FILE_LOG(logERROR) << "-sort by bcidAbs: merge -b rootFile" << endl; 00197 FILE_LOG(logERROR) << "-sort by difSynchro : merge -d SlabsRootFile AHCALRootFile" << endl; 00198 exit(-1); 00199 } 00200 00201 unsigned int criteria = GLOBALTRIGGER; 00202 string extension = "_MGT"; 00203 00204 if ( opt.compare("-d") == 0 ) { criteria = DIFSYNCHRO; extension = "_MDS"; } 00205 else if ( opt.compare("-b") == 0 ) { criteria = BCIDABS; extension = "_MBA"; } 00206 00207 00208 00209 vector<string> fileNames; 00210 00211 fileNames.push_back(argv[2]); 00212 00213 if ( criteria == DIFSYNCHRO ) 00214 { 00215 if ( argc <4 ) 00216 { 00217 FILE_LOG(logERROR) << "-sort by difSynchro : merge -d SlabsRootFile AHCALRootFile" << endl; 00218 exit(0); 00219 } 00220 fileNames.push_back(argv[3]); 00221 } 00222 00223 00224 00225 00226 vector<UInt_t> misses; 00227 00228 00229 //Open Root File 00230 TTree* minEventTree = NULL; 00231 UInt_t minEventNum = 0xffffffff; 00232 UInt_t maxEventNum = 0x0; 00233 list<TTree*> trees; 00234 list<TFile*> files; 00235 00236 for ( vector<string>::iterator iterFile = fileNames.begin(); iterFile != fileNames.end(); iterFile++) 00237 { 00238 string rootName = *iterFile; 00239 TFile *f = new TFile(rootName.c_str(),"READONLY"); 00240 files.push_back(f); 00241 TIter nextkey(f->GetListOfKeys()); 00242 TKey *key; 00243 // Loop over TTree, store name and min paramaters 00244 00245 const MTEvent *evt = new MTEvent(); 00246 ui32 lastTotalGlobalTrigerCounter = 0; 00247 00248 00249 00250 while (key = (TKey*)nextkey()) 00251 { 00252 try 00253 { 00254 TTree* tmp = dynamic_cast<TTree*>(key->ReadObj()); 00255 trees.push_back(tmp); 00256 cout << "Add TTree["<< tmp->GetName() <<"] with [" << tmp->GetEntries() << "] entries." << endl; 00257 if ( tmp->GetEntries() < minEventNum && tmp->GetEntries() > 0) 00258 { 00259 minEventNum = tmp->GetEntries() ; 00260 minEventTree = tmp; 00261 } 00262 /* 00263 TBranch *branch= tmp->GetBranch("MTEvent"); 00264 branch->SetAddress(&evt); 00265 00266 00267 tmp->GetEntry(tmp->GetEntries()-1); 00268 if ( lastTotalGlobalTrigerCounter == 0 ) 00269 { 00270 lastTotalGlobalTrigerCounter = evt->GetGlobalTriggerCounter(); 00271 } 00272 else 00273 { 00274 if ( evt->GetGlobalTriggerCounter() != lastTotalGlobalTrigerCounter ) 00275 { 00276 cout << "\n\n\n\n\n" << endl; 00277 FILE_LOG(logERROR) << " Last event of each TTree have not got the same GlobalTrigger counter value." << endl; 00278 FILE_LOG(logERROR) << " Synchronization failed. Data can not be merged" << endl; 00279 exit(-1); 00280 } 00281 } 00282 */ 00283 } 00284 00285 catch (...) {} 00286 } 00287 } 00288 00289 // Remove it to avoid auto looping 00290 if ( minEventTree != NULL ) 00291 { 00292 cout << "Reference TTree[" << minEventTree->GetName() << "]" << endl; 00293 trees.remove(minEventTree); 00294 } 00295 00296 string mergeFileName = fileNames[0].substr(0,fileNames[0].find("root")-1)+extension.c_str() + ".root"; 00297 00298 TFile *newFile = new TFile(mergeFileName.c_str(), "RECREATE"); 00299 newFile->cd(); 00300 // Creation du nouvel arbre destine a contenir les evenement merges 00301 TTree* mergedTree = new TTree("mergedTTree","MicroMegas merged event"); 00302 // mergedTree->SetDirectory(0); 00303 cout << "Create new TFile for merge result[" <<mergeFileName << "]" << endl; 00304 00305 // creation d' un nouvel evemenent merge 00306 MTEvent *mergedEvt = new MTEvent(); 00307 if ( mergedTree->GetBranch("MTEvent") == 0) 00308 { 00309 mergedTree->Branch("MTEvent",mergedEvt);//,16000,2);// second argument is class of evt!!! 00310 } 00311 00312 // on tourne sur tout les evenents de l arbre ayant le moins d' evenements 00313 TTree* refTree = minEventTree; 00314 MTRun * run = (MTRun*)refTree->GetUserInfo()->FindObject("MTRun"); 00315 TString svnVersion; 00316 if ( run != NULL ) { svnVersion = run->GetSvnVersion();} 00317 mergedTree->GetUserInfo()->Add(run); 00318 int lastEventId = 0; 00319 ui32 nbchannelOrig = 0; 00320 // ui32 nbchannelOther = 0; 00321 map<string , UInt_t> lastEventIdMap; 00322 UInt_t nbChannels = 0; 00323 for ( int evtNum = 0; evtNum < refTree->GetEntries() ; evtNum++) 00324 { 00325 FILE_LOG(logDEBUG) << "=============NEW EVENT TO MERGE "<< evtNum << "======================" << endl; 00326 mergedEvt->SetCrcIsCorrect(true); 00327 const MTEvent *evt = new MTEvent(); 00328 TBranch *branch= refTree->GetBranch("MTEvent"); 00329 branch->SetAddress(&evt); 00330 refTree->GetEntry(evtNum); 00331 00332 FillEvent(*evt,mergedEvt,true); 00333 mergedEvt->SetEventId(evtNum); 00334 /* 00335 if ( evt->GetCrcIsCorrect() == false ) 00336 { 00337 mergedEvt->SetCrcIsCorrect(false); 00338 } 00339 */ 00340 UInt_t globalTrigger = evt->GetGlobalTriggerCounter() ; 00341 ULong64_t difSynchro = evt->GetDifSynchro(); 00342 UInt_t difTrigger = evt->GetDifTriggerCounter() ; 00343 00344 UInt_t searchBcIdAbs = 0; 00345 00346 if ( evt->GetNchannel() == 0 ) 00347 { 00348 // cout << "reference Event has not got any Hit. Skip it" << endl; 00349 } 00350 else 00351 { 00352 if ( criteria == BCIDABS ) 00353 { 00354 MTChannel* channel = (MTChannel*)evt->GetChannels()->At(0); 00355 searchBcIdAbs = channel->GetBcIdAbs(); 00356 if ( searchBcIdAbs == 0 ) { cout << "searchBcIdAbs[" << searchBcIdAbs << "]" << endl; exit(-1); } 00357 // cout << "evt->GetNchannel() reference [ " << evt->GetNchannel() << "] " <<endl; 00358 } 00359 // create list for all Events channels with same criteria 00360 list<MTChannel*>* hits = new list<MTChannel*>(); 00361 FillChannels(*evt,hits); 00362 //nbChannels = nbChannels + hits->size(); 00363 nbchannelOrig = nbchannelOrig+evt->GetNchannel(); 00364 // On cherche dans les autres arbres les evenement avec ce meme criteria 00365 int evtNum2 = 0; 00366 for ( list<TTree*>::iterator iterTree = trees.begin(); iterTree != trees.end(); iterTree++) 00367 { 00368 TTree* tree = (TTree*)*iterTree; 00369 const MTEvent *evt = new MTEvent(); 00370 TBranch *branch= tree->GetBranch("MTEvent"); 00371 branch->SetAddress(&evt); 00372 00373 bool find = false; 00374 string treeName = string(tree->GetName()); 00375 00376 00377 UInt_t bcidAbs = 0; 00378 for ( evtNum2 = lastEventIdMap[treeName]; evtNum2< tree->GetEntries() ; evtNum2++) 00379 { 00380 00381 tree->GetEntry(evtNum2); 00382 if ( evt != NULL) 00383 { 00384 bcidAbs = 0; 00385 if ( criteria == BCIDABS ) 00386 { 00387 //cout << "evt->GetNchannel() [ " << evt->GetNchannel() << "] " <<endl; 00388 if ( evt->GetNchannel() > 0 ) 00389 { 00390 MTChannel* channel = (MTChannel*)(evt->GetChannels()->At(0)); 00391 bcidAbs = channel->GetBcIdAbs(); 00392 //cout << "bcidAbs[" << bcidAbs << "]" << endl; 00393 } 00394 } 00395 00396 if ( ( criteria == GLOBALTRIGGER && evt->GetGlobalTriggerCounter() == globalTrigger ) 00397 ||( criteria == DIFSYNCHRO && evt->GetDifSynchro() == difSynchro ) 00398 ||( criteria == BCIDABS && bcidAbs != 0 && bcidAbs == searchBcIdAbs )) 00399 00400 { 00401 find = true; 00402 /* 00403 if ( criteria == BCIDABS ) 00404 { cout << "Merge by bcid abs [ " << tree->GetName() << "], eventNum[ " << evtNum2 <<"],bcidAbs[" << bcidAbs << "]" << endl; } 00405 if ( criteria == GLOBALTRIGGER ) 00406 { cout << "Merge by globalTrigger [ " <<tree->GetName() << "], eventNum[ " << evtNum2 << "], globalTriger[ " << globalTrigger << "]" << endl; } 00407 00408 */ 00409 //--------------------------------- 00410 // on tourne sur tous les MTChannel 00411 FillChannels(*evt,hits); 00412 FillEvent (*evt,mergedEvt); 00413 /* 00414 if ( evt->GetCrcIsCorrect() == false ) 00415 { 00416 mergedEvt->SetCrcIsCorrect(false); 00417 } 00418 */ 00419 //nbchannelOther = nbchannelOther + evt->GetNchannel(); 00420 00421 break; 00422 } 00423 } 00424 } // end loop over current TTree events (tree) 00425 if ( ! find ) 00426 { 00427 if ( criteria == GLOBALTRIGGER ) 00428 { 00429 cout << "global trigger[" << tree->GetName() << " " << globalTrigger << "] not found" << endl; 00430 misses.push_back(globalTrigger); 00431 } 00432 else if ( criteria == DIFSYNCHRO ) 00433 { 00434 cout << "difSynchro[" << tree->GetName() << " " << difSynchro << "] not found" << endl; 00435 misses.push_back(difSynchro); 00436 } 00437 else if ( criteria == BCIDABS ) 00438 { 00439 cout << "bcidAbs [" << tree->GetName() << " " << searchBcIdAbs << "] not found" << endl; 00440 misses.push_back(bcidAbs); 00441 } 00442 00443 } 00444 else 00445 { 00446 //cout << "---- difSynchro[" << tree->GetName() << " " << difSynchro << "] found" << endl; 00447 lastEventIdMap[treeName] = evtNum2; 00448 } 00449 00450 delete evt; 00451 } // end loop over TTree 00452 // Tous les MTChannel pour ce critere ont ete recuperes. 00453 // On les ajoutes donc a notre nouveau MTEvent 00454 for ( list<MTChannel*>::iterator iterCh = hits->begin(); iterCh != hits->end(); iterCh++) 00455 { 00456 MTChannel* ch = *iterCh; 00457 mergedEvt->AddChannel(ch); 00458 } 00459 nbChannels = nbChannels + hits->size(); 00460 00461 // On sauve les MTEvent dans le nouvel arbre 00462 // Lorsque l' on modifie le map nbHitPerBcidHit d' un evenement la methode MTEvent->Fill() devient beaucoup plus lent 00463 mergedTree->Fill(); // fill with mergedEvt 00464 for ( list<MTChannel*>::iterator iterCh = hits->begin(); iterCh != hits->end(); iterCh++) 00465 { 00466 00467 delete (*iterCh) ; //delete MTChannel ch 00468 } 00469 delete hits; 00470 } // end else on if ( evt->GetNchannel() == 0 ) 00471 if ( evtNum % 1 == 0) 00472 { 00473 FILE_LOG(logINFO ) << "Done for entry " << evtNum +1 << " / " << refTree->GetEntries() << "\r" << flush; 00474 //FILE_LOG(logINFO ) << "Done for entry " << evtNum +1 << " / " << refTree->GetEntries() << endl; 00475 } 00476 00477 00478 // Clean and free memory 00479 mergedEvt->SetNchannel(0); // Free memory 00480 mergedEvt->Clear(); 00481 00482 00483 delete evt; 00484 } //end loop over ref TTree events 00485 00486 for ( list<TTree*>::iterator iterTree = trees.begin(); iterTree != trees.end(); iterTree++) 00487 { 00488 TTree* tree = (TTree*)*iterTree; 00489 MTRun * run = (MTRun*)tree->GetUserInfo()->FindObject("MTRun"); 00490 mergedTree->GetUserInfo()->Add(run); 00491 } 00492 00493 00494 00495 mergedTree->Write("", TObject::kOverwrite); 00496 mergedTree->SetDirectory(0); 00497 newFile->Close(); 00498 //f.Close(); 00499 00500 00501 00502 string comment = "No comment"; 00503 bool behavior = true; 00504 if ( misses.size() > 0 ) 00505 { 00506 behavior = false; 00507 string msg = "WARNING !!! Some event has not been merges. Find bellow list of criteria not found."; 00508 cout << msg << endl; 00509 comment = msg; 00510 for ( vector<UInt_t>::const_iterator iter = misses.begin(); iter != misses.end() ; iter++) 00511 { 00512 cout << "["<< *iter << "]"; 00513 ostringstream out; 00514 out << *iter; 00515 string sIndex = out.str(); 00516 msg = msg + "[" + sIndex + "]"; 00517 } 00518 cout << endl; 00519 } 00520 cout << endl << "Done." << endl; 00521 00522 //cout << "Last global trigger counter = " << globalTrigger << "]" << endl; 00523 00524 Mysql mysql; 00525 // Add merge software in DB if not already exist 00526 string svn(svnVersion.Data()); 00527 FILE_LOG(logINFO) << " mysql.add merge Software to DB (" << svn << "]" << endl; 00528 ui32 softId = mysql.addMergeSoftware(svn); 00529 00530 // Add merge file 00531 size_t last_slash = mergeFileName.find_last_of("/") +1 ; 00532 string name = mergeFileName.substr(last_slash); 00533 string path = mergeFileName.substr(0,last_slash); 00534 int mergeId = mysql.addMergeFile(softId,path,name,behavior,refTree->GetEntries(),nbChannels,true,comment); 00535 cout << "mergeId[" << mergeId << "]" << endl; 00536 00537 for ( vector<string>::iterator iterFile = fileNames.begin(); iterFile != fileNames.end(); iterFile++) 00538 { 00539 string full = *iterFile; 00540 size_t last_slash = full.find_last_of("/") +1 ; 00541 string name = full.substr(last_slash); 00542 string path = full.substr(0,last_slash); 00543 try { 00544 ui32 rebuildId = mysql.getRebuildFile(path,name); 00545 mysql.connectMergeAndRebuildFile(rebuildId,mergeId); 00546 } 00547 catch ( MicroException e ) 00548 { 00549 FILE_LOG(logWARNING) << "Rebuild file[" << path + name << "] not registerd in database." << endl; 00550 } 00551 00552 } 00553 00554 00555 00556 00557 00558 00559 00560 00561 }