/* $Id$ */
///////////////////////////////////////////////////////////////////////////////
-//
+//
// This class for running and define a Trigger Descriptor
-//
+//
// A Trigger Descriptor define a trigger setup for specific runnign
// condition (Pb-Pb, p-p, p-A, Calibration, etc).
// It keep:
// - cluster detector (List of detectors involved)
-// - List of conditions
+// - List of conditions
//
// Descriptors could be create in advance and store in a file.
//
// Example how to create a Trigger Descriptor:
-//
+//
// AliTriggerDescriptor descrip( "TEST", "Test Descriptor" );
//
// // Define a Cluster Detector
// "VO2_M3_ZDC1",
// "Dummy",
// 0x0200 );
-//
+//
// descrip.AddCondition( "VZERO_TEST3_L0 | MUON_Unlike_LPt_L0 | ZDC_TEST3_L0",
// "VO3_M1_ZDC3",
// "Dummy",
//
// // save the descriptor to file
// // (default file name $ALICE_ROOT/data/triggerDescriptor.root)
-// AliTriggerDescriptor::WriteDescriptor( &descrip );
-//
+// descrip.WriteDescriptor(); or descrip.WriteDescriptor( filename );
+//
///////////////////////////////////////////////////////////////////////////////
#include <TString.h>
//_____________________________________________________________________________
const char* AliTriggerDescriptor::fgkDetectorName[AliTriggerDescriptor::fgkNDetectors] =
- { "ITS", "TRD", "PHOS", "EMCAL", "MUON", "ZDC", "START", "VZERO", "CRT" };
+ { "ITS", "TRD", "PHOS", "EMCAL", "MUON", "ZDC", "T0", "VZERO", "ACORDE", "TOF" };
const TString AliTriggerDescriptor::fgkDescriptorFileName("/data/triggerDescriptors.root");
//_____________________________________________________________________________
AliTriggerDescriptor::AliTriggerDescriptor():
-TNamed(), fDetectorCluster("")
+ TNamed(),
+ fDetectorCluster(""),
+ fConditions()
{
}
//_____________________________________________________________________________
AliTriggerDescriptor::AliTriggerDescriptor( TString & name, TString & description ):
-TNamed( name, description ), fDetectorCluster("")
+ TNamed( name, description ),
+ fDetectorCluster(""),
+ fConditions()
{
}
//_____________________________________________________________________________
AliTriggerDescriptor::AliTriggerDescriptor( const AliTriggerDescriptor& des ):
-TNamed( des ), fDetectorCluster( des.fDetectorCluster )
+ TNamed( des ),
+ fDetectorCluster( des.fDetectorCluster ),
+ fConditions()
{
// Copy constructor
+ Int_t ncond = des.fConditions.GetEntriesFast();
+ for( Int_t j=0; j<ncond; j++ ) {
+ AddCondition( new AliTriggerCondition( *(AliTriggerCondition*)(des.fConditions.At( j )) ) );
+ }
+}
+
+//______________________________________________________________________________
+AliTriggerDescriptor& AliTriggerDescriptor::operator=(const AliTriggerDescriptor& des)
+{
+ // AliTriggerDescriptor assignment operator.
+
+ if (this != &des) {
+ TNamed::operator=(des);
+ fDetectorCluster = des.fDetectorCluster;
+ fConditions.Delete();
+ Int_t ncond = des.fConditions.GetEntriesFast();
+ for( Int_t j=0; j<ncond; j++ ) {
+ AddCondition( new AliTriggerCondition( *(AliTriggerCondition*)(des.fConditions.At( j )) ) );
+ }
+ }
+ return *this;
}
//_____________________________________________________________________________
}
//_____________________________________________________________________________
-void AliTriggerDescriptor::AddCondition( TString & cond, TString & name, TString & description, Long_t mask )
+void AliTriggerDescriptor::AddCondition( TString & cond, TString & name, TString & description, ULong64_t mask )
{
// Add a new condition
AliTriggerCondition* acond = new AliTriggerCondition( cond, name, description, mask );
TObjArray* AliTriggerDescriptor::GetAvailableDescriptors( const char* filename )
{
// Return an array of descriptor in the file
-
+
TString path;
if( !filename[0] ) {
path += gSystem->Getenv( "ALICE_ROOT" );
}
TObjArray* desArray = new TObjArray();
-
+
TFile file( path.Data(), "READ" );
if( file.IsZombie() ) {
AliErrorGeneral( "AliTriggerDescriptor", Form( "Error opening file (%s)", path.Data() ) );
return NULL;
}
-
+
file.ReadAll();
TKey* key;
Form( "Can't open file (%s)", path.Data() ) );
return;
}
-
+
Bool_t result = (Write( GetName(), TObject::kOverwrite ) != 0);
if( !result )
AliErrorGeneral( "AliTriggerDescriptor",
file.Close();
}
-
-
-
//_____________________________________________________________________________
Bool_t AliTriggerDescriptor::CheckInputsConditions( TString& configfile )
{
// check if the condition is compatible with the triggers inputs
Int_t ncond = fConditions.GetEntriesFast();
+ Bool_t check = kTRUE;
+ ULong64_t mask = 0L;
for( Int_t j=0; j<ncond; j++ ) {
AliTriggerCondition* cond = (AliTriggerCondition*)(fConditions.At( j ));
- if( !(cond->CheckInputs( inputs )) ) return kFALSE;
+ if( !(cond->CheckInputs( inputs )) ) check = kFALSE;
+ else AliInfo( Form( "Condition (%s) inputs names OK, class mask (0x%Lx)",
+ cond->GetName(), cond->GetMask( ) ) );
+ // check if condition mask is duplicated
+ if( mask & cond->GetMask() ) {
+ AliError( Form("Condition (%s). The class mask (0x%Lx) is ambiguous. It was previous defined",
+ cond->GetName(), cond->GetMask() ) );
+ check = kFALSE;
+ }
+ mask |= cond->GetMask();
}
- return kTRUE;
+ return check;
}