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