-// Create new AliMUONTransientDigit and add it to the fTDList
-
- fTDList->AddAtAndExpand(
- new AliMUONTransientDigit(fNch,fDigits),fCounter);
- fHitMap[fNch]->SetHit(padhit->PadX(),padhit->PadY(),fCounter);
- AliMUONTransientDigit* pdigit =
- (AliMUONTransientDigit*)fTDList->Last();
- // list of tracks
- Int_t track, charge;
- track = fTrack+fMask;
- if (fSignal) {
- charge = padhit->QPad();
- } else {
- charge = kBgTag;
- }
- pdigit->AddToTrackList(track,charge);
- fCounter++;
+/// The main work loop starts here.
+/// The digitization process is broken up into two steps:
+/// 1) Loop over input streams and create transient digits from the input.
+/// Done in GenerateTransientDigits()
+/// 2) Loop over the generated transient digits and write them to the output
+/// stream. Done in CreateDigits()
+
+ AliDebug(1, "Running digitiser.");
+
+ if (fManager->GetNinputs() == 0)
+ {
+ AliWarning("No inputs set, nothing to do.");
+ return;
+ }
+
+ if (!FetchLoaders(fManager->GetInputFolderName(0), fRunLoader, fGime) ) return;
+ if (! FetchGlobalPointers(fRunLoader) ) return;
+ if (! FetchTriggerPointer(fGime) ) return;
+
+ InitArrays();
+
+ AliDebug(2, Form("Event Number is %d.", fManager->GetOutputEventNr()));
+
+ // Loop over files to merge and to digitize
+ fSignal = kTRUE;
+ for (Int_t inputFile = 0; inputFile < fManager->GetNinputs(); inputFile++)
+ {
+ fMask = fManager->GetMask(inputFile);
+ AliDebug(2, Form("Digitising folder %d, with fMask = %d: %s", inputFile, fMask,
+ (const char*)fManager->GetInputFolderName(inputFile)));
+
+ if (inputFile != 0)
+ // If this is the first file then we already have the loaders loaded.
+ if (! FetchLoaders(fManager->GetInputFolderName(inputFile), fRunLoader, fGime) )
+ continue;
+ else
+ // If this is not the first file then it is assumed to be background.
+ fSignal = kFALSE;
+
+ if (! InitInputData(fGime) ) continue;
+ GenerateTransientDigits();
+ CleanupInputData(fGime);
+ }
+
+ Bool_t ok = FetchLoaders(fManager->GetOutputFolderName(), fRunLoader, fGime);
+ if (ok) ok = InitOutputData(fGime);
+ if (ok) CreateDigits();
+ if (ok) CreateTrigger();
+ if (ok) CleanupOutputData(fGime);
+
+ CleanupArrays();
+ CleanupTriggerArrays();