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 "AliMpCathodType.h"
25 #include "AliMpVSegmentation.h"
30 /// \class AliMpManuList
32 /// A sort of cache for mapping information we use often (or that are
33 /// time consuming to recompute).
35 /// \author Laurent Aphecetche
38 ClassImp(AliMpManuList)
41 //_____________________________________________________________________________
42 AliMpManuList::AliMpManuList()
47 //_____________________________________________________________________________
48 AliMpManuList::~AliMpManuList()
53 //_____________________________________________________________________________
55 AliMpManuList::DoesChannelExist(Int_t detElemId, Int_t manuID, Int_t manuChannel)
57 /// Whether a given (detElemId,manuID,manuChannel) combination is a valid one
59 const AliMpVSegmentation* seg =
60 AliMpSegmentation::Instance()
61 ->GetMpSegmentationByElectronics(detElemId,manuID);
62 if (!seg) return kFALSE;
64 if ( seg->PadByLocation(AliMpIntPair(manuID,manuChannel),kFALSE).IsValid() )
74 //_____________________________________________________________________________
76 AliMpManuList::ManuList()
78 /// Create a TList of AliMpIntPair<detElemId,manuID> of all MUON TRK manus
79 /// The returned list must be deleted by the client
81 TList* manuList = new TList;
83 manuList->SetOwner(kTRUE);
89 while ( !it.IsDone() )
91 Int_t detElemId = it.CurrentDEId();
92 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
93 if ( stationType != AliMp::kStationTrigger )
95 for ( Int_t cath = AliMp::kCath0; cath <=AliMp::kCath1 ; ++cath )
97 const AliMpVSegmentation* seg
98 = AliMpSegmentation::Instance()
99 ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath));
103 seg->GetAllElectronicCardIDs(manus);
105 for ( Int_t im = 0; im < manus.GetSize(); ++im )
107 manuList->Add(new AliMpIntPair(detElemId,manus[im]));
116 //_____________________________________________________________________________
118 AliMpManuList::NumberOfChannels(Int_t detElemId, Int_t manuId)
120 /// Returns the number of channels in that manuID. Answer should be <=64
121 /// whatever happens.
123 const AliMpVSegmentation* seg =
124 AliMpSegmentation::Instance()
125 ->GetMpSegmentationByElectronics(detElemId,manuId);
127 for ( Int_t i = 0; i < 64; ++i )
129 AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,i),kFALSE);
130 if (pad.IsValid()) ++n;
135 //_____________________________________________________________________________
137 AliMpManuList::NumberOfManus(Int_t detElemId)
139 /// Returns the number of manus contained in the given detection element.
141 for ( Int_t i = AliMp::kCath0; i <= AliMp::kCath1; ++i )
143 const AliMpVSegmentation* seg
144 = AliMpSegmentation::Instance()
145 ->GetMpSegmentation(detElemId,AliMp::GetCathodType(i));
148 seg->GetAllElectronicCardIDs(manus);
149 n += manus.GetSize();