]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONClusterReconstructor.cxx
Removing class AliMUONTrackK
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterReconstructor.cxx
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
18 /// \class AliMUONClusterReconstructor
19 ///
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.
23 ///
24 /// \author C. Finck and L. Aphecetche, Subatech
25 ///
26
27 #include "AliMUONClusterReconstructor.h"
28
29 #include "AliLog.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>
41
42 /// \cond CLASSIMP
43 ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
44 /// \endcond
45  
46 //__________________________________________________________________________
47 AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONVClusterFinder* clusterFinder,
48                                                          const AliMUONGeometryTransformer* transformer)
49 : TObject(),
50   fClusterFinder(clusterFinder),
51   fTransformer(transformer),
52   fClusterStore(0x0)
53 {
54     /// Standard Constructor
55
56   if (!transformer && clusterFinder)
57   {
58     AliFatal("I require a geometry transformer, otherwise I cannot compute "
59              "global coordinates of the clusters !");    
60   }
61   
62 //  fRecModel->SetGhostChi2Cut(10);
63 }
64
65 //__________________________________________________________________________
66 AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
67 {
68   /// Destructor
69 }
70
71 //______________________________________________________________________________
72 void
73 AliMUONClusterReconstructor::ClusterizeOneDE(Int_t detElemId,
74                                              const AliMUONVDigitStore& digitStore)
75 {
76   /// Clusterize one detection element, which digits are in digitStore
77   
78   if ( digitStore.IsEmpty() ) return;
79   
80   const AliMpVSegmentation* seg[2] = 
81   { AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0),
82     AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath1)
83   };
84     
85   Bool_t ok = fClusterFinder->Prepare(seg,digitStore);
86   if ( !ok )
87   {
88     AliWarning(Form("No hit pad for DE %d ?",detElemId));
89   }
90   
91   AliMUONCluster* cluster;
92     
93   while ( ( cluster = fClusterFinder->NextCluster() ) )
94   {
95     // Converts cluster objects into ones suitable for output
96     //
97     AliMUONRawCluster rawCluster;
98     
99     rawCluster.SetDetElemId(detElemId);
100     
101     for ( Int_t cathode = 0; cathode < 2; ++cathode )
102     {
103       rawCluster.SetMultiplicity(cathode,cluster->Multiplicity(cathode));
104       rawCluster.SetCharge(cathode,cluster->Charge()); // both cathode get the total cluster charge
105       Double_t xg, yg, zg;
106       
107       fTransformer->Local2Global(detElemId, 
108                                  cluster->Position().X(), cluster->Position().Y(), 
109                                  0, xg, yg, zg);
110       
111       if ( cathode == 0 )
112       {
113         AliDebug(1,Form("Adding RawCluster detElemId %4d mult %2d charge %e (xl,yl,zl)=(%e,%e,%e) (xg,yg,zg)=(%e,%e,%e)",
114                         detElemId,cluster->Multiplicity(),cluster->Charge(),
115                         cluster->Position().X(),cluster->Position().Y(),0.0,
116                         xg,yg,zg));
117       }
118       rawCluster.SetX(cathode,xg);
119       rawCluster.SetY(cathode,yg);
120       rawCluster.SetZ(cathode,zg);      
121     }
122     fClusterStore->Add(rawCluster);
123   }
124 }
125
126 //____________________________________________________________________
127 void AliMUONClusterReconstructor::Digits2Clusters(const AliMUONVDigitStore& digitStore,
128                                                   AliMUONVClusterStore& clusterStore)
129 {
130   /// Clusterize the digitStore to produce a clusterStore
131   
132   fClusterStore = &clusterStore;
133   fClusterStore->Clear();
134   
135   AliMpDEIterator deIt;
136   
137   deIt.First();
138   
139   while (!deIt.IsDone())
140   {
141     AliMUONVDigitStore* deDigits = digitStore.Create();
142     
143     Int_t currentDE = deIt.CurrentDEId();
144     AliMp::StationType stationType = AliMpDEManager::GetStationType(currentDE);
145     if (stationType!=AliMp::kStationTrigger) 
146     {
147       TIter next(digitStore.CreateIterator(currentDE,currentDE));
148       AliMUONVDigit* digit;
149
150       while ( ( digit = static_cast<AliMUONVDigit*>(next()) ) )
151       {
152         if ( ! digit->Charge() > 0 ) continue; // skip void digits.
153     
154         deDigits->Add(*digit,AliMUONVDigitStore::kIgnore);
155       }      
156       ClusterizeOneDE(currentDE,*deDigits);
157     }
158     delete deDigits;
159     deIt.Next();
160   }
161 }