1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ////////////////////////////////////
20 // MUON event reconstructor in ALICE
22 // This class contains as data:
23 // * the parameters for the event reconstruction
24 // * a pointer to the array of hits to be reconstructed (the event)
25 // * a pointer to the array of segments made with these hits inside each station
26 // * a pointer to the array of reconstructed tracks
28 // It contains as methods, among others:
29 // * MakeEventToBeReconstructed to build the array of hits to be reconstructed
30 // * MakeSegments to build the segments
31 // * MakeTracks to build the tracks
33 ////////////////////////////////////
35 #include "AliMUONClusterReconstructor.h"
37 #include "AliMUONDigit.h"
38 #include "AliMUONConstants.h"
39 #include "AliMUONData.h"
40 #include "AliMUONClusterFinderVS.h"
41 #include "AliMUONClusterInput.h"
42 #include "AliMUONRawCluster.h"
43 #include "AliRun.h" // for gAlice
44 #include "AliRunLoader.h"
45 #include "AliLoader.h"
47 const Int_t AliMUONClusterReconstructor::fgkDefaultPrintLevel = 0;
49 ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
51 //__________________________________________________________________________
52 AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliLoader* loader)
55 // Standard Constructor
62 fChambers = new TObjArray(AliMUONConstants::NCh());
64 fPrintLevel = fgkDefaultPrintLevel;
66 // initialize loader's
69 // initialize container
70 fMUONData = new AliMUONData(fLoader,"MUON","MUON");
72 // Loading AliRun master
73 AliRunLoader* runloader = fLoader->GetRunLoader();
74 if (runloader->GetAliRun() == 0x0) runloader->LoadgAlice();
75 gAlice = runloader->GetAliRun();
78 fMUON = (AliMUON*) gAlice->GetDetector("MUON");
81 //__________________________________________________________________________
82 AliMUONClusterReconstructor::AliMUONClusterReconstructor()
89 fPrintLevel(fgkDefaultPrintLevel),
93 // Default Constructor
96 //____________________________________________________________________
97 void AliMUONClusterReconstructor::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst)
99 // take infos chambers from AliMUON
100 AliMUONChamber* pCh = 0;
101 pCh = &(fMUON->Chamber(id));
103 fChambers->AddAt(pCh, id);
105 // Set ClusterFinder for chamber id
106 ((AliMUONChamber*) fChambers->At(id))->SetReconstructionModel(reconst);
108 //_______________________________________________________________________
109 AliMUONClusterReconstructor::AliMUONClusterReconstructor (const AliMUONClusterReconstructor& rhs)
112 // Protected copy constructor
114 Fatal("AliMUONClusterReconstructor", "Not implemented.");
117 //_______________________________________________________________________
118 AliMUONClusterReconstructor &
119 AliMUONClusterReconstructor::operator=(const AliMUONClusterReconstructor& rhs)
121 // Protected assignement operator
123 if (this == &rhs) return *this;
125 Fatal("operator=", "Not implemented.");
130 //__________________________________________________________________________
131 AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
134 fChambers->Clear(); // Sets pointers to 0 sinche it is not the owner
142 //____________________________________________________________________
143 void AliMUONClusterReconstructor::Digits2Clusters()
146 // Perform cluster finding
148 TClonesArray *dig1, *dig2;
150 dig1 = new TClonesArray("AliMUONDigit",1000);
151 dig2 = new TClonesArray("AliMUONDigit",1000);
153 // Loop on chambers and on cathode planes
155 // fMUONData->ResetRawClusters();
156 TClonesArray * muonDigits;
158 for (Int_t ich = 0; ich < 10; ich++) {
159 AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich);
160 AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel();
161 //AliMUONClusterFinderAZ* rec = (AliMUONClusterFinderAZ*)iChamber->ReconstructionModel();
163 fMUONData->ResetDigits();
164 fMUONData->GetCathode(0);
166 muonDigits = fMUONData->Digits(ich);
167 ndig=muonDigits->GetEntriesFast();
169 printf("1 Found %d digits in %p chamber %d\n", ndig, (void*)muonDigits,ich);
170 TClonesArray &lhits1 = *dig1;
172 for (k = 0; k < ndig; k++) {
173 digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
174 if (rec->TestTrack(digit->Track(0)))
175 new(lhits1[n++]) AliMUONDigit(*digit);
177 fMUONData->ResetDigits();
178 fMUONData->GetCathode(1);
179 muonDigits = fMUONData->Digits(ich);
180 ndig=muonDigits->GetEntriesFast();
182 printf("\n 2 Found %d digits in %p %d", ndig, (void*)muonDigits, ich);
183 TClonesArray &lhits2 = *dig2;
186 for (k=0; k<ndig; k++) {
187 digit= (AliMUONDigit*) muonDigits->UncheckedAt(k);
188 if (rec->TestTrack(digit->Track(0)))
189 new(lhits2[n++]) AliMUONDigit(*digit);
193 AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2);
194 rec->FindRawClusters();
196 // copy into the container
197 TClonesArray* tmp = rec->GetRawClusters();
198 for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) {
199 AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id);
200 fMUONData->AddRawCluster(ich, *pClus);