]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
In Mapping/macros:
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Mar 2009 13:12:21 +0000 (13:12 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Mar 2009 13:12:21 +0000 (13:12 +0000)
- Renaming macros for station 345: all start now with the prefix testSt345
and making them working again.  (Laurent)
- Adding an alternative macro timeMapping2.C (Ivana)

MUON/mapping/macros/testSt345Pads.C [moved from MUON/mapping/macros/testSlatPads.C with 82% similarity]
MUON/mapping/macros/testSt345ReadMotifType.C [moved from MUON/mapping/macros/testReadMotifTypeSlat.C with 79% similarity]
MUON/mapping/macros/testSt345ReadPCB.C [moved from MUON/mapping/macros/testReadPCB.C with 78% similarity]
MUON/mapping/macros/testSt345ReadSlat.C [moved from MUON/mapping/macros/testReadSlat.C with 70% similarity]
MUON/mapping/macros/test_suite.sh
MUON/mapping/macros/timeMapping2.C [new file with mode: 0644]
MUON/mapping/macros/timeMapping2.out [new file with mode: 0644]

similarity index 82%
rename from MUON/mapping/macros/testSlatPads.C
rename to MUON/mapping/macros/testSt345Pads.C
index e8bfb4186ff34af0e9b760b0878b6d4f102ff62c..87b387649becfc2fc2a84f66bd2366d329e700a3 100644 (file)
@@ -32,6 +32,7 @@
 #include "AliMpArea.h"
 #include "AliMpSt345Reader.h"
 #include "AliMpIntPair.h"
+#include "slats.h"
 
 #include <TObjArray.h>
 #include <TObjString.h>
@@ -39,7 +40,6 @@
 #include <TString.h>
 #include <TStopwatch.h>
 #include <Riostream.h>
-
 #endif
 
 //______________________________________________________________________________
@@ -82,7 +82,7 @@ Int_t Count(const AliMpSlat& slat)
   {
     for ( Int_t j = 0; j <= seg.MaxPadIndexY(); ++j )
     {
-      if ( seg.HasPad(AliMpIntPair(i,j)) ) 
+      if ( seg.HasPadByIndices(AliMpIntPair(i,j)) ) 
       {
         ++n;
       }
@@ -198,30 +198,8 @@ void XCheck(const AliMpSlat& slat)
 }
 
 //______________________________________________________________________________
-void testSlatPads(const char* slatlist)
+void testSt345Pads()
 {
-  ifstream in(slatlist);
-  char line[80];
-  TObjArray slatsToTest;
-  slatsToTest.SetOwner(kTRUE);
-  
-  TStopwatch timerCount;
-  TStopwatch timerIterate;
-  TStopwatch timerCT;
-  
-  timerCount.Start(true); timerCount.Stop();
-  timerIterate.Start(true); timerIterate.Stop();
-  timerCT.Start(true); timerCT.Stop();
-  
-  
-  while ( in.getline(line,80) )
-  {
-    if ( line[0] == '#' ) continue;
-    slatsToTest.AddLast(new TObjString(line));
-  }
-  
-  in.close();
-  
   AliMpDataProcessor mp;
   AliMpDataMap* dataMap = mp.CreateDataMap("data");
   AliMpDataStreams dataStreams(dataMap);
@@ -229,63 +207,87 @@ void testSlatPads(const char* slatlist)
   AliMpSlatMotifMap* motifMap = new AliMpSlatMotifMap();
   AliMpSt345Reader reader(dataStreams, motifMap);
   
-  for ( Int_t i = 0; i < slatsToTest.GetEntriesFast(); ++i )
+  Int_t ok(0);
+  
+  for ( Int_t i = 0; i < NSLATS; ++i ) 
   {
-    TString slatName( ((TObjString*)slatsToTest[i])->String());
+    Bool_t slatOK(kTRUE);
+    
+    TString slatName( slatTypeNames[i] );
     
     AliMpSlat* bending = reader.ReadSlat(slatName.Data(),AliMp::kBendingPlane);
     AliMpSlat* nonbending = reader.ReadSlat(slatName.Data(),AliMp::kNonBendingPlane);
   
-    timerCount.Start(false);
-    Int_t NumberOfBendingPads = Count(*bending);
-    Int_t NumberOfNonBendingPads = Count(*nonbending);
-    timerCount.Stop();
+    Int_t NumberOfBendingPads(0);
+    Int_t NumberOfNonBendingPads(0);
+    Int_t xcheck_b(0);
+    Int_t xcheck_nb(0);
+    Int_t nc_b(0);
+    Int_t nc_nb(0);
     
-    timerIterate.Start(false);
-    Int_t xcheck_b = Iterate(*bending);   
-    Int_t xcheck_nb = Iterate(*nonbending);
-    timerIterate.Stop();
+    if ( bending )
+    {
+      NumberOfBendingPads = Count(*bending);
+      xcheck_b = Iterate(*bending);   
+      nc_b = CircularTest(*bending);   
+    }
+    else
+    {
+      cout << "Could not read bending plane of slat " << slatName.Data() << endl;
+    }
     
-    timerCT.Start(false);
-    Int_t nc_b = CircularTest(*bending);   
-    Int_t nc_nb = CircularTest(*nonbending);
-    timerCT.Stop();
+    if ( nonbending ) 
+    {
+      NumberOfNonBendingPads = Count(*nonbending);
+      xcheck_nb = Iterate(*nonbending);
+      nc_nb = CircularTest(*nonbending);
+    }
+    else
+    {
+      cout << "Could not read bending plane of slat " << slatName.Data() << endl;
+    }
     
     cout << setw(10) << slatName
       << " BENDING : " << setw(5) << NumberOfBendingPads
       << " NONBENDING : " << setw(5) << NumberOfNonBendingPads
       << " CT for " << (nc_b+nc_nb) << " pads ";
+    
     if ( nc_b>0 && nc_nb>0 ) 
     {
       cout << "OK.";
     }
     else
     {
+      slatOK = kFALSE;
       cout << "FAILED.";
     }
     cout << endl;
 
-    XCheck(*nonbending);
-    XCheck(*bending);
+    if ( nonbending ) XCheck(*nonbending);
+    if ( bending ) XCheck(*bending);
 
     if ( xcheck_b != NumberOfBendingPads )
     {
       cout << setw(20) << " Bending : HasPad and Iterator give different results !" 
       << " " << NumberOfBendingPads << " vs " << xcheck_b << endl;
+      slatOK = kFALSE;
     }
     if ( xcheck_nb != NumberOfNonBendingPads )
     {
       cout << setw(20) << " NonBending : HasPad and Iterator give different results !"
       << " " << NumberOfNonBendingPads << " vs " << xcheck_nb << endl;
+      slatOK = kFALSE;
     }
-    
+
+    if (slatOK) ++ok;
    }
   
-  cout << "Count : "; 
-  timerCount.Print();
-  cout << "Iterate : ";
-  timerIterate.Print();
-  cout << "CT : ";
-  timerCT.Print();
-  
+  if ( ok == NSLATS ) 
+  {
+    cout << "Successfully tested " << ok << " slats" << endl;
+  }
+  else
+  {
+    cout << "Failed to read " << (NSLATS-ok) << " out of " << NSLATS << " slats" << endl;
+  }
 }
similarity index 79%
rename from MUON/mapping/macros/testReadMotifTypeSlat.C
rename to MUON/mapping/macros/testSt345ReadMotifType.C
index e01584899570acbbf8706e7dcee668b013938aee..8940afa0aeb24bc301726204933c275ef0b57230 100644 (file)
@@ -1,5 +1,9 @@
 // $Id$
-// $MpId: testReadMotifTypeSlat.C,v 1.1 2005/09/19 19:02:53 ivana Exp $
+
+///
+/// Tries to read all motif types for stations 3, 4, 5
+///
+/// 
 
 #if !defined(__CINT__) || defined(__MAKECINT__)
 
@@ -36,7 +40,7 @@ Int_t test(AliMpMotifReader& r, const char letter, Int_t from, Int_t to)
   return n;
 }
 
-void testReadMotifTypeSlat()
+void testSt345ReadMotifType()
 {
   AliMpDataProcessor mp;
   AliMpDataMap* dataMap = mp.CreateDataMap("data");
@@ -48,13 +52,13 @@ void testReadMotifTypeSlat()
   Int_t n = 0;
   
   n += test(r,'I',1,1);
-  n += test(r,'L',1,20);
-  n += test(r,'O',1,19);
+  n += test(r,'L',1,25);
+  n += test(r,'O',1,20);
   n += test(r,'P',1,4);
   n += test(r,'Q',1,4);
-  n += test(r,'R',1,42);
-  n += test(r,'Z',1,5);
+  n += test(r,'R',1,45);
+  n += test(r,'Z',1,8);
   
-  cout << "==== " << n << " motifTypes successfully read in" << endl;
+  cout << "Successfully read in " << n << " motifTypes" << endl;
 }  
 
similarity index 78%
rename from MUON/mapping/macros/testReadPCB.C
rename to MUON/mapping/macros/testSt345ReadPCB.C
index 2ab7e0c4923c6cbf819961a5bdb4d00dacb835e7..b8ce7133b92530c2bca71870a1226dfa6a1714e9 100644 (file)
@@ -1,5 +1,4 @@
 // $Id$
-// $MpId: testReadPCB.C,v 1.1 2005/09/19 19:02:53 ivana Exp $
 
 #if !defined(__CINT__) || defined(__MAKECINT__)
 
@@ -17,7 +16,7 @@
 
 #endif
 
-void testReadPCB()
+void testSt345ReadPCB()
 {
   AliMpDataProcessor mp;
   AliMpDataMap* dataMap = mp.CreateDataMap("data");
@@ -27,15 +26,17 @@ void testReadPCB()
   AliMpSt345Reader r(dataStreams, motifMap);
 
   const char* pcbToTest[] = { "B1", "B2", "B3+", "B3-", "N1", "N2+", "N2-", 
-  "N3", "R1B", "R1N", "R2B", "R2N", "R3B", "R3N", "S2B", "S2N" };
+  "N3", "R1B", "R1N", "R2B", "R2N", "R3B", "R3N", "S2B-", "S2B+", "S2N" };
   
   Int_t N = sizeof(pcbToTest)/sizeof(const char*);
+  Int_t ok(0);
   
   for ( Int_t i = 0; i < N; ++i )
   {
     AliMpPCB* pcb = r.ReadPCB(pcbToTest[i]);
     if (pcb)
     {
+      ++ok;
       pcb->Print();
       for ( Int_t j = 0; j < pcb->GetSize(); ++j )
       {
@@ -49,4 +50,12 @@ void testReadPCB()
       cout << "Cannot read " << pcbToTest[i] << endl;
     }
   }  
+  if ( ok == N ) 
+  {
+    cout << "Successfully read " << ok << " PCBs" << endl;
+  }
+  else
+  {
+    cout << "Failed to read " << (N-ok) << " PCBs out of " << N << endl;
+  }
 }
similarity index 70%
rename from MUON/mapping/macros/testReadSlat.C
rename to MUON/mapping/macros/testSt345ReadSlat.C
index 0f33a3ba138373b7873b84a704ce0232f5f74e31..a451af47c2e50159714e637863824ae3456bbaea 100644 (file)
@@ -1,5 +1,4 @@
 // $Id$
-// $MpId: testReadSlat.C,v 1.4 2005/09/19 19:02:53 ivana Exp $
 
 #if !defined(__CINT__) || defined(__MAKECINT__)
 
 #include "AliMpSt345Reader.h"
 
 #include <Riostream.h>
-#include <TObjArray.h>
-#include <TObjString.h>
+#include "slats.h"
 
 #endif
 
-void testReadSlat()
+void testSt345ReadSlat()
 {
   AliMpDataProcessor mp;
   AliMpDataMap* dataMap = mp.CreateDataMap("data");
@@ -28,20 +26,11 @@ void testReadSlat()
   AliMpSlatMotifMap* motifMap = new AliMpSlatMotifMap();
   AliMpSt345Reader r(dataStreams, motifMap);
 
-  ifstream in("slats.list");
-  char line[80];
-  TObjArray slatsToTest;
+  Int_t ok(0);
   
-  while ( in.getline(line,80) )
+  for ( Int_t i = 0; i < NSLATS; ++i )
   {
-    slatsToTest.AddLast(new TObjString(line));
-  }
-  
-  in.close();
-  
-  for ( Int_t i = 0; i < slatsToTest.GetEntriesFast(); ++i )
-  {
-    TString slat( ((TObjString*)slatsToTest[i])->String());
+    TString slat(slatTypeNames[i]);
     
     cout << "Trying to read " << slat << endl;
     AliMpSlat* b = r.ReadSlat(slat.Data(),AliMp::kBendingPlane);
@@ -58,13 +47,20 @@ void testReadSlat()
       {
         cout << "NOT THE SAME X-SIZE !" << endl;
       }
-      cout << "Bending : ";
+      cout << "Bending    : ";
       b->Print();
       cout << "NonBending : ";
       nb->Print();
+      ++ok;
     }
   }
   
-  slatsToTest.SetOwner(kTRUE);
-  slatsToTest.Delete();
+  if ( ok == NSLATS ) 
+  {
+    cout << "Successfully read " << ok << " slats" << endl;
+  }
+  else
+  {
+    cout << "Failed to read " << (NSLATS-ok) << " slats out of " << NSLATS << endl;
+  }
 }
