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 // -----------------------------------
19 // Class AliMUONClusterReconstructor
20 // ----------------------------------
21 // MUON cluster reconstructor for MUON
22 // Should implement a virtual class ClusterFinder to choose between VS and AZ method
24 #include "AliMUONClusterReconstructor.h"
25 #include "AliRun.h" // for gAlice
26 #include "AliRunLoader.h"
27 #include "AliLoader.h"
30 #include "AliMUONDigit.h"
31 #include "AliMUONConstants.h"
32 #include "AliMUONData.h"
33 #include "AliMUONClusterFinderVS.h"
34 #include "AliMUONClusterInput.h"
35 #include "AliMUONRawCluster.h"
38 ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
40 //__________________________________________________________________________
41 AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONData* data)
44 fRecModel(new AliMUONClusterFinderVS()),
45 fDigitsCath0(new TClonesArray("AliMUONDigit",1000)),
46 fDigitsCath1(new TClonesArray("AliMUONDigit",1000))
48 /// Standard Constructor
50 fDigitsCath0->SetOwner(kTRUE);
51 fDigitsCath1->SetOwner(kTRUE);
54 //_______________________________________________________________________
55 AliMUONClusterReconstructor::AliMUONClusterReconstructor (const AliMUONClusterReconstructor& rhs)
58 /// Protected copy constructor
60 AliFatal("Not implemented.");
63 //_______________________________________________________________________
64 AliMUONClusterReconstructor &
65 AliMUONClusterReconstructor::operator=(const AliMUONClusterReconstructor& rhs)
67 /// Protected assignement operator
69 if (this == &rhs) return *this;
71 AliFatal("Not implemented.");
76 //__________________________________________________________________________
77 AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
86 //______________________________________________________________________________
88 AliMUONClusterReconstructor::ClusterizeOneDE(Int_t detElemId)
90 /// Clusterize one detection element, and let fMUONData know about
93 if ( fDigitsCath0->GetEntriesFast() || fDigitsCath1->GetEntriesFast() )
95 Int_t iChamber = detElemId/100 - 1;
96 AliMUONClusterInput::Instance()->SetDigits(iChamber, detElemId,
97 fDigitsCath0,fDigitsCath1);
98 AliDebug(3,Form("ClusterizeOneDE iChamber=%d DE=%d",iChamber,detElemId));
99 StdoutToAliDebug(3,cout << "DigitsCath0=" << endl;
100 fDigitsCath0->Print();
101 cout << "DigitsCath1=" << endl;
102 fDigitsCath1->Print(););
103 fRecModel->FindRawClusters();
105 // copy results into the output container
106 TClonesArray* tmp = fRecModel->GetRawClusters();
107 for (Int_t id = 0; id < tmp->GetEntriesFast(); ++id)
109 AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id);
110 fMUONData->AddRawCluster(iChamber, *pClus);
114 fDigitsCath0->Clear("C");
115 fDigitsCath1->Clear("C");
119 //____________________________________________________________________
120 void AliMUONClusterReconstructor::Digits2Clusters(Int_t chBeg)
122 /// Clusterize all the tracking chamber digits.
124 /// For each chamber, we loop *once* on that chamber digits, and store them
125 /// in 2 temporary arrays (one pair of arrays per detection element,
126 /// one array per cathode). Once a pair of arrays is full (i.e. all the digits
127 /// of that detection element have been stored), we clusterize this DE, and
128 /// move to the next one.
132 AliWarning("No reco model defined. Nothing to do...");
140 for ( iChamber = chBeg; iChamber < AliMUONConstants::NTrackingCh(); ++iChamber )
142 TClonesArray* muonDigits = fMUONData->Digits(iChamber);
144 Int_t ndig = muonDigits->GetEntriesFast();
147 muonDigits->Sort(); // the sort *must* be per DE (at least), otherwise
148 // the following logic with currentDE will fail.
150 currentDE = -1; // initialize the DE counter (that is used to track
151 // when we change of DE in the following loop over
152 // all digits) to an invalid value.
154 for ( Int_t k = 0; k < ndig; ++k )
156 AliMUONDigit* digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
157 if ( ! digit->Signal() > 0 ) continue; // skip void digits.
159 if ( digit->DetElemId() != currentDE )
161 AliDebug(3,Form("Switching DE from %d to %d",currentDE,digit->DetElemId()));
162 // we get to a new DE, so clusterize the previous one before
164 ClusterizeOneDE(currentDE);
165 currentDE = digit->DetElemId();
168 // Add the digit to the array with the right cathode number.
169 if (digit->Cathode() == 0)
171 new((*fDigitsCath0)[fDigitsCath0->GetLast()+1]) AliMUONDigit(*digit);
175 new((*fDigitsCath1)[fDigitsCath1->GetLast()+1]) AliMUONDigit(*digit);
177 } // end of loop on chamber digits
179 // As the above logic is based on detecting a change in DE number,
180 // the last DE of each chamber has not been clusterized, so we do
182 ClusterizeOneDE(currentDE);
183 } // end of loop over chambers
186 //_______________________________________________________________________
188 AliMUONClusterReconstructor::SetRecoModel(AliMUONClusterFinderVS* rec)
190 /// Set reconstruction model
196 //_______________________________________________________________________
197 void AliMUONClusterReconstructor::Trigger2Trigger()
199 /// Copy trigger from TreeD to TreeR
201 fMUONData->SetTreeAddress("GLT");
202 fMUONData->GetTriggerD();