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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////////
18 // This class which defines defines the Trigger Configuration
20 // Trigger Configuration defines the trigger setup for a particular run
21 // We have default configurations for each running mode (Pb-Pb, p-p, p-A, Calibration, etc).
23 // All the information conained in the CTP configuration file used
24 // online during the data taking
26 // Configurations could be created and stored in local file.
27 // By default the configuration is loaded from the corresponding GRP entry
28 // inside the OCDB. There one can have one and only one configuration per run.
30 // Example how to create a Trigger Configuration:
32 // AliTriggerConfiguration config( "TEST", "Test Configuration" );
34 // // Define a Cluster Detector
35 // config.AddDetectorCluster( "VZERO ZDC MUON" );
37 // // Define the trigger conditions (see AliTriggerCondition.cxx)
38 // config.AddCondition( "VZERO_TEST1_L0 & MUON_SPlus_LPt_L0 & ZDC_TEST2_L0", // condition
39 // "VO1_M1_ZDC2", // short name
40 // "Dummy", // short description
41 // 0x0100 ); // class mask (set one bit)
43 // config.AddCondition( "VZERO_TEST2_L0 & MUON_SMinus_HPt_L0 & ZDC_TEST1_L0",
48 // config.AddCondition( "VZERO_TEST3_L0 | MUON_Unlike_LPt_L0 | ZDC_TEST3_L0",
52 // config.CheckInputsConditions("Config.C");
55 // // save the configuration to file
56 // // (default file name $ALICE_ROOT/data/triggerConfigurations.root)
57 // config.WriteConfiguration(); or config.WriteConfiguration( filename );
59 ///////////////////////////////////////////////////////////////////////////////
60 #include <Riostream.h>
65 #include <TObjArray.h>
66 #include <TObjString.h>
72 #include "AliCDBManager.h"
75 #include "AliModule.h"
78 #include "AliRunLoader.h"
79 #include "AliTriggerBCMask.h"
80 #include "AliTriggerClass.h"
81 #include "AliTriggerCluster.h"
82 #include "AliTriggerConfiguration.h"
83 #include "AliTriggerDescriptor.h"
84 #include "AliTriggerInput.h"
85 #include "AliTriggerInteraction.h"
86 #include "AliTriggerPFProtection.h"
88 ClassImp(AliTriggerConfiguration)
90 const TString AliTriggerConfiguration::fgkConfigurationFileName("/data/triggerConfigurations.root");
92 //_____________________________________________________________________________
93 AliTriggerConfiguration::AliTriggerConfiguration():
105 // Default constructor
108 //_____________________________________________________________________________
109 AliTriggerConfiguration::AliTriggerConfiguration( TString & name, TString & description ):
110 TNamed( name, description ),
124 //_____________________________________________________________________________
125 AliTriggerConfiguration::~AliTriggerConfiguration()
130 fInteractions.SetOwner();
131 fInteractions.Delete();
132 fFunctions.SetOwner();
134 fPFProtections.SetOwner();
135 fPFProtections.Delete();
138 fDescriptors.SetOwner();
139 fDescriptors.Delete();
140 fClusters.SetOwner();
146 //_____________________________________________________________________________
147 Bool_t AliTriggerConfiguration::AddInput( AliTriggerInput* input )
149 // Add a trigger input to
150 // the list of the trigger inputs
151 if (fInputs.GetEntries() < kNMaxInputs) {
152 fInputs.AddLast( input );
156 AliError("CTP can handle up to 50 inputs ! Impossible to add the required input !");
161 //_____________________________________________________________________________
162 AliTriggerInput* AliTriggerConfiguration::AddInput( TString &name, TString &det,
163 UChar_t level, UInt_t signature,
166 // Add a trigger input to
167 // the list of the trigger inputs
168 AliTriggerInput *input = new AliTriggerInput(name,det,level,signature,number);
169 if (!AddInput(input)) {
177 //_____________________________________________________________________________
178 AliTriggerInteraction* AliTriggerConfiguration::AddInteraction(TString &name, TString &logic)
180 // Add a trigger interaction object to
181 // the list of the trigger interactions
182 AliTriggerInteraction *interact = new AliTriggerInteraction(name,logic);
183 if (!AddInteraction(interact)) {
191 //_____________________________________________________________________________
192 Bool_t AliTriggerConfiguration::AddInteraction(AliTriggerInteraction *interact)
194 // Add a trigger interaction object to
195 // the list of the trigger interactions
196 if (fInteractions.GetEntries() < kNMaxInteractions) {
197 if (interact->CheckInputs(fInputs)) {
198 fInteractions.AddLast( interact );
202 AliError("Invalid interaction ! Impossible to add it !");
205 AliError("CTP can handle up to 2 interactions ! Impossible to add the required interaction !");
210 //_____________________________________________________________________________
211 AliTriggerInteraction* AliTriggerConfiguration::AddFunction(TString &name, TString &logic)
213 // Add a trigger function object to
214 // the list of the trigger functions
215 AliTriggerInteraction *func = new AliTriggerInteraction(name,logic);
216 if (!AddFunction(func)) {
224 //_____________________________________________________________________________
225 Bool_t AliTriggerConfiguration::AddFunction(AliTriggerInteraction *func)
227 // Add a trigger function object to
228 // the list of the trigger functions
229 if (fFunctions.GetEntries() < kNMaxFunctions) {
230 if (func->CheckInputs(fInputs)) {
231 fFunctions.AddLast( func );
235 AliError("Invalid logical function ! Impossible to add it !");
238 AliError("CTP can handle up to 2 logical functions ! Impossible to add the required interaction !");
243 //_____________________________________________________________________________
244 Bool_t AliTriggerConfiguration::AddPFProtection( AliTriggerPFProtection* pfp )
246 // Add a trigger past-future protection object to
247 // the list of the trigger past-future protections
248 if (fPFProtections.GetEntries() < kNMaxPFProtections) {
249 if (pfp->CheckInteractions(fInteractions)) {
250 fPFProtections.AddLast( pfp );
254 AliError("Invalid past-future protection ! Impossible to add it !");
257 AliError("CTP can handle up to 4 past-future protections ! Impossible to add the required protection !");
262 //_____________________________________________________________________________
263 AliTriggerBCMask* AliTriggerConfiguration::AddMask( TString &name, TString &mask )
265 // Add a trigger bunch-crossing mask object to
266 // the list of the trigger bunch-crossing masks
267 AliTriggerBCMask *bcmask = new AliTriggerBCMask(name,mask);
268 if (!AddMask(bcmask)) {
276 //_____________________________________________________________________________
277 Bool_t AliTriggerConfiguration::AddMask( AliTriggerBCMask* mask )
279 // Add a trigger bunch-crossing mask object to
280 // the list of the trigger bunch-crossing masks
281 if (fMasks.GetEntries() < kNMaxMasks) {
282 fMasks.AddLast( mask );
286 AliError("CTP can handle up to 4 bunch-crossing masks ! Impossible to add the required mask !");
291 //_____________________________________________________________________________
292 AliTriggerCluster* AliTriggerConfiguration::AddCluster( TString &name, UChar_t index, TString &detectors)
294 // Add a trigger detector readout cluster to
295 // the list of the trigger clusters
296 AliTriggerCluster *clust = new AliTriggerCluster(name,index,detectors);
297 if (!AddCluster(clust)) {
306 //_____________________________________________________________________________
307 Bool_t AliTriggerConfiguration::AddCluster( AliTriggerCluster* cluster )
309 // Add a trigger detector readout cluster to
310 // the list of the trigger clusters
311 if (fClusters.GetEntries() < kNMaxClusters) {
312 TString dets(cluster->GetDetectorsInCluster());
313 if (!(dets.IsNull())) {
314 fClusters.AddLast( cluster );
318 AliError("Empty trigger cluster ! Impossible to add it !");
321 AliError("CTP can handle up to 6 different detector clusters ! Impossible to add the required cluster !");
326 //_____________________________________________________________________________
327 TString AliTriggerConfiguration::GetActiveDetectors() const
329 // Return an string with all active detector
332 TString activeDet = "";
334 Int_t nclus = fClusters.GetEntriesFast();
335 if( !nclus ) return activeDet;
337 for( Int_t j=0; j<nclus; ++j ) {
338 TString detStr = ((AliTriggerCluster*)fClusters.At(j))->GetDetectorsInCluster();
339 TObjArray* det = detStr.Tokenize(" ");
340 Int_t ndet = det->GetEntriesFast();
341 for( Int_t k=0; k<ndet; ++k ) {
342 if( activeDet.Contains( ((TObjString*)det->At(k))->String() ) )continue;
343 activeDet.Append( " " );
344 activeDet.Append( ((TObjString*)det->At(k))->String() );
350 //_____________________________________________________________________________
351 TString AliTriggerConfiguration::GetTriggeringDetectors() const
353 // Return an string with all detectors
354 // used for triggering
358 Int_t ninputs = fInputs.GetEntriesFast();
359 if( !ninputs ) return trDet;
361 for( Int_t j=0; j<ninputs; j++ ) {
362 TString detStr = ((AliTriggerInput*)fInputs.At(j))->GetDetector();
363 if( trDet.Contains( detStr ) ) continue;
365 trDet.Append( detStr );
370 //_____________________________________________________________________________
371 TString AliTriggerConfiguration::GetTriggeringModules() const
373 // Return an string with all detectors (modules in the AliRoot
374 // simulation sense) used for triggering
378 Int_t ninputs = fInputs.GetEntriesFast();
379 if( !ninputs ) return trDet;
381 for( Int_t j=0; j<ninputs; j++ ) {
382 TString detStr = ((AliTriggerInput*)fInputs.At(j))->GetModule();
383 if( trDet.Contains( detStr ) ) continue;
385 trDet.Append( detStr );
390 //_____________________________________________________________________________
391 AliTriggerDescriptor* AliTriggerConfiguration::AddDescriptor( TString &name, TString &cond )
393 // Add a trigger descriptor to
394 // the list of the trigger descriptors
395 AliTriggerDescriptor *desc = new AliTriggerDescriptor(name,cond);
396 if (!AddDescriptor(desc)) {
404 //_____________________________________________________________________________
405 Bool_t AliTriggerConfiguration::AddDescriptor( AliTriggerDescriptor *desc )
407 // Add a trigger descriptor to
408 // the list of the trigger descriptors
409 if (fDescriptors.GetEntries() < kNMaxClasses) {
410 if (desc->CheckInputsAndFunctions(fInputs,fFunctions)) {
411 fDescriptors.AddLast( desc );
415 AliError("Invalid trigger desciptor ! Impossible to add it !");
418 AliError("CTP can handle up to 50 different descriptors ! Impossible to add the required descriptor !");
423 //_____________________________________________________________________________
424 Bool_t AliTriggerConfiguration::AddClass( AliTriggerClass *trclass )
426 // Add a trigger class to
427 // the list of the trigger classes
428 if (fClasses.GetEntries() < kNMaxClasses) {
429 if (trclass->CheckClass(this)) {
430 fClasses.AddLast( trclass );
434 AliError("Invalid trigger class ! Impossible to add it !");
437 AliError("CTP can handle up to 50 different classes ! Impossible to add the required class !");
442 //_____________________________________________________________________________
443 AliTriggerClass *AliTriggerConfiguration::AddClass( TString &name, UChar_t index,
444 AliTriggerDescriptor *desc, AliTriggerCluster *clus,
445 AliTriggerPFProtection *pfp, AliTriggerBCMask *mask,
446 UInt_t prescaler, Bool_t allrare)
448 // Add a trigger class to
449 // the list of the trigger classes
450 if (!fDescriptors.FindObject(desc)) {
451 AliError("Invalid descriptor ! Impossible to add the class !");
454 if (!fClusters.FindObject(clus)) {
455 AliError("Invalid cluster ! Impossible to add the class !");
458 if (!fPFProtections.FindObject(pfp)) {
459 AliError("Invalid past-future protection ! Impossible to add the class !");
462 if (!fMasks.FindObject(mask)) {
463 AliError("Invalid bunch-crossing mask ! Impossible to add the class !");
466 AliTriggerClass* trclass = new AliTriggerClass( name,index,desc,clus,pfp,mask,prescaler,allrare );
467 if (!AddClass(trclass)) {
475 //_____________________________________________________________________________
476 AliTriggerClass *AliTriggerConfiguration::AddClass( TString &name, UChar_t index,
477 TString &desc, TString &clus,
478 TString &pfp, TString &mask,
479 UInt_t prescaler, Bool_t allrare)
481 // Add a new trigger class
482 if (!fDescriptors.FindObject(desc)) {
483 AliError("Invalid descriptor ! Impossible to add the class !");
486 if (!fClusters.FindObject(clus)) {
487 AliError("Invalid cluster ! Impossible to add the class !");
490 if (!fPFProtections.FindObject(pfp)) {
491 AliError("Invalid past-future protection ! Impossible to add the class !");
494 if (!fMasks.FindObject(mask)) {
495 AliError("Invalid bunch-crossing mask ! Impossible to add the class !");
498 AliTriggerClass* trclass = new AliTriggerClass( this, name,index,desc,clus,pfp,mask,prescaler,allrare );
499 if (!AddClass(trclass)) {
507 //_____________________________________________________________________________
508 Bool_t AliTriggerConfiguration::ProcessConfigurationLine(const char* line, Int_t& level)
510 // processes one line of configuration
512 TString strLine(line);
514 if (strLine.BeginsWith("#")) return kTRUE;
515 if (strLine.BeginsWith("PARTITION:")) {
516 strLine.ReplaceAll("PARTITION:","");
517 SetName(strLine.Data());
520 if (strLine.BeginsWith("VERSION:")) {
521 strLine.ReplaceAll("VERSION:","");
522 fVersion = strLine.Atoi();
525 if (strLine.BeginsWith("INPUTS:")) {
529 if (strLine.BeginsWith("INTERACTIONS:")) {
533 if (strLine.BeginsWith("DESCRIPTORS:")) {
537 if (strLine.BeginsWith("CLUSTERS:")) {
541 if (strLine.BeginsWith("PFS:")) {
545 if (strLine.BeginsWith("BCMASKS:")) {
549 if (strLine.BeginsWith("CLASSES:")) {
554 strLine.ReplaceAll("*",'!');
555 strLine.ReplaceAll("~",'!');
556 TObjArray *tokens = strLine.Tokenize(" \t");
557 Int_t ntokens = tokens->GetEntriesFast();
567 AliError(Form("Invalid trigger input syntax (%s)!",strLine.Data()));
570 AddInput(((TObjString*)tokens->At(0))->String(),
571 ((TObjString*)tokens->At(1))->String(),
572 ((TObjString*)tokens->At(2))->String().Atoi(),
573 ((TObjString*)tokens->At(3))->String().Atoi(),
574 ((TObjString*)tokens->At(4))->String().Atoi());
579 AliError(Form("Invalid trigger interaction syntax (%s)!",strLine.Data()));
582 AddInteraction(((TObjString*)tokens->At(0))->String(),
583 ((TObjString*)tokens->At(1))->String());
586 // Read logical functions and descriptors
588 if ((((TObjString*)tokens->At(0))->String().CompareTo("EMPTY") == 0) ||
589 (((TObjString*)tokens->At(0))->String().CompareTo("DEMPTY") == 0)) {
590 AddDescriptor(((TObjString*)tokens->At(0))->String(),
591 strLine.ReplaceAll(((TObjString*)tokens->At(0))->String(),""));
595 AliError(Form("Invalid trigger descriptor syntax (%s)!",strLine.Data()));
599 if (((TObjString*)tokens->At(0))->String().BeginsWith("l0f")) {
601 AddFunction(((TObjString*)tokens->At(0))->String(),
602 strLine.ReplaceAll(((TObjString*)tokens->At(0))->String(),""));
605 AddDescriptor(((TObjString*)tokens->At(0))->String(),
606 strLine.ReplaceAll(((TObjString*)tokens->At(0))->String(),""));
612 AliError(Form("Invalid trigger cluster syntax (%s)!",strLine.Data()));
616 for(Int_t i = 2; i < ntokens; i++) {
617 strTemp += ((TObjString*)tokens->At(i))->String();
620 AddCluster(((TObjString*)tokens->At(0))->String(),
621 ((TObjString*)tokens->At(1))->String().Atoi(),
627 AliTriggerPFProtection *pfp = NULL;
628 if ((((TObjString*)tokens->At(0))->String().CompareTo("NONE") == 0) ||
629 (((TObjString*)tokens->At(0))->String().CompareTo("NOPF") == 0)) {
630 pfp = new AliTriggerPFProtection(((TObjString*)tokens->At(0))->String());
634 AliError(Form("Invalid trigger pfs syntax (%s)!",strLine.Data()));
637 pfp = new AliTriggerPFProtection(((TObjString*)tokens->At(0))->String(),
638 ((TObjString*)tokens->At(1))->String(),
639 ((TObjString*)tokens->At(2))->String(),
640 ((TObjString*)tokens->At(3))->String());
641 pfp->SetNa1(((TObjString*)tokens->At(4))->String().Atoi());
642 pfp->SetNa2(((TObjString*)tokens->At(5))->String().Atoi());
643 pfp->SetNb1(((TObjString*)tokens->At(6))->String().Atoi());
644 pfp->SetNb2(((TObjString*)tokens->At(7))->String().Atoi());
645 pfp->SetTa(((TObjString*)tokens->At(8))->String().Atoi());
646 pfp->SetTb(((TObjString*)tokens->At(9))->String().Atoi());
648 AddPFProtection(pfp);
653 AliError(Form("Invalid trigger bcmasks syntax (%s)!",strLine.Data()));
656 if (((TObjString*)tokens->At(0))->String().CompareTo("NONE") == 0)
657 AddMask(new AliTriggerBCMask(((TObjString*)tokens->At(0))->String()));
659 AddMask(((TObjString*)tokens->At(0))->String(),
660 ((TObjString*)tokens->At(1))->String());
666 AliError(Form("Invalid trigger class syntax (%s)!",strLine.Data()));
669 AliTriggerClass *trclass = new AliTriggerClass(this,
670 ((TObjString*)tokens->At(0))->String(),((TObjString*)tokens->At(1))->String().Atoi(),
671 ((TObjString*)tokens->At(2))->String(),((TObjString*)tokens->At(3))->String(),
672 ((TObjString*)tokens->At(4))->String(),((TObjString*)tokens->At(5))->String(),
673 ((TObjString*)tokens->At(6))->String().Atoi(),(Bool_t)(((TObjString*)tokens->At(7))->String().Atoi()));
684 //_____________________________________________________________________________
685 AliTriggerConfiguration* AliTriggerConfiguration::LoadConfiguration(TString & configuration)
687 // Load one pre-created Configurations from database/file that match
688 // with the input string 'configuration'
689 // Ej: "Pb-Pb" or "p-p-DIMUON CALIBRATION-CENTRAL-BARREL"
690 // By default the files are stored in GRP/CTP folder.
691 // The filename is constructed as: GRP/CTP/<configuration>.cfg
693 // Load the selected configuration
695 if (configuration.EndsWith(".cfg") ||
696 configuration.EndsWith(".shuttle")) {
697 filename = configuration;
700 filename = gSystem->Getenv("ALICE_ROOT");
701 filename += "/GRP/CTP/";
702 filename += configuration;
706 if( gSystem->AccessPathName( filename.Data() ) ) {
707 AliErrorClass( Form( "file (%s) not found", filename.Data() ) );
712 ifstream *file = new ifstream ( filename.Data() );
714 AliErrorClass(Form("Error opening file (%s) !",filename.Data()));
720 AliTriggerConfiguration *cfg = new AliTriggerConfiguration();
725 while (strLine.ReadLine(*file)) {
726 if (cfg->ProcessConfigurationLine(strLine, level) == kFALSE)
740 //_____________________________________________________________________________
741 AliTriggerConfiguration* AliTriggerConfiguration::LoadConfigurationFromString(const char* configuration)
743 // Loads configuration given as parameter <configuration>
748 AliTriggerConfiguration *cfg = new AliTriggerConfiguration();
752 TObjArray* tokens = TString(configuration).Tokenize("\n");
753 for (Int_t i=0; i<tokens->GetEntries(); i++)
755 TObjString* str = dynamic_cast<TObjString*>(tokens->At(i));
759 if (cfg->ProcessConfigurationLine(str->String(), level) == kFALSE)
772 //_____________________________________________________________________________
773 TObjArray* AliTriggerConfiguration::GetAvailableConfigurations( const char* filename )
775 // Return an array of configuration in the file
779 path += gSystem->Getenv( "ALICE_ROOT" );
780 path += fgkConfigurationFileName;
785 if( gSystem->AccessPathName( path.Data() ) ) {
786 AliErrorGeneral( "AliTriggerConfiguration", Form( "file (%s) not found", path.Data() ) );
790 TObjArray* desArray = new TObjArray();
792 TFile file( path.Data(), "READ" );
793 if( file.IsZombie() ) {
794 AliErrorGeneral( "AliTriggerConfiguration", Form( "Error opening file (%s)", path.Data() ) );
801 TIter next( file.GetListOfKeys() );
802 while( (key = (TKey*)next()) ) {
803 TObject* obj = key->ReadObj();
804 if( obj->InheritsFrom( "AliTriggerConfiguration" ) ) {
805 desArray->AddLast( obj );
813 //_____________________________________________________________________________
814 void AliTriggerConfiguration::WriteConfiguration( const char* filename )
816 // Write the configuration
819 path += gSystem->Getenv("ALICE_ROOT");
820 path += fgkConfigurationFileName;
825 TFile file( path.Data(), "UPDATE" );
826 if( file.IsZombie() ) {
827 AliErrorGeneral( "AliTriggerConfiguration",
828 Form( "Can't open file (%s)", path.Data() ) );
832 Bool_t result = (Write( GetName(), TObject::kOverwrite ) != 0);
834 AliErrorGeneral( "AliTriggerConfiguration",
835 Form( "Can't write entry to file <%s>!", path.Data() ) );
839 //_____________________________________________________________________________
840 Bool_t AliTriggerConfiguration::CheckConfiguration( TString& configfile )
842 // To be used on the pre-creation of Configurations to check if the
843 // conditions have valid inputs names.
845 // Initiate detectors modules from a Config file
846 // Ask to each active module present in the fDetectorCluster
847 // to create a Trigger detector and retrive the inputs from it
848 // to create a list of inputs.
849 // Each condition in the configuration is then checked agains
850 // the list of inputs
854 AliError( "no gAlice object. Restart aliroot and try again." );
857 if (gAlice->Modules()->GetEntries() > 0) {
858 AliError( "gAlice was already run. Restart aliroot and try again." );
862 AliInfo( Form( "initializing gAlice with config file %s",
863 configfile.Data() ) );
864 //_______________________________________________________________________
867 gROOT->LoadMacro(configfile.Data());
868 gInterpreter->ProcessLine(gAlice->GetConfigFunction());
870 if(AliCDBManager::Instance()->GetRun() >= 0) {
871 AliRunLoader::Instance()->SetRunNumber(AliCDBManager::Instance()->GetRun());
873 AliWarning("Run number not initialized!!");
876 AliRunLoader::Instance()->CdGAFile();
878 AliPDG::AddParticlesToPdgDataBase();
880 gAlice->GetMCApp()->Init();
882 //Must be here because some MCs (G4) adds detectors here and not in Config.C
883 gAlice->InitLoaders();
884 AliRunLoader::Instance()->MakeTree("E");
885 AliRunLoader::Instance()->LoadKinematics("RECREATE");
886 AliRunLoader::Instance()->LoadTrackRefs("RECREATE");
887 AliRunLoader::Instance()->LoadHits("all","RECREATE");
889 // Save stuff at the beginning of the file to avoid file corruption
890 AliRunLoader::Instance()->CdGAFile();
893 AliRunLoader* runLoader = AliRunLoader::Instance();
895 AliError( Form( "gAlice has no run loader object. "
896 "Check your config file: %s", configfile.Data() ) );
900 // get the possible inputs to check the condition
902 TObjArray* detArray = runLoader->GetAliRun()->Detectors();
904 TString detStr = GetTriggeringModules();
906 for( Int_t iDet = 0; iDet < detArray->GetEntriesFast(); iDet++ ) {
907 AliModule* det = (AliModule*) detArray->At(iDet);
908 if( !det || !det->IsActive() ) continue;
909 if( IsSelected( det->GetName(), detStr ) ) {
910 AliInfo( Form( "Creating inputs for %s", det->GetName() ) );
911 AliTriggerDetector* dtrg = det->CreateTriggerDetector();
912 dtrg->CreateInputs(GetInputs());
913 TObjArray* detInp = dtrg->GetInputs();
914 for( Int_t i=0; i<detInp->GetEntriesFast(); i++ ) {
915 AliInfo( Form( "Adding input %s", ((AliTriggerInput*)detInp->At(i))->GetName() ) );
916 inputs.AddLast( detInp->At(i) );
921 // check if the condition is compatible with the triggers inputs
922 Int_t ndesc = fClasses.GetEntriesFast();
923 Bool_t check = kTRUE;
925 for( Int_t j=0; j<ndesc; j++ ) {
926 AliTriggerClass *trclass = (AliTriggerClass*)fClasses.At( j );
927 if( !(trclass->CheckClass( this )) ) check = kFALSE;
929 if (trclass->IsActive(this->GetInputs(),this->GetFunctions())) {
930 AliInfo( Form( "Trigger Class (%s) OK, class mask (0x%Lx)",
931 trclass->GetName(), trclass->GetMask( ) ) );
934 AliWarning( Form( "Trigger Class (%s) is NOT active, class mask (0x%Lx)",
935 trclass->GetName(), trclass->GetMask( ) ) );
938 // check if condition mask is duplicated
939 if( mask & trclass->GetMask() ) {
940 AliError( Form("Class (%s). The class mask (0x%Lx) is ambiguous. It was already defined",
941 trclass->GetName(), trclass->GetMask() ) );
944 mask |= trclass->GetMask();
950 //_____________________________________________________________________________
951 void AliTriggerConfiguration::Reset()
953 for( Int_t j=0; j<fInputs.GetEntriesFast(); j++ )
954 ((AliTriggerInput*)fInputs.At(j))->Reset();
956 for( Int_t j=0; j<fClasses.GetEntriesFast(); j++ )
957 ((AliTriggerClass*)fClasses.At(j))->Reset();
960 //_____________________________________________________________________________
961 void AliTriggerConfiguration::Print( const Option_t* ) const
964 cout << "#################################################" << endl;
965 cout << "Trigger Configuration:" << endl;
966 cout << " Name: " << GetName() << endl;
967 cout << " Description: " << GetTitle() << endl;
968 cout << " Version: " << GetVersion() << endl;
969 cout << " Active Detectors: " << GetActiveDetectors() << endl;
970 cout << " Trigger Detectors: " << GetTriggeringDetectors() << endl;
972 cout << "#################################################" << endl;
974 cout << "#################################################" << endl;
975 fInteractions.Print();
976 cout << "#################################################" << endl;
978 cout << "#################################################" << endl;
979 fDescriptors.Print();
980 cout << "#################################################" << endl;
982 cout << "#################################################" << endl;
983 fPFProtections.Print();
984 cout << "#################################################" << endl;
986 cout << "#################################################" << endl;
988 cout << "#################################################" << endl;
994 //////////////////////////////////////////////////////////////////////////////
997 //_____________________________________________________________________________
998 Bool_t AliTriggerConfiguration::IsSelected( TString detName, TString& detectors ) const
1000 // check whether detName is contained in detectors
1001 // if yes, it is removed from detectors
1003 // check if all detectors are selected
1004 if( (detectors.CompareTo("ALL") == 0 ) ||
1005 detectors.BeginsWith("ALL ") ||
1006 detectors.EndsWith(" ALL") ||
1007 detectors.Contains(" ALL ") ) {
1012 // search for the given detector
1013 Bool_t result = kFALSE;
1014 if( (detectors.CompareTo( detName ) == 0) ||
1015 detectors.BeginsWith( detName+" " ) ||
1016 detectors.EndsWith( " "+detName ) ||
1017 detectors.Contains( " "+detName+" " ) ) {
1018 detectors.ReplaceAll( detName, "" );
1022 // clean up the detectors string
1023 while( detectors.Contains(" ") ) detectors.ReplaceAll( " ", " " );
1024 while( detectors.BeginsWith(" ") ) detectors.Remove( 0, 1 );
1025 while( detectors.EndsWith(" ") ) detectors.Remove( detectors.Length()-1, 1 );