]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONreco.C
Double inclusion of AliResponse removed.
[u/mrichter/AliRoot.git] / MUON / MUONreco.C
CommitLineData
8d4daf7f 1// Macro for testing the new C++ reconstruction code
2
3// Arguments:
4// FirstEvent (default 0)
5// LastEvent (default 0)
6// RecGeantHits (1 to reconstruct GEANT hits) (default 0)
7// FileName (for signal) (default "galice.root")
8// BkgGeantFileName (for background),
9// needed only if RecGeantHits = 1 and background to be added
10void MUONreco (Int_t FirstEvent = 0, Int_t LastEvent = 0, Int_t RecGeantHits = 0, Text_t *FileName = "galice.root", Text_t *BkgGeantFileName = "")
11{
12 //
13 cout << "MUONtest_reco" << endl;
14 cout << "FirstEvent " << FirstEvent << endl;
15 cout << "LastEvent " << LastEvent << endl;
16 cout << "RecGeantHits " << RecGeantHits << endl;
17 cout << "FileName ``" << FileName << "''" << endl;
18 cout << "BkgGeantFileName ``" << BkgGeantFileName << "''" << endl;
19 // Dynamically link some shared libs
20 if (gClassTable->GetID("AliRun") < 0) {
21 gROOT->LoadMacro("loadlibs.C");
22 loadlibs();
23 }
24
25 // Connect the Root Galice file containing Geometry, Kine and Hits
26 TFile *file = (TFile*) gROOT->GetListOfFiles()->FindObject(FileName);
27 if (!file) {
28 printf("\n Creating file %s\n", FileName);
29 file = new TFile(FileName);
30 }
31 else printf("\n File %s found in file list\n", FileName);
32
33 // Get AliRun object from file or create it if not on file
34 if (!gAlice) {
35 gAlice = (AliRun*) file->Get("gAlice");
36 if (gAlice) printf("AliRun object found on file\n");
37 if (!gAlice) {
38 printf("\n Create new gAlice object");
39 gAlice = new AliRun("gAlice","Alice test program");
40 }
41 }
42
43 // Initializations
44 // AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
45 AliMUONEventReconstructor *Reco = new AliMUONEventReconstructor();
46 Reco->SetRecGeantHits(RecGeantHits);
47
48 // The right place for changing AliMUONEventReconstructor parameters
49 // with respect to the default ones
50// Reco->SetMaxSigma2Distance(100.0);
51 Reco->SetPrintLevel(10);
52 cout << "AliMUONEventReconstructor: actual parameters" << endl;
53 Reco->Dump();
54
55 // Loop over events
56 for (Int_t event = FirstEvent; event <= LastEvent; event++) {
57 cout << "Event: " << event << endl;
58 AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
59 Int_t nparticles = gAlice->GetEvent(event);
60 cout << "nparticles: " << nparticles << endl;
61 // prepare background file and/or event if necessary
62 if (RecGeantHits == 1) {
63 if (event == FirstEvent) Reco->SetBkgGeantFile(BkgGeantFileName);
64 if (Reco->GetBkgGeantFile())Reco->NextBkgGeantEvent();
65 }
66 Reco->EventReconstruct();
67 // Dump current event
68 Reco->EventDump();
69 } // Event loop
70}