ROOT logo

#include "hdst.h"
#include "htrbnetdef.h"

//------- detectors -------------------
#include "hspectrometer.h"
#include "hrichdetector.h"
#include "hmdcdetector.h"
#include "htofdetector.h"
#include "hrpcdetector.h"
#include "hshowerdetector.h"
#include "hemcdetector.h"
#include "htboxdetector.h"
#include "hstart2detector.h"
#include "hwalldetector.h"
#include "hpiontrackerdetector.h"
//-------------------------------------

//--------- data source ---------------
#include "hldsource.h"
#include "hldfilesource.h"
#include "hldgrepfilesource.h"
#include "hldremotesource.h"
#include "hldstacksource.h"
#include "hrootsource.h"
#include "hgeantmergesource.h"
//-------------------------------------

//-------- unpackers -----------------
#include "hmdcunpacker.h"
#include "hshowerunpacker.h"
#include "hrichunpacker.h"
#include "hrich700trb3unpacker.h"
#include "hwalltrb2unpacker.h"
#include "hrpctrb2unpacker.h"
#include "htoftrb2unpacker.h"
#include "hstart2trb2unpacker.h"
#include "hstart2trb3unpacker.h"
#include "hlatchunpacker.h"
#include "htboxunpacker.h"
#include "hpiontrackertrb3unpacker.h"
#include "hemctrb3unpacker.h"
//-------------------------------------


//-------- parameters -----------------
#include "hades.h"
#include "hruntimedb.h"
#ifdef ORACLE_SUPPORT
  #include "hparora2io.h"
#endif
#include "hparasciifileio.h"
#include "hparrootfileio.h"
//-------------------------------------

#include "TObjString.h"


#include <iostream>
#include <vector>
using namespace std;


ClassImp(HDst)

