// $Id$
#include <TClonesArray.h>
+#include <TParticle.h>
#include "AliMUONSDigitizerV2.h"
#include "AliLoader.h"
#include "AliRun.h"
#include "AliRunLoader.h"
+#include "AliStack.h"
//-----------------------------------------------------------------------------
/// The sdigitizer performs the transformation from hits (energy deposits by
AliDebug(1,"");
- AliRunLoader* runLoader = AliRunLoader::GetRunLoader();
+ AliRunLoader* runLoader = AliRunLoader::Instance();
AliLoader* loader = runLoader->GetDetectorLoader("MUON");
loader->LoadHits("READ");
AliFatal(Form("Could not create digitstore of class %s",classname.Data()));
}
- AliInfo(Form("Will use digitStore of type %s",sDigitStore->ClassName()));
+ AliDebug(1,Form("Will use digitStore of type %s",sDigitStore->ClassName()));
for ( Int_t iEvent = 0; iEvent < nofEvents; ++iEvent )
{
AliDebug(1,Form("iEvent=%d",iEvent));
runLoader->GetEvent(iEvent);
+ // for pile up studies
+ runLoader->LoadKinematics();
+ AliStack* stack = runLoader->Stack();
+ Int_t nparticles = (Int_t) stack->GetNtrack();
+ float T0=10; // time of the triggered event
+ // loop to find the time of the triggered event (this may change)
+ for (Int_t iparticle=0; iparticle<nparticles; ++iparticle) {
+ float t = stack->Particle(iparticle)->T();
+ if (TMath::Abs(t)<TMath::Abs(T0)) T0 = t;
+ }
+
loader->MakeSDigitsContainer();
TTree* treeS = loader->TreeS();
while ( ( hit = static_cast<AliMUONHit*>(next()) ) )
{
Int_t chamberId = hit->Chamber()-1;
+ Float_t age = hit->Age()-T0;
+
AliMUONChamber& chamber = muon->Chamber(chamberId);
AliMUONResponse* response = chamber.ResponseModel();
// Update some sdigit information that could not be known
// by the DisIntegrate method
d->SetHit(ihit);
- d->AddTrack(iTrack,d->Charge());
+ d->SetTime(age);
+ d->AddTrack(hit->GetTrack(),d->Charge());
tdlist.Add(d);
}
++ihit;