#include <TSystem.h>
#include <TDirectory.h>
#include <TVirtualMC.h>
+#include <TGeoManager.h>
+#include <TString.h>
#include "AliLog.h"
#include "AliConfig.h"
#include "AliRun.h"
#include "AliTrackReference.h"
#include "AliMC.h"
-#include "../RAW/AliRawDataHeader.h"
+#include "AliRawDataHeader.h"
+
+#include "AliDAQ.h"
ClassImp(AliModule)
// nwbuf number of user words
//
Int_t kmat;
- gMC->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
- (*fIdmate)[imat]=kmat;
+ //Build the string uniquename as "DET_materialname"
+ TString uniquename = GetName();
+ uniquename.Append("_");
+ uniquename.Append(name);
+ //if geometry loaded from file only fill fIdmate, else create material too
+ if(gAlice->IsRootGeometry()){
+ TGeoMaterial *mat = gGeoManager->GetMaterial(uniquename.Data());
+ kmat = mat->GetUniqueID();
+ (*fIdmate)[imat]=kmat;
+ }else{
+ gMC->Material(kmat, uniquename.Data(), a, z, dens, radl, absl, buf, nwbuf);
+ (*fIdmate)[imat]=kmat;
+ }
}
//_______________________________________________________________________
// wmat array of concentrations
//
Int_t kmat;
- gMC->Mixture(kmat, name, a, z, dens, nlmat, wmat);
- (*fIdmate)[imat]=kmat;
+ //Build the string uniquename as "DET_mixturename"
+ TString uniquename = GetName();
+ uniquename.Append("_");
+ uniquename.Append(name);
+ //if geometry loaded from file only fill fIdmate, else create mixture too
+ if(gAlice->IsRootGeometry()){
+ TGeoMaterial *mat = gGeoManager->GetMaterial(uniquename.Data());
+ kmat = mat->GetUniqueID();
+ (*fIdmate)[imat]=kmat;
+ }else{
+ gMC->Mixture(kmat, uniquename.Data(), a, z, dens, nlmat, wmat);
+ (*fIdmate)[imat]=kmat;
+ }
}
//_______________________________________________________________________
// = 3 constant magnetic field along z
//
Int_t kmed;
- gMC->Medium(kmed,name, (*fIdmate)[nmat], isvol, ifield, fieldm,
- tmaxfd, stemax, deemax, epsil, stmin, ubuf, nbuf);
- (*fIdtmed)[numed]=kmed;
+ //Build the string uniquename as "DET_mediumname"
+ TString uniquename = GetName();
+ uniquename.Append("_");
+ uniquename.Append(name);
+ //if geometry loaded from file only fill fIdtmed, else create medium too
+ if(gAlice->IsRootGeometry()){
+ TGeoMedium *med = gGeoManager->GetMedium(uniquename.Data());
+ kmed = med->GetId();
+ (*fIdtmed)[numed]=kmed;
+ }else{
+ gMC->Medium(kmed, uniquename.Data(), (*fIdmate)[nmat], isvol, ifield,
+ fieldm, tmaxfd, stemax, deemax, epsil, stmin, ubuf, nbuf);
+ (*fIdtmed)[numed]=kmed;
+ }
}
//_______________________________________________________________________
// Called at finish primary
//
if (!fTrackReferences) return;
- for (Int_t i=0;i<fTrackReferences->GetEntries();i++){
+ Int_t nEntries = fTrackReferences->GetEntries();
+
+ for (Int_t i=0;i<nEntries;i++){
AliTrackReference * ref = dynamic_cast<AliTrackReference*>(fTrackReferences->UncheckedAt(i));
if (ref) {
Int_t newID = map[ref->GetTrack()];
if (newID>=0) ref->SetTrack(newID);
else {
- //ref->SetTrack(-1);
ref->SetBit(kNotDeleted,kFALSE);
fTrackReferences->RemoveAt(i);
}
}
//_____________________________________________________________________________
-void AliModule::AddTrackReference(Int_t label){
+AliTrackReference* AliModule::AddTrackReference(Int_t label){
//
// add a trackrefernce to the list
if (!fTrackReferences) {
AliError("Container trackrefernce not active");
- return;
+ return 0;
}
Int_t nref = fTrackReferences->GetEntriesFast();
TClonesArray &lref = *fTrackReferences;
- new(lref[nref]) AliTrackReference(label);
+ return new(lref[nref]) AliTrackReference(label);
}
AliWarning(Form("Dummy version called for %s", GetName()));
- const Int_t kNDetectors = 17;
- const char* kDetectors[kNDetectors] = {"TPC", "ITSSPD", "ITSSDD", "ITSSSD", "TRD", "TOF", "PHOS", "RICH", "EMCAL", "MUON", "MUTR", "ZDC", "PMD", "START", "VZERO", "CRT", "FMD"};
- const Int_t kDetectorDDLs[kNDetectors] = {216, 20, 12, 16, 18, 72, 20, 20, 22, 20, 2, 1, 6, 1, 1, 1, 3};
- Int_t nDDLs = 1;
- Int_t ddlOffset = 0;
- for (Int_t i = 0; i < kNDetectors; i++) {
- if (strcmp(GetName(), kDetectors[i]) == 0) {
- nDDLs = kDetectorDDLs[i];
- ddlOffset = 0x100 * i;
- }
- }
+ Int_t nDDLs = AliDAQ::NumberOfDdls(GetName());
if (!GetLoader()) return;
fstream digitsFile(GetLoader()->GetDigitsFileName(), ios::in);
for (Int_t iDDL = 0; iDDL < nDDLs; iDDL++) {
char fileName[20];
- sprintf(fileName, "%s_%d.ddl", GetName(), iDDL + ddlOffset);
+ strcpy(fileName,AliDAQ::DdlFileName(GetName(),iDDL));
fstream rawFile(fileName, ios::out);
if (!rawFile) return;