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>
74 #include "AliTriggerBCMask.h"
75 #include "AliTriggerClass.h"
76 #include "AliTriggerCluster.h"
77 #include "AliTriggerConfiguration.h"
78 #include "AliTriggerDescriptor.h"
79 #include "AliTriggerInput.h"
80 #include "AliTriggerInteraction.h"
81 #include "AliTriggerPFProtection.h"
83 ClassImp(AliTriggerConfiguration)
85 const TString AliTriggerConfiguration::fgkConfigurationFileName("/data/triggerConfigurations.root");
87 //_____________________________________________________________________________
88 AliTriggerConfiguration::AliTriggerConfiguration():
100 // Default constructor
103 //_____________________________________________________________________________
104 AliTriggerConfiguration::AliTriggerConfiguration( TString & name, TString & description ):
105 TNamed( name, description ),
119 //_____________________________________________________________________________
120 AliTriggerConfiguration::~AliTriggerConfiguration()
125 fInteractions.SetOwner();
126 fInteractions.Delete();
127 fFunctions.SetOwner();
129 fPFProtections.SetOwner();
130 fPFProtections.Delete();
133 fDescriptors.SetOwner();
134 fDescriptors.Delete();
135 fClusters.SetOwner();
141 //_____________________________________________________________________________
142 Bool_t AliTriggerConfiguration::AddInput( AliTriggerInput* input )
144 // Add a trigger input to
145 // the list of the trigger inputs
146 if (fInputs.GetEntries() < kNMaxInputs) {
147 fInputs.AddLast( input );
151 AliError("CTP can handle up to 60 inputs ! Impossible to add the required input !");
156 //_____________________________________________________________________________
157 AliTriggerInput* AliTriggerConfiguration::AddInput( TString &name, TString &det,
158 UChar_t level, UInt_t signature,
161 // Add a trigger input to
162 // the list of the trigger inputs
163 AliTriggerInput *input = new AliTriggerInput(name,det,level,signature,number);
164 if (!AddInput(input)) {
172 //_____________________________________________________________________________
173 AliTriggerInteraction* AliTriggerConfiguration::AddInteraction(TString &name, TString &logic)
175 // Add a trigger interaction object to
176 // the list of the trigger interactions
177 AliTriggerInteraction *interact = new AliTriggerInteraction(name,logic);
178 if (!AddInteraction(interact)) {
186 //_____________________________________________________________________________
187 Bool_t AliTriggerConfiguration::AddInteraction(AliTriggerInteraction *interact)
189 // Add a trigger interaction object to
190 // the list of the trigger interactions
191 if (fInteractions.GetEntries() < kNMaxInteractions) {
192 if (interact->CheckInputs(fInputs)) {
193 fInteractions.AddLast( interact );
197 AliError("Invalid interaction ! Impossible to add it !");
200 AliError("CTP can handle up to 2 interactions ! Impossible to add the required interaction !");
205 //_____________________________________________________________________________
206 AliTriggerInteraction* AliTriggerConfiguration::AddFunction(TString &name, TString &logic)
208 // Add a trigger function object to
209 // the list of the trigger functions
210 AliTriggerInteraction *func = new AliTriggerInteraction(name,logic);
211 if (!AddFunction(func)) {
219 //_____________________________________________________________________________
220 Bool_t AliTriggerConfiguration::AddFunction(AliTriggerInteraction *func)
222 // Add a trigger function object to
223 // the list of the trigger functions
224 if (fFunctions.GetEntries() < kNMaxFunctions) {
225 if (func->CheckInputs(fInputs)) {
226 fFunctions.AddLast( func );
230 AliError("Invalid logical function ! Impossible to add it !");
233 AliError("CTP can handle up to 2 logical functions ! Impossible to add the required interaction !");
238 //_____________________________________________________________________________
239 Bool_t AliTriggerConfiguration::AddPFProtection( AliTriggerPFProtection* pfp )
241 // Add a trigger past-future protection object to
242 // the list of the trigger past-future protections
243 if (fPFProtections.GetEntries() < kNMaxPFProtections) {
244 //if (pfp->CheckInteractions(fInteractions)) {
246 fPFProtections.AddLast( pfp );
250 AliError("Invalid past-future protection ! Impossible to add it !");
253 AliError("CTP can handle up to 4 past-future protections ! Impossible to add the required protection !");
258 //_____________________________________________________________________________
259 AliTriggerBCMask* AliTriggerConfiguration::AddMask( TString &name, TString &mask )
261 // Add a trigger bunch-crossing mask object to
262 // the list of the trigger bunch-crossing masks
263 AliTriggerBCMask *bcmask = new AliTriggerBCMask(name,mask);
264 if (!AddMask(bcmask)) {
272 //_____________________________________________________________________________
273 Bool_t AliTriggerConfiguration::AddMask( AliTriggerBCMask* mask )
275 // Add a trigger bunch-crossing mask object to
276 // the list of the trigger bunch-crossing masks
277 if (fMasks.GetEntries() < (kNMaxMasks+1)) { //+1 to account for NONE
278 fMasks.AddLast( mask );
282 AliError("CTP can handle up to 4 bunch-crossing masks ! Impossible to add the required mask !");
287 //_____________________________________________________________________________
288 AliTriggerCluster* AliTriggerConfiguration::AddCluster( TString &name, UChar_t index, TString &detectors)
290 // Add a trigger detector readout cluster to
291 // the list of the trigger clusters
292 AliTriggerCluster *clust = new AliTriggerCluster(name,index,detectors);
293 if (!AddCluster(clust)) {
302 //_____________________________________________________________________________
303 Bool_t AliTriggerConfiguration::AddCluster( AliTriggerCluster* cluster )
305 // Add a trigger detector readout cluster to
306 // the list of the trigger clusters
307 if (fClusters.GetEntries() < kNMaxClusters) {
308 TString dets(cluster->GetDetectorsInCluster());
309 if (!(dets.IsNull())) {
310 fClusters.AddLast( cluster );
314 AliError("Empty trigger cluster ! Impossible to add it !");
317 AliError("CTP can handle up to 6 different detector clusters ! Impossible to add the required cluster !");
322 //_____________________________________________________________________________
323 TString AliTriggerConfiguration::GetActiveDetectors() const
325 // Return an string with all active detector
328 TString activeDet = "";
330 Int_t nclus = fClusters.GetEntriesFast();
331 if( !nclus ) return activeDet;
333 for( Int_t j=0; j<nclus; ++j ) {
334 TString detStr = ((AliTriggerCluster*)fClusters.At(j))->GetDetectorsInCluster();
335 TObjArray* det = detStr.Tokenize(" ");
336 Int_t ndet = det->GetEntriesFast();
337 for( Int_t k=0; k<ndet; ++k ) {
338 if( activeDet.Contains( ((TObjString*)det->At(k))->String() ) )continue;
339 activeDet.Append( " " );
340 activeDet.Append( ((TObjString*)det->At(k))->String() );
346 //_____________________________________________________________________________
347 TString AliTriggerConfiguration::GetTriggeringDetectors() const
349 // Return an string with all detectors
350 // used for triggering
354 Int_t ninputs = fInputs.GetEntriesFast();
355 if( !ninputs ) return trDet;
357 for( Int_t j=0; j<ninputs; j++ ) {
358 TString detStr = ((AliTriggerInput*)fInputs.At(j))->GetDetector();
359 if( trDet.Contains( detStr ) ) continue;
361 trDet.Append( detStr );
366 //_____________________________________________________________________________
367 TString AliTriggerConfiguration::GetTriggeringModules() const
369 // Return an string with all detectors (modules in the AliRoot
370 // simulation sense) used for triggering
374 Int_t ninputs = fInputs.GetEntriesFast();
375 if( !ninputs ) return trDet;
377 for( Int_t j=0; j<ninputs; j++ ) {
378 TString detStr = ((AliTriggerInput*)fInputs.At(j))->GetModule();
379 if( trDet.Contains( detStr ) ) continue;
381 trDet.Append( detStr );
386 //_____________________________________________________________________________
387 AliTriggerDescriptor* AliTriggerConfiguration::AddDescriptor( TString &name, TString &cond )
389 // Add a trigger descriptor to
390 // the list of the trigger descriptors
391 AliTriggerDescriptor *desc = new AliTriggerDescriptor(name,cond);
392 if (!AddDescriptor(desc)) {
400 //_____________________________________________________________________________
401 Bool_t AliTriggerConfiguration::AddDescriptor( AliTriggerDescriptor *desc )
403 // Add a trigger descriptor to
404 // the list of the trigger descriptors
405 if (fDescriptors.GetEntries() < kNMaxClasses) {
406 if (desc->CheckInputsAndFunctions(fInputs,fFunctions)) {
407 fDescriptors.AddLast( desc );
411 AliError("Invalid trigger desciptor ! Impossible to add it !");
414 AliError("CTP can handle up to 50 different descriptors ! Impossible to add the required descriptor !");
419 //_____________________________________________________________________________
420 Bool_t AliTriggerConfiguration::AddClass( AliTriggerClass *trclass )
422 // Add a trigger class to
423 // the list of the trigger classes
424 if (fClasses.GetEntries() < kNMaxClasses) {
425 if (trclass->CheckClass(this)) {
426 fClasses.AddLast( trclass );
430 AliError("Invalid trigger class ! Impossible to add it !");
433 AliError("CTP can handle up to 50 different classes ! Impossible to add the required class !");
438 //_____________________________________________________________________________
439 AliTriggerClass *AliTriggerConfiguration::AddClass( TString &name, UChar_t index,
440 AliTriggerDescriptor *desc, AliTriggerCluster *clus,
441 AliTriggerPFProtection *pfp, AliTriggerBCMask *mask,
442 UInt_t prescaler, Bool_t allrare)
444 // Add a trigger class to
445 // the list of the trigger classes
446 if (!fDescriptors.FindObject(desc)) {
447 AliError("Invalid descriptor ! Impossible to add the class !");
450 if (!fClusters.FindObject(clus)) {
451 AliError("Invalid cluster ! Impossible to add the class !");
454 if (!fPFProtections.FindObject(pfp)) {
455 AliError("Invalid past-future protection ! Impossible to add the class !");
458 if (!fMasks.FindObject(mask)) {
459 AliError("Invalid bunch-crossing mask ! Impossible to add the class !");
462 AliTriggerClass* trclass = new AliTriggerClass( name,index,desc,clus,pfp,mask,prescaler,allrare );
463 if (!AddClass(trclass)) {
471 //_____________________________________________________________________________
472 AliTriggerClass *AliTriggerConfiguration::AddClass( TString &name, UChar_t index,
473 TString &desc, TString &clus,
474 TString &pfp, TString &mask,
475 UInt_t prescaler, Bool_t allrare)
477 // Add a new trigger class
478 if (!fDescriptors.FindObject(desc)) {
479 AliError("Invalid descriptor ! Impossible to add the class !");
482 if (!fClusters.FindObject(clus)) {
483 AliError("Invalid cluster ! Impossible to add the class !");
486 if (!fPFProtections.FindObject(pfp)) {
487 AliError("Invalid past-future protection ! Impossible to add the class !");
490 if (!fMasks.FindObject(mask)) {
491 AliError("Invalid bunch-crossing mask ! Impossible to add the class !");
494 AliTriggerClass* trclass = new AliTriggerClass( this, name,index,desc,clus,pfp,mask,prescaler,allrare );
495 if (!AddClass(trclass)) {
503 //_____________________________________________________________________________
504 Bool_t AliTriggerConfiguration::ProcessConfigurationLine(const char* line, Int_t& level)
506 // processes one line of configuration
508 TString strLine(line);
510 if (strLine.BeginsWith("#")) return kTRUE;
511 if (strLine.BeginsWith("PARTITION:")) {
512 strLine.ReplaceAll("PARTITION:","");
513 SetName(strLine.Data());
516 if (strLine.BeginsWith("VERSION:")) {
517 strLine.ReplaceAll("VERSION:","");
518 fVersion = strLine.Atoi();
521 if (strLine.BeginsWith("INPUTS:")) {
525 if (strLine.BeginsWith("INTERACTIONS:")) {
529 if (strLine.BeginsWith("DESCRIPTORS:")) {
533 if (strLine.BeginsWith("CLUSTERS:")) {
537 if (strLine.BeginsWith("PFS:")) {
541 if (strLine.BeginsWith("BCMASKS:")) {
545 if (strLine.BeginsWith("CLASSES:")) {
550 strLine.ReplaceAll("*",'!');
551 strLine.ReplaceAll("~",'!');
552 TObjArray *tokens = strLine.Tokenize(" \t");
553 Int_t ntokens = tokens->GetEntriesFast();
563 AliError(Form("Invalid trigger input syntax (%s)!",strLine.Data()));
566 AddInput(((TObjString*)tokens->At(0))->String(),
567 ((TObjString*)tokens->At(1))->String(),
568 ((TObjString*)tokens->At(2))->String().Atoi(),
569 ((TObjString*)tokens->At(3))->String().Atoi(),
570 ((TObjString*)tokens->At(4))->String().Atoi());
575 AliError(Form("Invalid trigger interaction syntax (%s)!",strLine.Data()));
578 AddInteraction(((TObjString*)tokens->At(0))->String(),
579 ((TObjString*)tokens->At(1))->String());
582 // Read logical functions and descriptors
584 if ((((TObjString*)tokens->At(0))->String().CompareTo("EMPTY") == 0) ||
585 (((TObjString*)tokens->At(0))->String().CompareTo("DTRUE") == 0) ||
586 (((TObjString*)tokens->At(0))->String().CompareTo("DEMPTY") == 0)) {
587 AddDescriptor(((TObjString*)tokens->At(0))->String(),
588 strLine.ReplaceAll(((TObjString*)tokens->At(0))->String(),""));
592 AliError(Form("Invalid trigger descriptor syntax (%s)!",strLine.Data()));
596 if (((TObjString*)tokens->At(0))->String().BeginsWith("l0f")) {
598 AddFunction(((TObjString*)tokens->At(0))->String(),
599 strLine.ReplaceAll(((TObjString*)tokens->At(0))->String(),""));
602 AddDescriptor(((TObjString*)tokens->At(0))->String(),
603 strLine.ReplaceAll(((TObjString*)tokens->At(0))->String(),""));
609 AliError(Form("Invalid trigger cluster syntax (%s)!",strLine.Data()));
612 if (((TObjString*)tokens->At(1))->String().Atoi() <= 0) {
613 AliError(Form("Invalid trigger cluster syntax (%s)!",strLine.Data()));
617 for(Int_t i = 2; i < ntokens; i++) {
618 strTemp += ((TObjString*)tokens->At(i))->String();
621 AddCluster(((TObjString*)tokens->At(0))->String(),
622 ((TObjString*)tokens->At(1))->String().Atoi(),
628 AliTriggerPFProtection *pfp = NULL;
629 if ((((TObjString*)tokens->At(0))->String().CompareTo("NONE") == 0) ||
630 (((TObjString*)tokens->At(0))->String().CompareTo("NOPF") == 0)) {
631 pfp = new AliTriggerPFProtection(((TObjString*)tokens->At(0))->String());
635 pfp = new AliTriggerPFProtection(((TObjString*)tokens->At(0))->String(),
636 ((TObjString*)tokens->At(1))->String(),
637 ((TObjString*)tokens->At(2))->String(),
638 ((TObjString*)tokens->At(3))->String());
639 pfp->SetNa1(((TObjString*)tokens->At(4))->String().Atoi());
640 pfp->SetNa2(((TObjString*)tokens->At(5))->String().Atoi());
641 pfp->SetNb1(((TObjString*)tokens->At(6))->String().Atoi());
642 pfp->SetNb2(((TObjString*)tokens->At(7))->String().Atoi());
643 pfp->SetTa(((TObjString*)tokens->At(8))->String().Atoi());
644 pfp->SetTb(((TObjString*)tokens->At(9))->String().Atoi());
645 }else if(ntokens == 13){
647 for(Int_t i=0;i<12;i++){
648 TString ss(((TObjString*)tokens->At(i+1))->String());
651 for(Int_t j=ss.Length()-1;j>=0;j--){
653 if(nn >= (UInt_t)'0' && nn <= (UInt_t)'9')nn=nn-(UInt_t)'0'; else
654 if(nn >= (UInt_t)'A' && nn <= (UInt_t)'F')nn=10+nn-(UInt_t)'A'; else
655 if(nn >= (UInt_t)'a' && nn <= (UInt_t)'f')nn=10+nn-(UInt_t)'a'; else{
656 AliError(Form("Invalid trigger pfs syntax (%s)!",strLine.Data()));
659 num=num+(1<<(ss.Length()-1-j)*4)*nn;
660 //cout << ss[j] << " 2 " << nn << " " << num << endl;
664 pfp = new AliTriggerPFProtection(((TObjString*)tokens->At(0))->String(),pfdef);
666 AliError(Form("Invalid trigger pfs syntax (%s)!",strLine.Data()));
670 AddPFProtection(pfp);
675 AliError(Form("Invalid trigger bcmasks syntax (%s)!",strLine.Data()));
678 if (((TObjString*)tokens->At(0))->String().CompareTo("NONE") == 0)
680 AddMask(new AliTriggerBCMask(((TObjString*)tokens->At(0))->String()));
683 AddMask(((TObjString*)tokens->At(0))->String(),
684 ((TObjString*)tokens->At(1))->String());
689 if ((ntokens < 8) || (ntokens >10)) {
690 AliError(Form("Invalid trigger class syntax (%s)!",strLine.Data()));
693 AliTriggerClass *trclass = new AliTriggerClass(this,
694 ((TObjString*)tokens->At(0))->String(),((TObjString*)tokens->At(1))->String().Atoi(),
695 ((TObjString*)tokens->At(2))->String(),((TObjString*)tokens->At(3))->String(),
696 ((TObjString*)tokens->At(4))->String(),((TObjString*)tokens->At(5))->String(),
697 ((TObjString*)tokens->At(6))->String().Atoi(),(Bool_t)(((TObjString*)tokens->At(7))->String().Atoi()));
708 //_____________________________________________________________________________
709 AliTriggerConfiguration* AliTriggerConfiguration::LoadConfiguration(TString & configuration)
711 // Load one pre-created Configurations from database/file that match
712 // with the input string 'configuration'
713 // Ej: "Pb-Pb" or "p-p-DIMUON CALIBRATION-CENTRAL-BARREL"
714 // By default the files are stored in GRP/CTP folder.
715 // The filename is constructed as: GRP/CTP/<configuration>.cfg
717 // Load the selected configuration
719 if (configuration.EndsWith(".cfg") ||
720 configuration.EndsWith(".shuttle")) {
721 filename = configuration;
724 filename = gSystem->Getenv("ALICE_ROOT");
725 filename += "/GRP/CTP/";
726 filename += configuration;
730 if( gSystem->AccessPathName( filename.Data() ) ) {
731 AliErrorClass( Form( "file (%s) not found", filename.Data() ) );
736 ifstream *file = new ifstream ( filename.Data() );
738 AliErrorClass(Form("Error opening file (%s) !",filename.Data()));
744 AliTriggerConfiguration *cfg = new AliTriggerConfiguration();
749 while (strLine.ReadLine(*file)) {
750 if (cfg->ProcessConfigurationLine(strLine, level) == kFALSE)
764 //_____________________________________________________________________________
765 AliTriggerConfiguration* AliTriggerConfiguration::LoadConfigurationFromString(const char* configuration)
767 // Loads configuration given as parameter <configuration>
772 AliTriggerConfiguration *cfg = new AliTriggerConfiguration();
776 TObjArray* tokens = TString(configuration).Tokenize("\n");
777 for (Int_t i=0; i<tokens->GetEntries(); i++)
779 TObjString* str = dynamic_cast<TObjString*>(tokens->At(i));
783 if (cfg->ProcessConfigurationLine(str->String(), level) == kFALSE)
796 //_____________________________________________________________________________
797 TObjArray* AliTriggerConfiguration::GetAvailableConfigurations( const char* filename )
799 // Return an array of configuration in the file
803 path += gSystem->Getenv( "ALICE_ROOT" );
804 path += fgkConfigurationFileName;
809 if( gSystem->AccessPathName( path.Data() ) ) {
810 AliErrorGeneral( "AliTriggerConfiguration", Form( "file (%s) not found", path.Data() ) );
814 TObjArray* desArray = new TObjArray();
816 TFile file( path.Data(), "READ" );
817 if( file.IsZombie() ) {
818 AliErrorGeneral( "AliTriggerConfiguration", Form( "Error opening file (%s)", path.Data() ) );
825 TIter next( file.GetListOfKeys() );
826 while( (key = (TKey*)next()) ) {
827 TObject* obj = key->ReadObj();
828 if( obj->InheritsFrom( "AliTriggerConfiguration" ) ) {
829 desArray->AddLast( obj );
837 //_____________________________________________________________________________
838 void AliTriggerConfiguration::WriteConfiguration( const char* filename )
840 // Write the configuration
843 path += gSystem->Getenv("ALICE_ROOT");
844 path += fgkConfigurationFileName;
849 TFile file( path.Data(), "UPDATE" );
850 if( file.IsZombie() ) {
851 AliErrorGeneral( "AliTriggerConfiguration",
852 Form( "Can't open file (%s)", path.Data() ) );
856 Bool_t result = (Write( GetName(), TObject::kOverwrite ) != 0);
858 AliErrorGeneral( "AliTriggerConfiguration",
859 Form( "Can't write entry to file <%s>!", path.Data() ) );
863 //_____________________________________________________________________________
864 Int_t AliTriggerConfiguration::GetClassIndexFromName(const char* className) const
866 //const TObjArray& classes = cfg->GetClasses();
867 Int_t nclasses = (Int_t)fClasses.GetEntriesFast();
868 for (Int_t i=0;i<nclasses;i++) {
869 AliTriggerClass* trgclass = (AliTriggerClass*)fClasses.At(i);
870 if (TString(trgclass->GetName()).CompareTo(className) == 0) {
871 ULong64_t classmask = (ULong64_t)trgclass->GetMask();
872 return TMath::Nint(TMath::Log2(classmask))+1;
877 //_____________________________________________________________________________
878 const char* AliTriggerConfiguration::GetClassNameFromIndex(Int_t classIndex) const
880 Int_t nclasses = (Int_t)fClasses.GetEntriesFast();
881 for (Int_t i=0;i<nclasses;i++) {
882 AliTriggerClass* trgclass = (AliTriggerClass*)fClasses.At(i);
883 ULong64_t classmask = (ULong64_t)trgclass->GetMask();
884 if (TMath::Nint(TMath::Log2(classmask))+1 == classIndex) return trgclass->GetName();
888 //_____________________________________________________________________________
889 AliTriggerClass* AliTriggerConfiguration::GetTriggerClass(Int_t classIndex) const
891 Int_t nclasses = (Int_t)fClasses.GetEntriesFast();
892 for (Int_t i=0;i<nclasses;i++) {
893 AliTriggerClass* trgclass = (AliTriggerClass*)fClasses.At(i);
894 ULong64_t classmask = (ULong64_t)trgclass->GetMask();
895 if (TMath::Nint(TMath::Log2(classmask))+1 == classIndex) return trgclass;
899 //_____________________________________________________________________________
900 void AliTriggerConfiguration::Reset()
902 for( Int_t j=0; j<fInputs.GetEntriesFast(); j++ )
903 ((AliTriggerInput*)fInputs.At(j))->Reset();
905 for( Int_t j=0; j<fClasses.GetEntriesFast(); j++ )
906 ((AliTriggerClass*)fClasses.At(j))->Reset();
909 //_____________________________________________________________________________
910 void AliTriggerConfiguration::Print( const Option_t* ) const
913 cout << "#################################################" << endl;
914 cout << "Trigger Configuration:" << endl;
915 cout << " Name: " << GetName() << endl;
916 cout << " Description: " << GetTitle() << endl;
917 cout << " Version: " << GetVersion() << endl;
918 cout << " Active Detectors: " << GetActiveDetectors() << endl;
919 cout << " Trigger Detectors: " << GetTriggeringDetectors() << endl;
921 cout << "#################################################" << endl;
923 cout << "#################################################" << endl;
924 fInteractions.Print();
925 cout << "#################################################" << endl;
927 cout << "#################################################" << endl;
928 fDescriptors.Print();
929 cout << "#################################################" << endl;
931 cout << "#################################################" << endl;
932 fPFProtections.Print();
933 cout << "#################################################" << endl;
935 cout << "#################################################" << endl;
937 cout << "#################################################" << endl;
943 //////////////////////////////////////////////////////////////////////////////
946 //_____________________________________________________________________________
947 Bool_t AliTriggerConfiguration::IsSelected( TString detName, TString& detectors ) const
949 // check whether detName is contained in detectors
950 // if yes, it is removed from detectors
952 // check if all detectors are selected
953 if( (detectors.CompareTo("ALL") == 0 ) ||
954 detectors.BeginsWith("ALL ") ||
955 detectors.EndsWith(" ALL") ||
956 detectors.Contains(" ALL ") ) {
961 // search for the given detector
962 Bool_t result = kFALSE;
963 if( (detectors.CompareTo( detName ) == 0) ||
964 detectors.BeginsWith( detName+" " ) ||
965 detectors.EndsWith( " "+detName ) ||
966 detectors.Contains( " "+detName+" " ) ) {
967 detectors.ReplaceAll( detName, "" );
971 // clean up the detectors string
972 while( detectors.Contains(" ") ) detectors.ReplaceAll( " ", " " );
973 while( detectors.BeginsWith(" ") ) detectors.Remove( 0, 1 );
974 while( detectors.EndsWith(" ") ) detectors.Remove( detectors.Length()-1, 1 );