Adding some further mother volumes to speed-up the overlap checking and particle...
[u/mrichter/AliRoot.git] / ITS / AliITSTrigger.cxx
... / ...
CommitLineData
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 "AliITSTrigger.h"
32#include "AliLog.h"
33#include "AliRun.h"
34#include "AliRunLoader.h"
35#include "AliITSLoader.h"
36#include "AliTriggerInput.h"
37
38ClassImp(AliITSTrigger)
39
40//______________________________________________________________________
41AliITSTrigger::AliITSTrigger() :
42 AliTriggerDetector(),
43 fPITprocessor()
44{
45 //standard constructor
46 SetName("ITS");
47}
48//______________________________________________________________________
49AliITSTrigger::AliITSTrigger(AliITSTriggerConditions* cond) :
50 AliTriggerDetector(),
51 fPITprocessor(cond)
52{
53 // optional constructor
54 SetName("ITS");
55}
56//______________________________________________________________________
57void AliITSTrigger::SetTriggerConditions(AliITSTriggerConditions* cond) {
58 // Sets the trigger conditions, normally coming from OCDB
59 fPITprocessor.SetTriggerConditions(cond);
60}
61//______________________________________________________________________
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;
70 }
71
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 }
77}
78//______________________________________________________________________
79void AliITSTrigger::Trigger() {
80 // Performs Pixel Trigger processing of the simulated fast-or signals
81
82 // Get the FO signals for this event
83 AliITSFOSignalsSPD* foSignals = NULL;
84 AliRunLoader* runLoader = AliRunLoader::Instance();
85 runLoader->LoadDigits();
86 AliITSLoader* itsLoader = (AliITSLoader*) runLoader->GetLoader("ITSLoader");
87 if (!itsLoader) {
88 AliError("ITS loader is NULL.");
89 }
90
91 else {
92 TTree *tree = itsLoader->TreeD();
93 if(!tree) {
94 AliError("TreeD not available");
95 return;
96 }
97 foSignals = (AliITSFOSignalsSPD*)tree->GetUserInfo()->FindObject("AliITSFOSignalsSPD");
98 if(!foSignals) AliError("FO signals not retrieved");
99 }
100
101 // Process the FO signals
102 if (foSignals) {
103 fPITprocessor.PreprocessFOSignals(foSignals);
104 UInt_t numInputs = fPITprocessor.GetNumOutputs();
105 for (UInt_t inp=0; inp<numInputs; inp++) {
106 if (fPITprocessor.ProcessFOSignalsIndex(inp, foSignals)) {
107 SetInput(fPITprocessor.GetOutputLabel(inp));
108 }
109 }
110 }
111 else {
112 AliError("Fast-OR signals not available. No trigger processing done.");
113 }
114
115}