slicPandora/tests
diff -N JobTest.cpp
--- JobTest.cpp 22 Feb 2010 19:44:15 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,158 +0,0 @@
-/*
- * File: main.cpp
- * Author: ngraf
- *
- * Created on December 1, 2009, 2:18 AM
- */
-
-#include <stdlib.h>
-#include <iostream>
-
-#include "lcio.h"
-
-#include "IO/LCReader.h"
-#include "IO/LCWriter.h"
-#include "IMPL/LCTOOLS.h"
-#include "EVENT/LCRunHeader.h"
-
-
-#include "SlicPandoraPFANewProcessor.h"
-#include "CalorimeterHitMaker.h"
-
-static std::vector<std::string> FILEN;
-
-using namespace std;
-using namespace lcio;
-
-/*
- *
- */
-int main(int argc, char** argv)
-{
- cout << "Hello from sidPandora" << endl;
-
-
- // read file names from command line (only argument)
- if (argc < 2)
- {
- cout << " usage: slicpandoramain <input-file1> <pandora settings xml file>" << endl;
- exit(1);
- }
- // for (int i = 1; i < argc; i++)
- // {
- FILEN.push_back(argv[1]);
- string xmlFileName = argv[2];
- cout << "Processing file " << argv[1] << endl;
- cout << "using " << xmlFileName << endl;
- // }
- int nFiles = 1;
-
- LCReader* lcReader = LCFactory::getInstance()->createLCReader();
-
- LCWriter* lcWriter = LCFactory::getInstance()->createLCWriter();
- try
- {
- lcWriter->setCompressionLevel(9);
- lcWriter->open("reco.slcio", LCIO::WRITE_NEW);
- } catch (IOException& e)
- {
- cout << "[RunEventProcessor()] Can't open file for writing - "
- << e.what() << endl;
- exit(1);
- }
-
-
- // first we read the run information
-
- cout << "creating processors" << endl;
- CalorimeterHitMaker chitmaker;
- SlicPandoraPFANewProcessor processor(xmlFileName);
-
- // PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraApi::ReadSettings(_pandora, "C:/work/ilc/software/C++/PandoraPFA/PandoraSettings.xml"));
- // for reading from one file only use sth. like:
- // const char* FILEN = "recjob.slcio" ;
- // cout << " will open and read from files: " << endl;
- // for (int i = 0; i < nFiles; i++)
- // {
- // cout << " " << FILEN[i] << endl;
- // }
-
- int maxNumberOfEvents = 1;
- int events = 0;
-
- //
- // lcReader->open(FILEN);
- // LCRunHeader *runHdr;
- //
- // // use a try catch block here: if sth. went wrong with reading the run data we
- // // still can try and read the event data - see below
- // try
- // {
- // // loop over all run headers
- // while ((runHdr = lcReader->readNextRunHeader()) != 0)
- // {
- // LCTOOLS::dumpRunHeader(runHdr);
- // // cout << " Run : " << runHdr->getRunNumber()
- // // << " - " << runHdr->getDetectorName()
- // // << ": " << runHdr->getDescription() << endl ;
- //
- //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->CreateTracks(pLCEvent));
- //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->CreateCaloHits(pLCEvent));
- //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraApi::ProcessEvent(m_pandora));
- //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->ProcessParticleFlowObjects(pLCEvent));
- //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraApi::Reset(m_pandora));
- // if(++events >= maxNumberOfEvents) break;
- // }
- //
- // } catch (IOException& e)
- // {
- // cout << " io error when reading run data : " << e.what() << endl;
- // }
- // cout << endl;
- //
- // lcReader->close();
-
-
- // now loop over the file again and dump event data
-
- lcReader->open(FILEN);
-
- // cout << " reopened " << FILEN << " for reading " << endl ;
- cout << " will open and read from files: " << endl;
- for (int i = 0; i < nFiles; i++)
- {
- cout << " " << FILEN[i] << endl;
- }
-
- LCEvent* evt;
- int nEvents = 0;
-
- //----------- the event loop -----------
- while ((evt = lcReader->readNextEvent()) != 0)
- {
- LCTOOLS::dumpEvent(evt);
- // create CalorimeterHits...
- chitmaker.processEvent(evt);
- // run pandoraPFA...
- processor.processEvent(evt);
- cout << " done with processing this event" << endl;
- // print out the contents of the reconstruction
- LCTOOLS::dumpEvent(evt);
- lcWriter->writeEvent(evt);
- if (++nEvents >= maxNumberOfEvents) break;
-
- }
- // -------- end of event loop -----------
-
- cout << endl << " " << nEvents << " events read from files: " << endl;
- for (int i = 0; i < nFiles; i++)
- {
- cout << " " << FILEN[i] << endl;
- }
-
- lcReader->close();
- lcWriter->close();
-
- delete lcReader;
- return (EXIT_SUCCESS);
-}