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