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() : TNamed()
49 // Default constructor
53 //_____________________________________________________________________________
54 void AliTriggerDetector::CreateInputs()
56 // Define the inputs to the Central Trigger Processor
57 // This is a dummy version
59 // Do not create inputs again!!
60 if( fInputs.GetEntriesFast() > 0 ) return;
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 ) );
68 //_____________________________________________________________________________
69 void AliTriggerDetector::Trigger()
71 // This is a dummy version set all inputs in a random way
73 AliWarning( Form( "Triggering dummy detector %s", GetName() ) );
75 // ********** Get Digits for the current event **********
76 AliRunLoader* runLoader = gAlice->GetRunLoader();
77 AliInfo( Form( "Event %d", runLoader->GetEventNumber() ) );
79 TString loadername = GetName();
80 loadername.Append( "Loader" );
81 AliLoader * loader = runLoader->GetLoader( loadername.Data() );
83 loader->LoadDigits( "READ" );
84 TTree* digits = loader->TreeD();
85 // Do something with the digits !!!
89 loader->UnloadDigits();
91 // ******************************************************
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 ) {
99 fMask |= in->GetValue();
104 //_____________________________________________________________________________
105 void AliTriggerDetector::SetInput( TString& name )
108 AliTriggerInput* in = ((AliTriggerInput*)fInputs.FindObject( name.Data() ));
110 fMask |= in->GetValue();
113 //_____________________________________________________________________________
114 void AliTriggerDetector::SetInput( const char * name )
117 AliTriggerInput* in = ((AliTriggerInput*)fInputs.FindObject( name ));
119 fMask |= in->GetValue();
122 //_____________________________________________________________________________
123 void AliTriggerDetector::SetInput( Int_t mask )
126 Int_t nInputs = fInputs.GetEntriesFast();
127 for( Int_t j=0; j<nInputs; j++ ) {
128 AliTriggerInput* in = (AliTriggerInput*)fInputs.At( j );
129 if( in->GetMask() == mask ) {
131 fMask |= in->GetValue();
137 //_____________________________________________________________________________
138 void AliTriggerDetector::Print( const Option_t* opt ) const
141 cout << "Trigger Detector : " << GetName() << endl;
142 cout << " Trigger Class Mask: 0x" << hex << GetMask() << dec << endl;
143 Int_t nInputs = fInputs.GetEntriesFast();
144 for( Int_t j=0; j<nInputs; j++ ) {
145 AliTriggerInput* in = (AliTriggerInput*)fInputs.At( j );