Create the magnetic field map in the reconstruction macros (Yuri)
[u/mrichter/AliRoot.git] / MUON / AliMUONLegacyClusterServer.cxx
CommitLineData
9bf6860b 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 AliMUONLegacyClusterServer
19///
20/// Special implementation of AliMUONVClusterServer, which will only return
21/// clusters from a pre-defined cluster store.
22///
23/// Made to recover the old (i.e. before introduction of VClusterServer) behavior
24/// of the MUON recontruction where rec points were always written to TreeR,
25/// and then the tracking picked them from that tree, in order to have the
26/// possibility to save full rec points (for debugging the spectro, mainly, should
27/// not be an option used during final production).
28///
29/// \author Laurent Aphecetche, Subatech
30///
31
32#include "AliMUONLegacyClusterServer.h"
33
34#include "AliCodeTimer.h"
35#include "AliLog.h"
36#include "AliMUONGeometryTransformer.h"
37#include "AliMUONTriggerTrackToTrackerClusters.h"
38#include "AliMUONVCluster.h"
39#include "AliMUONVClusterStore.h"
40#include "AliMpArea.h"
41#include <TCollection.h>
42
43/// \cond CLASSIMP
44ClassImp(AliMUONLegacyClusterServer)
45/// \endcond
46
47//_____________________________________________________________________________
48AliMUONLegacyClusterServer::AliMUONLegacyClusterServer(const AliMUONGeometryTransformer& transformer, AliMUONVClusterStore* store)
49: AliMUONVClusterServer(), fTransformer(transformer), fClusterStore(store), fTriggerTrackStore(0x0),
50fBypass(0x0)
51{
52 /// ctor. Mode Read : we'll only server clusters from existing store
53}
54
55//_____________________________________________________________________________
56AliMUONLegacyClusterServer::~AliMUONLegacyClusterServer()
57{
58 /// dtor
59 delete fBypass;
60}
61
62//_____________________________________________________________________________
63Int_t
64AliMUONLegacyClusterServer::Clusterize(Int_t chamberId,
65 AliMUONVClusterStore& clusterStore,
66 const AliMpArea& /*area*/)
67{
68 /// Fills clusterStore with clusters in given chamber
69 ///
70 /// Return the number of clusters added to clusterStore
71
72 AliCodeTimerAuto(Form("Chamber %d",chamberId));
73
74 if ( fBypass && chamberId >= 6 )
75 {
76 return fBypass->GenerateClusters(chamberId,clusterStore);
77 }
78
79 AliDebug(1,Form("chamberId=%d fClusterStore(%p).GetSize()=%d clusterStore(%p).GetSize()=%d",
80 chamberId,
81 fClusterStore,fClusterStore->GetSize(),
82 &clusterStore,clusterStore.GetSize()));
83
84 TIter next(fClusterStore->CreateChamberIterator(chamberId,chamberId));
85 AliMUONVCluster* cluster;
86 Int_t n(0);
87 TObjArray a;
88
89 while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) )
90 {
91 clusterStore.Add(*cluster);
92 a.Add(cluster);
93 ++n;
94 }
95
96 TIter remove(&a);
97 while ( ( cluster = static_cast<AliMUONVCluster*>(remove()) ) )
98 {
99 fClusterStore->Remove(*cluster);
100 }
101
102 AliDebug(1,Form("n=%d remaining clusters=%d",n,fClusterStore->GetSize()));
103
104 return n;
105}
106
107//_____________________________________________________________________________
108Bool_t
109AliMUONLegacyClusterServer::UseTriggerTrackStore(AliMUONVTriggerTrackStore* trackStore)
110{
111 /// Tells us to use trigger track store, and thus to bypass St45 clusters
112 fTriggerTrackStore = trackStore; // not owner
113 delete fBypass;
114 fBypass = new AliMUONTriggerTrackToTrackerClusters(fTransformer,fTriggerTrackStore);
115 return kTRUE;
116}
117
118//_____________________________________________________________________________
119void
120AliMUONLegacyClusterServer::UseDigits(TIter&)
121{
122 /// Give the iterator to our delegate if we have one, of issue and error
123
124 AliError("Not implemented for this class, as we're not writing clusters, but reading them instead !");
125}
126