index 8864581b9646d1c4a691cfd0065eaee4a67085c7..30bfba3e193ecc42d9526a9f98dfbf0076503a79 100755 (executable)
@@ -15,9 +15,9 @@ then
   mkdir -p $OUTDIR 
 fi
 
-for TEST in `ls testSt12*C` timeMapping.C
+for TEST in `ls testSt12*C` `ls testSt345*C` testDE.C timeMapping.C
 do
-  TESTNAME=`echo $TEST | sed s/.C//g`
+  TESTNAME=`echo $TEST | sed 's/\.C//g'`
   echo "Running $TESTNAME ..."
   #aliroot -b >& testSt12AllIndices.out << EOF
   aliroot -b >& $OUTDIR/$TESTNAME".out" << EOF
diff --git a/MUON/mapping/macros/timeMapping2.C b/MUON/mapping/macros/timeMapping2.C
new file mode 100644 (file)
index 0000000..6df7aeb
--- /dev/null
@@ -0,0 +1,214 @@
+// $Id$
+
+/// An alternative macro to time the PadBy*** methods of AliMpVSegmentation 
+/// implementation(s) which can handle AliMpPad not derived from TObject.
+///
+/// By L. Aphecetche, Subatech
+/// Modified by I. Hrivnacova, IPN Orsay
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
+
+#include "AliMpVSegmentation.h"
+#include "AliMpCDB.h"
+#include "AliMpSegmentation.h"
+#include "AliMpPad.h"
+#include "AliCodeTimer.h"
+#include "AliMpDEManager.h"
+#include "AliMpConstants.h"
+#include "AliMpManuIterator.h"
+#include "AliMpDEIterator.h"
+#include "AliMpCathodType.h"
+#include "AliMpStationType.h"
+#include "AliMpVPadIterator.h"
+
+#include "AliSysInfo.h"
+
+#include <TObjArray.h>
+#include <TVector2.h>
+#include <TTree.h>
+
+#include <vector>
+
+// The line below should be commented if you want to try this macro
+// on revision before 31082 (where AliMpVSegmentation did not have the HasPadBy...
+// methods).
+
+#define HASPAD
+
+//______________________________________________________________________________
+Int_t StationId(Int_t detElemId)
+{
+  switch ( 1 + AliMpDEManager::GetChamberId(detElemId) / 2 )
+  {
+    case 1:
+    case 2:
+      return 12;
+      break;
+    case 3:
+    case 4:
+    case 5:
+      return 345;
+      break;
+    default:
+      return -1;
+  }
+}
+
+//______________________________________________________________________________
+void ByPosition(const AliMpVSegmentation* seg, Int_t detElemId, 
+                const std::vector<AliMpPad>& pads)
+{
+  /// Time the PadByPosition method
+  
+  Int_t stationId = StationId(detElemId);
+
+  AliCodeTimerAutoGeneral(Form("PadByPosition-St%d",stationId));
+
+  std::vector<AliMpPad>::const_iterator it; 
+  for ( it = pads.begin(); it != pads.end(); it++ ) 
+  {
+    seg->PadByPosition(it->Position(),kFALSE);
+  }
+}
+
+//______________________________________________________________________________
+void ByIndices(const AliMpVSegmentation* seg, Int_t detElemId)
+{
+  /// Time the (Has)PadByIndices method
+  
+  Int_t stationId = StationId(detElemId);
+  {
+    AliCodeTimerAutoGeneral(Form("PadByIndices-St%d",stationId));
+    
+    for ( Int_t ix = 0; ix < seg->MaxPadIndexX(); ++ix )
+    {
+      for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy )
+      {
+        seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE);
+      }
+    }
+  }
+  
+#ifdef HASPAD        
+  {
+    AliCodeTimerAutoGeneral(Form("HasPadByIndices-St%d",stationId));
+    
+    for ( Int_t ix = 0; ix < seg->MaxPadIndexX(); ++ix )
+    {
+      for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy )
+      {
+        seg->HasPadByIndices(AliMpIntPair(ix,iy));
+      }
+    }
+  }
+#endif        
+}
+
+//______________________________________________________________________________
+void ByLocation(const AliMpVSegmentation* seg, Int_t detElemId, Int_t manuId)
+{
+  /// Time the (Has)PadByLocation method
+  
+  Int_t stationId = StationId(detElemId);
+  {
+    AliCodeTimerAutoGeneral(Form("PadByLocation-St%d",stationId));
+  
+    for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
+    {
+      seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE);
+    }
+  }
+
+#ifdef HASPAD
+  {
+    AliCodeTimerAutoGeneral(Form("HasPadByLocation-St%d",stationId));
+    
+    for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
+    {
+      seg->HasPadByLocation(AliMpIntPair(manuId,manuChannel));
+    }
+  }
+#endif      
+  
+}
+
+//______________________________________________________________________________
+void timeMapping2(Int_t nloop=1)
+{
+  AliCodeTimer::Instance()->Reset();
+
+  {
+    AliSysInfo::AddStamp("0");
+    AliCodeTimerAutoGeneral("Load mapping");
+    AliMpCDB::LoadDDLStore2();
+    AliSysInfo::AddStamp("1");
+    AliCodeTimer::Instance()->Print();
+    TTree t;
+    t.ReadFile("syswatch.log");
+    t.Scan("pI.fMemResident:sname");
+  }
+
+  AliCodeTimer::Instance()->Reset();
+  
+  for ( Int_t i = 0; i < nloop; ++i )
+  {
+    AliMpManuIterator it;
+    
+    Int_t detElemId;
+    Int_t manuId;
+    
+    while ( it.Next(detElemId,manuId) )
+    {
+      const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
+      
+      ByLocation(seg,detElemId,manuId);
+    }
+    
+    AliMpDEIterator deit;
+    
+    deit.First();
+    
+    while (!deit.IsDone())
+    {
+      Int_t detElemId = deit.CurrentDEId();
+      
+      if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger ) 
+      {
+        
+        for ( Int_t cath = 0; cath < 2; ++cath )
+        {
+          const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath));
+
+          ByIndices(seg,detElemId);
+          
+          //TObjArray pads;
+          //pads.SetOwner(kTRUE);
+          std::vector<AliMpPad> pads;
+
+          AliMpVPadIterator* pit = seg->CreateIterator();
+        
+          pit->First();
+        
+          while (!pit->IsDone())
+          {
+            AliMpPad pad = pit->CurrentItem();
+            //pads.Add(new AliMpPad(pad));
+            pads.push_back(pad);
+            pit->Next();
+          }
+          
+          delete pit;
+          
+          ByPosition(seg, detElemId, pads);
+        }
+        
+      }
+      
+      deit.Next();
+    }
+    
+  }
+  AliCodeTimer::Instance()->Print();
+}
+
+#endif
diff --git a/MUON/mapping/macros/timeMapping2.out b/MUON/mapping/macros/timeMapping2.out
new file mode 100644 (file)
index 0000000..ad67c6d
--- /dev/null
@@ -0,0 +1,38 @@
+I-AliCDBManager::SetDefaultStorage: Setting Default storage to: local://$ALICE_ROOT/OCDB
+W-AliCDBManager::Get: Run number explicitly set in query: CDB cache temporarily disabled!
+AliMpDCSNamer
+   ManuId2PCBIndex  R:0.0523s C:0.0600s (9676 slices)
+   ManuId2Sector  R:0.0344s C:0.0400s (7152 slices)
+AliMpDetElement
+   AddManu 
+         R:1.4517s C:1.4000s (16828 slices)
+        slat R:0.7501s C:0.7100s (9676 slices)
+        st12 R:0.5489s C:0.5300s (7152 slices)
+AliMpFastSegmentation
+   AliMpFastSegmentation 
+        AliMpSectorSegmentation R:0.0807s C:0.0800s (4 slices)
+        AliMpSlatSegmentation R:0.0973s C:0.0500s (38 slices)
+General
+   timeMapping2 Load mapping R:2.6892s C:2.6000s (1 slices)
+************************************
+*    Row   * pI.fMemRe *     sname *
+************************************
+*        0 *        62 *         0 *
+*        1 *       107 *         1 *
+************************************
+AliMpMotifMap
+   GetMotifPosition  R:0.0658s C:0.1000s (7152 slices)
+General
+   ByIndices 
+        HasPadByIndices-St12 R:0.1710s C:0.1600s (32 slices)
+        HasPadByIndices-St345 R:0.1198s C:0.1000s (280 slices)
+        PadByIndices-St12 R:0.5098s C:0.5000s (32 slices)
+        PadByIndices-St345 R:0.4567s C:0.4500s (280 slices)
+   ByLocation 
+        HasPadByLocation-St12 R:0.0730s C:0.0600s (7152 slices)
+        HasPadByLocation-St345 R:0.0979s C:0.1100s (9676 slices)
+        PadByLocation-St12 R:0.3791s C:0.3600s (7152 slices)
+        PadByLocation-St345 R:0.4947s C:0.4700s (9676 slices)
+   ByPosition 
+        PadByPosition-St12 R:7.0682s C:7.0700s (32 slices)
+        PadByPosition-St345 R:2.0758s C:2.1200s (280 slices)