]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/READMEsim.txt
remoe duplicate QA initialisation and do ESD QA for same detectors as RecPoint QA
[u/mrichter/AliRoot.git] / MUON / READMEsim.txt
CommitLineData
518eb852 1// $Id$
50837721 2
91509ec6 3/*! \page README_sim Simulation
518eb852 4
91509ec6 5The simulation encompasses the following tasks :
d55fa8e9 6
91509ec6 7- Generation of MC particles (the kinematics of the event ends up in the TreeK
8 of Kinematics#.root)
9
10- Tracking particles through the detector using
11the Virtual Monte Carlo, producing AliMUONHit objects, that end up in
12 the TreeH of MUON.Hits#.root file(s). This part is steered by AliMUON and its child
13AliMUONv1 classes.
6b1e4b22 14
91509ec6 15- Converting MC hits into AliMUONVDigit, called SDigits, that end up in the TreeS
16 of the MUON.SDigits#.root file(s). A S(ummable)Digit is a pad with its associated
17charge, but no noise or electronics response function applied. Steered by AliMUONSDigitizerV2 class.
d55fa8e9 18
91509ec6 19- Converting SDigits into Digits, by applying electronics calibrations. Actually, we de-calibrate
20 the digits at this stage, by adding a pedestal and dividing by a gain, more or less. Steered
21 by AliMUONDigitizerV3 class. Digits end up in TreeD of MUON.Digits#.root file(s). In addition,
22 for the trigger, we create AliMUONLocalTrigger, AliMUONRegionalTrigger and AliMUONGlobalTrigger objects
23at this stage, that ends up in TreeD as well.
518eb852 24
91509ec6 25- Convert the Digits into RAW data, in a format that should be exactly the same as real data from the
26DAQ. Performed by AliMUONRawWriter.
518eb852 27
91509ec6 28From there on, the reconstruction can proceed, in the very same way for real or simulated data,
29 as long as they are in RAW format.
7f42a16f 30
91509ec6 31\section sim_s1 How to run a MUON generation
518eb852 32
d55fa8e9 33You only need to run the simulation part of the test script
34AlirootRun_MUONtest.sh
88cb7938 35
b3ba6823 36
91509ec6 37\section sim_s2 Tracking parameters, cuts, energy loss and physics processes
518eb852 38
02d8f072 39Tracking parameters in MUON are automatically defined by GEANT
40MUON takes the default values of CUTs and physics processes
41defined by the Config files, except for the gas mixture medium
42of the tracking chambers. The CUT's and physics processes of
43the gas mixture medium is then defined in the galice.cuts file
44in the data directory. In particular ILOSS parameter MUST be
45equal unity (1) in order simulate a realistic energy loss
46distribution (mean value and fluctuations) in the active gas.
a88eb0d0 47
91509ec6 48\section sim_s3 Tracking of particle in the magnetic field
518eb852 49
a88eb0d0 50GEANT has two ways for tracking charged particles in the
51magnetic field: HELIX et RKUTA.
52HELIX is faster and works well if the gradient of magnetic
53field is small.
54For MUON, HELIX is a not a good approximation and we must
55use RKUTA to get the optimal mass resolution of the
56spectrometer. The choice of HELIX or RKUTA is done in the
57config file when the magnetic field is defined:
518eb852 58<pre>
b97b210c 59 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", TRACKING, FACTOR, MAXB, AliMagFMaps::k5kG);
a88eb0d0 60 gAlice->SetField(field);
518eb852 61</pre>
a88eb0d0 62TRACKING must be 1 for RKUTA and 2 for HELIX (the default value for aliroot is 2 (HELIX))
63FACTOR allows you to set the magnetic field to 0, just putting FACTOR=0. Default value is 1.
64MAXB is the maximum magnetic field which is 10.T
2b32c661 65
e6168aff 66\section sim_s4 Tailing effect
67
68The control to turn on/off the parametrized tailing effect:
69<pre>
70AliMUON::SetTailEffect(Bool_t),
71</pre>
72
73The parameter to tune increase/decrease the tailing effect is kept inside,
74AliMUONResponseV0::DisIntegrate(). This parameter is an integer number
75(excluding zero and four), the higher the value is the less is the tailing
76effect:
77<pre>
78Int_t para = 5;
79</pre>
80Zero is excluded because it gives straight line transformation, and four
81is excluded because the AliRoot simulation chain spends VERY VERY long
82time in AliMUONResponseV0::DisIntegrate method, which reason was not yet
83understood. The parameter for 1, 2, 3, 5, 6, 7, 8, 9, 10 were checked with
84no slowing down problem, however parameters greater than 6 give almost no
85tailing effect since they basically correspond to higher order polynomial
86transform.
87
88
89\section sim_s5 MUON cocktail generator
518eb852 90
f4f795ed 91There is a MUON cocktail generator of the muon sources in the
92EVGEN directory. This class derives from AliGenCocktail.
93In the init of this class I have filled the cocktail with
94the muon sources: J/Psi, Upsilon, Open Charm, Open Beauty,
95Pion, Kaons. The code needs only the production cross section
96at 4pi (for the moment this values are in the code since I
97prefere them do not be modified), and the code calculates the
98rate of particles in the acceptance, making the scaling based
99on the number of collisions for the hard probes and on the
100number of participants for soft sources: Pions and Kaons.
101
102In the Genereate of this class all entries in the cocktail
103are called and we define a "primordial trigger" with requires
104a minimum number of muons above a Pt cut in the required acceptance.
105In order to normalized to the real number of simulated events,
106there are 2 data members in the class fNsuceeded adn fNGenerate
107which tell us what is the biais source.
108
109Enclose an example to use this generator:
518eb852 110<pre>
f4f795ed 111AliGenMUONCocktail * gener = new AliGenMUONCocktail();
112gener->SetPtRange(1.,100.); // Transverse momentum range
113gener->SetPhiRange(0.,360.); // Azimuthal angle range
114gener->SetYRange(-4.0,-2.4);
115gener->SetMuonPtCut(1.);
116gener->SetMuonThetaCut(171.,178.);
117gener->SetMuonMultiplicity(2);
35e21dec 118gener->SetImpactParameterRange(0.,5.); // 10% most centra PbPb collisions
f4f795ed 119gener->SetVertexSmear(kPerTrack);
120gener->SetOrigin(0,0,0); // Vertex position
121gener->SetSigma(0,0,0.0); // Sigma in (X,Y,Z) (cm) on IP position
122gener->Init();
518eb852 123</pre>
f4f795ed 124
e6168aff 125\section sim_s6 How to simulate events with misaligned geometry in local CDB
d228b279 126
127If you want to use a misaligned geometry to simulate some
128events you can use a local CDB. For this need to follow
129the next steps:
130
131- Generate misaligned data in local CDB.
132You can use MUONGenerateGeometryData.C as described above in
133the corresponding section. Let's assume you used the default
134residual misalignment settings, then you have a local CDB in
135your working directory called ResMisAlignCDB containing
136misalignement data (ResMisAlignCDB/MUON/Align).
137
0d24599f 138- Tell AliSimulation you want to use your local CDB for
139MUON/Align/Data
d228b279 140To do this you need to instantiate the AliCDBManager, set the
0d24599f 141default storage and set the specific storage for MUON/Align/Data,
142before instantiating AliSimulation (see for example the commented
d228b279 143lines AlirootRun_MUONtest.sh).
144
518eb852 145<pre>
d228b279 146aliroot -b >& testSim.out << EOF
147AliCDBManager* man = AliCDBManager::Instance();
148man->SetDefaultStorage("local://$ALICE_ROOT");
0d24599f 149man->SetSpecificStorage("MUON/align/Data","local://ResMisAlignCDB");
d228b279 150AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C");
151MuonSim.SetWriteRawData("MUON");
152MuonSim.Run(10);
153.q
154EOF
518eb852 155</pre>
29fc2c86 156
e6168aff 157\section sim_s7 How to Merge events
cd85a354 158
159You can merge 2 types of simulated events. For example,
160you can simulate Hijing events, and then simulate muons
161merging both.
162
163Merging is done at the sdigits level, so Kinematics files
164of the merged events will just correspond to the
d55fa8e9 165Config.C simulated file).
cd85a354 166
167You must, first, do the Hijing simulation and store it
168in directory $HIJING_SIM. Note that for merging you
169won't need Kinematics files of the Hijing simulation...
170
171Hijing simulation
172
518eb852 173<pre>
cd85a354 174aliroot -b << EOF
d55fa8e9 175AliSimulation HijingSim("$HIJING_SIM/YourConfigForHIJING.C")
cd85a354 176HijingSim.Run(5)
177.q
178EOF
518eb852 179</pre>
cd85a354 180
d55fa8e9 181You cand build YourConfigFroHIJING.C File from the
182ConfigPPR file in AliRoot/macros module.
cd85a354 183
184Then you can do muon simulation and reconstruction
185merging both simulated events. In next example, we are
186merging 20 times each Hijing event in order to simulate
187100 muons merged with 5 Hijing events.
188
518eb852 189<pre>
cd85a354 190aliroot -b << EOF
191AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C")
192MuonSim.MergeWith("$HIJING_SIM/galice.root",20) //parameters are the Hijing simulation file and the number of times we use each Hijing event
193MuonSim.Run(100) // number of muon (Config.C) events
194.q
195EOF
196
197
198aliroot -b << EOF
199TPluginManager * pluginmanager = gROOT->GetPluginManager()
200pluginmanager->AddHandler("AliReconstructor","MUON","AliMUONReconstructor","MUON","AliMUONReconstructor()")
201AliReconstruction MuonRec("galice.root")
202MuonRec.SetRunTracking("")
203MuonRec.SetRunVertexFinder(kFALSE)
204MuonRec.SetRunLocalReconstruction("MUON")
205MuonRec.SetFillESD("MUON")
206MuonRec.Run()
207.q
208EOF
518eb852 209</pre>
cd85a354 210
e6168aff 211\section sim_s8 On track numbering
d228b279 212
213All generated particles, including primary and secondary
214particles are put on the stack. The secondary particles are kept
215in the stack only if they gave a hit in *any* of the ALICE detectors
216The number of all particles placed on the stack for a given event
217can be obtained with
218Int_t nPart = AliStack::GetNtrack();
219Looping from 0 to nPart via AliStack::Particle(ipart)
220gives the particle listing as obtained from the particle generator (primaries)
221and Monte Carlo (secondaries).
222
223The particle response in the detector, a hit, is registered
224in the hits tree and the hits are filled with each primary track.
225The total number of "tracks" (fills of the tree) can be obtained
c58ae721 226with ntracks = AliMUONMCDataInterface::NumberOfTracks(event) and is usually smaller than "nPart".
d228b279 227Since particles can also deposit hits in other detectors than
228the MUON spectrometer, there will be many "tracks" (fills) in the hit-tree
229without a hit in MUON.
230
231The correspondence between "track ID" in the hits-tree ("itr") and the
232particle ID for particles on the stack (i.e. generated particles) can be
233obtained via:
518eb852 234<pre>
d228b279 235for (Int_t itr = 0; itr < ntracks; itr++) {
c58ae721 236 AliMUONVHitStore* hitStore = mcDataInterface.HitStore(event,itr);
237 //track "itr" of the hits-tree
238 Int_t nhitstot = hitStore->GetSize();
239 AliMUONHit* mHit;
240 TIter next(hitStore->CreateIterator());
241 while ( ( mHit = static_cast<AliMUONHit*>(next()) ) )
242 {
243 Int_t id = mHit->Track(); //gives particle ID on stack
244 TParticle* particle = mcDataInterface.Stack(event)->Particle(id);
d228b279 245 }
246}
518eb852 247</pre>
d228b279 248
c58ae721 249where mcDataInterface has been obtained by
250AliMUONMCDataInterface mcDataInterface("galice.root");
251
d228b279 252During the procedure to go from hits to digits, the hits
253are summed up such that more than one track can contribute
254to a given digit. As a consequence the method
255Int_t AliMUONDigit::Track(Int_t trackID)
256takes an argument, where "trackID" runs from 0 to
257AliMUONDigit::Ntracks() to provide the reference to *all*
258tracks that contributed to it. The returned track ID is the one
259referred to in the hit-tree. To know which is the generated particle
260that deposited a given digit one has to follow the sequence of the kind:
c58ae721 261(shown here using the simple, but not fast, DataInterface interfaces) :
262
518eb852 263<pre>
c58ae721 264AliMUONMCDataInterface mcdi("galice.root");
265AliMUONDataInterface di("galice.root");
d228b279 266
c58ae721 267AliMUONVDigitStore* digitStore = di.DigitStore(event);
268AliMUONVDigit* mDigit = ... get some digit from the digitStore
d228b279 269
c58ae721 270for (int tr = 0; tr < mDigit->Ntracks(); tr++)
271{
d228b279 272 Int_t hitTrackID = mDigit->Track(tr);
c58ae721 273 // get the hits corresponding to this trackID
274 AliMUONHitStore* hitStore = mcdi.HitStore(event,hitTrackID);
275 // loop over the hits
276 TIter hNext(hitStore->CreateIterator());
277 AliMUONHit* mHit;
278 while ( ( mHit = static_cast<AliMUONHit*>(hNext()) ) )
279 {
280 Int_t numPart = mHit->Track(); //gives ID of particle on the stack
281 Int_t idTrack = mHit->Particle(); //gives flavour code of the particle
282 }
d228b279 283}
518eb852 284</pre>
d228b279 285
91509ec6 286This chapter is defined in the READMEsim.txt file.
23567f21 287
518eb852 288*/