]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterReconstructor.cxx
coding violation fixes
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterReconstructor.cxx
CommitLineData
52c9bc11 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
3d1463c8 18//-----------------------------------------------------------------------------
3dbff571 19/// \class AliMUONClusterReconstructor
20///
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.
24///
25/// \author C. Finck and L. Aphecetche, Subatech
26///
3d1463c8 27//-----------------------------------------------------------------------------
52c9bc11 28
52c9bc11 29#include "AliMUONClusterReconstructor.h"
cf464691 30
3dbff571 31#include "AliMUONCluster.h"
32#include "AliMUONGeometryTransformer.h"
2060b217 33#include "AliMUONVCluster.h"
f9247068 34#include "AliMUONVClusterFinder.h"
3dbff571 35#include "AliMUONVClusterStore.h"
36#include "AliMUONVDigit.h"
37#include "AliMUONVDigitStore.h"
2060b217 38#include "AliMUONPad.h"
39
3dbff571 40#include "AliMpDEIterator.h"
66f4c572 41#include "AliMpDEManager.h"
f9247068 42#include "AliMpSegmentation.h"
2060b217 43
44#include "AliLog.h"
45
3dbff571 46#include <Riostream.h>
2060b217 47#include <float.h>
cf464691 48
7945aae7 49/// \cond CLASSIMP
52c9bc11 50ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
7945aae7 51/// \endcond
dd20215d 52
52c9bc11 53//__________________________________________________________________________
3dbff571 54AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONVClusterFinder* clusterFinder,
f9247068 55 const AliMUONGeometryTransformer* transformer)
dd20215d 56: TObject(),
f9247068 57 fClusterFinder(clusterFinder),
3dbff571 58 fTransformer(transformer),
2060b217 59 fClusterStore(0x0),
60 fNCluster(0)
52c9bc11 61{
3dbff571 62 /// Standard Constructor
f8028dc0 63 /// Note that we adopt clusterFinder
52c9bc11 64
f9247068 65 if (!transformer && clusterFinder)
66 {
67 AliFatal("I require a geometry transformer, otherwise I cannot compute "
68 "global coordinates of the clusters !");
69 }
3dbff571 70
71// fRecModel->SetGhostChi2Cut(10);
52c9bc11 72}
30178c30 73
52c9bc11 74//__________________________________________________________________________
75AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
76{
3dbff571 77 /// Destructor
f8028dc0 78 delete fClusterFinder;
dd20215d 79}
7e4a628d 80
f9247068 81//______________________________________________________________________________
82void
3dbff571 83AliMUONClusterReconstructor::ClusterizeOneDE(Int_t detElemId,
84 const AliMUONVDigitStore& digitStore)
f9247068 85{
3dbff571 86 /// Clusterize one detection element, which digits are in digitStore
87
f8028dc0 88// AliDebug(1,Form("detElemId=%d, %d digits",detElemId,digitStore.GetSize()));
89
3dbff571 90 if ( digitStore.IsEmpty() ) return;
91
f9247068 92 const AliMpVSegmentation* seg[2] =
866c3232 93 { AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0),
94 AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath1)
f9247068 95 };
3dbff571 96
2060b217 97 if (!fClusterFinder->Prepare(seg,digitStore)) AliWarning(Form("No hit pad for DE %d ?",detElemId));
f9247068 98
99 AliMUONCluster* cluster;
2060b217 100 AliMUONVCluster *rawCluster;
101 Int_t nPad;
102
103 // Converts cluster objects into ones suitable for output
104 while ( ( cluster = fClusterFinder->NextCluster() ) ) {
3dbff571 105
2060b217 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++);
f9247068 109
2060b217 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());
f9247068 116 }
2060b217 117
118 // fill charge and other cluster informations
119 rawCluster->SetCharge(cluster->Charge());
120
121 Double_t xg, yg, zg;
122 fTransformer->Local2Global(detElemId,
123 cluster->Position().X(), cluster->Position().Y(),
124 0, xg, yg, zg);
125 rawCluster->SetXYZ(xg, yg, zg);
126
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,
130 xg,yg,zg));
dd20215d 131 }
2060b217 132
52c9bc11 133}
dd20215d 134
52c9bc11 135//____________________________________________________________________
3dbff571 136void AliMUONClusterReconstructor::Digits2Clusters(const AliMUONVDigitStore& digitStore,
137 AliMUONVClusterStore& clusterStore)
a713db22 138{
3dbff571 139 /// Clusterize the digitStore to produce a clusterStore
a713db22 140
3dbff571 141 fClusterStore = &clusterStore;
142 fClusterStore->Clear();
2060b217 143 fNCluster = 0;
dd20215d 144
3dbff571 145 AliMpDEIterator deIt;
dd20215d 146
3dbff571 147 deIt.First();
148
149 while (!deIt.IsDone())
dd20215d 150 {
3dbff571 151 AliMUONVDigitStore* deDigits = digitStore.Create();
dd20215d 152
3dbff571 153 Int_t currentDE = deIt.CurrentDEId();
154 AliMp::StationType stationType = AliMpDEManager::GetStationType(currentDE);
155 if (stationType!=AliMp::kStationTrigger)
dd20215d 156 {
3dbff571 157 TIter next(digitStore.CreateIterator(currentDE,currentDE));
158 AliMUONVDigit* digit;
159
160 while ( ( digit = static_cast<AliMUONVDigit*>(next()) ) )
dd20215d 161 {
3dbff571 162 if ( ! digit->Charge() > 0 ) continue; // skip void digits.
dd20215d 163
3dbff571 164 deDigits->Add(*digit,AliMUONVDigitStore::kIgnore);
165 }
166 ClusterizeOneDE(currentDE,*deDigits);
167 }
168 delete deDigits;
169 deIt.Next();
170 }
7e4a628d 171}