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>
64 #include <TObjArray.h>
65 #include <TObjString.h>
73 #include "AliTriggerBCMask.h"
74 #include "AliTriggerClass.h"
75 #include "AliTriggerCluster.h"
76 #include "AliTriggerConfiguration.h"
77 #include "AliTriggerDescriptor.h"
78 #include "AliTriggerInput.h"
79 #include "AliTriggerInteraction.h"
80 #include "AliTriggerPFProtection.h"
85 ClassImp(AliTriggerConfiguration)
87 const TString AliTriggerConfiguration::fgkConfigurationFileName("/data/triggerConfigurations.root");
89 //_____________________________________________________________________________
90 AliTriggerConfiguration::AliTriggerConfiguration():
102 // Default constructor
105 //_____________________________________________________________________________
106 AliTriggerConfiguration::AliTriggerConfiguration( TString & name, TString & description ):
107 TNamed( name, description ),
121 //_____________________________________________________________________________
122 AliTriggerConfiguration::~AliTriggerConfiguration()
127 fInteractions.SetOwner();
128 fInteractions.Delete();
129 fFunctions.SetOwner();
131 fPFProtections.SetOwner();
132 fPFProtections.Delete();
135 fDescriptors.SetOwner();
136 fDescriptors.Delete();
137 fClusters.SetOwner();
143 //_____________________________________________________________________________
144 Bool_t AliTriggerConfiguration::AddInput( AliTriggerInput* input )
146 // Add a trigger input to
147 // the list of the trigger inputs
148 if (fInputs.GetEntries() < kNMaxInputs) {
149 fInputs.AddLast( input );
153 AliError("CTP can handle up to 60 inputs ! Impossible to add the required input !");
158 //_____________________________________________________________________________
159 AliTriggerInput* AliTriggerConfiguration::AddInput( TString &name, TString &det,
160 UChar_t level, UInt_t signature,
163 // Add a trigger input to
164 // the list of the trigger inputs
165 AliTriggerInput *input = new AliTriggerInput(name,det,level,signature,number);
166 if (!AddInput(input)) {
174 //_____________________________________________________________________________
175 AliTriggerInteraction* AliTriggerConfiguration::AddInteraction(TString &name, TString &logic)
177 // Add a trigger interaction object to
178 // the list of the trigger interactions
179 AliTriggerInteraction *interact = new AliTriggerInteraction(name,logic);
180 if (!AddInteraction(interact)) {
188 //_____________________________________________________________________________
189 Bool_t AliTriggerConfiguration::AddInteraction(AliTriggerInteraction *interact)
191 // Add a trigger interaction object to
192 // the list of the trigger interactions
193 if (fInteractions.GetEntries() < kNMaxInteractions) {
194 if (interact->CheckInputs(fInputs)) {
195 fInteractions.AddLast( interact );
199 AliError("Invalid interaction ! Impossible to add it !");
202 AliError("CTP can handle up to 2 interactions ! Impossible to add the required interaction !");
207 //_____________________________________________________________________________
208 AliTriggerInteraction* AliTriggerConfiguration::AddFunction(TString &name, TString &logic)
210 // Add a trigger function object to
211 // the list of the trigger functions
212 AliTriggerInteraction *func = new AliTriggerInteraction(name,logic);
213 if (!AddFunction(func)) {
221 //_____________________________________________________________________________
222 Bool_t AliTriggerConfiguration::AddFunction(AliTriggerInteraction *func)
224 // Add a trigger function object to
225 // the list of the trigger functions
226 if (fFunctions.GetEntries() < kNMaxFunctions) {
227 if (func->CheckInputs(fInputs)) {
228 fFunctions.AddLast( func );
232 AliError("Invalid logical function ! Impossible to add it !");
235 AliError("CTP can handle up to 4 logical functions ! Impossible to add the required interaction !");
240 //_____________________________________________________________________________
241 Bool_t AliTriggerConfiguration::AddPFProtection( AliTriggerPFProtection* pfp )
243 // Add a trigger past-future protection object to
244 // the list of the trigger past-future protections
245 if (fPFProtections.GetEntries() < kNMaxPFProtections) {
246 //if (pfp->CheckInteractions(fInteractions)) {
248 fPFProtections.AddLast( pfp );
252 AliError("Invalid past-future protection ! Impossible to add it !");
255 AliError("CTP can handle up to 4 past-future protections ! Impossible to add the required protection !");
260 //_____________________________________________________________________________
261 AliTriggerBCMask* AliTriggerConfiguration::AddMask( TString &name, TString &mask )
263 // Add a trigger bunch-crossing mask object to
264 // the list of the trigger bunch-crossing masks
265 AliTriggerBCMask *bcmask = new AliTriggerBCMask(name,mask);
266 if (!AddMask(bcmask)) {
274 //_____________________________________________________________________________
275 Bool_t AliTriggerConfiguration::AddMask( AliTriggerBCMask* mask )
277 // Add a trigger bunch-crossing mask object to
278 // the list of the trigger bunch-crossing masks
279 if (fMasks.GetEntries() < (kNMaxMasks)) {
280 fMasks.AddLast( mask );
284 AliError("CTP can handle up to 12 bunch-crossing masks ! Impossible to add the required mask !");
289 //_____________________________________________________________________________
290 AliTriggerCluster* AliTriggerConfiguration::AddCluster( TString &name, UChar_t index, TString &detectors)
292 // Add a trigger detector readout cluster to
293 // the list of the trigger clusters
294 AliTriggerCluster *clust = new AliTriggerCluster(name,index,detectors);
295 if (!AddCluster(clust)) {
304 //_____________________________________________________________________________
305 Bool_t AliTriggerConfiguration::AddCluster( AliTriggerCluster* cluster )
307 // Add a trigger detector readout cluster to
308 // the list of the trigger clusters
309 if (fClusters.GetEntries() < kNMaxClusters) {
310 TString dets(cluster->GetDetectorsInCluster());
311 if (!(dets.IsNull())) {
312 fClusters.AddLast( cluster );
316 AliError("Empty trigger cluster ! Impossible to add it !");
319 AliError("CTP can handle up to 6 different detector clusters ! Impossible to add the required cluster !");
324 //_____________________________________________________________________________
325 TString AliTriggerConfiguration::GetActiveDetectors() const
327 // Return an string with all active detector
330 TString activeDet = "";
332 Int_t nclus = fClusters.GetEntriesFast();
333 if( !nclus ) return activeDet;
335 for( Int_t j=0; j<nclus; ++j ) {
336 TString detStr = ((AliTriggerCluster*)fClusters.At(j))->GetDetectorsInCluster();
337 TObjArray* det = detStr.Tokenize(" ");
338 Int_t ndet = det->GetEntriesFast();
339 for( Int_t k=0; k<ndet; ++k ) {
340 if( activeDet.Contains( ((TObjString*)det->At(k))->String() ) )continue;
341 activeDet.Append( " " );
342 activeDet.Append( ((TObjString*)det->At(k))->String() );
349 //_____________________________________________________________________________
350 TString AliTriggerConfiguration::GetTriggeringDetectors() const
352 // Return an string with all detectors
353 // used for triggering
357 Int_t ninputs = fInputs.GetEntriesFast();
358 if( !ninputs ) return trDet;
360 for( Int_t j=0; j<ninputs; j++ ) {
361 TString detStr = ((AliTriggerInput*)fInputs.At(j))->GetDetector();
362 if( trDet.Contains( detStr ) ) continue;
364 trDet.Append( detStr );
369 //_____________________________________________________________________________
370 TString AliTriggerConfiguration::GetTriggeringModules() const
372 // Return an string with all detectors (modules in the AliRoot
373 // simulation sense) used for triggering
377 Int_t ninputs = fInputs.GetEntriesFast();
378 if( !ninputs ) return trDet;
380 for( Int_t j=0; j<ninputs; j++ ) {
381 TString detStr = ((AliTriggerInput*)fInputs.At(j))->GetModule();
382 if( trDet.Contains( detStr ) ) continue;
384 trDet.Append( detStr );
389 //_____________________________________________________________________________
390 AliTriggerDescriptor* AliTriggerConfiguration::AddDescriptor( TString &name, TString &cond )
392 // Add a trigger descriptor to
393 // the list of the trigger descriptors
394 AliTriggerDescriptor *desc = new AliTriggerDescriptor(name,cond);
395 if (!AddDescriptor(desc)) {
403 //_____________________________________________________________________________
404 Bool_t AliTriggerConfiguration::AddDescriptor( AliTriggerDescriptor *desc )
406 // Add a trigger descriptor to
407 // the list of the trigger descriptors
408 if (fDescriptors.GetEntries() < kNMaxClasses) {
409 if (desc->CheckInputsAndFunctions(fInputs,fFunctions)) {
410 fDescriptors.AddLast( desc );
414 AliError("Invalid trigger desciptor ! Impossible to add it !");
417 AliError("CTP can handle up to 50 different descriptors ! Impossible to add the required descriptor !");
422 //_____________________________________________________________________________
423 Bool_t AliTriggerConfiguration::AddClass( AliTriggerClass *trclass )
425 // Add a trigger class to
426 // the list of the trigger classes
427 if (fClasses.GetEntries() < kNMaxClasses) {
428 if (trclass->CheckClass(this)) {
429 fClasses.AddLast( trclass );
433 AliError("Invalid trigger class ! Impossible to add it !");
436 AliError("CTP can handle up to 50 different classes ! Impossible to add the required class !");
441 //_____________________________________________________________________________
442 AliTriggerClass *AliTriggerConfiguration::AddClass( TString &name, UChar_t index,
443 AliTriggerDescriptor *desc, AliTriggerCluster *clus,
444 AliTriggerPFProtection *pfp, AliTriggerBCMask *mask,
445 UInt_t prescaler, Bool_t allrare)
447 // Add a trigger class to
448 // the list of the trigger classes
449 if (!fDescriptors.FindObject(desc)) {
450 AliError("Invalid descriptor ! Impossible to add the class !");
453 if (!fClusters.FindObject(clus)) {
454 AliError("Invalid cluster ! Impossible to add the class !");
457 if (!fPFProtections.FindObject(pfp)) {
458 AliError("Invalid past-future protection ! Impossible to add the class !");
461 if (!fMasks.FindObject(mask)) {
462 AliError("Invalid bunch-crossing mask ! Impossible to add the class !");
465 AliTriggerClass* trclass = new AliTriggerClass( name,index,desc,clus,pfp,mask,prescaler,allrare );
466 if (!AddClass(trclass)) {
474 //_____________________________________________________________________________
475 AliTriggerClass *AliTriggerConfiguration::AddClass( TString &name, UChar_t index,
476 TString &desc, TString &clus,
477 TString &pfp, TString &mask,
478 UInt_t prescaler, Bool_t allrare)
480 // Add a new trigger class
481 if (!fDescriptors.FindObject(desc)) {
482 AliError("Invalid descriptor ! Impossible to add the class !");
485 if (!fClusters.FindObject(clus)) {
486 AliError("Invalid cluster ! Impossible to add the class !");
489 if (!fPFProtections.FindObject(pfp)) {
490 AliError("Invalid past-future protection ! Impossible to add the class !");
493 if (!fMasks.FindObject(mask)) {
494 AliError("Invalid bunch-crossing mask ! Impossible to add the class !");
497 AliTriggerClass* trclass = new AliTriggerClass( this, name,index,desc,clus,pfp,mask,prescaler,allrare );
498 if (!AddClass(trclass)) {
506 //_____________________________________________________________________________
507 Bool_t AliTriggerConfiguration::ProcessConfigurationLine(const char* line, Int_t& level)
509 // processes one line of configuration
511 TString strLine(line);
513 if (strLine.BeginsWith("#")) return kTRUE;
514 if (strLine.BeginsWith("PARTITION:")) {
515 strLine.ReplaceAll("PARTITION:","");
516 SetName(strLine.Data());
519 if (strLine.BeginsWith("VERSION:")) {
520 strLine.ReplaceAll("VERSION:","");
521 fVersion = strLine.Atoi();
524 if (strLine.BeginsWith("INPUTS:")) {
528 if (strLine.BeginsWith("INTERACTIONS:")) {
532 if (strLine.BeginsWith("DESCRIPTORS:")) {
536 if (strLine.BeginsWith("CLUSTERS:")) {
540 if (strLine.BeginsWith("PFS:")) {
544 if (strLine.BeginsWith("BCMASKS:")) {
548 if (strLine.BeginsWith("CLASSES:")) {
553 strLine.ReplaceAll("*",'!');
554 strLine.ReplaceAll("~",'!');
555 TObjArray *tokens = strLine.Tokenize(" \t");
556 Int_t ntokens = tokens->GetEntriesFast();
566 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()));
583 AddInteraction(((TObjString*)tokens->At(0))->String(),
584 ((TObjString*)tokens->At(1))->String());
587 // Read logical functions and descriptors
589 if ((((TObjString*)tokens->At(0))->String().CompareTo("EMPTY") == 0) ||
590 (((TObjString*)tokens->At(0))->String().CompareTo("DTRUE") == 0) ||
591 (((TObjString*)tokens->At(0))->String().CompareTo("DEMPTY") == 0)) {
592 AddDescriptor(((TObjString*)tokens->At(0))->String(),
593 strLine.ReplaceAll(((TObjString*)tokens->At(0))->String(),""));
597 AliError(Form("Invalid trigger descriptor syntax (%s)!",strLine.Data()));
602 if (((TObjString*)tokens->At(0))->String().BeginsWith("l0f")) {
604 if(!AddFunction(((TObjString*)tokens->At(0))->String(),
605 strLine.ReplaceAll(((TObjString*)tokens->At(0))->String(),""))) {
611 if(!AddDescriptor(((TObjString*)tokens->At(0))->String(),
612 strLine.ReplaceAll(((TObjString*)tokens->At(0))->String(),""))) {
621 AliError(Form("Invalid trigger cluster syntax (%s)!",strLine.Data()));
625 if (((TObjString*)tokens->At(1))->String().Atoi() <= 0) {
626 AliError(Form("Invalid trigger cluster syntax (%s)!",strLine.Data()));
630 for(Int_t i = 2; i < ntokens; i++) {
631 strTemp += ((TObjString*)tokens->At(i))->String();
634 AddCluster(((TObjString*)tokens->At(0))->String(),
635 ((TObjString*)tokens->At(1))->String().Atoi(),
641 AliTriggerPFProtection *pfp = NULL;
642 if ((((TObjString*)tokens->At(0))->String().CompareTo("NONE") == 0) ||
643 (((TObjString*)tokens->At(0))->String().CompareTo("NOPF") == 0)) {
644 pfp = new AliTriggerPFProtection(((TObjString*)tokens->At(0))->String());
648 pfp = new AliTriggerPFProtection(((TObjString*)tokens->At(0))->String(),
649 ((TObjString*)tokens->At(1))->String(),
650 ((TObjString*)tokens->At(2))->String(),
651 ((TObjString*)tokens->At(3))->String());
652 pfp->SetNa1(((TObjString*)tokens->At(4))->String().Atoi());
653 pfp->SetNa2(((TObjString*)tokens->At(5))->String().Atoi());
654 pfp->SetNb1(((TObjString*)tokens->At(6))->String().Atoi());
655 pfp->SetNb2(((TObjString*)tokens->At(7))->String().Atoi());
656 pfp->SetTa(((TObjString*)tokens->At(8))->String().Atoi());
657 pfp->SetTb(((TObjString*)tokens->At(9))->String().Atoi());
658 }else if(ntokens == 13){
660 for(Int_t i=0;i<12;i++){
661 TString ss(((TObjString*)tokens->At(i+1))->String());
664 for(Int_t j=ss.Length()-1;j>=0;j--){
666 if(nn >= (UInt_t)'0' && nn <= (UInt_t)'9')nn=nn-(UInt_t)'0'; else
667 if(nn >= (UInt_t)'A' && nn <= (UInt_t)'F')nn=10+nn-(UInt_t)'A'; else
668 if(nn >= (UInt_t)'a' && nn <= (UInt_t)'f')nn=10+nn-(UInt_t)'a'; else{
669 AliError(Form("Invalid trigger pfs syntax (%s)!",strLine.Data()));
672 num=num+(1<<(ss.Length()-1-j)*4)*nn;
673 //cout << ss[j] << " 2 " << nn << " " << num << endl;
677 pfp = new AliTriggerPFProtection(((TObjString*)tokens->At(0))->String(),pfdef);
679 AliError(Form("Invalid trigger pfs syntax (%s)!",strLine.Data()));
683 AddPFProtection(pfp);
688 AliError(Form("Invalid trigger bcmasks syntax (%s)!",strLine.Data()));
692 if (((TObjString*)tokens->At(0))->String().CompareTo("NONE") == 0)
694 if(!AddMask(new AliTriggerBCMask(((TObjString*)tokens->At(0))->String()))) {
700 if(!AddMask(((TObjString*)tokens->At(0))->String(),((TObjString*)tokens->At(1))->String())) {
708 if ((ntokens !=8) && (ntokens != 10) && (ntokens != 11)) {
709 AliError(Form("Invalid trigger class syntax (%s)!",strLine.Data()));
713 AliTriggerClass *trclass=0;
714 if(ntokens == 8)trclass = new AliTriggerClass(this,
715 ((TObjString*)tokens->At(0))->String(),((TObjString*)tokens->At(1))->String().Atoi(),
716 ((TObjString*)tokens->At(2))->String(),((TObjString*)tokens->At(3))->String(),
717 ((TObjString*)tokens->At(4))->String(),((TObjString*)tokens->At(5))->String(),
718 ((TObjString*)tokens->At(6))->String().Atoi(),(Bool_t)(((TObjString*)tokens->At(7))->String().Atoi()));
719 else{ trclass = new AliTriggerClass(this,
720 ((TObjString*)tokens->At(0))->String(),((TObjString*)tokens->At(1))->String().Atoi(),
721 ((TObjString*)tokens->At(2))->String(),((TObjString*)tokens->At(3))->String(),
722 ((TObjString*)tokens->At(4))->String(),
723 ((TObjString*)tokens->At(6))->String().Atoi(),(Bool_t)(((TObjString*)tokens->At(7))->String().Atoi()),
724 (((TObjString*)tokens->At(8))->String().Atoi()),(((TObjString*)tokens->At(9))->String().Atoi()));
725 if(!trclass->SetMasks(this,((TObjString*)tokens->At(5))->String())) {
740 //_____________________________________________________________________________
741 AliTriggerConfiguration* AliTriggerConfiguration::LoadConfiguration(TString & configuration)
743 // Load one pre-created Configurations from database/file that match
744 // with the input string 'configuration'
745 // Ej: "Pb-Pb" or "p-p-DIMUON CALIBRATION-CENTRAL-BARREL"
746 // By default the files are stored in GRP/CTP folder.
747 // The filename is constructed as: GRP/CTP/<configuration>.cfg
749 // Load the selected configuration
751 if (configuration.EndsWith(".cfg") ||
752 configuration.EndsWith(".shuttle")) {
753 filename = configuration;
756 filename = gSystem->Getenv("ALICE_ROOT");
757 filename += "/GRP/CTP/";
758 filename += configuration;
762 if( gSystem->AccessPathName( filename.Data() ) ) {
763 AliErrorClass( Form( "file (%s) not found", filename.Data() ) );
768 ifstream *file = new ifstream ( filename.Data() );
770 AliErrorClass(Form("Error opening file (%s) !",filename.Data()));
776 AliTriggerConfiguration *cfg = new AliTriggerConfiguration();
781 while (strLine.ReadLine(*file)) {
782 if (cfg->ProcessConfigurationLine(strLine, level) == kFALSE)
796 //_____________________________________________________________________________
797 AliTriggerConfiguration* AliTriggerConfiguration::LoadConfigurationFromString(const char* configuration)
799 // Loads configuration given as parameter <configuration>
804 AliTriggerConfiguration *cfg = new AliTriggerConfiguration();
808 TObjArray* tokens = TString(configuration).Tokenize("\n");
809 for (Int_t i=0; i<tokens->GetEntries(); i++)
811 TObjString* str = dynamic_cast<TObjString*>(tokens->At(i));
815 if (cfg->ProcessConfigurationLine(str->String(), level) == kFALSE)
828 //_____________________________________________________________________________
829 TObjArray* AliTriggerConfiguration::GetAvailableConfigurations( const char* filename )
831 // Return an array of configuration in the file
835 path += gSystem->Getenv( "ALICE_ROOT" );
836 path += fgkConfigurationFileName;
841 if( gSystem->AccessPathName( path.Data() ) ) {
842 AliErrorGeneral( "AliTriggerConfiguration", Form( "file (%s) not found", path.Data() ) );
846 TObjArray* desArray = new TObjArray();
848 TFile file( path.Data(), "READ" );
849 if( file.IsZombie() ) {
850 AliErrorGeneral( "AliTriggerConfiguration", Form( "Error opening file (%s)", path.Data() ) );
857 TIter next( file.GetListOfKeys() );
858 while( (key = (TKey*)next()) ) {
859 TObject* obj = key->ReadObj();
860 if( obj->InheritsFrom( "AliTriggerConfiguration" ) ) {
861 desArray->AddLast( obj );
869 //_____________________________________________________________________________
870 void AliTriggerConfiguration::WriteConfiguration( const char* filename )
872 // Write the configuration
875 path += gSystem->Getenv("ALICE_ROOT");
876 path += fgkConfigurationFileName;
881 TFile file( path.Data(), "UPDATE" );
882 if( file.IsZombie() ) {
883 AliErrorGeneral( "AliTriggerConfiguration",
884 Form( "Can't open file (%s)", path.Data() ) );
888 Bool_t result = (Write( GetName(), TObject::kOverwrite ) != 0);
890 AliErrorGeneral( "AliTriggerConfiguration",
891 Form( "Can't write entry to file <%s>!", path.Data() ) );
895 //_____________________________________________________________________________
896 Int_t AliTriggerConfiguration::GetClassIndexFromName(const char* className) const
898 //const TObjArray& classes = cfg->GetClasses();
899 Int_t nclasses = (Int_t)fClasses.GetEntriesFast();
900 for (Int_t i=0;i<nclasses;i++) {
901 AliTriggerClass* trgclass = (AliTriggerClass*)fClasses.At(i);
902 if (TString(trgclass->GetName()).CompareTo(className) == 0) {
903 ULong64_t classmask = (ULong64_t)trgclass->GetMask();
904 return TMath::Nint(TMath::Log2(classmask))+1;
909 //_____________________________________________________________________________
910 const char* AliTriggerConfiguration::GetClassNameFromIndex(Int_t classIndex) const
912 Int_t nclasses = (Int_t)fClasses.GetEntriesFast();
913 for (Int_t i=0;i<nclasses;i++) {
914 AliTriggerClass* trgclass = (AliTriggerClass*)fClasses.At(i);
915 ULong64_t classmask = (ULong64_t)trgclass->GetMask();
916 if (TMath::Nint(TMath::Log2(classmask))+1 == classIndex) return trgclass->GetName();
920 //_____________________________________________________________________________
921 AliTriggerClass* AliTriggerConfiguration::GetTriggerClass(Int_t classIndex) const
923 Int_t nclasses = (Int_t)fClasses.GetEntriesFast();
924 for (Int_t i=0;i<nclasses;i++) {
925 AliTriggerClass* trgclass = (AliTriggerClass*)fClasses.At(i);
926 ULong64_t classmask = (ULong64_t)trgclass->GetMask();
927 if (TMath::Nint(TMath::Log2(classmask))+1 == classIndex) return trgclass;
931 //_____________________________________________________________________________
932 void AliTriggerConfiguration::Reset()
934 for( Int_t j=0; j<fInputs.GetEntriesFast(); j++ )
935 ((AliTriggerInput*)fInputs.At(j))->Reset();
937 for( Int_t j=0; j<fClasses.GetEntriesFast(); j++ )
938 ((AliTriggerClass*)fClasses.At(j))->Reset();
941 //_____________________________________________________________________________
942 void AliTriggerConfiguration::Print( const Option_t* ) const
945 cout << "#################################################" << endl;
946 cout << "Trigger Configuration:" << endl;
947 cout << " Name: " << GetName() << endl;
948 cout << " Description: " << GetTitle() << endl;
949 cout << " Version: " << GetVersion() << endl;
950 cout << " Active Detectors: " << GetActiveDetectors() << endl;
951 cout << " Trigger Detectors: " << GetTriggeringDetectors() << endl;
953 cout << "#################################################" << endl;
955 cout << "#################################################" << endl;
956 fInteractions.Print();
957 cout << "#################################################" << endl;
959 cout << "#################################################" << endl;
960 fDescriptors.Print();
961 cout << "#################################################" << endl;
963 cout << "#################################################" << endl;
964 fPFProtections.Print();
965 cout << "#################################################" << endl;
967 cout << "#################################################" << endl;
969 cout << "#################################################" << endl;
975 //////////////////////////////////////////////////////////////////////////////
978 //_____________________________________________________________________________
979 Bool_t AliTriggerConfiguration::IsSelected( TString detName, TString& detectors ) const
981 // check whether detName is contained in detectors
982 // if yes, it is removed from detectors
984 // check if all detectors are selected
985 if( (detectors.CompareTo("ALL") == 0 ) ||
986 detectors.BeginsWith("ALL ") ||
987 detectors.EndsWith(" ALL") ||
988 detectors.Contains(" ALL ") ) {
993 // search for the given detector
994 Bool_t result = kFALSE;
995 if( (detectors.CompareTo( detName ) == 0) ||
996 detectors.BeginsWith( detName+" " ) ||
997 detectors.EndsWith( " "+detName ) ||
998 detectors.Contains( " "+detName+" " ) ) {
999 detectors.ReplaceAll( detName, "" );
1003 // clean up the detectors string
1004 while( detectors.Contains(" ") ) detectors.ReplaceAll( " ", " " );
1005 while( detectors.BeginsWith(" ") ) detectors.Remove( 0, 1 );
1006 while( detectors.EndsWith(" ") ) detectors.Remove( detectors.Length()-1, 1 );