]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONTestTrigger.C
improving IO
[u/mrichter/AliRoot.git] / MUON / MUONTestTrigger.C
CommitLineData
a9e2aefa 1#include "iostream.h"
2// example of macro which retrieves the Trigger Output from galice.root
3
4void MUONTestTrigger (Int_t evNumber1=0,Int_t evNumber2=0)
5{
6//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7// Dynamically link some shared libs
8 if (gClassTable->GetID("AliRun") < 0) {
9 gROOT->LoadMacro("loadlibs.C");
10 loadlibs();
11 }
12
13// Connect the Root Galice file containing Geometry, Kine and Hits
14 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
15 if (file) file->Close();
16 file = new TFile("galice.root","READ");
17
18// Get AliRun object from file or create it if not on file
19 printf ("I'm after Map \n");
20 if (!gAlice) {
21 gAlice = (AliRun*)file->Get("gAlice");
22 if (gAlice) printf("AliRun object found on file\n");
23 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
24 }
25 printf ("I'm after gAlice \n");
26//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
27
28 for (int nev=evNumber1; nev<= evNumber2; nev++) {
29 Int_t nparticles = gAlice->GetEvent(nev);
30 cout << "nev npart =" << nev << " , " << nparticles << "\n";
31 if (nev < evNumber1) continue;
32 if (nparticles <= 0) return;
33
34 Int_t nbytes = 0;
35 AliMUONGlobalTrigger *gloTrg;
36 AliMUONLocalTrigger *locTrg;
37
38// Get pointers to Alice detectors and Triggers containers
39 AliMUON *MUON = (AliMUON*)gAlice->GetModule("MUON");
40 TClonesArray *globalTrigger = MUON->GlobalTrigger();
41 TClonesArray *localTrigger = MUON->LocalTrigger();
42
43 TTree *TR = gAlice->TreeR();
44 TBranch *gbranch = TR->GetBranch("MUONGlobalTrigger");
45 TBranch *lbranch = TR->GetBranch("MUONLocalTrigger");
46 gbranch->SetAddress(&globalTrigger);
47 lbranch->SetAddress(&localTrigger);
48
49 Int_t nent = TR->GetEntries();
50 cout << ">>> " << nent << " entries found in TreeR of event "
51 << nev << "\n";
52 Int_t nb = 0;
53
54 for (Int_t n=1; n<nent; n++) {
55 MUON->ResetTrigger();
56 nbytes += TR->GetEvent(n);
57
58 Int_t nglobals = globalTrigger->GetEntries(); // should be = 1
59 Int_t nlocals = localTrigger->GetEntries(); // who knows ?
60
61 for (Int_t i=0; i<nglobals; i++) { // inspect Global Trigger
62 cout << " >>> Output for Global Trigger " << "\n";
63
64 gloTrg = (AliMUONGlobalTrigger*)globalTrigger->UncheckedAt(i);
65
61d7fd01 66 cout << "fSinglePlusLpt = " << gloTrg->SinglePlusLpt() << "\n";
67 cout << "fSinglePlusHpt = " << gloTrg->SinglePlusHpt() << "\n";
68 cout << "fSinglePlusApt = " << gloTrg->SinglePlusApt() << "\n";
a9e2aefa 69
61d7fd01 70 cout << "fSingleMinusLpt = " << gloTrg->SingleMinusLpt() << "\n";
71 cout << "fSingleMinusHpt = " << gloTrg->SingleMinusHpt() << "\n";
72 cout << "fSingleMinusApt = " << gloTrg->SingleMinusApt() << "\n";
a9e2aefa 73
61d7fd01 74 cout << "fSingleUndefLpt = " << gloTrg->SingleUndefLpt() << "\n";
75 cout << "fSingleUndefHpt = " << gloTrg->SingleUndefHpt() << "\n";
76 cout << "fSingleUndefApt = " << gloTrg->SingleUndefApt() << "\n";
a9e2aefa 77
61d7fd01 78 cout << "fPairLikeLpt = " << gloTrg->PairLikeLpt() << "\n";
79 cout << "fPairLikeHpt = " << gloTrg->PairLikeHpt() << "\n";
80 cout << "fPairLikeApt = " << gloTrg->PairLikeApt() << "\n";
a9e2aefa 81
61d7fd01 82 cout << "fPairUnlikeLpt = " << gloTrg->PairUnlikeLpt() << "\n";
83 cout << "fPairUnlikeHpt = " << gloTrg->PairUnlikeHpt() << "\n";
84 cout << "fPairUnlikeApt = " << gloTrg->PairUnlikeApt() << "\n";
a9e2aefa 85 } // end of loop on Global Trigger
86
87 for (Int_t i=0; i<nlocals; i++) { // inspect Local Trigger
88 cout << " >>> Output for Local Trigger # " << i << "\n";
89
90 locTrg = (AliMUONLocalTrigger*)localTrigger->UncheckedAt(i);
91
61d7fd01 92 cout << "fLoCircuit = " << locTrg->LoCircuit() << "\n";
93 cout << "fLoStripX = " << locTrg->LoStripX() << "\n";
94 cout << "fLoDev = " << locTrg->LoDev() << "\n";
95 cout << "fLoStripY = " << locTrg->LoStripY() << "\n";
96 cout << "fLoLpt = " << locTrg->LoLpt() << "\n";
97 cout << "fLoHpt = " << locTrg->LoHpt() << "\n";
98 cout << "fLoApt = " << locTrg->LoApt() << "\n";
a9e2aefa 99
100 } // end of loop on Local Trigger
101 } // end of loop on entries of TreeR
102 } // loop on event
103
a9e2aefa 104}
105
106
107
108