Extension to L0 and L1 trigger classes
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Jun 2009 11:16:33 +0000 (11:16 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Jun 2009 11:16:33 +0000 (11:16 +0000)
TRD/AliTRDTrigger.cxx
TRD/AliTRDTrigger.h
TRD/AliTRDTriggerL0.cxx [new file with mode: 0644]
TRD/AliTRDTriggerL0.h [new file with mode: 0644]
TRD/AliTRDTriggerL1.cxx [new file with mode: 0644]
TRD/AliTRDTriggerL1.h [new file with mode: 0644]
TRD/CMake_libTRDsim.txt
TRD/TRDsimLinkDef.h
TRD/libTRDsim.pkg

index e9834e1..41da6df 100644 (file)
@@ -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                                                                    //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
 
 #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,43 @@ 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::CreateInputs(const TObjArray& inputs)
 {
-  // Create the inputs to CTP for the TRD
+  // Create inputs for all registered trigger modules.
 
-  // if inputs already created return
-  if (fInputs.GetEntriesFast() > 0)
-    return;
+  fInputs.SetOwner(kFALSE);
 
-  AliInfo("Creating TRD trigger inputs");
-  fInputs.AddLast(new AliTriggerInput("TRD_HIGHPT_L1", "TRD", 1));
-  fInputs.AddLast(new AliTriggerInput("TRD_JET_L1", "TRD", 1));
+  TIter trigger(&fTriggers);
+  while (AliTriggerDetector *trgDet = (AliTriggerDetector*) trigger()) {
+    trgDet->CreateInputs(inputs);
+    fInputs.AddAll(trgDet->GetInputs());
+  }
+}
+
+void AliTRDTrigger::CreateInputs()
+{
+  // Here no inputs are created. 
+  // This is done in the submodules called from 
+  // CreateInputs(const TObjArray& inputs).
+
+  return;
 }
 
 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;
 }
index 1de3246..c342ba4 100644 (file)
@@ -8,9 +8,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 this class the two classes for L0 (pretrigger) and                //
+// L1 (GTU) are called
 //                                                                        //
 ////////////////////////////////////////////////////////////////////////////
 
