#include "AliMUONData.h"
#include "AliMUONDigit.h"
#include "AliMUONHit.h"
+#include "AliMpDEManager.h"
#include "AliLoader.h"
#include "AliRun.h"
#include "AliRunLoader.h"
#include "TObjArray.h"
+
+///
+/// The sdigitizer performs the transformation from hits (energy deposits by
+/// the transport code) to sdigits (equivalent of charges on pad).
+///
+/// It does so by converting the energy deposit into a charge and then spreading
+/// this charge over several pads, according to the response function (a
+/// Mathieson distribution, basically).
+///
+/// See also AliMUONResponseV0, which is doing the real job (in DisIntegrate
+/// method), while this sdigitizer is just "steering" the process.
+///
+/// Please note that we do *not* merge sdigits after creation, which means
+/// that after sdigitization, a given pad can have several sdigits. This
+/// merging is taken care of later on by the digitizer(V3).
+///
+
ClassImp(AliMUONSDigitizerV2)
//_____________________________________________________________________________
AliMUONSDigitizerV2::AliMUONSDigitizerV2()
: TTask("AliMUONSDigitizerV2","From Hits to SDigits for MUON")
{
+ //
+ // ctor.
+ //
}
//_____________________________________________________________________________
AliMUONSDigitizerV2::~AliMUONSDigitizerV2()
{
+ //
+ // dtor.
+ //
}
//_____________________________________________________________________________
//
// Go from hits to sdigits.
//
+ // In the code below, apart from the loop itself (which look complicated
+ // but is really only a loop on each hit in the input file) the main
+ // work is done in AliMUONResponse::DisIntegrate method, which converts
+ // a single hit in (possibly) several sdigits.
+ //
AliDebug(1,"");
AliMUON* muon = static_cast<AliMUON*>(gAlice->GetModule("MUON"));
- const Int_t nofEvents(runLoader->GetNumberOfEvents());
+ Int_t nofEvents(runLoader->GetNumberOfEvents());
for ( Int_t iEvent = 0; iEvent < nofEvents; ++iEvent )
{
+ // Loop over events.
TObjArray tdlist;
tdlist.SetOwner(kTRUE);
Long64_t nofTracks = treeH->GetEntries();
for ( Long64_t iTrack = 0; iTrack < nofTracks; ++iTrack )
{
+ // Loop over the tracks of this event.
treeH->GetEvent(iTrack);
TClonesArray* hits = muonData.Hits();
Int_t nofHits = hits->GetEntriesFast();
for ( Int_t ihit = 0; ihit < nofHits; ++ihit )
{
+ // Loop over the hits of this track.
AliMUONHit* hit = static_cast<AliMUONHit*>(hits->At(ihit));
Int_t chamberId = hit->Chamber()-1;
AliMUONChamber& chamber = muon->Chamber(chamberId);
AliMUONResponse* response = chamber.ResponseModel();
- TList digits;
+
+ // This is the heart of this method : the dis-integration
+ TList digits;
response->DisIntegrate(*hit,digits);
+
TIter next(&digits);
AliMUONDigit* d;
while ( ( d = (AliMUONDigit*)next() ) )
{
+ // Update some sdigit information that could not be known
+ // by the DisIntegrate method
d->SetHit(ihit);
+ d->AddTrack(iTrack,d->Signal());
tdlist.Add(d);
}
}
muonData.ResetHits();
- } // loop on tracks within an event
- tdlist.Sort(); // not really needed, except for comparing with old sdigitizer
+ } // end of loop on tracks within an event
+
for ( Int_t i = 0; i <= tdlist.GetLast(); ++i )
{
AliMUONDigit* d = (AliMUONDigit*)tdlist[i];
if ( d->Signal() > 0 ) // that check would be better in the disintegrate
// method, but to compare with old sdigitizer, it has to be there.
{
- muonData.AddSDigit(d->DetElemId()/100-1,*d);
+ muonData.AddSDigit(AliMpDEManager::GetChamberId(d->DetElemId()),*d);
}
}
muonData.Fill("S");
fLoader->WriteSDigits("OVERWRITE");
+
muonData.ResetSDigits();
fLoader->UnloadSDigits();
} // loop on events