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
21 /// This class is just a steering class to loop over detection elements of tracking chambers,
22 /// extract the relevant digits, and pass them to the actual clusterizer class,
23 /// which operate on a single detection element at a time.
25 /// \author C. Finck and L. Aphecetche, Subatech
27 //-----------------------------------------------------------------------------
29 #include "AliMUONClusterReconstructor.h"
31 #include "AliMUONCluster.h"
32 #include "AliMUONGeometryTransformer.h"
33 #include "AliMUONVCluster.h"
34 #include "AliMUONVClusterFinder.h"
35 #include "AliMUONVClusterStore.h"
36 #include "AliMUONVDigit.h"
37 #include "AliMUONVDigitStore.h"
38 #include "AliMUONPad.h"
40 #include "AliMpDEIterator.h"
41 #include "AliMpDEManager.h"
42 #include "AliMpSegmentation.h"
46 #include <Riostream.h>
50 ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
53 //__________________________________________________________________________
54 AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONVClusterFinder* clusterFinder,
55 const AliMUONGeometryTransformer* transformer)
57 fClusterFinder(clusterFinder),
58 fTransformer(transformer),
62 /// Standard Constructor
63 /// Note that we adopt clusterFinder
65 if (!transformer && clusterFinder)
67 AliFatal("I require a geometry transformer, otherwise I cannot compute "
68 "global coordinates of the clusters !");
71 // fRecModel->SetGhostChi2Cut(10);
74 //__________________________________________________________________________
75 AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
78 delete fClusterFinder;
81 //______________________________________________________________________________
83 AliMUONClusterReconstructor::ClusterizeOneDE(Int_t detElemId,
84 const AliMUONVDigitStore& digitStore)
86 /// Clusterize one detection element, which digits are in digitStore
88 // AliDebug(1,Form("detElemId=%d, %d digits",detElemId,digitStore.GetSize()));
90 if ( digitStore.IsEmpty() ) return;
92 const AliMpVSegmentation* seg[2] =
93 { AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0),
94 AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath1)
97 if (!fClusterFinder->Prepare(seg,digitStore)) AliWarning(Form("No hit pad for DE %d ?",detElemId));
99 AliMUONCluster* cluster;
100 AliMUONVCluster *rawCluster;
103 // Converts cluster objects into ones suitable for output
104 while ( ( cluster = fClusterFinder->NextCluster() ) ) {
106 // add new cluster to the store with information to build its ID
107 // increment the number of clusters into the store
108 rawCluster = fClusterStore->Add(AliMpDEManager::GetChamberId(detElemId), detElemId, fNCluster++);
110 // fill array of Id of digits attached to this cluster
111 nPad = cluster->Multiplicity();
112 if (nPad < 1) AliWarning("no pad attached to the cluster");
113 for (Int_t iPad=0; iPad<nPad; iPad++) {
114 AliMUONPad *pad = cluster->Pad(iPad);
115 rawCluster->AddDigitId(pad->GetUniqueID());
118 // fill charge and other cluster informations
119 rawCluster->SetCharge(cluster->Charge());
122 fTransformer->Local2Global(detElemId,
123 cluster->Position().X(), cluster->Position().Y(),
125 rawCluster->SetXYZ(xg, yg, zg);
127 AliDebug(1,Form("Adding RawCluster detElemId %4d mult %2d charge %e (xl,yl,zl)=(%e,%e,%e) (xg,yg,zg)=(%e,%e,%e)",
128 detElemId,nPad,cluster->Charge(),
129 cluster->Position().X(),cluster->Position().Y(),0.0,
135 //____________________________________________________________________
136 void AliMUONClusterReconstructor::Digits2Clusters(const AliMUONVDigitStore& digitStore,
137 AliMUONVClusterStore& clusterStore)
139 /// Clusterize the digitStore to produce a clusterStore
141 fClusterStore = &clusterStore;
142 fClusterStore->Clear();
145 AliMpDEIterator deIt;
149 while (!deIt.IsDone())
151 AliMUONVDigitStore* deDigits = digitStore.Create();
153 Int_t currentDE = deIt.CurrentDEId();
154 AliMp::StationType stationType = AliMpDEManager::GetStationType(currentDE);
155 if (stationType!=AliMp::kStationTrigger)
157 TIter next(digitStore.CreateIterator(currentDE,currentDE));
158 AliMUONVDigit* digit;
160 while ( ( digit = static_cast<AliMUONVDigit*>(next()) ) )
162 if ( ! digit->Charge() > 0 ) continue; // skip void digits.
164 deDigits->Add(*digit,AliMUONVDigitStore::kIgnore);
166 ClusterizeOneDE(currentDE,*deDigits);