///////////////////////////////////////////////////////////////////////////////
#include <TVirtualMCApplication.h>
+#include <TVirtualMC.h>
#include <TGeoManager.h>
#include <TObjString.h>
#include <TSystem.h>
fDeleteIntermediateFiles(kFALSE),
fWriteSelRawData(kFALSE),
fStopOnError(kFALSE),
-
fNEvents(1),
fConfigFileName(configFileName),
fGAliceFileName("galice.root"),
fQATasks("ALL"),
fQASteer(NULL),
fRunQA(kTRUE),
+ fEventSpecie(AliRecoParam::kDefault),
fRunHLT("default"),
fWriteGRPEntry(kTRUE)
{
fQASteer->SetTasks(fQATasks) ;
}
-//_____________________________________________________________________________
-AliSimulation::AliSimulation(const AliSimulation& sim) :
- TNamed(sim),
-
- fRunGeneration(sim.fRunGeneration),
- fRunSimulation(sim.fRunSimulation),
- fLoadAlignFromCDB(sim.fLoadAlignFromCDB),
- fLoadAlObjsListOfDets(sim.fLoadAlObjsListOfDets),
- fMakeSDigits(sim.fMakeSDigits),
- fMakeDigits(sim.fMakeDigits),
- fMakeTrigger(sim.fMakeTrigger),
- fMakeDigitsFromHits(sim.fMakeDigitsFromHits),
- fWriteRawData(sim.fWriteRawData),
- fRawDataFileName(""),
- fDeleteIntermediateFiles(kFALSE),
- fWriteSelRawData(kFALSE),
- fStopOnError(sim.fStopOnError),
-
- fNEvents(sim.fNEvents),
- fConfigFileName(sim.fConfigFileName),
- fGAliceFileName(sim.fGAliceFileName),
- fEventsPerFile(),
- fBkgrdFileNames(NULL),
- fAlignObjArray(NULL),
- fUseBkgrdVertex(sim.fUseBkgrdVertex),
- fRegionOfInterest(sim.fRegionOfInterest),
- fCDBUri(sim.fCDBUri),
- fSpecCDBUri(),
- fRun(-1),
- fSeed(0),
- fInitCDBCalled(sim.fInitCDBCalled),
- fInitRunNumberCalled(sim.fInitRunNumberCalled),
- fSetRunNumberFromDataCalled(sim.fSetRunNumberFromDataCalled),
- fEmbeddingFlag(sim.fEmbeddingFlag),
- fQADetectors(sim.fQADetectors),
- fQATasks(sim.fQATasks),
- fQASteer(sim.fQASteer),
- fRunQA(sim.fRunQA),
- fRunHLT(sim.fRunHLT),
- fWriteGRPEntry(sim.fWriteGRPEntry)
-{
-// copy constructor
-
- for (Int_t i = 0; i < sim.fEventsPerFile.GetEntriesFast(); i++) {
- if (!sim.fEventsPerFile[i]) continue;
- fEventsPerFile.Add(sim.fEventsPerFile[i]->Clone());
- }
-
- fBkgrdFileNames = new TObjArray;
- for (Int_t i = 0; i < sim.fBkgrdFileNames->GetEntriesFast(); i++) {
- if (!sim.fBkgrdFileNames->At(i)) continue;
- fBkgrdFileNames->Add(sim.fBkgrdFileNames->At(i)->Clone());
- }
-
- for (Int_t i = 0; i < sim.fSpecCDBUri.GetEntriesFast(); i++) {
- if (sim.fSpecCDBUri[i]) fSpecCDBUri.Add(sim.fSpecCDBUri[i]->Clone());
- }
- fgInstance = this;
-}
-
-//_____________________________________________________________________________
-AliSimulation& AliSimulation::operator = (const AliSimulation& sim)
-{
-// assignment operator
-
- this->~AliSimulation();
- new(this) AliSimulation(sim);
- return *this;
-}
-
//_____________________________________________________________________________
AliSimulation::~AliSimulation()
{
AliRunLoader* runLoader = LoadRun("READ");
if (!runLoader) return kFALSE;
else {
- runData = runLoader->GetAliRun()->GetHeader()->GetRun();
+ runData = runLoader->GetHeader()->GetRun();
delete runLoader;
}
// Set run number in CDBManager
AliInfo(Form("Run number: %d",AliCDBManager::Instance()->GetRun()));
- AliRunLoader* runLoader = gAlice->GetRunLoader();
+ AliRunLoader* runLoader = AliRunLoader::GetRunLoader();
if (!runLoader) {
AliError(Form("gAlice has no run loader object. "
"Check your config file: %s", fConfigFileName.Data()));
MisalignGeometry(runLoader);
#endif
-// AliRunLoader* runLoader = gAlice->GetRunLoader();
+// AliRunLoader* runLoader = AliRunLoader::GetRunLoader();
// if (!runLoader) {
// AliError(Form("gAlice has no run loader object. "
// "Check your config file: %s", fConfigFileName.Data()));
AliInfo("running gAlice");
AliSysInfo::AddStamp("Start_simulation");
- StdoutToAliInfo(StderrToAliError(
- gAlice->Run(nEvents);
- ););
+
+ gAlice->InitMC("Config.C");
+
+ // Create the Root Tree with one branch per detector
+ //Hits moved to begin event -> now we are crating separate tree for each event
+
+ gMC->ProcessRun(nEvents);
+
+ // End of this run, close files
+ if(nEvents>0) gAlice->FinishRun();
+
AliSysInfo::AddStamp("Stop_simulation");
delete runLoader;
if (!SetRunNumberFromData()) if (fStopOnError) return kFALSE;
SetCDBLock();
- while (AliRunLoader::GetRunLoader()) delete AliRunLoader::GetRunLoader();
- if (gAlice) delete gAlice;
+ delete AliRunLoader::GetRunLoader();
+ delete gAlice;
gAlice = NULL;
Int_t nStreams = 1;
dateFileName, runLoader->GetNumberOfEvents(),runLoader->GetHeader()->GetRun());
FILE* pipe = gSystem->OpenPipe(command, "w");
+ if (!pipe) {
+ AliError(Form("Cannot execute command: %s",command));
+ return kFALSE;
+ }
+
Int_t selEvents = 0;
for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
{
// delete existing run loaders, open a new one and load gAlice
- while (AliRunLoader::GetRunLoader()) delete AliRunLoader::GetRunLoader();
+ delete AliRunLoader::GetRunLoader();
AliRunLoader* runLoader =
AliRunLoader::Open(fGAliceFileName.Data(),
AliConfig::GetDefaultEventFolderName(), mode);
Int_t iDet;
//
// Get the runloader
- AliRunLoader* runLoader = gAlice->GetRunLoader();
+ AliRunLoader* runLoader = AliRunLoader::GetRunLoader();
//
// Open esd file if available
TFile* esdFile = TFile::Open(esdFileName);
typedef void (*CompileInfo)( char*& date, char*& time);
CompileInfo fctInfo=(CompileInfo)gSystem->DynFindSymbol(ALIHLTSIMULATION_LIBRARY, "CompileInfo");
if (fctInfo) {
- char* date="";
- char* time="";
- (*fctInfo)(date, time);
- if (!date) date="unknown";
- if (!time) time="unknown";
+ Char_t* date=0;
+ Char_t* time=0;
+ (*fctInfo)(date,time);
+ if (!date) {date=new Char_t[8]; strcpy(date,"unknown");}
+ if (!time) {time=new Char_t[8]; strcpy(time,"unknown");}
AliInfo(Form("%s build on %s (%s)", ALIHLTSIMULATION_LIBRARY, date, time));
+ delete date;
+ delete time;
} else {
AliInfo(Form("no build info available for %s", ALIHLTSIMULATION_LIBRARY));
}
// run the QA on summable hits, digits or digits
if(!gAlice) return kFALSE;
- fQASteer->SetRunLoader(gAlice->GetRunLoader()) ;
+ fQASteer->SetRunLoader(AliRunLoader::GetRunLoader()) ;
TString detectorsw("") ;
Bool_t rv = kTRUE ;
+ fQASteer->SetEventSpecie(fEventSpecie) ;
detectorsw = fQASteer->Run(fQADetectors.Data()) ;
if ( detectorsw.IsNull() )
rv = kFALSE ;
- else
- fQASteer->EndOfCycle(detectorsw) ;
return rv ;
}
fRunQA = kTRUE ;
fQASteer->SetActiveDetectors(fQADetectors) ;
fQASteer->SetTasks(fQATasks) ;
+ for (Int_t det = 0 ; det < AliQA::kNDET ; det++)
+ fQASteer->SetWriteExpert(AliQA::DETECTORINDEX_t(det)) ;
+
return kTRUE;
}
}
//---------------------------------------------------------------------
-
void AliSimulation::WriteGRPEntry()
{
// Get the necessary information from galice (generator, trigger etc) and
TString target;
gen->GetTarget(target,a,z);
TString beamType = projectile + "-" + target;
+ beamType.ReplaceAll(" ","");
if (!beamType.CompareTo("-")) {
-
- grpObj->SetBeamType("UNKNOWN");
+ grpObj->SetBeamType("UNKNOWN");
}
else {
- grpObj->SetBeamType(beamType);
+ grpObj->SetBeamType(beamType);
+ // Heavy ion run, the event specie is set to kHighMult
+ fEventSpecie = AliRecoParam::kHighMult;
+ if ((strcmp(beamType,"p-p") == 0) ||
+ (strcmp(beamType,"p-") == 0) ||
+ (strcmp(beamType,"-p") == 0) ||
+ (strcmp(beamType,"P-P") == 0) ||
+ (strcmp(beamType,"P-") == 0) ||
+ (strcmp(beamType,"-P") == 0)) {
+ // Proton run, the event specie is set to kLowMult
+ fEventSpecie = AliRecoParam::kLowMult;
+ }
}
- }
- else {
+ } else {
AliWarning("Unknown beam type and energy! Setting energy to 0");
grpObj->SetBeamEnergy(0);
grpObj->SetBeamType("UNKNOWN");
nDets++;
}
}
+ // CTP
+ if (!fMakeTrigger.IsNull() || strcmp(gAlice->GetTriggerDescriptor(),""))
+ detectorPattern |= (1 << AliDAQ::DetectorID("TRG"));
+
// HLT
if (!fRunHLT.IsNull())
detectorPattern |= (1 << AliDAQ::kHLTId);
// Now store the entry in OCDB
AliCDBManager* man = AliCDBManager::Instance();
- AliCDBId id("GRP/GRP/Data", man->GetRun(), man->GetRun());
+ AliCDBId id("GRP/GRP/Data", man->GetRun(), man->GetRun(), 1, 1);
AliCDBMetaData *metadata= new AliCDBMetaData();
metadata->SetResponsible("alice-off@cern.ch");