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 #include "AliMpManuList.h"
20 #include "AliMpDEIterator.h"
21 #include "AliMpDEManager.h"
22 #include "AliMpSegmentation.h"
23 #include "AliMpStationType.h"
24 #include "AliMpVSegmentation.h"
29 /// \class AliMpManuList
31 /// A sort of cache for mapping information we use often (or that are
32 /// time consuming to recompute).
34 /// \author Laurent Aphecetche
37 ClassImp(AliMpManuList)
40 //_____________________________________________________________________________
41 AliMpManuList::AliMpManuList()
46 //_____________________________________________________________________________
47 AliMpManuList::~AliMpManuList()
52 //_____________________________________________________________________________
54 AliMpManuList::DoesChannelExist(Int_t detElemId, Int_t manuID, Int_t manuChannel)
56 /// Whether a given (detElemId,manuID,manuChannel) combination is a valid one
58 const AliMpVSegmentation* seg =
59 AliMpSegmentation::Instance()
60 ->GetMpSegmentationByElectronics(detElemId,manuID);
61 if (!seg) return kFALSE;
63 if ( seg->PadByLocation(AliMpIntPair(manuID,manuChannel),kFALSE).IsValid() )
73 //_____________________________________________________________________________
75 AliMpManuList::ManuList()
77 /// Create a TList of AliMpIntPair<detElemId,manuID> of all MUON TRK manus
78 /// The returned list must be deleted by the client
80 TList* manuList = new TList;
82 manuList->SetOwner(kTRUE);
88 while ( !it.IsDone() )
90 Int_t detElemId = it.CurrentDE();
91 AliMpStationType stationType = AliMpDEManager::GetStationType(detElemId);
92 if ( stationType != kStationTrigger )
94 for ( Int_t cath = 0; cath <=1 ; ++cath )
96 const AliMpVSegmentation* seg
97 = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,cath);
101 seg->GetAllElectronicCardIDs(manus);
103 for ( Int_t im = 0; im < manus.GetSize(); ++im )
105 manuList->Add(new AliMpIntPair(detElemId,manus[im]));
114 //_____________________________________________________________________________
116 AliMpManuList::NumberOfChannels(Int_t detElemId, Int_t manuId)
118 /// Returns the number of channels in that manuID. Answer should be <=64
119 /// whatever happens.
121 const AliMpVSegmentation* seg =
122 AliMpSegmentation::Instance()
123 ->GetMpSegmentationByElectronics(detElemId,manuId);
125 for ( Int_t i = 0; i < 64; ++i )
127 AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,i),kFALSE);
128 if (pad.IsValid()) ++n;
133 //_____________________________________________________________________________
135 AliMpManuList::NumberOfManus(Int_t detElemId)
137 /// Returns the number of manus contained in the given detection element.
139 for ( Int_t i = 0; i < 2; ++i )
141 const AliMpVSegmentation* seg
142 = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,i);
144 seg->GetAllElectronicCardIDs(manus);
145 n += manus.GetSize();