#include "AliMpArea.h"
#include "AliMpSt345Reader.h"
#include "AliMpIntPair.h"
+#include "slats.h"
#include <TObjArray.h>
#include <TObjString.h>
#include <TString.h>
#include <TStopwatch.h>
#include <Riostream.h>
-
#endif
//______________________________________________________________________________
{
for ( Int_t j = 0; j <= seg.MaxPadIndexY(); ++j )
{
- if ( seg.HasPad(AliMpIntPair(i,j)) )
+ if ( seg.HasPadByIndices(AliMpIntPair(i,j)) )
{
++n;
}
}
//______________________________________________________________________________
-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);
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;
+ }
}
// $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__)
return n;
}
-void testReadMotifTypeSlat()
+void testSt345ReadMotifType()
{
AliMpDataProcessor mp;
AliMpDataMap* dataMap = mp.CreateDataMap("data");
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;
}
// $Id$
-// $MpId: testReadPCB.C,v 1.1 2005/09/19 19:02:53 ivana Exp $
#if !defined(__CINT__) || defined(__MAKECINT__)
#endif
-void testReadPCB()
+void testSt345ReadPCB()
{
AliMpDataProcessor mp;
AliMpDataMap* dataMap = mp.CreateDataMap("data");
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 )
{
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;
+ }
}
// $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");
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);
{
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;
+ }
}
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
--- /dev/null
+// $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
--- /dev/null
+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)