]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUON.cxx
AliRICHMerger removed. Substituted by AliRICHDigitizer complitelly
[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"
3fa6cfdd 52#include "AliMUONLoader.h"
fe4da5cc 53#include "AliMUON.h"
88cb7938 54#include "AliMUONChamberTrigger.h"
55#include "AliMUONClusterFinderVS.h"
56#include "AliMUONClusterInput.h"
57#include "AliMUONConstants.h"
58#include "AliMUONDigit.h"
59#include "AliMUONGlobalTrigger.h"
a9e2aefa 60#include "AliMUONHit.h"
88cb7938 61#include "AliMUONHitMapA1.h"
62#include "AliMUONLocalTrigger.h"
63#include "AliMUONMerger.h"
a9e2aefa 64#include "AliMUONPadHit.h"
a9e2aefa 65#include "AliMUONRawCluster.h"
88cb7938 66#include "AliMUONTransientDigit.h"
ecfa008b 67#include "AliMUONTriggerCircuit.h"
a9e2aefa 68#include "AliMUONTriggerDecision.h"
88cb7938 69#include "AliRun.h"
70
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)
ce3f5e87 87//__________________________________________________________________
fe4da5cc 88AliMUON::AliMUON()
89{
de05461e 90// Default Constructor
91//
1bd28025 92 fNCh = 0;
93 fNTrackingCh = 0;
1bd26093 94 fIshunt = 0;
1bd28025 95 fChambers = 0;
ce3f5e87 96 fTriggerCircuits = 0;
1bd26093 97 fAccMin = 0.;
98 fAccMax = 0.;
99 fAccCut = kFALSE;
1cae9436 100 fMerger = 0;
edf34242 101 fFileName = 0;
aecb8bcd 102 fMUONData = 0;
fe4da5cc 103}
ce3f5e87 104//__________________________________________________________________
fe4da5cc 105AliMUON::AliMUON(const char *name, const char *title)
ce3f5e87 106 : AliDetector(name,title)
fe4da5cc 107{
108//Begin_Html
109/*
a897a37a 110<img src="gif/alimuon.gif">
fe4da5cc 111*/
112//End_Html
ce3f5e87 113 fMUONData = 0x0;
114 fIshunt = 0;
f665c1ea 115
ce3f5e87 116 fNCh = AliMUONConstants::NCh();
117 fNTrackingCh = AliMUONConstants::NTrackingCh();
a897a37a 118
ce3f5e87 119 SetMarkerColor(kRed);//
a9e2aefa 120//
ce3f5e87 121// Creating List of Chambers
a9e2aefa 122 Int_t ch;
f665c1ea 123 fChambers = new TObjArray(AliMUONConstants::NCh());
a9e2aefa 124 // Loop over stations
f665c1ea 125 for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
a9e2aefa 126 // Loop over 2 chambers in the station
ce3f5e87 127 for (Int_t stCH = 0; stCH < 2; stCH++) {
128 //
129 //
130 // Default Parameters for Muon Tracking Stations
131 ch = 2 * st + stCH;
132 if (ch < AliMUONConstants::NTrackingCh()) {
133 fChambers->AddAt(new AliMUONChamber(ch),ch);
134 } else {
135 fChambers->AddAt(new AliMUONChamberTrigger(ch),ch);
136 }
137 AliMUONChamber* chamber = (AliMUONChamber*) fChambers->At(ch);
138 chamber->SetGid(0);
139 // Default values for Z of chambers
140 chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch));
141 //
142 chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch));
143 // Set chamber inner and outer radius to default
144 chamber->SetRInner(AliMUONConstants::Dmin(st)/2);
145 chamber->SetROuter(AliMUONConstants::Dmax(st)/2);
146 //
147 } // Chamber stCH (0, 1) in
a9e2aefa 148 } // Station st (0...)
ce3f5e87 149
a9e2aefa 150 fMaxStepGas=0.01;
151 fMaxStepAlu=0.1;
152 fMaxDestepGas=-1;
153 fMaxDestepAlu=-1;
ce3f5e87 154
155 fMaxIterPad = 0;
156 fCurIterPad = 0;
157
158 fAccMin = 0.;
159 fAccMax = 0.;
160 fAccCut = kFALSE;
161
162 // cp new design of AliMUONTriggerDecision
163 fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit());
164 for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) {
165 fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ);
166 }
167 fMerger = 0;
fe4da5cc 168}
ce3f5e87 169//____________________________________________________________________
50e97f19 170AliMUON::AliMUON(const AliMUON& rMUON):AliDetector(rMUON)
a9e2aefa 171{
172// Dummy copy constructor
173 ;
174
175}
ce3f5e87 176//____________________________________________________________________
fe4da5cc 177AliMUON::~AliMUON()
178{
de05461e 179// Destructor
ce3f5e87 180 if(fDebug) printf("%s: Calling AliMUON destructor !!!\n",ClassName());
181 fIshunt = 0;
182 if (fMerger) delete fMerger;
a897a37a 183}
ce3f5e87 184//____________________________________________________________________
fe4da5cc 185void AliMUON::BuildGeometry()
186{
de05461e 187// Geometry for event display
5fd73042 188 for (Int_t i=0; i<7; i++) {
189 for (Int_t j=0; j<2; j++) {
190 Int_t id=2*i+j+1;
191 this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay");
a897a37a 192 }
5fd73042 193 }
fe4da5cc 194}
ce3f5e87 195//___________________________________________________________________
fe4da5cc 196Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t )
197{
ce3f5e87 198 return 9999;
fe4da5cc 199}
ce3f5e87 200//__________________________________________________________________
201void AliMUON::SetTreeAddress()
a897a37a 202{
ce3f5e87 203 GetMUONData()->SetLoader(fLoader);
204 GetMUONData()->SetTreeAddress("H,D,RC");
a9e2aefa 205}
206
ce3f5e87 207//____________________________________________________________________
a9e2aefa 208void AliMUON::SetPadSize(Int_t id, Int_t isec, Float_t p1, Float_t p2)
209{
de05461e 210// Set the pad size for chamber id and cathode isec
a9e2aefa 211 Int_t i=2*(id-1);
2682e810 212 ((AliMUONChamber*) fChambers->At(i)) ->SetPadSize(isec,p1,p2);
213 ((AliMUONChamber*) fChambers->At(i+1))->SetPadSize(isec,p1,p2);
a897a37a 214}
215
fe4da5cc 216//___________________________________________
a9e2aefa 217void AliMUON::SetChambersZ(const Float_t *Z)
218{
219 // Set Z values for all chambers (tracking and trigger)
220 // from the array pointed to by "Z"
f665c1ea 221 for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++)
2682e810 222 ((AliMUONChamber*) fChambers->At(ch))->SetZ(Z[ch]);
f665c1ea 223 return;
a9e2aefa 224}
ce3f5e87 225//_________________________________________________________________
a9e2aefa 226void AliMUON::SetChambersZToDefault()
fe4da5cc 227{
a9e2aefa 228 // Set Z values for all chambers (tracking and trigger)
229 // to default values
f665c1ea 230 SetChambersZ(AliMUONConstants::DefaultChamberZ());
a9e2aefa 231 return;
fe4da5cc 232}
ce3f5e87 233//_________________________________________________________________
a897a37a 234void AliMUON::SetChargeSlope(Int_t id, Float_t p1)
fe4da5cc 235{
de05461e 236// Set the inverse charge slope for chamber id
ce3f5e87 237 Int_t i=2*(id-1); //PH ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1);
238 //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1);
2682e810 239 ((AliMUONChamber*) fChambers->At(i))->SetChargeSlope(p1);
240 ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSlope(p1);
fe4da5cc 241}
ce3f5e87 242//__________________________________________________________________
a897a37a 243void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2)
fe4da5cc 244{
de05461e 245// Set sigma of charge spread for chamber id
fe4da5cc 246 Int_t i=2*(id-1);
2682e810 247 ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2);
248 ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSpread(p1,p2);
fe4da5cc 249}
ce3f5e87 250//___________________________________________________________________
a897a37a 251void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1)
fe4da5cc 252{
de05461e 253// Set integration limits for charge spread
fe4da5cc 254 Int_t i=2*(id-1);
2682e810 255 ((AliMUONChamber*) fChambers->At(i))->SetSigmaIntegration(p1);
256 ((AliMUONChamber*) fChambers->At(i+1))->SetSigmaIntegration(p1);
fe4da5cc 257}
258
ce3f5e87 259//__________________________________________________________________
d09fafb0 260void AliMUON::SetMaxAdc(Int_t id, Int_t p1)
fe4da5cc 261{
de05461e 262// Set maximum number for ADCcounts (saturation)
fe4da5cc 263 Int_t i=2*(id-1);
2682e810 264 ((AliMUONChamber*) fChambers->At(i))->SetMaxAdc(p1);
265 ((AliMUONChamber*) fChambers->At(i+1))->SetMaxAdc(p1);
fe4da5cc 266}
ce3f5e87 267//__________________________________________________________________
a897a37a 268void AliMUON::SetMaxStepGas(Float_t p1)
fe4da5cc 269{
de05461e 270// Set stepsize in gas
ce3f5e87 271 fMaxStepGas=p1;
fe4da5cc 272}
ce3f5e87 273//__________________________________________________________________
a897a37a 274void AliMUON::SetMaxStepAlu(Float_t p1)
fe4da5cc 275{
de05461e 276// Set step size in Alu
fe4da5cc 277 fMaxStepAlu=p1;
278}
ce3f5e87 279//__________________________________________________________________
a897a37a 280void AliMUON::SetMaxDestepGas(Float_t p1)
fe4da5cc 281{
de05461e 282// Set maximum step size in Gas
fe4da5cc 283 fMaxDestepGas=p1;
284}
ce3f5e87 285//__________________________________________________________________
a897a37a 286void AliMUON::SetMaxDestepAlu(Float_t p1)
fe4da5cc 287{
de05461e 288// Set maximum step size in Alu
ce3f5e87 289 fMaxDestepAlu=p1;
fe4da5cc 290}
ce3f5e87 291//___________________________________________________________________
5c1f55c5 292void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax)
fe4da5cc 293{
de05461e 294// Set acceptance cuts
ce3f5e87 295 fAccCut=acc;
296 fAccMin=angmin*TMath::Pi()/180;
297 fAccMax=angmax*TMath::Pi()/180;
298 Int_t ch;
299 if (acc) {
300 for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
301 // Loop over 2 chambers in the station
302 for (Int_t stCH = 0; stCH < 2; stCH++) {
303 ch = 2 * st + stCH;
304 // Set chamber inner and outer radius according to acceptance cuts
b13a15bc 305 Chamber(ch).SetRInner(TMath::Abs(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin)));
306 Chamber(ch).SetROuter(TMath::Abs(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax)));
ce3f5e87 307 } // chamber loop
308 } // station loop
309 }
fe4da5cc 310}
ce3f5e87 311//____________________________________________________________________
a30a000f 312void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation)
fe4da5cc 313{
de05461e 314// Set the segmentation for chamber id cathode isec
2682e810 315 ((AliMUONChamber*) fChambers->At(id))->SetSegmentationModel(isec, segmentation);
fe4da5cc 316
317}
ce3f5e87 318//____________________________________________________________________
a9e2aefa 319void AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response)
fe4da5cc 320{
de05461e 321// Set the response for chamber id
2682e810 322 ((AliMUONChamber*) fChambers->At(id))->SetResponseModel(response);
fe4da5cc 323}
ce3f5e87 324//____________________________________________________________________
30aaba74 325void AliMUON::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst)
a897a37a 326{
de05461e 327// Set ClusterFinder for chamber id
2682e810 328 ((AliMUONChamber*) fChambers->At(id))->SetReconstructionModel(reconst);
a897a37a 329}
ce3f5e87 330//____________________________________________________________________
fe4da5cc 331void AliMUON::SetNsec(Int_t id, Int_t nsec)
332{
de05461e 333// Set number of segmented cathods for chamber id
2682e810 334 ((AliMUONChamber*) fChambers->At(id))->SetNsec(nsec);
fe4da5cc 335}
ce3f5e87 336//_____________________________________________________________________
2ab0c725 337void AliMUON::SDigits2Digits()
338{
d963c261 339
340// write TreeD here
341
342 if (!fMerger) {
343 if (gAlice->GetDebug()>0) {
344 cerr<<"AliMUON::SDigits2Digits: create default AliMUONMerger "<<endl;
345 cerr<<" no merging, just digitization of 1 event will be done"<<endl;
346 }
347 fMerger = new AliMUONMerger();
2ab0c725 348 }
d963c261 349 fMerger->Init();
350 fMerger->Digitise();
351 char hname[30];
88cb7938 352 // sprintf(hname,"TreeD%d",fLoader->GetHeader()->GetEvent());
353 fLoader->TreeD()->Write(hname,TObject::kOverwrite);
354 fLoader->TreeD()->Reset();
2ab0c725 355}
a9e2aefa 356
ce3f5e87 357//_______________________________________________________________________
3fa6cfdd 358AliLoader* AliMUON::MakeLoader(const char* topfoldername)
359{
360//builds standard getter (AliLoader type)
361//if detector wants to use castomized getter, it must overload this method
362
363 if (GetDebug())
364 Info("MakeLoader",
365 "Creating standard getter for detector %s. Top folder is %s.",
366 GetName(),topfoldername);
367
128843d9 368 fLoader = new AliLoader(GetName(),topfoldername);
ce3f5e87 369 fMUONData = new AliMUONData(fLoader,GetName(),GetName());
3fa6cfdd 370 return fLoader;
371}
a897a37a 372
ce3f5e87 373//_______________________________________________________________________
a9e2aefa 374void AliMUON::Trigger(Int_t nev){
375// call the Trigger Algorithm and fill TreeR
376
377 Int_t singlePlus[3] = {0,0,0};
378 Int_t singleMinus[3] = {0,0,0};
379 Int_t singleUndef[3] = {0,0,0};
380 Int_t pairUnlike[3] = {0,0,0};
381 Int_t pairLike[3] = {0,0,0};
ce3f5e87 382
a9e2aefa 383 ResetTrigger();
a9e2aefa 384 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
385 decision->Trigger();
386 decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef,
387 pairUnlike, pairLike);
ce3f5e87 388
389 // add a local trigger in the list
390 GetMUONData()->AddGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
9ae15266 391 Int_t i;
a9e2aefa 392
f665c1ea 393 for (Int_t icirc=0; icirc<AliMUONConstants::NTriggerCircuit(); icirc++) {
ce3f5e87 394 if(decision->GetITrigger(icirc)==1) {
395 Int_t localtr[7]={0,0,0,0,0,0,0};
396 Int_t loLpt[2]={0,0}; Int_t loHpt[2]={0,0}; Int_t loApt[2]={0,0};
397 decision->GetLutOutput(icirc, loLpt, loHpt, loApt);
398 localtr[0] = icirc;
399 localtr[1] = decision->GetStripX11(icirc);
400 localtr[2] = decision->GetDev(icirc);
401 localtr[3] = decision->GetStripY11(icirc);
402 for (i=0; i<2; i++) { // convert the Lut output in 1 digit
403 localtr[4] = localtr[4]+Int_t(loLpt[i]*TMath::Power(2,i));
404 localtr[5] = localtr[5]+Int_t(loHpt[i]*TMath::Power(2,i));
405 localtr[6] = localtr[6]+Int_t(loApt[i]*TMath::Power(2,i));
a897a37a 406 }
ce3f5e87 407 GetMUONData()->AddLocalTrigger(localtr); // add a local trigger in the list
408 }
a9e2aefa 409 }
ce3f5e87 410
a9e2aefa 411 delete decision;
bf17dbfd 412
ba9436c6 413 // fLoader->TreeR()->Fill();
1a1cdff8 414 GetMUONData()->Fill("GLT"); //Filling Global and Local Trigger GLT
ce3f5e87 415 // char hname[30];
416 // sprintf(hname,"TreeR%d",nev);
417 // fLoader->TreeR()->Write(hname,TObject::kOverwrite);
bf17dbfd 418 // fLoader->TreeR()->Reset();
88cb7938 419 fLoader->WriteRecPoints("OVERWRITE");
88cb7938 420
a9e2aefa 421 printf("\n End of trigger for event %d", nev);
a897a37a 422}
a897a37a 423
ce3f5e87 424//____________________________________________________________________
fe311ef1 425void AliMUON::Digits2Reco()
426{
427 FindClusters();
e365e1ee 428 Int_t nev = gAlice->GetHeader()->GetEvent();
1a1cdff8 429 GetMUONData()->Fill("RC"); //Filling Reconstructed Cluster
88cb7938 430 fLoader->WriteRecPoints("OVERWRITE");
ce3f5e87 431 GetMUONData()->ResetRawClusters();
1a1cdff8 432 Info("Digits2Reco","End of cluster finding for event %d", nev);
fe311ef1 433}
ce3f5e87 434//____________________________________________________________________
fe311ef1 435void AliMUON::FindClusters()
a9e2aefa 436{
de05461e 437//
438// Perform cluster finding
439//
a9e2aefa 440 TClonesArray *dig1, *dig2;
441 Int_t ndig, k;
442 dig1 = new TClonesArray("AliMUONDigit",1000);
443 dig2 = new TClonesArray("AliMUONDigit",1000);
444 AliMUONDigit *digit;
a9e2aefa 445// Loop on chambers and on cathode planes
a897a37a 446//
fe311ef1 447 ResetRawClusters();
88cb7938 448 TClonesArray * muonDigits;
449
1bd28025 450 for (Int_t ich = 0; ich < 10; ich++) {
2682e810 451 //PH AliMUONChamber* iChamber = (AliMUONChamber*) (*fChambers)[ich];
452 AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich);
fe311ef1 453 AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel();
454
88cb7938 455 ResetDigits();
1a1cdff8 456 GetMUONData()->GetCathode(0);
88cb7938 457 //TClonesArray *
1a1cdff8 458 muonDigits = GetMUONData()->Digits(ich);
a9e2aefa 459 ndig=muonDigits->GetEntriesFast();
88cb7938 460 printf("\n 1 Found %d digits in %p chamber %d", ndig, muonDigits,ich);
a9e2aefa 461 TClonesArray &lhits1 = *dig1;
1bd28025 462 Int_t n = 0;
463 for (k = 0; k < ndig; k++) {
464 digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
465 if (rec->TestTrack(digit->Track(0)))
a9e2aefa 466 new(lhits1[n++]) AliMUONDigit(*digit);
467 }
1a1cdff8 468 GetMUONData()->ResetDigits();
469 GetMUONData()->GetCathode(1);
470 muonDigits = GetMUONData()->Digits(ich);
a9e2aefa 471 ndig=muonDigits->GetEntriesFast();
472 printf("\n 2 Found %d digits in %p %d", ndig, muonDigits, ich);
473 TClonesArray &lhits2 = *dig2;
474 n=0;
475
476 for (k=0; k<ndig; k++) {
477 digit= (AliMUONDigit*) muonDigits->UncheckedAt(k);
1bd28025 478 if (rec->TestTrack(digit->Track(0)))
a9e2aefa 479 new(lhits2[n++]) AliMUONDigit(*digit);
a897a37a 480 }
a897a37a 481
9825400f 482 if (rec) {
483 AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2);
a9e2aefa 484 rec->FindRawClusters();
485 }
486 dig1->Delete();
487 dig2->Delete();
488 } // for ich
a9e2aefa 489 delete dig1;
490 delete dig2;
a897a37a 491}
ce3f5e87 492//______________________________________________________________________
2ab0c725 493#ifdef never
ce3f5e87 494void AliMUON::Streamer(TBuffer &R__b)_
fe4da5cc 495{
496 // Stream an object of class AliMUON.
a30a000f 497 AliMUONChamber *iChamber;
a9e2aefa 498 AliMUONTriggerCircuit *iTriggerCircuit;
a30a000f 499 AliSegmentation *segmentation;
500 AliMUONResponse *response;
501 TClonesArray *digitsaddress;
502 TClonesArray *rawcladdress;
9ae15266 503 Int_t i;
9ae15266 504 if (R__b.IsReading()) {
505 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
506 AliDetector::Streamer(R__b);
507 R__b >> fNPadHits;
508 R__b >> fPadHits; // diff
509 R__b >> fNLocalTrigger;
510 R__b >> fLocalTrigger;
511 R__b >> fNGlobalTrigger;
512 R__b >> fGlobalTrigger;
513 R__b >> fDchambers;
514 R__b >> fRawClusters;
515 R__b.ReadArray(fNdch);
516 R__b.ReadArray(fNrawch);
517 R__b >> fAccCut;
518 R__b >> fAccMin;
519 R__b >> fAccMax;
520 R__b >> fChambers;
521 R__b >> fTriggerCircuits;
f665c1ea 522 for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
9ae15266 523 iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
524 iTriggerCircuit->Streamer(R__b);
fe4da5cc 525 }
9ae15266 526// Stream chamber related information
f665c1ea 527 for (i =0; i<AliMUONConstants::NCh(); i++) {
9ae15266 528 iChamber=(AliMUONChamber*) (*fChambers)[i];
529 iChamber->Streamer(R__b);
530 if (iChamber->Nsec()==1) {
531 segmentation=iChamber->SegmentationModel(1);
532 if (segmentation)
533 segmentation->Streamer(R__b);
534 } else {
535 segmentation=iChamber->SegmentationModel(1);
536 if (segmentation)
537 segmentation->Streamer(R__b);
538 if (segmentation)
539 segmentation=iChamber->SegmentationModel(2);
540 segmentation->Streamer(R__b);
541 }
542 response=iChamber->ResponseModel();
543 if (response)
544 response->Streamer(R__b);
545 digitsaddress=(TClonesArray*) (*fDchambers)[i];
546 digitsaddress->Streamer(R__b);
f665c1ea 547 if (i < AliMUONConstants::NTrackingCh()) {
9ae15266 548 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
549 rawcladdress->Streamer(R__b);
550 }
a9e2aefa 551 }
9ae15266 552
553 } else {
554 R__b.WriteVersion(AliMUON::IsA());
555 AliDetector::Streamer(R__b);
556 R__b << fNPadHits;
557 R__b << fPadHits; // diff
558 R__b << fNLocalTrigger;
559 R__b << fLocalTrigger;
560 R__b << fNGlobalTrigger;
561 R__b << fGlobalTrigger;
562 R__b << fDchambers;
563 R__b << fRawClusters;
f665c1ea 564 R__b.WriteArray(fNdch, AliMUONConstants::NCh());
565 R__b.WriteArray(fNrawch, AliMUONConstants::NTrackingCh());
9ae15266 566
567 R__b << fAccCut;
568 R__b << fAccMin;
569 R__b << fAccMax;
570
571 R__b << fChambers;
572 R__b << fTriggerCircuits;
f665c1ea 573 for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
9ae15266 574 iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
575 iTriggerCircuit->Streamer(R__b);
fe4da5cc 576 }
f665c1ea 577 for (i =0; i<AliMUONConstants::NCh(); i++) {
9ae15266 578 iChamber=(AliMUONChamber*) (*fChambers)[i];
579 iChamber->Streamer(R__b);
580 if (iChamber->Nsec()==1) {
581 segmentation=iChamber->SegmentationModel(1);
582 if (segmentation)
583 segmentation->Streamer(R__b);
584 } else {
585 segmentation=iChamber->SegmentationModel(1);
586 if (segmentation)
587 segmentation->Streamer(R__b);
588 segmentation=iChamber->SegmentationModel(2);
589 if (segmentation)
590 segmentation->Streamer(R__b);
591 }
592 response=iChamber->ResponseModel();
593 if (response)
594 response->Streamer(R__b);
595 digitsaddress=(TClonesArray*) (*fDchambers)[i];
596 digitsaddress->Streamer(R__b);
f665c1ea 597 if (i < AliMUONConstants::NTrackingCh()) {
9ae15266 598 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
599 rawcladdress->Streamer(R__b);
600 }
a9e2aefa 601 }
fe4da5cc 602 }
fe4da5cc 603}
2ab0c725 604#endif
ce3f5e87 605//_______________________________________________________________________
a9e2aefa 606AliMUONPadHit* AliMUON::FirstPad(AliMUONHit* hit, TClonesArray *clusters)
fe4da5cc 607{
5a35ac13 608// to be removed
fe4da5cc 609 // Initialise the pad iterator
610 // Return the address of the first padhit for hit
a897a37a 611 TClonesArray *theClusters = clusters;
fe4da5cc 612 Int_t nclust = theClusters->GetEntriesFast();
1bd28025 613 if (nclust && hit->PHlast() > 0) {
614 AliMUON::fMaxIterPad=hit->PHlast();
615 AliMUON::fCurIterPad=hit->PHfirst();
a9e2aefa 616 return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
fe4da5cc 617 } else {
618 return 0;
619 }
620}
ce3f5e87 621//_______________________________________________________________________
a9e2aefa 622AliMUONPadHit* AliMUON::NextPad(TClonesArray *clusters)
fe4da5cc 623{
5a35ac13 624 // To be removed
de05461e 625// Get next pad (in iterator)
626//
a9e2aefa 627 AliMUON::fCurIterPad++;
628 if (AliMUON::fCurIterPad <= AliMUON::fMaxIterPad) {
629 return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
fe4da5cc 630 } else {
631 return 0;
632 }
633}
ce3f5e87 634//_______________________________________________________________________
a897a37a 635
636AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster)
637{
de05461e 638//
639// Return rawcluster (icluster) for chamber ichamber and cathode icathod
640// Obsolete ??
ce3f5e87 641 TClonesArray *muonRawCluster = GetMUONData()->RawClusters(ichamber);
a897a37a 642 ResetRawClusters();
88cb7938 643 TTree *treeR = fLoader->TreeR();
a9e2aefa 644 Int_t nent=(Int_t)treeR->GetEntries();
645 treeR->GetEvent(nent-2+icathod-1);
646 //treeR->GetEvent(icathod);
647 //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast();
a897a37a 648
a9e2aefa 649 AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster);
a897a37a 650 //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw);
651
652 return mRaw;
653}
ce3f5e87 654//________________________________________________________________________
1cae9436 655void AliMUON::SetMerger(AliMUONMerger* merger)
656{
657// Set pointer to merger
658 fMerger = merger;
659}
ce3f5e87 660//________________________________________________________________________
1cae9436 661AliMUONMerger* AliMUON::Merger()
662{
663// Return pointer to merger
664 return fMerger;
665}
ce3f5e87 666//________________________________________________________________________
50e97f19 667AliMUON& AliMUON::operator = (const AliMUON& /*rhs*/)
a897a37a 668{
a9e2aefa 669// copy operator
670// dummy version
671 return *this;
a897a37a 672}
673