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 /// \class AliMUONClusterReconstructor
20 /// This class is just a steering class to loop over detection elements of tracking chambers,
21 /// extract the relevant digits, and pass them to the actual clusterizer class,
22 /// which operate on a single detection element at a time.
24 /// \author C. Finck and L. Aphecetche, Subatech
27 #include "AliMUONClusterReconstructor.h"
30 #include "AliMUONCluster.h"
31 #include "AliMUONGeometryTransformer.h"
32 #include "AliMUONRawCluster.h"
33 #include "AliMUONVClusterFinder.h"
34 #include "AliMUONVClusterStore.h"
35 #include "AliMUONVDigit.h"
36 #include "AliMUONVDigitStore.h"
37 #include "AliMpDEIterator.h"
38 #include "AliMpDEManager.h"
39 #include "AliMpSegmentation.h"
40 #include <Riostream.h>
43 ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
46 //__________________________________________________________________________
47 AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONVClusterFinder* clusterFinder,
48 const AliMUONGeometryTransformer* transformer)
50 fClusterFinder(clusterFinder),
51 fTransformer(transformer),
54 /// Standard Constructor
55 /// Note that we adopt clusterFinder
57 if (!transformer && clusterFinder)
59 AliFatal("I require a geometry transformer, otherwise I cannot compute "
60 "global coordinates of the clusters !");
63 // fRecModel->SetGhostChi2Cut(10);
66 //__________________________________________________________________________
67 AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
70 delete fClusterFinder;
73 //______________________________________________________________________________
75 AliMUONClusterReconstructor::ClusterizeOneDE(Int_t detElemId,
76 const AliMUONVDigitStore& digitStore)
78 /// Clusterize one detection element, which digits are in digitStore
80 // AliDebug(1,Form("detElemId=%d, %d digits",detElemId,digitStore.GetSize()));
82 if ( digitStore.IsEmpty() ) return;
84 const AliMpVSegmentation* seg[2] =
85 { AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0),
86 AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath1)
89 Bool_t ok = fClusterFinder->Prepare(seg,digitStore);
92 AliWarning(Form("No hit pad for DE %d ?",detElemId));
95 AliMUONCluster* cluster;
97 while ( ( cluster = fClusterFinder->NextCluster() ) )
99 // Converts cluster objects into ones suitable for output
101 AliMUONRawCluster rawCluster;
103 rawCluster.SetDetElemId(detElemId);
105 for ( Int_t cathode = 0; cathode < 2; ++cathode )
107 rawCluster.SetMultiplicity(cathode,cluster->Multiplicity(cathode));
108 rawCluster.SetCharge(cathode,cluster->Charge()); // both cathode get the total cluster charge
111 fTransformer->Local2Global(detElemId,
112 cluster->Position().X(), cluster->Position().Y(),
117 AliDebug(1,Form("Adding RawCluster detElemId %4d mult %2d charge %e (xl,yl,zl)=(%e,%e,%e) (xg,yg,zg)=(%e,%e,%e)",
118 detElemId,cluster->Multiplicity(),cluster->Charge(),
119 cluster->Position().X(),cluster->Position().Y(),0.0,
122 rawCluster.SetX(cathode,xg);
123 rawCluster.SetY(cathode,yg);
124 rawCluster.SetZ(cathode,zg);
126 fClusterStore->Add(rawCluster);
130 //____________________________________________________________________
131 void AliMUONClusterReconstructor::Digits2Clusters(const AliMUONVDigitStore& digitStore,
132 AliMUONVClusterStore& clusterStore)
134 /// Clusterize the digitStore to produce a clusterStore
136 fClusterStore = &clusterStore;
137 fClusterStore->Clear();
139 AliMpDEIterator deIt;
143 while (!deIt.IsDone())
145 AliMUONVDigitStore* deDigits = digitStore.Create();
147 Int_t currentDE = deIt.CurrentDEId();
148 AliMp::StationType stationType = AliMpDEManager::GetStationType(currentDE);
149 if (stationType!=AliMp::kStationTrigger)
151 TIter next(digitStore.CreateIterator(currentDE,currentDE));
152 AliMUONVDigit* digit;
154 while ( ( digit = static_cast<AliMUONVDigit*>(next()) ) )
156 if ( ! digit->Charge() > 0 ) continue; // skip void digits.
158 deDigits->Add(*digit,AliMUONVDigitStore::kIgnore);
160 ClusterizeOneDE(currentDE,*deDigits);