]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpMotifMap.cxx
Updated comments for Doxygen - corrected warnings
[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 Int_t AliMpMotifMap::CalculateNofPads() const 
263 {
264 /// Calculate total number of pads in the map
265
266   Int_t nofPads = 0;
267
268 #ifdef WITH_STL
269   MotifPositionMapIterator it;
270   for (it=fMotifPositions.begin(); it != fMotifPositions.end(); it++) {
271     AliMpMotifPosition* motifPosition = (*it).second;
272     nofPads += motifPosition->GetMotif()->GetMotifType()->GetNofPads();
273   }
274 #endif
275   
276 #ifdef WITH_ROOT  
277   TExMapIter it = fMotifPositions.GetIterator();
278   Long_t key, value;
279   
280   while ( it.Next(key, value) ) {
281     AliMpMotifPosition* motifPosition = reinterpret_cast<AliMpMotifPosition*>(value);
282     nofPads += motifPosition->GetMotif()->GetMotifType()->GetNofPads();
283   }
284 #endif  
285
286   return nofPads;
287 }
288
289 //_____________________________________________________________________________
290 void  AliMpMotifMap::PrintMotifPositions() const
291 {
292 /// Print all motif positions.
293
294 #ifdef WITH_STL
295   if (fMotifPositions.size()) {
296     cout << "Dump of Motif Position Map - " << fMotifPositions.size() << " entries:" << endl;
297     Int_t counter = 0;        
298     for (MotifPositionMapIterator i=fMotifPositions.begin(); 
299                                   i != fMotifPositions.end(); i++) {
300
301       cout << "Map element " 
302            << setw(3) << counter++ << "   "; 
303       PrintMotifPosition((*i).second);     
304       cout << endl;
305     }
306     cout << endl;
307   }
308 #endif  
309
310 #ifdef WITH_ROOT
311   if (fMotifPositions.GetSize()) {
312     cout << "Dump of Motif Position Map - " << fMotifPositions.GetSize() << " entries:" << endl;
313     Int_t counter = 0;        
314     TExMapIter i = fMotifPositions.GetIterator();
315     Long_t key, value;
316     while ( i.Next(key, value) ) {
317       AliMpMotifPosition* motifPosition = (AliMpMotifPosition*)value;
318       cout << "Map element " 
319            << setw(3) << counter++ << "   "; 
320       PrintMotifPosition(motifPosition);           
321       cout << endl;
322     }
323     cout << endl;
324   }
325 #endif  
326 }
327
328 //_____________________________________________________________________________
329 void  AliMpMotifMap::PrintMotifPositions2() const
330 {
331 /// Print all motif positions from the second map
332 /// (by global indices)
333
334 #ifdef WITH_STL
335   if (fMotifPositions2.size()) {
336     cout << "Dump of Motif Position Map 2 - " << fMotifPositions2.size() << " entries:" << endl;
337     Int_t counter = 0;        
338     for (MotifPositionMap2Iterator i=fMotifPositions2.begin(); 
339                                    i != fMotifPositions2.end(); i++) {
340
341       cout << "Map element " 
342            << setw(3) << counter++ << "   "; 
343       PrintMotifPosition2((*i).second);  
344       cout << endl;
345     }
346     cout << endl;
347   }
348 #endif  
349
350 #ifdef WITH_ROOT
351   if (fMotifPositions2.GetSize()) {
352     cout << "Dump of Motif Position Map 2 - " << fMotifPositions2.GetSize() << " entries:" << endl;
353     Int_t counter = 0;        
354     TExMapIter i = fMotifPositions2.GetIterator();
355     Long_t key, value;
356     while ( i.Next(key, value) ) {
357       AliMpMotifPosition* motifPosition = (AliMpMotifPosition*)value;
358       cout << "Map element " 
359            << setw(3) << counter++ << "   "; 
360       PrintMotifPosition2(motifPosition);          
361       cout << endl;
362     }
363     cout << endl;
364   }
365 #endif  
366 }
367
368 //
369 // public methods
370 //
371
372 //_____________________________________________________________________________
373 Bool_t AliMpMotifMap::AddMotif(AliMpVMotif* motif, Bool_t warn)
374 {
375 /// Add the specified motif 
376 /// if the motif with this ID is not yet present.
377
378   AliMpVMotif* found = FindMotif(motif->GetID());
379   if (found) {    
380     if (warn && found == motif) 
381       AliWarningStream() << "The motif is already in map." << endl;
382
383     if (warn && found != motif) {
384       AliWarningStream() 
385         << "Another motif with the same ID is already in map." << endl; 
386     }        
387     return false;
388   }  
389
390 #ifdef WITH_STL
391   fMotifs[motif->GetID()] = motif;
392 #endif
393
394 #ifdef WITH_ROOT
395   fMotifs.Add(motif->GetID(), motif);
396 #endif
397
398   return true;
399 }
400
401 //_____________________________________________________________________________
402 Bool_t AliMpMotifMap::AddMotifType(AliMpMotifType* motifType, Bool_t warn)
403 {
404 /// Add the specified motif type
405 /// if the motif with this ID is not yet present.
406
407   AliMpMotifType* found = FindMotifType(motifType->GetID());
408   if (found) {    
409     if (warn && found == motifType) 
410       AliWarningStream() << "The motif type is already in map." << endl;
411       
412     if (warn && found != motifType) { 
413       AliWarningStream() 
414         << "Another motif type with the same ID is already in map." << endl;
415     }        
416     return false;
417   }  
418
419 #ifdef WITH_STL
420   fMotifTypes[motifType->GetID()] = motifType;
421 #endif
422
423 #ifdef WITH_ROOT
424   fMotifTypes.Add(motifType->GetID(), motifType);
425 #endif
426
427   return true;
428 }
429
430 //_____________________________________________________________________________
431 Bool_t AliMpMotifMap::AddMotifPosition(AliMpMotifPosition* motifPosition, Bool_t warn)
432 {
433 /// Add the specified motif position
434 /// if this position is not yet present.
435
436   AliMpMotifPosition* found = FindMotifPosition(motifPosition->GetID());
437   if (found) { 
438     if (warn && found == motifPosition) {
439       AliWarningStream()
440            << "ID: " << motifPosition->GetID() 
441            << "  found: " << found 
442            << "  new:   " << motifPosition << endl
443            << "This motif position is already in map." << endl;
444     }  
445     
446     if (warn && found != motifPosition) { 
447       AliWarningStream()
448            << "ID: " << motifPosition->GetID() 
449            << "  found: " << found 
450            << "  new:   " << motifPosition << endl
451            << "Another motif position with the same ID is already in map."
452            << endl;
453     }
454                     
455     return false;
456   }  
457
458 #ifdef WITH_STL
459   fMotifPositions[motifPosition->GetID()] = motifPosition;
460 #endif
461
462 #ifdef WITH_ROOT
463   fMotifPositions.Add(motifPosition->GetID(), motifPosition);
464 #endif
465
466   return true;
467 }
468
469 //_____________________________________________________________________________
470 void AliMpMotifMap::FillMotifPositionMap2()
471 {
472 /// Fill the second map (by global indices) of motif positions.
473
474 #ifdef WITH_STL
475   if (fMotifPositions2.size() > 0 ) {
476     AliWarningStream() << "Map has been already filled." << endl;
477     return;
478   }  
479
480   for (MotifPositionMapIterator ip=fMotifPositions.begin(); 
481        ip != fMotifPositions.end(); ip++) {
482
483     fMotifPositions2[(*ip).second->GetLowIndicesLimit()] = (*ip).second;
484   }  
485 #endif
486
487 #ifdef WITH_ROOT
488   if (fMotifPositions2.GetSize() > 0 ) {
489     AliWarningStream() <<"Map has been already filled." << endl;
490     return;
491   }  
492
493   TExMapIter i = fMotifPositions.GetIterator();
494   Long_t key, value;
495   while ( i.Next(key, value) ) {
496     AliMpMotifPosition* motifPosition = (AliMpMotifPosition*)value;
497     fMotifPositions2.Add(motifPosition->GetLowIndicesLimit(), motifPosition);
498   }
499 #endif
500
501 }
502
503 //_____________________________________________________________________________
504 void  AliMpMotifMap::Print(const char* opt) const
505 {
506 /// Print the motifs and motif types maps.
507
508   TString sopt(opt);
509   
510   sopt.ToUpper();
511   
512   if ( sopt.Contains("MOTIFS") || sopt == "ALL" ) PrintMotifs();
513   if ( sopt.Contains("MOTIFTYPES") || sopt == "ALL" ) PrintMotifTypes();
514   if ( sopt.Contains("MOTIFPOSITIONS") || sopt == "ALL" ) PrintMotifPositions();
515   if ( sopt.Contains("MOTIFPOSITIONS2") || sopt == "ALL" ) PrintMotifPositions2();
516 }
517
518 //_____________________________________________________________________________
519 void  AliMpMotifMap::PrintGlobalIndices(const char* fileName) const
520 {
521 /// Print all motif positions and their global indices.
522
523   ofstream out(fileName, ios::out);
524
525 #ifdef WITH_STL
526   if (fMotifPositions.size()) {
527     for (MotifPositionMapIterator i=fMotifPositions.begin(); 
528                                    i != fMotifPositions.end(); i++) {
529
530       AliMpMotifPosition* motifPosition = (*i).second;
531       out << setw(5) << motifPosition->GetID() << "     "
532           << setw(3) << motifPosition->GetLowIndicesLimit().GetFirst()  << " " 
533           << setw(3) << motifPosition->GetLowIndicesLimit().GetSecond() 
534          << endl;
535     }
536     out << endl;
537   }
538 #endif
539
540 #ifdef WITH_ROOT
541   if (fMotifPositions.GetSize()) {
542     TExMapIter i = fMotifPositions.GetIterator();
543     Long_t key, value;
544     while ( i.Next(key, value) ) {
545       AliMpMotifPosition* motifPosition = (AliMpMotifPosition*)value;
546       out << setw(5) << motifPosition->GetID() << "     "
547           << setw(3) << motifPosition->GetLowIndicesLimit().GetFirst()  << " " 
548           << setw(3) << motifPosition->GetLowIndicesLimit().GetSecond() 
549          << endl;
550     }
551     out << endl;
552   }
553 #endif
554 }
555
556 //_____________________________________________________________________________
557 void  AliMpMotifMap::UpdateGlobalIndices(const char* fileName)
558 {
559 /// Update the motif positions global indices from the file.
560
561   ifstream in(fileName, ios::in);
562
563   Int_t motifPositionId, offx, offy;
564     
565   do {
566     in >> motifPositionId >> offx >> offy;
567     
568     if (in.eof()) {
569       FillMotifPositionMap2();
570       return;
571     }  
572     
573     AliMpMotifPosition* motifPosition = FindMotifPosition(motifPositionId);
574           
575     if (motifPosition) {
576        AliDebugStream(1) 
577             << "Processing " 
578             << motifPosition->GetID() << " " << offx << " " << offy << endl; 
579
580        motifPosition->SetLowIndicesLimit(AliMpIntPair(offx, offy));
581        
582        Int_t offx2 
583          = offx + motifPosition->GetMotif()->GetMotifType()->GetNofPadsX() - 1;
584          
585        Int_t offy2 
586          = offy + motifPosition->GetMotif()->GetMotifType()->GetNofPadsY() - 1;
587        
588        motifPosition->SetHighIndicesLimit(AliMpIntPair(offx2, offy2));
589     }
590     else {   
591        AliWarningStream()
592          << "Motif position " << motifPositionId << " not found" << endl;
593     }
594   }    
595   while (!in.eof());
596 }
597
598
599 //_____________________________________________________________________________
600 AliMpVMotif* AliMpMotifMap::FindMotif(const TString& motifID) const
601 {
602 /// Find the motif with the specified ID.
603   
604 #ifdef WITH_STL
605   MotifMapIterator i = fMotifs.find(motifID);
606   if (i != fMotifs.end()) 
607     return (*i).second;
608   else                 
609     return 0;
610 #endif
611
612 #ifdef WITH_ROOT
613   return (AliMpVMotif*)fMotifs.GetValue(motifID);
614 #endif
615 }
616
617 //_____________________________________________________________________________
618 AliMpVMotif* AliMpMotifMap::FindMotif(const TString& motifID, 
619                                       const TString& motifTypeID,
620                                       const TVector2& padDimensions ) const
621 {
622 /// Find the motif with the specified ID and returns it
623 /// only if its motif type and motif dimensions agree
624 /// with the given motifTypeID and motifDimensions.
625 /// Disagreement causes fatal error.
626  
627   AliMpVMotif* motif = FindMotif(motifID);
628
629   if (motif && motif->GetMotifType()->GetID() != motifTypeID) {
630       Fatal("FindMotif", 
631             "Motif has been already defined with a different type.");
632       return 0;     
633   }
634
635   // check pad dimension in case of a normal motif
636   if (motif && 
637       dynamic_cast<AliMpMotif*>(motif) && 
638       ( motif->GetPadDimensions(0).X() != padDimensions.X() ||
639         motif->GetPadDimensions(0).Y() != padDimensions.Y())) { 
640       
641       Fatal("FindMotifType", 
642             "Motif type has been already defined with different dimensions.");
643       return 0;
644
645   } 
646
647   // check case of a special motif
648   if (motif && 
649       (padDimensions.X() == 0. && padDimensions.Y() == 0.) &&
650       !dynamic_cast<AliMpMotifSpecial*>(motif)) {
651
652       Fatal("FindMotifType", 
653             "Motif type has been already defined with different dimensions.");
654       return 0;
655
656   } 
657   
658   return motif;
659 }
660
661 //_____________________________________________________________________________
662 AliMpMotifType* AliMpMotifMap::FindMotifType(const TString& motifTypeID) const
663 {
664 /// Find the motif type with the specified motif type ID.
665   
666 #ifdef WITH_STL
667   MotifTypeMapIterator i = fMotifTypes.find(motifTypeID);
668   if (i != fMotifTypes.end()) 
669     return (*i).second;
670   else                 
671     return 0;
672 #endif
673
674 #ifdef WITH_ROOT
675   return (AliMpMotifType*)fMotifTypes.GetValue(motifTypeID);
676 #endif
677 }
678
679 //_____________________________________________________________________________
680 AliMpMotifPosition* 
681 AliMpMotifMap::FindMotifPosition(Int_t motifPositionID) const
682 {
683 /// Find the motif position with the specified motif position ID.
684   
685 #ifdef WITH_STL
686   MotifPositionMapIterator i = fMotifPositions.find(motifPositionID);
687   if (i != fMotifPositions.end()) 
688     return (*i).second;
689   else                 
690     return 0;
691 #endif
692
693 #ifdef WITH_ROOT
694   return (AliMpMotifPosition*)fMotifPositions.GetValue(motifPositionID);
695 #endif
696 }
697
698 /*
699 //_____________________________________________________________________________
700 AliMpMotifPosition* 
701 AliMpMotifMap::FindMotifPosition(const AliMpIntPair& indices) const
702 {
703 /// Find the last motif position which has the global indices (low limit)
704 /// less then the indices specified.
705
706 #ifdef WITH_STL
707   MotifPositionMap2Iterator found 
708     = fMotifPositions2.lower_bound(indices);
709   
710   if (found == fMotifPositions2.end()) found--; 
711
712   MotifPositionMap2Iterator i=found;
713   do {
714     AliMpIntPair low = (*i).second->GetLowIndicesLimit();
715     AliMpIntPair up = (*i).second->GetHighIndicesLimit();
716     
717     if ( indices.GetFirst()  >= low.GetFirst() &&
718          indices.GetSecond() >= low.GetSecond() &&
719          indices.GetFirst()  <= up.GetFirst() &&
720          indices.GetSecond() <= up.GetSecond())
721          
722          return (*i).second;                     
723   }
724   while ( i-- != fMotifPositions2.begin());
725   
726   return 0;
727 #endif
728
729 #ifdef WITH_ROOT
730   // HOW TO DO THIS WITH ROOT ????
731   // Fortunately it seems not to be used anywhere
732   Fatal("FindMotifPosition", "Difficult in Root to do this.");
733   return 0;
734 #endif
735 }
736 */