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