]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/MUON/src/AliRoot/TriggerSource.cxx
Coding conventions
[u/mrichter/AliRoot.git] / HLT / MUON / src / AliRoot / TriggerSource.cxx
index 6a69377de2c7c5066ea8a420774b9d2eef042da5..20af321179be59578be95b0ca1e750596677c801 100644 (file)
@@ -5,6 +5,12 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 
+/* AliHLTMUONTriggerSource is used to extract L0 trigger information for
+   the muon spectrometer from a simulated event stored in .root files by AliRoot.
+   It is used by the AliHLTMUONMicrodHLT class as a input data set for the
+   dHLT algorithm.
+ */
 #include "AliRoot/TriggerSource.hpp"
 #include "AliRoot/Base.hpp"
 #include "Tracking/Calculations.hpp"
 #endif
 
 ClassImp(AliHLTMUONTriggerSource)
-ClassImp(AliHLTMUONTriggerSource::EventData)
+ClassImp(AliHLTMUONTriggerSource::AliEventData)
 
 
 AliHLTMUONTriggerSource::AliHLTMUONTriggerSource()
-       : TObject(), fEventList(AliHLTMUONTriggerSource::EventData::Class())
+       : TObject(), fEventList(AliHLTMUONTriggerSource::AliEventData::Class())
 {
-       fAreaToUse = FromWholePlane;
-       fDataToUse = FromLocalTriggers;
+// Default constructor.
+
+       fAreaToUse = kFromWholePlane;
+       fDataToUse = kFromLocalTriggers;
        fMaxBlockSize = 0xFFFFFFFF;
        fUseLookupTable = kTRUE;
        fFilename = "";
@@ -43,10 +51,12 @@ AliHLTMUONTriggerSource::AliHLTMUONTriggerSource()
 
 
 AliHLTMUONTriggerSource::AliHLTMUONTriggerSource(AliMUONDataInterface* data)
-       : TObject(), fEventList(AliHLTMUONTriggerSource::EventData::Class())
+       : TObject(), fEventList(AliHLTMUONTriggerSource::AliEventData::Class())
 {
-       fAreaToUse = FromWholePlane;
-       fDataToUse = FromLocalTriggers;
+// Creates a new trigger source object by filling data from the data interface.
+
+       fAreaToUse = kFromWholePlane;
+       fDataToUse = kFromLocalTriggers;
        fMaxBlockSize = 0xFFFFFFFF;
        fUseLookupTable = kTRUE;
        fFilename = "";
@@ -65,6 +75,9 @@ AliHLTMUONTriggerSource::~AliHLTMUONTriggerSource()
 
 void AliHLTMUONTriggerSource::FillFrom(AliMUONDataInterface* data)
 {
+// Fills the internal data structures from the specified data interface
+// for all the events found in AliMUONDataInterface.
+          
        DebugMsg(1, "FillFrom(AliMUONDataInterface*)");
        
        if (FileAndFolderOk(data))
@@ -84,6 +97,9 @@ void AliHLTMUONTriggerSource::FillFrom(AliMUONDataInterface* data)
 
 void AliHLTMUONTriggerSource::FillFrom(AliMUONDataInterface* data, Int_t event)
 {
+// Fills the internal data structures from the specified data interface
+// for the given event.
+
        DebugMsg(1, "FillFrom(AliMUONDataInterface*, Int_t)");
        
        if (FileAndFolderOk(data))
@@ -101,6 +117,16 @@ void AliHLTMUONTriggerSource::FillFrom(
                Int_t event, Int_t trigger, Bool_t newblock
        )
 {
+// Fills the internal data structures from the specified data interface
+// for the given event and trigger number.
+// If 'newblock' is set to true then the new trigger record is added to 
+// a new block. Otherwise the point is added to the current block.
+// Note: This method ignores the fAreaToUse and fMaxBlockSize flags.
+// This is very usefull for custom trigger source filling.
+// For the case of adding data from AliMUONHit objects the 'trigger'
+// parameter becomes the track number in TreeH and not the index of the
+// AliMUONLocalTrigger object.
+
        DebugMsg(1, "FillFrom(AliMUONDataInterface*, Int_t, Int_t, Bool_t)");
        
        if (FileAndFolderOk(data))
@@ -119,7 +145,7 @@ void AliHLTMUONTriggerSource::FillFrom(
                }
                else
                {
-                       if (fCurrentEvent->fEventNumber != event)
+                       if (fCurrentEvent->EventNumber() != event)
                        {
                                Bool_t found = GetEvent(event);
                                if ( ! found) AddEvent(event);
@@ -143,6 +169,8 @@ void AliHLTMUONTriggerSource::FillFrom(
 
 void AliHLTMUONTriggerSource::Clear(Option_t* /*option*/)
 {
+// Clears all the internal arrays.
+
        fFilename = "";
        fFoldername = "";
        ResetAllPointers();
@@ -152,13 +180,18 @@ void AliHLTMUONTriggerSource::Clear(Option_t* /*option*/)
 
 Bool_t AliHLTMUONTriggerSource::GetEvent(Int_t eventnumber) const
 {
+// Fetches the specified event number stored in this AliHLTMUONTriggerSource.
+// Sets the current block and trigger to the first block and trigger record in
+// the event. If there are no blocks or trigger records then these pointers are
+// set to NULL. kTRUE is returned if the event was found, kFALSE otherwise.
+
        DebugMsg(1, "AliHLTMUONTriggerSource::GetEvent(" << eventnumber << ")" );
        
        // Try find the corresponding event in the list of events.
        for (Int_t i = 0; i < fEventList.GetEntriesFast(); i++)
        {
-               EventData* current = (EventData*) fEventList[i];
-               if (current->fEventNumber == eventnumber)
+               AliEventData* current = (AliEventData*) fEventList[i];
+               if (current->EventNumber() == eventnumber)
                {
                        fEventIndex = i;
                        fCurrentEvent = current;
@@ -175,11 +208,16 @@ Bool_t AliHLTMUONTriggerSource::GetEvent(Int_t eventnumber) const
 
 Bool_t AliHLTMUONTriggerSource::GetFirstEvent() const
 {
+// Fetches the first event stored in this AliHLTMUONTriggerSource.
+// Sets the current block and trigger record to the first block and trigger
+// in the event. If there are no blocks or trigger records then these pointers
+// are set to NULL. kTRUE is returned if the event was found, kFALSE otherwise.
+
        DebugMsg(1, "AliHLTMUONTriggerSource::GetFirstEvent()");
        if (fEventList.GetEntriesFast() > 0)
        {
                fEventIndex = 0;
-               fCurrentEvent = (EventData*) fEventList[0];
+               fCurrentEvent = (AliEventData*) fEventList[0];
                GetFirstBlock();
                DebugMsg(2, "\tfEventIndex = " << fEventIndex << " , fBlockIndex = " << fBlockIndex
                        << " , fTriggerIndex = " << fTriggerIndex
@@ -198,16 +236,22 @@ Bool_t AliHLTMUONTriggerSource::GetFirstEvent() const
 
 Bool_t AliHLTMUONTriggerSource::MoreEvents() const
 {
+// Returns kTRUE if there are more events to iterate over.
+
        return 0 <= fEventIndex && fEventIndex < fEventList.GetEntriesFast();
 }
 
 
 Bool_t AliHLTMUONTriggerSource::GetNextEvent() const
 {
+// Fetches the next event stored following the currently selected one.
+// kTRUE is returned if the event was found, kFALSE otherwise.
+// The internal pointers are reset if we reached the last event.
+          
        DebugMsg(1, "AliHLTMUONTriggerSource::GetNextEvent()");
        if (fEventIndex < fEventList.GetEntriesFast() - 1)
        {
-               fCurrentEvent = (EventData*) fEventList[ ++fEventIndex ];
+               fCurrentEvent = (AliEventData*) fEventList[ ++fEventIndex ];
                GetFirstBlock();
                DebugMsg(2, "\tfEventIndex = " << fEventIndex << " , fBlockIndex = " << fBlockIndex
                        << " , fTriggerIndex = " << fTriggerIndex
@@ -224,8 +268,11 @@ Bool_t AliHLTMUONTriggerSource::GetNextEvent() const
 
 Int_t AliHLTMUONTriggerSource::CurrentEvent() const
 {
+// Returns the corresponding AliRoot event number for the current event.
+// -1 is returned if no event is selected.
+          
        if (fCurrentEvent != NULL)
-               return fCurrentEvent->fEventNumber;
+               return fCurrentEvent->EventNumber();
        else
                return -1;
 }
@@ -233,6 +280,9 @@ Int_t AliHLTMUONTriggerSource::CurrentEvent() const
 
 Int_t AliHLTMUONTriggerSource::NumberOfBlocks() const
 {
+// Returns the number of trigger record blocks in the current event.
+// -1 is returned if no event is selected.
+          
        DebugMsg(1, "AliHLTMUONTriggerSource::NumberOfBlocks()");
        if (fCurrentEvent == NULL)
        {
@@ -240,12 +290,17 @@ Int_t AliHLTMUONTriggerSource::NumberOfBlocks() const
                return -1;
        }
        else
-               return fCurrentEvent->fBlocks.GetEntriesFast();
+               return fCurrentEvent->Blocks().GetEntriesFast();
 }
 
 
 Bool_t AliHLTMUONTriggerSource::GetBlock(Int_t index) const
 {
+// Fetches the index'th block in the current event.
+// Sets the current trigger record to the first trigger in the block.
+// If there are no trigger records then this pointer is set to NULL.
+// kTRUE is returned if the block was found, kFALSE otherwise.
+
        DebugMsg(1, "AliHLTMUONTriggerSource::GetBlock(" << index << ")");
        
        // Note NumberOfBlocks() also checks if the event was selected.
@@ -255,7 +310,7 @@ Bool_t AliHLTMUONTriggerSource::GetBlock(Int_t index) const
        if ( 0 <= index && index < numberofblocks )
        {
                fBlockIndex = index;
-               fCurrentBlock = (TClonesArray*) fCurrentEvent->fBlocks[index];
+               fCurrentBlock = (TClonesArray*) fCurrentEvent->Blocks()[index];
                GetFirstTrigger();
                DebugMsg(2, "\tfEventIndex = " << fEventIndex << " , fBlockIndex = " << fBlockIndex
                        << " , fTriggerIndex = " << fTriggerIndex
@@ -282,12 +337,17 @@ Bool_t AliHLTMUONTriggerSource::GetBlock(Int_t index) const
 
 Bool_t AliHLTMUONTriggerSource::GetFirstBlock() const
 {
+// Fetches the first block in the current event.
+// Sets the current trigger record to the first trigger in the block.
+// If there are no trigger records then this pointer is set to NULL.
+// kTRUE is returned if the block was found, kFALSE otherwise.
+          
        DebugMsg(1, "AliHLTMUONTriggerSource::GetFirstBlock()");
        // Note: NumberOfBlocks() also checks if fCurrentEvent != NULL.
        if (NumberOfBlocks() > 0)
        {
                fBlockIndex = 0;
-               fCurrentBlock = (TClonesArray*) fCurrentEvent->fBlocks[fBlockIndex];
+               fCurrentBlock = (TClonesArray*) fCurrentEvent->Blocks()[fBlockIndex];
                GetFirstTrigger();
                DebugMsg(2, "\tfEventIndex = " << fEventIndex << " , fBlockIndex = " << fBlockIndex
                        << " , fTriggerIndex = " << fTriggerIndex
@@ -301,19 +361,24 @@ Bool_t AliHLTMUONTriggerSource::GetFirstBlock() const
 
 Bool_t AliHLTMUONTriggerSource::MoreBlocks() const
 {
+// Returns kTRUE if there are more blocks to be traversed.
+
        return 0 <= fBlockIndex && fBlockIndex < NumberOfBlocks();
 }
 
 
 Bool_t AliHLTMUONTriggerSource::GetNextBlock() const
 {
+// Fetches the next block in the current event.
+// kTRUE is returned if the block was found, kFALSE otherwise.
+          
        DebugMsg(1, "AliHLTMUONTriggerSource::GetNextBlock()");
 
        // Note: NumberOfBlocks() checks if fCurrentEvent != NULL. If it is then it returns -1
        // and since fBlockIndex is always >= -1 the if statement must go to the else part.
        if (fBlockIndex < NumberOfBlocks() - 1)
        {
-               fCurrentBlock = (TClonesArray*) fCurrentEvent->fBlocks[ ++fBlockIndex ];
+               fCurrentBlock = (TClonesArray*) fCurrentEvent->Blocks()[ ++fBlockIndex ];
                GetFirstTrigger();
                DebugMsg(2, "\tfEventIndex = " << fEventIndex << " , fBlockIndex = " << fBlockIndex
                        << " , fTriggerIndex = " << fTriggerIndex
@@ -330,6 +395,9 @@ Bool_t AliHLTMUONTriggerSource::GetNextBlock() const
 
 Int_t AliHLTMUONTriggerSource::NumberOfTriggers() const
 {
+// Returns the number of trigger records in the current block.
+// -1 is returned if no block is selected.
+
        DebugMsg(1, "AliHLTMUONTriggerSource::NumberOfTriggers()");
        if (fCurrentBlock == NULL)
        {
@@ -343,6 +411,10 @@ Int_t AliHLTMUONTriggerSource::NumberOfTriggers() const
 
 const AliHLTMUONTriggerRecord* AliHLTMUONTriggerSource::GetTrigger(Int_t triggernumber) const
 {
+// Fetches the trigger record with the specified trigger number from
+// the current block.
+// NULL is returned if the record was not found.
+
        DebugMsg(1, "AliHLTMUONTriggerSource::GetTrigger(" << triggernumber << ")");
 
        if (fCurrentBlock == NULL)
@@ -371,6 +443,9 @@ const AliHLTMUONTriggerRecord* AliHLTMUONTriggerSource::GetTrigger(Int_t trigger
 
 const AliHLTMUONTriggerRecord* AliHLTMUONTriggerSource::GetFirstTrigger() const
 {
+// Fetches the first trigger record in the current block.
+// NULL is returned if the record was not found.
+
        DebugMsg(1, "AliHLTMUONTriggerSource::GetFirstTrigger()");
        // Note: NumberOfTriggers() also checks if fCurrentBlock != NULL.
        if (NumberOfTriggers() > 0)
@@ -389,12 +464,17 @@ const AliHLTMUONTriggerRecord* AliHLTMUONTriggerSource::GetFirstTrigger() const
 
 Bool_t AliHLTMUONTriggerSource::MoreTriggers() const
 {
+// Returns kTRUE if there are more triggers to iterate over.
+
        return 0 <= fTriggerIndex && fTriggerIndex < NumberOfTriggers();
 }
 
 
 const AliHLTMUONTriggerRecord* AliHLTMUONTriggerSource::GetNextTrigger() const
 {
+// Fetches the next trigger record in the current block.
+// NULL is returned if the record was not found.
+
        DebugMsg(1, "AliHLTMUONTriggerSource::GetNextTrigger()");
        
        // Note: NumberOfTriggers() checks if fCurrentBlock != NULL. If it is then it returns -1
@@ -417,6 +497,11 @@ const AliHLTMUONTriggerRecord* AliHLTMUONTriggerSource::GetNextTrigger() const
 
 Int_t AliHLTMUONTriggerSource::CurrentTrigger() const
 {
+// Returns the trigger record number for the currently selected trigger record.
+// This number corresponds to the index'th AliMUONLocalTrigger object for the
+// current event.
+// -1 is returned if no trigger record is selected.
+
        if (fCurrentTrigger != NULL)
        {
                return fCurrentTrigger->TriggerNumber();
@@ -431,13 +516,16 @@ Int_t AliHLTMUONTriggerSource::CurrentTrigger() const
 
 void AliHLTMUONTriggerSource::AddEvent(Int_t eventnumber)
 {
+// Adds a new AliEventData block to the fEventList and updates the fCurrentEvent,
+// fCurrentBlock and fCurrentTrigger pointers.
+
        DebugMsg(1, "AliHLTMUONTriggerSource::AddEvent(" << eventnumber << ")");
        Assert( eventnumber >= 0 );
 
        // Assume the eventnumber does not already exist in the event list.
        fEventIndex = fEventList.GetEntriesFast();
-       new ( fEventList[fEventIndex] ) EventData(eventnumber);
-       fCurrentEvent = (EventData*) fEventList[fEventIndex];
+       new ( fEventList[fEventIndex] ) AliEventData(eventnumber);
+       fCurrentEvent = (AliEventData*) fEventList[fEventIndex];
        
        // Remember to reset the other pointers because the new event is empty.
        ResetBlockPointers();
@@ -450,6 +538,8 @@ void AliHLTMUONTriggerSource::AddEvent(Int_t eventnumber)
 
 void AliHLTMUONTriggerSource::AddBlock()
 {
+// Adds a new block to the current event and updates fCurrentBlock and fCurrentTrigger.
+
        DebugMsg(1, "AliHLTMUONTriggerSource::AddBlock()");
        
        if (fCurrentEvent == NULL)
@@ -458,9 +548,9 @@ void AliHLTMUONTriggerSource::AddBlock()
                return;
        }
        
-       fBlockIndex = fCurrentEvent->fBlocks.GetEntriesFast();
-       new ( fCurrentEvent->fBlocks[fBlockIndex] ) TClonesArray(AliHLTMUONTriggerRecord::Class());
-       fCurrentBlock = (TClonesArray*) fCurrentEvent->fBlocks[fBlockIndex];
+       fBlockIndex = fCurrentEvent->Blocks().GetEntriesFast();
+       new ( fCurrentEvent->Blocks()[fBlockIndex] ) TClonesArray(AliHLTMUONTriggerRecord::Class());
+       fCurrentBlock = (TClonesArray*) fCurrentEvent->Blocks()[fBlockIndex];
        
        // Remember to reset the trigger pointer because the new block is empty.
        ResetTriggerPointers();
@@ -473,6 +563,9 @@ void AliHLTMUONTriggerSource::AddBlock()
 
 void AliHLTMUONTriggerSource::AddTrigger(const AliHLTMUONTriggerRecord& data)
 {
+// Adds a new trigger record to the current event and block.
+// The fCurrentTrigger is updated appropriately.
+
        DebugMsg(1, "AliHLTMUONTriggerSource::AddTrigger(" << (void*)&data << ")");
 
        if (fCurrentBlock == NULL)
@@ -493,6 +586,11 @@ void AliHLTMUONTriggerSource::AddTrigger(const AliHLTMUONTriggerRecord& data)
 
 Bool_t AliHLTMUONTriggerSource::FileAndFolderOk(AliMUONDataInterface* data)
 {
+// Checks if the file and folder names correspond to this AliHLTMUONTriggerSource's 
+// file and folder names. kTRUE is returned if they do.
+// If the file and folder names are empty then they are assigned the names
+// as found in the data interface and kTRUE is returned.
+
        if (fFilename == "")
        {
                // Nothing filled yet so set the file and folder names.
@@ -525,6 +623,10 @@ Bool_t AliHLTMUONTriggerSource::FileAndFolderOk(AliMUONDataInterface* data)
 
 void AliHLTMUONTriggerSource::AddEventFrom(AliMUONDataInterface* data, AliMUON* module, Int_t event)
 {
+// Adds the whole event from the data interface to the internal data structures.
+// It is assumed that FileAndFolderOk(data) returns true just before calling
+// this method.
+
        if ( data->GetEvent(event) )
        {
                AddEvent(event);
@@ -535,7 +637,7 @@ void AliHLTMUONTriggerSource::AddEventFrom(AliMUONDataInterface* data, AliMUON*
 
                switch (fDataToUse)
                {
-               case FromHits:
+               case kFromHits:
                        for (Int_t track = 0; track < data->NumberOfTracks(); track++)
                        {
                                if ( ! FillTriggerFromHits(data, track, trigdata) )
@@ -555,9 +657,9 @@ void AliHLTMUONTriggerSource::AddEventFrom(AliMUONDataInterface* data, AliMUON*
                        }
                        break;
 
-               case FromLocalTriggers:
+               case kFromLocalTriggers:
                        Assert( module != NULL );
-                       DebugMsg(4, "Taking FromLocalTriggers branch...");
+                       DebugMsg(4, "Taking kFromLocalTriggers branch...");
                        for (Int_t i = 0; i < data->NumberOfLocalTriggers(); i++)
                        {
                                DebugMsg(4, "for loop: i = " << i);
@@ -588,13 +690,17 @@ void AliHLTMUONTriggerSource::AddEventFrom(AliMUONDataInterface* data, AliMUON*
 
 void AliHLTMUONTriggerSource::AddTriggerFrom(AliMUONDataInterface* data, AliMUON* module, Int_t trigger)
 {
+// Adds the specified trigger record from the given data interface.
+// The data interface should be initialised correctly, that is the event
+// should already be selected before calling this method.
+
        DebugMsg(1, "Entering AddTriggerFrom");
 
        AliHLTMUONTriggerRecord trigdata;
 
        switch (fDataToUse)
        {
-       case FromHits:
+       case kFromHits:
                {
                // Note: in this case we treat the trigger parameter as a track number.
                if ( ! FillTriggerFromHits(data, trigger, trigdata) )
@@ -602,7 +708,7 @@ void AliHLTMUONTriggerSource::AddTriggerFrom(AliMUONDataInterface* data, AliMUON
                }
                break;
 
-       case FromLocalTriggers:
+       case kFromLocalTriggers:
                {
                Assert( module != NULL );
                AliMUONLocalTrigger* lt = data->LocalTrigger(trigger);
@@ -622,13 +728,17 @@ void AliHLTMUONTriggerSource::AddTriggerFrom(AliMUONDataInterface* data, AliMUON
 }
 
 
-Bool_t AliHLTMUONTriggerSource::InFillRegion(const AliHLTMUONTriggerRecord& data)
+Bool_t AliHLTMUONTriggerSource::InFillRegion(const AliHLTMUONTriggerRecord& data) const
 {
+// Checks to see if the specified trigger record is in the chamber region
+// we want to fill from.
+// kTRUE is returned if (x, y) is in the region, and kFALSE otherwise.
+
        switch (fAreaToUse)
        {
-       case FromWholePlane:     return kTRUE;
-       case FromLeftHalfPlane:  return data.Station1Point().fX <= 0;
-       case FromRightHalfPlane: return data.Station1Point().fX > 0;
+       case kFromWholePlane:     return kTRUE;
+       case kFromLeftHalfPlane:  return data.Station1Point().fX <= 0;
+       case kFromRightHalfPlane: return data.Station1Point().fX > 0;
 
        default:
                Error("InFillRegion", "fAreaToUse is not set to a valid value.");
@@ -641,6 +751,11 @@ void AliHLTMUONTriggerSource::FillTriggerFromLocalTrigger(
                AliMUONLocalTrigger* trigger, AliMUON* module, AliHLTMUONTriggerRecord& record
        )
 {
+// Fills the trigger data from the AliMUONLocalTrigger object.
+// if the fUseLookupTable is set to true then we use the L0 lookup table to
+// fill the Pt value otherwise we use the PtCal method in AliMUONTriggerCircuit.
+// Note the fTriggerNumber parameter is not filled in to 'record'.
+
        DebugMsg(2, "Creating TriggerRecord from AliMUONLocalTrigger object: " << (void*)trigger );
        AliMUONTriggerCircuit& circuit = module->TriggerCircuit(trigger->LoCircuit());
 
@@ -689,6 +804,10 @@ Bool_t AliHLTMUONTriggerSource::FillTriggerFromHits(
                AliMUONDataInterface* data, Int_t track, AliHLTMUONTriggerRecord& record
        )
 {
+// Fills the TriggerRecord structure from AliMUONHit objects.
+// The hits on the last 4 chambers are used (i.e. chambers 11 to 14).
+// kTRUE is returned if the structure was filled successfully.
+
        DebugMsg(2, "Creating TriggerRecord from hits on track: " << track );
        
        Float_t x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4;
@@ -807,9 +926,17 @@ Bool_t AliHLTMUONTriggerSource::FillTriggerFromHits(
 
 Bool_t AliHLTMUONTriggerSource::FetchAliMUON(AliMUON*& module)
 {
+// Fetches the AliMUON module from the AliRun global object. AliRun will be loaded
+// by the runloader if it has not yet been loaded. In such a case the AliRun object
+// will also we unloaded when we are done with it.
+// kTRUE is returned if no error occured and kFALSE otherwise.
+// Note that if fDataToUse is set to kFromHits then gAlice is not loaded and 'module'
+// will be left untouched. The method will still return kTRUE however since this is
+// not an error. We do not need the AliMUON module when filling from hits.
+
        // Check if we even need the MUON module. Not having to load it will
        // save a lot of loading time for AliRoot.
-       if (fDataToUse == FromHits)
+       if (fDataToUse == kFromHits)
        {
                // Make sure we do not attempt to unload gAlice in FinishedWithAliMUON,
                // by setting the fHadToLoadgAlice to false.
@@ -849,6 +976,11 @@ Bool_t AliHLTMUONTriggerSource::FetchAliMUON(AliMUON*& module)
 
 void AliHLTMUONTriggerSource::FinishedWithAliMUON()
 {
+// After one is finished with the AliMUON object returned by GetAliMUON, one
+// should call this method.
+// If the gAlice object was loaded by GetAliMUON then it will be unloaded at
+// this point, otherwise nothing is done.
+
        // Only unload the gAlice object if we had to load it ourselves.
        if (fHadToLoadgAlice)
                AliRunLoader::GetRunLoader()->UnloadgAlice();
@@ -857,6 +989,8 @@ void AliHLTMUONTriggerSource::FinishedWithAliMUON()
 
 void AliHLTMUONTriggerSource::ResetAllPointers() const
 {
+// Sets all the current pointers to NULL and indices to -1.
+
        fEventIndex = -1;
        fCurrentEvent = NULL;
        fBlockIndex = -1;
@@ -871,6 +1005,8 @@ void AliHLTMUONTriggerSource::ResetAllPointers() const
 
 void AliHLTMUONTriggerSource::ResetBlockPointers() const
 {
+// Sets the block and trigger pointers to NULL and indices to -1.
+
        fBlockIndex = -1;
        fCurrentBlock = NULL;
        fTriggerIndex = -1;
@@ -883,6 +1019,8 @@ void AliHLTMUONTriggerSource::ResetBlockPointers() const
 
 void AliHLTMUONTriggerSource::ResetTriggerPointers() const
 {
+// Sets just the current trigger record pointer to NULL and index to -1.
+
        fTriggerIndex = -1;
        fCurrentTrigger = NULL;
        DebugMsg(2, "\tfEventIndex = " << fEventIndex << " , fBlockIndex = " << fBlockIndex
@@ -891,15 +1029,17 @@ void AliHLTMUONTriggerSource::ResetTriggerPointers() const
 }
 
 
-AliHLTMUONTriggerSource::EventData::EventData() : fBlocks(TClonesArray::Class())
+AliHLTMUONTriggerSource::AliEventData::AliEventData() : fBlocks(TClonesArray::Class())
 {
        fEventNumber = -1;
 }
 
 
-AliHLTMUONTriggerSource::EventData::EventData(Int_t eventnumber)
+AliHLTMUONTriggerSource::AliEventData::AliEventData(Int_t eventnumber)
        : fBlocks(TClonesArray::Class())
 {
+// Create a new event data block with specified event number.
+
        fEventNumber = eventnumber;
 
        // If the following is not set then we do not write the fBlocks properly.
@@ -907,7 +1047,7 @@ AliHLTMUONTriggerSource::EventData::EventData(Int_t eventnumber)
 }
 
 
-AliHLTMUONTriggerSource::EventData::~EventData()
+AliHLTMUONTriggerSource::AliEventData::~AliEventData()
 {
        //fBlocks.Clear("C");  // Done in fBlocks destructor 
 }