#include "AliMC.h"
#include "AliRawDataHeader.h"
-#include "AliDAQConfig.h"
+#include "AliDAQ.h"
ClassImp(AliModule)
+Float_t AliModule::fgDensityFactor = 1.0;
+
//_______________________________________________________________________
AliModule::AliModule():
fEuclidMaterial(""),
fHistograms(0),
fNodes(0),
fEnable(1),
- fTrackReferences(0),
fMaxIterTrackRef(0),
fCurrentIterTrackRef(0),
fRunLoader(0)
fHistograms(new TList()),
fNodes(new TList()),
fEnable(1),
- fTrackReferences(new TClonesArray("AliTrackReference", 100)),
fMaxIterTrackRef(0),
fCurrentIterTrackRef(0),
fRunLoader(0)
// Add this Module to the global list of Modules in Run.
//
// Get the Module numeric ID
+
Int_t id = gAlice->GetModuleID(name);
if (id>=0) {
// Module already added !
gAlice->AddModule(this);
- SetMarkerColor(3);
+ //PH SetMarkerColor(3);
//
// Clear space for tracking media and material indexes
for(Int_t i=0;i<100;i++) (*fIdmate)[i]=(*fIdtmed)[i]=0;
}
-//_______________________________________________________________________
-AliModule::AliModule(const AliModule &mod):
- TNamed(mod),
- TAttLine(mod),
- TAttMarker(mod),
- AliRndm(mod),
- fEuclidMaterial(""),
- fEuclidGeometry(""),
- fIdtmed(0),
- fIdmate(0),
- fLoMedium(0),
- fHiMedium(0),
- fActive(0),
- fHistograms(0),
- fNodes(0),
- fEnable(0),
- fTrackReferences(0),
- fMaxIterTrackRef(0),
- fCurrentIterTrackRef(0),
- fRunLoader(0)
-{
- //
- // Copy constructor
- //
- mod.Copy(*this);
-}
-
//_______________________________________________________________________
AliModule::~AliModule()
{
delete fHistograms;
fHistograms = 0;
}
- // Delete track references
- if (fTrackReferences) {
- fTrackReferences->Delete();
- delete fTrackReferences;
- fTrackReferences = 0;
- }
// Delete TArray objects
delete fIdtmed;
delete fIdmate;
}
-//_______________________________________________________________________
-void AliModule::Copy(TObject & /* mod */) const
-{
- //
- // Copy *this onto mod, not implemented for AliModule
- //
- AliFatal("Not implemented!");
-}
-
//_______________________________________________________________________
void AliModule::Disable()
{
kmat = mat->GetUniqueID();
(*fIdmate)[imat]=kmat;
}else{
- gMC->Material(kmat, uniquename.Data(), a, z, dens, radl, absl, buf, nwbuf);
+ if (fgDensityFactor != 1.0)
+ AliWarning(Form("Material density multiplied by %.2f!", fgDensityFactor));
+ gMC->Material(kmat, uniquename.Data(), a, z, dens * fgDensityFactor, radl, absl, buf, nwbuf);
(*fIdmate)[imat]=kmat;
}
}
kmat = mat->GetUniqueID();
(*fIdmate)[imat]=kmat;
}else{
- gMC->Mixture(kmat, uniquename.Data(), a, z, dens, nlmat, wmat);
+ if (fgDensityFactor != 1.0)
+ AliWarning(Form("Material density multiplied by %.2f!", fgDensityFactor));
+ gMC->Mixture(kmat, uniquename.Data(), a, z, dens * fgDensityFactor, nlmat, wmat);
(*fIdmate)[imat]=kmat;
}
}
}
//Pad the string with blanks
i=-1;
- while(natmed[++i]);
+ while(natmed[++i]) ;
while(i<20) natmed[i++]=' ';
natmed[i]='\0';
//
if (nwbuf>0) for(i=0;i<nwbuf;i++) fscanf(lun,"%f",&ubuf[i]);
//Pad the string with blanks
i=-1;
- while(namate[++i]);
+ while(namate[++i]) ;
while(i<20) namate[i++]=' ';
namate[i]='\0';
//
if (fieldm<0) fieldm=sxmgmx;
//Pad the string with blanks
i=-1;
- while(natmed[++i]);
+ while(natmed[++i]) ;
while(i<20) natmed[i++]=' ';
natmed[i]='\0';
//
}
//_______________________________________________________________________
-void AliModule::RemapTrackReferencesIDs(Int_t *map)
+void AliModule::AddAlignableVolumes() const
{
//
- // Remapping track reference
- // Called at finish primary
- //
- if (!fTrackReferences) return;
- for (Int_t i=0;i<fTrackReferences->GetEntries();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);
- }
- }
- }
- fTrackReferences->Compress();
-
+ if (IsActive())
+ AliWarning(Form(" %s still has to implement the AddAlignableVolumes method!",GetName()));
}
-
//_______________________________________________________________________
-AliTrackReference* AliModule::FirstTrackReference(Int_t track)
-{
- //
- // Initialise the hit iterator
- // Return the address of the first hit for track
- // If track>=0 the track is read from disk
- // while if track<0 the first hit of the current
- // track is returned
- //
- if(track>=0)
- {
- if (fRunLoader == 0x0)
- AliFatal("AliRunLoader not initialized. Can not proceed");
- fRunLoader->GetAliRun()->GetMCApp()->ResetTrackReferences();
- fRunLoader->TreeTR()->GetEvent(track);
- }
- //
- fMaxIterTrackRef = fTrackReferences->GetEntriesFast();
- fCurrentIterTrackRef = 0;
- if(fMaxIterTrackRef) return dynamic_cast<AliTrackReference*>(fTrackReferences->UncheckedAt(0));
- else return 0;
-}
-
-//_______________________________________________________________________
-AliTrackReference* AliModule::NextTrackReference()
-{
- //
- // Return the next hit for the current track
- //
- if(fMaxIterTrackRef) {
- if(++fCurrentIterTrackRef<fMaxIterTrackRef)
- return dynamic_cast<AliTrackReference*>(fTrackReferences->UncheckedAt(fCurrentIterTrackRef));
- else
- return 0;
- } else {
- AliWarning("Iterator called without calling FistTrackReference before");
- return 0;
- }
-}
-
-
-//_______________________________________________________________________
-void AliModule::ResetTrackReferences()
-{
- //
- // Reset number of hits and the hits array
- //
- fMaxIterTrackRef = 0;
- if (fTrackReferences) fTrackReferences->Clear();
-}
-
-//_____________________________________________________________________________
AliLoader* AliModule::MakeLoader(const char* /*topfoldername*/)
{
return 0x0;
}
-//PH Merged with v3-09-08 |
-// V
-//_____________________________________________________________________________
-
-void AliModule::SetTreeAddress()
-{
- //
- // Set branch address for track reference Tree
- //
-
- TBranch *branch;
-
- // Branch address for track reference tree
- TTree *treeTR = TreeTR();
-
- if (treeTR && fTrackReferences) {
- branch = treeTR->GetBranch(GetName());
- if (branch)
- {
- AliDebug(3, Form("(%s) Setting for TrackRefs",GetName()));
- branch->SetAddress(&fTrackReferences);
- }
- else
- {
- //can be called before MakeBranch and than does not make sense to issue the warning
- AliDebug(1, Form("(%s) Failed for Track References. Can not find branch in tree.",
- GetName()));
- }
- }
-}
//_____________________________________________________________________________
-void AliModule::AddTrackReference(Int_t label){
+AliTrackReference* AliModule::AddTrackReference(Int_t label, Int_t id){
//
// add a trackrefernce to the list
- if (!fTrackReferences) {
- AliError("Container trackrefernce not active");
- return;
- }
- Int_t nref = fTrackReferences->GetEntriesFast();
- TClonesArray &lref = *fTrackReferences;
- new(lref[nref]) AliTrackReference(label);
-}
-
-
-//_____________________________________________________________________________
-void AliModule::MakeBranchTR(Option_t */*option*/)
-{
- //
- // Makes branch in treeTR
- //
- AliDebug(2,Form("Making Track Refs. Branch for %s",GetName()));
- TTree * tree = TreeTR();
- if (fTrackReferences && tree)
- {
- TBranch *branch = tree->GetBranch(GetName());
- if (branch)
- {
- AliDebug(2,Form("Branch %s is already in tree.",GetName()));
- return;
- }
-
- branch = tree->Branch(GetName(),&fTrackReferences);
- }
- else
- {
- AliDebug(2,Form("FAILED for %s: tree=%#x fTrackReferences=%#x",
- GetName(),tree,fTrackReferences));
- }
+ return (gAlice->GetMCApp()->AddTrackReference(label, id));
}
//_____________________________________________________________________________
AliWarning(Form("Dummy version called for %s", GetName()));
- 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;