LCOV - code coverage report
Current view: top level - TRD/TRDsim - AliTRDTriggerL1.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 72 98 73.5 %
Date: 2016-06-14 17:26:59 Functions: 7 7 100.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /* $Id: AliTRDTriggerL1.cxx 31904 2009-04-08 16:42:03Z cblume $ */
      17             : 
      18             : ///////////////////////////////////////////////////////////////////////////////
      19             : //                                                                           //
      20             : // TRD trigger L1 (GTU) simulation steering                                  //
      21             : // The Trigger() method calls the GTU tracking simulation and                //
      22             : // runs the triggers for HCO, HJT, HSE, HQU, HEE                             //
      23             : //                                                                           //
      24             : ///////////////////////////////////////////////////////////////////////////////
      25             : 
      26             : 
      27             : #include "TObjArray.h"
      28             : #include <TTree.h>
      29             : 
      30             : #include "AliLog.h"
      31             : #include "AliTriggerInput.h"
      32             : #include "AliRunLoader.h"
      33             : #include "AliLoader.h"
      34             : 
      35             : #include "AliTRDTriggerL1.h"
      36             : #include "AliTRDgtuSim.h"
      37             : #include "AliTRDtrackGTU.h"
      38             : #include "AliTRDcalibDB.h"
      39             : #include "AliTRDCalDCSGTU.h"
      40             : 
      41             : AliTRDTriggerL1::AliTRDTriggerL1() :
      42           4 :   AliTriggerDetector(),
      43           4 :   fPtThresholdA(3.),
      44           4 :   fPtThresholdB(2.),
      45           4 :   fPidThresholdA(144),
      46           4 :   fPidThresholdB(164),
      47           4 :   fNoThreshold(1),
      48           4 :   fNoThresholdA(1),
      49           4 :   fNoThresholdB(1),
      50           4 :   fNoThresholdJetA(3),
      51           4 :   fNoThresholdJetB(250),
      52           4 :   fNoThresholdElA(1),
      53           4 :   fNoThresholdElB(1),
      54           4 :   fNoTrklThresholdElA(5),
      55           4 :   fNoTrklThresholdElB(5),
      56           4 :   fLayerMaskElA(0x1),
      57           4 :   fLayerMaskElB(0x1)
      58          20 : {
      59             :   // ctor
      60             : 
      61           4 :   SetName("TRD");
      62           8 : }
      63             : 
      64             : AliTRDTriggerL1::~AliTRDTriggerL1()
      65          16 : {
      66             :   // dtor
      67          16 : }
      68             : 
      69             : void AliTRDTriggerL1::CreateInputs()
      70             : {
      71             :   // create the trigger inputs for TRD
      72             : 
      73           8 :   if (fInputs.GetEntriesFast() > 0)
      74             :     return;
      75             : 
      76          20 :   fInputs.AddLast(new AliTriggerInput("1HCO", "TRD", 1));
      77          20 :   fInputs.AddLast(new AliTriggerInput("1HJT", "TRD", 1));
      78          20 :   fInputs.AddLast(new AliTriggerInput("1HSE", "TRD", 1));
      79          20 :   fInputs.AddLast(new AliTriggerInput("1HQU", "TRD", 1));
      80          20 :   fInputs.AddLast(new AliTriggerInput("1HEE", "TRD", 1));
      81           8 : }
      82             : 
      83             : void AliTRDTriggerL1::Trigger()
      84             : {
      85             :   // run the trigger algorithms
      86             : 
      87           8 :   AliRunLoader *runLoader = AliRunLoader::Instance();
      88           4 :   if (!runLoader)
      89           0 :     return;
      90           4 :   AliLoader *trdLoader = runLoader->GetLoader("TRDLoader");
      91           4 :   if (!trdLoader)
      92           0 :     return;
      93             : 
      94             :   // now running the GTU tracking;
      95           4 :   AliTRDgtuSim *gtusim = new AliTRDgtuSim();
      96           4 :   gtusim->RunGTU(trdLoader, 0x0);
      97             : 
      98           4 :   TTree *trackTree = trdLoader->GetDataLoader("gtutracks")->Tree();
      99           4 :   if (!trackTree) {
     100           0 :     AliDebug(1,"Did not find track tree");
     101           0 :     return;
     102             :   }
     103           4 :   TBranch *branch = trackTree->GetBranch("TRDtrackGTU");
     104          12 :   AliDebug(1,Form("TRD trigger: found %lld tracks", trackTree->GetEntriesFast()));
     105             : 
     106             :   // trigger algorithms to come, e.g.
     107             :   Bool_t triggered1HCO    = kFALSE;
     108             :   Bool_t triggered1HJT    = kFALSE;
     109             :   Bool_t triggered1HSE    = kFALSE;
     110             :   Bool_t triggered1HQU    = kFALSE;
     111             :   Bool_t triggered1HEE    = kFALSE;
     112             : 
     113           4 :   if (branch) {
     114           4 :     AliTRDtrackGTU *trk = 0x0;
     115           4 :     branch->SetAddress(&trk);
     116             : 
     117           4 :     Int_t nTracks[90]      = { 0 }; // number of tracks
     118           4 :     Int_t nTracksA[90]     = { 0 }; // number of tracks above pt threshold A
     119           4 :     Int_t nTracksB[90]     = { 0 }; // number of tracks above pt threshold B
     120           4 :     Int_t nTracksElA[90]   = { 0 }; // number of tracks above pt threshold A and PID threshold A
     121           4 :     Int_t nTracksElB[90]   = { 0 }; // number of tracks above pt threshold B and PID threshold B
     122             : 
     123          38 :     for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) {
     124          15 :       trackTree->GetEntry(iTrack);
     125             : 
     126          15 :       nTracks[5*trk->GetSector() + trk->GetStack()]++;
     127             : 
     128          15 :       if (TMath::Abs(trk->GetPt()) > fPtThresholdA) {
     129           2 :         nTracksA[5*trk->GetSector() + trk->GetStack()]++;
     130           2 :         if ((trk->GetPID() > fPidThresholdA) &&
     131           0 :             ((trk->GetTrackletMask() & fLayerMaskElA) == fLayerMaskElA) &&
     132           0 :             (trk->GetNTracklets() >= fNoTrklThresholdElA))
     133           0 :           nTracksElA[5*trk->GetSector() + trk->GetStack()]++;
     134             :       }
     135             : 
     136          15 :       if (TMath::Abs(trk->GetPt()) > fPtThresholdB) {
     137           7 :         nTracksB[5*trk->GetSector() + trk->GetStack()]++;
     138           7 :         if ((trk->GetPID() > fPidThresholdB) &&
     139           0 :             ((trk->GetTrackletMask() & fLayerMaskElB) == fLayerMaskElB) &&
     140           0 :             (trk->GetNTracklets() >= fNoTrklThresholdElB))
     141           0 :           nTracksElB[5*trk->GetSector() + trk->GetStack()]++;
     142             :       }
     143             :     }
     144             : 
     145         728 :     for (Int_t iStack = 0; iStack < 90; iStack++) {
     146         360 :       if (nTracks[iStack] >= fNoThreshold)
     147          15 :         triggered1HCO = kTRUE;
     148             : 
     149         720 :       if ((nTracksA[iStack] >= fNoThresholdJetA) || (nTracksB[iStack] >= fNoThresholdJetB))
     150           0 :         triggered1HJT = kTRUE;
     151             : 
     152         360 :       if ((nTracksElA[iStack] >= fNoThresholdElA))
     153           0 :         triggered1HSE = kTRUE;
     154             : 
     155         360 :       if ((nTracksElB[iStack] >= fNoThresholdElB))
     156           0 :         triggered1HQU = kTRUE;
     157             :     }
     158           4 :   }
     159             :   else {
     160           0 :     AliWarning("GTU Branch not found");
     161             :   }
     162             : 
     163           4 :   if (triggered1HCO) {
     164          12 :     AliDebug(1, "Fired cosmic trigger");
     165           4 :     SetInput("1HCO");
     166           4 :   }
     167             : 
     168           4 :   if (triggered1HJT) {
     169           0 :     AliDebug(1, "Fired jet trigger");
     170           0 :     SetInput("1HJT");
     171           0 :   }
     172             : 
     173           4 :   if (triggered1HSE) {
     174           0 :     AliDebug(1, "Fired single electron trigger");
     175           0 :     SetInput("1HSE");
     176           0 :   }
     177             : 
     178           4 :   if (triggered1HQU) {
     179           0 :     AliDebug(1, "Fired single electron trigger");
     180           0 :     SetInput("1HQU");
     181           0 :   }
     182             : 
     183           4 :   if (triggered1HEE) {
     184           0 :     AliDebug(1, "Fired single electron trigger");
     185           0 :     SetInput("1HEE");
     186           0 :   }
     187             : 
     188             :   // cleaning up
     189           8 :   delete gtusim;
     190           8 : }

Generated by: LCOV version 1.11