--- /dev/null
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+
+// $Id$
+
+///
+/// \class AliMUONContourHandler
+///
+/// Class used to create contours of the muon tracker parts :
+/// manu, bus patches, detection elements, chambers.
+///
+/// \author Laurent Aphecetche, Subatech
+///
+
+#include "AliMUONContourHandler.h"
+
+#include "AliCodeTimer.h"
+#include "AliLog.h"
+#include "AliMUONContour.h"
+#include "AliMUONContourMaker.h"
+#include "AliMUONGeometryDetElement.h"
+#include "AliMUONGeometryTransformer.h"
+#include "AliMUONManuContourMaker.h"
+#include "AliMUONPolygon.h"
+#include "AliMUONSegment.h"
+#include "AliMpArea.h"
+#include "AliMpCDB.h"
+#include "AliMpDDLStore.h"
+#include "AliMpDEManager.h"
+#include "AliMpExMap.h"
+#include <float.h>
+#include "Riostream.h"
+#include "TArrow.h"
+#include "TCanvas.h"
+#include "TFile.h"
+#include "TGeoMatrix.h"
+#include "TLine.h"
+#include "TObjArray.h"
+#include "TPolyLine.h"
+#include "TSystem.h"
+
+///\cond CLASSIMP
+ClassImp(AliMUONContourHandler)
+///\endcond
+
+//_____________________________________________________________________________
+AliMUONContourHandler::AliMUONContourHandler(Bool_t explodedView)
+: TObject(),
+fTransformations(0x0),
+fAllContourMap(0x0),
+fAllContourArray(0x0)
+{
+ /// ctor. If explodedView=kTRUE, we generate views that will look
+ /// fine in 2D (i.e. won't show overlaps of DE as in reality)
+ /// Use kFALSE if you want realistic geometry, though.
+ ///
+ /// IMPORTANT : as we many MUON classes, this one cannot work
+ /// before you've loaded the mapping in memory (see e.g. AliMpCDB::LoadDDLStore)
+ ///
+
+ fTransformations = GenerateTransformations(explodedView);
+ AliMUONManuContourMaker manuMaker(fTransformations);
+ TObjArray* manus = manuMaker.GenerateManuContours(kTRUE);
+ if (manus)
+ {
+ manus->SetOwner(kFALSE);
+ GenerateAllContours(*manus);
+ }
+ delete manus;
+}
+
+//_____________________________________________________________________________
+AliMUONContourHandler::~AliMUONContourHandler()
+{
+ /// Dtor
+ delete fAllContourMap;
+ delete fAllContourArray;
+}
+
+//______________________________________________________________________________
+Bool_t
+AliMUONContourHandler::Adopt(AliMUONContour* contour)
+{
+ /// Adopt the given contour
+ if ( GetContour(contour->GetName()) )
+ {
+ // contour already exists
+ return kFALSE;
+ }
+ fAllContourMap->Add(new TObjString(contour->GetName()),contour);
+ return kTRUE;
+}
+
+//______________________________________________________________________________
+TObjArray*
+AliMUONContourHandler::CreateContourList(const TObjArray& manuContours)
+{
+ /// Create an array of maps of contour names
+ ///
+ /// Assyming that key is something like station#/chamber#/de#/buspatch#/manu#
+ /// the idea here is to put one TMap for each level in mapArray :
+ ///
+ /// mapArray[0].key = station0
+ /// mapArray[0].value = map of strings { station0/chamber0, station0/chamber1 }
+ ///
+ /// Then each entry in mapArray will be converted into a contour by
+ /// merging its children (e.g. station0 contour will be made from the merging
+ /// of station0/chamber0 and station0/chamber1 in the example above).
+ ///
+
+ AliCodeTimerAuto("");
+
+ TIter next(&manuContours);
+ AliMUONContour* contour;
+ TObjArray* mapArray = new TObjArray;
+
+ while ( ( contour = static_cast<AliMUONContour*>(next()) ) )
+ {
+ // Key is something like station#/chamber#/de#/buspatch#/manu#
+
+ TString key(contour->GetName());
+ TObjArray* s = key.Tokenize("/");
+ for ( Int_t i = 0; i < s->GetLast(); ++i )
+ {
+ TMap* m = static_cast<TMap*>(mapArray->At(i));
+ if (!m)
+ {
+ m = new TMap;
+ if ( i > mapArray->GetSize() ) mapArray->Expand(i);
+ mapArray->AddAt(m,i);
+ }
+ TString parent;
+ for ( Int_t k = 0; k <= i; ++k )
+ {
+ TObjString* str = static_cast<TObjString*>(s->At(k));
+ parent += str->String();
+ if ( k < i ) parent += "/";
+ }
+ TString child(parent);
+ child += "/";
+ child += static_cast<TObjString*>(s->At(i+1))->String();
+
+ TObjArray* ma = static_cast<TObjArray*>(m->GetValue(parent.Data()));
+ if (!ma)
+ {
+ ma = new TObjArray;
+ m->Add(new TObjString(parent.Data()),ma);
+ }
+ TPair* p = static_cast<TPair*>(ma->FindObject(child.Data()));
+ if ( !p )
+ {
+ ma->Add(new TObjString(child.Data()));
+ }
+ }
+ delete s;
+ }
+
+ return mapArray;
+}
+
+//______________________________________________________________________________
+void
+AliMUONContourHandler::GenerateAllContours(const TObjArray& manuContours)
+{
+ /// From a map of manu contours, generate the compound contours (bp, de, etc...)
+ /// by merging them.
+ /// Note that manuContours should NOT be the owner of its contours,
+ /// as they are adopted by the array returned by this method.
+
+ AliCodeTimerAuto("");
+
+ // Get the list of contours to create
+ TObjArray* mapArray = CreateContourList(manuContours);
+
+ // Now loop over the mapArray to actually create the contours
+ TIter next2(mapArray,kIterBackward);
+
+ fAllContourMap = new TMap(20000,1);
+ fAllContourMap->SetOwnerKeyValue(kTRUE,kTRUE);
+
+ fAllContourArray = new TObjArray;
+ fAllContourArray->SetOwner(kFALSE); // the map is the real owner of the contours
+
+ TIter nextContour(&manuContours);
+ AliMUONContour* contour(0x0);
+
+ // start by adding the manu contours we begin with
+ while ( ( contour = static_cast<AliMUONContour*>(nextContour()) ) )
+ {
+ fAllContourMap->Add(new TObjString(contour->GetName()),contour);
+ }
+
+ AliMUONContourMaker maker;
+
+ for ( Int_t i = mapArray->GetLast(); i >= 1; --i )
+ // end at 1 to avoid merging different cathodes together, which
+ // would not work...
+ {
+ TMap* a = static_cast<TMap*>(mapArray->At(i));
+ TIter next3(a);
+ TObjString* str;
+ while ( ( str = static_cast<TObjString*>(next3()) ) )
+ {
+ TObjArray* m = static_cast<TObjArray*>(a->GetValue(str->String().Data()));
+ TIter next4(m);
+ TObjString* k;
+ TObjArray subcontours;
+ subcontours.SetOwner(kFALSE);
+ while ( ( k = static_cast<TObjString*>(next4()) ) )
+ {
+ contour = static_cast<AliMUONContour*>(fAllContourMap->GetValue(k->String().Data()));
+ if ( contour )
+ {
+ subcontours.Add(contour);
+ }
+ else
+ {
+ AliError(Form("Did not find contour %s",k->String().Data()))
+ continue;
+ }
+ }
+
+ contour = maker.MergeContour(subcontours,str->String().Data());
+
+ bool error(kFALSE);
+
+ if (!contour)
+ {
+ error=kTRUE;
+ AliError(Form("ERROR : could not merge into %s",str->String().Data()));
+ }
+ else
+ {
+ if ( contour->Area().IsValid() == kFALSE )
+ {
+ error=kTRUE;
+ AliError(Form("ERROR : area of contour %s is invalid",str->String().Data()));
+ }
+ }
+
+ if (!error)
+ {
+ fAllContourMap->Add(new TObjString(str->String().Data()),contour);
+ fAllContourArray->Add(contour);
+ }
+ }
+ }
+}
+
+//_____________________________________________________________________________
+AliMpExMap*
+AliMUONContourHandler::GenerateTransformations(Bool_t exploded)
+{
+ /// Generate geometric transformations to be used to compute the contours
+ /// If exploded=kFALSE then we generate real transformations, otherwise
+ /// we generate tweaked ones that look fine on screen.
+
+ AliCodeTimerAuto("");
+
+ AliMUONGeometryTransformer transformer;
+ Bool_t ok = transformer.LoadGeometryData("transform.dat");
+ // transformer.LoadGeometryData("geometry.root"); //FIXME: add a protection if geometry.root file does not exist
+ if (!ok)
+ {
+ cout << "ERROR : cannot get geometry !" << endl;
+ return 0x0;
+ }
+ AliMpExMap* transformations = new AliMpExMap;
+ AliMpDEIterator deIt;
+ deIt.First();
+ while ( !deIt.IsDone() )
+ {
+ Int_t detElemId = deIt.CurrentDEId();
+ const AliMUONGeometryDetElement* de = transformer.GetDetElement(detElemId);
+
+ TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(de->GetGlobalTransformation()->Clone());
+
+ if (exploded)
+ {
+ Double_t* translation = matrix->GetTranslation();
+ Double_t xscale = 1.0;
+ Double_t yscale = 1.5;
+ Double_t shift = 5.0; // cm
+
+ if ( AliMpDEManager::GetStationType(detElemId) == AliMp::kStation345 )
+ {
+ translation[0] *= xscale;
+ translation[1] *= yscale;
+ }
+ else
+ {
+ Double_t xshift[] = { shift, -shift, -shift, shift };
+ Double_t yshift[] = { shift, shift, -shift, -shift };
+ Int_t ishift = detElemId % 100;
+
+ translation[0] += xshift[ishift];
+ translation[1] += yshift[ishift];
+ }
+ matrix->SetTranslation(translation);
+ }
+ transformations->Add(detElemId,matrix);
+ deIt.Next();
+ }
+ return transformations;
+}
+
+//_____________________________________________________________________________
+AliMUONContour*
+AliMUONContourHandler::GetContour(const char* contourname) const
+{
+ /// Get a given contour
+ return static_cast<AliMUONContour*>(fAllContourMap->GetValue(contourname));
+}
+
+//_____________________________________________________________________________
+void
+AliMUONContourHandler::Print(Option_t* opt) const
+{
+ /// printout
+
+ if ( fAllContourMap )
+ {
+ cout << Form("Contour map : collisions = %5.3f size = %d capacity = %d",
+ fAllContourMap->AverageCollisions(),
+ fAllContourMap->GetSize(),
+ fAllContourMap->Capacity()) << endl;
+ }
+}
--- /dev/null
+#ifndef ALIMUONCONTOURHANDLER_H
+#define ALIMUONCONTOURHANDLER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice */
+
+// $Id$
+
+/// \ingroup graphics
+/// \class AliMUONContourHandler
+/// \brief Holder for MUON tracker contours
+///
+/// \author Laurent Aphecetche
+
+#ifndef ROOT_TObject
+# include "TObject.h"
+#endif
+
+class TObjArray;
+class AliMpExMap;
+class TMap;
+class AliMUONContour;
+
+class AliMUONContourHandler : public TObject
+{
+public:
+ AliMUONContourHandler(Bool_t explodedView=kTRUE);
+ virtual ~AliMUONContourHandler();
+
+ Bool_t Adopt(AliMUONContour* contour);
+
+ TMap* AllContourMap() const { return fAllContourMap; }
+
+ TObjArray* AllContourArray() const { return fAllContourArray; }
+
+ AliMUONContour* GetContour(const char* contourname) const;
+
+ AliMpExMap* GetTransformations() const { return fTransformations; }
+
+ void Print(Option_t* opt="") const;
+
+private:
+
+ AliMUONContourHandler(const AliMUONContourHandler& rhs);
+ AliMUONContourHandler& operator=(const AliMUONContourHandler& rhs);
+
+ AliMpExMap* GenerateTransformations(Bool_t exploded);
+
+ TObjArray* CreateContourList(const TObjArray& manuContours);
+
+ void GenerateAllContours(const TObjArray& manuContours);
+
+private:
+ AliMpExMap* fTransformations; //< transformations used to go from local to global coordinates
+ TMap* fAllContourMap; //< all (i.e. manus, buspatches, detection elements, etc..) contours
+ TObjArray* fAllContourArray; //< all contours, ordered by hierarchy level
+
+ ClassDef(AliMUONContourHandler,1) // MUON tracker contour holder
+};
+
+#endif
#include "TArrayD.h"
#include "TMath.h"
#include <cassert>
+#include "TArrayI.h"
/// \cond CLASSIMP
ClassImp(AliMUONContourMaker)
all.Add(verticals.UncheckedAt(i));
all.Add(horizontals.UncheckedAt(i));
}
+
+ TArrayI alreadyAdded(all.GetLast()+1);
+ alreadyAdded.Reset();
Int_t i(0);
AliMUONSegment* si = static_cast<AliMUONSegment*>(all.UncheckedAt(i));
inorder.Add(si);
+ alreadyAdded[i] = 1;
const AliMUONSegment* all0 = static_cast<const AliMUONSegment*>(all.First());
if ( i != 0 && AliMUONSegment::AreEqual(si->EndX(),all0->StartX()) && AliMUONSegment::AreEqual(si->EndY(),all0->StartY()) )
{
{
i = 0;
inorder.Clear();
+ alreadyAdded.Set(all.GetLast()+1);
+ alreadyAdded.Reset();
}
continue;
}
for ( Int_t j = 0; j <= all.GetLast(); ++j)
{
- if ( j != i )
+ if ( j != i && alreadyAdded[j] == 0 )
{
const AliMUONSegment* sj = static_cast<const AliMUONSegment*>(all.UncheckedAt(j));
if ( AliMUONSegment::AreEqual(si->EndX(),sj->StartX()) && AliMUONSegment::AreEqual(si->EndY(),sj->StartY()))
#include "AliCodeTimer.h"
#include "AliLog.h"
#include "AliMUONContour.h"
-#include "AliMUONContourMaker.h"
-#include "AliMUONGeometryDetElement.h"
-#include "AliMUONGeometryTransformer.h"
-#include "AliMUONManuContourMaker.h"
#include "AliMUONPolygon.h"
#include "AliMUONSegment.h"
-#include "AliMpArea.h"
+#include "AliMUONContourHandler.h"
#include "AliMpCDB.h"
#include "AliMpDDLStore.h"
-#include "AliMpDEManager.h"
#include "AliMpExMap.h"
#include <float.h>
#include "Riostream.h"
#include "TFile.h"
#include "TGeoMatrix.h"
#include "TLine.h"
+#include "TMap.h"
#include "TObjArray.h"
#include "TPolyLine.h"
#include "TSystem.h"
}
-//______________________________________________________________________________
-TObjArray*
-AliMUONContourMakerTest::CreateContourList(const TObjArray& manuContours)
-{
- /// Create an array of maps of contour names
- ///
- /// Assyming that key is something like station#/chamber#/de#/buspatch#/manu#
- /// the idea here is to put one TMap for each level in mapArray :
- ///
- /// mapArray[0].key = station0
- /// mapArray[0].value = map of strings { station0/chamber0, station0/chamber1 }
- ///
- /// Then each entry in mapArray will be converted into a contour by
- /// merging its children (e.g. station0 contour will be made from the merging
- /// of station0/chamber0 and station0/chamber1 in the example above).
- ///
-
- AliCodeTimerAuto("");
-
- TIter next(&manuContours);
- AliMUONContour* contour;
- TObjArray* mapArray = new TObjArray;
-
- while ( ( contour = static_cast<AliMUONContour*>(next()) ) )
- {
- // Key is something like station#/chamber#/de#/buspatch#/manu#
-
- TString key(contour->GetName());
- TObjArray* s = key.Tokenize("/");
- for ( Int_t i = 0; i < s->GetLast(); ++i )
- {
- TMap* m = static_cast<TMap*>(mapArray->At(i));
- if (!m)
- {
- m = new TMap;
- if ( i > mapArray->GetSize() ) mapArray->Expand(i);
- mapArray->AddAt(m,i);
- }
- TString parent;
- for ( Int_t k = 0; k <= i; ++k )
- {
- TObjString* str = static_cast<TObjString*>(s->At(k));
- parent += str->String();
- if ( k < i ) parent += "/";
- }
- TString child(parent);
- child += "/";
- child += static_cast<TObjString*>(s->At(i+1))->String();
-
- TObjArray* ma = static_cast<TObjArray*>(m->GetValue(parent.Data()));
- if (!ma)
- {
- ma = new TObjArray;
- m->Add(new TObjString(parent.Data()),ma);
- }
- TPair* p = static_cast<TPair*>(ma->FindObject(child.Data()));
- if ( !p )
- {
- ma->Add(new TObjString(child.Data()));
- }
- }
- delete s;
- }
-
- return mapArray;
-}
-
//_____________________________________________________________________________
void
AliMUONContourMakerTest::Exec(const Option_t* opt)
AliCodeTimer::Instance()->Reset();
AliCodeTimerAuto("");
-
- AliMpExMap* real(0x0);
- AliMpExMap* exploded(0x0);
-
- GenerateTransformations(real,exploded);
-
- TObjArray* manus(0x0);
- TObjArray* all(0x0);
-
- TString sopt(opt);
-
- if ( sopt.Contains("MANU") || sopt.Contains("ALL") )
- {
- AliMUONManuContourMaker manuMaker(exploded);
- manus = manuMaker.GenerateManuContours(kTRUE);
- }
-
- if ( sopt.Contains("ALL") && manus )
- {
- manus->SetOwner(kFALSE);
- all = GenerateAllContours(*manus);
- if ( sopt.Contains("SAVE") && all )
- {
- TFile f("AliMUONContourMakerTest.all.root","RECREATE");
- all->Write("ALL",TObject::kSingleKey);
- f.Close();
- }
-
- }
-
- AliCodeTimer::Instance()->Print();
-
- delete manus;
- delete all;
-}
-//______________________________________________________________________________
-TObjArray*
-AliMUONContourMakerTest::GenerateAllContours(const TObjArray& manuContours)
-{
- /// From a map of manu contours, generate the compound contours (bp, de, etc...)
- /// by merging them.
- /// Note that manuContours should NOT be the owner of its contours,
- /// as they are adopted by the array returned by this method.
+ TString sopt(opt);
- AliCodeTimerAuto("");
+ Bool_t explodedView(kTRUE);
- // Get the list of contours to create
- TObjArray* mapArray = CreateContourList(manuContours);
+ if (sopt.Contains("REAL")) explodedView = kFALSE;
- // Now loop over the mapArray to actually create the contours
- TIter next2(mapArray,kIterBackward);
-
- TMap allContourMap;
- allContourMap.SetOwnerKeyValue(kTRUE,kFALSE); // not owner of contours, as the returned array will be the owner
- TObjArray* allContourArray = new TObjArray;
- allContourArray->SetOwner(kTRUE);
-
- TIter nextContour(&manuContours);
- AliMUONContour* contour(0x0);
+ AliMUONContourHandler ch(explodedView);
- while ( ( contour = static_cast<AliMUONContour*>(nextContour()) ) )
+ if ( sopt.Contains("SAVE") )
{
- allContourMap.Add(new TObjString(contour->GetName()),contour);
- allContourArray->Add(contour);
+ TFile f2("AliMUONContourMakerTest.manuContours.root","RECREATE");
+ ch.AllContourMap()->Write("ALL",TObject::kSingleKey);
+ f2.Close();
}
-
- AliMUONContourMaker maker;
-
- for ( Int_t i = mapArray->GetLast(); i >= 1; --i )
- // end at 1 to avoid merging different cathodes together, which
- // would not work...
- {
- TMap* a = static_cast<TMap*>(mapArray->At(i));
- TIter next3(a);
- TObjString* str;
- while ( ( str = static_cast<TObjString*>(next3()) ) )
- {
- TObjArray* m = static_cast<TObjArray*>(a->GetValue(str->String().Data()));
- TIter next4(m);
- TObjString* k;
- TObjArray subcontours;
- subcontours.SetOwner(kFALSE);
- while ( ( k = static_cast<TObjString*>(next4()) ) )
- {
- contour = static_cast<AliMUONContour*>(allContourMap.GetValue(k->String().Data()));
- if ( contour )
- {
- subcontours.Add(contour);
- }
- else
- {
- AliError(Form("Did not find contour %s",k->String().Data()))
- return allContourArray;
- }
- }
- contour = maker.MergeContour(subcontours,str->String().Data());
-
- bool error(kFALSE);
-
- if (!contour)
- {
- error=kTRUE;
- AliError(Form("ERROR : could not merge into %s",str->String().Data()));
- }
- else
- {
- if ( contour->Area().IsValid() == kFALSE )
- {
- error=kTRUE;
- AliError(Form("ERROR : area of contour %s is invalid",str->String().Data()));
- }
- }
-
- if ( error )
- {
- // do it again, but get intermediate results to plot them
- PrintAsPNG(str->String().Data(),subcontours);
- if (contour )
- {
- StdoutToAliError(contour->Area().Print("B"););
- }
- AliError(Form("%d subcontours",subcontours.GetLast()+1));
- StdoutToAliError(subcontours.Print(););
- // check whether one of the subcontour itself is already invalid ?
- TIter next(&subcontours);
- AliMUONContour* cont;
- while ( ( cont = static_cast<AliMUONContour*>(next()) ) )
- {
- if (!cont->IsValid())
- {
- AliError(Form("subcontour %s is invalid",cont->GetName()));
- }
- }
- TFile f("subcontour.root","recreate");
- subcontours.Write("fault",TObject::kSingleKey);
- f.Close();
-
- return allContourArray;
- }
-
- allContourArray->Add(contour);
- allContourMap.Add(new TObjString(str->String().Data()),contour);
- }
- }
-
- return allContourArray;
+ AliCodeTimer::Instance()->Print();
}
-//_____________________________________________________________________________
-void
-AliMUONContourMakerTest::GenerateTransformations(AliMpExMap*& real, AliMpExMap*& exploded)
-{
- /// Generate geometric transformations to be used to compute the contours
- /// (real are, as the name implies, real ones, while the other ones are
- /// a bit tweaked to look fine on screen).
-
- AliCodeTimerAuto("");
-
- AliMUONGeometryTransformer transformer;
- Bool_t ok = transformer.LoadGeometryData("transform.dat");
- // transformer.LoadGeometryData("geometry.root"); //FIXME: add a protection if geometry.root file does not exist
- if (!ok)
- {
- cout << "ERROR : cannot get geometry !" << endl;
- return;
- }
- real = new AliMpExMap;
- exploded = new AliMpExMap;
- AliMpDEIterator deIt;
- deIt.First();
- while ( !deIt.IsDone() )
- {
- Int_t detElemId = deIt.CurrentDEId();
- const AliMUONGeometryDetElement* de = transformer.GetDetElement(detElemId);
-
- real->Add(detElemId,de->GetGlobalTransformation()->Clone());
-
- TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(de->GetGlobalTransformation()->Clone());
- Double_t* translation = matrix->GetTranslation();
-
- if ( AliMpDEManager::GetStationType(detElemId) == AliMp::kStation345 )
- {
- translation[0] *= 1.0;
- translation[1] *= 1.5;
- }
- else
- {
- Double_t shift = 5; // cm
- Double_t xshift[] = { shift, -shift, -shift, shift };
- Double_t yshift[] = { shift, shift, -shift, -shift };
- Int_t ishift = detElemId % 100;
-
- translation[0] += xshift[ishift];
- translation[1] += yshift[ishift];
- }
- matrix->SetTranslation(translation);
- exploded->Add(detElemId,matrix);
- deIt.Next();
- }
-}
//_____________________________________________________________________________
void
private:
- TObjArray* CreateContourList(const TObjArray& manuContours);
-
- TObjArray* GenerateAllContours(const TObjArray& manuContours);
-
- void GenerateTransformations(AliMpExMap*& real, AliMpExMap*& exploded);
+ TString NameIt(const AliMpMotifPosition& motifPosition) const;
ClassDef(AliMUONContourMakerTest,1) // Test of AliMUONContourMaker
};
#include "AliMpSector.h"
#include "AliMpSlat.h"
#include "AliLog.h"
+#include <TMap.h>
#include <TObjString.h>
+#include "AliMUONPainterGroup.h"
/// \class AliMUONDEPainter
///
return norm;
}
+//_____________________________________________________________________________
+void
+AliMUONDEPainter::SetResponder(Int_t depth)
+{
+ /// Select as responder the *first* group that has a given depth
+
+ AliDebug(1,Form("depth=%d",depth));
+
+ if (!fPainterGroups)
+ {
+ CreateGroups();
+ }
+
+ TIter next(fPainterGroups);
+ TObjString* str;
+
+ fResponderGroup = 0x0;
+
+ while ( ( str = static_cast<TObjString*>(next()) ) )
+ {
+ AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
+ if ( str->String() == "BUSPATCH" )
+ {
+ AliDebug(1,Form("group %s is indeed buspatch, using as responder",
+ group->Type(),depth));
+ group->SetResponder(kTRUE);
+ fResponderGroup = group;
+ break;
+ }
+ else
+ {
+ group->SetResponder(kFALSE);
+ }
+ }
+}
+
virtual Bool_t IsIncluded() const;
+ using AliMUONVPainter::SetResponder;
+
+ virtual void SetResponder(Int_t depth);
+
private:
Int_t fDetElemId; ///< our id
#include "AliMUONManuPainter.h"
-#include "AliMUONManuPadPainter.h"
+#include "AliLog.h"
#include "AliMUONContour.h"
+#include "AliMUONManuContourMaker.h"
+#include "AliMUONManuPadPainter.h"
#include "AliMUONPainterHelper.h"
#include "AliMUONVCalibParam.h"
#include "AliMUONVDigit.h"
#include "AliMpStationType.h"
#include "AliMpVMotif.h"
#include "AliMpVPadIterator.h"
-#include "AliLog.h"
#include <TArrayI.h>
#include <float.h>
return;
}
- AliMUONContour* contour = h->GetContour(ContourName());
-
- if (!contour)
- {
- contour = h->GenerateManuContour(fDetElemId,
- fManuId,
- Attributes(),
- ContourName());
- }
+ TString name = AliMUONManuContourMaker::ManuPathName(detElemId, manuId);
+ AliMUONContour* contour = h->GetContour(name.Data());
+
if (!contour)
{
- AliFatal(Form("Could not get manuId %04d from DE %04d",manuId,detElemId));
+ AliError(Form("Could not get manuId %04d from DE %04d (name=%s)",manuId,detElemId,name.Data()));
}
SetContour(contour);
#include "AliCDBManager.h"
#include "AliCodeTimer.h"
#include "AliLog.h"
+#include "AliMUONChamberPainter.h"
+#include "AliMUONDEPainter.h"
#include "AliMUONPainterDataRegistry.h"
#include "AliMUONPainterDataSourceFrame.h"
#include "AliMUONPainterEnv.h"
}
fMainFrame = new TGMainFrame(gClient->GetRoot(),w,h);
-
+
+ AliMUONPainterHelper::Instance()->GenerateDefaultMatrices();
+
CreateMenuBar(w);
const Int_t kbs = 2;
cout << " Welcome to mchview" << endl;
cout << " " << FullVersion() << endl;
cout << "***************************************************" << endl;
+
+ // Trying to see if we're requested to draw something specific instead
+ // of the global view of all the chambers
+
+ AliMUONVPainter* painter(0x0);
+ TObjArray args;
+ args.SetOwner(kTRUE);
+
+ for ( int i = 1; i < argc[0]; ++i )
+ {
+ args.Add(new TObjString(argv[i]));
+ }
+
+ for ( Int_t i = 0; i <= args.GetLast(); ++i )
+ {
+ TString a(static_cast<TObjString*>(args.At(i))->String());
+ AliMUONAttPainter att;
+
+ att.SetPlane(kTRUE,kFALSE);
+ att.SetCathode(kFALSE,kFALSE);
+ att.SetViewPoint(kTRUE,kFALSE);
+
+ if ( a == "--de" )
+ {
+ Int_t detElemId = static_cast<TObjString*>(args.At(i+1))->String().Atoi();
+
+ painter = new AliMUONDEPainter(att,detElemId);
+
+ painter->SetOutlined("*",kFALSE);
+ painter->SetOutlined("BUSPATCH",kTRUE);
+
+ painter->SetLine(1,4,3);
+ ++i;
+ }
+
+ if ( a == "--chamber" )
+ {
+ Int_t chamberId = static_cast<TObjString*>(args.At(i+1))->String().Atoi();
+
+ painter = new AliMUONChamberPainter(att,chamberId-1);
+
+ painter->SetOutlined("*",kFALSE);
+ painter->SetOutlined("DE",kTRUE);
+
+ painter->SetLine(1,4,3);
+ ++i;
+ }
+
+ }
+
+ if ( painter )
+ {
+ fPainterMasterFrame->ShiftClicked(painter,0x0);
+
+ fPainterMasterFrame->Update();
+ }
+
}
//______________________________________________________________________________
TGTextView* rn = new TGTextView(t);
+ rn->AddLine("1.00");
+ rn->AddLine("");
+ rn->AddLine("Added the Status and StatusMap as a possible OCDB data source");
+ rn->AddLine("");
+ rn->AddLine("Added one (computed) dimension to the Gains data source = 1/a1/0.2 (mV/fC)");
+ rn->AddLine("");
+
+
+ rn->AddLine("0.99a");
+ rn->AddLine("");
+ rn->AddLine("Added the --de and --chamber options");
+ rn->AddLine("");
+
rn->AddLine("0.99");
rn->AddLine("");
rn->AddLine("The chamberid in the label (top right of panel) is now starting at 1 as in common usage");
void HandleMenu(Int_t i);
/// Return the version number of the mchview application
- static const char* Version() { return "0.98"; }
+ static const char* Version() { return "1.00"; }
/// Return the SVN revision and version number of the mchview application
static const char* FullVersion() { return Form("mchview Version %s ($Id$)",Version()); }
fOCDBTypes->AddEntry("Capacitances",2);
fOCDBTypes->AddEntry("HV",3);
fOCDBTypes->AddEntry("Occupancy",4);
+ fOCDBTypes->AddEntry("StatusMap",5);
+ fOCDBTypes->AddEntry("Status",6);
fOCDBTypes->Select(0);
fOCDBTypes->Resize(100,20);
#include "AliCodeTimer.h"
#include "AliLog.h"
#include "AliMUONContour.h"
+#include "AliMUONContourHandler.h"
#include "AliMUONContourMaker.h"
#include "AliMUONGeometryDetElement.h"
#include "AliMUONGeometryTransformer.h"
#include "AliMUONPainterEnv.h"
#include "AliMUONPainterMatrix.h"
#include "AliMUONPainterRegistry.h"
+#include "AliMUONPadStatusMaker.h"
#include "AliMUONVCalibParam.h"
#include "AliMUONVDigit.h"
#include "AliMUONVTrackerData.h"
//_____________________________________________________________________________
AliMUONPainterHelper::AliMUONPainterHelper() :
TObject(),
-fExplodedGlobalTransformations(0x0),
-fRealGlobalTransformations(0x0),
fPainterMatrices(0x0),
fEnv(0x0),
-fAllContours(20000,1)
+fReal(0x0),
+fExploded(0x0)
{
- /// ctor
+ /// ctor
- fAllContours.SetOwnerKeyValue(kTRUE,kTRUE);
+ if ( ! AliMpCDB::LoadMpSegmentation() )
+ {
+ AliFatal("Could not access mapping from OCDB !");
+ }
- fExplodeFactor[0] = 1.00;
- fExplodeFactor[1] = 1.50;
-
- if ( ! AliMpCDB::LoadMpSegmentation() )
- {
- AliFatal("Could not access mapping from OCDB !");
- }
-
- // Load DDL store
- if ( ! AliMpCDB::LoadDDLStore() )
- {
- AliFatal("Could not access DDL Store from OCDB !");
- }
+ // Load DDL store
+ if ( ! AliMpCDB::LoadDDLStore() )
+ {
+ AliFatal("Could not access DDL Store from OCDB !");
+ }
+
+ fExploded = new AliMUONContourHandler(kTRUE);
}
//_____________________________________________________________________________
AliMUONPainterHelper::~AliMUONPainterHelper()
{
/// dtor
- delete fExplodedGlobalTransformations;
- delete fRealGlobalTransformations;
delete fPainterMatrices;
+ delete fReal;
+ delete fExploded;
fEnv->Save();
fgInstance = 0;
}
//_____________________________________________________________________________
AliMUONContour*
-AliMUONPainterHelper::GetContour(const char* contourName) const
+AliMUONPainterHelper::GetContour(const char* contourName, Bool_t explodedView) const
{
/// Get a contour by name
- return static_cast<AliMUONContour*>(fAllContours.GetValue(contourName));
+ if (explodedView)
+ {
+ return fExploded->GetContour(contourName);
+ }
+ else
+ {
+ if ( fReal )
+ {
+ return fReal->GetContour(contourName);
+ }
+ }
+ return 0x0;
}
//_____________________________________________________________________________
AliMUONAttPainter att;
att.SetViewPoint(kTRUE,kFALSE);
- att.SetPlane(kFALSE,kFALSE);
- att.SetCathode(kTRUE,kFALSE);
-
att.SetCathode(kFALSE,kFALSE);
att.SetPlane(kTRUE,kFALSE);
attributes.Add(new AliMUONAttPainter(att));
-// commented the lines below, as it's now fast enough to be created on the fly,
-// only when requested by the user
-//
-// attributes.Add(new AliMUONAttPainter(att));
-// att.SetCathode(kFALSE,kTRUE);
-// attributes.Add(new AliMUONAttPainter(att));
-// att.SetPlane(kFALSE,kTRUE);
-// attributes.Add(new AliMUONAttPainter(att));
-
TIter next(&attributes);
AliMUONAttPainter* a;
}
}
-//_____________________________________________________________________________
-void
-AliMUONPainterHelper::GenerateGeometry()
-{
- /// Generate the geometry (FIXME: using transform.dat for the moment)
- /// The geometry is not the "normal" one as we "explode" it to avoid
- /// having overlapping detection elements as in the reality, which
- /// would be inconvenient for a display ;-)
-
- AliCodeTimerAuto("");
-
- AliMUONGeometryTransformer transformer;
- transformer.LoadGeometryData("transform.dat");
- fExplodedGlobalTransformations = new AliMpExMap;
- fRealGlobalTransformations = new AliMpExMap;
- AliMpDEIterator deIt;
- deIt.First();
- while ( !deIt.IsDone() )
- {
- Int_t detElemId = deIt.CurrentDEId();
- const AliMUONGeometryDetElement* de = transformer.GetDetElement(detElemId);
-
- fRealGlobalTransformations->Add(detElemId,de->GetGlobalTransformation()->Clone());
-
- TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(de->GetGlobalTransformation()->Clone());
- Double_t* translation = matrix->GetTranslation();
-
- AliDebug(1,Form("Initial translation for DE %04d is %7.3f, %7.3f",
- detElemId,translation[0],translation[1]));
-
- if ( AliMpDEManager::GetStationType(detElemId) == AliMp::kStation345 )
- {
- translation[0] *= fExplodeFactor[0];
- translation[1] *= fExplodeFactor[1];
- }
- else
- {
- Double_t shift = 5; // cm
- Double_t xshift[] = { shift, -shift, -shift, shift };
- Double_t yshift[] = { shift, shift, -shift, -shift };
- Int_t ishift = detElemId % 100;
-
- translation[0] += xshift[ishift];
- translation[1] += yshift[ishift];
- }
- matrix->SetTranslation(translation);
- fExplodedGlobalTransformations->Add(detElemId,matrix);
- deIt.Next();
- }
-}
-
-//_____________________________________________________________________________
-AliMUONContour*
-AliMUONPainterHelper::GenerateManuContour(Int_t detElemId,
- Int_t manuId,
- AliMUONAttPainter viewType,
- const char* contourName)
-{
- /// Generate the contour of the list of pads
-
- static AliMUONManuContourMaker maker(fExplodedGlobalTransformations);
-
- if ( viewType.IsBackView() )
- {
- AliError("Backview not implemented yet (and will probably never be, after all...)");
- return 0x0;
- }
-
- AliMUONContour* contour = maker.CreateManuContour(detElemId,manuId,contourName);
-
- if ( !contour ) return 0x0;
-
- AliMUONContour* pContour = new AliMUONContour(*contour);
-
- if (pContour)
- {
- RegisterContour(pContour);
- }
-
- return pContour;
-}
-
//_____________________________________________________________________________
AliMp::CathodType
AliMUONPainterHelper::GetCathodeType(Int_t detElemId, Int_t manuId) const
AliMUONPainterHelper::GetMotifPosition(Int_t detElemId, Int_t manuId) const
{
/// Get a given motif position
- AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
- if ( stationType == AliMp::kStation345 )
- {
- AliMp::PlaneType planeType(AliMp::kBendingPlane);
- if ( manuId & AliMpConstants::ManuMask(AliMp::kNonBendingPlane) )
- {
- planeType = AliMp::kNonBendingPlane;
- }
- const AliMpSlat* slat = GetSlat(detElemId,planeType);
- return slat->FindMotifPosition(manuId);
- }
- else if ( stationType != AliMp::kStationTrigger )
+ const AliMpVSegmentation* vseg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
+ if (vseg)
{
- AliMp::PlaneType planeType(AliMp::kBendingPlane);
- if ( manuId & AliMpConstants::ManuMask(AliMp::kNonBendingPlane) )
- {
- planeType = AliMp::kNonBendingPlane;
- }
- const AliMpSector* sector = GetSector(detElemId,planeType);
- return sector->GetMotifMap()->FindMotifPosition(manuId);
+ return vseg->MotifPosition(manuId);
}
- AliFatalClass("Not supposed to work with trigger");
return 0x0;
}
-
//_____________________________________________________________________________
AliMpPCB*
AliMUONPainterHelper::GetPCB(Int_t detElemId, AliMp::CathodType cathodeType,
AliCodeTimerAutoClass("");
fgInstance = new AliMUONPainterHelper;
- fgInstance->GenerateGeometry();
- fgInstance->GenerateDefaultMatrices();
fgInstance->fEnv = new AliMUONPainterEnv;
return fgInstance;
}
{
/// Local to global transformation of coordinates
- TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(fExplodedGlobalTransformations->GetValue(detElemId));
- Double_t pg[3] = { xg, yg, zg };
- Double_t pl[3] = { 0., 0., 0. };
- matrix->MasterToLocal(pg, pl);
- xl = pl[0];
- yl = pl[1];
- zl = pl[2];
-}
-
-//_____________________________________________________________________________
-void
-AliMUONPainterHelper::Global2LocalReal(Int_t detElemId,
- Double_t xg, Double_t yg, Double_t zg,
- Double_t& xl, Double_t& yl, Double_t& zl) const
-{
- /// Local to global transformation of coordinates
-
- TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(fRealGlobalTransformations->GetValue(detElemId));
+ TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(fExploded->GetTransformations()->GetValue(detElemId));
Double_t pg[3] = { xg, yg, zg };
Double_t pl[3] = { 0., 0., 0. };
matrix->MasterToLocal(pg, pl);
{
/// Local to (exploded) global transformation of coordinates
- TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(fExplodedGlobalTransformations->GetValue(detElemId));
- Double_t pl[3] = { xl, yl, zl };
- Double_t pg[3] = { 0., 0., 0. };
- matrix->LocalToMaster(pl, pg);
- xg = pg[0];
- yg = pg[1];
- zg = pg[2];
-}
-
-//_____________________________________________________________________________
-void
-AliMUONPainterHelper::Local2GlobalReal(Int_t detElemId,
- Double_t xl, Double_t yl, Double_t zl,
- Double_t& xg, Double_t& yg, Double_t& zg) const
-{
- /// Local to (real) global transformation of coordinates
-
- TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(fRealGlobalTransformations->GetValue(detElemId));
+ TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(fExploded->GetTransformations()->GetValue(detElemId));
Double_t pl[3] = { xl, yl, zl };
Double_t pg[3] = { 0., 0., 0. };
matrix->LocalToMaster(pl, pg);
//_____________________________________________________________________________
AliMUONContour*
-AliMUONPainterHelper::MergeContours(const TObjArray& contours,
- const char* contourName)
+AliMUONPainterHelper::MergeContours(const TObjArray& contours, const char* contourName, Bool_t explodedGeometry)
{
/// Merge a set of contours (delegating to the contour maker)
if (contour)
{
- RegisterContour(contour);
+ RegisterContour(contour,explodedGeometry);
}
return contour;
}
if ( sopt.Length() == 0 )
{
- cout << Form("ExplodeFactor=%e,%e",fExplodeFactor[0],fExplodeFactor[1]) << endl;
- cout << endl;
- cout << Form("GlobalTransformations=%x",fExplodedGlobalTransformations);
- if ( fExplodedGlobalTransformations ) cout << Form(" with %d transformations",fExplodedGlobalTransformations->GetSize());
- cout << endl;
- cout << Form("Contour map : collisions = %5.3f size = %d capacity = %d",
- fAllContours.AverageCollisions(),
- fAllContours.GetSize(),
- fAllContours.Capacity()) << endl;
- cout << endl;
+ if ( fExploded ) fExploded->Print();
+ if ( fReal ) fReal->Print();
}
- if ( sopt.Contains("MATRI") || sopt.Contains("FULL") )
+ if ( fPainterMatrices && ( sopt.Contains("MATRI") || sopt.Contains("FULL") ) )
{
fPainterMatrices->Print(opt);
}
//_____________________________________________________________________________
void
-AliMUONPainterHelper::RegisterContour(AliMUONContour* contour)
+AliMUONPainterHelper::RegisterContour(AliMUONContour* contour, Bool_t explodedView)
{
/// contour is adopted by contourMaker
AliCodeTimerAuto("")
AliDebug(1,contour->GetName());
- if ( fAllContours.GetValue(contour->GetName()) )
+ AliMUONContourHandler* ch = fReal;
+ if ( explodedView )
{
- AliError(Form("Contour with name %s is already there",contour->GetName()));
-// Print("CONTOUR");
- return;
+ ch = fExploded;
+ }
+ if (!ch)
+ {
+ AliError(Form("ContourHandler for %s view is not created yet !",explodedView ? "EXPLODED" : "REAL"));
+ }
+ else
+ {
+ if ( ch->GetContour(contour->GetName()) )
+ {
+ AliError(Form("Contour with name %s is already there",contour->GetName()));
+ return;
+ }
+ ch->Adopt(contour);
}
- fAllContours.Add(new TObjString(contour->GetName()),contour);
-}
-
-//_____________________________________________________________________________
-AliMpPad
-AliMUONPainterHelper::PadByExplodedPosition(Int_t detElemId, Int_t manuId,
- Double_t x, Double_t y) const
-{
- /// Find a pad by exploded position. FIXME: not really used nor tested !
-
- Double_t xr, yr, zr;
-
-// Local2Global(detElemId,0.0,0.0,0.0,dummy,dummy,z); // to find z
-
- AliDebug(1,Form("DE %04d ManuID %04d x %7.3f y %7.3f",detElemId,manuId,x,y));
-
- Exploded2Real(detElemId,x,y,0,xr,yr,zr);
-
- AliDebug(1,Form("xr %7.3f yr %7.3f zr %7.3f",xr,yr,zr));
-
- Double_t xl,yl,zl;
-
- Global2LocalReal(detElemId,xr,yr,zr,xl,yl,zl);
-
- AliDebug(1,Form("xl %7.3f yl %7.3f zl %7.3f",xl,yl,zl));
-
- const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
-
- AliDebug(1,Form("dx,dy=%7.3f,%7.3f",seg->GetDimensionX(),seg->GetDimensionY()));
-
- return seg->PadByPosition(xl,yl);
-}
-
-//_____________________________________________________________________________
-void
-AliMUONPainterHelper::Exploded2Real(Int_t detElemId,
- Double_t xe, Double_t ye, Double_t ze,
- Double_t& xr, Double_t& yr, Double_t& zr) const
-{
- /// Convert exploded coordinates into real ones. FIXME: not really used nor tested !
-
- // first go back to local
-
- Double_t xl,yl,zl;
-
- Global2Local(detElemId,xe,ye,ze,xl,yl,zl);
-
- // and then back to global but not exploded
-
- Local2GlobalReal(detElemId,xl,yl,zl,xr,yr,zr);
}
//_____________________________________________________________________________
/// Format a double value to be displayed
/// FIXME: should insure we have the right number of significant digits here...
- return Form("%s = %e",name,value);
+ TString sname(name);
+
+ sname.ToUpper();
+ if (sname.Contains("BIT"))
+ {
+ Int_t i = (Int_t)(value);
+ TString rv = Form("%s = 0x%x",name,i);
+ cout << rv << ":" << AliMUONPadStatusMaker::AsString(i) << endl;
+ return rv;
+ }
+ else
+ {
+ return Form("%s = %e",name,value);
+ }
+}
+
+//_____________________________________________________________________________
+TObjArray*
+AliMUONPainterHelper::GetAllContoursAsArray(Bool_t explodedView) const
+{
+ /// Get the contours in a specially arranged array (orderer by hierarchy level)
+
+ if ( explodedView ) return fExploded->AllContourArray(); // fExploded should always be created
+
+ if (!fReal) fReal = new AliMUONContourHandler(kFALSE); // fReal might be first asked here.
+
+ return fReal->AllContourArray();
}
+
# include "AliMpPad.h"
#endif
-#ifndef ROOT_TMap
-# include "TMap.h"
-#endif
-
class AliMUONAttPainter;
class AliMUONContour;
+class AliMUONContourHandler;
class AliMUONPainterEnv;
class AliMUONVCalibParam;
class AliMUONVTrackerData;
class AliMpSlat;
class TArrayI;
class TList;
-class TMap;
class TObjArray;
class AliMUONPainterHelper : public TObject
AliMp::CathodType GetCathodeType(Int_t detElemId, Int_t manuId) const;
- AliMUONContour* GenerateManuContour(Int_t detElemId, Int_t manuId,
- AliMUONAttPainter viewType,
- const char* contourName);
-
- AliMUONContour* GetContour(const char* contourName) const;
+ AliMUONContour* GetContour(const char* contourName, Bool_t explodedGeometry=kTRUE) const;
/// Return a contour by name
AliMUONContour* GetContour(const TString& contourName) const { return GetContour(contourName.Data()); }
static AliMUONPainterHelper* Instance();
- AliMpPad PadByExplodedPosition(Int_t detElemId, Int_t manuId, Double_t x, Double_t y) const;
-
- void Exploded2Real(Int_t detElemId, Double_t xe, Double_t ye, Double_t ze,
- Double_t& xr, Double_t& yr, Double_t& zr) const;
-
void Local2Global(Int_t detElemId, Double_t xl, Double_t yl, Double_t zl,
Double_t& xg, Double_t& yg, Double_t& zg) const;
- void Local2GlobalReal(Int_t detElemId, Double_t xl, Double_t yl, Double_t zl,
- Double_t& xg, Double_t& yg, Double_t& zg) const;
-
void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
Double_t& xl, Double_t& yl, Double_t& zl) const;
- void Global2LocalReal(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
- Double_t& xl, Double_t& yl, Double_t& zl) const;
-
- AliMUONContour* MergeContours(const TObjArray& contours,
- const char* contourName);
+ AliMUONContour* MergeContours(const TObjArray& contours, const char* contourName, Bool_t explodedGeometry=kTRUE);
virtual void Print(Option_t* opt="") const;
- void RegisterContour(AliMUONContour* contour);
+ void RegisterContour(AliMUONContour* contour, Bool_t explodedView=kTRUE);
TString FormatValue(const char* name, Double_t value) const;
/// Return the environment
AliMUONPainterEnv* Env() { return fEnv; }
+ TObjArray* GetAllContoursAsArray(Bool_t explodedView=kTRUE) const;
+
+ void GenerateDefaultMatrices();
+
private:
/// Not implemented
/// Not implemented
AliMUONPainterHelper& operator=(const AliMUONPainterHelper&);
- void GenerateDefaultMatrices();
- void GenerateGeometry();
-
private:
static AliMUONPainterHelper* fgInstance; ///< global instance
- Double_t fExplodeFactor[2]; ///< explosing factors for representation
- AliMpExMap* fExplodedGlobalTransformations; ///< global geometric transformations (exploded)
- AliMpExMap* fRealGlobalTransformations; ///< global geometric transformations (real)
TObjArray* fPainterMatrices; ///< default matrices
AliMUONPainterEnv* fEnv; ///< resources
- TMap fAllContours; ///< all contours
+ mutable AliMUONContourHandler* fReal; ///< contours in real coordinates
+ AliMUONContourHandler* fExploded; ///< contours in exploded coordinates
- ClassDef(AliMUONPainterHelper,2) // Helper class for painters
+ ClassDef(AliMUONPainterHelper,3) // Helper class for painters
};
#endif
AliMUONVStore* gains = new AliMUON2DMap(kTRUE);
TString comment;
AliMUONTrackerIO::ReadGains(filename.Data(),*gains,comment);
- store = AliMUONTrackerOCDBDataMaker::SplitQuality(*gains);
+ store = AliMUONTrackerOCDBDataMaker::PatchGainStore(*gains);
delete gains;
}
else if ( stype == "CAPACITANCES" )
#include "AliLog.h"
#include "AliMUON2DMap.h"
#include "AliMUONCalibParamND.h"
+#include "AliMUONCalibParamNI.h"
#include "AliMUONCalibrationData.h"
+#include "AliMUONDigitCalibrator.h"
+#include "AliMUONPadStatusMapMaker.h"
#include "AliMUONTrackerData.h"
#include "AliMUONVStore.h"
#include "AliMpConstants.h"
#include "AliMpDetElement.h"
#include "AliMpDEManager.h"
#include "AliMpDCSNamer.h"
+#include "AliMpManuIterator.h"
+#include "Riostream.h"
#include <TClass.h>
#include <TMap.h>
#include <TObjArray.h>
}
else if ( stype == "GAINS" )
{
- AliMUONVStore* gains = AliMUONCalibrationData::CreateGains(runNumber,&startOfValidity);
+ AliMUONVStore* gains = AliMUONCalibrationData::CreateGains(runNumber,&startOfValidity);
+ store = PatchGainStore(*gains);
+ delete gains;
fData = CreateDataGains(startOfValidity);
- store = SplitQuality(*gains);
- delete gains;
}
else if ( stype == "CAPACITANCES" )
{
store = CreateHVStore(*m);
delete m;
}
-
+ else if ( stype == "STATUSMAP" )
+ {
+ fData = new AliMUONTrackerData(Form("STATUSMAP%d",runNumber),"Status map",2,kTRUE);
+ fData->SetDimensionName(0,"Bits");
+ fData->SetDimensionName(1,"Dead");
+ store = CreateStatusMapStore(runNumber);
+ }
+ else if ( stype == "STATUS" )
+ {
+ fData = new AliMUONTrackerData(Form("STATUS%d",runNumber),"Status",1,kTRUE);
+ fData->SetDimensionName(0,"Bits");
+ store = CreateStatusStore(runNumber);
+ }
+
AliCDBManager::Instance()->SetDefaultStorage(storage);
if (!store)
{
/// Create data to hold gains values
- AliMUONVTrackerData* data = new AliMUONTrackerData(Form("GAIN%d",runNumber),"Gains",6,kTRUE);
- data->SetDimensionName(0,"a1");
- data->SetDimensionName(1,"a2");
- data->SetDimensionName(2,"thres");
- data->SetDimensionName(3,"qual1");
- data->SetDimensionName(4,"qual2");
- data->SetDimensionName(5,"sat");
+ AliMUONVTrackerData* data = new AliMUONTrackerData(Form("GAIN%d",runNumber),"Gains",7,kTRUE);
+ data->SetDimensionName(0,"gain");
+ data->SetDimensionName(1,"a1");
+ data->SetDimensionName(2,"a2");
+ data->SetDimensionName(3,"thres");
+ data->SetDimensionName(4,"qual1");
+ data->SetDimensionName(5,"qual2");
+ data->SetDimensionName(6,"sat");
return data;
}
+//_____________________________________________________________________________
+AliMUONVStore*
+AliMUONTrackerOCDBDataMaker::PatchGainStore(AliMUONVStore& gains)
+{
+ /// Polish the gain store :
+ /// a) adding a dimension, computed from a1, and called gain = 1/a1/0.2
+ /// where 0.2 is internal capa in pF, and gain is then in mV/fC
+ /// b) splitting the quality in two
+
+ AliMUONVStore* store = gains.Create();
+
+ TIter next(gains.CreateIterator());
+ AliMUONVCalibParam* param;
+
+ while ( ( param = static_cast<AliMUONVCalibParam*>(next()) ) )
+ {
+ AliMUONVCalibParam* nd = new AliMUONCalibParamND(param->Dimension()+2,
+ param->Size(),
+ param->ID0(),
+ param->ID1());
+ for ( Int_t i = 0; i < param->Size(); ++i )
+ {
+
+ Int_t qual = param->ValueAsInt(i,3);
+ Int_t q1 = (qual & 0xF0) >> 4; // linear fit quality
+ Int_t q2 = qual & 0xF; // parabolic fit quality
+ Double_t gain = 0.0;
+
+ if ( param->ValueAsFloat(i,0) > 1E-9 ) gain = 1.0/param->ValueAsFloat(i,0)/0.2;
+
+ nd->SetValueAsDouble(i,0,gain); // gain
+ nd->SetValueAsDouble(i,1,param->ValueAsFloat(i,0)); // a1
+ nd->SetValueAsDouble(i,2,param->ValueAsFloat(i,1)); // a2
+ nd->SetValueAsInt(i,3,param->ValueAsInt(i,2)); // thres
+ nd->SetValueAsInt(i,4,q1); // qual1
+ nd->SetValueAsInt(i,5,q2); // qual2
+ nd->SetValueAsInt(i,6,param->ValueAsInt(i,4)); // sat
+ }
+ store->Add(nd);
+ }
+
+ return store;
+}
+
//_____________________________________________________________________________
AliMUONVTrackerData*
AliMUONTrackerOCDBDataMaker::CreateDataPedestals(Int_t runNumber)
return data;
}
+//_____________________________________________________________________________
+AliMUONVStore*
+AliMUONTrackerOCDBDataMaker::CreateStatusStore(Int_t runNumber)
+{
+ /// Get the status store
+
+ AliMUONDigitCalibrator calibrator(runNumber);
+
+ AliMUONVStore* sm = new AliMUON2DMap(kTRUE);
+
+ AliMpManuIterator it;
+ Int_t detElemId, manuId;
+
+ while (it.Next(detElemId,manuId))
+ {
+ AliMUONVCalibParam* np = new AliMUONCalibParamNI(1,AliMpConstants::ManuNofChannels(),detElemId,manuId);
+ for ( Int_t i = 0; i < np->Size(); ++i )
+ {
+ Int_t value = calibrator.PadStatus(detElemId,manuId,i);
+ np->SetValueAsInt(i,0,value); // "raw" value of the status
+ }
+ sm->Add(np);
+ }
+
+ return sm;
+}
+
+//_____________________________________________________________________________
+AliMUONVStore*
+AliMUONTrackerOCDBDataMaker::CreateStatusMapStore(Int_t runNumber)
+{
+ /// Get the status map, and polish it a bit for representation purposes
+
+ AliMUONDigitCalibrator calibrator(runNumber);
+
+ AliMUONVStore* sm = new AliMUON2DMap(kTRUE);
+
+ AliMpManuIterator it;
+ Int_t detElemId, manuId;
+
+ while (it.Next(detElemId,manuId))
+ {
+ AliMUONVCalibParam* np = new AliMUONCalibParamNI(2,AliMpConstants::ManuNofChannels(),detElemId,manuId);
+ for ( Int_t i = 0; i < np->Size(); ++i )
+ {
+ Int_t value = calibrator.StatusMap(detElemId,manuId,i);
+ Int_t channelIsDead = ( value & AliMUONPadStatusMapMaker::SelfDeadMask() );
+ np->SetValueAsInt(i,0,value); // "raw" value of the status map
+ np->SetValueAsInt(i,1,channelIsDead); // simple 0 or 1 for this channel
+ }
+ sm->Add(np);
+ }
+
+ return sm;
+}
+
//_____________________________________________________________________________
AliMUONVStore*
AliMUONTrackerOCDBDataMaker::CreateHVStore(TMap& m)
AliError("Not implemented. Does it have sense ?");
return 0;
}
-
-//_____________________________________________________________________________
-AliMUONVStore*
-AliMUONTrackerOCDBDataMaker::SplitQuality(const AliMUONVStore& gains)
-{
- /// Create a new store, identical to source gain store, except that qual
- /// dimension is "decompacted" in two separated values
-
- AliMUONVStore* store = gains.Create();
-
- TIter next(gains.CreateIterator());
- AliMUONVCalibParam* param;
-
- while ( ( param = static_cast<AliMUONVCalibParam*>(next()) ) )
- {
- AliMUONVCalibParam* nd = new AliMUONCalibParamND(param->Dimension()+1,
- param->Size(),
- param->ID0(),
- param->ID1());
- for ( Int_t i = 0; i < param->Size(); ++i )
- {
- for ( Int_t k = 0; k < param->Dimension(); ++k )
- {
- if ( k == 3 ) continue;
- Int_t m = ( k < 3 ? k : k+1 ) ;
- nd->SetValueAsDouble(i,m,param->ValueAsFloat(i,k));
- }
- Int_t qual = param->ValueAsInt(i,3);
-
- Int_t q1 = (qual & 0xF0) >> 4; // linear fit quality
- Int_t q2 = qual & 0xF; // parabolic fit quality
-
- nd->SetValueAsInt(i,3,q1);
- nd->SetValueAsInt(i,4,q2);
- }
- store->Add(nd);
- }
- return store;
-}
virtual Long64_t Merge(TCollection* li);
static AliMUONVStore* CreateHVStore(TMap& hvMap);
- static AliMUONVStore* SplitQuality(const AliMUONVStore& gains);
static AliMUONVTrackerData* CreateDataPedestals(Int_t runNumber);
static AliMUONVTrackerData* CreateDataGains(Int_t runNumber);
static AliMUONVTrackerData* CreateDataCapacitances(Int_t runNumber);
+ static AliMUONVStore* CreateStatusMapStore(Int_t runNumber);
+ static AliMUONVStore* CreateStatusStore(Int_t runNumber);
+
+ static AliMUONVStore* PatchGainStore(AliMUONVStore& gains);
+
private:
/// Not implemented
AliMUONTrackerOCDBDataMaker(const AliMUONTrackerOCDBDataMaker& rhs);
void SetOutlined(const char* pattern, Bool_t flag);
- void SetResponder(const char* pattern);
+ virtual void SetResponder(const char* pattern);
- void SetResponder(Int_t depth);
+ virtual void SetResponder(Int_t depth);
void SetVisible(const char* pattern, Bool_t flag);
AliMUONPainterGroup* CreateGroup(const char* type, Int_t depth);
+protected:
void CreateGroups();
+
+private:
void GetBoundingBox(Double_t& x1, Double_t& y1,
Double_t& x2, Double_t& y2) const;
AliMUONVPainter* fMother; ///< our mother
AliMUONPainterGroup* fGroup; ///< our group
AliMUONContour* fContour; ///< our contour
+protected:
TMap* fPainterGroups; ///< map of groups
+private:
TObjArray* fChildren; ///< our children
+protected:
AliMUONPainterGroup* fResponderGroup; ///< the responder group
+private:
AliMUONPainterGroup* fPlotterGroup; ///< the plotter group
Double_t fBorderFactor; ///< border factor for visu
TVirtualPad* fPad; ///< the pad we're drawn in
#pragma link C++ class AliMUONNode+;
#pragma link C++ class AliMUONPointWithRef+;
#pragma link C++ class AliMUONContourMakerTest+;
+#pragma link C++ class AliMUONContourHandler+;
#endif
AliMUONSegmentTree.cxx \
AliMUONNode.cxx \
AliMUONPointWithRef.cxx \
- AliMUONContourMakerTest.cxx
+ AliMUONContourMakerTest.cxx \
+ AliMUONContourHandler.cxx
HDRS:= $(SRCS:.cxx=.h)
#include "AliMpDataMap.h"
#include "AliMpDataStreams.h"
#include "AliMpDDLStore.h"
-
+#include "AliMpManuStore.h"
//______________________________________________________________________________
Int_t Usage()
cout << " --geometry #x#+#+# : manually specify the geometry of the window, ala X11..., e.g. --geometry 1280x900+1600+0 will" << endl;
cout << " get a window of size 1280x900, located at (1600,0) from the top-left of the (multihead) display " << endl;
cout << " --asciimapping : load mapping from ASCII files instead of OCDB (for debug and experts only...)" << endl;
+ cout << " --de detElemId : start by displaying the given detection element instead of the default view (which is all the chambers)" << endl;
+ cout << " --chamber chamberId (from 1 to 10) : start by displaying the given chamber instead of the default view (which is all the chambers)" << endl;
return -1;
}
}
else if ( a == "--asciimapping" )
{
+ ++nok;
ASCIImapping = kTRUE;
}
-
+ else if ( a == "--de" || a == "--chamber" )
+ {
+ // do nothing. Let AliMUONMchViewApplication handle that one. (and the next one as well).
+ nok += 2;
+ ++i;
+ }
else
{
return Usage();
if ( ASCIImapping )
{
AliMpDataProcessor mp;
- AliMpDataMap* map = mp.CreateDataMap("data");
- AliMpDataStreams dataStreams(map);
- AliMpDDLStore::ReadData(dataStreams);
+ {
+ AliMpDataMap* datamap = mp.CreateDataMap("data");
+ AliMpDataStreams dataStreams(datamap);
+ AliMpDDLStore::ReadData(dataStreams);
+ }
+ {
+ AliMpDataMap* datamap = mp.CreateDataMap("data_run");
+ AliMpDataStreams dataStreams(datamap);
+ AliMpManuStore::ReadData(dataStreams);
+ }
+
+ AliCDBManager::Instance()->SetSpecificStorage("MUON/Calib/Neighbours","local://$ALICE_ROOT/OCDB");
+
}
gROOT->SetStyle("Plain");