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