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