1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ==========================================================
19 Please add to this README file all information concerning
20 config files, simulation, digitalization, clusterization,
21 reconstruction and macro analysis
23 ==========================================================
24 How to check that your aliroot is working well
25 ==========================================================
26 There is a script file AlirootRun_MUONtest.sh which
27 allows for simulating, reconstructing and making the
28 invariant analysis of the generated Upsilon (1S).
29 The used configuration file is Config.C in MUON
32 source $ALICE_ROOT/MUON/AlirootRun_MUONtest.sh
33 The results of this test are saved in test_out/ directory.
34 Please note that the CDB (Condition DataBase) is now always *required*
35 to 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
39 ==========================================================
40 How to check that your aliroot is working VERY well
41 ==========================================================
42 There is a script file AlirootRun_MUONlongtest.sh which
43 allows for simulating, reconstructing and making the
44 -+invariant analysis of the generated Upsilon (1S).
45 This script generates a large number of Upsilon (20k)
46 in order to access differential quantities.
47 The used configuration file is Config.C in MUON
49 One should really run this script to check if the MUON
50 code can process a large number of events WITHOUT errors,
51 in particular before making important commits !!
54 $ALICE_ROOT/MUON/AlirootRun_MUONtestlong.sh
55 The results of this test are saved in testlong_out/ directory
56 and will be kept in CVS
58 (NOTE: the macros performing the calculations/plots MUONefficiency.C
59 and MUONplotEfficiency.C are also able to handle J/Psi if
60 Config.C is modified accordingly )
62 ==========================================================
63 How to run a MUON generation
64 ==========================================================
66 root [0] gAlice->Run(10,"$ALICE_ROOT/MUON/Config.C");
68 1 single muon of 7 GeV/c in the MUON spectrometer
69 acceptance will be simulated using geant3.
70 Hit information will be store in the root file in the
72 If you want to change the option or to define a new directory
73 for hits, you have to do the following before:
74 root [0] gAlice->SetConfigFunction("Config( \"/home/martinez/aliroot/work_NewIO/test/\" , \"box\" );");
76 ============================================================
77 How to run MUONCheck macro
78 ============================================================
79 To check the content of a root data file, the MUONCheck
80 provides a ascii output on screen.
82 To compile MUONCheck.C
83 .includepath $ALICE_ROOT/STEER
84 .includepath $ALICE_ROOT/MUON
85 .includepath $ALICE_ROOT/MUON/mapping
86 .L $ALICE_ROOT/MUON/MUONCheck.C++
88 gSystem->Load("$ALICE_ROOT/MUON/MUONCheck_C.so")
90 To print Kine : (default file is galice.root )
91 MUONkine() or MUONkine(##,"galice.root") for the event number ##
93 To print hits : (default file is galice.root if not MUONhits("toto.root""); )
94 MUONhits() or MUONhits(##,"galice.root") for the event number ##
96 To print digits : (default file is galice.root)
97 MUONdigits() or MUONdigits(##,"galice.root") for the event number ##
99 To print sdigits : (default file is galice.root)
100 MUONsdigits() or MUONsdigits(##,"galice.root") for the event number ##
102 To print rawcluster : (default file is galice.root)
103 MUONrecpoints() or MUONrecpoints(##,"galice.root") for the event number ##
105 To print trigger : (default file is galice.root)
106 MUONrectrigger() or MUONrectrigger(##,"galice.root") for the event number ##
110 ============================================================
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 ============================================================
115 gAlice->Init("$ALICE_ROOT/MUON/Config.C");
116 gGeoManager->GetMasterVolume()->Draw();
119 ============================================================
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 ============================================================
124 gAlice->Init("$ALICE_ROOT/MUON/Config.C");
125 gGeoManager->CheckOverlaps();
126 gGeoManager->PrintOverlaps();
128 ============================================================
129 How to run MUONdisplay
130 ============================================================
131 First you need to perform a full simulation:
132 generation, digitalisation and clusterisation
133 To run MUONdisplay with Root 5.04/00 you need to get a fix in
134 the gpad/src/TPad.cxx from Root CVS:
135 cvs update -r 1.200 gpad/src/TPad.cxx
138 .L $ALICE_ROOT/MUON/MUONdisplay.C
139 MUONdisplay(0,"galice.root")
141 ============================================================
142 Tracking parameters, cuts, energy loss and physics processes
143 ============================================================
144 Tracking parameters in MUON are automatically defined by GEANT
145 MUON takes the default values of CUTs and physics processes
146 defined by the Config files, except for the gas mixture medium
147 of the tracking chambers. The CUT's and physics processes of
148 the gas mixture medium is then defined in the galice.cuts file
149 in the data directory. In particular ILOSS parameter MUST be
150 equal unity (1) in order simulate a realistic energy loss
151 distribution (mean value and fluctuations) in the active gas.
153 ============================================================
154 Tracking of particle in the magnetic field
155 ============================================================
156 GEANT has two ways for tracking charged particles in the
157 magnetic field: HELIX et RKUTA.
158 HELIX is faster and works well if the gradient of magnetic
160 For MUON, HELIX is a not a good approximation and we must
161 use RKUTA to get the optimal mass resolution of the
162 spectrometer. The choice of HELIX or RKUTA is done in the
163 config file when the magnetic field is defined:
164 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", TRACKING, FACTOR, MAXB, AliMagFMaps::k4kG);
165 gAlice->SetField(field);
166 TRACKING must be 1 for RKUTA and 2 for HELIX (the default value for aliroot is 2 (HELIX))
167 FACTOR allows you to set the magnetic field to 0, just putting FACTOR=0. Default value is 1.
168 MAXB is the maximum magnetic field which is 10.T
170 ===========================================================
171 MUON cocktail for physics ..............
172 ===========================================================
173 There is a MUON cocktail generator of the muon sources in the
174 EVGEN directory. This class derives from AliGenCocktail.
175 In the init of this class I have filled the cocktail with
176 the muon sources: J/Psi, Upsilon, Open Charm, Open Beauty,
177 Pion, Kaons. The code needs only the production cross section
178 at 4pi (for the moment this values are in the code since I
179 prefere them do not be modified), and the code calculates the
180 rate of particles in the acceptance, making the scaling based
181 on the number of collisions for the hard probes and on the
182 number of participants for soft sources: Pions and Kaons.
184 In the Genereate of this class all entries in the cocktail
185 are called and we define a "primordial trigger" with requires
186 a minimum number of muons above a Pt cut in the required acceptance.
187 In order to normalized to the real number of simulated events,
188 there are 2 data members in the class fNsuceeded adn fNGenerate
189 which tell us what is the biais source.
191 Enclose an example to use this generator:
192 AliGenMUONCocktail * gener = new AliGenMUONCocktail();
193 gener->SetPtRange(1.,100.); // Transverse momentum range
194 gener->SetPhiRange(0.,360.); // Azimuthal angle range
195 gener->SetYRange(-4.0,-2.4);
196 gener->SetMuonPtCut(1.);
197 gener->SetMuonThetaCut(171.,178.);
198 gener->SetMuonMultiplicity(2);
199 gener->SetImpactParameterRange(0.,5.); // 10% most centra PbPb collisions
200 gener->SetVertexSmear(kPerTrack);
201 gener->SetOrigin(0,0,0); // Vertex position
202 gener->SetSigma(0,0,0.0); // Sigma in (X,Y,Z) (cm) on IP position
205 ================================================================
206 csh Script for the full reconstruction with raw data generator
207 ================================================================
208 The rawdata generation and analysis is working with the new segmentation.
209 So the config file must use the version "AliMUONFactoryV3"
212 The method AliSimulation::SetWriteRawData("MUON") enables on
213 the muon rawdata generation
215 AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C")
216 MuonSim.SetMakeTrigger("MUON");
217 MuonSim.SetWriteRawData("MUON")
224 AliReconstruction MuonRec("galice.root");
225 MuonRec.SetInput("$YOUR_WORKING_DIRECTORY/"); Do not forget the slash at the end!
226 MuonRec.SetRunVertexFinder(kFALSE);
227 MuonRec.SetRunLocalReconstruction("MUON");
228 MuonRec.SetRunTracking("");
229 MuonRec.SetFillESD("MUON");
230 MuonRec.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
237 ============================================================
238 How to read & decode raw data
239 ============================================================
240 These macros can read & decode DDL files, root and DATE files.
241 Nevertheless for the two latter, aliroot has to be compiled with DATE.
244 .includepath $ALICE_ROOT/STEER
245 .includepath $ALICE_ROOT/MUON
246 .includepath $ALICE_ROOT/RAW
247 .L $ALICE_ROOT/MUON/MUONRawStreamTracker.C+
248 MUONRawStreamTracker(maxEvent, firstDDL, lastDDL, rawFileName)
251 .includepath $ALICE_ROOT/STEER
252 .includepath $ALICE_ROOT/MUON
253 .includepath $ALICE_ROOT/RAW
254 .L $ALICE_ROOT/MUON/MUONRawStreamTrigger.C+
255 MUONRawStreamTrigger(maxEvent, firstDDL, lastDDL, rawFileName)
257 Default wise the macro read all DDL files from the current directory for 1000 events.
258 For root file rawFileName must end with .root, for date file rawFileName
259 must be no extention. For DDL files you have to specified the directory
260 where the raw0...n subdirectories are located:
261 MUONRawStreamTracker(maxEvent, "$YOUR_WORKING_DIRECTORY/"); //Do not forget the slash at the end!
264 ============================================================
265 How to run MUONRecoCheck macro
266 ============================================================
267 To check the muon reconstruction by comparing the reconstructed tracks
268 with the reference tracks made of "AliTrackReference" for the hits and
269 kinematic informations (TParticle) for the vertex.
270 This macro can be used to check the track reconstruction e.g. efficiency,
271 momentum resolution ... but also to make physics analysis whenever
272 track identification is needed.
274 To compile MUONRecoCheck.C
275 .includepath $ALICE_ROOT/STEER
276 .includepath $ALICE_ROOT/MUON
277 .L $ALICE_ROOT/MUON/MUONRecoCheck.C+
279 // To run MUONRecoCheck
280 MUONRecoCheck(nEvent,"galice.root"); // nEvent = nb of events
283 ============================================================
284 How to run MUONTracker macro
285 ============================================================
286 To make the track reconstruction directly from AliTrackReference hits
287 which are recorded in TrackRefs.root during the simulation.
288 It can be used to check the reconstruction without clusterization.
290 To compile MUONTracker.C
291 .includepath $ALICE_ROOT/STEER
292 .includepath $ALICE_ROOT/MUON
293 .L $ALICE_ROOT/MUON/MUONTracker.C+
295 // To run MUONTracker
296 MUONTracker(iEventMin,iEventMax,"galice.root"); // iEventMin: first event
298 ===========================================================
299 Macro MUONGenerateGeometryData.C
300 ===========================================================
302 Macro for generating the geometry data files
303 and mis-alignment data.
306 - MUON/data/volpath.dat file contains the volume paths
307 for all alignable objects (modules & detection
309 - MUON/data/transform.dat file contains the transformations
310 data (translation and rotation) for all alignable objects
311 (modules & detection elements)
312 - MUON/data/svmap.dat file contains all the information to link
313 each geant volume (it can be extended to other virtual MC) with
314 a detection element. The point here is that a given detection
315 element, i.e. a slat chamber can consist of more geant volumes.
316 the correspondence is then defined in an input file.
317 Each time there is a change in the definition of MC geometry, these
318 input files must be re-generated via the macro
319 MUONGenerateGeometryData.C
321 To be run from aliroot:
322 .x MUONGenerateGeometryData.C
324 The generated files do not replace the existing ones
325 but have different names (with extension ".out").
326 Replacement with new files has to be done manually.
328 If the appropiate flags are set (zeroAlign, resMisAlign and/or fullMisAlign)
329 zero, residual and/or full misalignment data are generated in a
330 local CDB folder (defaults are ResMisAlignCDB and FullMisAlignCDB
331 in the working directory). Inside the local CDB the path for the
332 alignment data is (and must be) "MUON/Align/Data/".
333 Residual misalignment: Default is our current estimate of
334 misalignment after all our alignment procedure has been applied.
335 Full misalignment: Default is our current estimate of initial
338 ==========================================================
339 How to simulate events with misaligned geometry in local CDB
340 ==========================================================
342 If you want to use a misaligned geometry to simulate some
343 events you can use a local CDB. For this need to follow
346 - Generate misaligned data in local CDB.
347 You can use MUONGenerateGeometryData.C as described above in
348 the corresponding section. Let's assume you used the default
349 residual misalignment settings, then you have a local CDB in
350 your working directory called ResMisAlignCDB containing
351 misalignement data (ResMisAlignCDB/MUON/Align).
353 - Copy the calibration data in your local CDB.
354 cp -r $ALICE_ROOT/MUON/Calib ResMisAlignCDB/MUON
356 - Tell AliSimulation you want to use your local CDB for MUON
357 To do this you need to instantiate the AliCDBManager, set the
358 default storage and set the specific storage for MUON, before
359 instantiating AliSimulation (see for example the commented
360 lines AlirootRun_MUONtest.sh).
362 aliroot -b >& testSim.out << EOF
363 AliCDBManager* man = AliCDBManager::Instance();
364 man->SetDefaultStorage("local://$ALICE_ROOT");
365 man->SetSpecificStorage("MUON","local://ResMisAlignCDB");
366 AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C");
367 MuonSim.SetWriteRawData("MUON");
372 ==========================================================
374 ==========================================================
376 You can merge 2 types of simulated events. For example,
377 you can simulate Hijing events, and then simulate muons
380 Merging is done at the sdigits level, so Kinematics files
381 of the merged events will just correspond to the
382 Config.C simulated file (not to Config_HIJING.C).
384 You must, first, do the Hijing simulation and store it
385 in directory $HIJING_SIM. Note that for merging you
386 won't need Kinematics files of the Hijing simulation...
391 AliSimulation HijingSim("$HIJING_SIM/Config_HIJING.C")
397 Then you can do muon simulation and reconstruction
398 merging both simulated events. In next example, we are
399 merging 20 times each Hijing event in order to simulate
400 100 muons merged with 5 Hijing events.
404 AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C")
405 MuonSim.MergeWith("$HIJING_SIM/galice.root",20) //parameters are the Hijing simulation file and the number of times we use each Hijing event
406 MuonSim.Run(100) // number of muon (Config.C) events
412 TPluginManager * pluginmanager = gROOT->GetPluginManager()
413 pluginmanager->AddHandler("AliReconstructor","MUON","AliMUONReconstructor","MUON","AliMUONReconstructor()")
414 AliReconstruction MuonRec("galice.root")
415 MuonRec.SetRunTracking("")
416 MuonRec.SetRunVertexFinder(kFALSE)
417 MuonRec.SetRunLocalReconstruction("MUON")
418 MuonRec.SetFillESD("MUON")
423 ==========================================================
424 How to play with the CDB
425 ==========================================================
427 If you'd like to see how the CDB is created, please have a look at the
428 MUONCDB.C (work in progress, though).
430 ==========================================================
431 ...on track numbering
432 ==========================================================
434 All generated particles, including primary and secondary
435 particles are put on the stack. The secondary particles are kept
436 in the stack only if they gave a hit in *any* of the ALICE detectors
437 The number of all particles placed on the stack for a given event
439 Int_t nPart = AliStack::GetNtrack();
440 Looping from 0 to nPart via AliStack::Particle(ipart)
441 gives the particle listing as obtained from the particle generator (primaries)
442 and Monte Carlo (secondaries).
444 The particle response in the detector, a hit, is registered
445 in the hits tree and the hits are filled with each primary track.
446 The total number of "tracks" (fills of the tree) can be obtained
447 with ntracks = AliMUONData::GetNtracks() and is usually smaller than "nPart".
448 Since particles can also deposit hits in other detectors than
449 the MUON spectrometer, there will be many "tracks" (fills) in the hit-tree
450 without a hit in MUON.
452 The correspondence between "track ID" in the hits-tree ("itr") and the
453 particle ID for particles on the stack (i.e. generated particles) can be
455 for (Int_t itr = 0; itr < ntracks; itr++) {
456 MUONData->GetTrack(itr); //track "itr" of the hits-tree
457 Int_t nhitstot = MUONData->Hits()->GetEntriesFast();
459 for (Int_t ihit=0; ihit<nhitstot; ihit++) {
460 mHit = static_cast<AliMUONHit*>(MUONData->Hits()->At(ihit));
461 Int_t id = muonHit->Track(); //gives particle ID on stack
462 TParticle* particle = gAlice->Stack()->Particle(id);
466 During the procedure to go from hits to digits, the hits
467 are summed up such that more than one track can contribute
468 to a given digit. As a consequence the method
469 Int_t AliMUONDigit::Track(Int_t trackID)
470 takes an argument, where "trackID" runs from 0 to
471 AliMUONDigit::Ntracks() to provide the reference to *all*
472 tracks that contributed to it. The returned track ID is the one
473 referred to in the hit-tree. To know which is the generated particle
474 that deposited a given digit one has to follow the sequence of the kind:
477 mDigit = static_cast<AliMUONDigit*>(digits->At(idigit));
478 for (int tr = 0; tr < mDigit->Ntracks(); tr++){
479 Int_t hitTrackID = mDigit->Track(tr);
480 MUONData->GetTrack(hitTrackID);
481 mHit = static_cast<AliMUONHit*>(MUONData->Hits()->At(0));
482 //just take first hit of given track
483 Int_t numPart = mHit->Track(); //gives ID of particle on the stack
484 Int_t idTrack = mHit->Particle(); //gives flavour code of the particle
486 In this example, for simplicity, only the first hit of a
487 hit-track is used to check the particle ID.
489 ===========================================================
490 Still working ..............
491 ===========================================================