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 cluster reconstructor for MUON
22 // Should implement a virtual class ClusterFinder to chose between VS and AZ method
23 ////////////////////////////////////
25 #include "AliMUONClusterReconstructor.h"
26 #include "AliRun.h" // for gAlice
27 #include "AliRunLoader.h"
28 #include "AliLoader.h"
31 #include "AliMUONDigit.h"
32 #include "AliMUONConstants.h"
33 #include "AliMUONData.h"
34 #include "AliMUONClusterFinderVS.h"
35 #include "AliMUONClusterInput.h"
36 #include "AliMUONRawCluster.h"
37 #include "AliRawReader.h" // for raw data
41 const Int_t AliMUONClusterReconstructor::fgkDefaultPrintLevel = 0;
43 ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
45 //__________________________________________________________________________
46 AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliLoader* loader)
49 // Standard Constructor
56 fChambers = new TObjArray(AliMUONConstants::NCh());
58 fPrintLevel = fgkDefaultPrintLevel;
60 // initialize loader's
63 // initialize container
64 fMUONData = new AliMUONData(fLoader,"MUON","MUON");
66 // Loading AliRun master
67 AliRunLoader* runloader = fLoader->GetRunLoader();
68 if (runloader->GetAliRun() == 0x0) runloader->LoadgAlice();
69 gAlice = runloader->GetAliRun();
72 fMUON = (AliMUON*) gAlice->GetDetector("MUON");
75 //__________________________________________________________________________
76 AliMUONClusterReconstructor::AliMUONClusterReconstructor()
83 fPrintLevel(fgkDefaultPrintLevel),
87 // Default Constructor
90 //____________________________________________________________________
91 void AliMUONClusterReconstructor::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst)
93 // take infos chambers from AliMUON
94 AliMUONChamber* pCh = 0;
95 pCh = &(fMUON->Chamber(id));
97 fChambers->AddAt(pCh, id);
99 // Set ClusterFinder for chamber id
100 ((AliMUONChamber*) fChambers->At(id))->SetReconstructionModel(reconst);
102 //_______________________________________________________________________
103 AliMUONClusterReconstructor::AliMUONClusterReconstructor (const AliMUONClusterReconstructor& rhs)
106 // Protected copy constructor
108 AliFatal("Not implemented.");
111 //_______________________________________________________________________
112 AliMUONClusterReconstructor &
113 AliMUONClusterReconstructor::operator=(const AliMUONClusterReconstructor& rhs)
115 // Protected assignement operator
117 if (this == &rhs) return *this;
119 AliFatal("Not implemented.");
124 //__________________________________________________________________________
125 AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
128 fChambers->Clear(); // Sets pointers to 0 sinche it is not the owner
136 //____________________________________________________________________
137 void AliMUONClusterReconstructor::Digits2Clusters()
140 // Perform cluster finding
142 TClonesArray *dig1, *dig2;
144 dig1 = new TClonesArray("AliMUONDigit",1000);
145 dig2 = new TClonesArray("AliMUONDigit",1000);
147 // Loop on chambers and on cathode planes
149 // fMUONData->ResetRawClusters();
150 TClonesArray * muonDigits;
152 for (Int_t ich = 0; ich < 10; ich++) {
153 AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich);
154 AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel();
155 //AliMUONClusterFinderAZ* rec = (AliMUONClusterFinderAZ*)iChamber->ReconstructionModel();
157 fMUONData->ResetDigits();
158 fMUONData->GetCathode(0);
160 muonDigits = fMUONData->Digits(ich);
161 ndig=muonDigits->GetEntriesFast();
162 AliDebug(1,Form("1 Found %d digits in %p chamber %d", ndig, (void*)muonDigits,ich));
163 TClonesArray &lhits1 = *dig1;
165 for (k = 0; k < ndig; k++) {
166 digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
167 if (rec->TestTrack(digit->Track(0)))
168 new(lhits1[n++]) AliMUONDigit(*digit);
170 fMUONData->ResetDigits();
171 fMUONData->GetCathode(1);
172 muonDigits = fMUONData->Digits(ich);
173 ndig=muonDigits->GetEntriesFast();
174 AliDebug(1,Form("2 Found %d digits in %p %d", ndig, (void*)muonDigits, ich));
175 TClonesArray &lhits2 = *dig2;
178 for (k=0; k<ndig; k++) {
179 digit= (AliMUONDigit*) muonDigits->UncheckedAt(k);
180 if (rec->TestTrack(digit->Track(0)))
181 new(lhits2[n++]) AliMUONDigit(*digit);
185 AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2);
186 rec->FindRawClusters();
188 // copy into the container
189 TClonesArray* tmp = rec->GetRawClusters();
190 for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) {
191 AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id);
192 fMUONData->AddRawCluster(ich, *pClus);
201 //____________________________________________________________________
202 void AliMUONClusterReconstructor::Digits2Clusters(AliRawReader* /*rawReader*/)
205 // Perform cluster finding form raw data
207 AliFatal("clusterization not implemented for raw data input");