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