// ************************************************************************** // This file is property of and copyright by the CBM HLT Project * // CBM Experiment at FAIR, All rights reserved. * // * // * // Primary Authors: Igor Kulakov * // Maksym Zyzak * // Ivan Kisel * // * // Permission to use, copy, modify and distribute this software and its * // documentation strictly for non-commercial purposes is hereby granted * // without fee, provided that the above copyright notice appears in all * // copies and that both the copyright notice and this permission notice * // appear in the supporting documentation. The authors make no claims * // about the suitability of this software for any purpose. It is * // provided "as is" without express or implied warranty. * // * //*************************************************************************** #include #include #include #include using namespace std; //#include "L1AlgoInter.h" #include "TaskManager.h" #include "InputDataArray.h" #include "L1AlgoInputMCData.h" #include "TStopwatch.h" int main(int argc, char **argv) { int iVerbose = 0; int firstEvent = 0; int lastEvent = 0; int StartTime = -1; bool fullTiming = 0; string filePrefix = "./Events/"; for( int i=1; i < argc; i++ ){ if ( !std::strcmp( argv[i], "-h" ) || !std::strcmp( argv[i], "--help" ) || !std::strcmp( argv[i], "-help" ) ) { // usage(argv[0]); return 0; } else if ( !std::strcmp( argv[i], "-perf" ) ) { iVerbose = 1; } else if ( !std::strcmp( argv[i], "-VerboseLevel" ) && ++i < argc ) { iVerbose = atoi( argv[i] ); } else if ( !std::strcmp( argv[i], "-time" ) ) { fullTiming = true; } else if ( !std::strcmp( argv[i], "-dir" ) && ++i < argc ) { filePrefix = argv[i]; } else if ( !std::strcmp( argv[i], "-StartTime" ) && ++i < argc ) { StartTime = atoi( argv[i] ); } else if ( !std::strcmp( argv[i], "-ev" ) && ++i < argc ) { firstEvent = atoi( argv[i] ); if (++i < argc){ lastEvent = atoi( argv[i] ); std::cout << "Only process events " << firstEvent << ",..," << lastEvent << std::endl; } else{ lastEvent = firstEvent; // std::cout << "Only process event " << lastEvent << std::endl; } } else if (firstEvent == lastEvent) { firstEvent = atoi( argv[i] ); lastEvent = firstEvent; } else { std::cout << " Incorrect option: " << argv[i] << " was ignored. "<< std::endl; } } InputDataArray InputData; InputMCDataArray InputMCData; { std::string LocalfilePrefix = filePrefix; LocalfilePrefix += "/"; const int NEventsToRead = lastEvent+1; InputData.fInput = new L1AlgoInputData[NEventsToRead]; InputData.fSettings = new L1AlgoInputSettings; InputMCData.fMCInput = new L1AlgoInputMCData[NEventsToRead]; if(!InputData.fSettings->ReadSettingsFromFile(LocalfilePrefix.data(), iVerbose)) { std::cout << "Setting can not be read" << std::endl; } for ( int kEvents = firstEvent; kEvents <= lastEvent; kEvents++ ) { if (!InputData.fInput[kEvents].ReadHitsFromFile(LocalfilePrefix.data(), NEventsToRead, iVerbose)) { cout << "Hits Data for Event " << kEvents << " can't be read." << std::endl; break; } if(iVerbose>0) { if (!InputMCData.fMCInput[kEvents].ReadMCDataFromFile(LocalfilePrefix.data(), NEventsToRead, iVerbose)) { cout << "MC Data for Event " << kEvents << " can't be read." << std::endl; break; } } } } TaskManager manager; manager.Init( InputData.fSettings, iVerbose ); for ( int iE = firstEvent; iE <= lastEvent; iE++ ) { if(iVerbose>0) manager.SetData( &(InputData.fInput[iE]), &(InputMCData.fMCInput[iE]) ); else manager.SetData( &(InputData.fInput[iE]) ); manager.Run(); } if(iVerbose>0) manager.PrintEff(); return 0; }