Fixes to coding conventions violations
[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)
fe4da5cc 87//___________________________________________
88AliMUON::AliMUON()
89{
de05461e 90// Default Constructor
91//
1bd28025 92 fNCh = 0;
93 fNTrackingCh = 0;
1bd26093 94 fIshunt = 0;
1bd26093 95 fPadHits = 0;
96 fNPadHits = 0;
1bd28025 97 fChambers = 0;
1bd26093 98 fDchambers = 0;
1bd28025 99 fTriggerCircuits = 0;
1bd26093 100 fNdch = 0;
101 fRawClusters = 0;
102 fNrawch = 0;
103 fGlobalTrigger = 0;
104 fNLocalTrigger = 0;
105 fLocalTrigger = 0;
106 fNLocalTrigger = 0;
107 fAccMin = 0.;
108 fAccMax = 0.;
109 fAccCut = kFALSE;
1cae9436 110 fMerger = 0;
edf34242 111 fFileName = 0;
fe4da5cc 112}
113
114//___________________________________________
115AliMUON::AliMUON(const char *name, const char *title)
116 : AliDetector(name,title)
117{
118//Begin_Html
119/*
a897a37a 120<img src="gif/alimuon.gif">
fe4da5cc 121*/
122//End_Html
f665c1ea 123
a9e2aefa 124 fHits = new TClonesArray("AliMUONHit",1000);
1cedd08a 125 gAlice->AddHitList(fHits);
a9e2aefa 126 fPadHits = new TClonesArray("AliMUONPadHit",10000);
127 fNPadHits = 0;
fe4da5cc 128 fIshunt = 0;
129
1bd28025 130 fNCh = AliMUONConstants::NCh();
1bd26093 131 fNTrackingCh = AliMUONConstants::NTrackingCh();
1bd28025 132 fNdch = new Int_t[fNCh];
fe4da5cc 133
f665c1ea 134 fDchambers = new TObjArray(AliMUONConstants::NCh());
fe4da5cc 135
136 Int_t i;
137
f665c1ea 138 for (i=0; i<AliMUONConstants::NCh() ;i++) {
cd4df77b 139 fDchambers->AddAt(new TClonesArray("AliMUONDigit",10000),i);
fe4da5cc 140 fNdch[i]=0;
141 }
142
1bd28025 143 fNrawch = new Int_t[fNTrackingCh];
a897a37a 144
f665c1ea 145 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
a897a37a 146
f665c1ea 147 for (i=0; i<AliMUONConstants::NTrackingCh();i++) {
cd4df77b 148 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
a897a37a 149 fNrawch[i]=0;
150 }
151
a9e2aefa 152 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
153 fNGlobalTrigger = 0;
154 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
155 fNLocalTrigger = 0;
fe4da5cc 156
fe4da5cc 157 SetMarkerColor(kRed);
a9e2aefa 158//
159//
160//
161//
f665c1ea 162
a9e2aefa 163 Int_t ch;
164
f665c1ea 165 fChambers = new TObjArray(AliMUONConstants::NCh());
a9e2aefa 166
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
170 for (Int_t stCH = 0; stCH < 2; stCH++) {
171//
172//
173// Default Parameters for Muon Tracking Stations
174
175
176 ch = 2 * st + stCH;
177//
f665c1ea 178 if (ch < AliMUONConstants::NTrackingCh()) {
cd4df77b 179 fChambers->AddAt(new AliMUONChamber(ch),ch);
a9e2aefa 180 } else {
cd4df77b 181 fChambers->AddAt(new AliMUONChamberTrigger(ch),ch);
a9e2aefa 182 }
183
2682e810 184 //PH AliMUONChamber* chamber = (AliMUONChamber*) (*fChambers)[ch];
185 AliMUONChamber* chamber = (AliMUONChamber*) fChambers->At(ch);
a9e2aefa 186
187 chamber->SetGid(0);
188 // Default values for Z of chambers
f665c1ea 189 chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch));
a9e2aefa 190//
f665c1ea 191 chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch));
5c1f55c5 192// Set chamber inner and outer radius to default
f665c1ea 193 chamber->SetRInner(AliMUONConstants::Dmin(st)/2);
194 chamber->SetROuter(AliMUONConstants::Dmax(st)/2);
a9e2aefa 195//
196 } // Chamber stCH (0, 1) in
197 } // Station st (0...)
cd4df77b 198// fChambers->SetLast(AliMUONConstants::NCh());
a9e2aefa 199 fMaxStepGas=0.01;
200 fMaxStepAlu=0.1;
201 fMaxDestepGas=-1;
202 fMaxDestepAlu=-1;
203//
204 fMaxIterPad = 0;
205 fCurIterPad = 0;
5c1f55c5 206//
207 fAccMin = 0.;
208 fAccMax = 0.;
209 fAccCut = kFALSE;
a9e2aefa 210
211 // cp new design of AliMUONTriggerDecision
f665c1ea 212 fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit());
213 for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) {
cd4df77b 214 fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ);
a9e2aefa 215
1cae9436 216 }
217 fMerger = 0;
fe4da5cc 218}
219
220//___________________________________________
50e97f19 221AliMUON::AliMUON(const AliMUON& rMUON):AliDetector(rMUON)
a9e2aefa 222{
223// Dummy copy constructor
224 ;
225
226}
227
fe4da5cc 228AliMUON::~AliMUON()
229{
de05461e 230// Destructor
9e1a0ddb 231 if(fDebug) printf("%s: Calling AliMUON destructor !!!\n",ClassName());
a897a37a 232
f665c1ea 233 fIshunt = 0;
c2c0190f 234
235 // Delete TObjArrays
236
237 if (fChambers){
238 fChambers->Delete();
239 delete fChambers;
240 }
241
242 if (fTriggerCircuits){
243 fTriggerCircuits->Delete();
244 delete fTriggerCircuits;
245 }
246
247 if (fDchambers){
248 fDchambers->Delete();
249 delete fDchambers;
250 }
251
252 if (fRawClusters){
253 fRawClusters->Delete();
254 delete fRawClusters;
255 }
62468ef9 256
257 if (fNrawch) delete [] fNrawch;
c2c0190f 258
259 // Delete TClonesArrays
260
261 if (fPadHits){
262 fPadHits->Delete();
263 delete fPadHits;
264 }
265
266 if (fGlobalTrigger){
267 fGlobalTrigger->Delete();
268 delete fGlobalTrigger;
269 }
f665c1ea 270 fNGlobalTrigger = 0;
271
c2c0190f 272 if (fLocalTrigger){
273 fLocalTrigger->Delete();
274 delete fLocalTrigger;
275 }
f665c1ea 276 fNLocalTrigger = 0;
a897a37a 277
c2c0190f 278 if (fHits) {
279 fHits->Delete();
280 delete fHits;
281 }
282
1cae9436 283 if (fMerger) delete fMerger;
62468ef9 284 if (fNdch) delete [] fNdch;
285
fe4da5cc 286}
287
288//___________________________________________
289void AliMUON::AddHit(Int_t track, Int_t *vol, Float_t *hits)
290{
291 TClonesArray &lhits = *fHits;
a9e2aefa 292 new(lhits[fNhits++]) AliMUONHit(fIshunt,track,vol,hits);
fe4da5cc 293}
294//___________________________________________
5a35ac13 295void AliMUON::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
296 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
297 Float_t tof, Float_t momentum, Float_t theta,
298 Float_t phi, Float_t length, Float_t destep)
299{
300 TClonesArray &lhits = *fHits;
301 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
302 idpart, X, Y, Z,
303 tof, momentum, theta,
304 phi, length, destep);
305}
306//___________________________________________
307void AliMUON::AddPadHit(Int_t *clhits) // To be removed
fe4da5cc 308{
a9e2aefa 309 TClonesArray &lclusters = *fPadHits;
310 new(lclusters[fNPadHits++]) AliMUONPadHit(clhits);
fe4da5cc 311}
312//_____________________________________________________________________________
313void AliMUON::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
314{
315 //
316 // Add a MUON digit to the list
317 //
318
1e7c351a 319 //PH TClonesArray &ldigits = * ((TClonesArray*)(*fDchambers)[id]);
320 TClonesArray &ldigits = * ( (TClonesArray*) fDchambers->At(id) );
a9e2aefa 321 new(ldigits[fNdch[id]++]) AliMUONDigit(tracks,charges,digits);
fe4da5cc 322}
323
a897a37a 324//_____________________________________________________________________________
325void AliMUON::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
326{
327 //
328 // Add a MUON digit to the list
329 //
330
2682e810 331 //PH TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]);
332 TClonesArray &lrawcl = *((TClonesArray*)fRawClusters->At(id));
a897a37a 333 new(lrawcl[fNrawch[id]++]) AliMUONRawCluster(c);
334}
a897a37a 335
a9e2aefa 336//___________________________________________
337void AliMUON::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus,
338 Int_t *singleUndef,
339 Int_t *pairUnlike, Int_t *pairLike)
340{
341// add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
342 TClonesArray &globalTrigger = *fGlobalTrigger;
343 new(globalTrigger[fNGlobalTrigger++])
344 AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike,
345 pairLike);
346}
347//___________________________________________
348void AliMUON::AddLocalTrigger(Int_t *localtr)
349{
350// add a MUON Local Trigger to the list
351 TClonesArray &localTrigger = *fLocalTrigger;
352 new(localTrigger[fNLocalTrigger++]) AliMUONLocalTrigger(localtr);
a897a37a 353}
354
fe4da5cc 355//___________________________________________
356void AliMUON::BuildGeometry()
357{
de05461e 358// Geometry for event display
5fd73042 359 for (Int_t i=0; i<7; i++) {
360 for (Int_t j=0; j<2; j++) {
361 Int_t id=2*i+j+1;
362 this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay");
a897a37a 363 }
5fd73042 364 }
fe4da5cc 365}
366
367//___________________________________________
368Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t )
369{
370 return 9999;
371}
372
373//___________________________________________
88cb7938 374void AliMUON::MakeBranch(Option_t* option)
fe4da5cc 375{
2ab0c725 376 //
f665c1ea 377 // Create Tree branches for the MUON.
2ab0c725 378 //
f665c1ea 379 const Int_t kBufferSize = 4000;
380 char branchname[30];
381 sprintf(branchname,"%sCluster",GetName());
382
f665c1ea 383
5cf7bbad 384 const char *cD = strstr(option,"D");
385 const char *cR = strstr(option,"R");
386 const char *cH = strstr(option,"H");
2ab0c725 387
88cb7938 388 if (TreeH() && cH)
389 {
390 if (fPadHits == 0x0) fPadHits = new TClonesArray("AliMUONPadHit",10000);
391 MakeBranchInTree(TreeH(), branchname, &fPadHits, kBufferSize, 0);
392 if (fHits == 0x0) fHits = new TClonesArray("AliMUONHit",1000);
393 }
394 //it must be under fHits creation
395 AliDetector::MakeBranch(option);
f665c1ea 396
88cb7938 397 if (cD && fLoader->TreeD()) {
2ab0c725 398 //
399 // one branch for digits per chamber
400 //
401 Int_t i;
88cb7938 402 if (fDchambers == 0x0)
403 {
404 fDchambers = new TObjArray(AliMUONConstants::NCh());
405 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
406 fDchambers->AddAt(new TClonesArray("AliMUONDigit",10000),i);
407 }
2ab0c725 408 }
88cb7938 409
410 for (i=0; i<AliMUONConstants::NCh() ;i++)
411 {
412 sprintf(branchname,"%sDigits%d",GetName(),i+1);
413 MakeBranchInTree(fLoader->TreeD(), branchname, &((*fDchambers)[i]), kBufferSize, 0);
414 printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
415 }
f665c1ea 416 }
417
88cb7938 418 if (cR && fLoader->TreeR()) {
2ab0c725 419 //
420 // one branch for raw clusters per chamber
421 //
88cb7938 422 printf("Make Branch - TreeR address %p\n",fLoader->TreeR());
2ab0c725 423
424 Int_t i;
88cb7938 425 if (fRawClusters == 0x0)
426 {
427 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
428 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
429 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
430 }
431 }
2ab0c725 432
88cb7938 433 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++)
434 {
435 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
436 MakeBranchInTree(fLoader->TreeR(), branchname, &((*fRawClusters)[i]), kBufferSize, 0);
437 printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1);
2ab0c725 438 }
439 //
440 // one branch for global trigger
441 //
442 sprintf(branchname,"%sGlobalTrigger",GetName());
88cb7938 443
444 if (fGlobalTrigger == 0x0) {
445 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
2ab0c725 446 }
88cb7938 447 MakeBranchInTree(fLoader->TreeR(), branchname, &fGlobalTrigger, kBufferSize, 0);
448 printf("Making Branch %s for Global Trigger\n",branchname);
2ab0c725 449 //
450 // one branch for local trigger
451 //
452 sprintf(branchname,"%sLocalTrigger",GetName());
88cb7938 453
454 if (fLocalTrigger == 0x0) {
455 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
2ab0c725 456 }
88cb7938 457
458 MakeBranchInTree(fLoader->TreeR(), branchname, &fLocalTrigger, kBufferSize, 0);
459 printf("Making Branch %s for Local Trigger\n",branchname);
2ab0c725 460 }
fe4da5cc 461}
462
463//___________________________________________
464void AliMUON::SetTreeAddress()
465{
466 // Set branch address for the Hits and Digits Tree.
a897a37a 467 char branchname[30];
fe4da5cc 468
469 TBranch *branch;
88cb7938 470 TTree *treeH = fLoader->TreeH();
471 TTree *treeD = fLoader->TreeD();
472 TTree *treeR = fLoader->TreeR();
fe4da5cc 473
474 if (treeH) {
88cb7938 475 if (fPadHits == 0x0) fPadHits = new TClonesArray("AliMUONPadHit",10000);
a9e2aefa 476 if (fPadHits) {
fe4da5cc 477 branch = treeH->GetBranch("MUONCluster");
a9e2aefa 478 if (branch) branch->SetAddress(&fPadHits);
fe4da5cc 479 }
88cb7938 480 if (fHits == 0x0) fHits = new TClonesArray("AliMUONHit",1000);
fe4da5cc 481 }
88cb7938 482 //it must be under fHits creation
483 AliDetector::SetTreeAddress();
fe4da5cc 484
485 if (treeD) {
88cb7938 486 if (fDchambers == 0x0)
487 {
488 fDchambers = new TObjArray(AliMUONConstants::NCh());
489 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
490 fDchambers->AddAt(new TClonesArray("AliMUONDigit",10000),i);
491 }
492 }
f665c1ea 493 for (int i=0; i<AliMUONConstants::NCh(); i++) {
fe4da5cc 494 sprintf(branchname,"%sDigits%d",GetName(),i+1);
88cb7938 495
496 if (fDchambers) {
fe4da5cc 497 branch = treeD->GetBranch(branchname);
498 if (branch) branch->SetAddress(&((*fDchambers)[i]));
499 }
500 }
501 }
a897a37a 502
503 // printf("SetTreeAddress --- treeR address %p \n",treeR);
504
505 if (treeR) {
88cb7938 506 if (fRawClusters == 0x0)
507 {
508 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
509 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
510 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
511 }
512 }
513
f665c1ea 514 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
a897a37a 515 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
516 if (fRawClusters) {
517 branch = treeR->GetBranch(branchname);
518 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
519 }
520 }
a897a37a 521
88cb7938 522 if (fLocalTrigger == 0x0) {
523 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
524 }
525
a9e2aefa 526 if (fLocalTrigger) {
527 branch = treeR->GetBranch("MUONLocalTrigger");
528 if (branch) branch->SetAddress(&fLocalTrigger);
529 }
88cb7938 530
531 if (fGlobalTrigger == 0x0) {
532 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
533 }
534
a9e2aefa 535 if (fGlobalTrigger) {
536 branch = treeR->GetBranch("MUONGlobalTrigger");
537 if (branch) branch->SetAddress(&fGlobalTrigger);
538 }
539 }
fe4da5cc 540}
541//___________________________________________
542void AliMUON::ResetHits()
543{
544 // Reset number of clusters and the cluster array for this detector
545 AliDetector::ResetHits();
a9e2aefa 546 fNPadHits = 0;
547 if (fPadHits) fPadHits->Clear();
fe4da5cc 548}
549
550//____________________________________________
551void AliMUON::ResetDigits()
552{
553 //
554 // Reset number of digits and the digits array for this detector
555 //
03a51b7f 556 if (fDchambers == 0x0) return;
f665c1ea 557 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
2682e810 558 //PH if ((*fDchambers)[i]) ((TClonesArray*)(*fDchambers)[i])->Clear();
559 if ((*fDchambers)[i]) ((TClonesArray*)fDchambers->At(i))->Clear();
fe4da5cc 560 if (fNdch) fNdch[i]=0;
561 }
562}
563//____________________________________________
a897a37a 564void AliMUON::ResetRawClusters()
565{
566 //
567 // Reset number of raw clusters and the raw clust array for this detector
568 //
f665c1ea 569 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
2682e810 570 //PH if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear();
571 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
a897a37a 572 if (fNrawch) fNrawch[i]=0;
573 }
574}
a9e2aefa 575
a897a37a 576//____________________________________________
a9e2aefa 577void AliMUON::ResetTrigger()
a897a37a 578{
a9e2aefa 579 // Reset Local and Global Trigger
580 fNGlobalTrigger = 0;
581 if (fGlobalTrigger) fGlobalTrigger->Clear();
582 fNLocalTrigger = 0;
583 if (fLocalTrigger) fLocalTrigger->Clear();
584}
585
586//____________________________________________
587void AliMUON::SetPadSize(Int_t id, Int_t isec, Float_t p1, Float_t p2)
588{
de05461e 589// Set the pad size for chamber id and cathode isec
a9e2aefa 590 Int_t i=2*(id-1);
2682e810 591 //PH ((AliMUONChamber*) (*fChambers)[i]) ->SetPadSize(isec,p1,p2);
592 //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetPadSize(isec,p1,p2);
593 ((AliMUONChamber*) fChambers->At(i)) ->SetPadSize(isec,p1,p2);
594 ((AliMUONChamber*) fChambers->At(i+1))->SetPadSize(isec,p1,p2);
a897a37a 595}
596
fe4da5cc 597//___________________________________________
a9e2aefa 598void AliMUON::SetChambersZ(const Float_t *Z)
599{
600 // Set Z values for all chambers (tracking and trigger)
601 // from the array pointed to by "Z"
f665c1ea 602 for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++)
2682e810 603 //PH ((AliMUONChamber*) ((*fChambers)[ch]))->SetZ(Z[ch]);
604 ((AliMUONChamber*) fChambers->At(ch))->SetZ(Z[ch]);
f665c1ea 605 return;
a9e2aefa 606}
fe4da5cc 607
a9e2aefa 608//___________________________________________
609void AliMUON::SetChambersZToDefault()
fe4da5cc 610{
a9e2aefa 611 // Set Z values for all chambers (tracking and trigger)
612 // to default values
f665c1ea 613 SetChambersZ(AliMUONConstants::DefaultChamberZ());
a9e2aefa 614 return;
fe4da5cc 615}
616
617//___________________________________________
a897a37a 618void AliMUON::SetChargeSlope(Int_t id, Float_t p1)
fe4da5cc 619{
de05461e 620// Set the inverse charge slope for chamber id
fe4da5cc 621 Int_t i=2*(id-1);
2682e810 622 //PH ((AliMUONChamber*) (*fChambers)[i])->SetChargeSlope(p1);
623 //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetChargeSlope(p1);
624 ((AliMUONChamber*) fChambers->At(i))->SetChargeSlope(p1);
625 ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSlope(p1);
fe4da5cc 626}
627
628//___________________________________________
a897a37a 629void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2)
fe4da5cc 630{
de05461e 631// Set sigma of charge spread for chamber id
fe4da5cc 632 Int_t i=2*(id-1);
2682e810 633 //PH ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2);
634 //PH ((AliMUONChamber*) fChambers->Ati+1])->SetChargeSpread(p1,p2);
635 ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2);
636 ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSpread(p1,p2);
fe4da5cc 637}
638
639//___________________________________________
a897a37a 640void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1)
fe4da5cc 641{
de05461e 642// Set integration limits for charge spread
fe4da5cc 643 Int_t i=2*(id-1);
2682e810 644 //PH ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1);
645 //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1);
646 ((AliMUONChamber*) fChambers->At(i))->SetSigmaIntegration(p1);
647 ((AliMUONChamber*) fChambers->At(i+1))->SetSigmaIntegration(p1);
fe4da5cc 648}
649
650//___________________________________________
d09fafb0 651void AliMUON::SetMaxAdc(Int_t id, Int_t p1)
fe4da5cc 652{
de05461e 653// Set maximum number for ADCcounts (saturation)
fe4da5cc 654 Int_t i=2*(id-1);
2682e810 655 //PH ((AliMUONChamber*) (*fChambers)[i])->SetMaxAdc(p1);
656 //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetMaxAdc(p1);
657 ((AliMUONChamber*) fChambers->At(i))->SetMaxAdc(p1);
658 ((AliMUONChamber*) fChambers->At(i+1))->SetMaxAdc(p1);
fe4da5cc 659}
660
661//___________________________________________
a897a37a 662void AliMUON::SetMaxStepGas(Float_t p1)
fe4da5cc 663{
de05461e 664// Set stepsize in gas
fe4da5cc 665 fMaxStepGas=p1;
666}
667
668//___________________________________________
a897a37a 669void AliMUON::SetMaxStepAlu(Float_t p1)
fe4da5cc 670{
de05461e 671// Set step size in Alu
fe4da5cc 672 fMaxStepAlu=p1;
673}
674
675//___________________________________________
a897a37a 676void AliMUON::SetMaxDestepGas(Float_t p1)
fe4da5cc 677{
de05461e 678// Set maximum step size in Gas
fe4da5cc 679 fMaxDestepGas=p1;
680}
681
682//___________________________________________
a897a37a 683void AliMUON::SetMaxDestepAlu(Float_t p1)
fe4da5cc 684{
de05461e 685// Set maximum step size in Alu
fe4da5cc 686 fMaxDestepAlu=p1;
687}
688//___________________________________________
5c1f55c5 689void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax)
fe4da5cc 690{
de05461e 691// Set acceptance cuts
fe4da5cc 692 fAccCut=acc;
5c1f55c5 693 fAccMin=angmin*TMath::Pi()/180;
694 fAccMax=angmax*TMath::Pi()/180;
695 Int_t ch;
696 if (acc) {
697 for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
698 // Loop over 2 chambers in the station
699 for (Int_t stCH = 0; stCH < 2; stCH++) {
700 ch = 2 * st + stCH;
701// Set chamber inner and outer radius according to acceptance cuts
702 Chamber(ch).SetRInner(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin));
703 Chamber(ch).SetROuter(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax));
704 } // chamber loop
705 } // station loop
706 }
fe4da5cc 707}
708//___________________________________________
a30a000f 709void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation)
fe4da5cc 710{
de05461e 711// Set the segmentation for chamber id cathode isec
2682e810 712 //PH ((AliMUONChamber*) (*fChambers)[id])->SetSegmentationModel(isec, segmentation);
713 ((AliMUONChamber*) fChambers->At(id))->SetSegmentationModel(isec, segmentation);
fe4da5cc 714
715}
716//___________________________________________
a9e2aefa 717void AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response)
fe4da5cc 718{
de05461e 719// Set the response for chamber id
2682e810 720 //PH ((AliMUONChamber*) (*fChambers)[id])->SetResponseModel(response);
721 ((AliMUONChamber*) fChambers->At(id))->SetResponseModel(response);
fe4da5cc 722}
723
30aaba74 724void AliMUON::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst)
a897a37a 725{
de05461e 726// Set ClusterFinder for chamber id
2682e810 727 //PH ((AliMUONChamber*) (*fChambers)[id])->SetReconstructionModel(reconst);
728 ((AliMUONChamber*) fChambers->At(id))->SetReconstructionModel(reconst);
a897a37a 729}
730
fe4da5cc 731void AliMUON::SetNsec(Int_t id, Int_t nsec)
732{
de05461e 733// Set number of segmented cathods for chamber id
2682e810 734 //PH ((AliMUONChamber*) (*fChambers)[id])->SetNsec(nsec);
735 ((AliMUONChamber*) fChambers->At(id))->SetNsec(nsec);
fe4da5cc 736}
737
fe4da5cc 738//___________________________________________
2ab0c725 739void AliMUON::SDigits2Digits()
740{
d963c261 741
742// write TreeD here
743
744 if (!fMerger) {
745 if (gAlice->GetDebug()>0) {
746 cerr<<"AliMUON::SDigits2Digits: create default AliMUONMerger "<<endl;
747 cerr<<" no merging, just digitization of 1 event will be done"<<endl;
748 }
749 fMerger = new AliMUONMerger();
2ab0c725 750 }
d963c261 751 fMerger->Init();
752 fMerger->Digitise();
753 char hname[30];
88cb7938 754 // sprintf(hname,"TreeD%d",fLoader->GetHeader()->GetEvent());
755 fLoader->TreeD()->Write(hname,TObject::kOverwrite);
756 fLoader->TreeD()->Reset();
2ab0c725 757}
a9e2aefa 758
3fa6cfdd 759
760//__________________________________________________________________________
761AliLoader* AliMUON::MakeLoader(const char* topfoldername)
762{
763//builds standard getter (AliLoader type)
764//if detector wants to use castomized getter, it must overload this method
765
766 if (GetDebug())
767 Info("MakeLoader",
768 "Creating standard getter for detector %s. Top folder is %s.",
769 GetName(),topfoldername);
770
771 fLoader = new AliMUONLoader(GetName(),topfoldername);
772 return fLoader;
773}
774//__________________________________________________________________________
5a35ac13 775// To be removed
802a864d 776void AliMUON::MakePadHits(Float_t xhit,Float_t yhit, Float_t zhit,
a9e2aefa 777 Float_t eloss, Float_t tof, Int_t idvol)
fe4da5cc 778{
779//
a897a37a 780// Calls the charge disintegration method of the current chamber and adds
781// the simulated cluster to the root treee
fe4da5cc 782//
a897a37a 783 Int_t clhits[7];
784 Float_t newclust[6][500];
785 Int_t nnew;
786
787
fe4da5cc 788//
a897a37a 789// Integrated pulse height on chamber
790
791
792 clhits[0]=fNhits+1;
fe4da5cc 793//
a897a37a 794//
7ab910ae 795// if (idvol == 6) printf("\n ->Disintegration %f %f %f", xhit, yhit, eloss );
796
797
2682e810 798 //PH ((AliMUONChamber*) (*fChambers)[idvol])
799 ((AliMUONChamber*) fChambers->At(idvol))
802a864d 800 ->DisIntegration(eloss, tof, xhit, yhit, zhit, nnew, newclust);
a897a37a 801 Int_t ic=0;
7ab910ae 802// if (idvol == 6) printf("\n nnew %d \n", nnew);
a897a37a 803//
804// Add new clusters
805 for (Int_t i=0; i<nnew; i++) {
806 if (Int_t(newclust[3][i]) > 0) {
807 ic++;
808// Cathode plane
809 clhits[1] = Int_t(newclust[5][i]);
810// Cluster Charge
811 clhits[2] = Int_t(newclust[0][i]);
812// Pad: ix
813 clhits[3] = Int_t(newclust[1][i]);
814// Pad: iy
815 clhits[4] = Int_t(newclust[2][i]);
816// Pad: charge
817 clhits[5] = Int_t(newclust[3][i]);
818// Pad: chamber sector
819 clhits[6] = Int_t(newclust[4][i]);
820
a9e2aefa 821 AddPadHit(clhits);
a897a37a 822 }
823 }
a897a37a 824}
825
a9e2aefa 826//___________________________________________
827void AliMUON::Trigger(Int_t nev){
828// call the Trigger Algorithm and fill TreeR
829
830 Int_t singlePlus[3] = {0,0,0};
831 Int_t singleMinus[3] = {0,0,0};
832 Int_t singleUndef[3] = {0,0,0};
833 Int_t pairUnlike[3] = {0,0,0};
834 Int_t pairLike[3] = {0,0,0};
835
836 ResetTrigger();
a9e2aefa 837 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
838 decision->Trigger();
839 decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef,
840 pairUnlike, pairLike);
88cb7938 841
a9e2aefa 842// add a local trigger in the list
843 AddGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
9ae15266 844 Int_t i;
a9e2aefa 845
f665c1ea 846 for (Int_t icirc=0; icirc<AliMUONConstants::NTriggerCircuit(); icirc++) {
9ae15266 847 if(decision->GetITrigger(icirc)==1) {
848 Int_t localtr[7]={0,0,0,0,0,0,0};
849 Int_t loLpt[2]={0,0}; Int_t loHpt[2]={0,0}; Int_t loApt[2]={0,0};
850 decision->GetLutOutput(icirc, loLpt, loHpt, loApt);
851 localtr[0] = icirc;
852 localtr[1] = decision->GetStripX11(icirc);
853 localtr[2] = decision->GetDev(icirc);
854 localtr[3] = decision->GetStripY11(icirc);
855 for (i=0; i<2; i++) { // convert the Lut output in 1 digit
856 localtr[4] = localtr[4]+Int_t(loLpt[i]*TMath::Power(2,i));
857 localtr[5] = localtr[5]+Int_t(loHpt[i]*TMath::Power(2,i));
858 localtr[6] = localtr[6]+Int_t(loApt[i]*TMath::Power(2,i));
859 }
860 AddLocalTrigger(localtr); // add a local trigger in the list
a897a37a 861 }
a9e2aefa 862 }
88cb7938 863
a9e2aefa 864 delete decision;
a897a37a 865
88cb7938 866 fLoader->TreeR()->Fill();
867// char hname[30];
868// sprintf(hname,"TreeR%d",nev);
869// fLoader->TreeR()->Write(hname,TObject::kOverwrite);
870// fLoader->TreeR()->Reset();
871 fLoader->WriteRecPoints("OVERWRITE");
a9e2aefa 872 ResetTrigger();
88cb7938 873
a9e2aefa 874 printf("\n End of trigger for event %d", nev);
a897a37a 875}
a897a37a 876
a897a37a 877
a9e2aefa 878//____________________________________________
fe311ef1 879void AliMUON::Digits2Reco()
880{
881 FindClusters();
e365e1ee 882 Int_t nev = gAlice->GetHeader()->GetEvent();
88cb7938 883 fLoader->TreeR()->Fill();
884 // char hname[30];
885 // sprintf(hname,"TreeR%d", nev);
886 //fLoader->TreeR()->Write(hname);
887 //fLoader->TreeR()->Reset();
888 fLoader->WriteRecPoints("OVERWRITE");
e365e1ee 889 ResetRawClusters();
890 printf("\n End of cluster finding for event %d", nev);
fe311ef1 891}
892
893void AliMUON::FindClusters()
a9e2aefa 894{
de05461e 895//
896// Perform cluster finding
897//
a9e2aefa 898 TClonesArray *dig1, *dig2;
899 Int_t ndig, k;
900 dig1 = new TClonesArray("AliMUONDigit",1000);
901 dig2 = new TClonesArray("AliMUONDigit",1000);
902 AliMUONDigit *digit;
a9e2aefa 903// Loop on chambers and on cathode planes
a897a37a 904//
fe311ef1 905 ResetRawClusters();
88cb7938 906 TClonesArray * muonDigits;
907
1bd28025 908 for (Int_t ich = 0; ich < 10; ich++) {
2682e810 909 //PH AliMUONChamber* iChamber = (AliMUONChamber*) (*fChambers)[ich];
910 AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich);
fe311ef1 911 AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel();
912
88cb7938 913 ResetDigits();
914 fLoader->TreeD()->GetEvent(0);
915 //TClonesArray *
916 muonDigits = (TClonesArray *) Dchambers()->At(ich);
a9e2aefa 917 ndig=muonDigits->GetEntriesFast();
88cb7938 918 printf("\n 1 Found %d digits in %p chamber %d", ndig, muonDigits,ich);
a9e2aefa 919 TClonesArray &lhits1 = *dig1;
1bd28025 920 Int_t n = 0;
921 for (k = 0; k < ndig; k++) {
922 digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
923 if (rec->TestTrack(digit->Track(0)))
a9e2aefa 924 new(lhits1[n++]) AliMUONDigit(*digit);
925 }
88cb7938 926 ResetDigits();
927 fLoader->TreeD()->GetEvent(1);
928 //muonDigits = this->DigitsAddress(ich);
929 muonDigits = (TClonesArray *) Dchambers()->At(ich);
a9e2aefa 930 ndig=muonDigits->GetEntriesFast();
931 printf("\n 2 Found %d digits in %p %d", ndig, muonDigits, ich);
932 TClonesArray &lhits2 = *dig2;
933 n=0;
934
935 for (k=0; k<ndig; k++) {
936 digit= (AliMUONDigit*) muonDigits->UncheckedAt(k);
1bd28025 937 if (rec->TestTrack(digit->Track(0)))
a9e2aefa 938 new(lhits2[n++]) AliMUONDigit(*digit);
a897a37a 939 }
a897a37a 940
9825400f 941 if (rec) {
942 AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2);
a9e2aefa 943 rec->FindRawClusters();
944 }
945 dig1->Delete();
946 dig2->Delete();
947 } // for ich
a9e2aefa 948 delete dig1;
949 delete dig2;
a897a37a 950}
a9e2aefa 951
2ab0c725 952#ifdef never
fe4da5cc 953void AliMUON::Streamer(TBuffer &R__b)
954{
955 // Stream an object of class AliMUON.
a30a000f 956 AliMUONChamber *iChamber;
a9e2aefa 957 AliMUONTriggerCircuit *iTriggerCircuit;
a30a000f 958 AliSegmentation *segmentation;
959 AliMUONResponse *response;
960 TClonesArray *digitsaddress;
961 TClonesArray *rawcladdress;
9ae15266 962 Int_t i;
9ae15266 963 if (R__b.IsReading()) {
964 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
965 AliDetector::Streamer(R__b);
966 R__b >> fNPadHits;
967 R__b >> fPadHits; // diff
968 R__b >> fNLocalTrigger;
969 R__b >> fLocalTrigger;
970 R__b >> fNGlobalTrigger;
971 R__b >> fGlobalTrigger;
972 R__b >> fDchambers;
973 R__b >> fRawClusters;
974 R__b.ReadArray(fNdch);
975 R__b.ReadArray(fNrawch);
976 R__b >> fAccCut;
977 R__b >> fAccMin;
978 R__b >> fAccMax;
979 R__b >> fChambers;
980 R__b >> fTriggerCircuits;
f665c1ea 981 for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
9ae15266 982 iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
983 iTriggerCircuit->Streamer(R__b);
fe4da5cc 984 }
9ae15266 985// Stream chamber related information
f665c1ea 986 for (i =0; i<AliMUONConstants::NCh(); i++) {
9ae15266 987 iChamber=(AliMUONChamber*) (*fChambers)[i];
988 iChamber->Streamer(R__b);
989 if (iChamber->Nsec()==1) {
990 segmentation=iChamber->SegmentationModel(1);
991 if (segmentation)
992 segmentation->Streamer(R__b);
993 } else {
994 segmentation=iChamber->SegmentationModel(1);
995 if (segmentation)
996 segmentation->Streamer(R__b);
997 if (segmentation)
998 segmentation=iChamber->SegmentationModel(2);
999 segmentation->Streamer(R__b);
1000 }
1001 response=iChamber->ResponseModel();
1002 if (response)
1003 response->Streamer(R__b);
1004 digitsaddress=(TClonesArray*) (*fDchambers)[i];
1005 digitsaddress->Streamer(R__b);
f665c1ea 1006 if (i < AliMUONConstants::NTrackingCh()) {
9ae15266 1007 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
1008 rawcladdress->Streamer(R__b);
1009 }
a9e2aefa 1010 }
9ae15266 1011
1012 } else {
1013 R__b.WriteVersion(AliMUON::IsA());
1014 AliDetector::Streamer(R__b);
1015 R__b << fNPadHits;
1016 R__b << fPadHits; // diff
1017 R__b << fNLocalTrigger;
1018 R__b << fLocalTrigger;
1019 R__b << fNGlobalTrigger;
1020 R__b << fGlobalTrigger;
1021 R__b << fDchambers;
1022 R__b << fRawClusters;
f665c1ea 1023 R__b.WriteArray(fNdch, AliMUONConstants::NCh());
1024 R__b.WriteArray(fNrawch, AliMUONConstants::NTrackingCh());
9ae15266 1025
1026 R__b << fAccCut;
1027 R__b << fAccMin;
1028 R__b << fAccMax;
1029
1030 R__b << fChambers;
1031 R__b << fTriggerCircuits;
f665c1ea 1032 for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
9ae15266 1033 iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
1034 iTriggerCircuit->Streamer(R__b);
fe4da5cc 1035 }
f665c1ea 1036 for (i =0; i<AliMUONConstants::NCh(); i++) {
9ae15266 1037 iChamber=(AliMUONChamber*) (*fChambers)[i];
1038 iChamber->Streamer(R__b);
1039 if (iChamber->Nsec()==1) {
1040 segmentation=iChamber->SegmentationModel(1);
1041 if (segmentation)
1042 segmentation->Streamer(R__b);
1043 } else {
1044 segmentation=iChamber->SegmentationModel(1);
1045 if (segmentation)
1046 segmentation->Streamer(R__b);
1047 segmentation=iChamber->SegmentationModel(2);
1048 if (segmentation)
1049 segmentation->Streamer(R__b);
1050 }
1051 response=iChamber->ResponseModel();
1052 if (response)
1053 response->Streamer(R__b);
1054 digitsaddress=(TClonesArray*) (*fDchambers)[i];
1055 digitsaddress->Streamer(R__b);
f665c1ea 1056 if (i < AliMUONConstants::NTrackingCh()) {
9ae15266 1057 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
1058 rawcladdress->Streamer(R__b);
1059 }
a9e2aefa 1060 }
fe4da5cc 1061 }
fe4da5cc 1062}
2ab0c725 1063#endif
1064
a9e2aefa 1065AliMUONPadHit* AliMUON::FirstPad(AliMUONHit* hit, TClonesArray *clusters)
fe4da5cc 1066{
5a35ac13 1067// to be removed
fe4da5cc 1068 // Initialise the pad iterator
1069 // Return the address of the first padhit for hit
a897a37a 1070 TClonesArray *theClusters = clusters;
fe4da5cc 1071 Int_t nclust = theClusters->GetEntriesFast();
1bd28025 1072 if (nclust && hit->PHlast() > 0) {
1073 AliMUON::fMaxIterPad=hit->PHlast();
1074 AliMUON::fCurIterPad=hit->PHfirst();
a9e2aefa 1075 return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
fe4da5cc 1076 } else {
1077 return 0;
1078 }
1079}
1080
a9e2aefa 1081AliMUONPadHit* AliMUON::NextPad(TClonesArray *clusters)
fe4da5cc 1082{
5a35ac13 1083 // To be removed
de05461e 1084// Get next pad (in iterator)
1085//
a9e2aefa 1086 AliMUON::fCurIterPad++;
1087 if (AliMUON::fCurIterPad <= AliMUON::fMaxIterPad) {
1088 return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
fe4da5cc 1089 } else {
1090 return 0;
1091 }
1092}
1093
a897a37a 1094
1095AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster)
1096{
de05461e 1097//
1098// Return rawcluster (icluster) for chamber ichamber and cathode icathod
1099// Obsolete ??
a9e2aefa 1100 TClonesArray *muonRawCluster = RawClustAddress(ichamber);
a897a37a 1101 ResetRawClusters();
88cb7938 1102 TTree *treeR = fLoader->TreeR();
a9e2aefa 1103 Int_t nent=(Int_t)treeR->GetEntries();
1104 treeR->GetEvent(nent-2+icathod-1);
1105 //treeR->GetEvent(icathod);
1106 //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast();
a897a37a 1107
a9e2aefa 1108 AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster);
a897a37a 1109 //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw);
1110
1111 return mRaw;
1112}
1cae9436 1113
1114void AliMUON::SetMerger(AliMUONMerger* merger)
1115{
1116// Set pointer to merger
1117 fMerger = merger;
1118}
1119
1120AliMUONMerger* AliMUON::Merger()
1121{
1122// Return pointer to merger
1123 return fMerger;
1124}
1125
1126
a897a37a 1127
50e97f19 1128AliMUON& AliMUON::operator = (const AliMUON& /*rhs*/)
a897a37a 1129{
a9e2aefa 1130// copy operator
1131// dummy version
1132 return *this;
a897a37a 1133}
1134
cd4df77b 1135////////////////////////////////////////////////////////////////////////
1136void AliMUON::MakeBranchInTreeD(TTree *treeD, const char *file)
1137{
1138 //
1139 // Create TreeD branches for the MUON.
1140 //
a897a37a 1141
cd4df77b 1142 const Int_t kBufferSize = 4000;
1143 char branchname[30];
1144
1e7c351a 1145 if (fDchambers == 0x0) {
1146 fDchambers = new TObjArray(AliMUONConstants::NCh());
1147 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
1148 fDchambers->AddAt(new TClonesArray("AliMUONDigit",10000),i);
1149 }
1150 }
cd4df77b 1151 //
1152 // one branch for digits per chamber
1153 //
1154 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
1155 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1156 if (fDchambers && treeD) {
1157 MakeBranchInTree(treeD,
1158 branchname, &((*fDchambers)[i]), kBufferSize, file);
62468ef9 1159// printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
cd4df77b 1160 }
1161 }
1162}
a897a37a 1163
cd4df77b 1164//___________________________________________
fe4da5cc 1165