]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONLegacyClusterServer.cxx
AliEveTrackCounter, AliEveTrackCounterEditor
[u/mrichter/AliRoot.git] / MUON / AliMUONLegacyClusterServer.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 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
44 ClassImp(AliMUONLegacyClusterServer)
45 /// \endcond
46
47 //_____________________________________________________________________________
48 AliMUONLegacyClusterServer::AliMUONLegacyClusterServer(const AliMUONGeometryTransformer& transformer, 
49                                                                                                                                                                                                                          AliMUONVClusterStore* store,
50                                                                                                                                                                                                                          Bool_t bypassSt4, Bool_t bypassSt5)
51 : AliMUONVClusterServer(), fTransformer(transformer), fClusterStore(store), fTriggerTrackStore(0x0),
52 fBypass(0x0),
53 fBypassSt4(bypassSt4),
54 fBypassSt5(bypassSt5)
55 {
56   /// ctor. Mode Read : we'll only server clusters from existing store
57 }
58
59 //_____________________________________________________________________________
60 AliMUONLegacyClusterServer::~AliMUONLegacyClusterServer()
61 {
62   /// dtor
63   delete fBypass;
64 }
65
66 //_____________________________________________________________________________
67 Int_t 
68 AliMUONLegacyClusterServer::Clusterize(Int_t chamberId, 
69                                        AliMUONVClusterStore& clusterStore,
70                                        const AliMpArea& /*area*/)
71 {
72   /// Fills clusterStore with clusters in given chamber
73   ///
74   /// Return the number of clusters added to clusterStore
75   
76   AliCodeTimerAuto(Form("Chamber %d",chamberId));
77
78   if ( fBypassSt4 && ( chamberId == 6 || chamberId == 7 ) ) 
79   {
80     return fBypass->GenerateClusters(chamberId,clusterStore);
81   }
82
83         if ( fBypassSt5 && ( chamberId == 8 || chamberId == 9 ) ) 
84   {
85     return fBypass->GenerateClusters(chamberId,clusterStore);
86   }
87         
88   AliDebug(1,Form("chamberId=%d fClusterStore(%p).GetSize()=%d clusterStore(%p).GetSize()=%d",
89                   chamberId,
90                   fClusterStore,fClusterStore->GetSize(),
91                   &clusterStore,clusterStore.GetSize()));
92   
93   TIter next(fClusterStore->CreateChamberIterator(chamberId,chamberId));
94   AliMUONVCluster* cluster;
95   Int_t n(0);
96   TObjArray a;
97   
98   while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) )
99   {
100     clusterStore.Add(*cluster);
101     a.Add(cluster);
102     ++n;
103   }
104   
105   TIter remove(&a);
106   while ( ( cluster = static_cast<AliMUONVCluster*>(remove()) ) )
107   {
108     fClusterStore->Remove(*cluster);
109   }
110   
111   AliDebug(1,Form("n=%d remaining clusters=%d",n,fClusterStore->GetSize()));
112   
113   return n;
114 }
115
116 //_____________________________________________________________________________
117 Bool_t 
118 AliMUONLegacyClusterServer::UseTriggerTrackStore(AliMUONVTriggerTrackStore* trackStore)
119 {
120   /// Tells us to use trigger track store, and thus to bypass St4 and/or 5 clusters
121   fTriggerTrackStore = trackStore; // not owner
122   delete fBypass;
123   fBypass = new AliMUONTriggerTrackToTrackerClusters(fTransformer,fTriggerTrackStore);
124   return kTRUE;
125 }
126
127 //_____________________________________________________________________________
128 void
129 AliMUONLegacyClusterServer::UseDigits(TIter&)
130 {
131   /// Give the iterator to our delegate if we have one, of issue and error
132   
133   AliError("Not implemented for this class, as we're not writing clusters, but reading them instead !");
134 }
135