Analysis code updated
[u/mrichter/AliRoot.git] / MFT / AliMuonForwardTrackAnalysis.C
CommitLineData
6240bf36 1// #include "AliMuonForwardTrackAnalysis.h"
2// #include "TDatabasePDG.h"
3// #include "TGeoGlobalMagField.h"
4// #include "TROOT.h"
5// #include "AliMagF.h"
cabfe25b 6
7//=============================================================================================================================================================
e806e863 8
cabfe25b 9void AliMuonForwardTrackAnalysis(const Char_t *readDir= ".", // the directory with the MuonGlobalTracks.root and geometry.root files
10 Int_t option = kNoOption, // for resonance analysis: kResonanceOnly
11 Double_t massMin = 0., // lower limit for the cut on dimuon mass
12 Double_t massMax = 10., // upper limit for the cut on dimuon mass
13 Double_t maxChi2SingleMuons = 1.5, // upper limit for the cut on the single muon chi2
14 Double_t maxOffsetSingleMuons = 250., // upper limit for the cut on the single muon offset w.r.t. the primary vtx
15 Bool_t correlateCutOnOffsetChi2 = kTRUE, // if true, the cur region in the chi2-offset plane for single muons is a quadrant aorund the origin
16 Double_t maxWOffsetMuonPairsAtPrimaryVtx = 1.e9, // upper limit for the cut on weighted offset of dimuond w.r.t. the primary vtx
17 Double_t maxWOffsetMuonPairsAtPCA = 1.e9, // upper limit for the cut on weighted offset of dimuond w.r.t. their PCA
18 Double_t maxDistancePrimaryVtxPCA = 1.e9, // upper limit for the cut on the distance between primary vtx and PCA
19 Double_t minPCAQuality = 0., // lower limit for the cut on the PCA quality
20 Int_t triggerLevel = 1, // level of the trigger both muons must satisfy
21 Int_t maxNWrongClusters = 999, // maximum number of wrong MFT clusters for a global muon track
22 const Char_t *outDir = ".", // directory where the output file will be created
23 Bool_t singleMuonAnalysis = kTRUE, // if true, the aalysis of single muons will be performed
24 Bool_t muonPairAnalysis = kTRUE, // if true, the aalysis of muon pairs will be performed
e806e863 25 Int_t firstEvent = -1,
26 Int_t lastEvent = -1,
cabfe25b 27 Int_t myRandom = 0, // number which will tag the name of the output file
28 Double_t ptMinSingleMuons = 0.0, // lower limit for the cut on the single muon pt
6240bf36 29 Double_t trueMass = 0.0, // used to evaluate the pseudo proper decay length, usually for J/psi only
30 Bool_t evalDimuonVtxResolution=kFALSE, // to be set true only if prompt dimuon sources are analyzed
31 Int_t nEventsToMix = 0) { // if <1 or >100, mixing is not performed
e806e863 32
6240bf36 33 const Double_t mJpsi = TDatabasePDG::Instance()->GetParticle("J/psi")->Mass();
34
35 if (trueMass<0) trueMass = mJpsi;
36
e806e863 37 gROOT -> LoadMacro("./AliMuonForwardTrackAnalysis.cxx+");
38 // AliLog::SetClassDebugLevel("AliMuonForwardTrackPair", 1);
6240bf36 39 // AliLog::SetClassDebugLevel("AliMuonForwardTrackAnalysis", 2);
e806e863 40
e806e863 41 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
42
43 AliMuonForwardTrackAnalysis *myAnalysis = new AliMuonForwardTrackAnalysis();
44 myAnalysis->ReadEvents(firstEvent, lastEvent);
45 myAnalysis->SetInputDir(readDir);
46 myAnalysis->SetOutputDir(outDir);
cabfe25b 47 myAnalysis->SetMassRange(massMin, massMax);
48 myAnalysis->SetTrueMass(trueMass);
e806e863 49 myAnalysis->SetSingleMuonAnalysis(singleMuonAnalysis);
50 myAnalysis->SetMuonPairAnalysis(muonPairAnalysis);
51 myAnalysis->SetOption(option);
cabfe25b 52
e806e863 53 myAnalysis->SetMaxNWrongClustersMC(maxNWrongClusters);
cabfe25b 54 myAnalysis->SetMinPtSingleMuons(ptMinSingleMuons);
55 myAnalysis->SetMaxChi2SingleMuons(maxChi2SingleMuons);
56 myAnalysis->SetMaxOffsetSingleMuons(maxOffsetSingleMuons);
57 myAnalysis->CorrelateCutOnOffsetChi2(correlateCutOnOffsetChi2);
58
59 myAnalysis->SetMaxWOffsetMuonPairsAtPrimaryVtx(maxWOffsetMuonPairsAtPrimaryVtx);
60 myAnalysis->SetMaxWOffsetMuonPairsAtPCA(maxWOffsetMuonPairsAtPCA);
61 myAnalysis->SetMaxDistancePrimaryVtxPCA(maxDistancePrimaryVtxPCA);
62 myAnalysis->SetMinPCAQuality(minPCAQuality);
3b6fd486 63
cabfe25b 64 myAnalysis->SetMatchTrigger(triggerLevel);
e806e863 65
cabfe25b 66 myAnalysis->EvalDimuonVtxResolution(evalDimuonVtxResolution); // it should be true only with prompt dimuon sources
5f74a7f3 67
6240bf36 68 myAnalysis->SetNEventsToMix(nEventsToMix);
e806e863 69
6240bf36 70 if (myAnalysis->Init("MuonGlobalTracks.root")) {
71 while (myAnalysis->LoadNextEvent()) continue;
72 myAnalysis->Terminate(Form("outFiles/outFile.%d.%d.%d.root", myAnalysis->GetFirstEvent(), myAnalysis->GetLastEvent(), myRandom));
73 }
e806e863 74
75}
76
77//================================================================================================================================
78