]>
Commit | Line | Data |
---|---|---|
518eb852 | 1 | // $Id$ |
50837721 | 2 | |
91509ec6 | 3 | /*! \page README_sim Simulation |
518eb852 | 4 | |
91509ec6 | 5 | The 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 | |
11 | the 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 | |
13 | AliMUONv1 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 | |
17 | charge, 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 | |
23 | at 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 |
26 | DAQ. Performed by AliMUONRawWriter. | |
518eb852 | 27 | |
91509ec6 | 28 | From 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 | 33 | You only need to run the simulation part of the test script |
34 | AlirootRun_MUONtest.sh | |
88cb7938 | 35 | |
b3ba6823 | 36 | |
91509ec6 | 37 | \section sim_s2 Tracking parameters, cuts, energy loss and physics processes |
518eb852 | 38 | |
02d8f072 | 39 | Tracking parameters in MUON are automatically defined by GEANT |
40 | MUON takes the default values of CUTs and physics processes | |
41 | defined by the Config files, except for the gas mixture medium | |
42 | of the tracking chambers. The CUT's and physics processes of | |
43 | the gas mixture medium is then defined in the galice.cuts file | |
44 | in the data directory. In particular ILOSS parameter MUST be | |
45 | equal unity (1) in order simulate a realistic energy loss | |
46 | distribution (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 | 50 | GEANT has two ways for tracking charged particles in the |
51 | magnetic field: HELIX et RKUTA. | |
52 | HELIX is faster and works well if the gradient of magnetic | |
53 | field is small. | |
54 | For MUON, HELIX is a not a good approximation and we must | |
55 | use RKUTA to get the optimal mass resolution of the | |
56 | spectrometer. The choice of HELIX or RKUTA is done in the | |
57 | config 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 | 62 | TRACKING must be 1 for RKUTA and 2 for HELIX (the default value for aliroot is 2 (HELIX)) |
63 | FACTOR allows you to set the magnetic field to 0, just putting FACTOR=0. Default value is 1. | |
64 | MAXB is the maximum magnetic field which is 10.T | |
2b32c661 | 65 | |
91509ec6 | 66 | \section sim_s4 MUON cocktail generator |
518eb852 | 67 | |
f4f795ed | 68 | There is a MUON cocktail generator of the muon sources in the |
69 | EVGEN directory. This class derives from AliGenCocktail. | |
70 | In the init of this class I have filled the cocktail with | |
71 | the muon sources: J/Psi, Upsilon, Open Charm, Open Beauty, | |
72 | Pion, Kaons. The code needs only the production cross section | |
73 | at 4pi (for the moment this values are in the code since I | |
74 | prefere them do not be modified), and the code calculates the | |
75 | rate of particles in the acceptance, making the scaling based | |
76 | on the number of collisions for the hard probes and on the | |
77 | number of participants for soft sources: Pions and Kaons. | |
78 | ||
79 | In the Genereate of this class all entries in the cocktail | |
80 | are called and we define a "primordial trigger" with requires | |
81 | a minimum number of muons above a Pt cut in the required acceptance. | |
82 | In order to normalized to the real number of simulated events, | |
83 | there are 2 data members in the class fNsuceeded adn fNGenerate | |
84 | which tell us what is the biais source. | |
85 | ||
86 | Enclose an example to use this generator: | |
518eb852 | 87 | <pre> |
f4f795ed | 88 | AliGenMUONCocktail * gener = new AliGenMUONCocktail(); |
89 | gener->SetPtRange(1.,100.); // Transverse momentum range | |
90 | gener->SetPhiRange(0.,360.); // Azimuthal angle range | |
91 | gener->SetYRange(-4.0,-2.4); | |
92 | gener->SetMuonPtCut(1.); | |
93 | gener->SetMuonThetaCut(171.,178.); | |
94 | gener->SetMuonMultiplicity(2); | |
35e21dec | 95 | gener->SetImpactParameterRange(0.,5.); // 10% most centra PbPb collisions |
f4f795ed | 96 | gener->SetVertexSmear(kPerTrack); |
97 | gener->SetOrigin(0,0,0); // Vertex position | |
98 | gener->SetSigma(0,0,0.0); // Sigma in (X,Y,Z) (cm) on IP position | |
99 | gener->Init(); | |
518eb852 | 100 | </pre> |
f4f795ed | 101 | |
91509ec6 | 102 | \section sim_s5 How to simulate events with misaligned geometry in local CDB |
d228b279 | 103 | |
104 | If you want to use a misaligned geometry to simulate some | |
105 | events you can use a local CDB. For this need to follow | |
106 | the next steps: | |
107 | ||
108 | - Generate misaligned data in local CDB. | |
109 | You can use MUONGenerateGeometryData.C as described above in | |
110 | the corresponding section. Let's assume you used the default | |
111 | residual misalignment settings, then you have a local CDB in | |
112 | your working directory called ResMisAlignCDB containing | |
113 | misalignement data (ResMisAlignCDB/MUON/Align). | |
114 | ||
0d24599f | 115 | - Tell AliSimulation you want to use your local CDB for |
116 | MUON/Align/Data | |
d228b279 | 117 | To do this you need to instantiate the AliCDBManager, set the |
0d24599f | 118 | default storage and set the specific storage for MUON/Align/Data, |
119 | before instantiating AliSimulation (see for example the commented | |
d228b279 | 120 | lines AlirootRun_MUONtest.sh). |
121 | ||
518eb852 | 122 | <pre> |
d228b279 | 123 | aliroot -b >& testSim.out << EOF |
124 | AliCDBManager* man = AliCDBManager::Instance(); | |
125 | man->SetDefaultStorage("local://$ALICE_ROOT"); | |
0d24599f | 126 | man->SetSpecificStorage("MUON/align/Data","local://ResMisAlignCDB"); |
d228b279 | 127 | AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C"); |
128 | MuonSim.SetWriteRawData("MUON"); | |
129 | MuonSim.Run(10); | |
130 | .q | |
131 | EOF | |
518eb852 | 132 | </pre> |
29fc2c86 | 133 | |
91509ec6 | 134 | \section sim_s6 How to Merge events |
cd85a354 | 135 | |
136 | You can merge 2 types of simulated events. For example, | |
137 | you can simulate Hijing events, and then simulate muons | |
138 | merging both. | |
139 | ||
140 | Merging is done at the sdigits level, so Kinematics files | |
141 | of the merged events will just correspond to the | |
d55fa8e9 | 142 | Config.C simulated file). |
cd85a354 | 143 | |
144 | You must, first, do the Hijing simulation and store it | |
145 | in directory $HIJING_SIM. Note that for merging you | |
146 | won't need Kinematics files of the Hijing simulation... | |
147 | ||
148 | Hijing simulation | |
149 | ||
518eb852 | 150 | <pre> |
cd85a354 | 151 | aliroot -b << EOF |
d55fa8e9 | 152 | AliSimulation HijingSim("$HIJING_SIM/YourConfigForHIJING.C") |
cd85a354 | 153 | HijingSim.Run(5) |
154 | .q | |
155 | EOF | |
518eb852 | 156 | </pre> |
cd85a354 | 157 | |
d55fa8e9 | 158 | You cand build YourConfigFroHIJING.C File from the |
159 | ConfigPPR file in AliRoot/macros module. | |
cd85a354 | 160 | |
161 | Then you can do muon simulation and reconstruction | |
162 | merging both simulated events. In next example, we are | |
163 | merging 20 times each Hijing event in order to simulate | |
164 | 100 muons merged with 5 Hijing events. | |
165 | ||
518eb852 | 166 | <pre> |
cd85a354 | 167 | aliroot -b << EOF |
168 | AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C") | |
169 | MuonSim.MergeWith("$HIJING_SIM/galice.root",20) //parameters are the Hijing simulation file and the number of times we use each Hijing event | |
170 | MuonSim.Run(100) // number of muon (Config.C) events | |
171 | .q | |
172 | EOF | |
173 | ||
174 | ||
175 | aliroot -b << EOF | |
176 | TPluginManager * pluginmanager = gROOT->GetPluginManager() | |
177 | pluginmanager->AddHandler("AliReconstructor","MUON","AliMUONReconstructor","MUON","AliMUONReconstructor()") | |
178 | AliReconstruction MuonRec("galice.root") | |
179 | MuonRec.SetRunTracking("") | |
180 | MuonRec.SetRunVertexFinder(kFALSE) | |
181 | MuonRec.SetRunLocalReconstruction("MUON") | |
182 | MuonRec.SetFillESD("MUON") | |
183 | MuonRec.Run() | |
184 | .q | |
185 | EOF | |
518eb852 | 186 | </pre> |
cd85a354 | 187 | |
91509ec6 | 188 | \section sim_s7 On track numbering |
d228b279 | 189 | |
190 | All generated particles, including primary and secondary | |
191 | particles are put on the stack. The secondary particles are kept | |
192 | in the stack only if they gave a hit in *any* of the ALICE detectors | |
193 | The number of all particles placed on the stack for a given event | |
194 | can be obtained with | |
195 | Int_t nPart = AliStack::GetNtrack(); | |
196 | Looping from 0 to nPart via AliStack::Particle(ipart) | |
197 | gives the particle listing as obtained from the particle generator (primaries) | |
198 | and Monte Carlo (secondaries). | |
199 | ||
200 | The particle response in the detector, a hit, is registered | |
201 | in the hits tree and the hits are filled with each primary track. | |
202 | The total number of "tracks" (fills of the tree) can be obtained | |
c58ae721 | 203 | with ntracks = AliMUONMCDataInterface::NumberOfTracks(event) and is usually smaller than "nPart". |
d228b279 | 204 | Since particles can also deposit hits in other detectors than |
205 | the MUON spectrometer, there will be many "tracks" (fills) in the hit-tree | |
206 | without a hit in MUON. | |
207 | ||
208 | The correspondence between "track ID" in the hits-tree ("itr") and the | |
209 | particle ID for particles on the stack (i.e. generated particles) can be | |
210 | obtained via: | |
518eb852 | 211 | <pre> |
d228b279 | 212 | for (Int_t itr = 0; itr < ntracks; itr++) { |
c58ae721 | 213 | AliMUONVHitStore* hitStore = mcDataInterface.HitStore(event,itr); |
214 | //track "itr" of the hits-tree | |
215 | Int_t nhitstot = hitStore->GetSize(); | |
216 | AliMUONHit* mHit; | |
217 | TIter next(hitStore->CreateIterator()); | |
218 | while ( ( mHit = static_cast<AliMUONHit*>(next()) ) ) | |
219 | { | |
220 | Int_t id = mHit->Track(); //gives particle ID on stack | |
221 | TParticle* particle = mcDataInterface.Stack(event)->Particle(id); | |
d228b279 | 222 | } |
223 | } | |
518eb852 | 224 | </pre> |
d228b279 | 225 | |
c58ae721 | 226 | where mcDataInterface has been obtained by |
227 | AliMUONMCDataInterface mcDataInterface("galice.root"); | |
228 | ||
d228b279 | 229 | During the procedure to go from hits to digits, the hits |
230 | are summed up such that more than one track can contribute | |
231 | to a given digit. As a consequence the method | |
232 | Int_t AliMUONDigit::Track(Int_t trackID) | |
233 | takes an argument, where "trackID" runs from 0 to | |
234 | AliMUONDigit::Ntracks() to provide the reference to *all* | |
235 | tracks that contributed to it. The returned track ID is the one | |
236 | referred to in the hit-tree. To know which is the generated particle | |
237 | that deposited a given digit one has to follow the sequence of the kind: | |
c58ae721 | 238 | (shown here using the simple, but not fast, DataInterface interfaces) : |
239 | ||
518eb852 | 240 | <pre> |
c58ae721 | 241 | AliMUONMCDataInterface mcdi("galice.root"); |
242 | AliMUONDataInterface di("galice.root"); | |
d228b279 | 243 | |
c58ae721 | 244 | AliMUONVDigitStore* digitStore = di.DigitStore(event); |
245 | AliMUONVDigit* mDigit = ... get some digit from the digitStore | |
d228b279 | 246 | |
c58ae721 | 247 | for (int tr = 0; tr < mDigit->Ntracks(); tr++) |
248 | { | |
d228b279 | 249 | Int_t hitTrackID = mDigit->Track(tr); |
c58ae721 | 250 | // get the hits corresponding to this trackID |
251 | AliMUONHitStore* hitStore = mcdi.HitStore(event,hitTrackID); | |
252 | // loop over the hits | |
253 | TIter hNext(hitStore->CreateIterator()); | |
254 | AliMUONHit* mHit; | |
255 | while ( ( mHit = static_cast<AliMUONHit*>(hNext()) ) ) | |
256 | { | |
257 | Int_t numPart = mHit->Track(); //gives ID of particle on the stack | |
258 | Int_t idTrack = mHit->Particle(); //gives flavour code of the particle | |
259 | } | |
d228b279 | 260 | } |
518eb852 | 261 | </pre> |
d228b279 | 262 | |
91509ec6 | 263 | This chapter is defined in the READMEsim.txt file. |
23567f21 | 264 | |
518eb852 | 265 | */ |