/* This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
*
* MAUS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MAUS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MAUS. If not, see .
*
*/
#ifndef __MDREBUILDMANAGER_H
#define __MDREBUILDMANAGER_H
//C++
#include
#include
#include
#include "MDdateFile.h"
#include "MDfileManager.h"
#include "MDprocessManager.h"
// typedef std::pair EvntLabel;
struct EvntLabel {
EvntLabel()
:_pos(0), _nPartEv(0), _size(0) {}
EvntLabel(long p, int n, int s)
:_pos(p), _nPartEv(n), _size(s) {}
long _pos;
int _nPartEv;
int _size;
};
// typedef std::queue EvntFIFO;
typedef std::deque EvntFIFO;
class MDRebuildManager : public MDprocessManager {
public:
MDRebuildManager(int nLDCs)
: MDprocessManager(), _nLDCs(nLDCs) {_addresMap.resize(nLDCs);}
virtual ~MDRebuildManager() {}
void SetInFiles(vector f) {_infiles = f;}
void SetOutFile(ofstream* f) {_outfile = f;}
bool Scan();
int Scan(MDdateFile *infile);
bool Reorder();
void Rebuild();
void Rebuild(MDdateFile *infile, ofstream *outfile);
bool Synchronize();
void DumpAddresMap(int LdcId);
private:
int ProcessSubEvent(unsigned char* aDataPtr);
std::vector _addresMap;
int _nLDCs;
// MDdateFile *_infile;
vector< MDdateFile* > _infiles;
ofstream *_outfile;
};
#endif