void HDst::setupSpectrometer(TString beamtime,Int_t mdcsetup[6][4],TString detectors)
{
    // beamtime aug11, aug11_3sec ,apr12,jul14,aug14,aug18,mar19
    // Int_t mdcset[6][4] setup mdc. If not used put NULL (default).
    // if not NULL it will overwrite settings given by beamtime
    // detectors (default)= rich,mdc,tof,rpc,shower,wall,tbox,start

    beamtime.ToLower();
    detectors.ToLower();
    ::Info("setupSpectrometer()", "\n----------- setting up HADES spectrometer ----------------");

    if(beamtime.CompareTo("may14")==0) beamtime = "jul14";
    if(beamtime.CompareTo("aug14")==0) beamtime = "jul14";

    if     (beamtime.CompareTo("aug11")     ==0);
    else if(beamtime.CompareTo("aug11_3sec")==0);
    else if(beamtime.CompareTo("apr12")     ==0);
    else if(beamtime.CompareTo("jul14")     ==0);
    else if(beamtime.CompareTo("aug18")     ==0);
    else if(beamtime.CompareTo("mar19")     ==0);
    else {
        ::Error("","Beam time = '%s' not supported !",beamtime.Data());
        exit(1);
    }
    ::Info("setupSpectrometer()", "Using %s setup",beamtime.Data());

    Int_t mdcMods_aug11[6][4]={
        {1,1,1,1},
        {1,1,0,1},
        {1,1,1,1},
        {1,1,1,1},
        {1,1,1,1},
        {1,1,1,1} };

    Int_t mdcMods_aug11_3sec[6][4]={
        {0,0,0,0},
        {0,0,0,0},
        {1,1,1,1},
        {0,0,0,0},
        {1,1,1,1},
        {1,1,1,1} };

    Int_t mdcMods_apr12[6][4]={
        {1,1,1,1},
        {1,1,1,1},
        {1,1,1,1},
        {1,1,1,1},
        {1,1,1,1},
        {1,1,1,1} };


    Int_t mdcMods[6][4];

    ::Info("", "setting up MDC modules");
    if(mdcsetup) ::Info("", "settings will be taken by input array");
    else         ::Info("", "settings will be taken by %s",beamtime.Data());
    for(Int_t s=0;s<6;s++){
        cout<<"    sec "<<s;
        for(Int_t m=0;m<4;m++){
            if(mdcsetup == NULL){
                if     (beamtime.CompareTo("aug11")     ==0) mdcMods[s][m] = mdcMods_aug11[s][m];
                else if(beamtime.CompareTo("aug11_3sec")==0) mdcMods[s][m] = mdcMods_aug11_3sec[s][m];
                else if(beamtime.CompareTo("apr12")     ==0) mdcMods[s][m] = mdcMods_apr12[s][m];
                else if(beamtime.CompareTo("jul14")     ==0) mdcMods[s][m] = mdcMods_apr12[s][m];
                else if(beamtime.CompareTo("aug18")     ==0) mdcMods[s][m] = mdcMods_apr12[s][m];
                else if(beamtime.CompareTo("mar19")     ==0) mdcMods[s][m] = mdcMods_apr12[s][m];
                else {
                    ::Error("","Beam time = %s not supported !",beamtime.Data());
                    exit(1);
                }
            } else {
                mdcMods[s][m] = mdcsetup[s][m];
            }
            cout<<" "<<mdcMods[s][m];
        }
        cout<<endl;
    }



    Int_t tofMods   [22] = {1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    Int_t rpcMods   [1]  = {1};
    Int_t showerMods[3]  = {1,2,3};
    Int_t emcMods   [1]  = {1};
    Int_t nStartMods[10]      = {1,1,1,1,0,0,0,0,0,0};  // before apr12
    Int_t nStartModsApr12[10] = {1,1,1,1,1,0,0,0,0,0};  // apr12
    Int_t nStartModsJul14[10] = {1,0,0,0,1,0,0,0,0,0};  // jul14 (+may14)  start+hodo
    Int_t nStartModsAug18[10] = {1,1,1,1,0,0,0,0,0,0};  // aug18  start+veto
    Int_t nStartModsMar19[10] = {1,1,0,1,0,0,0,0,0,0};  // aug18  start+veto
    Int_t pionTrackerMods[10] = {1,1,1,1,0,0,0,0,0,0};  // jul14
    Int_t wallMods  [1]  = {1};
    Int_t nTrigMods [1]  = {1};
    Int_t richMods  [1]  = {1};

    HSpectrometer* spec = gHades->getSetup();

    if(detectors.Contains("tbox")){
        ::Info("","Adding TBox");
        spec->addDetector(new HTBoxDetector);
        spec->getDetector("TBox")->setModules(-1,nTrigMods);
    }
    if(detectors.Contains("start")) {
        ::Info("","Adding START");
        spec->addDetector(new HStart2Detector);
        if( beamtime.CompareTo("aug11")      ==0 ||
            beamtime.CompareTo("aug11_3sec") ==0
          ) {
            spec->getDetector("Start")->setModules(-1,nStartMods);
        } else if (beamtime.CompareTo("apr12") ==0) {
            spec->getDetector("Start")->setModules(-1,nStartModsApr12);
        } else if (beamtime.CompareTo("jul14") ==0) {
            spec->getDetector("Start")->setModules(-1,nStartModsJul14);
        } else if (beamtime.CompareTo("aug18") ==0) {
            spec->getDetector("Start")->setModules(-1,nStartModsAug18);
        } else if (beamtime.CompareTo("mar19") ==0) {
            spec->getDetector("Start")->setModules(-1,nStartModsMar19);
        }

    }
    if(detectors.Contains("wall"))  {
        ::Info("","Adding WALL");
        spec->addDetector(new HWallDetector);
        spec->getDetector("Wall")->setModules(-1,wallMods);
    }
    if(detectors.Contains("piontracker"))  {
        ::Info("","Adding PionTracker");
        spec->addDetector(new HPionTrackerDetector);
        spec->getDetector("PionTracker")->setModules(-1,pionTrackerMods);
    }

    if(detectors.Contains("rich"))  {spec->addDetector(new HRichDetector);   ::Info("","Adding RICH");  }
    if(detectors.Contains("mdc"))   {spec->addDetector(new HMdcDetector);    ::Info("","Adding MDC");   }
    if(detectors.Contains("tof"))   {spec->addDetector(new HTofDetector);    ::Info("","Adding TOF");   }
    if(detectors.Contains("rpc"))   {spec->addDetector(new HRpcDetector);    ::Info("","Adding RPC");   }
    if(detectors.Contains("shower")){spec->addDetector(new HShowerDetector); ::Info("","Adding SHOWER");}
    if(detectors.Contains("emc"))   {spec->addDetector(new HEmcDetector);    ::Info("","Adding EMC");}

    for (Int_t is=0; is<6; is++) {
        if(detectors.Contains("rich"))  spec->getDetector("Rich")  ->setModules(is,richMods);
        if(detectors.Contains("mdc"))   spec->getDetector("Mdc")   ->setModules(is,mdcMods[is]);
        if(detectors.Contains("tof"))   spec->getDetector("Tof")   ->setModules(is,tofMods);
        if(detectors.Contains("rpc"))   spec->getDetector("Rpc")   ->setModules(is,rpcMods);
        if(detectors.Contains("shower"))spec->getDetector("Shower")->setModules(is,showerMods);
        if(detectors.Contains("emc"))   spec->getDetector("Emc")   ->setModules(is,emcMods);
    }
}
void HDst::setupParameterSources(TString parsource,TString asciiParFile,TString rootParFile,TString histDate)
{
    // parsource = oracle,ascii,root (order matters)
    // if source is "ascii" a ascii param file has to provided
    // if source is "root" a root param file has to provided
    // The histDate paramter (default "now") is used wit the oracle source
    parsource.ToLower();
    parsource.ReplaceAll(" ","");

    ::Info("setupParameterSources()", "\n----------- setting up parameter sources ----------------");

    Bool_t useOra   = kFALSE;
    Bool_t useAscii = kFALSE;
    Bool_t useRoot  = kFALSE;

    if(parsource.Contains("oracle")) useOra   = kTRUE;
    if(parsource.Contains("ascii"))  useAscii = kTRUE;
    if(parsource.Contains("root"))   useRoot  = kTRUE;


    if(useAscii && asciiParFile == "") {
        ::Error( "","Ascii source selected, but ascii file empty!");
        exit(1);

    }
    if(useRoot  && rootParFile  == "") {
        ::Error( "","Root source selected, but root file empty!");
        exit(1);
    }
    if(useOra && useRoot && useAscii) {

        ::Error( "","Root , Ascii and Ora cannot be active at the same time (only 2 of them)!");
        exit(1);
    }

    TObjArray* ar = parsource.Tokenize(",");

    if(ar){

        Int_t n  = ar->GetEntries();

        if(n > 2 || n == 0){

            ::Error( "","To many ( > 2) or no param source specified !");
            exit(1);
        }
        HRuntimeDb *rtdb = gHades->getRuntimeDb();

        for(Int_t i = 0; i < n; i ++){
            TString parsrc = ((TObjString*)ar->At(i))->GetString();
            if(parsrc == "ascii"){

                ::Info("", "Add ASCII as source %i reading from : %s",i+1,asciiParFile.Data());

                HParAsciiFileIo *input = new HParAsciiFileIo;
                input->open((Text_t*)asciiParFile.Data(),"in");
                if(i == 0) rtdb->setFirstInput(input);
                else       rtdb->setSecondInput(input);
            }
            else if(parsrc == "root"){

                ::Info("", "Add ROOT  as source %i reading from : %s",i+1,rootParFile.Data());

                HParRootFileIo *input=new HParRootFileIo;
                input->open((Text_t*)rootParFile.Data(),"READ");
                if(i == 0) rtdb->setFirstInput(input);
                else       rtdb->setSecondInput(input);
            }
            else if(parsrc == "oracle"){
#ifdef ORACLE_SUPPORT
                ::Info("", "Add ORACLE as source %i histdate = %s",i+1,histDate.Data());

                HParOra2Io *ora=new HParOra2Io() ;
                ora->open();

                if(histDate.CompareTo("now")==0 || histDate.Contains("-")){
                    ora->setHistoryDate(histDate.Data());
                } else {
                    ora->setParamRelease(histDate.Data());
                }
                if(i == 0) rtdb->setFirstInput(ora);
                else       rtdb->setSecondInput(ora);
#else
                ::Error( "","ORCALE source specified but not supported !");
                exit(1);
#endif
            }
        }

        ar->Delete();
        delete ar;

    }

}

void HDst::setDataSource(Int_t sourceType,
                         TString inDir,
                         TString inFile,
                         Int_t refId,
                         TString eventbuilder
                        )
{

    // datasource 0 = hld, 1 = hldgrep 2 = hldremote, 3 root 4 geantmerge  5 hldstack(Processor task)
    // like "lxhadeb02.gsi.de"  needed by dataosoure = 2
    // inputDir needed by dataosoure = 1,2
    // inputFile needed by dataosoure = 1,3,4
    // inputDir should be empty if not used (dataosoure = 0,3)
    // inputFile can contain path if inputDir is empty
    // for datasource 4 inputFile is a comma seprated list
    // "file1_with_path,file2_with_path,file3_with_path"

    ::Info("setDataSource()","\n----------- setting up data sources ---------------------");

    if( sourceType == 0 ){
        ::Info("", "Add HldFileSource");

        HldFileSource* source = new HldFileSource;
        if(inDir !="") source->setDirectory((Text_t*) inDir.Data());

	if(inFile.Contains(",")) { // multiple file input
	    TObjArray* ar = 0;
	    if(inFile.Contains(",")){
		ar = inFile.Tokenize(",");
		if(ar) {
		    for(Int_t i=0;i<ar->GetEntries();i++){
			TString file = ((TObjString*)ar->At(i))->GetString();
			::Info("", "%i : Add file %s",i,file.Data());
			source->addFile((Text_t*) file.Data(),refId);
		    }
		    ar->Delete();
                    delete ar;
		}
	    }
	} else {
	    source->addFile((Text_t*) inFile.Data(),refId);
	}

	gHades->setDataSource(source);
    } else if ( sourceType == 1 ){
        ::Info("", "Add HldGrepFileSource");
        Int_t GrepInterval   = 5 ; // look for new file each n seconds
        Int_t GrepTimeOffset = 10; // at least n seconds old
        Int_t GrepFileOffset = 0;  // latest - GrepFileOffset file (minimum 0)
        HldGrepFileSource* source = new HldGrepFileSource(inDir,"Grep",GrepInterval,refId,GrepTimeOffset,GrepFileOffset);
        gHades->setDataSource(source);
    } else if ( sourceType == 2 ){
        ::Info("", "Add HldRemoteSource");
        HldRemoteSource* source = new HldRemoteSource(eventbuilder.Data());
        source->setRefId(refId);
        gHades->setDataSource(source);
    } else if ( sourceType == 3 ){
        ::Info("", "Add HRootSource");
        HRootSource* source = new HRootSource();
        if(inDir !="") source->setDirectory((Text_t*) inDir.Data());

	if(inFile.Contains(",")) { // multiple file input
	    TObjArray* ar = 0;
	    if(inFile.Contains(",")){
		ar = inFile.Tokenize(",");
		if(ar) {
		    for(Int_t i=0;i<ar->GetEntries();i++){
			TString file = ((TObjString*)ar->At(i))->GetString();
			::Info("", "%i : Add file %s",i,file.Data());
			source->addFile((Text_t*) file.Data());
		    }
		    ar->Delete();
                    delete ar;
		}
	    }
	} else {
	    source->addFile((Text_t*) inFile.Data());
	}
        source->setGlobalRefId(refId);
        gHades->setDataSource(source);
    } else if ( sourceType == 4 ){
        ::Info("", "Add HGeantMergeSource");
        HGeantMergeSource* source = new HGeantMergeSource();
        source->addMultFiles(inFile);
        source->setGlobalRefId(refId);
        gHades->setDataSource(source);
    } else if( sourceType == 5 ){
        ::Info("", "Add HldStackSource");

        HldStackSource* source = new HldStackSource;
        gHades->setDataSource(source);
    } else {
        ::Error("","Unknown source type = %i !",sourceType);
        exit(1);
    }
}

void HDst::setSecondDataSource(TString inDir,
                               TString inFile,
                               Int_t refId
                              )
{

    // second datasource is a root source (used for embedding)
    // inputDir should be empty if not used
    // inputFile can contain path if inputDir is empty

    ::Info("setDataSource()","\n----------- setting up data sources ---------------------");

    ::Info("", "Add second DataSource");

    HRootSource* source = new HRootSource(kTRUE,kTRUE);
    if(inDir !="") source->setDirectory((Text_t*) inDir.Data());
    source->addFile((Text_t*) inFile.Data());
    source->setGlobalRefId(refId);
    gHades->setSecondDataSource(source);
}

void HDst::setupUnpackers(TString beamtime,TString detectors,Bool_t correctINL)
{
    // beamtime aug11 apr12 jul14 aug14 aug18 mar19
    // detectors (default)= rich,mdc,tof,rpc,shower,wall,tbox,latch,start
    // The data source has to be set before!
    ::Info("setupUnpackers()", "\n----------- setting up unpackers    ---------------------");

    beamtime.ToLower();
    detectors.ToLower();

    if(beamtime.CompareTo("may14")==0) beamtime = "jul14";
    if(beamtime.CompareTo("aug14")==0) beamtime = "jul14";

    if     (beamtime.CompareTo("aug11")      ==0);
    else if(beamtime.CompareTo("apr12")      ==0);
    else if(beamtime.CompareTo("jul14")      ==0);
    else if(beamtime.CompareTo("aug18")      ==0);
    else if(beamtime.CompareTo("mar19")      ==0);
    else {
        ::Error("","Beam time = %s not supported !",beamtime.Data());
        exit(1);
    }


    //Data source
    HldSource *source = (HldSource *)gHades->getDataSource();


    if(source == NULL) {
        ::Error( "","Datasource source not set !");
        exit(1);
    }

    TString classname = source->ClassName();

    if(classname == "HRootSource") {
        ::Error( "","Datasource is HRootSource , not compatibel with unpackers !");
        exit(1);
    }


    if(beamtime == "aug11")
    {
        ::Info("", "Using aug11 setup");

        Int_t mdcUnpackers   [12] = {0x1100,0x1110,0x1120,0x1130,0x1140,0x1150,0x1000,0x1010,0x1020,0x1030,0x1040,0x1050};
        Int_t rpcUnpackers   [2]  = {0x8400,0x8410}; //
        Int_t startUnpackers [1]      = {0x8800};        //
        Int_t tofUnpackers   [1]  = {0x8600};        //
        Int_t wallUnpackers  [1]  = {0x8700};        //
        Int_t showerUnpackers[6]  = {0x3200,0x3210,0x3220,0x3230,0x3240,0x3250}; //
        Int_t richUnpackers  [3]  = {0x8300,0x8310,0x8320};


        if(detectors.Contains("wall")) {
            ::Info("", "Adding WALL unpackers");

            for(UInt_t i=0; i<(sizeof(wallUnpackers)/sizeof(Int_t)); i++)
            {
                cout<<hex<<wallUnpackers[i]<<", "<<dec<<flush;
                HWallTrb2Unpacker* wallUnpacker=new HWallTrb2Unpacker(wallUnpackers[i]);
                wallUnpacker->setQuietMode();
                wallUnpacker->removeTimeRef();
                source->addUnpacker( wallUnpacker);
            }
            cout<<endl;
        }

        if(detectors.Contains("latch")) {source->addUnpacker( new HLatchUnpacker(startUnpackers[0]) ); ::Info("", "Adding LATCH unpacker");}
        if(detectors.Contains("tbox"))  {source->addUnpacker( new HTBoxUnpacker(startUnpackers[0]) );  ::Info("", "Adding TBOX unpacker");}

        if(detectors.Contains("rich")){
            ::Info("", "Adding RICH unpackers");

            for(UInt_t i=0; i<(sizeof(richUnpackers)/sizeof(Int_t)); i++){
                cout<<hex<<richUnpackers[i]<<", "<<dec<<flush;
                source->addUnpacker( new HRichUnpacker(richUnpackers[i]) );
            }
            cout<<endl;
        }

        if(detectors.Contains("mdc")){
            ::Info("", "Adding MDC unpackers");

            for(UInt_t i=0; i<(sizeof(mdcUnpackers)/sizeof(Int_t)); i++) {
                cout<<hex<<mdcUnpackers[i]<<", "<<dec<<flush;
                HMdcUnpacker* mdc_unpacker = new HMdcUnpacker(  mdcUnpackers[i], kFALSE );
                mdc_unpacker->setQuietMode(kTRUE,kFALSE);

                mdc_unpacker->setFillDataWord(kFALSE);
                //mdc_unpacker->setFillOepStatus(kTRUE);
                mdc_unpacker->setPersistencyDataword(kTRUE);
                mdc_unpacker->setPersistencyOepStatusData(kFALSE);
                source->addUnpacker( (HMdcUnpacker*)mdc_unpacker );
            }
            cout<<endl;
        }

        if(detectors.Contains("shower")){
            ::Info("", "Adding SHOWER unpackers");

            for(UInt_t i=0; i<(sizeof(showerUnpackers)/sizeof(Int_t)); i++) {
                cout<<hex<<showerUnpackers[i]<<", "<<dec<<flush;
                source->addUnpacker( new HShowerUnpacker(showerUnpackers[i]) );
            }
            cout<<endl;
        }

        if(detectors.Contains("tof")){
            ::Info("", "Adding TOF unpackers");

            for(UInt_t i=0; i<(sizeof(tofUnpackers)/sizeof(Int_t)); i++){
                cout<<hex<<tofUnpackers[i]<<", "<<dec<<flush;
                HTofTrb2Unpacker *tofUnp = new HTofTrb2Unpacker(tofUnpackers[i]);
                tofUnp->setDebugFlag(0);
                //tofUnp->setQuietMode();
                if(correctINL)tofUnp->setcorrectINL();
                tofUnp->removeTimeRef();
                source->addUnpacker( tofUnp );
            }
            cout<<endl;
        }

        if(detectors.Contains("start")){
            ::Info("", "Adding START unpackers");

                for(UInt_t i=0; i<(sizeof(startUnpackers)/sizeof(Int_t)); i++){
                    cout<<hex<<startUnpackers[i]<<", "<<dec<<flush;
                    HStart2Trb2Unpacker *startUnp = new HStart2Trb2Unpacker(startUnpackers[i]);
                    startUnp->setDebugFlag(0);
                    if(correctINL)startUnp->setcorrectINL();
                    //startUnp->setQuietMode();

                    source->addUnpacker( startUnp );
                }
            cout<<endl;
        }

        if(detectors.Contains("rpc")){
            ::Info("", "Adding RPC unpackers");
            for(UInt_t i=0; i<(sizeof(rpcUnpackers)/sizeof(Int_t)); i++){

                cout<<hex<<rpcUnpackers[i]<<", "<<dec<<flush;
                HRpcTrb2Unpacker *rpcTrb2Unpacker = new HRpcTrb2Unpacker(rpcUnpackers[i]);
                //rpcTrb2Unpacker->setQuietMode();
                rpcTrb2Unpacker->setDebugFlag(0);
                if(correctINL)rpcTrb2Unpacker->setcorrectINL();
                source->addUnpacker(rpcTrb2Unpacker);
            }
        }
        cout<<endl;

    } else if(beamtime == "apr12") {
        ::Info("", "Using apr12 setup");

        Int_t mdcUnpackers   [12] = {0x1100,0x1110,0x1120,0x1130,0x1140,0x1150,0x1000,0x1010,0x1020,0x1030,0x1040,0x1050};
        Int_t rpcUnpackers   [2]  = {0x8400,0x8410}; //
        Int_t startUnpackers [1]  = {0x8800};        //
        Int_t tofUnpackers   [1]  = {0x8600};        //
        Int_t wallUnpackers  [1]  = {0x8700};        //
        Int_t showerUnpackers[6]  = {0x3200,0x3210,0x3220,0x3230,0x3240,0x3250}; //
        Int_t richUnpackers  [3]  = {0x8300,0x8310,0x8320};


        if(detectors.Contains("wall")) {
            ::Info("", "Adding WALL unpackers");

            for(UInt_t i=0; i<(sizeof(wallUnpackers)/sizeof(Int_t)); i++)
            {
                cout<<hex<<wallUnpackers[i]<<", "<<dec<<flush;
                HWallTrb2Unpacker* wallUnpacker=new HWallTrb2Unpacker(wallUnpackers[i]);
                wallUnpacker->setQuietMode();
                wallUnpacker->removeTimeRef();
                source->addUnpacker( wallUnpacker);
            }
            cout<<endl;
        }

        if(detectors.Contains("latch")) {source->addUnpacker( new HLatchUnpacker(startUnpackers[0]) ); ::Info("", "Adding LATCH unpacker");}
        if(detectors.Contains("tbox"))  {source->addUnpacker( new HTBoxUnpacker(startUnpackers[0]) );  ::Info("", "Adding TBOX unpacker");}

        if(detectors.Contains("rich")){
            ::Info("", "Adding RICH unpackers");

            for(UInt_t i=0; i<(sizeof(richUnpackers)/sizeof(Int_t)); i++){
                cout<<hex<<richUnpackers[i]<<", "<<dec<<flush;
                source->addUnpacker( new HRichUnpacker(richUnpackers[i]) );
            }
            cout<<endl;
        }

        if(detectors.Contains("mdc")){
            ::Info("", "Adding MDC unpackers");

            for(UInt_t i=0; i<(sizeof(mdcUnpackers)/sizeof(Int_t)); i++) {
                cout<<hex<<mdcUnpackers[i]<<", "<<dec<<flush;
                HMdcUnpacker* mdc_unpacker = new HMdcUnpacker(  mdcUnpackers[i], kFALSE );
                mdc_unpacker->setQuietMode(kTRUE,kFALSE);

                mdc_unpacker->setFillDataWord(kFALSE);
                mdc_unpacker->setFillOepStatus(kTRUE);
                mdc_unpacker->setPersistencyDataword(kTRUE);
                mdc_unpacker->setPersistencyOepStatusData(kTRUE);
                source->addUnpacker( (HMdcUnpacker*)mdc_unpacker );
            }
            cout<<endl;
        }

        if(detectors.Contains("shower")){
            ::Info("", "Adding SHOWER unpackers");

            for(UInt_t i=0; i<(sizeof(showerUnpackers)/sizeof(Int_t)); i++) {
                cout<<hex<<showerUnpackers[i]<<", "<<dec<<flush;
                source->addUnpacker( new HShowerUnpacker(showerUnpackers[i]) );
            }
            cout<<endl;
        }

        if(detectors.Contains("tof")){
            ::Info("", "Adding TOF unpackers");

            for(UInt_t i=0; i<(sizeof(tofUnpackers)/sizeof(Int_t)); i++){
                cout<<hex<<tofUnpackers[i]<<", "<<dec<<flush;
                HTofTrb2Unpacker *tofUnp = new HTofTrb2Unpacker(tofUnpackers[i]);
                tofUnp->setDebugFlag(0);
                //tofUnp->setQuietMode();
                if(correctINL)tofUnp->setcorrectINL();
                tofUnp->removeTimeRef();
                source->addUnpacker( tofUnp );
            }
            cout<<endl;
        }

        if(detectors.Contains("start")){
            ::Info("", "Adding START unpackers");

            for(UInt_t i=0; i<(sizeof(startUnpackers)/sizeof(Int_t)); i++){
                cout<<hex<<startUnpackers[i]<<", "<<dec<<flush;
                HStart2Trb2Unpacker *startUnp = new HStart2Trb2Unpacker(startUnpackers[i]);
                startUnp->setDebugFlag(0);
                if(correctINL)startUnp->setcorrectINL();
                //startUnp->setQuietMode();
                //startUnp->disableTimeRef(); // new since apr12 , only for cosmics
                source->addUnpacker( startUnp );
            }
            cout<<endl;
        }

        if(detectors.Contains("rpc")){
            ::Info("", "Adding RPC unpackers");
            for(UInt_t i=0; i<(sizeof(rpcUnpackers)/sizeof(Int_t)); i++){

                cout<<hex<<rpcUnpackers[i]<<", "<<dec<<flush;
                HRpcTrb2Unpacker *rpcTrb2Unpacker = new HRpcTrb2Unpacker(rpcUnpackers[i]);
                //rpcTrb2Unpacker->setQuietMode();
                rpcTrb2Unpacker->setDebugFlag(0);
                if(correctINL)rpcTrb2Unpacker->setcorrectINL();
                source->addUnpacker(rpcTrb2Unpacker);
            }
        }
        cout<<endl;

    } else if(beamtime == "jul14") {
        ::Info("", "Using jul14 setup");

        Int_t mdcUnpackers   [12] = {0x1100,0x1110,0x1120,0x1130,0x1140,0x1150,0x1000,0x1010,0x1020,0x1030,0x1040,0x1050};
        Int_t rpcUnpackers   [3]  = {0x8400,0x8410,0x8420};
        Int_t startUnpackers [1]      = {0x8800};         // CTS-Hub
	Int_t startUnpackersTrb3 [2]  = {0x8880,0x8890};  // start+hodo
        Int_t pionTrackerUnpackers[2] = {0x8900,0x8910};
        Int_t tofUnpackers   [1]  = {0x8600};        //
        Int_t wallUnpackers  [1]  = {0x8700};        //
        Int_t showerUnpackers[6]  = {0x3200,0x3210,0x3220,0x3230,0x3240,0x3250}; //
        Int_t richUnpackers  [3]  = {0x8300,0x8310,0x8320};


        if(detectors.Contains("wall")) {
            ::Info("", "Adding WALL unpackers");

            for(UInt_t i=0; i<(sizeof(wallUnpackers)/sizeof(Int_t)); i++)
            {
                cout<<hex<<wallUnpackers[i]<<", "<<dec<<flush;
                HWallTrb2Unpacker* wallUnpacker=new HWallTrb2Unpacker(wallUnpackers[i]);
                wallUnpacker->setQuietMode();
                wallUnpacker->removeTimeRef();
                source->addUnpacker( wallUnpacker);
            }
            cout<<endl;
        }

        if(detectors.Contains("latch")) {source->addUnpacker( new HLatchUnpacker(startUnpackers[0]) ); ::Info("", "Adding LATCH unpacker");}
        if(detectors.Contains("tbox"))  {source->addUnpacker( new HTBoxUnpacker(startUnpackers[0]) );  ::Info("", "Adding TBOX unpacker");}

        if(detectors.Contains("rich")){
            ::Info("", "Adding RICH unpackers");

            for(UInt_t i=0; i<(sizeof(richUnpackers)/sizeof(Int_t)); i++){
                cout<<hex<<richUnpackers[i]<<", "<<dec<<flush;
                source->addUnpacker( new HRichUnpacker(richUnpackers[i]) );
            }
            cout<<endl;
        }

        if(detectors.Contains("mdc")){
            ::Info("", "Adding MDC unpackers");

            for(UInt_t i=0; i<(sizeof(mdcUnpackers)/sizeof(Int_t)); i++) {
                cout<<hex<<mdcUnpackers[i]<<", "<<dec<<flush;
                HMdcUnpacker* mdc_unpacker = new HMdcUnpacker(  mdcUnpackers[i], kFALSE );
                mdc_unpacker->setQuietMode(kTRUE,kFALSE);

                mdc_unpacker->setFillDataWord(kFALSE);
                mdc_unpacker->setFillOepStatus(kTRUE);
                mdc_unpacker->setPersistencyDataword(kTRUE);
                mdc_unpacker->setPersistencyOepStatusData(kFALSE);
                source->addUnpacker( (HMdcUnpacker*)mdc_unpacker );
            }
            cout<<endl;
        }

        if(detectors.Contains("shower")){
            ::Info("", "Adding SHOWER unpackers");

            for(UInt_t i=0; i<(sizeof(showerUnpackers)/sizeof(Int_t)); i++) {
                cout<<hex<<showerUnpackers[i]<<", "<<dec<<flush;
                source->addUnpacker( new HShowerUnpacker(showerUnpackers[i]) );
            }
            cout<<endl;
        }

        if(detectors.Contains("tof")){
            ::Info("", "Adding TOF unpackers");

            for(UInt_t i=0; i<(sizeof(tofUnpackers)/sizeof(Int_t)); i++){
                cout<<hex<<tofUnpackers[i]<<", "<<dec<<flush;
                HTofTrb2Unpacker *tofUnp = new HTofTrb2Unpacker(tofUnpackers[i]);
                tofUnp->setDebugFlag(0);
                //tofUnp->setQuietMode();
                if(correctINL)tofUnp->setcorrectINL();
                tofUnp->removeTimeRef();
                source->addUnpacker( tofUnp );
            }
            cout<<endl;
        }

        if(detectors.Contains("start")){
            ::Info("", "Adding START unpackers");

	    vector<UInt_t>ids;
	    for(UInt_t i=0; i<(sizeof(startUnpackersTrb3)/sizeof(Int_t)); i++){
		cout<<hex<<startUnpackersTrb3[i]<<", "<<dec<<flush;
		ids.push_back(startUnpackersTrb3[i]);
	    }
	    cout<<endl;

	    HStart2Trb3Unpacker *startUnp = new HStart2Trb3Unpacker(ids);
	    startUnp->setDebugFlag(0);
	    startUnp->setQuietMode();
	    startUnp->setCTSId(0x8000);
	    source->addUnpacker( startUnp );

        }

        if(detectors.Contains("piontracker")){
            ::Info("", "Adding PionTracker unpackers");

            for(UInt_t i=0; i<(sizeof(pionTrackerUnpackers)/sizeof(Int_t)); i++){
                cout<<hex<<pionTrackerUnpackers[i]<<", "<<dec<<flush;
                HPionTrackerTrb3Unpacker *pionTrackerUnp = new HPionTrackerTrb3Unpacker(pionTrackerUnpackers[i]);
                pionTrackerUnp->setDebugFlag(0);
                pionTrackerUnp->setQuietMode();
                source->addUnpacker( pionTrackerUnp );
            }
            cout<<endl;
	}

        if(detectors.Contains("rpc")){
            ::Info("", "Adding RPC unpackers");
            for(UInt_t i=0; i<(sizeof(rpcUnpackers)/sizeof(Int_t)); i++){

                cout<<hex<<rpcUnpackers[i]<<", "<<dec<<flush;
                HRpcTrb2Unpacker *rpcTrb2Unpacker = new HRpcTrb2Unpacker(rpcUnpackers[i]);
                //rpcTrb2Unpacker->setQuietMode();
                rpcTrb2Unpacker->setDebugFlag(0);
                if(correctINL)rpcTrb2Unpacker->setcorrectINL();
                source->addUnpacker(rpcTrb2Unpacker);
            }
        }
        cout<<endl;
    }
    else if(beamtime == "aug18" || beamtime == "mar19") {

	if(beamtime == "aug18")::Info("", "Using aug18 setup");
	else                   ::Info("", "Using mar19 setup");

        Int_t mdcUnpackers   [12] = {0x1100,0x1110,0x1120,0x1130,0x1140,0x1150,0x1000,0x1010,0x1020,0x1030,0x1040,0x1050};
        Int_t rpcUnpackers   [3]  = {0x8400,0x8410,0x8420};
        Int_t startUnpackers [1]      = {0x8800};         // CTS-Hub
        Int_t startUnpackersTrb3 [1]  = {0x8880}; //start
        Int_t pionTrackerUnpackers[2] = {0x8900,0x8910};
        Int_t tofUnpackers   [1]  = {0x8600};        //
        Int_t wallUnpackers  [1]  = {0x8700};        //
        Int_t showerUnpackers[6]  = {0x3200,0x3210,0x3220,0x3230,0x3240,0x3250}; //
        Int_t richUnpackers  [12] = {0x83c0,0x83c1,0x83c2,0x83c3,0x83c4,0x83c5,0x83c6,0x83c7,0x83c8,0x83c9,0x83ca,0x83cb};
        Int_t emcUnpackers   [6] = {0x8A00,0x8A01,0x8A02,0x8A03,0x8A04,0x8A05};

        if(detectors.Contains("wall")) {
            ::Info("", "Adding WALL unpackers");

            for(UInt_t i=0; i<(sizeof(wallUnpackers)/sizeof(Int_t)); i++)
            {
                cout<<hex<<wallUnpackers[i]<<", "<<dec<<flush;
                HWallTrb2Unpacker* wallUnpacker=new HWallTrb2Unpacker(wallUnpackers[i]);
                wallUnpacker->setQuietMode();
                wallUnpacker->removeTimeRef();
                source->addUnpacker( wallUnpacker);
            }
            cout<<endl;
        }

        if(detectors.Contains("latch")) {source->addUnpacker( new HLatchUnpacker(startUnpackers[0]) ); ::Info("", "Adding LATCH unpacker");}
        if(detectors.Contains("tbox"))  {source->addUnpacker( new HTBoxUnpacker(startUnpackers[0]) );  ::Info("", "Adding TBOX unpacker");}

        if(detectors.Contains("rich")){
            ::Info("", "Adding RICH unpackers");
	    vector<UInt_t>ids;
	    for(UInt_t i=0; i<(sizeof(richUnpackers)/sizeof(Int_t)); i++){
		cout<<hex<<richUnpackers[i]<<", "<<dec<<flush;
		ids.push_back(richUnpackers[i]);
	    }
	    cout<<endl;

	    HRich700Trb3Unpacker* unp = new HRich700Trb3Unpacker(ids);
	    //unp->setMinAddress(Trbnet::kRICHTrb3MinTrbnetAddress);   // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
	    //unp->setMaxAddress(Trbnet::kRICHTrb3MaxTrbnetAddress);   // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
	    unp->setDebugFlag(0);
	    unp->setQuietMode();
	    source->addUnpacker( unp );

        }

        if(detectors.Contains("mdc")){
            ::Info("", "Adding MDC unpackers");

            for(UInt_t i=0; i<(sizeof(mdcUnpackers)/sizeof(Int_t)); i++) {
                cout<<hex<<mdcUnpackers[i]<<", "<<dec<<flush;
                HMdcUnpacker* mdc_unpacker = new HMdcUnpacker(  mdcUnpackers[i], kFALSE );
                mdc_unpacker->setQuietMode(kTRUE,kFALSE);

                mdc_unpacker->setFillDataWord(kFALSE);
                mdc_unpacker->setFillOepStatus(kTRUE);
                mdc_unpacker->setPersistencyDataword(kTRUE);
                mdc_unpacker->setPersistencyOepStatusData(kFALSE);
                source->addUnpacker( (HMdcUnpacker*)mdc_unpacker );
            }
            cout<<endl;
        }

        if(detectors.Contains("shower")){
            ::Info("", "Adding SHOWER unpackers");

            for(UInt_t i=0; i<(sizeof(showerUnpackers)/sizeof(Int_t)); i++) {
                cout<<hex<<showerUnpackers[i]<<", "<<dec<<flush;
                source->addUnpacker( new HShowerUnpacker(showerUnpackers[i]) );
            }
            cout<<endl;
        }

        if(detectors.Contains("tof")){
            ::Info("", "Adding TOF unpackers");

            for(UInt_t i=0; i<(sizeof(tofUnpackers)/sizeof(Int_t)); i++){
                cout<<hex<<tofUnpackers[i]<<", "<<dec<<flush;
                HTofTrb2Unpacker *tofUnp = new HTofTrb2Unpacker(tofUnpackers[i]);
                tofUnp->setDebugFlag(0);
                //tofUnp->setQuietMode();
                if(correctINL)tofUnp->setcorrectINL();
                tofUnp->removeTimeRef();
                source->addUnpacker( tofUnp );
            }
            cout<<endl;
        }

        if(detectors.Contains("start")){
            ::Info("", "Adding START unpackers");
	    vector<UInt_t>ids;
	    for(UInt_t i=0; i<(sizeof(startUnpackersTrb3)/sizeof(Int_t)); i++){
		cout<<hex<<startUnpackersTrb3[i]<<", "<<dec<<flush;
		ids.push_back(startUnpackersTrb3[i]);
	    }
	    cout<<endl;
	    HStart2Trb3Unpacker *startUnp = new HStart2Trb3Unpacker(ids);
	    startUnp->setDebugFlag(0);
	    startUnp->setQuietMode();
	    startUnp->setCTSId(0x8000);
	    //startUnp->setMinAddress(Trbnet::kStartTrb3MinTrbnetAddress);   // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
	    //startUnp->setMaxAddress(Trbnet::kStartTrb3MaxTrbnetAddress);   // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
	    source->addUnpacker( startUnp );
        }

        if(detectors.Contains("piontracker")){
            ::Info("", "Adding PionTracker unpackers");

            for(UInt_t i=0; i<(sizeof(pionTrackerUnpackers)/sizeof(Int_t)); i++){
                cout<<hex<<pionTrackerUnpackers[i]<<", "<<dec<<flush;
                HPionTrackerTrb3Unpacker *pionTrackerUnp = new HPionTrackerTrb3Unpacker(pionTrackerUnpackers[i]);
                pionTrackerUnp->setDebugFlag(0);
                pionTrackerUnp->setQuietMode();
                source->addUnpacker( pionTrackerUnp );
            }
            cout<<endl;

	 }

        if(detectors.Contains("rpc")){
            ::Info("", "Adding RPC unpackers");
            for(UInt_t i=0; i<(sizeof(rpcUnpackers)/sizeof(Int_t)); i++){

                cout<<hex<<rpcUnpackers[i]<<", "<<dec<<flush;
                HRpcTrb2Unpacker *rpcTrb2Unpacker = new HRpcTrb2Unpacker(rpcUnpackers[i]);
                //rpcTrb2Unpacker->setQuietMode();
                rpcTrb2Unpacker->setDebugFlag(0);
                if(correctINL)rpcTrb2Unpacker->setcorrectINL();
                source->addUnpacker(rpcTrb2Unpacker);
            }
            cout<<endl;
        }

        if(detectors.Contains("emc"))
        {
            ::Info("", "Adding Emc unpackers");
	    vector<UInt_t>ids;
	    for(UInt_t i=0; i<(sizeof(emcUnpackers)/sizeof(Int_t)); i++){
		cout<<hex<<emcUnpackers[i]<<", "<<dec<<flush;
		ids.push_back(emcUnpackers[i]);
	    }
	    cout << endl;
	    HEmcTrb3Unpacker * emcUnp = new HEmcTrb3Unpacker(ids);
	    //emcUnp->setMinAddress(Trbnet::kEmcTrb3MinTrbnetAddress);    // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
	    //emcUnp->setMaxAddress(Trbnet::kEmcTrb3MaxTrbnetAddress);    // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
	    emcUnp->setDebugFlag(0);
	    emcUnp->setQuietMode();
	    source->addUnpacker( emcUnp );
        }
    }

    else {

        ::Error( "setupUnpackers()","unknown beamtime = %s!",beamtime.Data());
        exit(1);
    }
}
 hdst.cc:1
 hdst.cc:2
 hdst.cc:3
 hdst.cc:4
 hdst.cc:5
 hdst.cc:6
 hdst.cc:7
 hdst.cc:8
 hdst.cc:9
 hdst.cc:10
 hdst.cc:11
 hdst.cc:12
 hdst.cc:13
 hdst.cc:14
 hdst.cc:15
 hdst.cc:16
 hdst.cc:17
 hdst.cc:18
 hdst.cc:19
 hdst.cc:20
 hdst.cc:21
 hdst.cc:22
 hdst.cc:23
 hdst.cc:24
 hdst.cc:25
 hdst.cc:26
 hdst.cc:27
 hdst.cc:28
 hdst.cc:29
 hdst.cc:30
 hdst.cc:31
 hdst.cc:32
 hdst.cc:33
 hdst.cc:34
 hdst.cc:35
 hdst.cc:36
 hdst.cc:37
 hdst.cc:38
 hdst.cc:39
 hdst.cc:40
 hdst.cc:41
 hdst.cc:42
 hdst.cc:43
 hdst.cc:44
 hdst.cc:45
 hdst.cc:46
 hdst.cc:47
 hdst.cc:48
 hdst.cc:49
 hdst.cc:50
 hdst.cc:51
 hdst.cc:52
 hdst.cc:53
 hdst.cc:54
 hdst.cc:55
 hdst.cc:56
 hdst.cc:57
 hdst.cc:58
 hdst.cc:59
 hdst.cc:60
 hdst.cc:61
 hdst.cc:62
 hdst.cc:63
 hdst.cc:64
 hdst.cc:65
 hdst.cc:66
 hdst.cc:67
 hdst.cc:68
 hdst.cc:69
 hdst.cc:70
 hdst.cc:71
 hdst.cc:72
 hdst.cc:73
 hdst.cc:74
 hdst.cc:75
 hdst.cc:76
 hdst.cc:77
 hdst.cc:78
 hdst.cc:79
 hdst.cc:80
 hdst.cc:81
 hdst.cc:82
 hdst.cc:83
 hdst.cc:84
 hdst.cc:85
 hdst.cc:86
 hdst.cc:87
 hdst.cc:88
 hdst.cc:89
 hdst.cc:90
 hdst.cc:91
 hdst.cc:92
 hdst.cc:93
 hdst.cc:94
 hdst.cc:95
 hdst.cc:96
 hdst.cc:97
 hdst.cc:98
 hdst.cc:99
 hdst.cc:100
 hdst.cc:101
 hdst.cc:102
 hdst.cc:103
 hdst.cc:104
 hdst.cc:105
 hdst.cc:106
 hdst.cc:107
 hdst.cc:108
 hdst.cc:109
 hdst.cc:110
 hdst.cc:111
 hdst.cc:112
 hdst.cc:113
 hdst.cc:114
 hdst.cc:115
 hdst.cc:116
 hdst.cc:117
 hdst.cc:118
 hdst.cc:119
 hdst.cc:120
 hdst.cc:121
 hdst.cc:122
 hdst.cc:123
 hdst.cc:124
 hdst.cc:125
 hdst.cc:126
 hdst.cc:127
 hdst.cc:128
 hdst.cc:129
 hdst.cc:130
 hdst.cc:131
 hdst.cc:132
 hdst.cc:133
 hdst.cc:134
 hdst.cc:135
 hdst.cc:136
 hdst.cc:137
 hdst.cc:138
 hdst.cc:139
 hdst.cc:140
 hdst.cc:141
 hdst.cc:142
 hdst.cc:143
 hdst.cc:144
 hdst.cc:145
 hdst.cc:146
 hdst.cc:147
 hdst.cc:148
 hdst.cc:149
 hdst.cc:150
 hdst.cc:151
 hdst.cc:152
 hdst.cc:153
 hdst.cc:154
 hdst.cc:155
 hdst.cc:156
 hdst.cc:157
 hdst.cc:158
 hdst.cc:159
 hdst.cc:160
 hdst.cc:161
 hdst.cc:162
 hdst.cc:163
 hdst.cc:164
 hdst.cc:165
 hdst.cc:166
 hdst.cc:167
 hdst.cc:168
 hdst.cc:169
 hdst.cc:170
 hdst.cc:171
 hdst.cc:172
 hdst.cc:173
 hdst.cc:174
 hdst.cc:175
 hdst.cc:176
 hdst.cc:177
 hdst.cc:178
 hdst.cc:179
 hdst.cc:180
 hdst.cc:181
 hdst.cc:182
 hdst.cc:183
 hdst.cc:184
 hdst.cc:185
 hdst.cc:186
 hdst.cc:187
 hdst.cc:188
 hdst.cc:189
 hdst.cc:190
 hdst.cc:191
 hdst.cc:192
 hdst.cc:193
 hdst.cc:194
 hdst.cc:195
 hdst.cc:196
 hdst.cc:197
 hdst.cc:198
 hdst.cc:199
 hdst.cc:200
 hdst.cc:201
 hdst.cc:202
 hdst.cc:203
 hdst.cc:204
 hdst.cc:205
 hdst.cc:206
 hdst.cc:207
 hdst.cc:208
 hdst.cc:209
 hdst.cc:210
 hdst.cc:211
 hdst.cc:212
 hdst.cc:213
 hdst.cc:214
 hdst.cc:215
 hdst.cc:216
 hdst.cc:217
 hdst.cc:218
 hdst.cc:219
 hdst.cc:220
 hdst.cc:221
 hdst.cc:222
 hdst.cc:223
 hdst.cc:224
 hdst.cc:225
 hdst.cc:226
 hdst.cc:227
 hdst.cc:228
 hdst.cc:229
 hdst.cc:230
 hdst.cc:231
 hdst.cc:232
 hdst.cc:233
 hdst.cc:234
 hdst.cc:235
 hdst.cc:236
 hdst.cc:237
 hdst.cc:238
 hdst.cc:239
 hdst.cc:240
 hdst.cc:241
 hdst.cc:242
 hdst.cc:243
 hdst.cc:244
 hdst.cc:245
 hdst.cc:246
 hdst.cc:247
 hdst.cc:248
 hdst.cc:249
 hdst.cc:250
 hdst.cc:251
 hdst.cc:252
 hdst.cc:253
 hdst.cc:254
 hdst.cc:255
 hdst.cc:256
 hdst.cc:257
 hdst.cc:258
 hdst.cc:259
 hdst.cc:260
 hdst.cc:261
 hdst.cc:262
 hdst.cc:263
 hdst.cc:264
 hdst.cc:265
 hdst.cc:266
 hdst.cc:267
 hdst.cc:268
 hdst.cc:269
 hdst.cc:270
 hdst.cc:271
 hdst.cc:272
 hdst.cc:273
 hdst.cc:274
 hdst.cc:275
 hdst.cc:276
 hdst.cc:277
 hdst.cc:278
 hdst.cc:279
 hdst.cc:280
 hdst.cc:281
 hdst.cc:282
 hdst.cc:283
 hdst.cc:284
 hdst.cc:285
 hdst.cc:286
 hdst.cc:287
 hdst.cc:288
 hdst.cc:289
 hdst.cc:290
 hdst.cc:291
 hdst.cc:292
 hdst.cc:293
 hdst.cc:294
 hdst.cc:295
 hdst.cc:296
 hdst.cc:297
 hdst.cc:298
 hdst.cc:299
 hdst.cc:300
 hdst.cc:301
 hdst.cc:302
 hdst.cc:303
 hdst.cc:304
 hdst.cc:305
 hdst.cc:306
 hdst.cc:307
 hdst.cc:308
 hdst.cc:309
 hdst.cc:310
 hdst.cc:311
 hdst.cc:312
 hdst.cc:313
 hdst.cc:314
 hdst.cc:315
 hdst.cc:316
 hdst.cc:317
 hdst.cc:318
 hdst.cc:319
 hdst.cc:320
 hdst.cc:321
 hdst.cc:322
 hdst.cc:323
 hdst.cc:324
 hdst.cc:325
 hdst.cc:326
 hdst.cc:327
 hdst.cc:328
 hdst.cc:329
 hdst.cc:330
 hdst.cc:331
 hdst.cc:332
 hdst.cc:333
 hdst.cc:334
 hdst.cc:335
 hdst.cc:336
 hdst.cc:337
 hdst.cc:338
 hdst.cc:339
 hdst.cc:340
 hdst.cc:341
 hdst.cc:342
 hdst.cc:343
 hdst.cc:344
 hdst.cc:345
 hdst.cc:346
 hdst.cc:347
 hdst.cc:348
 hdst.cc:349
 hdst.cc:350
 hdst.cc:351
 hdst.cc:352
 hdst.cc:353
 hdst.cc:354
 hdst.cc:355
 hdst.cc:356
 hdst.cc:357
 hdst.cc:358
 hdst.cc:359
 hdst.cc:360
 hdst.cc:361
 hdst.cc:362
 hdst.cc:363
 hdst.cc:364
 hdst.cc:365
 hdst.cc:366
 hdst.cc:367
 hdst.cc:368
 hdst.cc:369
 hdst.cc:370
 hdst.cc:371
 hdst.cc:372
 hdst.cc:373
 hdst.cc:374
 hdst.cc:375
 hdst.cc:376
 hdst.cc:377
 hdst.cc:378
 hdst.cc:379
 hdst.cc:380
 hdst.cc:381
 hdst.cc:382
 hdst.cc:383
 hdst.cc:384
 hdst.cc:385
 hdst.cc:386
 hdst.cc:387
 hdst.cc:388
 hdst.cc:389
 hdst.cc:390
 hdst.cc:391
 hdst.cc:392
 hdst.cc:393
 hdst.cc:394
 hdst.cc:395
 hdst.cc:396
 hdst.cc:397
 hdst.cc:398
 hdst.cc:399
 hdst.cc:400
 hdst.cc:401
 hdst.cc:402
 hdst.cc:403
 hdst.cc:404
 hdst.cc:405
 hdst.cc:406
 hdst.cc:407
 hdst.cc:408
 hdst.cc:409
 hdst.cc:410
 hdst.cc:411
 hdst.cc:412
 hdst.cc:413
 hdst.cc:414
 hdst.cc:415
 hdst.cc:416
 hdst.cc:417
 hdst.cc:418
 hdst.cc:419
 hdst.cc:420
 hdst.cc:421
 hdst.cc:422
 hdst.cc:423
 hdst.cc:424
 hdst.cc:425
 hdst.cc:426
 hdst.cc:427
 hdst.cc:428
 hdst.cc:429
 hdst.cc:430
 hdst.cc:431
 hdst.cc:432
 hdst.cc:433
 hdst.cc:434
 hdst.cc:435
 hdst.cc:436
 hdst.cc:437
 hdst.cc:438
 hdst.cc:439
 hdst.cc:440
 hdst.cc:441
 hdst.cc:442
 hdst.cc:443
 hdst.cc:444
 hdst.cc:445
 hdst.cc:446
 hdst.cc:447
 hdst.cc:448
 hdst.cc:449
 hdst.cc:450
 hdst.cc:451
 hdst.cc:452
 hdst.cc:453
 hdst.cc:454
 hdst.cc:455
 hdst.cc:456
 hdst.cc:457
 hdst.cc:458
 hdst.cc:459
 hdst.cc:460
 hdst.cc:461
 hdst.cc:462
 hdst.cc:463
 hdst.cc:464
 hdst.cc:465
 hdst.cc:466
 hdst.cc:467
 hdst.cc:468
 hdst.cc:469
 hdst.cc:470
 hdst.cc:471
 hdst.cc:472
 hdst.cc:473
 hdst.cc:474
 hdst.cc:475
 hdst.cc:476
 hdst.cc:477
 hdst.cc:478
 hdst.cc:479
 hdst.cc:480
 hdst.cc:481
 hdst.cc:482
 hdst.cc:483
 hdst.cc:484
 hdst.cc:485
 hdst.cc:486
 hdst.cc:487
 hdst.cc:488
 hdst.cc:489
 hdst.cc:490
 hdst.cc:491
 hdst.cc:492
 hdst.cc:493
 hdst.cc:494
 hdst.cc:495
 hdst.cc:496
 hdst.cc:497
 hdst.cc:498
 hdst.cc:499
 hdst.cc:500
 hdst.cc:501
 hdst.cc:502
 hdst.cc:503
 hdst.cc:504
 hdst.cc:505
 hdst.cc:506
 hdst.cc:507
 hdst.cc:508
 hdst.cc:509
 hdst.cc:510
 hdst.cc:511
 hdst.cc:512
 hdst.cc:513
 hdst.cc:514
 hdst.cc:515
 hdst.cc:516
 hdst.cc:517
 hdst.cc:518
 hdst.cc:519
 hdst.cc:520
 hdst.cc:521
 hdst.cc:522
 hdst.cc:523
 hdst.cc:524
 hdst.cc:525
 hdst.cc:526
 hdst.cc:527
 hdst.cc:528
 hdst.cc:529
 hdst.cc:530
 hdst.cc:531
 hdst.cc:532
 hdst.cc:533
 hdst.cc:534
 hdst.cc:535
 hdst.cc:536
 hdst.cc:537
 hdst.cc:538
 hdst.cc:539
 hdst.cc:540
 hdst.cc:541
 hdst.cc:542
 hdst.cc:543
 hdst.cc:544
 hdst.cc:545
 hdst.cc:546
 hdst.cc:547
 hdst.cc:548
 hdst.cc:549
 hdst.cc:550
 hdst.cc:551
 hdst.cc:552
 hdst.cc:553
 hdst.cc:554
 hdst.cc:555
 hdst.cc:556
 hdst.cc:557
 hdst.cc:558
 hdst.cc:559
 hdst.cc:560
 hdst.cc:561
 hdst.cc:562
 hdst.cc:563
 hdst.cc:564
 hdst.cc:565
 hdst.cc:566
 hdst.cc:567
 hdst.cc:568
 hdst.cc:569
 hdst.cc:570
 hdst.cc:571
 hdst.cc:572
 hdst.cc:573
 hdst.cc:574
 hdst.cc:575
 hdst.cc:576
 hdst.cc:577
 hdst.cc:578
 hdst.cc:579
 hdst.cc:580
 hdst.cc:581
 hdst.cc:582
 hdst.cc:583
 hdst.cc:584
 hdst.cc:585
 hdst.cc:586
 hdst.cc:587
 hdst.cc:588
 hdst.cc:589
 hdst.cc:590
 hdst.cc:591
 hdst.cc:592
 hdst.cc:593
 hdst.cc:594
 hdst.cc:595
 hdst.cc:596
 hdst.cc:597
 hdst.cc:598
 hdst.cc:599
 hdst.cc:600
 hdst.cc:601
 hdst.cc:602
 hdst.cc:603
 hdst.cc:604
 hdst.cc:605
 hdst.cc:606
 hdst.cc:607
 hdst.cc:608
 hdst.cc:609
 hdst.cc:610
 hdst.cc:611
 hdst.cc:612
 hdst.cc:613
 hdst.cc:614
 hdst.cc:615
 hdst.cc:616
 hdst.cc:617
 hdst.cc:618
 hdst.cc:619
 hdst.cc:620
 hdst.cc:621
 hdst.cc:622
 hdst.cc:623
 hdst.cc:624
 hdst.cc:625
 hdst.cc:626
 hdst.cc:627
 hdst.cc:628
 hdst.cc:629
 hdst.cc:630
 hdst.cc:631
 hdst.cc:632
 hdst.cc:633
 hdst.cc:634
 hdst.cc:635
 hdst.cc:636
 hdst.cc:637
 hdst.cc:638
 hdst.cc:639
 hdst.cc:640
 hdst.cc:641
 hdst.cc:642
 hdst.cc:643
 hdst.cc:644
 hdst.cc:645
 hdst.cc:646
 hdst.cc:647
 hdst.cc:648
 hdst.cc:649
 hdst.cc:650
 hdst.cc:651
 hdst.cc:652
 hdst.cc:653
 hdst.cc:654
 hdst.cc:655
 hdst.cc:656
 hdst.cc:657
 hdst.cc:658
 hdst.cc:659
 hdst.cc:660
 hdst.cc:661
 hdst.cc:662
 hdst.cc:663
 hdst.cc:664
 hdst.cc:665
 hdst.cc:666
 hdst.cc:667
 hdst.cc:668
 hdst.cc:669
 hdst.cc:670
 hdst.cc:671
 hdst.cc:672
 hdst.cc:673
 hdst.cc:674
 hdst.cc:675
 hdst.cc:676
 hdst.cc:677
 hdst.cc:678
 hdst.cc:679
 hdst.cc:680
 hdst.cc:681
 hdst.cc:682
 hdst.cc:683
 hdst.cc:684
 hdst.cc:685
 hdst.cc:686
 hdst.cc:687
 hdst.cc:688
 hdst.cc:689
 hdst.cc:690
 hdst.cc:691
 hdst.cc:692
 hdst.cc:693
 hdst.cc:694
 hdst.cc:695
 hdst.cc:696
 hdst.cc:697
 hdst.cc:698
 hdst.cc:699
 hdst.cc:700
 hdst.cc:701
 hdst.cc:702
 hdst.cc:703
 hdst.cc:704
 hdst.cc:705
 hdst.cc:706
 hdst.cc:707
 hdst.cc:708
 hdst.cc:709
 hdst.cc:710
 hdst.cc:711
 hdst.cc:712
 hdst.cc:713
 hdst.cc:714
 hdst.cc:715
 hdst.cc:716
 hdst.cc:717
 hdst.cc:718
 hdst.cc:719
 hdst.cc:720
 hdst.cc:721
 hdst.cc:722
 hdst.cc:723
 hdst.cc:724
 hdst.cc:725
 hdst.cc:726
 hdst.cc:727
 hdst.cc:728
 hdst.cc:729
 hdst.cc:730
 hdst.cc:731
 hdst.cc:732
 hdst.cc:733
 hdst.cc:734
 hdst.cc:735
 hdst.cc:736
 hdst.cc:737
 hdst.cc:738
 hdst.cc:739
 hdst.cc:740
 hdst.cc:741
 hdst.cc:742
 hdst.cc:743
 hdst.cc:744
 hdst.cc:745
 hdst.cc:746
 hdst.cc:747
 hdst.cc:748
 hdst.cc:749
 hdst.cc:750
 hdst.cc:751
 hdst.cc:752
 hdst.cc:753
 hdst.cc:754
 hdst.cc:755
 hdst.cc:756
 hdst.cc:757
 hdst.cc:758
 hdst.cc:759
 hdst.cc:760
 hdst.cc:761
 hdst.cc:762
 hdst.cc:763
 hdst.cc:764
 hdst.cc:765
 hdst.cc:766
 hdst.cc:767
 hdst.cc:768
 hdst.cc:769
 hdst.cc:770
 hdst.cc:771
 hdst.cc:772
 hdst.cc:773
 hdst.cc:774
 hdst.cc:775
 hdst.cc:776
 hdst.cc:777
 hdst.cc:778
 hdst.cc:779
 hdst.cc:780
 hdst.cc:781
 hdst.cc:782
 hdst.cc:783
 hdst.cc:784
 hdst.cc:785
 hdst.cc:786
 hdst.cc:787
 hdst.cc:788
 hdst.cc:789
 hdst.cc:790
 hdst.cc:791
 hdst.cc:792
 hdst.cc:793
 hdst.cc:794
 hdst.cc:795
 hdst.cc:796
 hdst.cc:797
 hdst.cc:798
 hdst.cc:799
 hdst.cc:800
 hdst.cc:801
 hdst.cc:802
 hdst.cc:803
 hdst.cc:804
 hdst.cc:805
 hdst.cc:806
 hdst.cc:807
 hdst.cc:808
 hdst.cc:809
 hdst.cc:810
 hdst.cc:811
 hdst.cc:812
 hdst.cc:813
 hdst.cc:814
 hdst.cc:815
 hdst.cc:816
 hdst.cc:817
 hdst.cc:818
 hdst.cc:819
 hdst.cc:820
 hdst.cc:821
 hdst.cc:822
 hdst.cc:823
 hdst.cc:824
 hdst.cc:825
 hdst.cc:826
 hdst.cc:827
 hdst.cc:828
 hdst.cc:829
 hdst.cc:830
 hdst.cc:831
 hdst.cc:832
 hdst.cc:833
 hdst.cc:834
 hdst.cc:835
 hdst.cc:836
 hdst.cc:837
 hdst.cc:838
 hdst.cc:839
 hdst.cc:840
 hdst.cc:841
 hdst.cc:842
 hdst.cc:843
 hdst.cc:844
 hdst.cc:845
 hdst.cc:846
 hdst.cc:847
 hdst.cc:848
 hdst.cc:849
 hdst.cc:850
 hdst.cc:851
 hdst.cc:852
 hdst.cc:853
 hdst.cc:854
 hdst.cc:855
 hdst.cc:856
 hdst.cc:857
 hdst.cc:858
 hdst.cc:859
 hdst.cc:860
 hdst.cc:861
 hdst.cc:862
 hdst.cc:863
 hdst.cc:864
 hdst.cc:865
 hdst.cc:866
 hdst.cc:867
 hdst.cc:868
 hdst.cc:869
 hdst.cc:870
 hdst.cc:871
 hdst.cc:872
 hdst.cc:873
 hdst.cc:874
 hdst.cc:875
 hdst.cc:876
 hdst.cc:877
 hdst.cc:878
 hdst.cc:879
 hdst.cc:880
 hdst.cc:881
 hdst.cc:882
 hdst.cc:883
 hdst.cc:884
 hdst.cc:885
 hdst.cc:886
 hdst.cc:887
 hdst.cc:888
 hdst.cc:889
 hdst.cc:890
 hdst.cc:891
 hdst.cc:892
 hdst.cc:893
 hdst.cc:894
 hdst.cc:895
 hdst.cc:896
 hdst.cc:897
 hdst.cc:898
 hdst.cc:899
 hdst.cc:900
 hdst.cc:901
 hdst.cc:902
 hdst.cc:903
 hdst.cc:904
 hdst.cc:905
 hdst.cc:906
 hdst.cc:907
 hdst.cc:908
 hdst.cc:909
 hdst.cc:910
 hdst.cc:911
 hdst.cc:912
 hdst.cc:913
 hdst.cc:914
 hdst.cc:915
 hdst.cc:916
 hdst.cc:917
 hdst.cc:918
 hdst.cc:919
 hdst.cc:920
 hdst.cc:921
 hdst.cc:922
 hdst.cc:923
 hdst.cc:924
 hdst.cc:925
 hdst.cc:926
 hdst.cc:927
 hdst.cc:928
 hdst.cc:929
 hdst.cc:930
 hdst.cc:931
 hdst.cc:932
 hdst.cc:933
 hdst.cc:934
 hdst.cc:935
 hdst.cc:936
 hdst.cc:937
 hdst.cc:938
 hdst.cc:939
 hdst.cc:940
 hdst.cc:941
 hdst.cc:942
 hdst.cc:943
 hdst.cc:944
 hdst.cc:945
 hdst.cc:946
 hdst.cc:947
 hdst.cc:948
 hdst.cc:949
 hdst.cc:950
 hdst.cc:951
 hdst.cc:952
 hdst.cc:953
 hdst.cc:954
 hdst.cc:955
 hdst.cc:956
 hdst.cc:957
 hdst.cc:958
 hdst.cc:959
 hdst.cc:960
 hdst.cc:961
 hdst.cc:962
 hdst.cc:963
 hdst.cc:964
 hdst.cc:965
 hdst.cc:966
 hdst.cc:967
 hdst.cc:968
 hdst.cc:969
 hdst.cc:970
 hdst.cc:971
 hdst.cc:972
 hdst.cc:973
 hdst.cc:974
 hdst.cc:975
 hdst.cc:976
 hdst.cc:977