Formatting changes.
[u/mrichter/AliRoot.git] / MUON / README
CommitLineData
50837721 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
88cb7938 18==========================================================
19Please add to this README file all information concerning
20config files, simulation, digitalization, clusterization,
21reconstruction and macro analysis
22
23==========================================================
6b1e4b22 24 How to check that your aliroot is working well
25==========================================================
8c4c70f6 26There is a script file AlirootRun_MUONtest.sh which
6b1e4b22 27allows for simulating, reconstructing and making the
28invariant analysis of the generated Upsilon (1S).
29The used configuration file is Config.C in MUON
30directory.
8c4c70f6 31You have to type :
32source $ALICE_ROOT/MUON/AlirootRun_MUONtest.sh
c57f3c5b 33The results of this test are saved in test_out/ directory.
60fff730 34Please note that the CDB (Condition DataBase) is now always *required*
35to perform either simulation or reconstruction. For the moment, a version
36 of that CDB is stored in CVS, so you should have one already in MUON/Calib
37subdirectories.
6b1e4b22 38
39==========================================================
7f42a16f 40 How to check that your aliroot is working VERY well
41==========================================================
42There is a script file AlirootRun_MUONlongtest.sh which
43allows for simulating, reconstructing and making the
44-+invariant analysis of the generated Upsilon (1S).
45This script generates a large number of Upsilon (20k)
46in order to access differential quantities.
47The used configuration file is Config.C in MUON
48directory.
49One should really run this script to check if the MUON
50code can process a large number of events WITHOUT errors,
51in particular before making important commits !!
52
53You have to type :
54$ALICE_ROOT/MUON/AlirootRun_MUONtestlong.sh
55The results of this test are saved in testlong_out/ directory
56and will be kept in CVS
57
58(NOTE: the macros performing the calculations/plots MUONefficiency.C
59and MUONplotEfficiency.C are also able to handle J/Psi if
60Config.C is modified accordingly )
61
62==========================================================
7985603c 63 How to run a MUON generation
88cb7938 64==========================================================
65aliroot
fc1fafa5 66root [0] gAlice->Run(10,"$ALICE_ROOT/MUON/Config.C");
88cb7938 67
681 single muon of 7 GeV/c in the MUON spectrometer
69acceptance will be simulated using geant3.
70Hit information will be store in the root file in the
71execution directory.
88cb7938 72If you want to change the option or to define a new directory
73for hits, you have to do the following before:
74root [0] gAlice->SetConfigFunction("Config( \"/home/martinez/aliroot/work_NewIO/test/\" , \"box\" );");
75
88cb7938 76============================================================
77 How to run MUONCheck macro
78============================================================
79To check the content of a root data file, the MUONCheck
80provides a ascii output on screen.
81
82To compile MUONCheck.C
2058bf30 83.includepath $ALICE_ROOT/STEER
84.includepath $ALICE_ROOT/MUON
bf485fb9 85.includepath $ALICE_ROOT/MUON/mapping
2058bf30 86.L $ALICE_ROOT/MUON/MUONCheck.C++
bf17dbfd 87To Load
88gSystem->Load("$ALICE_ROOT/MUON/MUONCheck_C.so")
2058bf30 89
278a86d5 90To print Kine : (default file is galice.root )
7d6677d7 91MUONkine() or MUONkine(##,"galice.root") for the event number ##
88cb7938 92
93To print hits : (default file is galice.root if not MUONhits("toto.root""); )
7d6677d7 94MUONhits() or MUONhits(##,"galice.root") for the event number ##
88cb7938 95
96To print digits : (default file is galice.root)
7d6677d7 97MUONdigits() or MUONdigits(##,"galice.root") for the event number ##
c57f3c5b 98
99To print sdigits : (default file is galice.root)
100MUONsdigits() or MUONsdigits(##,"galice.root") for the event number ##
88cb7938 101
102To print rawcluster : (default file is galice.root)
7d6677d7 103MUONrecpoints() or MUONrecpoints(##,"galice.root") for the event number ##
88cb7938 104
105To print trigger : (default file is galice.root)
7d6677d7 106MUONrectrigger() or MUONrectrigger(##,"galice.root") for the event number ##
2b32c661 107
108....
88cb7938 109
02d8f072 110============================================================
6570c14d 111 How to check the Geometry with the new Geometrical modeler
112 ftp://root.cern.ch/root/doc/chapter16.pdf
113 http://agenda.cern.ch/fullAgenda.php?ida=a05212
114============================================================
115gAlice->Init("$ALICE_ROOT/MUON/Config.C");
116gGeoManager->GetMasterVolume()->Draw();
117
02d8f072 118
119============================================================
b3ba6823 120 How to check the overlap with the new Geometrical modeler
121 ftp://root.cern.ch/root/doc/chapter16.pdf
122 http://agenda.cern.ch/fullAgenda.php?ida=a05212
123============================================================
124gAlice->Init("$ALICE_ROOT/MUON/Config.C");
125gGeoManager->CheckOverlaps();
126gGeoManager->PrintOverlaps();
127
128============================================================
7985603c 129 How to run MUONdisplay
130============================================================
1eccde20 131First you need to perform a full simulation:
7985603c 132generation, digitalisation and clusterisation
cd0f8cc8 133To run MUONdisplay with Root 5.04/00 you need to get a fix in
134the gpad/src/TPad.cxx from Root CVS:
135 cvs update -r 1.200 gpad/src/TPad.cxx
136and recompile root.
137
7985603c 138.L $ALICE_ROOT/MUON/MUONdisplay.C
139MUONdisplay(0,"galice.root")
140
141============================================================
02d8f072 142 Tracking parameters, cuts, energy loss and physics processes
143============================================================
144Tracking parameters in MUON are automatically defined by GEANT
145MUON takes the default values of CUTs and physics processes
146defined by the Config files, except for the gas mixture medium
147of the tracking chambers. The CUT's and physics processes of
148the gas mixture medium is then defined in the galice.cuts file
149in the data directory. In particular ILOSS parameter MUST be
150equal unity (1) in order simulate a realistic energy loss
151distribution (mean value and fluctuations) in the active gas.
a88eb0d0 152
153============================================================
154 Tracking of particle in the magnetic field
155============================================================
156GEANT has two ways for tracking charged particles in the
157magnetic field: HELIX et RKUTA.
158HELIX is faster and works well if the gradient of magnetic
159field is small.
160For MUON, HELIX is a not a good approximation and we must
161use RKUTA to get the optimal mass resolution of the
162spectrometer. The choice of HELIX or RKUTA is done in the
163config file when the magnetic field is defined:
b97b210c 164 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", TRACKING, FACTOR, MAXB, AliMagFMaps::k5kG);
a88eb0d0 165 gAlice->SetField(field);
166TRACKING must be 1 for RKUTA and 2 for HELIX (the default value for aliroot is 2 (HELIX))
167FACTOR allows you to set the magnetic field to 0, just putting FACTOR=0. Default value is 1.
168MAXB is the maximum magnetic field which is 10.T
2b32c661 169
f4f795ed 170===========================================================
171 MUON cocktail for physics ..............
172===========================================================
173There is a MUON cocktail generator of the muon sources in the
174EVGEN directory. This class derives from AliGenCocktail.
175In the init of this class I have filled the cocktail with
176the muon sources: J/Psi, Upsilon, Open Charm, Open Beauty,
177Pion, Kaons. The code needs only the production cross section
178at 4pi (for the moment this values are in the code since I
179prefere them do not be modified), and the code calculates the
180rate of particles in the acceptance, making the scaling based
181on the number of collisions for the hard probes and on the
182number of participants for soft sources: Pions and Kaons.
183
184In the Genereate of this class all entries in the cocktail
185are called and we define a "primordial trigger" with requires
186a minimum number of muons above a Pt cut in the required acceptance.
187In order to normalized to the real number of simulated events,
188there are 2 data members in the class fNsuceeded adn fNGenerate
189which tell us what is the biais source.
190
191Enclose an example to use this generator:
192AliGenMUONCocktail * gener = new AliGenMUONCocktail();
193gener->SetPtRange(1.,100.); // Transverse momentum range
194gener->SetPhiRange(0.,360.); // Azimuthal angle range
195gener->SetYRange(-4.0,-2.4);
196gener->SetMuonPtCut(1.);
197gener->SetMuonThetaCut(171.,178.);
198gener->SetMuonMultiplicity(2);
35e21dec 199gener->SetImpactParameterRange(0.,5.); // 10% most centra PbPb collisions
f4f795ed 200gener->SetVertexSmear(kPerTrack);
201gener->SetOrigin(0,0,0); // Vertex position
202gener->SetSigma(0,0,0.0); // Sigma in (X,Y,Z) (cm) on IP position
203gener->Init();
204
a2da7817 205================================================================
69be760c 206 csh Script for the full reconstruction with raw data generator
a2da7817 207================================================================
208The rawdata generation and analysis is working with the new segmentation.
209So the config file must use the version "AliMUONFactoryV3"
210
211Generation
212The method AliSimulation::SetWriteRawData("MUON") enables on
213the muon rawdata generation
214aliroot -b << EOF
215AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C")
10c8d1ce 216MuonSim.SetMakeTrigger("MUON");
a2da7817 217MuonSim.SetWriteRawData("MUON")
218MuonSim.Run(10)
219.q
220EOF
221
222Reconstruction
223aliroot -b << EOF
224AliReconstruction MuonRec("galice.root");
225MuonRec.SetInput("$YOUR_WORKING_DIRECTORY/"); Do not forget the slash at the end!
226MuonRec.SetRunVertexFinder(kFALSE);
227MuonRec.SetRunLocalReconstruction("MUON");
228MuonRec.SetRunTracking("");
229MuonRec.SetFillESD("MUON");
8e0ae46c 230MuonRec.SetOption("MUON", "VS"); // to use VS cluster finder
231// MuonRec.SetOption("MUON", "VS Original"); // to run VS and original track finder
232// MuonRec.SetOption("MUON", "Combi"); // to run combined cluster / track finder
233MMuonRec.Run();
a2da7817 234.q
235EOF
236
a7641a57 237============================================================
238 How to read & decode raw data
239============================================================
240These macros can read & decode DDL files, root and DATE files.
241Nevertheless for the two latter, aliroot has to be compiled with DATE.
242
243For tracker raw data
244.includepath $ALICE_ROOT/STEER
245.includepath $ALICE_ROOT/MUON
246.includepath $ALICE_ROOT/RAW
247.L $ALICE_ROOT/MUON/MUONRawStreamTracker.C+
248MUONRawStreamTracker(maxEvent, firstDDL, lastDDL, rawFileName)
249
250For trigger raw data
251.includepath $ALICE_ROOT/STEER
252.includepath $ALICE_ROOT/MUON
253.includepath $ALICE_ROOT/RAW
254.L $ALICE_ROOT/MUON/MUONRawStreamTrigger.C+
255MUONRawStreamTrigger(maxEvent, firstDDL, lastDDL, rawFileName)
256
257Default wise the macro read all DDL files from the current directory for 1000 events.
258For root file rawFileName must end with .root, for date file rawFileName
259must be no extention. For DDL files you have to specified the directory
260where the raw0...n subdirectories are located:
261MUONRawStreamTracker(maxEvent, "$YOUR_WORKING_DIRECTORY/"); //Do not forget the slash at the end!
a88eb0d0 262
b8dc484b 263
264============================================================
265 How to run MUONRecoCheck macro
266============================================================
267To check the muon reconstruction by comparing the reconstructed tracks
268with the reference tracks made of "AliTrackReference" for the hits and
269kinematic informations (TParticle) for the vertex.
270This macro can be used to check the track reconstruction e.g. efficiency,
271momentum resolution ... but also to make physics analysis whenever
272track identification is needed.
273
274To compile MUONRecoCheck.C
275.includepath $ALICE_ROOT/STEER
276.includepath $ALICE_ROOT/MUON
277.L $ALICE_ROOT/MUON/MUONRecoCheck.C+
278
279// To run MUONRecoCheck
280MUONRecoCheck(nEvent,"galice.root"); // nEvent = nb of events
281
29fc2c86 282
283============================================================
284 How to run MUONTracker macro
285============================================================
286To make the track reconstruction directly from AliTrackReference hits
287which are recorded in TrackRefs.root during the simulation.
288It can be used to check the reconstruction without clusterization.
289
290To compile MUONTracker.C
291.includepath $ALICE_ROOT/STEER
292.includepath $ALICE_ROOT/MUON
293.L $ALICE_ROOT/MUON/MUONTracker.C+
294
295// To run MUONTracker
296MUONTracker(iEventMin,iEventMax,"galice.root"); // iEventMin: first event
fc1fafa5 297
298===========================================================
299 Macro MUONGenerateGeometryData.C
300===========================================================
301
d228b279 302Macro for generating the geometry data files
303and mis-alignment data.
304
305Geometry data files:
306- MUON/data/volpath.dat file contains the volume paths
307for all alignable objects (modules & detection
308elements).
309- MUON/data/transform.dat file contains the transformations
310data (translation and rotation) for all alignable objects
311(modules & detection elements)
65087afe 312- MUON/data/svmap.dat file contains all the information to link
fc1fafa5 313each geant volume (it can be extended to other virtual MC) with
314a detection element. The point here is that a given detection
d228b279 315element, i.e. a slat chamber can consist of more geant volumes.
fc1fafa5 316the correspondence is then defined in an input file.
65087afe 317Each time there is a change in the definition of MC geometry, these
fc1fafa5 318input files must be re-generated via the macro
319MUONGenerateGeometryData.C
320
321To be run from aliroot:
322.x MUONGenerateGeometryData.C
323
324The generated files do not replace the existing ones
325but have different names (with extension ".out").
65087afe 326Replacement with new files has to be done manually.
29fc2c86 327
d228b279 328If the appropiate flags are set (zeroAlign, resMisAlign and/or fullMisAlign)
329zero, residual and/or full misalignment data are generated in a
330local CDB folder (defaults are ResMisAlignCDB and FullMisAlignCDB
331in the working directory). Inside the local CDB the path for the
332alignment data is (and must be) "MUON/Align/Data/".
333Residual misalignment: Default is our current estimate of
334misalignment after all our alignment procedure has been applied.
335Full misalignment: Default is our current estimate of initial
336misalignment.
337
338==========================================================
339How to simulate events with misaligned geometry in local CDB
340==========================================================
341
342If you want to use a misaligned geometry to simulate some
343events you can use a local CDB. For this need to follow
344the next steps:
345
346- Generate misaligned data in local CDB.
347You can use MUONGenerateGeometryData.C as described above in
348the corresponding section. Let's assume you used the default
349residual misalignment settings, then you have a local CDB in
350your working directory called ResMisAlignCDB containing
351misalignement data (ResMisAlignCDB/MUON/Align).
352
353- Copy the calibration data in your local CDB.
354cp -r $ALICE_ROOT/MUON/Calib ResMisAlignCDB/MUON
355
356- Tell AliSimulation you want to use your local CDB for MUON
357To do this you need to instantiate the AliCDBManager, set the
358default storage and set the specific storage for MUON, before
359instantiating AliSimulation (see for example the commented
360lines AlirootRun_MUONtest.sh).
361
362aliroot -b >& testSim.out << EOF
363AliCDBManager* man = AliCDBManager::Instance();
364man->SetDefaultStorage("local://$ALICE_ROOT");
365man->SetSpecificStorage("MUON","local://ResMisAlignCDB");
366AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C");
367MuonSim.SetWriteRawData("MUON");
368MuonSim.Run(10);
369.q
370EOF
29fc2c86 371
cd85a354 372==========================================================
86cd713c 373How to check the alignment software
374==========================================================
375
376The script AlirootRun_MUONtestAlign.sh allows you to check the software for
377the alignment with physics tracks. The script will:
378- Generate a misaligned geometry in a local CDB (default FullMisAlignCDB)
379- Simulate 1000 events using previously misaligned geometry
380- Reconstruct the events using perfect geometry
381- Run the alignment code over the above events using MUONAlignment.C
382
383To run you need to type:
384$ALICE_ROOT/MUON/AlirootRun_MUONtestAlign.sh
385
386The results of the test are saved in test_align/ directory. The file measShifts.root
387contains useful graphs for studying the alignment performances. A local CDB
388containing the realigned geometry is also created (default is ReAlignCDB). The
389file $ALICE_ROOT/MUON/data/transform2ReAlign.dat contains the
390transformations describing the realigned geometry to be compared with the
391used misaligned geometry $ALICE_ROOT/MUON/data/transform2.dat.
392
393IMPORTANT NOTE: For a useful test of the alignment performances, the
394order of 100 000 tracks is needed, it is then advisable to generate and
395reconstruct enough events separately and run MUONAlignment.C providing a file list
396afterwards.
397
398==========================================================
cd85a354 399 How to Merge events
400==========================================================
401
402You can merge 2 types of simulated events. For example,
403you can simulate Hijing events, and then simulate muons
404merging both.
405
406Merging is done at the sdigits level, so Kinematics files
407of the merged events will just correspond to the
408Config.C simulated file (not to Config_HIJING.C).
409
410You must, first, do the Hijing simulation and store it
411in directory $HIJING_SIM. Note that for merging you
412won't need Kinematics files of the Hijing simulation...
413
414Hijing simulation
415
416aliroot -b << EOF
417AliSimulation HijingSim("$HIJING_SIM/Config_HIJING.C")
418HijingSim.Run(5)
419.q
420EOF
421
422
423Then you can do muon simulation and reconstruction
424merging both simulated events. In next example, we are
425merging 20 times each Hijing event in order to simulate
426100 muons merged with 5 Hijing events.
427
428
429aliroot -b << EOF
430AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C")
431MuonSim.MergeWith("$HIJING_SIM/galice.root",20) //parameters are the Hijing simulation file and the number of times we use each Hijing event
432MuonSim.Run(100) // number of muon (Config.C) events
433.q
434EOF
435
436
437aliroot -b << EOF
438TPluginManager * pluginmanager = gROOT->GetPluginManager()
439pluginmanager->AddHandler("AliReconstructor","MUON","AliMUONReconstructor","MUON","AliMUONReconstructor()")
440AliReconstruction MuonRec("galice.root")
441MuonRec.SetRunTracking("")
442MuonRec.SetRunVertexFinder(kFALSE)
443MuonRec.SetRunLocalReconstruction("MUON")
444MuonRec.SetFillESD("MUON")
445MuonRec.Run()
446.q
447EOF
448
60fff730 449==========================================================
450 How to play with the CDB
451==========================================================
452
453If you'd like to see how the CDB is created, please have a look at the
454MUONCDB.C (work in progress, though).
455
d228b279 456==========================================================
457...on track numbering
458==========================================================
459
460All generated particles, including primary and secondary
461particles are put on the stack. The secondary particles are kept
462in the stack only if they gave a hit in *any* of the ALICE detectors
463The number of all particles placed on the stack for a given event
464can be obtained with
465Int_t nPart = AliStack::GetNtrack();
466Looping from 0 to nPart via AliStack::Particle(ipart)
467gives the particle listing as obtained from the particle generator (primaries)
468and Monte Carlo (secondaries).
469
470The particle response in the detector, a hit, is registered
471in the hits tree and the hits are filled with each primary track.
472The total number of "tracks" (fills of the tree) can be obtained
473with ntracks = AliMUONData::GetNtracks() and is usually smaller than "nPart".
474Since particles can also deposit hits in other detectors than
475the MUON spectrometer, there will be many "tracks" (fills) in the hit-tree
476without a hit in MUON.
477
478The correspondence between "track ID" in the hits-tree ("itr") and the
479particle ID for particles on the stack (i.e. generated particles) can be
480obtained via:
481for (Int_t itr = 0; itr < ntracks; itr++) {
482 MUONData->GetTrack(itr); //track "itr" of the hits-tree
483 Int_t nhitstot = MUONData->Hits()->GetEntriesFast();
484 AliMUONHit* mHit;
485 for (Int_t ihit=0; ihit<nhitstot; ihit++) {
486 mHit = static_cast<AliMUONHit*>(MUONData->Hits()->At(ihit));
487 Int_t id = muonHit->Track(); //gives particle ID on stack
488 TParticle* particle = gAlice->Stack()->Particle(id);
489 }
490}
491
492During the procedure to go from hits to digits, the hits
493are summed up such that more than one track can contribute
494to a given digit. As a consequence the method
495Int_t AliMUONDigit::Track(Int_t trackID)
496takes an argument, where "trackID" runs from 0 to
497AliMUONDigit::Ntracks() to provide the reference to *all*
498tracks that contributed to it. The returned track ID is the one
499referred to in the hit-tree. To know which is the generated particle
500that deposited a given digit one has to follow the sequence of the kind:
501
502
503mDigit = static_cast<AliMUONDigit*>(digits->At(idigit));
504for (int tr = 0; tr < mDigit->Ntracks(); tr++){
505 Int_t hitTrackID = mDigit->Track(tr);
506 MUONData->GetTrack(hitTrackID);
507 mHit = static_cast<AliMUONHit*>(MUONData->Hits()->At(0));
508 //just take first hit of given track
509 Int_t numPart = mHit->Track(); //gives ID of particle on the stack
510 Int_t idTrack = mHit->Particle(); //gives flavour code of the particle
511}
512In this example, for simplicity, only the first hit of a
513hit-track is used to check the particle ID.
514
5be7de69 515==========================================================
516Macro to process PDC06 preproduction
517==========================================================
518
519To read a generation/reconstrution from PDC06 preproduction, and write a file
520with a tree of AliMUONTrackLight / AliMUONPairLight :
521go to the directory containing the generation/reconstruction. From there run
522aliroot
523.x DecodeRecoCocktail.C+
524.q
525
526To read the file previously generated:
527aliroot
528.x ReadRecoCocktail.C+
529.q
530
88cb7938 531===========================================================
532 Still working ..............
533===========================================================