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