X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=inline;f=TRD%2FAliTRDTrigger.cxx;h=94bdf5c2349c49051bae984a9676bc102f142502;hb=def484dc29e499e626f7006791d6c9caf9bddc24;hp=e9834e18b0186be01d4e4addbefe255a228ec420;hpb=c8b1590d38895c0471accffb8a0bf536e4aba304;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDTrigger.cxx b/TRD/AliTRDTrigger.cxx index e9834e18b01..94bdf5c2349 100644 --- a/TRD/AliTRDTrigger.cxx +++ b/TRD/AliTRDTrigger.cxx @@ -18,9 +18,8 @@ /////////////////////////////////////////////////////////////////////////////// // // // TRD trigger interface class to CTP // -// currently the Trigger() method calls the GTU tracking simulation and // -// runs two example triggers, namely on a single high pt particle and // -// on a jet. // +// from here the trigger simulation for L0 (pretrigger) and L1 (GTU) are // +// called // // // /////////////////////////////////////////////////////////////////////////////// @@ -28,16 +27,20 @@ #include "AliLog.h" #include "AliTriggerInput.h" -#include "AliRunLoader.h" -#include "AliLoader.h" +#include "AliTriggerDetector.h" -#include "AliTRDgtuSim.h" -#include "AliTRDtrackGTU.h" #include "AliTRDTrigger.h" +#include "AliTRDTriggerL0.h" +#include "AliTRDTriggerL1.h" -AliTRDTrigger::AliTRDTrigger() +AliTRDTrigger::AliTRDTrigger() : + AliTriggerDetector(), + fTriggers() { - // defautl constructor + // default constructor + + fTriggers.AddLast(new AliTRDTriggerL0()); + fTriggers.AddLast(new AliTRDTriggerL1()); SetName("TRD"); } @@ -45,101 +48,38 @@ AliTRDTrigger::AliTRDTrigger() AliTRDTrigger::~AliTRDTrigger() { // destructor + TIter trigger(&fTriggers); + while (AliTriggerDetector *trgDet = (AliTriggerDetector*) trigger()) + delete trgDet; + + fInputs.Clear(); // inputs are deleted either by CTP or submodule } -void AliTRDTrigger::CreateInputs() +void AliTRDTrigger::AssignInputs(const TObjArray& inputs) { - // Create the inputs to CTP for the TRD + // Create inputs for all registered trigger modules. + if( fInputs.GetEntriesFast() > 0 ) return; - // if inputs already created return - if (fInputs.GetEntriesFast() > 0) - return; + TIter trigger(&fTriggers); + while (AliTriggerDetector *trgDet = (AliTriggerDetector*) trigger()) { + trgDet->AssignInputs(inputs); + fInputs.AddAll(trgDet->GetInputs()); + } +} + +void AliTRDTrigger::CreateInputs() +{ - AliInfo("Creating TRD trigger inputs"); - fInputs.AddLast(new AliTriggerInput("TRD_HIGHPT_L1", "TRD", 1)); - fInputs.AddLast(new AliTriggerInput("TRD_JET_L1", "TRD", 1)); } void AliTRDTrigger::Trigger() { // TRD trigger steering - // currently the L1 trigger is directly put here - // lateron can be separated such that from here the - // pretrigger (generating an L0) and L1 can be called - - AliRunLoader *runLoader = AliRunLoader::Instance(); - if (!runLoader) - return; - AliLoader *trdLoader = runLoader->GetLoader("TRDLoader"); - if (!trdLoader) - return; - - // now running the GTU tracking; - AliTRDgtuSim *gtusim = new AliTRDgtuSim(); - gtusim->RunGTU(trdLoader, 0x0); - gtusim->WriteTracksToLoader(); - - TTree *trackTree = trdLoader->GetDataLoader("gtutracks")->Tree(); - if (!trackTree) { - AliDebug(1,"Did not find track tree"); - return; - } - TBranch *branch = trackTree->GetBranch("TRDtrackGTU"); - AliDebug(1,Form("TRD trigger: found %i tracks", trackTree->GetEntriesFast())); - - // trigger thresholds should go elsewhere - Float_t ptThreshold1 = 2; - Float_t ptThreshold2 = 9.9; - Int_t trackThreshold1 = 6; - Int_t trackThreshold2 = 2; - - // trigger algorithms to come, e.g. - Bool_t triggered_highpt = kFALSE; - Bool_t triggered_jet = kFALSE; - - if (branch) { - AliTRDtrackGTU *trk = 0x0; - branch->SetAddress(&trk); - - // high pt trigger - for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) { - trackTree->GetEntry(iTrack); - if (TMath::Abs(trk->GetPt()) > 3.0) { - AliInfo(Form("Found track in sector %2i, stack %i with pt = %3.1f, triggered", - trk->GetSector(), trk->GetStack(), trk->GetPt())); - triggered_highpt = kTRUE; - } - } - - // jet trigger - Int_t nTracks1[90]; // tracks above lower pt threshold - Int_t nTracks2[90]; // tracks above higher pt threshold - for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) { - trackTree->GetEntry(iTrack); - if (TMath::Abs(trk->GetPt()) > ptThreshold1) - nTracks1[5*trk->GetSector() + trk->GetStack()]++; - if (TMath::Abs(trk->GetPt()) > ptThreshold2) - nTracks2[5*trk->GetSector() + trk->GetStack()]++; - } - for (Int_t iStack = 0; iStack < 90; iStack++) { - if ((nTracks1[iStack] >= trackThreshold1) || (nTracks2[iStack] >= trackThreshold2)) - triggered_jet = kTRUE; - } - } - else { - AliWarning("GTU Branch not found"); - } + // all registered TRD trigger mechanism are + // run from here - if (triggered_highpt) { - AliInfo("Fired high-pt trigger"); - SetInput("TRD_HIGHPT_L1"); + TIter trigger(&fTriggers); + while (AliTriggerDetector *trgDet = (AliTriggerDetector*) trigger()) { + trgDet->Trigger(); } - - if (triggered_jet) { - AliInfo("Fired jet trigger"); - SetInput("TRD_JET_L1"); - } - - // cleaning up - delete gtusim; }