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