]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliTriggerDetector.cxx
i)Added the fAlirootVersion, fRootVesrion and fGeant3Version fields along with the...
[u/mrichter/AliRoot.git] / STEER / AliTriggerDetector.cxx
CommitLineData
a5a091ce 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$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// Base Class for Detector specific Trigger // //
21// //
22// //
23// //
24// //
25// //
26///////////////////////////////////////////////////////////////////////////////
27
bacbe0fd 28#include <Riostream.h>
a5a091ce 29#include <TNamed.h>
30#include <TString.h>
31#include <TObjArray.h>
32#include <TRandom.h>
33
34
35#include "AliLog.h"
36#include "AliRun.h"
37#include "AliRunLoader.h"
38
39#include "AliTriggerInput.h"
40#include "AliTriggerDetector.h"
41
42
43
44ClassImp( AliTriggerDetector )
45
46//_____________________________________________________________________________
47AliTriggerDetector::AliTriggerDetector() : TNamed()
48{
49 // Default constructor
50 fMask = 0;
51}
52
53//_____________________________________________________________________________
54void AliTriggerDetector::CreateInputs()
55{
56 // Define the inputs to the Central Trigger Processor
57 // This is a dummy version
58
59 // Do not create inputs again!!
60 if( fInputs.GetEntriesFast() > 0 ) return;
61
62 TString name = GetName();
63 fInputs.AddLast( new AliTriggerInput( name+"_TEST1_L0", "Dummy input 1", 0x01 ) );
64 fInputs.AddLast( new AliTriggerInput( name+"_TEST2_L0", "Dummy input 2", 0x02 ) );
65 fInputs.AddLast( new AliTriggerInput( name+"_TEST3_L0", "Dummy input 3", 0x04 ) );
66}
67
68//_____________________________________________________________________________
69void AliTriggerDetector::Trigger()
70{
71 // This is a dummy version set all inputs in a random way
72
73 AliWarning( Form( "Triggering dummy detector %s", GetName() ) );
74
75 // ********** Get Digits for the current event **********
76 AliRunLoader* runLoader = gAlice->GetRunLoader();
77 AliInfo( Form( "Event %d", runLoader->GetEventNumber() ) );
78
79 TString loadername = GetName();
80 loadername.Append( "Loader" );
81 AliLoader * loader = runLoader->GetLoader( loadername.Data() );
82 if( loader ) {
83 loader->LoadDigits( "READ" );
84 TTree* digits = loader->TreeD();
85 // Do something with the digits !!!
86 if( digits ) {
87// digits->Print();
88 }
89 loader->UnloadDigits();
90 }
91 // ******************************************************
92
93 // set all inputs in a random way
94 Int_t nInputs = fInputs.GetEntriesFast();
95 for( Int_t j=0; j<nInputs; j++ ) {
96 AliTriggerInput* in = (AliTriggerInput*)fInputs.At( j );
97 if( gRandom->Rndm() > 0.5 ) {
98 in->Set();
99 fMask |= in->GetValue();
100 }
101 }
102}
103
104//_____________________________________________________________________________
105void AliTriggerDetector::SetInput( TString& name )
106{
107 // Set Input by name
92c1978f 108 SetInput( name.Data() );
a5a091ce 109}
110
111//_____________________________________________________________________________
112void AliTriggerDetector::SetInput( const char * name )
113{
114 // Set Input by name
115 AliTriggerInput* in = ((AliTriggerInput*)fInputs.FindObject( name ));
92c1978f 116 if( in ) {
117 in->Set();
118 fMask |= in->GetValue();
119 } else
120 AliError( Form( "There is not input named %s", name ) );
a5a091ce 121}
122
123//_____________________________________________________________________________
124void AliTriggerDetector::SetInput( Int_t mask )
125{
126 // Set Input by mask
127 Int_t nInputs = fInputs.GetEntriesFast();
128 for( Int_t j=0; j<nInputs; j++ ) {
129 AliTriggerInput* in = (AliTriggerInput*)fInputs.At( j );
130 if( in->GetMask() == mask ) {
131 in->Set();
132 fMask |= in->GetValue();
133 break;
134 }
135 }
136}
137
bacbe0fd 138//_____________________________________________________________________________
139void AliTriggerDetector::Print( const Option_t* opt ) const
140{
141 // Print
142 cout << "Trigger Detector : " << GetName() << endl;
143 cout << " Trigger Class Mask: 0x" << hex << GetMask() << dec << endl;
144 Int_t nInputs = fInputs.GetEntriesFast();
145 for( Int_t j=0; j<nInputs; j++ ) {
146 AliTriggerInput* in = (AliTriggerInput*)fInputs.At( j );
147 in->Print( opt );
148 }
149}