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