Example macro (E.Lopez)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Mar 2006 17:36:19 +0000 (17:36 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Mar 2006 17:36:19 +0000 (17:36 +0000)
STEER/ReadTrigger.C [new file with mode: 0644]

diff --git a/STEER/ReadTrigger.C b/STEER/ReadTrigger.C
new file mode 100644 (file)
index 0000000..d207e2c
--- /dev/null
@@ -0,0 +1,46 @@
+ReadTrigger( TString inFile = "galice.root" )
+{
+   // Dynamically link some shared libs
+   if( gClassTable->GetID( "AliRun" ) < 0 ) {
+      gROOT->ProcessLine( ".x $(ALICE_ROOT)/macros/loadlibs.C" );
+   } else if( gAlice ) {
+      delete gAlice->GetRunLoader();
+      delete gAlice;
+      gAlice=0;
+   }
+
+   AliRunLoader* rl = AliRunLoader::Open( inFile.Data() );
+   if( rl == 0x0 ) {
+      cerr << "ReadTrigger.C : Can not open session RunLoader=NULL"
+           << endl;
+       return 3;
+   }
+
+   // Read and Print Trigger
+
+   rl->LoadTrigger();
+   AliCentralTrigger *aCTP = rl->GetTrigger();
+   aCTP->Print();
+
+   // Loop over event and print trigger info
+   Int_t nevent = rl->GetNumberOfEvents();
+   for( Int_t i=0; i<nevent; i++ ) {
+      rl->GetEvent( i );
+      cout << endl << "Event " << i
+           << " Global Trigger Class Mask: 0x" << hex << aCTP->GetClassMask() << endl;
+
+      // Read trigger inputs from detector. Example. ITS
+      AliLoader * loader = rl->GetDetectorLoader( "ITS" );
+      if( loader ) {
+         AliDataLoader * dataLoader = loader->GetDigitsDataLoader();
+         if( !dataLoader->IsFileOpen() ) 
+            dataLoader->OpenFile( "READ" );
+         AliTriggerDetector* trgdet = (AliTriggerDetector*)dataLoader->GetDirectory()->Get( "Trigger" );
+         if( trgdet ) {
+            trgdet->Print();
+         } else {
+            cerr << "There is not trigger object for " << loader->GetName() << endl;
+         }
+      }
+   }
+}
\ No newline at end of file