- Welding section on absorber side (LHCVC2C_001)
[u/mrichter/AliRoot.git] / MUON / AliMUON.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
4c039060 15
88cb7938 16/* $Id$ */
17
a9e2aefa 18
19///////////////////////////////////////////////
fe4da5cc 20// Manager and hits classes for set:MUON //
21////////////////////////////////////////////////
22
88cb7938 23#include "Riostream.h"
24
25#include <AliPDG.h>
a897a37a 26#include <TBRIK.h>
88cb7938 27#include <TCanvas.h>
28#include <TDirectory.h>
29#include <TFile.h>
94de3818 30#include <TGeometry.h>
88cb7938 31#include <TMinuit.h>
fe4da5cc 32#include <TNode.h>
88cb7938 33#include <TNtuple.h>
fe4da5cc 34#include <TObjArray.h>
88cb7938 35#include <TObject.h>
36#include <TObjectTable.h>
37#include <TPad.h>
a897a37a 38#include <TParticle.h>
39#include <TROOT.h>
88cb7938 40#include <TRandom.h>
41#include <TRotMatrix.h>
42#include <TTUBE.h>
a9e2aefa 43#include <TTUBE.h>
88cb7938 44#include <TTree.h>
45#include <TVector.h>
46#include <TVirtualMC.h>
fe4da5cc 47
88cb7938 48#include "AliConst.h"
49#include "AliHeader.h"
50#include "AliHitMap.h"
51#include "AliLoader.h"
dbb4e169 52#include "AliRunDigitizer.h"
307d9d04 53#include "AliMC.h"
fac3a970 54#include "AliRun.h"
3fa6cfdd 55#include "AliMUONLoader.h"
fe4da5cc 56#include "AliMUON.h"
88cb7938 57#include "AliMUONChamberTrigger.h"
88cb7938 58#include "AliMUONConstants.h"
59#include "AliMUONDigit.h"
a9e2aefa 60#include "AliMUONHit.h"
88cb7938 61#include "AliMUONHitMapA1.h"
88cb7938 62#include "AliMUONMerger.h"
a9e2aefa 63#include "AliMUONPadHit.h"
a9e2aefa 64#include "AliMUONRawCluster.h"
88cb7938 65#include "AliMUONTransientDigit.h"
ecfa008b 66#include "AliMUONTriggerCircuit.h"
d1cd2474 67#include "AliMUONVGeometryBuilder.h"
dbb4e169 68#include "AliMUONDigitizerv2.h"
d1775029 69#include "AliMUONSDigitizerv1.h"
88cb7938 70
a9e2aefa 71
72// Defaults parameters for Z positions of chambers
73// taken from values for "stations" in AliMUON::AliMUON
74// const Float_t zch[7]={528, 690., 975., 1249., 1449., 1610, 1710.};
75// and from array "dstation" in AliMUONv1::CreateGeometry
76// Float_t dstation[5]={20., 20., 20, 20., 20.};
77// for tracking chambers,
78// according to (Z1 = zch - dstation) and (Z2 = zch + dstation)
79// for the first and second chambers in the station, respectively,
80// and from "DTPLANES" in AliMUONv1::CreateGeometry
81// const Float_t DTPLANES = 15.;
82// for trigger chambers,
83// according to (Z1 = zch) and (Z2 = zch + DTPLANES)
84// for the first and second chambers in the station, respectively
fe4da5cc 85
fe4da5cc 86ClassImp(AliMUON)
ce3f5e87 87//__________________________________________________________________
fe4da5cc 88AliMUON::AliMUON()
89{
de05461e 90// Default Constructor
91//
1bd28025 92 fNCh = 0;
93 fNTrackingCh = 0;
1bd26093 94 fIshunt = 0;
1bd28025 95 fChambers = 0;
d1cd2474 96 fGeometryBuilders = 0;
ce3f5e87 97 fTriggerCircuits = 0;
1bd26093 98 fAccMin = 0.;
99 fAccMax = 0.;
100 fAccCut = kFALSE;
1cae9436 101 fMerger = 0;
aecb8bcd 102 fMUONData = 0;
d652f85c 103 fSplitLevel = 0;
fe4da5cc 104}
ce3f5e87 105//__________________________________________________________________
fe4da5cc 106AliMUON::AliMUON(const char *name, const char *title)
ce3f5e87 107 : AliDetector(name,title)
fe4da5cc 108{
109//Begin_Html
110/*
a897a37a 111<img src="gif/alimuon.gif">
fe4da5cc 112*/
113//End_Html
ce3f5e87 114 fMUONData = 0x0;
d652f85c 115 fSplitLevel= 0;
ce3f5e87 116 fIshunt = 0;
f665c1ea 117
ce3f5e87 118 fNCh = AliMUONConstants::NCh();
119 fNTrackingCh = AliMUONConstants::NTrackingCh();
a897a37a 120
ce3f5e87 121 SetMarkerColor(kRed);//
a9e2aefa 122//
ce3f5e87 123// Creating List of Chambers
a9e2aefa 124 Int_t ch;
f665c1ea 125 fChambers = new TObjArray(AliMUONConstants::NCh());
d1cd2474 126 fGeometryBuilders = new TObjArray(AliMUONConstants::NCh());
127
a9e2aefa 128 // Loop over stations
f665c1ea 129 for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
a9e2aefa 130 // Loop over 2 chambers in the station
ce3f5e87 131 for (Int_t stCH = 0; stCH < 2; stCH++) {
132 //
133 //
134 // Default Parameters for Muon Tracking Stations
135 ch = 2 * st + stCH;
136 if (ch < AliMUONConstants::NTrackingCh()) {
137 fChambers->AddAt(new AliMUONChamber(ch),ch);
138 } else {
139 fChambers->AddAt(new AliMUONChamberTrigger(ch),ch);
140 }
141 AliMUONChamber* chamber = (AliMUONChamber*) fChambers->At(ch);
d1cd2474 142 //chamber->SetGid(0);
ce3f5e87 143 // Default values for Z of chambers
144 chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch));
145 //
146 chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch));
147 // Set chamber inner and outer radius to default
148 chamber->SetRInner(AliMUONConstants::Dmin(st)/2);
149 chamber->SetROuter(AliMUONConstants::Dmax(st)/2);
150 //
151 } // Chamber stCH (0, 1) in
a9e2aefa 152 } // Station st (0...)
ce3f5e87 153
1391e633 154 // Negatives values are ignored by geant3 CONS200 in the calculation of the tracking parameters
155 fMaxStepGas=0.1;
156 fMaxStepAlu=0.1;
a9e2aefa 157 fMaxDestepGas=-1;
158 fMaxDestepAlu=-1;
ce3f5e87 159
160 fMaxIterPad = 0;
161 fCurIterPad = 0;
162
163 fAccMin = 0.;
164 fAccMax = 0.;
165 fAccCut = kFALSE;
166
167 // cp new design of AliMUONTriggerDecision
168 fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit());
169 for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) {
170 fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ);
171 }
172 fMerger = 0;
fe4da5cc 173}
ce3f5e87 174//____________________________________________________________________
50e97f19 175AliMUON::AliMUON(const AliMUON& rMUON):AliDetector(rMUON)
a9e2aefa 176{
177// Dummy copy constructor
178 ;
179
180}
ce3f5e87 181//____________________________________________________________________
fe4da5cc 182AliMUON::~AliMUON()
183{
de05461e 184// Destructor
ce3f5e87 185 if(fDebug) printf("%s: Calling AliMUON destructor !!!\n",ClassName());
186 fIshunt = 0;
187 if (fMerger) delete fMerger;
d1cd2474 188
189 if (fGeometryBuilders){
190 fGeometryBuilders->Delete();
191 delete fGeometryBuilders;
c6df4ef2 192 }
193 if (fChambers){
194 fChambers->Delete();
195 delete fChambers;
196 }
197 if (fTriggerCircuits){
198 fTriggerCircuits->Delete();
199 delete fTriggerCircuits;
200 }
201 delete fMUONData;
d1cd2474 202}
203//_____________________________________________________________________________
204void AliMUON::AddGeometryBuilder(AliMUONVGeometryBuilder* geomBuilder)
205{
206// Adds the geometry builder to the list
207// ---
208
209 fGeometryBuilders->Add(geomBuilder);
a897a37a 210}
ce3f5e87 211//____________________________________________________________________
fe4da5cc 212void AliMUON::BuildGeometry()
213{
de05461e 214// Geometry for event display
5fd73042 215 for (Int_t i=0; i<7; i++) {
216 for (Int_t j=0; j<2; j++) {
217 Int_t id=2*i+j+1;
218 this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay");
a897a37a 219 }
5fd73042 220 }
fe4da5cc 221}
ce3f5e87 222//___________________________________________________________________
fe4da5cc 223Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t )
224{
ce3f5e87 225 return 9999;
fe4da5cc 226}
ce3f5e87 227//__________________________________________________________________
228void AliMUON::SetTreeAddress()
a897a37a 229{
ce3f5e87 230 GetMUONData()->SetLoader(fLoader);
d1775029 231 // GetMUONData()->MakeBranch("D,S,RC");
232 // GetMUONData()->SetTreeAddress("H,D,S,RC");
52c9bc11 233 GetMUONData()->SetTreeAddress("H");
307d9d04 234 if (fHits != GetMUONData()->Hits()) {
ae31c826 235 if ( gAlice->GetMCApp() )
6d2f7cbd 236 if ( gAlice->GetMCApp()->GetHitLists() ) {
237 fHits = GetMUONData()->Hits();
238 gAlice->GetMCApp()->AddHitList(fHits); // For purifyKine, only necessary when Hit list is created in AliMUONData
239 }
307d9d04 240 }
6d2f7cbd 241 fHits = GetMUONData()->Hits(); // Added by Ivana to use the methods FisrtHit, NextHit of AliDetector
a9e2aefa 242}
243
ce3f5e87 244//____________________________________________________________________
a9e2aefa 245void AliMUON::SetPadSize(Int_t id, Int_t isec, Float_t p1, Float_t p2)
246{
de05461e 247// Set the pad size for chamber id and cathode isec
a9e2aefa 248 Int_t i=2*(id-1);
2682e810 249 ((AliMUONChamber*) fChambers->At(i)) ->SetPadSize(isec,p1,p2);
250 ((AliMUONChamber*) fChambers->At(i+1))->SetPadSize(isec,p1,p2);
a897a37a 251}
252
fe4da5cc 253//___________________________________________
a9e2aefa 254void AliMUON::SetChambersZ(const Float_t *Z)
255{
256 // Set Z values for all chambers (tracking and trigger)
257 // from the array pointed to by "Z"
f665c1ea 258 for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++)
2682e810 259 ((AliMUONChamber*) fChambers->At(ch))->SetZ(Z[ch]);
f665c1ea 260 return;
a9e2aefa 261}
ce3f5e87 262//_________________________________________________________________
a9e2aefa 263void AliMUON::SetChambersZToDefault()
fe4da5cc 264{
a9e2aefa 265 // Set Z values for all chambers (tracking and trigger)
266 // to default values
f665c1ea 267 SetChambersZ(AliMUONConstants::DefaultChamberZ());
a9e2aefa 268 return;
fe4da5cc 269}
ce3f5e87 270//_________________________________________________________________
a897a37a 271void AliMUON::SetChargeSlope(Int_t id, Float_t p1)
fe4da5cc 272{
de05461e 273// Set the inverse charge slope for chamber id
ce3f5e87 274 Int_t i=2*(id-1); //PH ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1);
275 //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1);
2682e810 276 ((AliMUONChamber*) fChambers->At(i))->SetChargeSlope(p1);
277 ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSlope(p1);
fe4da5cc 278}
ce3f5e87 279//__________________________________________________________________
a897a37a 280void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2)
fe4da5cc 281{
de05461e 282// Set sigma of charge spread for chamber id
fe4da5cc 283 Int_t i=2*(id-1);
2682e810 284 ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2);
285 ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSpread(p1,p2);
fe4da5cc 286}
ce3f5e87 287//___________________________________________________________________
a897a37a 288void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1)
fe4da5cc 289{
de05461e 290// Set integration limits for charge spread
fe4da5cc 291 Int_t i=2*(id-1);
2682e810 292 ((AliMUONChamber*) fChambers->At(i))->SetSigmaIntegration(p1);
293 ((AliMUONChamber*) fChambers->At(i+1))->SetSigmaIntegration(p1);
fe4da5cc 294}
295
ce3f5e87 296//__________________________________________________________________
d09fafb0 297void AliMUON::SetMaxAdc(Int_t id, Int_t p1)
fe4da5cc 298{
de05461e 299// Set maximum number for ADCcounts (saturation)
fe4da5cc 300 Int_t i=2*(id-1);
2682e810 301 ((AliMUONChamber*) fChambers->At(i))->SetMaxAdc(p1);
302 ((AliMUONChamber*) fChambers->At(i+1))->SetMaxAdc(p1);
fe4da5cc 303}
ce3f5e87 304//__________________________________________________________________
a897a37a 305void AliMUON::SetMaxStepGas(Float_t p1)
fe4da5cc 306{
de05461e 307// Set stepsize in gas
ce3f5e87 308 fMaxStepGas=p1;
fe4da5cc 309}
ce3f5e87 310//__________________________________________________________________
a897a37a 311void AliMUON::SetMaxStepAlu(Float_t p1)
fe4da5cc 312{
de05461e 313// Set step size in Alu
fe4da5cc 314 fMaxStepAlu=p1;
315}
ce3f5e87 316//__________________________________________________________________
a897a37a 317void AliMUON::SetMaxDestepGas(Float_t p1)
fe4da5cc 318{
de05461e 319// Set maximum step size in Gas
fe4da5cc 320 fMaxDestepGas=p1;
321}
ce3f5e87 322//__________________________________________________________________
a897a37a 323void AliMUON::SetMaxDestepAlu(Float_t p1)
fe4da5cc 324{
de05461e 325// Set maximum step size in Alu
ce3f5e87 326 fMaxDestepAlu=p1;
fe4da5cc 327}
ce3f5e87 328//___________________________________________________________________
5c1f55c5 329void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax)
fe4da5cc 330{
de05461e 331// Set acceptance cuts
ce3f5e87 332 fAccCut=acc;
333 fAccMin=angmin*TMath::Pi()/180;
334 fAccMax=angmax*TMath::Pi()/180;
335 Int_t ch;
336 if (acc) {
337 for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
338 // Loop over 2 chambers in the station
339 for (Int_t stCH = 0; stCH < 2; stCH++) {
340 ch = 2 * st + stCH;
341 // Set chamber inner and outer radius according to acceptance cuts
b13a15bc 342 Chamber(ch).SetRInner(TMath::Abs(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin)));
343 Chamber(ch).SetROuter(TMath::Abs(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax)));
ce3f5e87 344 } // chamber loop
345 } // station loop
346 }
fe4da5cc 347}
d1cd2474 348
349//____________________________________________________________________
350Float_t AliMUON::GetMaxStepGas() const
351{
352// Return stepsize in gas
353
354 return fMaxStepGas;
355}
356
357//____________________________________________________________________
358Float_t AliMUON::GetMaxStepAlu() const
359{
360// Return step size in Alu
361
362 return fMaxStepAlu;
363}
364
365//____________________________________________________________________
366Float_t AliMUON::GetMaxDestepGas() const
367{
368// Return maximum step size in Gas
369
370 return fMaxDestepGas;
371}
372
373//____________________________________________________________________
374Float_t AliMUON::GetMaxDestepAlu() const
375{
376// Return maximum step size in Gas
377
378 return fMaxDestepAlu;
379}
ce3f5e87 380//____________________________________________________________________
a30a000f 381void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation)
fe4da5cc 382{
de05461e 383// Set the segmentation for chamber id cathode isec
2682e810 384 ((AliMUONChamber*) fChambers->At(id))->SetSegmentationModel(isec, segmentation);
fe4da5cc 385
386}
ce3f5e87 387//____________________________________________________________________
a9e2aefa 388void AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response)
fe4da5cc 389{
de05461e 390// Set the response for chamber id
2682e810 391 ((AliMUONChamber*) fChambers->At(id))->SetResponseModel(response);
fe4da5cc 392}
ce3f5e87 393//____________________________________________________________________
fe4da5cc 394void AliMUON::SetNsec(Int_t id, Int_t nsec)
395{
de05461e 396// Set number of segmented cathods for chamber id
2682e810 397 ((AliMUONChamber*) fChambers->At(id))->SetNsec(nsec);
fe4da5cc 398}
85a5290f 399//____________________________________________________________________
c92eb8ad 400AliDigitizer* AliMUON::CreateDigitizer(AliRunDigitizer* manager) const
85a5290f 401{
dbb4e169 402 return new AliMUONDigitizerv2(manager);
85a5290f 403}
ce3f5e87 404//_____________________________________________________________________
2ab0c725 405void AliMUON::SDigits2Digits()
406{
d963c261 407
408// write TreeD here
409
410 if (!fMerger) {
411 if (gAlice->GetDebug()>0) {
412 cerr<<"AliMUON::SDigits2Digits: create default AliMUONMerger "<<endl;
413 cerr<<" no merging, just digitization of 1 event will be done"<<endl;
414 }
415 fMerger = new AliMUONMerger();
2ab0c725 416 }
d963c261 417 fMerger->Init();
418 fMerger->Digitise();
419 char hname[30];
88cb7938 420 // sprintf(hname,"TreeD%d",fLoader->GetHeader()->GetEvent());
421 fLoader->TreeD()->Write(hname,TObject::kOverwrite);
422 fLoader->TreeD()->Reset();
2ab0c725 423}
a9e2aefa 424
d1775029 425//_____________________________________________________________________
426void AliMUON::Hits2SDigits()
427{
dbb4e169 428 // Adaption of AliMUONSDigitizerv1 to be excuted by the AliSimulation framework
429 AliRunLoader* runLoader = fLoader->GetRunLoader();
430 AliRunDigitizer * manager = new AliRunDigitizer(1,1);
e191bb57 431 manager->SetInputStream(0,runLoader->GetFileName(),AliConfig::GetDefaultEventFolderName());
dbb4e169 432 AliMUONDigitizer * dMUON = new AliMUONSDigitizerv1(manager);
433 fLoader->LoadHits("READ");
434 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
435 runLoader->GetEvent(iEvent);
436 dMUON->Exec("");
437 }
438 fLoader->UnloadHits();
d1775029 439}
ce3f5e87 440//_______________________________________________________________________
3fa6cfdd 441AliLoader* AliMUON::MakeLoader(const char* topfoldername)
442{
443//builds standard getter (AliLoader type)
444//if detector wants to use castomized getter, it must overload this method
445
446 if (GetDebug())
447 Info("MakeLoader",
448 "Creating standard getter for detector %s. Top folder is %s.",
449 GetName(),topfoldername);
128843d9 450 fLoader = new AliLoader(GetName(),topfoldername);
ce3f5e87 451 fMUONData = new AliMUONData(fLoader,GetName(),GetName());
d652f85c 452 fMUONData->SetSplitLevel(fSplitLevel);
3fa6cfdd 453 return fLoader;
454}
ce3f5e87 455//_______________________________________________________________________
a9e2aefa 456AliMUONPadHit* AliMUON::FirstPad(AliMUONHit* hit, TClonesArray *clusters)
fe4da5cc 457{
5a35ac13 458// to be removed
fe4da5cc 459 // Initialise the pad iterator
460 // Return the address of the first padhit for hit
a897a37a 461 TClonesArray *theClusters = clusters;
fe4da5cc 462 Int_t nclust = theClusters->GetEntriesFast();
1bd28025 463 if (nclust && hit->PHlast() > 0) {
464 AliMUON::fMaxIterPad=hit->PHlast();
465 AliMUON::fCurIterPad=hit->PHfirst();
a9e2aefa 466 return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
fe4da5cc 467 } else {
468 return 0;
469 }
470}
ce3f5e87 471//_______________________________________________________________________
a9e2aefa 472AliMUONPadHit* AliMUON::NextPad(TClonesArray *clusters)
fe4da5cc 473{
5a35ac13 474 // To be removed
de05461e 475// Get next pad (in iterator)
476//
a9e2aefa 477 AliMUON::fCurIterPad++;
478 if (AliMUON::fCurIterPad <= AliMUON::fMaxIterPad) {
479 return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
fe4da5cc 480 } else {
481 return 0;
482 }
483}
ce3f5e87 484//_______________________________________________________________________
a897a37a 485
486AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster)
487{
de05461e 488//
489// Return rawcluster (icluster) for chamber ichamber and cathode icathod
490// Obsolete ??
ce3f5e87 491 TClonesArray *muonRawCluster = GetMUONData()->RawClusters(ichamber);
a897a37a 492 ResetRawClusters();
88cb7938 493 TTree *treeR = fLoader->TreeR();
a9e2aefa 494 Int_t nent=(Int_t)treeR->GetEntries();
495 treeR->GetEvent(nent-2+icathod-1);
496 //treeR->GetEvent(icathod);
497 //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast();
a897a37a 498
a9e2aefa 499 AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster);
a897a37a 500 //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw);
501
502 return mRaw;
503}
ce3f5e87 504//________________________________________________________________________
1cae9436 505void AliMUON::SetMerger(AliMUONMerger* merger)
506{
507// Set pointer to merger
508 fMerger = merger;
509}
ce3f5e87 510//________________________________________________________________________
1cae9436 511AliMUONMerger* AliMUON::Merger()
512{
513// Return pointer to merger
514 return fMerger;
515}
ce3f5e87 516//________________________________________________________________________
50e97f19 517AliMUON& AliMUON::operator = (const AliMUON& /*rhs*/)
a897a37a 518{
a9e2aefa 519// copy operator
520// dummy version
521 return *this;
a897a37a 522}
48b32e42 523//________________________________________________________________________
524void AliMUON::RemapTrackHitIDs(Int_t* map)
525{
526// Remaps the track numbers in the hits arrays, so that they correspond
527// to the entry indices in the Kine tree.
528// The correspondance is not direct. To get the real index into the Kine tree
529// compute the particle index as follows:
530//
531// num_primaries = AliStack::GetNprimary();
532// num_tracks = AliStack::GetNtracks();
533// track = AliMUONHit::Track()
534//
535// if (track < num_primaries)
536// particleindex = track + num_tracks - num_primaries;
537// else
538// particleindex = track - num_primaries;
539
540 // Remap the track numbers based on the specified map.
541 AliMUONData* data = GetMUONData();
542 TClonesArray* hits = data->Hits();
543 for (Int_t i = 0; i < hits->GetEntriesFast(); i++)
544 {
545 AliMUONHit* hit = static_cast<AliMUONHit*>( hits->At(i) );
546 hit->SetTrack( map[hit->Track()] );
547 };
548};
549