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