]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/README.txt
coding violation fixes
[u/mrichter/AliRoot.git] / MUON / README.txt
CommitLineData
518eb852 1// $Id$
50837721 2
518eb852 3/*!
4
5\page README_main README main
6
88cb7938 7Please add to this README file all information concerning
d55fa8e9 8general items about the MUON code or the libraries
518eb852 9\ref base, \ref sim and \ref rec.
10
11Other README pages of the muon code are
12- \ref README_raw
13- \ref README_mapping
14- \ref README_calib
15- \ref README_geometry
16- \ref README_trigger
17- \ref README_shuttle
18- \ref README_evaluation
19- \ref README_fast
20
21\section s1 How to check that your aliroot is working well
22
8c4c70f6 23There is a script file AlirootRun_MUONtest.sh which
6b1e4b22 24allows for simulating, reconstructing and making the
25invariant analysis of the generated Upsilon (1S).
26The used configuration file is Config.C in MUON
27directory.
518eb852 28
8c4c70f6 29You have to type :
518eb852 30<pre>
d55fa8e9 31$ALICE_ROOT/MUON/AlirootRun_MUONtest.sh [option]
518eb852 32</pre>
d55fa8e9 33
34The complete list of the option is printed when you call
35the script with whatever non valid option, .eg. h:
36
518eb852 37<pre>
d55fa8e9 38./AlirootRun_MUONtest.sh h
39ERROR : extra option not recognized
40Usage: AlirootRun_MUONtest.sh options (-SRXsrxn:p:d:c:)
41 -S (-s) perform (or not) simulation (default is do it, i.e -S)
42 -R (-r) perform (or not) reconstruction (default is do it, i.e. -R)
43 -X event (-x) perform (or not) checks and dumps (default is do it for event 5, i.e. -X 5)
44 -n nevents (int) number of events to simulate (default 100)
45 -p recoptions (quotified string) reconstruction options to use (default "SAVEDIGITS")
46 -d full path to output directory (default /work/projects/alice/dev/AliRoot/MUON/test_out.100)
47 -c full path to configuration file for simulation (default /work/projects/alice/dev/AliRoot/MUON/Config.C)
518eb852 48</pre>
d55fa8e9 49
50The results of this test are saved in test_out.nevent directory.
60fff730 51Please note that the CDB (Condition DataBase) is now always *required*
52to perform either simulation or reconstruction. For the moment, a version
d55fa8e9 53of that CDB is stored in CVS, so you should have one already in MUON/Calib
60fff730 54subdirectories.
6b1e4b22 55
d55fa8e9 56
518eb852 57\section s2 How to check that your aliroot is working VERY well
58
7f42a16f 59There is a script file AlirootRun_MUONlongtest.sh which
60allows for simulating, reconstructing and making the
61-+invariant analysis of the generated Upsilon (1S).
62This script generates a large number of Upsilon (20k)
63in order to access differential quantities.
64The used configuration file is Config.C in MUON
65directory.
518eb852 66
7f42a16f 67One should really run this script to check if the MUON
68code can process a large number of events WITHOUT errors,
69in particular before making important commits !!
70
71You have to type :
518eb852 72<pre>
7f42a16f 73$ALICE_ROOT/MUON/AlirootRun_MUONtestlong.sh
518eb852 74</pre>
7f42a16f 75The results of this test are saved in testlong_out/ directory
76and will be kept in CVS
77
78(NOTE: the macros performing the calculations/plots MUONefficiency.C
79and MUONplotEfficiency.C are also able to handle J/Psi if
80Config.C is modified accordingly )
81
518eb852 82\section s3 How to run a MUON generation
83
d55fa8e9 84You only need to run the simulation part of the test script
85AlirootRun_MUONtest.sh
88cb7938 86
518eb852 87\section s4 How to dump the content of Root data files
88
c58ae721 89To check the content of Root data files, the AliMUON*DataInterface classes
cd4f4ea4 90provides the functions to produce an ASCII output on the screen
91which can be redirected on the file:
88cb7938 92
c58ae721 93for MC information, use AliMUONMCDataInterface :
94
518eb852 95<pre>
c58ae721 96> aliroot (or root with just the loading of MUON libs, see loadlibs.C)
97root [0] AliMUONMCDataInterface mcdi("galice.root");
98root [1] mcdi.DumpKine(5); > dump.kine
99root [2] mcdi.DumpHits(5); > dump.hits
100root [3] mcdi.DumpTrackRefs(5); > dump.trackrefs
518eb852 101</pre>
88cb7938 102
c58ae721 103for all other information, use AliMUONDataInterface :
2b32c661 104
518eb852 105<pre>
c58ae721 106> aliroot
107root [0] AliMUONDataInterface di("galice.root");
108root [1] di.DumpDigits(5); > dump.digits
109root [2] di.DumpSDigits(5); > dump.sdigits
110root [3] di.DumpRecPoints(5); > dump.recpoints
111root [4] di.DumpTrigger(5); > dump.rectrigger
518eb852 112</pre>
88cb7938 113
d55fa8e9 114Remind that during simulation and reconstruction two
115differents galice.root are generated: one for the generation
116(simulation) and other during the reconstruction.
b3ba6823 117
d55fa8e9 118If you open the wrong galice.root file you could get:
119root [0] AliMUONMCDataInterface mcdi("galice.root");
120root [1] mcdi.DumpKine(5);
121W-AliRunLoader::GetEvent: Stack not found in header
122E-TFile::TFile: file ./Kinematics.root does not exist
7985603c 123
518eb852 124\section s5 Tracking parameters, cuts, energy loss and physics processes
125
02d8f072 126Tracking parameters in MUON are automatically defined by GEANT
127MUON takes the default values of CUTs and physics processes
128defined by the Config files, except for the gas mixture medium
129of the tracking chambers. The CUT's and physics processes of
130the gas mixture medium is then defined in the galice.cuts file
131in the data directory. In particular ILOSS parameter MUST be
132equal unity (1) in order simulate a realistic energy loss
133distribution (mean value and fluctuations) in the active gas.
a88eb0d0 134
518eb852 135\section s6 Tracking of particle in the magnetic field
136
a88eb0d0 137GEANT has two ways for tracking charged particles in the
138magnetic field: HELIX et RKUTA.
139HELIX is faster and works well if the gradient of magnetic
140field is small.
141For MUON, HELIX is a not a good approximation and we must
142use RKUTA to get the optimal mass resolution of the
143spectrometer. The choice of HELIX or RKUTA is done in the
144config file when the magnetic field is defined:
518eb852 145<pre>
b97b210c 146 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", TRACKING, FACTOR, MAXB, AliMagFMaps::k5kG);
a88eb0d0 147 gAlice->SetField(field);
518eb852 148</pre>
a88eb0d0 149TRACKING must be 1 for RKUTA and 2 for HELIX (the default value for aliroot is 2 (HELIX))
150FACTOR allows you to set the magnetic field to 0, just putting FACTOR=0. Default value is 1.
151MAXB is the maximum magnetic field which is 10.T
2b32c661 152
518eb852 153\section s7 How to tune muon track reconstruction
154
155Several options and adjustable parameters are available for both Kalman and Original
d55fa8e9 156tracking algorithms (hard coded for the moment in AliMUONVTrackReconstructor.cxx):
157- *fgkSigmaToCutForTracking* : quality cut used to select new clusters to be
158 attached to the track candidate and to select good tracks.
019df241 159- *fgkMakeTrackCandidatesFast* : if this flag is set to 'true', the track candidates
160 are made assuming linear propagation between stations 4 and 5.
d55fa8e9 161- *fgkTrackAllTracks* : according to the value of this flag, in case that several
162 new clusters pass the quality cut, either we consider all the possibilities
163 (duplicating tracks) or we attach only the best cluster.
164- *fgkRecoverTracks* : if this flag is set to 'true', we try to recover the tracks
165 lost during the tracking by removing the worst of the 2 clusters attached in the
166 previous station.
167- *fgkImproveTracks* : if this flag is set to 'true', we try to improve the quality
168 of the tracks at the end of the tracking by removing clusters that do not pass
169 new quality cut (within the limit that we must keep at least one cluster per
170 the station).
171- *fgkSigmaToCutForImprovement* : quality cut used when we try to improve the
172 quality of the tracks.
173
518eb852 174\section s8 MUON cocktail for physics ..............
175
f4f795ed 176There is a MUON cocktail generator of the muon sources in the
177EVGEN directory. This class derives from AliGenCocktail.
178In the init of this class I have filled the cocktail with
179the muon sources: J/Psi, Upsilon, Open Charm, Open Beauty,
180Pion, Kaons. The code needs only the production cross section
181at 4pi (for the moment this values are in the code since I
182prefere them do not be modified), and the code calculates the
183rate of particles in the acceptance, making the scaling based
184on the number of collisions for the hard probes and on the
185number of participants for soft sources: Pions and Kaons.
186
187In the Genereate of this class all entries in the cocktail
188are called and we define a "primordial trigger" with requires
189a minimum number of muons above a Pt cut in the required acceptance.
190In order to normalized to the real number of simulated events,
191there are 2 data members in the class fNsuceeded adn fNGenerate
192which tell us what is the biais source.
193
194Enclose an example to use this generator:
518eb852 195<pre>
f4f795ed 196AliGenMUONCocktail * gener = new AliGenMUONCocktail();
197gener->SetPtRange(1.,100.); // Transverse momentum range
198gener->SetPhiRange(0.,360.); // Azimuthal angle range
199gener->SetYRange(-4.0,-2.4);
200gener->SetMuonPtCut(1.);
201gener->SetMuonThetaCut(171.,178.);
202gener->SetMuonMultiplicity(2);
35e21dec 203gener->SetImpactParameterRange(0.,5.); // 10% most centra PbPb collisions
f4f795ed 204gener->SetVertexSmear(kPerTrack);
205gener->SetOrigin(0,0,0); // Vertex position
206gener->SetSigma(0,0,0.0); // Sigma in (X,Y,Z) (cm) on IP position
207gener->Init();
518eb852 208</pre>
f4f795ed 209
518eb852 210
211\section s9 How to simulate events with misaligned geometry in local CDB
d228b279 212
213If you want to use a misaligned geometry to simulate some
214events you can use a local CDB. For this need to follow
215the next steps:
216
217- Generate misaligned data in local CDB.
218You can use MUONGenerateGeometryData.C as described above in
219the corresponding section. Let's assume you used the default
220residual misalignment settings, then you have a local CDB in
221your working directory called ResMisAlignCDB containing
222misalignement data (ResMisAlignCDB/MUON/Align).
223
0d24599f 224- Tell AliSimulation you want to use your local CDB for
225MUON/Align/Data
d228b279 226To do this you need to instantiate the AliCDBManager, set the
0d24599f 227default storage and set the specific storage for MUON/Align/Data,
228before instantiating AliSimulation (see for example the commented
d228b279 229lines AlirootRun_MUONtest.sh).
230
518eb852 231<pre>
d228b279 232aliroot -b >& testSim.out << EOF
233AliCDBManager* man = AliCDBManager::Instance();
234man->SetDefaultStorage("local://$ALICE_ROOT");
0d24599f 235man->SetSpecificStorage("MUON/align/Data","local://ResMisAlignCDB");
d228b279 236AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C");
237MuonSim.SetWriteRawData("MUON");
238MuonSim.Run(10);
239.q
240EOF
518eb852 241</pre>
29fc2c86 242
518eb852 243\section s10 How to Merge events
cd85a354 244
245You can merge 2 types of simulated events. For example,
246you can simulate Hijing events, and then simulate muons
247merging both.
248
249Merging is done at the sdigits level, so Kinematics files
250of the merged events will just correspond to the
d55fa8e9 251Config.C simulated file).
cd85a354 252
253You must, first, do the Hijing simulation and store it
254in directory $HIJING_SIM. Note that for merging you
255won't need Kinematics files of the Hijing simulation...
256
257Hijing simulation
258
518eb852 259<pre>
cd85a354 260aliroot -b << EOF
d55fa8e9 261AliSimulation HijingSim("$HIJING_SIM/YourConfigForHIJING.C")
cd85a354 262HijingSim.Run(5)
263.q
264EOF
518eb852 265</pre>
cd85a354 266
d55fa8e9 267You cand build YourConfigFroHIJING.C File from the
268ConfigPPR file in AliRoot/macros module.
cd85a354 269
270Then you can do muon simulation and reconstruction
271merging both simulated events. In next example, we are
272merging 20 times each Hijing event in order to simulate
273100 muons merged with 5 Hijing events.
274
518eb852 275<pre>
cd85a354 276aliroot -b << EOF
277AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C")
278MuonSim.MergeWith("$HIJING_SIM/galice.root",20) //parameters are the Hijing simulation file and the number of times we use each Hijing event
279MuonSim.Run(100) // number of muon (Config.C) events
280.q
281EOF
282
283
284aliroot -b << EOF
285TPluginManager * pluginmanager = gROOT->GetPluginManager()
286pluginmanager->AddHandler("AliReconstructor","MUON","AliMUONReconstructor","MUON","AliMUONReconstructor()")
287AliReconstruction MuonRec("galice.root")
288MuonRec.SetRunTracking("")
289MuonRec.SetRunVertexFinder(kFALSE)
290MuonRec.SetRunLocalReconstruction("MUON")
291MuonRec.SetFillESD("MUON")
292MuonRec.Run()
293.q
294EOF
518eb852 295</pre>
cd85a354 296
518eb852 297\section s11 ...On track numbering
d228b279 298
299All generated particles, including primary and secondary
300particles are put on the stack. The secondary particles are kept
301in the stack only if they gave a hit in *any* of the ALICE detectors
302The number of all particles placed on the stack for a given event
303can be obtained with
304Int_t nPart = AliStack::GetNtrack();
305Looping from 0 to nPart via AliStack::Particle(ipart)
306gives the particle listing as obtained from the particle generator (primaries)
307and Monte Carlo (secondaries).
308
309The particle response in the detector, a hit, is registered
310in the hits tree and the hits are filled with each primary track.
311The total number of "tracks" (fills of the tree) can be obtained
c58ae721 312with ntracks = AliMUONMCDataInterface::NumberOfTracks(event) and is usually smaller than "nPart".
d228b279 313Since particles can also deposit hits in other detectors than
314the MUON spectrometer, there will be many "tracks" (fills) in the hit-tree
315without a hit in MUON.
316
317The correspondence between "track ID" in the hits-tree ("itr") and the
318particle ID for particles on the stack (i.e. generated particles) can be
319obtained via:
518eb852 320<pre>
d228b279 321for (Int_t itr = 0; itr < ntracks; itr++) {
c58ae721 322 AliMUONVHitStore* hitStore = mcDataInterface.HitStore(event,itr);
323 //track "itr" of the hits-tree
324 Int_t nhitstot = hitStore->GetSize();
325 AliMUONHit* mHit;
326 TIter next(hitStore->CreateIterator());
327 while ( ( mHit = static_cast<AliMUONHit*>(next()) ) )
328 {
329 Int_t id = mHit->Track(); //gives particle ID on stack
330 TParticle* particle = mcDataInterface.Stack(event)->Particle(id);
d228b279 331 }
332}
518eb852 333</pre>
d228b279 334
c58ae721 335where mcDataInterface has been obtained by
336AliMUONMCDataInterface mcDataInterface("galice.root");
337
d228b279 338During the procedure to go from hits to digits, the hits
339are summed up such that more than one track can contribute
340to a given digit. As a consequence the method
341Int_t AliMUONDigit::Track(Int_t trackID)
342takes an argument, where "trackID" runs from 0 to
343AliMUONDigit::Ntracks() to provide the reference to *all*
344tracks that contributed to it. The returned track ID is the one
345referred to in the hit-tree. To know which is the generated particle
346that deposited a given digit one has to follow the sequence of the kind:
c58ae721 347(shown here using the simple, but not fast, DataInterface interfaces) :
348
518eb852 349<pre>
c58ae721 350AliMUONMCDataInterface mcdi("galice.root");
351AliMUONDataInterface di("galice.root");
d228b279 352
c58ae721 353AliMUONVDigitStore* digitStore = di.DigitStore(event);
354AliMUONVDigit* mDigit = ... get some digit from the digitStore
d228b279 355
c58ae721 356for (int tr = 0; tr < mDigit->Ntracks(); tr++)
357{
d228b279 358 Int_t hitTrackID = mDigit->Track(tr);
c58ae721 359 // get the hits corresponding to this trackID
360 AliMUONHitStore* hitStore = mcdi.HitStore(event,hitTrackID);
361 // loop over the hits
362 TIter hNext(hitStore->CreateIterator());
363 AliMUONHit* mHit;
364 while ( ( mHit = static_cast<AliMUONHit*>(hNext()) ) )
365 {
366 Int_t numPart = mHit->Track(); //gives ID of particle on the stack
367 Int_t idTrack = mHit->Particle(); //gives flavour code of the particle
368 }
d228b279 369}
518eb852 370</pre>
d228b279 371
068f96bd 372
518eb852 373\section s12 How to process invariant mass spectra for J/psi or Upsilon
374
825f8cb2 375The macro MUONmassPlot_ESD.C reads back the MUON ESD informations and compute
376the invariant mass spectra and corresponding uncorelated background.
377Moreover gives the number of event in the resonance peak and the number of triggers.
518eb852 378<pre>
825f8cb2 379Usage:
380root [0] .L $ALICE_ROOT/MUON/MUONmassPlot_ESD.C+
381root [1] MUONmassPlot_ESD(ExtrapToVertex,
382 geoFilenam, filename
383 FirstEvent, LastEvent,
384 esdFileName,
385 ResType, Chi2Cut,
386 PtCutMin, PtCutMax,
387 massMin, massMax)
388
389with:
390ExtrapToVertex (default -1)
391 <0: no extrapolation;
392 =0: extrapolation to (0,0,0);
393 >0: extrapolation to ESDVertex if available, else to (0,0,0)
394geoFilename (default "geometry.root") geometry file name needed to extrap to vertex
395filename (default "galice.root") galice root file name
396FirstEvent (default 0)
397LastEvent (default 10000)
398esdFileName (default "AliESDs.root") esd root file name
399ResType (default 553): 553 for Upsilon, anything else for J/Psi
400Chi2Cut (default 100): keep only tracks with chi2 per d.o.f. < Chi2Cut
401PtCutMin (default 1): keep only tracks with transverse momentum > PtCutMin
402PtCutMax (default 10000): keep only tracks with transverse momentum < PtCutMax
403massMin (default 9.17 for Upsilon) keep only invariant masses with
404massMax (default 9.77 for Upsilon) massMin < mass < massMax
518eb852 405</pre>
825f8cb2 406
518eb852 407\section s13 Still working ..............
23567f21 408
518eb852 409*/