@@ -22,10 +21,12 @@ class AliTRDTrigger : public AliTriggerDetector {
   AliTRDTrigger();
   ~AliTRDTrigger();
 
+  virtual void CreateInputs(const TObjArray& inputs);
   virtual void CreateInputs();
   virtual void Trigger();
 
  private:
+  TObjArray fTriggers;
 
   ClassDef(AliTRDTrigger, 1);
 
diff --git a/TRD/AliTRDTriggerL0.cxx b/TRD/AliTRDTriggerL0.cxx
new file mode 100644 (file)
index 0000000..4c17b86
--- /dev/null
@@ -0,0 +1,66 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id: AliTRDTriggerL0.cxx 31904 2009-04-08 16:42:03Z cblume $ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// TRD trigger L0 (pretrigger) simulation                                    //
+// So far no real trigger decision is done.                                  //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TObjArray.h"
+
+#include "AliLog.h"
+#include "AliTriggerInput.h"
+#include "AliRunLoader.h"
+#include "AliLoader.h"
+
+#include "AliTRDTriggerL0.h"
+#include "AliTRDgtuSim.h"
+#include "AliTRDtrackGTU.h"
+
+AliTRDTriggerL0::AliTRDTriggerL0()
+{
+  SetName("TRD");
+}
+
+AliTRDTriggerL0::~AliTRDTriggerL0()
+{
+
+}
+
+void AliTRDTriggerL0::CreateInputs()
+{
+  if (fInputs.GetEntriesFast() > 0)
+    return;
+
+  fInputs.AddLast(new AliTriggerInput("TRD_MB_L0", "TRD", 1)); // whatever should be there
+}
+
+void AliTRDTriggerL0::Trigger()
+{
+  // just an example:
+  AliRunLoader *runLoader = AliRunLoader::Instance();
+  if (!runLoader)
+    return;
+  AliLoader *trdLoader = runLoader->GetLoader("TRDLoader");
+  if (!trdLoader)
+    return;
+
+  // here comes the actual pretrigger simulation
+
+}
diff --git a/TRD/AliTRDTriggerL0.h b/TRD/AliTRDTriggerL0.h
new file mode 100644 (file)
index 0000000..b493638
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef ALITRDTRIGGERL0_H
+#define ALITRDTRIGGERL0_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliTRDTriggerL0.h 31443 2009-03-12 14:56:21Z cblume $ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+// TRD trigger implementation for L0 (pretrigger) simulation              //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+#include "AliTriggerDetector.h"
+
+class TObjArray;
+
+class AliTRDTriggerL0 : public AliTriggerDetector {
+
+ public:
+  AliTRDTriggerL0();
+  ~AliTRDTriggerL0();
+
+  virtual void CreateInputs();
+  virtual void Trigger();
+
+ private:
+
+  ClassDef(AliTRDTriggerL0, 1);
+
+};
+
+#endif
diff --git a/TRD/AliTRDTriggerL1.cxx b/TRD/AliTRDTriggerL1.cxx
new file mode 100644 (file)
index 0000000..c08915c
--- /dev/null
@@ -0,0 +1,135 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id: AliTRDTriggerL1.cxx 31904 2009-04-08 16:42:03Z cblume $ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// TRD trigger L1 (GTU) simulation steering                                  //
+// 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.                                                                 //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+
+#include "TObjArray.h"
+
+#include "AliLog.h"
+#include "AliTriggerInput.h"
+#include "AliRunLoader.h"
+#include "AliLoader.h"
+
+#include "AliTRDTriggerL1.h"
+#include "AliTRDgtuSim.h"
+#include "AliTRDtrackGTU.h"
+
+AliTRDTriggerL1::AliTRDTriggerL1()
+{
+  SetName("TRD");
+}
+
+AliTRDTriggerL1::~AliTRDTriggerL1()
+{
+
+}
+
+void AliTRDTriggerL1::CreateInputs()
+{
+  if (fInputs.GetEntriesFast() > 0)
+    return;
+
+  fInputs.AddLast(new AliTriggerInput("TRD_HIGHPT_L1", "TRD", 1));
+  fInputs.AddLast(new AliTriggerInput("TRD_JET_L1", "TRD", 1));
+}
+
+void AliTRDTriggerL1::Trigger()
+{
+  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) {
+        AliDebug(1, 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");
+  }
+
+  if (triggered_highpt) { 
+    AliInfo("Fired high-pt trigger");
+    SetInput("TRD_HIGHPT_L1");
+  }
+
+  if (triggered_jet) {
+    AliInfo("Fired jet trigger");
+    SetInput("TRD_JET_L1");
+  }
+
+  // cleaning up
+  delete gtusim;
+}
diff --git a/TRD/AliTRDTriggerL1.h b/TRD/AliTRDTriggerL1.h
new file mode 100644 (file)
index 0000000..1e832c5
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef ALITRDTRIGGERL1_H
+#define ALITRDTRIGGERL1_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliTRDTriggerL1.h 31443 2009-03-12 14:56:21Z cblume $ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+// TRD trigger implementation for L1 (GTU) simulation steering            //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+#include "AliTriggerDetector.h"
+
+class TObjArray;
+
+class AliTRDTriggerL1 : public AliTriggerDetector {
+
+ public:
+  AliTRDTriggerL1();
+  ~AliTRDTriggerL1();
+
+  virtual void CreateInputs();
+  virtual void Trigger();
+
+ private:
+
+  ClassDef(AliTRDTriggerL1, 1);
+
+};
+
+#endif
index fe0de48..c0520de 100644 (file)
@@ -7,6 +7,8 @@ AliTRDv1.cxx
 AliTRDdigitizer.cxx
 AliTRDQADataMakerSim.cxx
 AliTRDTrigger.cxx
+AliTRDTriggerL0.cxx
+AliTRDTriggerL1.cxx
 )
 
 # fill list of header files from list of source files
index b3f0f63..a01c91b 100644 (file)
@@ -13,6 +13,8 @@
 #pragma link C++ class  AliTRDv1+;
 #pragma link C++ class  AliTRDdigitizer+;
 #pragma link C++ class  AliTRDTrigger+;
+#pragma link C++ class  AliTRDTriggerL0+;
+#pragma link C++ class  AliTRDTriggerL1+;
 #pragma link C++ class  AliTRDQADataMakerSim+;
 
 #endif
index 3ae5c12..75f21c9 100644 (file)
@@ -5,6 +5,8 @@ SRCS= AliTRDsimTR.cxx \
       AliTRDv1.cxx \
       AliTRDdigitizer.cxx \
       AliTRDTrigger.cxx \
+      AliTRDTriggerL0.cxx \
+      AliTRDTriggerL1.cxx \
       AliTRDQADataMakerSim.cxx
 
 HDRS= $(SRCS:.cxx=.h)