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