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