]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpMotifMap.cxx
Work around for CINT bug in root 5.10/00, with gcc4.0.2
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifMap.cxx
CommitLineData
dee1d5f1 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
5f91c9e8 16// $Id$
073fe42a 17// $MpId: AliMpMotifMap.cxx,v 1.13 2006/03/15 10:04:36 ivana Exp $
5f91c9e8 18// Category: motif
490da820 19// -------------------
5f91c9e8 20// Class AliMpMotifMap
21// -------------------
22// Class describing the motif map container, where motifs are
23// mapped to their string IDs.
dbe945cc 24// Included in AliRoot: 2003/05/02
5f91c9e8 25// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
26
27#include <Riostream.h>
7a854749 28#include <TVector2.h>
5f91c9e8 29
30#include "AliMpMotifMap.h"
31#include "AliMpVMotif.h"
32#include "AliMpMotif.h"
33#include "AliMpMotifSpecial.h"
34#include "AliMpMotifType.h"
35#include "AliMpMotifPosition.h"
6d5f608a 36#include "TArrayI.h"
5f91c9e8 37
38ClassImp(AliMpMotifMap)
39
5006ec94 40//_____________________________________________________________________________
41AliMpMotifMap::AliMpMotifMap(Bool_t /*standardConstructor*/)
42 : TObject()
f79c58a5 43#ifdef WITH_ROOT
5006ec94 44 ,fMotifs(true),
45 fMotifTypes(true),
46 fMotifPositions(true),
47 fMotifPositions2(true)
3283cfc7 48#endif
5006ec94 49{
50/// Standard constructor
51
52 //fMotifPositions2.SetOwner(false);
53}
f79c58a5 54
5f91c9e8 55//_____________________________________________________________________________
56AliMpMotifMap::AliMpMotifMap()
5006ec94 57 : TObject(),
58 fMotifs(),
59 fMotifTypes(),
60 fMotifPositions(),
61 fMotifPositions2()
5f91c9e8 62{
dee1d5f1 63/// Default constructor
5f91c9e8 64}
65
66//_____________________________________________________________________________
dee1d5f1 67AliMpMotifMap::~AliMpMotifMap()
68{
69/// Destructor
5f91c9e8 70
71 // Delete all registered motifs, motif types, motif positions
72
f79c58a5 73#ifdef WITH_STL
5f91c9e8 74 for (MotifMapIterator im=fMotifs.begin(); im != fMotifs.end(); im++) {
75 delete im->second;
76 }
f79c58a5 77
5f91c9e8 78 for (MotifTypeMapIterator it=fMotifTypes.begin();
79 it != fMotifTypes.end(); it++) {
80 delete it->second;
81 }
f79c58a5 82
5f91c9e8 83 for (MotifPositionMapIterator ip=fMotifPositions.begin();
84 ip != fMotifPositions.end(); ip++) {
85 delete ip->second;
86 }
f79c58a5 87#endif
5f91c9e8 88}
89
90//
91// private methods
92//
93
f79c58a5 94//_____________________________________________________________________________
95void AliMpMotifMap::PrintMotif(const AliMpVMotif* motif) const
96{
dee1d5f1 97/// Print the motif.
f79c58a5 98// ---
99
100 cout << motif->GetID().Data() << " "
101 << motif->GetMotifType()->GetID() << " "
102 << motif->Dimensions().X() << " "
103 << motif->Dimensions().Y();
104}
105
106//_____________________________________________________________________________
107void AliMpMotifMap::PrintMotifType(const AliMpMotifType* motifType) const
108{
dee1d5f1 109/// Print the motif type.
f79c58a5 110
111 cout << motifType->GetID().Data() << " "
112 << motifType->GetNofPadsX() << " "
113 << motifType->GetNofPadsY() << " ";
114}
115
116//_____________________________________________________________________________
117void AliMpMotifMap::PrintMotifPosition(
118 const AliMpMotifPosition* motifPosition) const
119{
dee1d5f1 120/// Print the motif position.
f79c58a5 121
6d5f608a 122 cout << " ID " << motifPosition->GetID() << " "
123 << " Motif ID " << motifPosition->GetMotif()->GetID() << " "
124 << " Pos (X,Y) = (" << motifPosition->Position().X() << ","
125 << motifPosition->Position().Y() << ")";
f79c58a5 126}
127
128//_____________________________________________________________________________
129void AliMpMotifMap::PrintMotifPosition2(
130 const AliMpMotifPosition* motifPosition) const
131{
dee1d5f1 132/// Print the motif position.
f79c58a5 133
134 cout << setw(3) << motifPosition->GetLowIndicesLimit().GetFirst() << " "
135 << setw(3) << motifPosition->GetLowIndicesLimit().GetSecond() << " "
136 << setw(3) << motifPosition->GetHighIndicesLimit().GetFirst() << " "
137 << setw(3) << motifPosition->GetHighIndicesLimit().GetSecond() << " "
138 << motifPosition->GetID() << " ";
139}
140
5f91c9e8 141//_____________________________________________________________________________
142void AliMpMotifMap::PrintMotifs() const
143{
dee1d5f1 144/// Print all the motifs and their motif types
145/// for all motifs in the motifs map.
5f91c9e8 146
f79c58a5 147#ifdef WITH_STL
5f91c9e8 148 if (fMotifs.size()) {
149 cout << "Dump of Motif Map - " << fMotifs.size() << " entries:" << endl;
150 Int_t counter = 0;
151 for (MotifMapIterator i=fMotifs.begin(); i != fMotifs.end(); i++) {
152 const TString& id = (*i).first;
5f91c9e8 153 cout << "Map element "
154 << setw(3) << counter++ << " "
f79c58a5 155 << id.Data() << " " ;
156 PrintMotif((*i).second);
157 cout << endl;
5f91c9e8 158 }
159 cout << endl;
160 }
f79c58a5 161#endif
162
163#ifdef WITH_ROOT
164 if (fMotifs.GetSize()) {
165 cout << "Dump of Motif Map - " << fMotifs.GetSize() << " entries:" << endl;
166 Int_t counter = 0;
5006ec94 167 TExMapIter i = fMotifs.GetIterator();
f79c58a5 168 Long_t key, value;
169 while ( i.Next(key, value) ) {
5006ec94 170 TString id = fMotifs.AliMpExMap::GetString(key);
f79c58a5 171 AliMpVMotif* motif = (AliMpVMotif*)value;
172 cout << "Map element "
173 << setw(3) << counter++ << " "
174 << id.Data() << " " ;
175 PrintMotif(motif);
176 cout << endl;
177 }
178 cout << endl;
179 }
180#endif
5f91c9e8 181}
182
183//_____________________________________________________________________________
184void AliMpMotifMap::PrintMotifTypes() const
185{
dee1d5f1 186/// Print all the the motifs types and their motif dimensions
187/// for all motif types in the motif types map.
5f91c9e8 188
f79c58a5 189#ifdef WITH_STL
5f91c9e8 190 if (fMotifTypes.size()) {
191 cout << "Dump of Motif Type Map - " << fMotifTypes.size() << " entries:" << endl;
192 Int_t counter = 0;
193 for (MotifTypeMapIterator i=fMotifTypes.begin(); i != fMotifTypes.end(); i++) {
194 const TString& id = (*i).first;
5f91c9e8 195 cout << "Map element "
196 << setw(3) << counter++ << " "
f79c58a5 197 << id.Data() << " ";
198 PrintMotifType((*i).second);
199 cout << endl;
200 }
201 cout << endl;
202 }
203#endif
204
205#ifdef WITH_ROOT
206 if (fMotifTypes.GetSize()) {
207 cout << "Dump of Motif Type Map - " << fMotifTypes.GetSize() << " entries:" << endl;
208 Int_t counter = 0;
5006ec94 209 TExMapIter i = fMotifTypes.GetIterator();
f79c58a5 210 Long_t key, value;
211 while ( i.Next(key, value) ) {
5006ec94 212 TString id = AliMpExMap::GetString(key);
f79c58a5 213 AliMpMotifType* motifType = (AliMpMotifType*)value;
214 cout << "Map element "
215 << setw(3) << counter++ << " "
216 << id.Data() << " " ;
217 PrintMotifType(motifType);
218 cout << endl;
5f91c9e8 219 }
220 cout << endl;
221 }
f79c58a5 222#endif
5f91c9e8 223}
224
6d5f608a 225//_____________________________________________________________________________
226void
227AliMpMotifMap::GetAllMotifPositionsIDs(TArrayI& ecn) const
228{
490da820 229/// Fill the given array with all motif positions IDs (electronic card numbers)
230/// defined in the map
231
6d5f608a 232#ifdef WITH_STL
233 ecn.Set(fMotifPositions.size());
234 Int_t i(0);
235 MotifPositionMapIterator it;
236 for (it=fMotifPositions.begin(); it != fMotifPositions.end(); it++) {
237 AliMpMotifPosition* motifPosition = (*it).second;
238 ecn[i++] = motifPosition->GetID();
239 }
240#endif
241
242#ifdef WITH_ROOT
243 ecn.Set(fMotifPositions.GetSize());
244 TExMapIter it = fMotifPositions.GetIterator();
245 Long_t key, value;
246 Int_t i(0);
247
248 while ( it.Next(key, value) )
249 {
250 AliMpMotifPosition* motifPosition = reinterpret_cast<AliMpMotifPosition*>(value);
251 ecn[i] = motifPosition->GetID();
252 ++i;
253 }
254
255#endif
256}
257
3283cfc7 258//_____________________________________________________________________________
259Int_t AliMpMotifMap::CalculateNofPads() const
260{
261 Int_t nofPads = 0;
262
263#ifdef WITH_STL
264 MotifPositionMapIterator it;
265 for (it=fMotifPositions.begin(); it != fMotifPositions.end(); it++) {
266 AliMpMotifPosition* motifPosition = (*it).second;
267 nofPads += motifPosition->GetMotif()->GetMotifType()->GetNofPads();
268 }
269#endif
270
271#ifdef WITH_ROOT
272 TExMapIter it = fMotifPositions.GetIterator();
273 Long_t key, value;
274
275 while ( it.Next(key, value) ) {
276 AliMpMotifPosition* motifPosition = reinterpret_cast<AliMpMotifPosition*>(value);
277 nofPads += motifPosition->GetMotif()->GetMotifType()->GetNofPads();
278 }
279#endif
280
3283cfc7 281 return nofPads;
282}
283
5f91c9e8 284//_____________________________________________________________________________
285void AliMpMotifMap::PrintMotifPositions() const
286{
dee1d5f1 287/// Print all the the motifs positions.
5f91c9e8 288
f79c58a5 289#ifdef WITH_STL
5f91c9e8 290 if (fMotifPositions.size()) {
291 cout << "Dump of Motif Position Map - " << fMotifPositions.size() << " entries:" << endl;
292 Int_t counter = 0;
293 for (MotifPositionMapIterator i=fMotifPositions.begin();
294 i != fMotifPositions.end(); i++) {
295
5f91c9e8 296 cout << "Map element "
f79c58a5 297 << setw(3) << counter++ << " ";
298 PrintMotifPosition((*i).second);
299 cout << endl;
5f91c9e8 300 }
301 cout << endl;
302 }
f79c58a5 303#endif
304
305#ifdef WITH_ROOT
306 if (fMotifPositions.GetSize()) {
dee1d5f1 307 cout << "Dump of Motif Position Map - " << fMotifPositions.GetSize() << " entries:" << endl;
f79c58a5 308 Int_t counter = 0;
5006ec94 309 TExMapIter i = fMotifPositions.GetIterator();
f79c58a5 310 Long_t key, value;
311 while ( i.Next(key, value) ) {
312 AliMpMotifPosition* motifPosition = (AliMpMotifPosition*)value;
313 cout << "Map element "
314 << setw(3) << counter++ << " ";
315 PrintMotifPosition(motifPosition);
316 cout << endl;
317 }
318 cout << endl;
319 }
320#endif
5f91c9e8 321}
322
323//_____________________________________________________________________________
324void AliMpMotifMap::PrintMotifPositions2() const
325{
dee1d5f1 326/// Print all the the motifs positions from the second map
327/// (by global indices)
5f91c9e8 328
f79c58a5 329#ifdef WITH_STL
5f91c9e8 330 if (fMotifPositions2.size()) {
331 cout << "Dump of Motif Position Map 2 - " << fMotifPositions2.size() << " entries:" << endl;
332 Int_t counter = 0;
333 for (MotifPositionMap2Iterator i=fMotifPositions2.begin();
334 i != fMotifPositions2.end(); i++) {
335
5f91c9e8 336 cout << "Map element "
f79c58a5 337 << setw(3) << counter++ << " ";
338 PrintMotifPosition2((*i).second);
339 cout << endl;
340 }
341 cout << endl;
342 }
343#endif
344
345#ifdef WITH_ROOT
346 if (fMotifPositions2.GetSize()) {
347 cout << "Dump of Motif Position Map 2 - " << fMotifPositions2.GetSize() << " entries:" << endl;
348 Int_t counter = 0;
5006ec94 349 TExMapIter i = fMotifPositions2.GetIterator();
f79c58a5 350 Long_t key, value;
351 while ( i.Next(key, value) ) {
352 AliMpMotifPosition* motifPosition = (AliMpMotifPosition*)value;
353 cout << "Map element "
354 << setw(3) << counter++ << " ";
355 PrintMotifPosition2(motifPosition);
356 cout << endl;
5f91c9e8 357 }
358 cout << endl;
359 }
f79c58a5 360#endif
5f91c9e8 361}
362
363//
364// public methods
365//
366
367//_____________________________________________________________________________
368Bool_t AliMpMotifMap::AddMotif(AliMpVMotif* motif, Bool_t warn)
369{
dee1d5f1 370/// Add the specified motif
371/// if the motif with this ID is not yet present.
5f91c9e8 372
373 AliMpVMotif* found = FindMotif(motif->GetID());
374 if (found) {
375 if (warn && found == motif)
376 Warning("AddMotif", "The motif is already in map.");
377 if (warn && found != motif)
378 Warning("AddMotif", "Another motif with the same ID is already in map.");
379 return false;
380 }
381
f79c58a5 382#ifdef WITH_STL
5f91c9e8 383 fMotifs[motif->GetID()] = motif;
f79c58a5 384#endif
385
386#ifdef WITH_ROOT
5006ec94 387 fMotifs.Add(motif->GetID(), motif);
f79c58a5 388#endif
389
5f91c9e8 390 return true;
391}
392
393//_____________________________________________________________________________
394Bool_t AliMpMotifMap::AddMotifType(AliMpMotifType* motifType, Bool_t warn)
395{
dee1d5f1 396/// Add the specified motif type
397/// if the motif with this ID is not yet present.
5f91c9e8 398
399 AliMpMotifType* found = FindMotifType(motifType->GetID());
400 if (found) {
401 if (warn && found == motifType)
402 Warning("AddMotifType", "The motif type is already in map.");
403 if (warn && found != motifType)
404 Warning("AddMotifType",
405 "Another motif type with the same ID is already in map.");
406 return false;
407 }
408
f79c58a5 409#ifdef WITH_STL
5f91c9e8 410 fMotifTypes[motifType->GetID()] = motifType;
f79c58a5 411#endif
412
413#ifdef WITH_ROOT
5006ec94 414 fMotifTypes.Add(motifType->GetID(), motifType);
f79c58a5 415#endif
416
5f91c9e8 417 return true;
418}
419
420//_____________________________________________________________________________
421Bool_t AliMpMotifMap::AddMotifPosition(AliMpMotifPosition* motifPosition, Bool_t warn)
422{
dee1d5f1 423/// Add the specified motif position
424/// if this position is not yet present.
5f91c9e8 425
426 AliMpMotifPosition* found = FindMotifPosition(motifPosition->GetID());
7a854749 427 if (found) {
428 if (warn && found == motifPosition) {
429 cerr << "ID: " << motifPosition->GetID()
430 << " found: " << found
431 << " new: " << motifPosition << endl;
5f91c9e8 432 Warning("AddMotifPosition", "This motif position is already in map.");
7a854749 433 }
434 if (warn && found != motifPosition) {
435 cerr << "ID: " << motifPosition->GetID()
436 << " found: " << found
437 << " new: " << motifPosition << endl;
5f91c9e8 438 Warning("AddMotifposition",
7a854749 439 "Another motif position with the same ID is already in map.");
440 }
5f91c9e8 441 return false;
442 }
443
f79c58a5 444#ifdef WITH_STL
5f91c9e8 445 fMotifPositions[motifPosition->GetID()] = motifPosition;
f79c58a5 446#endif
447
448#ifdef WITH_ROOT
5006ec94 449 fMotifPositions.Add(motifPosition->GetID(), motifPosition);
f79c58a5 450#endif
451
5f91c9e8 452 return true;
453}
454
455//_____________________________________________________________________________
456void AliMpMotifMap::FillMotifPositionMap2()
457{
dee1d5f1 458/// Fill the second map (by global indices) of motif positions.
5f91c9e8 459
f79c58a5 460#ifdef WITH_STL
5f91c9e8 461 if (fMotifPositions2.size() > 0 ) {
462 Warning("FillMotifPositionMap2", "Map has been already filled.");
463 return;
464 }
465
466 for (MotifPositionMapIterator ip=fMotifPositions.begin();
467 ip != fMotifPositions.end(); ip++) {
468
469 fMotifPositions2[(*ip).second->GetLowIndicesLimit()] = (*ip).second;
470 }
f79c58a5 471#endif
472
473#ifdef WITH_ROOT
474 if (fMotifPositions2.GetSize() > 0 ) {
475 Warning("FillMotifPositionMap2", "Map has been already filled.");
476 return;
477 }
478
5006ec94 479 TExMapIter i = fMotifPositions.GetIterator();
f79c58a5 480 Long_t key, value;
481 while ( i.Next(key, value) ) {
482 AliMpMotifPosition* motifPosition = (AliMpMotifPosition*)value;
5006ec94 483 fMotifPositions2.Add(motifPosition->GetLowIndicesLimit(), motifPosition);
f79c58a5 484 }
485#endif
5f91c9e8 486
487}
488
489//_____________________________________________________________________________
6d5f608a 490void AliMpMotifMap::Print(const char* opt) const
5f91c9e8 491{
dee1d5f1 492/// Print the motifs and motif types maps.
5f91c9e8 493
6d5f608a 494 TString sopt(opt);
495
496 sopt.ToUpper();
497
498 if ( sopt.Contains("MOTIFS") || sopt == "ALL" ) PrintMotifs();
499 if ( sopt.Contains("MOTIFTYPES") || sopt == "ALL" ) PrintMotifTypes();
500 if ( sopt.Contains("MOTIFPOSITIONS") || sopt == "ALL" ) PrintMotifPositions();
501 if ( sopt.Contains("MOTIFPOSITIONS2") || sopt == "ALL" ) PrintMotifPositions2();
5f91c9e8 502}
503
504//_____________________________________________________________________________
505void AliMpMotifMap::PrintGlobalIndices(const char* fileName) const
506{
dee1d5f1 507/// Print all the motifs positions and their global indices.
5f91c9e8 508
509 ofstream out(fileName, ios::out);
510
f79c58a5 511#ifdef WITH_STL
5f91c9e8 512 if (fMotifPositions.size()) {
513 for (MotifPositionMapIterator i=fMotifPositions.begin();
514 i != fMotifPositions.end(); i++) {
515
516 AliMpMotifPosition* motifPosition = (*i).second;
517 out << setw(5) << motifPosition->GetID() << " "
518 << setw(3) << motifPosition->GetLowIndicesLimit().GetFirst() << " "
519 << setw(3) << motifPosition->GetLowIndicesLimit().GetSecond()
520 << endl;
521 }
522 out << endl;
523 }
f79c58a5 524#endif
525
526#ifdef WITH_ROOT
527 if (fMotifPositions.GetSize()) {
5006ec94 528 TExMapIter i = fMotifPositions.GetIterator();
f79c58a5 529 Long_t key, value;
530 while ( i.Next(key, value) ) {
531 AliMpMotifPosition* motifPosition = (AliMpMotifPosition*)value;
532 out << setw(5) << motifPosition->GetID() << " "
533 << setw(3) << motifPosition->GetLowIndicesLimit().GetFirst() << " "
534 << setw(3) << motifPosition->GetLowIndicesLimit().GetSecond()
535 << endl;
536 }
537 out << endl;
538 }
539#endif
5f91c9e8 540}
541
542//_____________________________________________________________________________
543void AliMpMotifMap::UpdateGlobalIndices(const char* fileName)
544{
dee1d5f1 545/// Updates the motifs positions global indices
546/// from the file.
5f91c9e8 547
548 ifstream in(fileName, ios::in);
549
550 Int_t motifPositionId, offx, offy;
551
552 do {
553 in >> motifPositionId >> offx >> offy;
554
555 if (in.eof()) {
556 FillMotifPositionMap2();
557 return;
558 }
559
560 AliMpMotifPosition* motifPosition = FindMotifPosition(motifPositionId);
561
562 if (motifPosition) {
563 cout << "Processing "
564 << motifPosition->GetID() << " " << offx << " " << offy << endl;
565
566 motifPosition->SetLowIndicesLimit(AliMpIntPair(offx, offy));
567
568 Int_t offx2
569 = offx + motifPosition->GetMotif()->GetMotifType()->GetNofPadsX() - 1;
570
571 Int_t offy2
572 = offy + motifPosition->GetMotif()->GetMotifType()->GetNofPadsY() - 1;
573
574 motifPosition->SetHighIndicesLimit(AliMpIntPair(offx2, offy2));
575 }
576 else {
577 cerr <<"Motif position " << motifPositionId << endl;
578 Warning("UpdateGlobalIndices", "Motif position not found !!!");
579 }
580 }
581 while (!in.eof());
582}
583
584
585//_____________________________________________________________________________
586AliMpVMotif* AliMpMotifMap::FindMotif(const TString& motifID) const
587{
dee1d5f1 588/// Finds the motif with the specified ID.
5f91c9e8 589
f79c58a5 590#ifdef WITH_STL
5f91c9e8 591 MotifMapIterator i = fMotifs.find(motifID);
5f91c9e8 592 if (i != fMotifs.end())
593 return (*i).second;
594 else
595 return 0;
f79c58a5 596#endif
597
598#ifdef WITH_ROOT
5006ec94 599 return (AliMpVMotif*)fMotifs.GetValue(motifID);
f79c58a5 600#endif
5f91c9e8 601}
602
603//_____________________________________________________________________________
604AliMpVMotif* AliMpMotifMap::FindMotif(const TString& motifID,
7a854749 605 const TString& motifTypeID,
606 const TVector2& padDimensions ) const
5f91c9e8 607{
dee1d5f1 608/// Finds the motif with the specified ID and returns it
609/// only if its motif type and motif dimensions agree
610/// with the given motifTypeID and motifDimensions.
611/// Disagreement causes fatal error.
612
5f91c9e8 613 AliMpVMotif* motif = FindMotif(motifID);
614
615 if (motif && motif->GetMotifType()->GetID() != motifTypeID) {
616 Fatal("FindMotif",
617 "Motif has been already defined with a different type.");
618 return 0;
619 }
620
621 // check pad dimension in case of a normal motif
622 if (motif &&
623 dynamic_cast<AliMpMotif*>(motif) &&
624 ( motif->GetPadDimensions(0).X() != padDimensions.X() ||
625 motif->GetPadDimensions(0).Y() != padDimensions.Y())) {
626
627 Fatal("FindMotifType",
628 "Motif type has been already defined with different dimensions.");
629 return 0;
630
631 }
632
633 // check case of a special motif
634 if (motif &&
635 (padDimensions.X() == 0. && padDimensions.Y() == 0.) &&
636 !dynamic_cast<AliMpMotifSpecial*>(motif)) {
637
638 Fatal("FindMotifType",
639 "Motif type has been already defined with different dimensions.");
640 return 0;
641
642 }
643
644 return motif;
645}
646
647//_____________________________________________________________________________
648AliMpMotifType* AliMpMotifMap::FindMotifType(const TString& motifTypeID) const
649{
dee1d5f1 650/// Find the motif type with the specified motif type ID.
5f91c9e8 651
f79c58a5 652#ifdef WITH_STL
5f91c9e8 653 MotifTypeMapIterator i = fMotifTypes.find(motifTypeID);
5f91c9e8 654 if (i != fMotifTypes.end())
655 return (*i).second;
656 else
657 return 0;
f79c58a5 658#endif
659
660#ifdef WITH_ROOT
5006ec94 661 return (AliMpMotifType*)fMotifTypes.GetValue(motifTypeID);
f79c58a5 662#endif
5f91c9e8 663}
664
665//_____________________________________________________________________________
7a854749 666AliMpMotifPosition*
667AliMpMotifMap::FindMotifPosition(Int_t motifPositionID) const
5f91c9e8 668{
dee1d5f1 669/// Find the motif position with the specified motif position ID.
5f91c9e8 670
f79c58a5 671#ifdef WITH_STL
5f91c9e8 672 MotifPositionMapIterator i = fMotifPositions.find(motifPositionID);
5f91c9e8 673 if (i != fMotifPositions.end())
674 return (*i).second;
675 else
676 return 0;
f79c58a5 677#endif
678
679#ifdef WITH_ROOT
5006ec94 680 return (AliMpMotifPosition*)fMotifPositions.GetValue(motifPositionID);
f79c58a5 681#endif
5f91c9e8 682}
683
f79c58a5 684/*
5f91c9e8 685//_____________________________________________________________________________
7a854749 686AliMpMotifPosition*
687AliMpMotifMap::FindMotifPosition(const AliMpIntPair& indices) const
5f91c9e8 688{
dee1d5f1 689/// Find the last motif position which has the global indices (low limit)
690/// less then the indices specified.
5f91c9e8 691
f79c58a5 692#ifdef WITH_STL
5f91c9e8 693 MotifPositionMap2Iterator found
694 = fMotifPositions2.lower_bound(indices);
695
696 if (found == fMotifPositions2.end()) found--;
697
698 MotifPositionMap2Iterator i=found;
699 do {
700 AliMpIntPair low = (*i).second->GetLowIndicesLimit();
701 AliMpIntPair up = (*i).second->GetHighIndicesLimit();
702
703 if ( indices.GetFirst() >= low.GetFirst() &&
704 indices.GetSecond() >= low.GetSecond() &&
705 indices.GetFirst() <= up.GetFirst() &&
706 indices.GetSecond() <= up.GetSecond())
707
708 return (*i).second;
709 }
710 while ( i-- != fMotifPositions2.begin());
711
712 return 0;
f79c58a5 713#endif
714
715#ifdef WITH_ROOT
716 // HOW TO DO THIS WITH ROOT ????
717 // Fortunately it seems not to be used anywhere
718 Fatal("FindMotifPosition", "Difficult in Root to do this.");
719 return 0;
720#endif
5f91c9e8 721}
f79c58a5 722*/