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"
32 #include "AliMUONCluster.h"
33 #include "AliMUONGeometryTransformer.h"
34 #include "AliMUONRawCluster.h"
35 #include "AliMUONVClusterFinder.h"
36 #include "AliMUONVClusterStore.h"
37 #include "AliMUONVDigit.h"
38 #include "AliMUONVDigitStore.h"
39 #include "AliMpDEIterator.h"
40 #include "AliMpDEManager.h"
41 #include "AliMpSegmentation.h"
42 #include <Riostream.h>
45 ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
48 //__________________________________________________________________________
49 AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONVClusterFinder* clusterFinder,
50 const AliMUONGeometryTransformer* transformer)
52 fClusterFinder(clusterFinder),
53 fTransformer(transformer),
56 /// Standard Constructor
57 /// Note that we adopt clusterFinder
59 if (!transformer && clusterFinder)
61 AliFatal("I require a geometry transformer, otherwise I cannot compute "
62 "global coordinates of the clusters !");
65 // fRecModel->SetGhostChi2Cut(10);
68 //__________________________________________________________________________
69 AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
72 delete fClusterFinder;
75 //______________________________________________________________________________
77 AliMUONClusterReconstructor::ClusterizeOneDE(Int_t detElemId,
78 const AliMUONVDigitStore& digitStore)
80 /// Clusterize one detection element, which digits are in digitStore
82 // AliDebug(1,Form("detElemId=%d, %d digits",detElemId,digitStore.GetSize()));
84 if ( digitStore.IsEmpty() ) return;
86 const AliMpVSegmentation* seg[2] =
87 { AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0),
88 AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath1)
91 Bool_t ok = fClusterFinder->Prepare(seg,digitStore);
94 AliWarning(Form("No hit pad for DE %d ?",detElemId));
97 AliMUONCluster* cluster;
99 while ( ( cluster = fClusterFinder->NextCluster() ) )
101 // Converts cluster objects into ones suitable for output
103 AliMUONRawCluster rawCluster;
105 rawCluster.SetDetElemId(detElemId);
107 for ( Int_t cathode = 0; cathode < 2; ++cathode )
109 rawCluster.SetMultiplicity(cathode,cluster->Multiplicity(cathode));
110 rawCluster.SetCharge(cathode,cluster->Charge()); // both cathode get the total cluster charge
113 fTransformer->Local2Global(detElemId,
114 cluster->Position().X(), cluster->Position().Y(),
119 AliDebug(1,Form("Adding RawCluster detElemId %4d mult %2d charge %e (xl,yl,zl)=(%e,%e,%e) (xg,yg,zg)=(%e,%e,%e)",
120 detElemId,cluster->Multiplicity(),cluster->Charge(),
121 cluster->Position().X(),cluster->Position().Y(),0.0,
124 rawCluster.SetX(cathode,xg);
125 rawCluster.SetY(cathode,yg);
126 rawCluster.SetZ(cathode,zg);
128 fClusterStore->Add(rawCluster);
132 //____________________________________________________________________
133 void AliMUONClusterReconstructor::Digits2Clusters(const AliMUONVDigitStore& digitStore,
134 AliMUONVClusterStore& clusterStore)
136 /// Clusterize the digitStore to produce a clusterStore
138 fClusterStore = &clusterStore;
139 fClusterStore->Clear();
141 AliMpDEIterator deIt;
145 while (!deIt.IsDone())
147 AliMUONVDigitStore* deDigits = digitStore.Create();
149 Int_t currentDE = deIt.CurrentDEId();
150 AliMp::StationType stationType = AliMpDEManager::GetStationType(currentDE);
151 if (stationType!=AliMp::kStationTrigger)
153 TIter next(digitStore.CreateIterator(currentDE,currentDE));
154 AliMUONVDigit* digit;
156 while ( ( digit = static_cast<AliMUONVDigit*>(next()) ) )
158 if ( ! digit->Charge() > 0 ) continue; // skip void digits.
160 deDigits->Add(*digit,AliMUONVDigitStore::kIgnore);
162 ClusterizeOneDE(currentDE,*deDigits);