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 ///////////////////////////////////////////////////////////////////////////////
30 #include <TObjArray.h>
36 #include "AliRunLoader.h"
38 #include "AliTriggerInput.h"
39 #include "AliTriggerDetector.h"
43 ClassImp( AliTriggerDetector )
45 //_____________________________________________________________________________
46 AliTriggerDetector::AliTriggerDetector() : TNamed()
48 // Default constructor
52 //_____________________________________________________________________________
53 void AliTriggerDetector::CreateInputs()
55 // Define the inputs to the Central Trigger Processor
56 // This is a dummy version
58 // Do not create inputs again!!
59 if( fInputs.GetEntriesFast() > 0 ) return;
61 TString name = GetName();
62 fInputs.AddLast( new AliTriggerInput( name+"_TEST1_L0", "Dummy input 1", 0x01 ) );
63 fInputs.AddLast( new AliTriggerInput( name+"_TEST2_L0", "Dummy input 2", 0x02 ) );
64 fInputs.AddLast( new AliTriggerInput( name+"_TEST3_L0", "Dummy input 3", 0x04 ) );
67 //_____________________________________________________________________________
68 void AliTriggerDetector::Trigger()
70 // This is a dummy version set all inputs in a random way
72 AliWarning( Form( "Triggering dummy detector %s", GetName() ) );
74 // ********** Get Digits for the current event **********
75 AliRunLoader* runLoader = gAlice->GetRunLoader();
76 AliInfo( Form( "Event %d", runLoader->GetEventNumber() ) );
78 TString loadername = GetName();
79 loadername.Append( "Loader" );
80 AliLoader * loader = runLoader->GetLoader( loadername.Data() );
82 loader->LoadDigits( "READ" );
83 TTree* digits = loader->TreeD();
84 // Do something with the digits !!!
88 loader->UnloadDigits();
90 // ******************************************************
92 // set all inputs in a random way
93 Int_t nInputs = fInputs.GetEntriesFast();
94 for( Int_t j=0; j<nInputs; j++ ) {
95 AliTriggerInput* in = (AliTriggerInput*)fInputs.At( j );
96 if( gRandom->Rndm() > 0.5 ) {
98 fMask |= in->GetValue();
103 //_____________________________________________________________________________
104 void AliTriggerDetector::SetInput( TString& name )
107 AliTriggerInput* in = ((AliTriggerInput*)fInputs.FindObject( name.Data() ));
109 fMask |= in->GetValue();
112 //_____________________________________________________________________________
113 void AliTriggerDetector::SetInput( const char * name )
116 AliTriggerInput* in = ((AliTriggerInput*)fInputs.FindObject( name ));
118 fMask |= in->GetValue();
121 //_____________________________________________________________________________
122 void AliTriggerDetector::SetInput( Int_t mask )
125 Int_t nInputs = fInputs.GetEntriesFast();
126 for( Int_t j=0; j<nInputs; j++ ) {
127 AliTriggerInput* in = (AliTriggerInput*)fInputs.At( j );
128 if( in->GetMask() == mask ) {
130 fMask |= in->GetValue();