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 <Riostream.h> // for cout
36 #include <stdlib.h> // for exit()
41 #include "AliMUONClusterReconstructor.h"
42 #include "AliMUONDigit.h"
43 #include "AliMUONConstants.h"
44 #include "AliMUONData.h"
45 #include "AliMUONClusterFinderVS.h"
46 #include "AliMUONClusterFinderAZ.h"
47 #include "AliMUONClusterInput.h"
48 #include "AliMUONRawCluster.h"
49 #include "AliRun.h" // for gAlice
50 #include "AliConfig.h"
51 #include "AliRunLoader.h"
52 #include "AliLoader.h"
54 const Int_t AliMUONClusterReconstructor::fgkDefaultPrintLevel = 0;
56 ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
58 //__________________________________________________________________________
59 AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliLoader* loader)
61 // Default Constructor
68 fChambers = new TObjArray(AliMUONConstants::NCh());
70 fPrintLevel = fgkDefaultPrintLevel;
72 // initialize loader's
75 // initialize container
76 fMUONData = new AliMUONData(fLoader,"MUON","MUON");
78 // Loading AliRun master
79 AliRunLoader* runloader = fLoader->GetRunLoader();
80 if (runloader->GetAliRun() == 0x0) runloader->LoadgAlice();
81 gAlice = runloader->GetAliRun();
84 fMUON = (AliMUON*) gAlice->GetDetector("MUON");
88 //____________________________________________________________________
89 void AliMUONClusterReconstructor::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst)
91 // take infos chambers from AliMUON
92 AliMUONChamber* pCh = 0;
93 pCh = &(fMUON->Chamber(id));
95 fChambers->AddAt(pCh, id);
97 // Set ClusterFinder for chamber id
98 ((AliMUONChamber*) fChambers->At(id))->SetReconstructionModel(reconst);
100 //_______________________________________________________________________
101 AliMUONClusterReconstructor::AliMUONClusterReconstructor (const AliMUONClusterReconstructor& Reconstructor):TObject(Reconstructor)
103 // Dummy copy constructor
106 AliMUONClusterReconstructor & AliMUONClusterReconstructor::operator=(const AliMUONClusterReconstructor& /*Reconstructor*/)
108 // Dummy assignment operator
112 //__________________________________________________________________________
113 AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
116 fChambers->Clear(); // Sets pointers to 0 sinche it is not the owner
124 //____________________________________________________________________
125 void AliMUONClusterReconstructor::Digits2Clusters()
128 // Perform cluster finding
130 TClonesArray *dig1, *dig2;
132 dig1 = new TClonesArray("AliMUONDigit",1000);
133 dig2 = new TClonesArray("AliMUONDigit",1000);
135 // Loop on chambers and on cathode planes
137 // fMUONData->ResetRawClusters();
138 TClonesArray * muonDigits;
140 for (Int_t ich = 0; ich < 10; ich++) {
141 AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich);
142 AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel();
143 //AliMUONClusterFinderAZ* rec = (AliMUONClusterFinderAZ*)iChamber->ReconstructionModel();
145 fMUONData->ResetDigits();
146 fMUONData->GetCathode(0);
148 muonDigits = fMUONData->Digits(ich);
149 ndig=muonDigits->GetEntriesFast();
151 printf("1 Found %d digits in %p chamber %d\n", ndig, (void*)muonDigits,ich);
152 TClonesArray &lhits1 = *dig1;
154 for (k = 0; k < ndig; k++) {
155 digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
156 if (rec->TestTrack(digit->Track(0)))
157 new(lhits1[n++]) AliMUONDigit(*digit);
159 fMUONData->ResetDigits();
160 fMUONData->GetCathode(1);
161 muonDigits = fMUONData->Digits(ich);
162 ndig=muonDigits->GetEntriesFast();
164 printf("\n 2 Found %d digits in %p %d", ndig, (void*)muonDigits, ich);
165 TClonesArray &lhits2 = *dig2;
168 for (k=0; k<ndig; k++) {
169 digit= (AliMUONDigit*) muonDigits->UncheckedAt(k);
170 if (rec->TestTrack(digit->Track(0)))
171 new(lhits2[n++]) AliMUONDigit(*digit);
175 AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2);
176 rec->FindRawClusters();
178 // copy into the container
179 TClonesArray* tmp = rec->GetRawClusters();
180 for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) {
181 AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id);
182 fMUONData->AddRawCluster(ich, *pClus);