Update for Ds
[u/mrichter/AliRoot.git] / ITS / AliITSTrigger.cxx
CommitLineData
e628c711 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
e628c711 16
0ca510a1 17/* $Id$ */
e628c711 18
ad7f2bfa 19////////////////////////////////////////////////////////////////////////
20// //
21// Simulates generation of Fast-OR signals from SPD (if needed). //
22// Processes the Fast-OR signals generated in AliITSsimulationSPD. //
23// Provides inputs for AliCentralTrigger. //
24// //
25// Version 2, Henrik Tydesjo, Feb 2009 //
26// Version 1, D. Elia, C. Jorgensen, Mar 2006 //
27// Version 0, J. Conrad, E. Lopez Torres, Oct 2005 //
28// //
29////////////////////////////////////////////////////////////////////////
e628c711 30
ad7f2bfa 31#include "AliITSTrigger.h"
e628c711 32#include "AliLog.h"
33#include "AliRun.h"
34#include "AliRunLoader.h"
2db4dcdc 35#include "AliITSLoader.h"
ad7f2bfa 36#include "AliTriggerInput.h"
e628c711 37
e628c711 38ClassImp(AliITSTrigger)
39
40//______________________________________________________________________
ad7f2bfa 41AliITSTrigger::AliITSTrigger() :
42 AliTriggerDetector(),
43 fPITprocessor()
44{
7537d03c 45 //standard constructor
46 SetName("ITS");
e628c711 47}
e628c711 48//______________________________________________________________________
ad7f2bfa 49AliITSTrigger::AliITSTrigger(AliITSTriggerConditions* cond) :
50 AliTriggerDetector(),
51 fPITprocessor(cond)
e628c711 52{
ad7f2bfa 53 // optional constructor
54 SetName("ITS");
e628c711 55}
e628c711 56//______________________________________________________________________
ad7f2bfa 57void AliITSTrigger::SetTriggerConditions(AliITSTriggerConditions* cond) {
58 // Sets the trigger conditions, normally coming from OCDB
59 fPITprocessor.SetTriggerConditions(cond);
e628c711 60}
8e50d897 61//______________________________________________________________________
ad7f2bfa 62void AliITSTrigger::CreateInputs() {
63 // Create inputs, based on OCDB Pixel Trigger Conditions
64 if( fInputs.GetEntriesFast() > 0 ) return; // Inputs already created, no need to proceed
65
66 // Load trigger conditions from OCDB if needed
67 if (! fPITprocessor.TriggerConditionsSet() ) {
68 AliError("Trigger conditions not set. No inputs created.");
69 return;
8e50d897 70 }
71
ad7f2bfa 72 UInt_t numInputs = fPITprocessor.GetNumOutputs();
73 AliInfo(Form("Number of trigger inputs: %d",numInputs));
74 for (UInt_t inp=0; inp<numInputs; inp++) {
75 fInputs.AddLast( new AliTriggerInput(fPITprocessor.GetOutputLabel(inp), "SPD", 0) );
76 }
8e50d897 77}
e628c711 78//______________________________________________________________________
ad7f2bfa 79void AliITSTrigger::Trigger() {
80 // Performs Pixel Trigger processing of the simulated fast-or signals
8e50d897 81
ad7f2bfa 82 // Get the FO signals for this event
83 AliITSFOSignalsSPD* foSignals = NULL;
84 AliRunLoader* runLoader = AliRunLoader::Instance();
85 AliITSLoader* itsLoader = (AliITSLoader*) runLoader->GetLoader("ITSLoader");
86 if (!itsLoader) {
87 AliError("ITS loader is NULL.");
88 }
a0d76912 89
90 else {
2729f4db 91 itsLoader->LoadDigits();
a0d76912 92 TTree *tree = itsLoader->TreeD();
93 if(!tree) {
94 AliError("TreeD not available");
2729f4db 95 itsLoader->UnloadDigits();
a0d76912 96 return;
97 }
98 foSignals = (AliITSFOSignalsSPD*)tree->GetUserInfo()->FindObject("AliITSFOSignalsSPD");
99 if(!foSignals) AliError("FO signals not retrieved");
100 }
8e50d897 101
ad7f2bfa 102 // Process the FO signals
103 if (foSignals) {
104 fPITprocessor.PreprocessFOSignals(foSignals);
105 UInt_t numInputs = fPITprocessor.GetNumOutputs();
106 for (UInt_t inp=0; inp<numInputs; inp++) {
107 if (fPITprocessor.ProcessFOSignalsIndex(inp, foSignals)) {
108 SetInput(fPITprocessor.GetOutputLabel(inp));
109 }
110 }
111 }
112 else {
113 AliError("Fast-OR signals not available. No trigger processing done.");
114 }
2729f4db 115 if (itsLoader) itsLoader->UnloadDigits();
e628c711 116}