From: ivana Date: Tue, 27 Sep 2005 09:29:09 +0000 (+0000) Subject: Added Bool_t rootInput argument; if set to true, the sector X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=334be4b7cf8c7e5508afddf801a74fddfdf78a0a Added Bool_t rootInput argument; if set to true, the sector is loaded from the Root file instead of the ASCI data --- diff --git a/MUON/mapping/macros/testAnyPadIterators.C b/MUON/mapping/macros/testAnyPadIterators.C index efa667b757b..e666cbb2e83 100644 --- a/MUON/mapping/macros/testAnyPadIterators.C +++ b/MUON/mapping/macros/testAnyPadIterators.C @@ -1,5 +1,5 @@ // $Id$ -// $MpId: testAnyPadIterators.C,v 1.12 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testAnyPadIterators.C,v 1.13 2005/09/26 16:05:24 ivana Exp $ // // Test macro for reading sector, and iterate over it @@ -25,19 +25,30 @@ void MarkPads(AliMpVPadIterator& it,Int_t xmax,Int_t ymax,Bool_t print=kTRUE) void testAnyPadIterators(AliMpStationType station = kStation1, AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false, Int_t i=50, Int_t j=50) { - AliMpSectorReader r(station, plane); - AliMpSector* sect = r.BuildSector(); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + sector=r.BuildSector(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); + } TCanvas *canv = new TCanvas("canv"); canv->Divide(2,2); //canv_1->Divide(2); canv->cd(1); - MarkPads(AliMpSectorPadIterator(sect), 150, 250, kFALSE); + MarkPads(AliMpSectorPadIterator(sector), 150, 250, kFALSE); canv->cd(2); - AliMpVMotif* motif = sect->FindMotif(TVector2(300,30)); + AliMpVMotif* motif = sector->FindMotif(TVector2(300,30)); if (motif) { AliMpMotifType* motifType = motif->GetMotifType(); @@ -47,16 +58,16 @@ void testAnyPadIterators(AliMpStationType station = kStation1, } else cout<<"No motif found at given position..."<cd(3); - //MarkPads(*AliMpPadIteratorPtr(AliMpSectorSegmentation(sect)->CreateIterator(AliMpIntPair(i,j))) - AliMpSectorSegmentation segm(sect); + //MarkPads(*AliMpPadIteratorPtr(AliMpSectorSegmentation(sector)->CreateIterator(AliMpIntPair(i,j))) + AliMpSectorSegmentation segm(sector); AliMpPad pad = segm.PadByIndices(AliMpIntPair(i,j)); - MarkPads(AliMpNeighboursPadIterator(&AliMpSectorSegmentation(sect),pad) + MarkPads(AliMpNeighboursPadIterator(&AliMpSectorSegmentation(sector),pad) ,i+8,j+8); cout<<"________________ Neighbours __________________________"<cd(4); Int_t motifPosId = 20; if (plane == kNonBendingPlane) motifPosId = 19; - AliMpMotifPosition* motifPos = sect->GetMotifMap()->FindMotifPosition(motifPosId); + AliMpMotifPosition* motifPos = sector->GetMotifMap()->FindMotifPosition(motifPosId); if (motifPos){ //MarkPads(*AliMpPadIteratorPtr(motifPos->CreateIterator()),15,15); MarkPads(AliMpMotifPositionPadIterator(motifPos),15,15); diff --git a/MUON/mapping/macros/testExistingPads.C b/MUON/mapping/macros/testExistingPads.C index a940f057d4a..f215f9ba7b5 100644 --- a/MUON/mapping/macros/testExistingPads.C +++ b/MUON/mapping/macros/testExistingPads.C @@ -1,13 +1,25 @@ // $Id$ -// $MpId: testExistingPads.C,v 1.10 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testExistingPads.C,v 1.11 2005/09/26 16:05:25 ivana Exp $ // // Test macro for testing which pad is seen as "existing" by AliMpSector. void testExistingPads(AliMpStationType station = kStation1, - AliMpPlaneType plane = kBendingPlane) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false) { - AliMpSectorReader r(station, plane); - AliMpSector *sector=r.BuildSector(); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + sector=r.BuildSector(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); + } + AliMpSectorSegmentation segmentation(sector); AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector); diff --git a/MUON/mapping/macros/testGraphics.C b/MUON/mapping/macros/testGraphics.C index a57ab9e3ce8..28e0a9c02e4 100644 --- a/MUON/mapping/macros/testGraphics.C +++ b/MUON/mapping/macros/testGraphics.C @@ -1,13 +1,25 @@ // $Id$ -// $MpId: testGraphics.C,v 1.11 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testGraphics.C,v 1.12 2005/09/26 16:05:25 ivana Exp $ // // Test macro for drawing sector data. void testGraphics(AliMpStationType station = kStation1, - AliMpPlaneType plane = kBendingPlane) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false) { - AliMpSectorReader r(station, plane); - AliMpSector *sector=r.BuildSector(); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + sector=r.BuildSector(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); + } + AliMpVPainter *painter=AliMpVPainter::CreatePainter(sector); TCanvas* canvas = new TCanvas(); diff --git a/MUON/mapping/macros/testIndicesLimits.C b/MUON/mapping/macros/testIndicesLimits.C index e69425cc96d..41c3fa80ba1 100644 --- a/MUON/mapping/macros/testIndicesLimits.C +++ b/MUON/mapping/macros/testIndicesLimits.C @@ -1,16 +1,24 @@ // $Id$ -// $MpId: testIndicesLimits.C,v 1.3 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testIndicesLimits.C,v 1.4 2005/09/26 16:05:25 ivana Exp $ // // Test macro for indices limits. void testIndicesLimits(AliMpStationType station = kStation1, - AliMpPlaneType plane = kBendingPlane) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false) { - AliMpSectorReader reader(station, plane); - //reader.SetVerboseLevel(1); - - // Read data - AliMpSector* sector = reader.BuildSector(); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + sector=r.BuildSector(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); + } // Loop over rows for (Int_t i=0; iGetNofRows(); i++) { diff --git a/MUON/mapping/macros/testMotifTypeIterators.C b/MUON/mapping/macros/testMotifTypeIterators.C index 4480f0fdd55..2c2d998d1e5 100644 --- a/MUON/mapping/macros/testMotifTypeIterators.C +++ b/MUON/mapping/macros/testMotifTypeIterators.C @@ -1,10 +1,11 @@ // $Id$ -// $MpId: testMotifTypeIterators.C,v 1.10 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testMotifTypeIterators.C,v 1.11 2005/09/26 16:05:25 ivana Exp $ // // Test macro for reading motif type data and iterate over them. void testMotifTypeIterators(AliMpStationType station = kStation1, - AliMpPlaneType plane = kBendingPlane) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false) { TString names; TString names2; diff --git a/MUON/mapping/macros/testNeighboursPadIterator.C b/MUON/mapping/macros/testNeighboursPadIterator.C index 44cd2a5e3d2..7a8146e4225 100644 --- a/MUON/mapping/macros/testNeighboursPadIterator.C +++ b/MUON/mapping/macros/testNeighboursPadIterator.C @@ -1,19 +1,26 @@ // $Id$ -// $MpId: testNeighboursPadIterator.C,v 1.8 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testNeighboursPadIterator.C,v 1.9 2005/09/26 16:05:25 ivana Exp $ // // Test macro for reading sector, and iterate over it void testNeighboursPadIterator(AliMpStationType station = kStation1, AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false, Int_t i=50, Int_t j=50) { - if (!gInterpreter->IsLoaded("mlibs.C")){ - gROOT->LoadMacro("mlibs.C"); - gInterpreter->ProcessLine("mlibs()"); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + sector=r.BuildSector(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); } - AliMpSectorReader r(station, plane); - AliMpSector* sect = r.BuildSector(); AliMpSectorSegmentation segm(sect); TCanvas *can = new TCanvas("canv"); diff --git a/MUON/mapping/macros/testPadDimensions.C b/MUON/mapping/macros/testPadDimensions.C index 1c7dba9691c..31638d34e41 100644 --- a/MUON/mapping/macros/testPadDimensions.C +++ b/MUON/mapping/macros/testPadDimensions.C @@ -1,14 +1,26 @@ // $Id$ -// $MpId: testPadDimensions.C,v 1.4 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testPadDimensions.C,v 1.5 2005/09/26 16:05:25 ivana Exp $ // // Test macro for testing retrieving of pad dimensions from // the map in AliMpSectorSegmentation. void testPadDimensions(AliMpStationType station = kStation1, - AliMpPlaneType plane = kBendingPlane) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false) { - AliMpSectorReader r(station, plane); - AliMpSector* sector=r.BuildSector(); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + sector=r.BuildSector(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); + } + AliMpSectorSegmentation segmentation(sector); segmentation.PrintZones(); diff --git a/MUON/mapping/macros/testPadsUpEtc.C b/MUON/mapping/macros/testPadsUpEtc.C index ac19b54340f..b8b071e2652 100644 --- a/MUON/mapping/macros/testPadsUpEtc.C +++ b/MUON/mapping/macros/testPadsUpEtc.C @@ -1,19 +1,31 @@ // $Id$ -// $MpId: testPadsUpEtc.C,v 1.6 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testPadsUpEtc.C,v 1.7 2005/09/26 16:05:25 ivana Exp $ // // Test macro that starts from a given pad and prints // all pads up, down, right, left from this pad // (up to the plane border). void testPadsUpEtc(AliMpStationType station = kStation1, - AliMpPlaneType planeType = kBendingPlane) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false) { - AliMpSectorReader reader(station, planeType); - AliMpSector* sector = reader.BuildSector(); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + sector=r.BuildSector(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); + } + AliMpSectorSegmentation segmentation(sector); AliMpIntPair indices(85, 101); - if( planeType == kNonBendingPlane) indices = AliMpIntPair(129, 10); + if( plane == kNonBendingPlane) indices = AliMpIntPair(129, 10); AliMpPad pad; if (segmentation.HasPad(indices)) { diff --git a/MUON/mapping/macros/testPrintLimits.C b/MUON/mapping/macros/testPrintLimits.C index 50f88f201fa..f14163d2280 100644 --- a/MUON/mapping/macros/testPrintLimits.C +++ b/MUON/mapping/macros/testPrintLimits.C @@ -1,15 +1,26 @@ // $Id$ -// $MpId: testPrintLimits.C,v 1.7 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testPrintLimits.C,v 1.8 2005/09/26 16:05:25 ivana Exp $ // // Test macro for making an output file, where all mapping elements // indices & positions are written. void testPrintLimits(AliMpStationType station = kStation1, - AliMpPlaneType plane = kBendingPlane, ostream& out=cout) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false, + ostream& out=cout) { - AliMpSectorReader r(station, plane); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + sector=r.BuildSector(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); - AliMpSector *sector=r.BuildSector(); + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); + } AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector); painter->Draw("ZSSMP"); diff --git a/MUON/mapping/macros/testReadMotifType.C b/MUON/mapping/macros/testReadMotifType.C index b8e9261b602..bdf743f28e7 100644 --- a/MUON/mapping/macros/testReadMotifType.C +++ b/MUON/mapping/macros/testReadMotifType.C @@ -1,10 +1,11 @@ // $Id$ -// $MpId: testReadMotifType.C,v 1.11 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testReadMotifType.C,v 1.12 2005/09/26 16:05:25 ivana Exp $ // // Test macro for reading motif type data. void testReadMotifType(AliMpStationType station = kStation1, - AliMpPlaneType plane = kBendingPlane) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false) { AliMpMotifReader r(station, plane); //r.SetVerboseLevel(2); diff --git a/MUON/mapping/macros/testReadSector.C b/MUON/mapping/macros/testReadSector.C index c186d84359b..35059c7c3bc 100644 --- a/MUON/mapping/macros/testReadSector.C +++ b/MUON/mapping/macros/testReadSector.C @@ -1,19 +1,36 @@ // $Id$ -// $MpId: testReadSector.C,v 1.13 2005/09/02 10:57:47 ivana Exp $ +// $MpId: testReadSector.C,v 1.14 2005/09/26 16:04:07 ivana Exp $ // // Test macro for reading sector data. #include void testReadSector(AliMpStationType station = kStation1, - AliMpPlaneType plane = kBendingPlane) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false) { - AliMpSectorReader reader(station, plane); - //reader.SetVerboseLevel(1); - - // Read data - AliMpSector* sector = reader.BuildSector(); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + //reader.SetVerboseLevel(1); + sector=r.BuildSector(); + + // Write sector on Root file + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + TFile f(filePath.Data(), "RECREATE"); + sector->Write(); + f.Close(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); + } + cout << endl; // Sector geometry diff --git a/MUON/mapping/macros/testSectorAreaIterator.C b/MUON/mapping/macros/testSectorAreaIterator.C index f7f593b764d..e2176ff56d7 100644 --- a/MUON/mapping/macros/testSectorAreaIterator.C +++ b/MUON/mapping/macros/testSectorAreaIterator.C @@ -1,5 +1,5 @@ // $Id$ -// $MpId: testSectorAreaIterator.C,v 1.3 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testSectorAreaIterator.C,v 1.4 2005/09/26 16:05:25 ivana Exp $ // // Test macro for iterating over the whole sector @@ -48,10 +48,22 @@ void MarkPads(AliMpVPadIterator& it, Double_t xmax, Double_t ymax, } void testSectorAreaIterator(AliMpStationType station = kStation1, - AliMpPlaneType planeType = kBendingPlane) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false) { - AliMpSectorReader reader(station, planeType); - AliMpSector* sector = reader.BuildSector(); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + sector=r.BuildSector(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); + } + AliMpSectorSegmentation segmentation(sector); AliMpArea area; diff --git a/MUON/mapping/macros/testSectorFind.C b/MUON/mapping/macros/testSectorFind.C index 85717627441..785685a5a3e 100644 --- a/MUON/mapping/macros/testSectorFind.C +++ b/MUON/mapping/macros/testSectorFind.C @@ -1,15 +1,26 @@ // $Id$ -// $MpId: testSectorFind.C,v 1.8 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testSectorFind.C,v 1.9 2005/09/26 16:05:25 ivana Exp $ // // Test macro for which verify that all FindPosition, FindIndices // and FindLocation methods are consistents between them. void testSectorFind(AliMpStationType station = kStation1, - AliMpPlaneType plane = kBendingPlane) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false) { - AliMpSectorReader r(station, plane); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + sector=r.BuildSector(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); + } - AliMpSector *sector=r.BuildSector(); AliMpSectorSegmentation segmentation(sector); AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector); painter->Draw("ZSSMP"); diff --git a/MUON/mapping/macros/testSectorPadIterators.C b/MUON/mapping/macros/testSectorPadIterators.C index a0422754d55..feea8b63554 100644 --- a/MUON/mapping/macros/testSectorPadIterators.C +++ b/MUON/mapping/macros/testSectorPadIterators.C @@ -1,13 +1,24 @@ // $Id$ -// $MpId: testSectorPadIterators.C,v 1.7 2005/08/24 08:53:27 ivana Exp $ +// $MpId: testSectorPadIterators.C,v 1.8 2005/09/26 16:05:25 ivana Exp $ // // Test macro for reading sector, and iterate over it void testSectorPadIterators(AliMpStationType station = kStation1, - AliMpPlaneType plane = kBendingPlane) + AliMpPlaneType plane = kBendingPlane, + Bool_t rootInput = false) { - AliMpSectorReader r(station, plane); - AliMpSector* sect = r.BuildSector(); + AliMpSector *sector = 0; + if (!rootInput) { + AliMpSectorReader r(station, plane); + sector=r.BuildSector(); + } + else { + TString filePath = AliMpFiles::Instance()->SectorFilePath(station,plane); + filePath.ReplaceAll("zones.dat", "sector.root"); + + TFile f(filePath.Data(), "READ"); + sector = (AliMpSector*)f.Get("Sector"); + } Int_t num=0; @@ -16,7 +27,7 @@ void testSectorPadIterators(AliMpStationType station = kStation1, const Double_t xmax=150; const Double_t ymax=250; - AliMpSectorPadIterator it = AliMpSectorPadIterator(sect); + AliMpSectorPadIterator it = AliMpSectorPadIterator(sector); for (it.First(); ! it.IsDone(); it.Next()) { AliMpIntPair indices = it.CurrentItem().GetIndices(); @@ -27,5 +38,5 @@ void testSectorPadIterators(AliMpStationType station = kStation1, marker->Draw(); } - delete sect; + delete sector; }