]>
Commit | Line | Data |
---|---|---|
52c9bc11 | 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 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
d19b6003 | 18 | // ----------------------------------- |
19 | // Class AliMUONClusterReconstructor | |
20 | // ---------------------------------- | |
cf464691 | 21 | // MUON cluster reconstructor for MUON |
d19b6003 | 22 | // Should implement a virtual class ClusterFinder to choose between VS and AZ method |
52c9bc11 | 23 | |
52c9bc11 | 24 | #include "AliMUONClusterReconstructor.h" |
cf464691 | 25 | #include "AliRun.h" // for gAlice |
26 | #include "AliRunLoader.h" | |
27 | #include "AliLoader.h" | |
28 | ||
a713db22 | 29 | #include "AliMUON.h" |
52c9bc11 | 30 | #include "AliMUONDigit.h" |
31 | #include "AliMUONConstants.h" | |
32 | #include "AliMUONData.h" | |
33 | #include "AliMUONClusterFinderVS.h" | |
52c9bc11 | 34 | #include "AliMUONClusterInput.h" |
35 | #include "AliMUONRawCluster.h" | |
8c343c7c | 36 | #include "AliLog.h" |
cf464691 | 37 | |
52c9bc11 | 38 | ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context |
dd20215d | 39 | |
52c9bc11 | 40 | //__________________________________________________________________________ |
dd20215d | 41 | AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONData* data) |
42 | : TObject(), | |
43 | fMUONData(data), | |
44 | fRecModel(new AliMUONClusterFinderVS()), | |
45 | fDigitsCath0(new TClonesArray("AliMUONDigit",1000)), | |
46 | fDigitsCath1(new TClonesArray("AliMUONDigit",1000)) | |
52c9bc11 | 47 | { |
d19b6003 | 48 | /// Standard Constructor |
52c9bc11 | 49 | |
dd20215d | 50 | fDigitsCath0->SetOwner(kTRUE); |
51 | fDigitsCath1->SetOwner(kTRUE); | |
52c9bc11 | 52 | } |
30178c30 | 53 | |
52c9bc11 | 54 | //__________________________________________________________________________ |
55 | AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void) | |
56 | { | |
d19b6003 | 57 | /// Destructor |
58 | ||
dd20215d | 59 | delete fRecModel; |
60 | delete fDigitsCath0; | |
61 | delete fDigitsCath1; | |
62 | } | |
7e4a628d | 63 | |
dd20215d | 64 | //______________________________________________________________________________ |
65 | void | |
66 | AliMUONClusterReconstructor::ClusterizeOneDE(Int_t detElemId) | |
67 | { | |
d19b6003 | 68 | /// Clusterize one detection element, and let fMUONData know about |
69 | /// the results. | |
dd20215d | 70 | |
71 | if ( fDigitsCath0->GetEntriesFast() || fDigitsCath1->GetEntriesFast() ) | |
72 | { | |
73 | Int_t iChamber = detElemId/100 - 1; | |
74 | AliMUONClusterInput::Instance()->SetDigits(iChamber, detElemId, | |
75 | fDigitsCath0,fDigitsCath1); | |
76 | AliDebug(3,Form("ClusterizeOneDE iChamber=%d DE=%d",iChamber,detElemId)); | |
77 | StdoutToAliDebug(3,cout << "DigitsCath0=" << endl; | |
78 | fDigitsCath0->Print(); | |
79 | cout << "DigitsCath1=" << endl; | |
80 | fDigitsCath1->Print();); | |
81 | fRecModel->FindRawClusters(); | |
82 | ||
83 | // copy results into the output container | |
84 | TClonesArray* tmp = fRecModel->GetRawClusters(); | |
85 | for (Int_t id = 0; id < tmp->GetEntriesFast(); ++id) | |
86 | { | |
87 | AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id); | |
88 | fMUONData->AddRawCluster(iChamber, *pClus); | |
89 | } | |
90 | ||
91 | // Reset the arrays | |
92 | fDigitsCath0->Clear("C"); | |
93 | fDigitsCath1->Clear("C"); | |
94 | } | |
52c9bc11 | 95 | } |
dd20215d | 96 | |
52c9bc11 | 97 | //____________________________________________________________________ |
cc87ebcd | 98 | void AliMUONClusterReconstructor::Digits2Clusters(Int_t chBeg) |
a713db22 | 99 | { |
d19b6003 | 100 | /// Clusterize all the tracking chamber digits. |
101 | /// | |
102 | /// For each chamber, we loop *once* on that chamber digits, and store them | |
103 | /// in 2 temporary arrays (one pair of arrays per detection element, | |
104 | /// one array per cathode). Once a pair of arrays is full (i.e. all the digits | |
105 | /// of that detection element have been stored), we clusterize this DE, and | |
106 | /// move to the next one. | |
a713db22 | 107 | |
dd20215d | 108 | if (!fRecModel) |
109 | { | |
110 | AliWarning("No reco model defined. Nothing to do..."); | |
111 | return; | |
112 | } | |
113 | ||
114 | Int_t iChamber(-1); | |
115 | Int_t currentDE(-1); | |
116 | ||
117 | // Loop on chambers | |
118 | for ( iChamber = chBeg; iChamber < AliMUONConstants::NTrackingCh(); ++iChamber ) | |
119 | { | |
120 | TClonesArray* muonDigits = fMUONData->Digits(iChamber); | |
121 | ||
122 | Int_t ndig = muonDigits->GetEntriesFast(); | |
123 | if (!ndig) continue; | |
124 | ||
125 | muonDigits->Sort(); // the sort *must* be per DE (at least), otherwise | |
126 | // the following logic with currentDE will fail. | |
127 | ||
128 | currentDE = -1; // initialize the DE counter (that is used to track | |
129 | // when we change of DE in the following loop over | |
130 | // all digits) to an invalid value. | |
131 | ||
132 | for ( Int_t k = 0; k < ndig; ++k ) | |
133 | { | |
134 | AliMUONDigit* digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); | |
135 | if ( ! digit->Signal() > 0 ) continue; // skip void digits. | |
136 | ||
137 | if ( digit->DetElemId() != currentDE ) | |
138 | { | |
139 | AliDebug(3,Form("Switching DE from %d to %d",currentDE,digit->DetElemId())); | |
140 | // we get to a new DE, so clusterize the previous one before | |
141 | // moving on. | |
142 | ClusterizeOneDE(currentDE); | |
143 | currentDE = digit->DetElemId(); | |
a713db22 | 144 | } |
dd20215d | 145 | |
146 | // Add the digit to the array with the right cathode number. | |
147 | if (digit->Cathode() == 0) | |
148 | { | |
dd20215d | 149 | new((*fDigitsCath0)[fDigitsCath0->GetLast()+1]) AliMUONDigit(*digit); |
150 | } | |
151 | else | |
152 | { | |
dd20215d | 153 | new((*fDigitsCath1)[fDigitsCath1->GetLast()+1]) AliMUONDigit(*digit); |
154 | } | |
155 | } // end of loop on chamber digits | |
156 | ||
157 | // As the above logic is based on detecting a change in DE number, | |
158 | // the last DE of each chamber has not been clusterized, so we do | |
159 | // it here. | |
160 | ClusterizeOneDE(currentDE); | |
161 | } // end of loop over chambers | |
52c9bc11 | 162 | } |
cf464691 | 163 | |
dd20215d | 164 | //_______________________________________________________________________ |
165 | void | |
166 | AliMUONClusterReconstructor::SetRecoModel(AliMUONClusterFinderVS* rec) | |
167 | { | |
d19b6003 | 168 | /// Set reconstruction model |
169 | ||
dd20215d | 170 | delete fRecModel; |
171 | fRecModel = rec; | |
172 | } | |
173 | ||
7e4a628d | 174 | //_______________________________________________________________________ |
175 | void AliMUONClusterReconstructor::Trigger2Trigger() | |
176 | { | |
d19b6003 | 177 | /// Copy trigger from TreeD to TreeR |
cc87ebcd | 178 | |
179 | fMUONData->SetTreeAddress("GLT"); | |
7e4a628d | 180 | fMUONData->GetTriggerD(); |
181 | } |