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