]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONreco.C
Updated VZERO source
[u/mrichter/AliRoot.git] / MUON / MUONreco.C
CommitLineData
c4270ab7 1// Macro MUONreco.C for testing the C++ reconstruction code
8d4daf7f 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 //
c4270ab7 13 cout << "MUONreco" << endl;
8d4daf7f 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
c4270ab7 25 // Connect the Root Galice file containing Geometry, Kine, Hits
26 // and eventually RawClusters
8d4daf7f 27 TFile *file = (TFile*) gROOT->GetListOfFiles()->FindObject(FileName);
28 if (!file) {
29 printf("\n Creating file %s\n", FileName);
30 file = new TFile(FileName);
31 }
32 else printf("\n File %s found in file list\n", FileName);
33
34 // Get AliRun object from file or create it if not on file
35 if (!gAlice) {
36 gAlice = (AliRun*) file->Get("gAlice");
37 if (gAlice) printf("AliRun object found on file\n");
38 if (!gAlice) {
39 printf("\n Create new gAlice object");
40 gAlice = new AliRun("gAlice","Alice test program");
41 }
42 }
43
44 // Initializations
45 // AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
46 AliMUONEventReconstructor *Reco = new AliMUONEventReconstructor();
47 Reco->SetRecGeantHits(RecGeantHits);
48
49 // The right place for changing AliMUONEventReconstructor parameters
50 // with respect to the default ones
51// Reco->SetMaxSigma2Distance(100.0);
52 Reco->SetPrintLevel(10);
53 cout << "AliMUONEventReconstructor: actual parameters" << endl;
54 Reco->Dump();
55
56 // Loop over events
57 for (Int_t event = FirstEvent; event <= LastEvent; event++) {
58 cout << "Event: " << event << endl;
59 AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
60 Int_t nparticles = gAlice->GetEvent(event);
61 cout << "nparticles: " << nparticles << endl;
62 // prepare background file and/or event if necessary
63 if (RecGeantHits == 1) {
64 if (event == FirstEvent) Reco->SetBkgGeantFile(BkgGeantFileName);
65 if (Reco->GetBkgGeantFile())Reco->NextBkgGeantEvent();
66 }
67 Reco->EventReconstruct();
c7ba256d 68 // Write this event in a tree
69 Reco->FillEvent();
8d4daf7f 70 // Dump current event
71 Reco->EventDump();
72 } // Event loop
73}