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