1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // Base Class for Detector specific Trigger // //
26 ///////////////////////////////////////////////////////////////////////////////
28 #include <Riostream.h>
31 #include <TObjArray.h>
37 #include "AliRunLoader.h"
39 #include "AliTriggerInput.h"
40 #include "AliTriggerDetector.h"
44 ClassImp( AliTriggerDetector )
46 //_____________________________________________________________________________
47 AliTriggerDetector::AliTriggerDetector() :
52 // Default constructor
55 //_____________________________________________________________________________
56 void AliTriggerDetector::CreateInputs()
58 // Define the inputs to the Central Trigger Processor
59 // This is a dummy version
61 // Do not create inputs again!!
62 if( fInputs.GetEntriesFast() > 0 ) return;
64 TString name = GetName();
65 fInputs.AddLast( new AliTriggerInput( name+"_TEST1_L0", "Dummy input 1", 0x01 ) );
66 fInputs.AddLast( new AliTriggerInput( name+"_TEST2_L0", "Dummy input 2", 0x02 ) );
67 fInputs.AddLast( new AliTriggerInput( name+"_TEST3_L0", "Dummy input 3", 0x04 ) );
70 //_____________________________________________________________________________
71 void AliTriggerDetector::Trigger()
73 // This is a dummy version set all inputs in a random way
75 AliWarning( Form( "Triggering dummy detector %s", GetName() ) );
77 // ********** Get Digits for the current event **********
78 AliRunLoader* runLoader = gAlice->GetRunLoader();
79 AliInfo( Form( "Event %d", runLoader->GetEventNumber() ) );
81 TString loadername = GetName();
82 loadername.Append( "Loader" );
83 AliLoader * loader = runLoader->GetLoader( loadername.Data() );
85 loader->LoadDigits( "READ" );
86 TTree* digits = loader->TreeD();
87 // Do something with the digits !!!
91 loader->UnloadDigits();
93 // ******************************************************
95 // set all inputs in a random way
96 Int_t nInputs = fInputs.GetEntriesFast();
97 for( Int_t j=0; j<nInputs; j++ ) {
98 AliTriggerInput* in = (AliTriggerInput*)fInputs.At( j );
99 if( gRandom->Rndm() > 0.5 ) {
101 fMask |= in->GetValue();
106 //_____________________________________________________________________________
107 void AliTriggerDetector::SetInput( TString& name )
110 SetInput( name.Data() );
113 //_____________________________________________________________________________
114 void AliTriggerDetector::SetInput( const char * name )
117 AliTriggerInput* in = ((AliTriggerInput*)fInputs.FindObject( name ));
120 fMask |= in->GetValue();
122 AliError( Form( "There is not input named %s", name ) );
125 //_____________________________________________________________________________
126 void AliTriggerDetector::SetInput( Int_t mask )
129 Int_t nInputs = fInputs.GetEntriesFast();
130 for( Int_t j=0; j<nInputs; j++ ) {
131 AliTriggerInput* in = (AliTriggerInput*)fInputs.At( j );
132 if( in->GetMask() == mask ) {
134 fMask |= in->GetValue();
140 //_____________________________________________________________________________
141 void AliTriggerDetector::Print( const Option_t* opt ) const
144 cout << "Trigger Detector : " << GetName() << endl;
145 cout << " Trigger Class Mask: 0x" << hex << GetMask() << dec << endl;
146 Int_t nInputs = fInputs.GetEntriesFast();
147 for( Int_t j=0; j<nInputs; j++ ) {
148 AliTriggerInput* in = (AliTriggerInput*)fInputs.At( j );