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